Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index f155ae9..ae7326b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2853=['limit','Content-Range','json','save','destroy','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','params','keys','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset'];(function(_0x4bed89,_0x423fef){var _0x359a70=function(_0xf4626f){while(--_0xf4626f){_0x4bed89['push'](_0x4bed89['shift']());}};_0x359a70(++_0x423fef);}(_0x2853,0x148));var _0x3285=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x2853[_0x42f009];return _0x22a1e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3285('0x0'));var rimraf=require(_0x3285('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3285('0x2'));var rp=require(_0x3285('0x3'));var moment=require(_0x3285('0x4'));var BPromise=require(_0x3285('0x5'));var Mustache=require(_0x3285('0x6'));var util=require(_0x3285('0x7'));var path=require(_0x3285('0x8'));var sox=require(_0x3285('0x9'));var csv=require('to-csv');var ejs=require(_0x3285('0xa'));var fs=require('fs');var _=require(_0x3285('0xb'));var squel=require(_0x3285('0xc'));var crypto=require(_0x3285('0xd'));var jsforce=require(_0x3285('0xe'));var deskjs=require(_0x3285('0xf'));var toCsv=require(_0x3285('0x10'));var querystring=require(_0x3285('0x11'));var Papa=require(_0x3285('0x12'));var Redis=require(_0x3285('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3285('0x14'));var as=require(_0x3285('0x15'));var hardwareService=require(_0x3285('0x16'));var logger=require(_0x3285('0x17'))(_0x3285('0x18'));var utils=require(_0x3285('0x19'));var config=require(_0x3285('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3285('0x1b'))['db'];function respondWithStatusCode(_0x4f376c,_0x4250a5){_0x4250a5=_0x4250a5||0xcc;return function(_0x185e81){if(_0x185e81){return _0x4f376c['sendStatus'](_0x4250a5);}return _0x4f376c['status'](_0x4250a5)[_0x3285('0x1c')]();};}function respondWithResult(_0x418f65,_0x422903){_0x422903=_0x422903||0xc8;return function(_0x120570){if(_0x120570){return _0x418f65[_0x3285('0x1d')](_0x422903)['json'](_0x120570);}};}function respondWithFilteredResult(_0x531137,_0x462eb5){return function(_0x450f6f){if(_0x450f6f){var _0x53ad19=_0x450f6f[_0x3285('0x1e')],_0x20f1c1=_0x462eb5[_0x3285('0x1f')],_0x12b5d5=_0x462eb5['offset']+_0x462eb5[_0x3285('0x20')],_0x4f4917;if(_0x12b5d5>=_0x53ad19){_0x12b5d5=_0x53ad19;_0x4f4917=0xc8;}else{_0x4f4917=0xce;}_0x531137['status'](_0x4f4917);return _0x531137['set'](_0x3285('0x21'),_0x20f1c1+'-'+_0x12b5d5+'/'+_0x53ad19)[_0x3285('0x22')](_0x450f6f);}return null;};}function patchUpdates(_0x1ddb7b){return function(_0x4f6855){try{jsonpatch['apply'](_0x4f6855,_0x1ddb7b,!![]);}catch(_0x23334e){return BPromise['reject'](_0x23334e);}return _0x4f6855[_0x3285('0x23')]();};}function saveUpdates(_0x206ed1,_0x6f663c){return function(_0x219381){if(_0x219381){return _0x219381['update'](_0x206ed1)['then'](function(_0x391cbd){return _0x391cbd;});}return null;};}function removeEntity(_0x1d976f,_0x4ecba5){return function(_0x3cd110){if(_0x3cd110){return _0x3cd110[_0x3285('0x24')]()['then'](function(){_0x1d976f[_0x3285('0x1d')](0xcc)[_0x3285('0x1c')]();});}};}function handleEntityNotFound(_0x12e175,_0x36d25a){return function(_0x5c4ced){if(!_0x5c4ced){_0x12e175['sendStatus'](0x194);}return _0x5c4ced;};}function handleError(_0x40b06b,_0x75557f){_0x75557f=_0x75557f||0x1f4;return function(_0x1852e1){logger['error'](_0x1852e1[_0x3285('0x25')]);if(_0x1852e1[_0x3285('0x26')]){delete _0x1852e1[_0x3285('0x26')];}_0x40b06b[_0x3285('0x1d')](_0x75557f)[_0x3285('0x27')](_0x1852e1);};}exports[_0x3285('0x28')]=function(_0x1ca802,_0x47d477){var _0x553370={},_0x32072d={},_0x1e735f={'count':0x0,'rows':[]};var _0x505044=_['map'](db[_0x3285('0x29')][_0x3285('0x2a')],function(_0x55ca81){return{'name':_0x55ca81[_0x3285('0x2b')],'type':_0x55ca81['type'][_0x3285('0x2c')]};});_0x32072d[_0x3285('0x2d')]=_['map'](_0x505044,_0x3285('0x26'));_0x32072d['query']=_['keys'](_0x1ca802[_0x3285('0x2e')]);_0x32072d['filters']=_[_0x3285('0x2f')](_0x32072d[_0x3285('0x2d')],_0x32072d['query']);_0x553370[_0x3285('0x30')]=_['intersection'](_0x32072d[_0x3285('0x2d')],qs['fields'](_0x1ca802[_0x3285('0x2e')][_0x3285('0x31')]));_0x553370[_0x3285('0x30')]=_0x553370[_0x3285('0x30')][_0x3285('0x32')]?_0x553370[_0x3285('0x30')]:_0x32072d[_0x3285('0x2d')];if(!_0x1ca802[_0x3285('0x2e')]['hasOwnProperty'](_0x3285('0x33'))){_0x553370[_0x3285('0x20')]=qs[_0x3285('0x20')](_0x1ca802[_0x3285('0x2e')][_0x3285('0x20')]);_0x553370[_0x3285('0x1f')]=qs['offset'](_0x1ca802[_0x3285('0x2e')][_0x3285('0x1f')]);}_0x553370[_0x3285('0x34')]=qs[_0x3285('0x35')](_0x1ca802['query'][_0x3285('0x35')]);_0x553370[_0x3285('0x36')]=qs[_0x3285('0x37')](_['pick'](_0x1ca802['query'],_0x32072d[_0x3285('0x37')]),_0x505044);if(_0x1ca802[_0x3285('0x2e')][_0x3285('0x38')]){_0x553370[_0x3285('0x36')]=_[_0x3285('0x39')](_0x553370[_0x3285('0x36')],{'$or':_['map'](_0x505044,function(_0x16a1d7){if(_0x16a1d7[_0x3285('0x3a')]!=='VIRTUAL'){var _0x459f81={};_0x459f81[_0x16a1d7['name']]={'$like':'%'+_0x1ca802[_0x3285('0x2e')]['filter']+'%'};return _0x459f81;}})});}_0x553370=_['merge']({},_0x553370,_0x1ca802[_0x3285('0x3b')]);var _0x19aaca={'where':_0x553370['where']};return db[_0x3285('0x29')][_0x3285('0x1e')](_0x19aaca)[_0x3285('0x3c')](function(_0xd60b1f){_0x1e735f[_0x3285('0x1e')]=_0xd60b1f;if(_0x1ca802[_0x3285('0x2e')][_0x3285('0x3d')]){_0x553370[_0x3285('0x3e')]=[{'all':!![]}];}return db[_0x3285('0x29')][_0x3285('0x3f')](_0x553370);})[_0x3285('0x3c')](function(_0x5bf72e){_0x1e735f[_0x3285('0x40')]=_0x5bf72e;return _0x1e735f;})[_0x3285('0x3c')](respondWithFilteredResult(_0x47d477,_0x553370))[_0x3285('0x41')](handleError(_0x47d477,null));};exports['show']=function(_0x4534ca,_0x43fddd){var _0x32217d={'raw':!![],'where':{'id':_0x4534ca[_0x3285('0x42')]['id']}},_0x1f316d={};_0x1f316d[_0x3285('0x2d')]=_[_0x3285('0x43')](db[_0x3285('0x29')][_0x3285('0x2a')]);_0x1f316d[_0x3285('0x2e')]=_[_0x3285('0x43')](_0x4534ca[_0x3285('0x2e')]);_0x1f316d[_0x3285('0x37')]=_['intersection'](_0x1f316d[_0x3285('0x2d')],_0x1f316d[_0x3285('0x2e')]);_0x32217d['attributes']=_[_0x3285('0x2f')](_0x1f316d[_0x3285('0x2d')],qs['fields'](_0x4534ca[_0x3285('0x2e')][_0x3285('0x31')]));_0x32217d[_0x3285('0x30')]=_0x32217d[_0x3285('0x30')]['length']?_0x32217d[_0x3285('0x30')]:_0x1f316d[_0x3285('0x2d')];if(_0x4534ca[_0x3285('0x2e')]['includeAll']){_0x32217d[_0x3285('0x3e')]=[{'all':!![]}];}_0x32217d=_['merge']({},_0x32217d,_0x4534ca[_0x3285('0x3b')]);return db[_0x3285('0x29')]['find'](_0x32217d)[_0x3285('0x3c')](handleEntityNotFound(_0x43fddd,null))[_0x3285('0x3c')](respondWithResult(_0x43fddd,null))[_0x3285('0x41')](handleError(_0x43fddd,null));};exports[_0x3285('0x44')]=function(_0x7fcd8e,_0x479d60){return db[_0x3285('0x29')][_0x3285('0x44')](_0x7fcd8e['body'],{})[_0x3285('0x3c')](respondWithResult(_0x479d60,0xc9))[_0x3285('0x41')](handleError(_0x479d60,null));};exports[_0x3285('0x45')]=function(_0x51cfba,_0x45fed6){return db['CmHopperHistory'][_0x3285('0x45')]()[_0x3285('0x3c')](respondWithResult(_0x45fed6,null))['catch'](handleError(_0x45fed6,null));};exports['update']=function(_0x1bde56,_0x4a2c11){if(_0x1bde56[_0x3285('0x46')][_0x3285('0x47')]){delete _0x1bde56[_0x3285('0x46')][_0x3285('0x47')];}return db[_0x3285('0x29')]['find']({'where':{'uniqueid':_0x1bde56[_0x3285('0x42')]['id']}})[_0x3285('0x3c')](handleEntityNotFound(_0x4a2c11,null))[_0x3285('0x3c')](saveUpdates(_0x1bde56[_0x3285('0x46')],null))['then'](respondWithResult(_0x4a2c11,null))[_0x3285('0x41')](handleError(_0x4a2c11,null));};
\ No newline at end of file
+var _0xb1cc=['bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','options','find','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x2cea2d,_0x4e7846){var _0x160369=function(_0x234d95){while(--_0x234d95){_0x2cea2d['push'](_0x2cea2d['shift']());}};_0x160369(++_0x4e7846);}(_0xb1cc,0x97));var _0xcb1c=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xb1cc[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require(_0xcb1c('0x0'));var rimraf=require(_0xcb1c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb1c('0x2'));var rp=require(_0xcb1c('0x3'));var moment=require(_0xcb1c('0x4'));var BPromise=require(_0xcb1c('0x5'));var Mustache=require('mustache');var util=require(_0xcb1c('0x6'));var path=require(_0xcb1c('0x7'));var sox=require(_0xcb1c('0x8'));var csv=require('to-csv');var ejs=require(_0xcb1c('0x9'));var fs=require('fs');var fs_extra=require(_0xcb1c('0xa'));var _=require(_0xcb1c('0xb'));var squel=require(_0xcb1c('0xc'));var crypto=require('crypto');var jsforce=require(_0xcb1c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcb1c('0xe'));var Papa=require('papaparse');var Redis=require(_0xcb1c('0xf'));var authService=require(_0xcb1c('0x10'));var qs=require(_0xcb1c('0x11'));var as=require(_0xcb1c('0x12'));var hardwareService=require(_0xcb1c('0x13'));var logger=require(_0xcb1c('0x14'))(_0xcb1c('0x15'));var utils=require(_0xcb1c('0x16'));var config=require(_0xcb1c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb1c('0x18'))['db'];function respondWithStatusCode(_0x2064d1,_0x33bef4){_0x33bef4=_0x33bef4||0xcc;return function(_0x309a0f){if(_0x309a0f){return _0x2064d1[_0xcb1c('0x19')](_0x33bef4);}return _0x2064d1[_0xcb1c('0x1a')](_0x33bef4)[_0xcb1c('0x1b')]();};}function respondWithResult(_0x505c30,_0x21ac7e){_0x21ac7e=_0x21ac7e||0xc8;return function(_0x2df70a){if(_0x2df70a){return _0x505c30[_0xcb1c('0x1a')](_0x21ac7e)[_0xcb1c('0x1c')](_0x2df70a);}};}function respondWithFilteredResult(_0x1325dd,_0x1fb452){return function(_0x2015ad){if(_0x2015ad){var _0x5c1c6d=typeof _0x1fb452['offset']==='undefined'&&typeof _0x1fb452['limit']===_0xcb1c('0x1d');var _0x1f59bf=_0x2015ad['count'];var _0x21b8d5=_0x5c1c6d?0x0:_0x1fb452[_0xcb1c('0x1e')];var _0x479ae6=_0x5c1c6d?_0x2015ad[_0xcb1c('0x1f')]:_0x1fb452[_0xcb1c('0x1e')]+_0x1fb452[_0xcb1c('0x20')];var _0x55bd03;if(_0x479ae6>=_0x1f59bf){_0x479ae6=_0x1f59bf;_0x55bd03=0xc8;}else{_0x55bd03=0xce;}_0x1325dd[_0xcb1c('0x1a')](_0x55bd03);return _0x1325dd[_0xcb1c('0x21')](_0xcb1c('0x22'),_0x21b8d5+'-'+_0x479ae6+'/'+_0x1f59bf)[_0xcb1c('0x1c')](_0x2015ad);}return null;};}function patchUpdates(_0x5811b3){return function(_0x44d184){try{jsonpatch['apply'](_0x44d184,_0x5811b3,!![]);}catch(_0x1b9422){return BPromise[_0xcb1c('0x23')](_0x1b9422);}return _0x44d184[_0xcb1c('0x24')]();};}function saveUpdates(_0x213656,_0x11ae80){return function(_0x3aed25){if(_0x3aed25){return _0x3aed25[_0xcb1c('0x25')](_0x213656)[_0xcb1c('0x26')](function(_0x4bc1d5){return _0x4bc1d5;});}return null;};}function removeEntity(_0x5ee427,_0x9927c){return function(_0x4df4eb){if(_0x4df4eb){return _0x4df4eb[_0xcb1c('0x27')]()[_0xcb1c('0x26')](function(){_0x5ee427[_0xcb1c('0x1a')](0xcc)[_0xcb1c('0x1b')]();});}};}function handleEntityNotFound(_0x3a4d8f,_0x501e49){return function(_0x41891f){if(!_0x41891f){_0x3a4d8f[_0xcb1c('0x19')](0x194);}return _0x41891f;};}function handleError(_0x440420,_0x15f503){_0x15f503=_0x15f503||0x1f4;return function(_0x270243){logger[_0xcb1c('0x28')](_0x270243[_0xcb1c('0x29')]);if(_0x270243[_0xcb1c('0x2a')]){delete _0x270243['name'];}_0x440420[_0xcb1c('0x1a')](_0x15f503)[_0xcb1c('0x2b')](_0x270243);};}exports[_0xcb1c('0x2c')]=function(_0x146f5f,_0x53cf12){var _0x407839={},_0x27c87b={},_0x3859b6={'count':0x0,'rows':[]};var _0x36a720=_[_0xcb1c('0x2d')](db[_0xcb1c('0x2e')][_0xcb1c('0x2f')],function(_0x5bbb5b){return{'name':_0x5bbb5b[_0xcb1c('0x30')],'type':_0x5bbb5b[_0xcb1c('0x31')][_0xcb1c('0x32')]};});_0x27c87b[_0xcb1c('0x33')]=_[_0xcb1c('0x2d')](_0x36a720,_0xcb1c('0x2a'));_0x27c87b['query']=_[_0xcb1c('0x34')](_0x146f5f[_0xcb1c('0x35')]);_0x27c87b['filters']=_[_0xcb1c('0x36')](_0x27c87b[_0xcb1c('0x33')],_0x27c87b['query']);_0x407839['attributes']=_[_0xcb1c('0x36')](_0x27c87b[_0xcb1c('0x33')],qs['fields'](_0x146f5f[_0xcb1c('0x35')][_0xcb1c('0x37')]));_0x407839[_0xcb1c('0x38')]=_0x407839[_0xcb1c('0x38')][_0xcb1c('0x39')]?_0x407839['attributes']:_0x27c87b['model'];if(!_0x146f5f[_0xcb1c('0x35')][_0xcb1c('0x3a')]('nolimit')){_0x407839['limit']=qs[_0xcb1c('0x20')](_0x146f5f[_0xcb1c('0x35')][_0xcb1c('0x20')]);_0x407839[_0xcb1c('0x1e')]=qs[_0xcb1c('0x1e')](_0x146f5f['query'][_0xcb1c('0x1e')]);}_0x407839[_0xcb1c('0x3b')]=qs['sort'](_0x146f5f[_0xcb1c('0x35')][_0xcb1c('0x3c')]);_0x407839[_0xcb1c('0x3d')]=qs['filters'](_[_0xcb1c('0x3e')](_0x146f5f[_0xcb1c('0x35')],_0x27c87b['filters']),_0x36a720);if(_0x146f5f[_0xcb1c('0x35')]['filter']){_0x407839[_0xcb1c('0x3d')]=_[_0xcb1c('0x3f')](_0x407839[_0xcb1c('0x3d')],{'$or':_[_0xcb1c('0x2d')](_0x36a720,function(_0x297899){if(_0x297899[_0xcb1c('0x31')]!==_0xcb1c('0x40')){var _0x5e3e1f={};_0x5e3e1f[_0x297899[_0xcb1c('0x2a')]]={'$like':'%'+_0x146f5f[_0xcb1c('0x35')][_0xcb1c('0x41')]+'%'};return _0x5e3e1f;}})});}_0x407839=_[_0xcb1c('0x3f')]({},_0x407839,_0x146f5f['options']);var _0x13949d={'where':_0x407839[_0xcb1c('0x3d')]};return db[_0xcb1c('0x2e')][_0xcb1c('0x1f')](_0x13949d)[_0xcb1c('0x26')](function(_0x1a9e79){_0x3859b6[_0xcb1c('0x1f')]=_0x1a9e79;if(_0x146f5f['query'][_0xcb1c('0x42')]){_0x407839['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xcb1c('0x43')](_0x407839);})[_0xcb1c('0x26')](function(_0x2b5939){_0x3859b6[_0xcb1c('0x44')]=_0x2b5939;return _0x3859b6;})['then'](respondWithFilteredResult(_0x53cf12,_0x407839))[_0xcb1c('0x45')](handleError(_0x53cf12,null));};exports[_0xcb1c('0x46')]=function(_0x53d1c6,_0x14fb22){var _0x283f03={'raw':!![],'where':{'id':_0x53d1c6[_0xcb1c('0x47')]['id']}},_0x4d33c4={};_0x4d33c4[_0xcb1c('0x33')]=_[_0xcb1c('0x34')](db[_0xcb1c('0x2e')][_0xcb1c('0x2f')]);_0x4d33c4[_0xcb1c('0x35')]=_[_0xcb1c('0x34')](_0x53d1c6[_0xcb1c('0x35')]);_0x4d33c4['filters']=_[_0xcb1c('0x36')](_0x4d33c4[_0xcb1c('0x33')],_0x4d33c4[_0xcb1c('0x35')]);_0x283f03[_0xcb1c('0x38')]=_['intersection'](_0x4d33c4[_0xcb1c('0x33')],qs[_0xcb1c('0x37')](_0x53d1c6[_0xcb1c('0x35')]['fields']));_0x283f03[_0xcb1c('0x38')]=_0x283f03[_0xcb1c('0x38')][_0xcb1c('0x39')]?_0x283f03[_0xcb1c('0x38')]:_0x4d33c4[_0xcb1c('0x33')];if(_0x53d1c6[_0xcb1c('0x35')][_0xcb1c('0x42')]){_0x283f03['include']=[{'all':!![]}];}_0x283f03=_['merge']({},_0x283f03,_0x53d1c6[_0xcb1c('0x48')]);return db[_0xcb1c('0x2e')][_0xcb1c('0x49')](_0x283f03)[_0xcb1c('0x26')](handleEntityNotFound(_0x14fb22,null))['then'](respondWithResult(_0x14fb22,null))[_0xcb1c('0x45')](handleError(_0x14fb22,null));};exports['create']=function(_0x20afc2,_0x573a13){return db[_0xcb1c('0x2e')][_0xcb1c('0x4a')](_0x20afc2[_0xcb1c('0x4b')],{})[_0xcb1c('0x26')](respondWithResult(_0x573a13,0xc9))[_0xcb1c('0x45')](handleError(_0x573a13,null));};exports[_0xcb1c('0x4c')]=function(_0x93c027,_0x362431){return db[_0xcb1c('0x2e')][_0xcb1c('0x4c')]()[_0xcb1c('0x26')](respondWithResult(_0x362431,null))[_0xcb1c('0x45')](handleError(_0x362431,null));};exports[_0xcb1c('0x25')]=function(_0x7d343c,_0x827d70){if(_0x7d343c[_0xcb1c('0x4b')][_0xcb1c('0x4d')]){delete _0x7d343c[_0xcb1c('0x4b')][_0xcb1c('0x4d')];}return db[_0xcb1c('0x2e')][_0xcb1c('0x49')]({'where':{'uniqueid':_0x7d343c[_0xcb1c('0x47')]['id']}})[_0xcb1c('0x26')](handleEntityNotFound(_0x827d70,null))[_0xcb1c('0x26')](saveUpdates(_0x7d343c['body'],null))[_0xcb1c('0x26')](respondWithResult(_0x827d70,null))[_0xcb1c('0x45')](handleError(_0x827d70,null));};
\ No newline at end of file