Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index 84b2784..3db1fbe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c56=['options','include','rows','catch','params','length','includeAll','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x23c0af,_0x56a715){var _0x495cd0=function(_0x124b41){while(--_0x124b41){_0x23c0af['push'](_0x23c0af['shift']());}};_0x495cd0(++_0x56a715);}(_0x5c56,0x1e0));var _0x65c5=function(_0x14a1df,_0x3657e2){_0x14a1df=_0x14a1df-0x0;var _0x2dd91e=_0x5c56[_0x14a1df];return _0x2dd91e;};'use strict';var emlformat=require(_0x65c5('0x0'));var rimraf=require(_0x65c5('0x1'));var zipdir=require(_0x65c5('0x2'));var jsonpatch=require(_0x65c5('0x3'));var rp=require(_0x65c5('0x4'));var moment=require(_0x65c5('0x5'));var BPromise=require(_0x65c5('0x6'));var Mustache=require('mustache');var util=require(_0x65c5('0x7'));var path=require('path');var sox=require(_0x65c5('0x8'));var csv=require(_0x65c5('0x9'));var ejs=require(_0x65c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65c5('0xb'));var squel=require(_0x65c5('0xc'));var crypto=require(_0x65c5('0xd'));var jsforce=require(_0x65c5('0xe'));var deskjs=require(_0x65c5('0xf'));var toCsv=require(_0x65c5('0x9'));var querystring=require(_0x65c5('0x10'));var Papa=require(_0x65c5('0x11'));var Redis=require(_0x65c5('0x12'));var authService=require(_0x65c5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x65c5('0x14'));var hardwareService=require(_0x65c5('0x15'));var logger=require('../../config/logger')(_0x65c5('0x16'));var utils=require(_0x65c5('0x17'));var config=require(_0x65c5('0x18'));var licenseUtil=require(_0x65c5('0x19'));var db=require(_0x65c5('0x1a'))['db'];function respondWithStatusCode(_0x448959,_0x4f9866){_0x4f9866=_0x4f9866||0xcc;return function(_0x68dddd){if(_0x68dddd){return _0x448959['sendStatus'](_0x4f9866);}return _0x448959[_0x65c5('0x1b')](_0x4f9866)[_0x65c5('0x1c')]();};}function respondWithResult(_0x9c489b,_0x384dd2){_0x384dd2=_0x384dd2||0xc8;return function(_0x456518){if(_0x456518){return _0x9c489b[_0x65c5('0x1b')](_0x384dd2)[_0x65c5('0x1d')](_0x456518);}};}function respondWithFilteredResult(_0x5695fa,_0x2fb1a4){return function(_0x6e0713){if(_0x6e0713){var _0x26632d=typeof _0x2fb1a4['offset']==='undefined'&&typeof _0x2fb1a4['limit']===_0x65c5('0x1e');var _0x3df78d=_0x6e0713['count'];var _0x22b570=_0x26632d?0x0:_0x2fb1a4[_0x65c5('0x1f')];var _0x1f4171=_0x26632d?_0x6e0713[_0x65c5('0x20')]:_0x2fb1a4[_0x65c5('0x1f')]+_0x2fb1a4[_0x65c5('0x21')];var _0x557d7b;if(_0x1f4171>=_0x3df78d){_0x1f4171=_0x3df78d;_0x557d7b=0xc8;}else{_0x557d7b=0xce;}_0x5695fa[_0x65c5('0x1b')](_0x557d7b);return _0x5695fa[_0x65c5('0x22')](_0x65c5('0x23'),_0x22b570+'-'+_0x1f4171+'/'+_0x3df78d)['json'](_0x6e0713);}return null;};}function patchUpdates(_0x1c1a9c){return function(_0x4a2f26){try{jsonpatch[_0x65c5('0x24')](_0x4a2f26,_0x1c1a9c,!![]);}catch(_0x150d65){return BPromise[_0x65c5('0x25')](_0x150d65);}return _0x4a2f26[_0x65c5('0x26')]();};}function saveUpdates(_0x3e3542,_0xc8c9ef){return function(_0x2514a1){if(_0x2514a1){return _0x2514a1['update'](_0x3e3542)[_0x65c5('0x27')](function(_0x484f17){return _0x484f17;});}return null;};}function removeEntity(_0x3a0a44,_0x5d6db9){return function(_0x2866d8){if(_0x2866d8){return _0x2866d8[_0x65c5('0x28')]()[_0x65c5('0x27')](function(){_0x3a0a44[_0x65c5('0x1b')](0xcc)[_0x65c5('0x1c')]();});}};}function handleEntityNotFound(_0x18344d,_0x12ec99){return function(_0x47d62c){if(!_0x47d62c){_0x18344d['sendStatus'](0x194);}return _0x47d62c;};}function handleError(_0x1ad828,_0x4a0c73){_0x4a0c73=_0x4a0c73||0x1f4;return function(_0x8e6748){logger[_0x65c5('0x29')](_0x8e6748['stack']);if(_0x8e6748[_0x65c5('0x2a')]){delete _0x8e6748[_0x65c5('0x2a')];}_0x1ad828[_0x65c5('0x1b')](_0x4a0c73)[_0x65c5('0x2b')](_0x8e6748);};}exports['index']=function(_0x5c02f9,_0x52372d){var _0x1d8e91={},_0x3cf657={},_0xc74652={'count':0x0,'rows':[]};var _0x167597=_[_0x65c5('0x2c')](db[_0x65c5('0x2d')][_0x65c5('0x2e')],function(_0x3e0ecb){return{'name':_0x3e0ecb[_0x65c5('0x2f')],'type':_0x3e0ecb[_0x65c5('0x30')][_0x65c5('0x31')]};});_0x3cf657['model']=_[_0x65c5('0x2c')](_0x167597,_0x65c5('0x2a'));_0x3cf657[_0x65c5('0x32')]=_[_0x65c5('0x33')](_0x5c02f9[_0x65c5('0x32')]);_0x3cf657[_0x65c5('0x34')]=_[_0x65c5('0x35')](_0x3cf657[_0x65c5('0x36')],_0x3cf657[_0x65c5('0x32')]);_0x1d8e91[_0x65c5('0x37')]=_[_0x65c5('0x35')](_0x3cf657['model'],qs[_0x65c5('0x38')](_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x38')]));_0x1d8e91[_0x65c5('0x37')]=_0x1d8e91['attributes']['length']?_0x1d8e91['attributes']:_0x3cf657[_0x65c5('0x36')];if(!_0x5c02f9['query'][_0x65c5('0x39')](_0x65c5('0x3a'))){_0x1d8e91['limit']=qs['limit'](_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x21')]);_0x1d8e91[_0x65c5('0x1f')]=qs[_0x65c5('0x1f')](_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x1f')]);}_0x1d8e91[_0x65c5('0x3b')]=qs[_0x65c5('0x3c')](_0x5c02f9['query'][_0x65c5('0x3c')]);_0x1d8e91['where']=qs[_0x65c5('0x34')](_[_0x65c5('0x3d')](_0x5c02f9[_0x65c5('0x32')],_0x3cf657[_0x65c5('0x34')]),_0x167597);if(_0x5c02f9['query'][_0x65c5('0x3e')]){_0x1d8e91[_0x65c5('0x3f')]=_[_0x65c5('0x40')](_0x1d8e91['where'],{'$or':_[_0x65c5('0x2c')](_0x167597,function(_0x46e442){if(_0x46e442['type']!==_0x65c5('0x41')){var _0x465c35={};_0x465c35[_0x46e442[_0x65c5('0x2a')]]={'$like':'%'+_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x3e')]+'%'};return _0x465c35;}})});}_0x1d8e91=_['merge']({},_0x1d8e91,_0x5c02f9[_0x65c5('0x42')]);var _0x4da0e5={'where':_0x1d8e91[_0x65c5('0x3f')]};return db[_0x65c5('0x2d')]['count'](_0x4da0e5)[_0x65c5('0x27')](function(_0x435e95){_0xc74652[_0x65c5('0x20')]=_0x435e95;if(_0x5c02f9['query']['includeAll']){_0x1d8e91[_0x65c5('0x43')]=[{'all':!![]}];}return db[_0x65c5('0x2d')]['findAll'](_0x1d8e91);})['then'](function(_0x4283b4){_0xc74652[_0x65c5('0x44')]=_0x4283b4;return _0xc74652;})[_0x65c5('0x27')](respondWithFilteredResult(_0x52372d,_0x1d8e91))[_0x65c5('0x45')](handleError(_0x52372d,null));};exports['show']=function(_0x1586c1,_0x4f97ca){var _0x4b6e9f={'raw':!![],'where':{'id':_0x1586c1[_0x65c5('0x46')]['id']}},_0x3ca88f={};_0x3ca88f[_0x65c5('0x36')]=_[_0x65c5('0x33')](db[_0x65c5('0x2d')]['rawAttributes']);_0x3ca88f[_0x65c5('0x32')]=_['keys'](_0x1586c1[_0x65c5('0x32')]);_0x3ca88f[_0x65c5('0x34')]=_['intersection'](_0x3ca88f['model'],_0x3ca88f[_0x65c5('0x32')]);_0x4b6e9f[_0x65c5('0x37')]=_[_0x65c5('0x35')](_0x3ca88f[_0x65c5('0x36')],qs[_0x65c5('0x38')](_0x1586c1[_0x65c5('0x32')][_0x65c5('0x38')]));_0x4b6e9f[_0x65c5('0x37')]=_0x4b6e9f[_0x65c5('0x37')][_0x65c5('0x47')]?_0x4b6e9f[_0x65c5('0x37')]:_0x3ca88f[_0x65c5('0x36')];if(_0x1586c1[_0x65c5('0x32')][_0x65c5('0x48')]){_0x4b6e9f['include']=[{'all':!![]}];}_0x4b6e9f=_[_0x65c5('0x40')]({},_0x4b6e9f,_0x1586c1['options']);return db[_0x65c5('0x2d')]['find'](_0x4b6e9f)['then'](handleEntityNotFound(_0x4f97ca,null))[_0x65c5('0x27')](respondWithResult(_0x4f97ca,null))[_0x65c5('0x45')](handleError(_0x4f97ca,null));};exports['create']=function(_0x5e533c,_0x464c08){return db[_0x65c5('0x2d')][_0x65c5('0x49')](_0x5e533c[_0x65c5('0x4a')],{})[_0x65c5('0x27')](respondWithResult(_0x464c08,0xc9))[_0x65c5('0x45')](handleError(_0x464c08,null));};exports[_0x65c5('0x4b')]=function(_0x4e10e5,_0x53761d){return db[_0x65c5('0x2d')][_0x65c5('0x4b')]()[_0x65c5('0x27')](respondWithResult(_0x53761d,null))[_0x65c5('0x45')](handleError(_0x53761d,null));};exports['update']=function(_0x2e5165,_0x146648){if(_0x2e5165[_0x65c5('0x4a')][_0x65c5('0x4c')]){delete _0x2e5165[_0x65c5('0x4a')][_0x65c5('0x4c')];}return db[_0x65c5('0x2d')][_0x65c5('0x4d')]({'where':{'uniqueid':_0x2e5165[_0x65c5('0x46')]['id']}})['then'](handleEntityNotFound(_0x146648,null))['then'](saveUpdates(_0x2e5165[_0x65c5('0x4a')],null))[_0x65c5('0x27')](respondWithResult(_0x146648,null))['catch'](handleError(_0x146648,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