Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index 496b851..d00367e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x58df=['save','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','CmHopperHistory','rows','catch','show','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x354315,_0x4eacf9){var _0x193970=function(_0x1790f4){while(--_0x1790f4){_0x354315['push'](_0x354315['shift']());}};_0x193970(++_0x4eacf9);}(_0x58df,0x79));var _0xf58d=function(_0x12e058,_0x3d4576){_0x12e058=_0x12e058-0x0;var _0x57d432=_0x58df[_0x12e058];return _0x57d432;};'use strict';var emlformat=require(_0xf58d('0x0'));var rimraf=require(_0xf58d('0x1'));var zipdir=require(_0xf58d('0x2'));var jsonpatch=require(_0xf58d('0x3'));var rp=require(_0xf58d('0x4'));var moment=require(_0xf58d('0x5'));var BPromise=require(_0xf58d('0x6'));var Mustache=require(_0xf58d('0x7'));var util=require('util');var path=require(_0xf58d('0x8'));var sox=require(_0xf58d('0x9'));var csv=require(_0xf58d('0xa'));var ejs=require(_0xf58d('0xb'));var fs=require('fs');var fs_extra=require(_0xf58d('0xc'));var _=require(_0xf58d('0xd'));var squel=require('squel');var crypto=require(_0xf58d('0xe'));var jsforce=require(_0xf58d('0xf'));var deskjs=require(_0xf58d('0x10'));var toCsv=require(_0xf58d('0xa'));var querystring=require(_0xf58d('0x11'));var Papa=require(_0xf58d('0x12'));var Redis=require(_0xf58d('0x13'));var authService=require(_0xf58d('0x14'));var qs=require(_0xf58d('0x15'));var as=require(_0xf58d('0x16'));var hardwareService=require(_0xf58d('0x17'));var logger=require(_0xf58d('0x18'))(_0xf58d('0x19'));var utils=require(_0xf58d('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf58d('0x1b'));var db=require(_0xf58d('0x1c'))['db'];function respondWithStatusCode(_0x1ecfa0,_0x130830){_0x130830=_0x130830||0xcc;return function(_0x47cdf3){if(_0x47cdf3){return _0x1ecfa0['sendStatus'](_0x130830);}return _0x1ecfa0[_0xf58d('0x1d')](_0x130830)[_0xf58d('0x1e')]();};}function respondWithResult(_0x9c215c,_0x25c4a7){_0x25c4a7=_0x25c4a7||0xc8;return function(_0x1be56b){if(_0x1be56b){return _0x9c215c[_0xf58d('0x1d')](_0x25c4a7)[_0xf58d('0x1f')](_0x1be56b);}};}function respondWithFilteredResult(_0x37d031,_0x2b1a3f){return function(_0x360aa7){if(_0x360aa7){var _0x22c0f8=typeof _0x2b1a3f[_0xf58d('0x20')]===_0xf58d('0x21')&&typeof _0x2b1a3f[_0xf58d('0x22')]===_0xf58d('0x21');var _0x124526=_0x360aa7['count'];var _0x295728=_0x22c0f8?0x0:_0x2b1a3f[_0xf58d('0x20')];var _0x82fb80=_0x22c0f8?_0x360aa7[_0xf58d('0x23')]:_0x2b1a3f[_0xf58d('0x20')]+_0x2b1a3f[_0xf58d('0x22')];var _0x5396d3;if(_0x82fb80>=_0x124526){_0x82fb80=_0x124526;_0x5396d3=0xc8;}else{_0x5396d3=0xce;}_0x37d031['status'](_0x5396d3);return _0x37d031['set'](_0xf58d('0x24'),_0x295728+'-'+_0x82fb80+'/'+_0x124526)[_0xf58d('0x1f')](_0x360aa7);}return null;};}function patchUpdates(_0x5bf79d){return function(_0x3ab161){try{jsonpatch[_0xf58d('0x25')](_0x3ab161,_0x5bf79d,!![]);}catch(_0x34d75e){return BPromise[_0xf58d('0x26')](_0x34d75e);}return _0x3ab161[_0xf58d('0x27')]();};}function saveUpdates(_0x42f789,_0x5c9f1d){return function(_0xd9bab1){if(_0xd9bab1){return _0xd9bab1[_0xf58d('0x28')](_0x42f789)[_0xf58d('0x29')](function(_0x598add){return _0x598add;});}return null;};}function removeEntity(_0x38e021,_0x13f151){return function(_0x302e24){if(_0x302e24){return _0x302e24[_0xf58d('0x2a')]()['then'](function(){_0x38e021['status'](0xcc)[_0xf58d('0x1e')]();});}};}function handleEntityNotFound(_0x5a48f4,_0x2258c2){return function(_0x388bc5){if(!_0x388bc5){_0x5a48f4[_0xf58d('0x2b')](0x194);}return _0x388bc5;};}function handleError(_0x1f7590,_0x12c52f){_0x12c52f=_0x12c52f||0x1f4;return function(_0xd868df){logger[_0xf58d('0x2c')](_0xd868df[_0xf58d('0x2d')]);if(_0xd868df[_0xf58d('0x2e')]){delete _0xd868df[_0xf58d('0x2e')];}_0x1f7590[_0xf58d('0x1d')](_0x12c52f)['send'](_0xd868df);};}exports[_0xf58d('0x2f')]=function(_0xb7b533,_0x1a987d){var _0xc91b46={},_0x1171f2={},_0x26a938={'count':0x0,'rows':[]};var _0x10cb40=_['map'](db['CmHopperHistory'][_0xf58d('0x30')],function(_0xf5b358){return{'name':_0xf5b358['fieldName'],'type':_0xf5b358[_0xf58d('0x31')][_0xf58d('0x32')]};});_0x1171f2['model']=_[_0xf58d('0x33')](_0x10cb40,'name');_0x1171f2[_0xf58d('0x34')]=_[_0xf58d('0x35')](_0xb7b533[_0xf58d('0x34')]);_0x1171f2[_0xf58d('0x36')]=_[_0xf58d('0x37')](_0x1171f2[_0xf58d('0x38')],_0x1171f2[_0xf58d('0x34')]);_0xc91b46[_0xf58d('0x39')]=_[_0xf58d('0x37')](_0x1171f2[_0xf58d('0x38')],qs[_0xf58d('0x3a')](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x3a')]));_0xc91b46[_0xf58d('0x39')]=_0xc91b46['attributes'][_0xf58d('0x3b')]?_0xc91b46[_0xf58d('0x39')]:_0x1171f2[_0xf58d('0x38')];if(!_0xb7b533[_0xf58d('0x34')][_0xf58d('0x3c')](_0xf58d('0x3d'))){_0xc91b46['limit']=qs['limit'](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x22')]);_0xc91b46[_0xf58d('0x20')]=qs[_0xf58d('0x20')](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x20')]);}_0xc91b46[_0xf58d('0x3e')]=qs[_0xf58d('0x3f')](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x3f')]);_0xc91b46[_0xf58d('0x40')]=qs['filters'](_[_0xf58d('0x41')](_0xb7b533[_0xf58d('0x34')],_0x1171f2[_0xf58d('0x36')]),_0x10cb40);if(_0xb7b533[_0xf58d('0x34')]['filter']){_0xc91b46[_0xf58d('0x40')]=_[_0xf58d('0x42')](_0xc91b46[_0xf58d('0x40')],{'$or':_[_0xf58d('0x33')](_0x10cb40,function(_0x15d3df){if(_0x15d3df[_0xf58d('0x31')]!==_0xf58d('0x43')){var _0x261508={};_0x261508[_0x15d3df[_0xf58d('0x2e')]]={'$like':'%'+_0xb7b533[_0xf58d('0x34')][_0xf58d('0x44')]+'%'};return _0x261508;}})});}_0xc91b46=_[_0xf58d('0x42')]({},_0xc91b46,_0xb7b533[_0xf58d('0x45')]);var _0x1a494f={'where':_0xc91b46[_0xf58d('0x40')]};return db['CmHopperHistory']['count'](_0x1a494f)[_0xf58d('0x29')](function(_0x208718){_0x26a938[_0xf58d('0x23')]=_0x208718;if(_0xb7b533['query']['includeAll']){_0xc91b46[_0xf58d('0x46')]=[{'all':!![]}];}return db[_0xf58d('0x47')]['findAll'](_0xc91b46);})[_0xf58d('0x29')](function(_0x1f0bf5){_0x26a938[_0xf58d('0x48')]=_0x1f0bf5;return _0x26a938;})[_0xf58d('0x29')](respondWithFilteredResult(_0x1a987d,_0xc91b46))[_0xf58d('0x49')](handleError(_0x1a987d,null));};exports[_0xf58d('0x4a')]=function(_0xe90363,_0xe41b89){var _0x1fb3e9={'raw':!![],'where':{'id':_0xe90363['params']['id']}},_0xae1615={};_0xae1615[_0xf58d('0x38')]=_[_0xf58d('0x35')](db[_0xf58d('0x47')][_0xf58d('0x30')]);_0xae1615[_0xf58d('0x34')]=_['keys'](_0xe90363[_0xf58d('0x34')]);_0xae1615[_0xf58d('0x36')]=_[_0xf58d('0x37')](_0xae1615['model'],_0xae1615[_0xf58d('0x34')]);_0x1fb3e9[_0xf58d('0x39')]=_[_0xf58d('0x37')](_0xae1615[_0xf58d('0x38')],qs[_0xf58d('0x3a')](_0xe90363[_0xf58d('0x34')]['fields']));_0x1fb3e9['attributes']=_0x1fb3e9[_0xf58d('0x39')][_0xf58d('0x3b')]?_0x1fb3e9[_0xf58d('0x39')]:_0xae1615[_0xf58d('0x38')];if(_0xe90363[_0xf58d('0x34')]['includeAll']){_0x1fb3e9[_0xf58d('0x46')]=[{'all':!![]}];}_0x1fb3e9=_[_0xf58d('0x42')]({},_0x1fb3e9,_0xe90363['options']);return db[_0xf58d('0x47')][_0xf58d('0x4b')](_0x1fb3e9)['then'](handleEntityNotFound(_0xe41b89,null))['then'](respondWithResult(_0xe41b89,null))[_0xf58d('0x49')](handleError(_0xe41b89,null));};exports[_0xf58d('0x4c')]=function(_0x4eeb2e,_0x3d48af){return db[_0xf58d('0x47')][_0xf58d('0x4c')](_0x4eeb2e[_0xf58d('0x4d')],{})['then'](respondWithResult(_0x3d48af,0xc9))[_0xf58d('0x49')](handleError(_0x3d48af,null));};exports[_0xf58d('0x4e')]=function(_0x5848d3,_0x3799b1){return db[_0xf58d('0x47')]['describe']()['then'](respondWithResult(_0x3799b1,null))['catch'](handleError(_0x3799b1,null));};exports[_0xf58d('0x28')]=function(_0x21c437,_0x37a3a0){if(_0x21c437['body'][_0xf58d('0x4f')]){delete _0x21c437[_0xf58d('0x4d')][_0xf58d('0x4f')];}return db[_0xf58d('0x47')]['find']({'where':{'uniqueid':_0x21c437['params']['id']}})[_0xf58d('0x29')](handleEntityNotFound(_0x37a3a0,null))[_0xf58d('0x29')](saveUpdates(_0x21c437[_0xf58d('0x4d')],null))[_0xf58d('0x29')](respondWithResult(_0x37a3a0,null))['catch'](handleError(_0x37a3a0,null));};
\ No newline at end of file
+var _0x111f=['catch','show','includeAll','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','include','findAll','rows'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x111f,0x1cb));var _0xf111=function(_0x14d7c6,_0x57afab){_0x14d7c6=_0x14d7c6-0x0;var _0x122608=_0x111f[_0x14d7c6];return _0x122608;};'use strict';var emlformat=require(_0xf111('0x0'));var rimraf=require(_0xf111('0x1'));var zipdir=require(_0xf111('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf111('0x3'));var moment=require(_0xf111('0x4'));var BPromise=require(_0xf111('0x5'));var Mustache=require(_0xf111('0x6'));var util=require(_0xf111('0x7'));var path=require(_0xf111('0x8'));var sox=require(_0xf111('0x9'));var csv=require(_0xf111('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf111('0xb'));var _=require('lodash');var squel=require(_0xf111('0xc'));var crypto=require(_0xf111('0xd'));var jsforce=require(_0xf111('0xe'));var deskjs=require(_0xf111('0xf'));var toCsv=require(_0xf111('0xa'));var querystring=require('querystring');var Papa=require(_0xf111('0x10'));var Redis=require(_0xf111('0x11'));var authService=require(_0xf111('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf111('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf111('0x14'))(_0xf111('0x15'));var utils=require(_0xf111('0x16'));var config=require(_0xf111('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf111('0x18'))['db'];function respondWithStatusCode(_0x22f20e,_0x366f75){_0x366f75=_0x366f75||0xcc;return function(_0x18a191){if(_0x18a191){return _0x22f20e['sendStatus'](_0x366f75);}return _0x22f20e['status'](_0x366f75)['end']();};}function respondWithResult(_0x3f5a4d,_0x3e75f7){_0x3e75f7=_0x3e75f7||0xc8;return function(_0x474673){if(_0x474673){return _0x3f5a4d[_0xf111('0x19')](_0x3e75f7)['json'](_0x474673);}};}function respondWithFilteredResult(_0xd7b9a5,_0x4e321a){return function(_0x48f395){if(_0x48f395){var _0x1a0cd=typeof _0x4e321a[_0xf111('0x1a')]===_0xf111('0x1b')&&typeof _0x4e321a[_0xf111('0x1c')]==='undefined';var _0x3e2d1c=_0x48f395[_0xf111('0x1d')];var _0x214d5a=_0x1a0cd?0x0:_0x4e321a[_0xf111('0x1a')];var _0x594a38=_0x1a0cd?_0x48f395[_0xf111('0x1d')]:_0x4e321a[_0xf111('0x1a')]+_0x4e321a['limit'];var _0x1ed68f;if(_0x594a38>=_0x3e2d1c){_0x594a38=_0x3e2d1c;_0x1ed68f=0xc8;}else{_0x1ed68f=0xce;}_0xd7b9a5[_0xf111('0x19')](_0x1ed68f);return _0xd7b9a5[_0xf111('0x1e')]('Content-Range',_0x214d5a+'-'+_0x594a38+'/'+_0x3e2d1c)['json'](_0x48f395);}return null;};}function patchUpdates(_0x5a8c90){return function(_0x1ba151){try{jsonpatch[_0xf111('0x1f')](_0x1ba151,_0x5a8c90,!![]);}catch(_0x51c518){return BPromise[_0xf111('0x20')](_0x51c518);}return _0x1ba151['save']();};}function saveUpdates(_0x59648d,_0x5afd62){return function(_0x31f95b){if(_0x31f95b){return _0x31f95b[_0xf111('0x21')](_0x59648d)['then'](function(_0x30092c){return _0x30092c;});}return null;};}function removeEntity(_0x1de8ff,_0x428bf1){return function(_0x4d71d){if(_0x4d71d){return _0x4d71d['destroy']()[_0xf111('0x22')](function(){_0x1de8ff[_0xf111('0x19')](0xcc)[_0xf111('0x23')]();});}};}function handleEntityNotFound(_0x413406,_0x2e9cfd){return function(_0xd4b7ee){if(!_0xd4b7ee){_0x413406[_0xf111('0x24')](0x194);}return _0xd4b7ee;};}function handleError(_0x492024,_0x57c5c0){_0x57c5c0=_0x57c5c0||0x1f4;return function(_0xe69c3c){logger[_0xf111('0x25')](_0xe69c3c[_0xf111('0x26')]);if(_0xe69c3c[_0xf111('0x27')]){delete _0xe69c3c['name'];}_0x492024[_0xf111('0x19')](_0x57c5c0)[_0xf111('0x28')](_0xe69c3c);};}exports[_0xf111('0x29')]=function(_0x54efb6,_0x27a944){var _0x21945b={},_0x3ed103={},_0x4af9bf={'count':0x0,'rows':[]};var _0x5a79ea=_[_0xf111('0x2a')](db[_0xf111('0x2b')][_0xf111('0x2c')],function(_0x5a39f4){return{'name':_0x5a39f4[_0xf111('0x2d')],'type':_0x5a39f4[_0xf111('0x2e')][_0xf111('0x2f')]};});_0x3ed103[_0xf111('0x30')]=_[_0xf111('0x2a')](_0x5a79ea,_0xf111('0x27'));_0x3ed103['query']=_[_0xf111('0x31')](_0x54efb6[_0xf111('0x32')]);_0x3ed103[_0xf111('0x33')]=_[_0xf111('0x34')](_0x3ed103[_0xf111('0x30')],_0x3ed103[_0xf111('0x32')]);_0x21945b[_0xf111('0x35')]=_[_0xf111('0x34')](_0x3ed103['model'],qs[_0xf111('0x36')](_0x54efb6[_0xf111('0x32')]['fields']));_0x21945b[_0xf111('0x35')]=_0x21945b['attributes'][_0xf111('0x37')]?_0x21945b[_0xf111('0x35')]:_0x3ed103[_0xf111('0x30')];if(!_0x54efb6[_0xf111('0x32')][_0xf111('0x38')](_0xf111('0x39'))){_0x21945b['limit']=qs[_0xf111('0x1c')](_0x54efb6[_0xf111('0x32')][_0xf111('0x1c')]);_0x21945b[_0xf111('0x1a')]=qs[_0xf111('0x1a')](_0x54efb6[_0xf111('0x32')][_0xf111('0x1a')]);}_0x21945b[_0xf111('0x3a')]=qs['sort'](_0x54efb6[_0xf111('0x32')][_0xf111('0x3b')]);_0x21945b['where']=qs[_0xf111('0x33')](_['pick'](_0x54efb6[_0xf111('0x32')],_0x3ed103[_0xf111('0x33')]),_0x5a79ea);if(_0x54efb6[_0xf111('0x32')][_0xf111('0x3c')]){_0x21945b['where']=_['merge'](_0x21945b[_0xf111('0x3d')],{'$or':_[_0xf111('0x2a')](_0x5a79ea,function(_0x15157b){if(_0x15157b[_0xf111('0x2e')]!==_0xf111('0x3e')){var _0x4b321b={};_0x4b321b[_0x15157b['name']]={'$like':'%'+_0x54efb6[_0xf111('0x32')][_0xf111('0x3c')]+'%'};return _0x4b321b;}})});}_0x21945b=_['merge']({},_0x21945b,_0x54efb6['options']);var _0x1daac8={'where':_0x21945b['where']};return db['CmHopperHistory'][_0xf111('0x1d')](_0x1daac8)[_0xf111('0x22')](function(_0xd884ae){_0x4af9bf[_0xf111('0x1d')]=_0xd884ae;if(_0x54efb6[_0xf111('0x32')]['includeAll']){_0x21945b[_0xf111('0x3f')]=[{'all':!![]}];}return db[_0xf111('0x2b')][_0xf111('0x40')](_0x21945b);})[_0xf111('0x22')](function(_0x5ae1ba){_0x4af9bf[_0xf111('0x41')]=_0x5ae1ba;return _0x4af9bf;})[_0xf111('0x22')](respondWithFilteredResult(_0x27a944,_0x21945b))[_0xf111('0x42')](handleError(_0x27a944,null));};exports[_0xf111('0x43')]=function(_0x3172a4,_0x180759){var _0x21f532={'raw':!![],'where':{'id':_0x3172a4['params']['id']}},_0x54c73f={};_0x54c73f['model']=_[_0xf111('0x31')](db[_0xf111('0x2b')][_0xf111('0x2c')]);_0x54c73f['query']=_[_0xf111('0x31')](_0x3172a4[_0xf111('0x32')]);_0x54c73f[_0xf111('0x33')]=_['intersection'](_0x54c73f[_0xf111('0x30')],_0x54c73f[_0xf111('0x32')]);_0x21f532[_0xf111('0x35')]=_[_0xf111('0x34')](_0x54c73f[_0xf111('0x30')],qs[_0xf111('0x36')](_0x3172a4['query'][_0xf111('0x36')]));_0x21f532['attributes']=_0x21f532[_0xf111('0x35')][_0xf111('0x37')]?_0x21f532['attributes']:_0x54c73f['model'];if(_0x3172a4[_0xf111('0x32')][_0xf111('0x44')]){_0x21f532[_0xf111('0x3f')]=[{'all':!![]}];}_0x21f532=_['merge']({},_0x21f532,_0x3172a4['options']);return db[_0xf111('0x2b')][_0xf111('0x45')](_0x21f532)[_0xf111('0x22')](handleEntityNotFound(_0x180759,null))[_0xf111('0x22')](respondWithResult(_0x180759,null))[_0xf111('0x42')](handleError(_0x180759,null));};exports[_0xf111('0x46')]=function(_0x17e33e,_0x1bb35b){return db[_0xf111('0x2b')]['create'](_0x17e33e[_0xf111('0x47')],{})[_0xf111('0x22')](respondWithResult(_0x1bb35b,0xc9))[_0xf111('0x42')](handleError(_0x1bb35b,null));};exports['describe']=function(_0x5bd787,_0x32b433){return db[_0xf111('0x2b')][_0xf111('0x48')]()[_0xf111('0x22')](respondWithResult(_0x32b433,null))['catch'](handleError(_0x32b433,null));};exports[_0xf111('0x21')]=function(_0x590452,_0x5a071){if(_0x590452[_0xf111('0x47')]['uniqueid']){delete _0x590452[_0xf111('0x47')][_0xf111('0x49')];}return db[_0xf111('0x2b')]['find']({'where':{'uniqueid':_0x590452[_0xf111('0x4a')]['id']}})[_0xf111('0x22')](handleEntityNotFound(_0x5a071,null))[_0xf111('0x22')](saveUpdates(_0x590452[_0xf111('0x47')],null))[_0xf111('0x22')](respondWithResult(_0x5a071,null))[_0xf111('0x42')](handleError(_0x5a071,null));};
\ No newline at end of file