Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index c88da76..3db1fbe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4672=['map','CmHopperHistory','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','end','status','offset','limit','count','json','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x4672,0x1c4));var _0x2467=function(_0x1cb574,_0x318720){_0x1cb574=_0x1cb574-0x0;var _0x3f11a5=_0x4672[_0x1cb574];return _0x3f11a5;};'use strict';var emlformat=require(_0x2467('0x0'));var rimraf=require(_0x2467('0x1'));var zipdir=require(_0x2467('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2467('0x3'));var moment=require('moment');var BPromise=require(_0x2467('0x4'));var Mustache=require('mustache');var util=require(_0x2467('0x5'));var path=require(_0x2467('0x6'));var sox=require(_0x2467('0x7'));var csv=require('to-csv');var ejs=require(_0x2467('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2467('0x9'));var squel=require(_0x2467('0xa'));var crypto=require(_0x2467('0xb'));var jsforce=require(_0x2467('0xc'));var deskjs=require(_0x2467('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2467('0xe'));var Papa=require(_0x2467('0xf'));var Redis=require(_0x2467('0x10'));var authService=require(_0x2467('0x11'));var qs=require(_0x2467('0x12'));var as=require(_0x2467('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2467('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2467('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2467('0x16'))['db'];function respondWithStatusCode(_0x4c9e6b,_0x532ac9){_0x532ac9=_0x532ac9||0xcc;return function(_0x9a25b9){if(_0x9a25b9){return _0x4c9e6b['sendStatus'](_0x532ac9);}return _0x4c9e6b['status'](_0x532ac9)[_0x2467('0x17')]();};}function respondWithResult(_0x26a510,_0x383ed9){_0x383ed9=_0x383ed9||0xc8;return function(_0x4ef0a0){if(_0x4ef0a0){return _0x26a510[_0x2467('0x18')](_0x383ed9)['json'](_0x4ef0a0);}};}function respondWithFilteredResult(_0x4c49de,_0x31d29b){return function(_0x1c42dd){if(_0x1c42dd){var _0x39737e=typeof _0x31d29b[_0x2467('0x19')]==='undefined'&&typeof _0x31d29b[_0x2467('0x1a')]==='undefined';var _0x54d59c=_0x1c42dd[_0x2467('0x1b')];var _0x37c46e=_0x39737e?0x0:_0x31d29b[_0x2467('0x19')];var _0x5c397b=_0x39737e?_0x1c42dd[_0x2467('0x1b')]:_0x31d29b[_0x2467('0x19')]+_0x31d29b[_0x2467('0x1a')];var _0x2b35fb;if(_0x5c397b>=_0x54d59c){_0x5c397b=_0x54d59c;_0x2b35fb=0xc8;}else{_0x2b35fb=0xce;}_0x4c49de[_0x2467('0x18')](_0x2b35fb);return _0x4c49de['set']('Content-Range',_0x37c46e+'-'+_0x5c397b+'/'+_0x54d59c)[_0x2467('0x1c')](_0x1c42dd);}return null;};}function patchUpdates(_0x494d45){return function(_0x20969a){try{jsonpatch['apply'](_0x20969a,_0x494d45,!![]);}catch(_0x3d717a){return BPromise[_0x2467('0x1d')](_0x3d717a);}return _0x20969a[_0x2467('0x1e')]();};}function saveUpdates(_0x3f4e93,_0x31acda){return function(_0x33ae32){if(_0x33ae32){return _0x33ae32[_0x2467('0x1f')](_0x3f4e93)[_0x2467('0x20')](function(_0x256699){return _0x256699;});}return null;};}function removeEntity(_0x49db26,_0x2410ac){return function(_0x42a41a){if(_0x42a41a){return _0x42a41a[_0x2467('0x21')]()['then'](function(){_0x49db26[_0x2467('0x18')](0xcc)[_0x2467('0x17')]();});}};}function handleEntityNotFound(_0x3215c3,_0x3059e8){return function(_0x5632e7){if(!_0x5632e7){_0x3215c3['sendStatus'](0x194);}return _0x5632e7;};}function handleError(_0x2c348f,_0xb44343){_0xb44343=_0xb44343||0x1f4;return function(_0x52d102){logger[_0x2467('0x22')](_0x52d102[_0x2467('0x23')]);if(_0x52d102[_0x2467('0x24')]){delete _0x52d102['name'];}_0x2c348f[_0x2467('0x18')](_0xb44343)[_0x2467('0x25')](_0x52d102);};}exports['index']=function(_0x23f125,_0x215dc4){var _0xb13a4c={},_0x31e61e={},_0x113c53={'count':0x0,'rows':[]};var _0x368daa=_[_0x2467('0x26')](db[_0x2467('0x27')][_0x2467('0x28')],function(_0x22de11){return{'name':_0x22de11['fieldName'],'type':_0x22de11[_0x2467('0x29')][_0x2467('0x2a')]};});_0x31e61e[_0x2467('0x2b')]=_['map'](_0x368daa,_0x2467('0x24'));_0x31e61e[_0x2467('0x2c')]=_['keys'](_0x23f125[_0x2467('0x2c')]);_0x31e61e[_0x2467('0x2d')]=_[_0x2467('0x2e')](_0x31e61e[_0x2467('0x2b')],_0x31e61e[_0x2467('0x2c')]);_0xb13a4c[_0x2467('0x2f')]=_['intersection'](_0x31e61e[_0x2467('0x2b')],qs[_0x2467('0x30')](_0x23f125[_0x2467('0x2c')][_0x2467('0x30')]));_0xb13a4c[_0x2467('0x2f')]=_0xb13a4c[_0x2467('0x2f')][_0x2467('0x31')]?_0xb13a4c[_0x2467('0x2f')]:_0x31e61e[_0x2467('0x2b')];if(!_0x23f125[_0x2467('0x2c')][_0x2467('0x32')](_0x2467('0x33'))){_0xb13a4c[_0x2467('0x1a')]=qs[_0x2467('0x1a')](_0x23f125[_0x2467('0x2c')][_0x2467('0x1a')]);_0xb13a4c[_0x2467('0x19')]=qs['offset'](_0x23f125['query'][_0x2467('0x19')]);}_0xb13a4c['order']=qs['sort'](_0x23f125[_0x2467('0x2c')][_0x2467('0x34')]);_0xb13a4c[_0x2467('0x35')]=qs[_0x2467('0x2d')](_['pick'](_0x23f125[_0x2467('0x2c')],_0x31e61e['filters']),_0x368daa);if(_0x23f125[_0x2467('0x2c')][_0x2467('0x36')]){_0xb13a4c[_0x2467('0x35')]=_[_0x2467('0x37')](_0xb13a4c[_0x2467('0x35')],{'$or':_[_0x2467('0x26')](_0x368daa,function(_0x1f38fa){if(_0x1f38fa['type']!==_0x2467('0x38')){var _0xbf4f46={};_0xbf4f46[_0x1f38fa[_0x2467('0x24')]]={'$like':'%'+_0x23f125[_0x2467('0x2c')][_0x2467('0x36')]+'%'};return _0xbf4f46;}})});}_0xb13a4c=_[_0x2467('0x37')]({},_0xb13a4c,_0x23f125[_0x2467('0x39')]);var _0x14ee20={'where':_0xb13a4c['where']};return db[_0x2467('0x27')][_0x2467('0x1b')](_0x14ee20)[_0x2467('0x20')](function(_0x363dc1){_0x113c53[_0x2467('0x1b')]=_0x363dc1;if(_0x23f125[_0x2467('0x2c')][_0x2467('0x3a')]){_0xb13a4c[_0x2467('0x3b')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xb13a4c);})[_0x2467('0x20')](function(_0x5fd77b){_0x113c53[_0x2467('0x3c')]=_0x5fd77b;return _0x113c53;})[_0x2467('0x20')](respondWithFilteredResult(_0x215dc4,_0xb13a4c))[_0x2467('0x3d')](handleError(_0x215dc4,null));};exports[_0x2467('0x3e')]=function(_0x12e512,_0x1faf60){var _0x37e466={'raw':!![],'where':{'id':_0x12e512[_0x2467('0x3f')]['id']}},_0x4c322e={};_0x4c322e['model']=_['keys'](db[_0x2467('0x27')]['rawAttributes']);_0x4c322e[_0x2467('0x2c')]=_[_0x2467('0x40')](_0x12e512[_0x2467('0x2c')]);_0x4c322e['filters']=_[_0x2467('0x2e')](_0x4c322e['model'],_0x4c322e[_0x2467('0x2c')]);_0x37e466[_0x2467('0x2f')]=_['intersection'](_0x4c322e[_0x2467('0x2b')],qs[_0x2467('0x30')](_0x12e512[_0x2467('0x2c')][_0x2467('0x30')]));_0x37e466[_0x2467('0x2f')]=_0x37e466['attributes'][_0x2467('0x31')]?_0x37e466['attributes']:_0x4c322e[_0x2467('0x2b')];if(_0x12e512[_0x2467('0x2c')][_0x2467('0x3a')]){_0x37e466[_0x2467('0x3b')]=[{'all':!![]}];}_0x37e466=_['merge']({},_0x37e466,_0x12e512[_0x2467('0x39')]);return db['CmHopperHistory'][_0x2467('0x41')](_0x37e466)[_0x2467('0x20')](handleEntityNotFound(_0x1faf60,null))[_0x2467('0x20')](respondWithResult(_0x1faf60,null))[_0x2467('0x3d')](handleError(_0x1faf60,null));};exports['create']=function(_0x16d1a4,_0x306331){return db['CmHopperHistory'][_0x2467('0x42')](_0x16d1a4['body'],{})[_0x2467('0x20')](respondWithResult(_0x306331,0xc9))[_0x2467('0x3d')](handleError(_0x306331,null));};exports[_0x2467('0x43')]=function(_0x5246ec,_0x1cdf58){return db[_0x2467('0x27')][_0x2467('0x43')]()['then'](respondWithResult(_0x1cdf58,null))[_0x2467('0x3d')](handleError(_0x1cdf58,null));};exports[_0x2467('0x1f')]=function(_0x260be4,_0x373094){if(_0x260be4[_0x2467('0x44')][_0x2467('0x45')]){delete _0x260be4[_0x2467('0x44')]['uniqueid'];}return db[_0x2467('0x27')][_0x2467('0x41')]({'where':{'uniqueid':_0x260be4[_0x2467('0x3f')]['id']}})[_0x2467('0x20')](handleEntityNotFound(_0x373094,null))['then'](saveUpdates(_0x260be4[_0x2467('0x44')],null))[_0x2467('0x20')](respondWithResult(_0x373094,null))[_0x2467('0x3d')](handleError(_0x373094,null));};
\ No newline at end of file
+var _0x59f1=['send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','describe','uniqueid','find','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name'];(function(_0x3b8e2c,_0x11a1b8){var _0x432178=function(_0x524669){while(--_0x524669){_0x3b8e2c['push'](_0x3b8e2c['shift']());}};_0x432178(++_0x11a1b8);}(_0x59f1,0x153));var _0x159f=function(_0x41052c,_0x20035c){_0x41052c=_0x41052c-0x0;var _0x4dc096=_0x59f1[_0x41052c];return _0x4dc096;};'use strict';var emlformat=require(_0x159f('0x0'));var rimraf=require(_0x159f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x159f('0x2'));var moment=require(_0x159f('0x3'));var BPromise=require(_0x159f('0x4'));var Mustache=require(_0x159f('0x5'));var util=require(_0x159f('0x6'));var path=require(_0x159f('0x7'));var sox=require(_0x159f('0x8'));var csv=require('to-csv');var ejs=require(_0x159f('0x9'));var fs=require('fs');var fs_extra=require(_0x159f('0xa'));var _=require(_0x159f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x159f('0xc'));var deskjs=require(_0x159f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x159f('0xe'));var Papa=require(_0x159f('0xf'));var Redis=require(_0x159f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x159f('0x11'));var as=require(_0x159f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x159f('0x13'))(_0x159f('0x14'));var utils=require('../../config/utils');var config=require(_0x159f('0x15'));var licenseUtil=require(_0x159f('0x16'));var db=require(_0x159f('0x17'))['db'];function respondWithStatusCode(_0x1ec1c9,_0x58b6c1){_0x58b6c1=_0x58b6c1||0xcc;return function(_0x168eb3){if(_0x168eb3){return _0x1ec1c9[_0x159f('0x18')](_0x58b6c1);}return _0x1ec1c9[_0x159f('0x19')](_0x58b6c1)[_0x159f('0x1a')]();};}function respondWithResult(_0x2ddb72,_0x26fa74){_0x26fa74=_0x26fa74||0xc8;return function(_0x96f5d){if(_0x96f5d){return _0x2ddb72[_0x159f('0x19')](_0x26fa74)[_0x159f('0x1b')](_0x96f5d);}};}function respondWithFilteredResult(_0x599c14,_0x3d5f66){return function(_0x335c5e){if(_0x335c5e){var _0x20323f=typeof _0x3d5f66[_0x159f('0x1c')]===_0x159f('0x1d')&&typeof _0x3d5f66[_0x159f('0x1e')]===_0x159f('0x1d');var _0x4dd1db=_0x335c5e[_0x159f('0x1f')];var _0x239fad=_0x20323f?0x0:_0x3d5f66[_0x159f('0x1c')];var _0x3d2273=_0x20323f?_0x335c5e[_0x159f('0x1f')]:_0x3d5f66[_0x159f('0x1c')]+_0x3d5f66['limit'];var _0x27d7c6;if(_0x3d2273>=_0x4dd1db){_0x3d2273=_0x4dd1db;_0x27d7c6=0xc8;}else{_0x27d7c6=0xce;}_0x599c14[_0x159f('0x19')](_0x27d7c6);return _0x599c14[_0x159f('0x20')](_0x159f('0x21'),_0x239fad+'-'+_0x3d2273+'/'+_0x4dd1db)[_0x159f('0x1b')](_0x335c5e);}return null;};}function patchUpdates(_0x2c5866){return function(_0x390751){try{jsonpatch[_0x159f('0x22')](_0x390751,_0x2c5866,!![]);}catch(_0x12f4e5){return BPromise[_0x159f('0x23')](_0x12f4e5);}return _0x390751[_0x159f('0x24')]();};}function saveUpdates(_0x397e11,_0x3fbacc){return function(_0x2d1987){if(_0x2d1987){return _0x2d1987[_0x159f('0x25')](_0x397e11)[_0x159f('0x26')](function(_0x171eb9){return _0x171eb9;});}return null;};}function removeEntity(_0x216d20,_0x208a37){return function(_0x40e345){if(_0x40e345){return _0x40e345['destroy']()['then'](function(){_0x216d20[_0x159f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e018,_0xec80b1){return function(_0x503fca){if(!_0x503fca){_0x24e018['sendStatus'](0x194);}return _0x503fca;};}function handleError(_0x1db057,_0x5f2053){_0x5f2053=_0x5f2053||0x1f4;return function(_0x1b69f2){logger['error'](_0x1b69f2[_0x159f('0x27')]);if(_0x1b69f2['name']){delete _0x1b69f2[_0x159f('0x28')];}_0x1db057['status'](_0x5f2053)[_0x159f('0x29')](_0x1b69f2);};}exports['index']=function(_0x31283b,_0x6d3599){var _0x4a8d91={},_0x16b63a={},_0x4869d9={'count':0x0,'rows':[]};var _0x58a625=_[_0x159f('0x2a')](db[_0x159f('0x2b')][_0x159f('0x2c')],function(_0x57ac16){return{'name':_0x57ac16[_0x159f('0x2d')],'type':_0x57ac16[_0x159f('0x2e')][_0x159f('0x2f')]};});_0x16b63a[_0x159f('0x30')]=_[_0x159f('0x2a')](_0x58a625,'name');_0x16b63a['query']=_[_0x159f('0x31')](_0x31283b[_0x159f('0x32')]);_0x16b63a[_0x159f('0x33')]=_[_0x159f('0x34')](_0x16b63a[_0x159f('0x30')],_0x16b63a[_0x159f('0x32')]);_0x4a8d91[_0x159f('0x35')]=_[_0x159f('0x34')](_0x16b63a[_0x159f('0x30')],qs[_0x159f('0x36')](_0x31283b[_0x159f('0x32')]['fields']));_0x4a8d91[_0x159f('0x35')]=_0x4a8d91[_0x159f('0x35')][_0x159f('0x37')]?_0x4a8d91[_0x159f('0x35')]:_0x16b63a[_0x159f('0x30')];if(!_0x31283b['query']['hasOwnProperty'](_0x159f('0x38'))){_0x4a8d91[_0x159f('0x1e')]=qs[_0x159f('0x1e')](_0x31283b[_0x159f('0x32')][_0x159f('0x1e')]);_0x4a8d91[_0x159f('0x1c')]=qs[_0x159f('0x1c')](_0x31283b[_0x159f('0x32')][_0x159f('0x1c')]);}_0x4a8d91[_0x159f('0x39')]=qs[_0x159f('0x3a')](_0x31283b['query'][_0x159f('0x3a')]);_0x4a8d91['where']=qs[_0x159f('0x33')](_['pick'](_0x31283b[_0x159f('0x32')],_0x16b63a['filters']),_0x58a625);if(_0x31283b[_0x159f('0x32')][_0x159f('0x3b')]){_0x4a8d91[_0x159f('0x3c')]=_[_0x159f('0x3d')](_0x4a8d91[_0x159f('0x3c')],{'$or':_['map'](_0x58a625,function(_0x569388){if(_0x569388[_0x159f('0x2e')]!==_0x159f('0x3e')){var _0x6d41bf={};_0x6d41bf[_0x569388[_0x159f('0x28')]]={'$like':'%'+_0x31283b['query'][_0x159f('0x3b')]+'%'};return _0x6d41bf;}})});}_0x4a8d91=_['merge']({},_0x4a8d91,_0x31283b[_0x159f('0x3f')]);var _0x1be51e={'where':_0x4a8d91[_0x159f('0x3c')]};return db[_0x159f('0x2b')][_0x159f('0x1f')](_0x1be51e)[_0x159f('0x26')](function(_0x1f6837){_0x4869d9[_0x159f('0x1f')]=_0x1f6837;if(_0x31283b[_0x159f('0x32')][_0x159f('0x40')]){_0x4a8d91['include']=[{'all':!![]}];}return db[_0x159f('0x2b')][_0x159f('0x41')](_0x4a8d91);})['then'](function(_0x331853){_0x4869d9[_0x159f('0x42')]=_0x331853;return _0x4869d9;})[_0x159f('0x26')](respondWithFilteredResult(_0x6d3599,_0x4a8d91))[_0x159f('0x43')](handleError(_0x6d3599,null));};exports[_0x159f('0x44')]=function(_0x4f2d07,_0x5d636d){var _0x39b6b0={'raw':!![],'where':{'id':_0x4f2d07['params']['id']}},_0x4cc490={};_0x4cc490[_0x159f('0x30')]=_['keys'](db['CmHopperHistory'][_0x159f('0x2c')]);_0x4cc490[_0x159f('0x32')]=_[_0x159f('0x31')](_0x4f2d07['query']);_0x4cc490[_0x159f('0x33')]=_[_0x159f('0x34')](_0x4cc490[_0x159f('0x30')],_0x4cc490[_0x159f('0x32')]);_0x39b6b0[_0x159f('0x35')]=_[_0x159f('0x34')](_0x4cc490['model'],qs[_0x159f('0x36')](_0x4f2d07[_0x159f('0x32')][_0x159f('0x36')]));_0x39b6b0[_0x159f('0x35')]=_0x39b6b0[_0x159f('0x35')][_0x159f('0x37')]?_0x39b6b0[_0x159f('0x35')]:_0x4cc490[_0x159f('0x30')];if(_0x4f2d07[_0x159f('0x32')][_0x159f('0x40')]){_0x39b6b0[_0x159f('0x45')]=[{'all':!![]}];}_0x39b6b0=_[_0x159f('0x3d')]({},_0x39b6b0,_0x4f2d07[_0x159f('0x3f')]);return db[_0x159f('0x2b')]['find'](_0x39b6b0)['then'](handleEntityNotFound(_0x5d636d,null))[_0x159f('0x26')](respondWithResult(_0x5d636d,null))[_0x159f('0x43')](handleError(_0x5d636d,null));};exports[_0x159f('0x46')]=function(_0x1a7b44,_0x452834){return db[_0x159f('0x2b')][_0x159f('0x46')](_0x1a7b44[_0x159f('0x47')],{})[_0x159f('0x26')](respondWithResult(_0x452834,0xc9))[_0x159f('0x43')](handleError(_0x452834,null));};exports['describe']=function(_0x50a77d,_0x1b983e){return db[_0x159f('0x2b')][_0x159f('0x48')]()[_0x159f('0x26')](respondWithResult(_0x1b983e,null))[_0x159f('0x43')](handleError(_0x1b983e,null));};exports[_0x159f('0x25')]=function(_0x1f53cb,_0x443515){if(_0x1f53cb[_0x159f('0x47')][_0x159f('0x49')]){delete _0x1f53cb[_0x159f('0x47')]['uniqueid'];}return db[_0x159f('0x2b')][_0x159f('0x4a')]({'where':{'uniqueid':_0x1f53cb[_0x159f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x443515,null))['then'](saveUpdates(_0x1f53cb[_0x159f('0x47')],null))[_0x159f('0x26')](respondWithResult(_0x443515,null))[_0x159f('0x43')](handleError(_0x443515,null));};
\ No newline at end of file