Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index 1f005b5..024126e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1ae=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','catch','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','CmHopperHistory','rawAttributes'];(function(_0x4f7231,_0x372629){var _0x42e62c=function(_0x5360dd){while(--_0x5360dd){_0x4f7231['push'](_0x4f7231['shift']());}};_0x42e62c(++_0x372629);}(_0xb1ae,0x185));var _0xeb1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ae[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xeb1a('0x0'));var rimraf=require(_0xeb1a('0x1'));var zipdir=require(_0xeb1a('0x2'));var jsonpatch=require(_0xeb1a('0x3'));var rp=require(_0xeb1a('0x4'));var moment=require(_0xeb1a('0x5'));var BPromise=require(_0xeb1a('0x6'));var Mustache=require('mustache');var util=require(_0xeb1a('0x7'));var path=require(_0xeb1a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeb1a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb1a('0xa'));var squel=require(_0xeb1a('0xb'));var crypto=require(_0xeb1a('0xc'));var jsforce=require(_0xeb1a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeb1a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb1a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeb1a('0x10'));var as=require(_0xeb1a('0x11'));var hardwareService=require(_0xeb1a('0x12'));var logger=require(_0xeb1a('0x13'))('api');var utils=require(_0xeb1a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeb1a('0x15'))['db'];function respondWithStatusCode(_0x398226,_0x457440){_0x457440=_0x457440||0xcc;return function(_0x55b15f){if(_0x55b15f){return _0x398226[_0xeb1a('0x16')](_0x457440);}return _0x398226['status'](_0x457440)[_0xeb1a('0x17')]();};}function respondWithResult(_0x5eea7c,_0x2dfe2e){_0x2dfe2e=_0x2dfe2e||0xc8;return function(_0x1433ac){if(_0x1433ac){return _0x5eea7c[_0xeb1a('0x18')](_0x2dfe2e)[_0xeb1a('0x19')](_0x1433ac);}};}function respondWithFilteredResult(_0x9a1a58,_0x400711){return function(_0x1746fb){if(_0x1746fb){var _0x591f2f=typeof _0x400711[_0xeb1a('0x1a')]==='undefined'&&typeof _0x400711[_0xeb1a('0x1b')]==='undefined';var _0x1b2182=_0x1746fb[_0xeb1a('0x1c')];var _0x21f158=_0x591f2f?0x0:_0x400711['offset'];var _0x766a5a=_0x591f2f?_0x1746fb['count']:_0x400711[_0xeb1a('0x1a')]+_0x400711['limit'];var _0x4b4b8e;if(_0x766a5a>=_0x1b2182){_0x766a5a=_0x1b2182;_0x4b4b8e=0xc8;}else{_0x4b4b8e=0xce;}_0x9a1a58[_0xeb1a('0x18')](_0x4b4b8e);return _0x9a1a58[_0xeb1a('0x1d')](_0xeb1a('0x1e'),_0x21f158+'-'+_0x766a5a+'/'+_0x1b2182)[_0xeb1a('0x19')](_0x1746fb);}return null;};}function patchUpdates(_0x417976){return function(_0x355db5){try{jsonpatch[_0xeb1a('0x1f')](_0x355db5,_0x417976,!![]);}catch(_0x5cc0d6){return BPromise[_0xeb1a('0x20')](_0x5cc0d6);}return _0x355db5[_0xeb1a('0x21')]();};}function saveUpdates(_0x13b6d4,_0x39a829){return function(_0x228381){if(_0x228381){return _0x228381[_0xeb1a('0x22')](_0x13b6d4)[_0xeb1a('0x23')](function(_0x790b3b){return _0x790b3b;});}return null;};}function removeEntity(_0x75f4b3,_0x589f74){return function(_0x125e54){if(_0x125e54){return _0x125e54[_0xeb1a('0x24')]()['then'](function(){_0x75f4b3[_0xeb1a('0x18')](0xcc)[_0xeb1a('0x17')]();});}};}function handleEntityNotFound(_0x254488,_0x5e6da4){return function(_0x34fecd){if(!_0x34fecd){_0x254488[_0xeb1a('0x16')](0x194);}return _0x34fecd;};}function handleError(_0x25f332,_0x299608){_0x299608=_0x299608||0x1f4;return function(_0x5c4ccb){logger[_0xeb1a('0x25')](_0x5c4ccb['stack']);if(_0x5c4ccb[_0xeb1a('0x26')]){delete _0x5c4ccb[_0xeb1a('0x26')];}_0x25f332[_0xeb1a('0x18')](_0x299608)[_0xeb1a('0x27')](_0x5c4ccb);};}exports['index']=function(_0x5901b6,_0x1c86a0){var _0x378a44={},_0x576df1={},_0x584f25={'count':0x0,'rows':[]};var _0x3b1005=_[_0xeb1a('0x28')](db[_0xeb1a('0x29')][_0xeb1a('0x2a')],function(_0x135eab){return{'name':_0x135eab[_0xeb1a('0x2b')],'type':_0x135eab[_0xeb1a('0x2c')][_0xeb1a('0x2d')]};});_0x576df1[_0xeb1a('0x2e')]=_['map'](_0x3b1005,_0xeb1a('0x26'));_0x576df1[_0xeb1a('0x2f')]=_[_0xeb1a('0x30')](_0x5901b6[_0xeb1a('0x2f')]);_0x576df1[_0xeb1a('0x31')]=_[_0xeb1a('0x32')](_0x576df1['model'],_0x576df1[_0xeb1a('0x2f')]);_0x378a44[_0xeb1a('0x33')]=_[_0xeb1a('0x32')](_0x576df1[_0xeb1a('0x2e')],qs[_0xeb1a('0x34')](_0x5901b6['query'][_0xeb1a('0x34')]));_0x378a44[_0xeb1a('0x33')]=_0x378a44[_0xeb1a('0x33')][_0xeb1a('0x35')]?_0x378a44[_0xeb1a('0x33')]:_0x576df1['model'];if(!_0x5901b6[_0xeb1a('0x2f')]['hasOwnProperty'](_0xeb1a('0x36'))){_0x378a44[_0xeb1a('0x1b')]=qs['limit'](_0x5901b6['query'][_0xeb1a('0x1b')]);_0x378a44[_0xeb1a('0x1a')]=qs['offset'](_0x5901b6['query']['offset']);}_0x378a44['order']=qs[_0xeb1a('0x37')](_0x5901b6['query']['sort']);_0x378a44[_0xeb1a('0x38')]=qs['filters'](_['pick'](_0x5901b6[_0xeb1a('0x2f')],_0x576df1['filters']),_0x3b1005);if(_0x5901b6[_0xeb1a('0x2f')][_0xeb1a('0x39')]){_0x378a44[_0xeb1a('0x38')]=_[_0xeb1a('0x3a')](_0x378a44['where'],{'$or':_[_0xeb1a('0x28')](_0x3b1005,function(_0x46dded){if(_0x46dded[_0xeb1a('0x2c')]!==_0xeb1a('0x3b')){var _0x451341={};_0x451341[_0x46dded[_0xeb1a('0x26')]]={'$like':'%'+_0x5901b6[_0xeb1a('0x2f')][_0xeb1a('0x39')]+'%'};return _0x451341;}})});}_0x378a44=_[_0xeb1a('0x3a')]({},_0x378a44,_0x5901b6[_0xeb1a('0x3c')]);var _0x365771={'where':_0x378a44['where']};return db[_0xeb1a('0x29')]['count'](_0x365771)['then'](function(_0x31e92f){_0x584f25[_0xeb1a('0x1c')]=_0x31e92f;if(_0x5901b6[_0xeb1a('0x2f')][_0xeb1a('0x3d')]){_0x378a44['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xeb1a('0x3e')](_0x378a44);})[_0xeb1a('0x23')](function(_0x5ebbd1){_0x584f25['rows']=_0x5ebbd1;return _0x584f25;})[_0xeb1a('0x23')](respondWithFilteredResult(_0x1c86a0,_0x378a44))['catch'](handleError(_0x1c86a0,null));};exports[_0xeb1a('0x3f')]=function(_0x500b8d,_0x4e5ad1){var _0x33db6={'raw':!![],'where':{'id':_0x500b8d[_0xeb1a('0x40')]['id']}},_0x3289cd={};_0x3289cd['model']=_['keys'](db[_0xeb1a('0x29')][_0xeb1a('0x2a')]);_0x3289cd[_0xeb1a('0x2f')]=_['keys'](_0x500b8d[_0xeb1a('0x2f')]);_0x3289cd[_0xeb1a('0x31')]=_[_0xeb1a('0x32')](_0x3289cd[_0xeb1a('0x2e')],_0x3289cd[_0xeb1a('0x2f')]);_0x33db6[_0xeb1a('0x33')]=_[_0xeb1a('0x32')](_0x3289cd[_0xeb1a('0x2e')],qs['fields'](_0x500b8d[_0xeb1a('0x2f')][_0xeb1a('0x34')]));_0x33db6[_0xeb1a('0x33')]=_0x33db6[_0xeb1a('0x33')][_0xeb1a('0x35')]?_0x33db6[_0xeb1a('0x33')]:_0x3289cd[_0xeb1a('0x2e')];if(_0x500b8d[_0xeb1a('0x2f')][_0xeb1a('0x3d')]){_0x33db6[_0xeb1a('0x41')]=[{'all':!![]}];}_0x33db6=_['merge']({},_0x33db6,_0x500b8d[_0xeb1a('0x3c')]);return db[_0xeb1a('0x29')][_0xeb1a('0x42')](_0x33db6)['then'](handleEntityNotFound(_0x4e5ad1,null))[_0xeb1a('0x23')](respondWithResult(_0x4e5ad1,null))['catch'](handleError(_0x4e5ad1,null));};exports[_0xeb1a('0x43')]=function(_0x9b4223,_0x47a5fd){return db[_0xeb1a('0x29')][_0xeb1a('0x43')](_0x9b4223['body'],{})['then'](respondWithResult(_0x47a5fd,0xc9))[_0xeb1a('0x44')](handleError(_0x47a5fd,null));};exports[_0xeb1a('0x45')]=function(_0x4b48ee,_0x53f5da){return db[_0xeb1a('0x29')]['describe']()[_0xeb1a('0x23')](respondWithResult(_0x53f5da,null))[_0xeb1a('0x44')](handleError(_0x53f5da,null));};exports['update']=function(_0x1143a3,_0x57167e){if(_0x1143a3[_0xeb1a('0x46')][_0xeb1a('0x47')]){delete _0x1143a3['body'][_0xeb1a('0x47')];}return db[_0xeb1a('0x29')][_0xeb1a('0x42')]({'where':{'uniqueid':_0x1143a3[_0xeb1a('0x40')]['id']}})[_0xeb1a('0x23')](handleEntityNotFound(_0x57167e,null))[_0xeb1a('0x23')](saveUpdates(_0x1143a3[_0xeb1a('0x46')],null))[_0xeb1a('0x23')](respondWithResult(_0x57167e,null))['catch'](handleError(_0x57167e,null));};
\ No newline at end of file
+var _0x16cc=['save','update','then','error','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','uniqueid','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x16cc,0xb5));var _0xc16c=function(_0x3122ca,_0x1eaf4c){_0x3122ca=_0x3122ca-0x0;var _0xf95988=_0x16cc[_0x3122ca];return _0xf95988;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc16c('0x0'));var jsonpatch=require(_0xc16c('0x1'));var rp=require('request-promise');var moment=require(_0xc16c('0x2'));var BPromise=require(_0xc16c('0x3'));var Mustache=require(_0xc16c('0x4'));var util=require(_0xc16c('0x5'));var path=require(_0xc16c('0x6'));var sox=require(_0xc16c('0x7'));var csv=require(_0xc16c('0x8'));var ejs=require(_0xc16c('0x9'));var fs=require('fs');var fs_extra=require(_0xc16c('0xa'));var _=require(_0xc16c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc16c('0xc'));var deskjs=require(_0xc16c('0xd'));var toCsv=require(_0xc16c('0x8'));var querystring=require('querystring');var Papa=require(_0xc16c('0xe'));var Redis=require(_0xc16c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc16c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc16c('0x11'));var logger=require(_0xc16c('0x12'))(_0xc16c('0x13'));var utils=require(_0xc16c('0x14'));var config=require(_0xc16c('0x15'));var licenseUtil=require(_0xc16c('0x16'));var db=require(_0xc16c('0x17'))['db'];function respondWithStatusCode(_0x59f30f,_0x20b9ba){_0x20b9ba=_0x20b9ba||0xcc;return function(_0x372648){if(_0x372648){return _0x59f30f[_0xc16c('0x18')](_0x20b9ba);}return _0x59f30f[_0xc16c('0x19')](_0x20b9ba)[_0xc16c('0x1a')]();};}function respondWithResult(_0x40ea97,_0x43be21){_0x43be21=_0x43be21||0xc8;return function(_0x1efc95){if(_0x1efc95){return _0x40ea97[_0xc16c('0x19')](_0x43be21)[_0xc16c('0x1b')](_0x1efc95);}};}function respondWithFilteredResult(_0x115840,_0x429268){return function(_0x2333c5){if(_0x2333c5){var _0x46d10f=typeof _0x429268[_0xc16c('0x1c')]===_0xc16c('0x1d')&&typeof _0x429268[_0xc16c('0x1e')]===_0xc16c('0x1d');var _0x503444=_0x2333c5['count'];var _0x48b9ac=_0x46d10f?0x0:_0x429268[_0xc16c('0x1c')];var _0x2df6f8=_0x46d10f?_0x2333c5[_0xc16c('0x1f')]:_0x429268[_0xc16c('0x1c')]+_0x429268[_0xc16c('0x1e')];var _0x703ab2;if(_0x2df6f8>=_0x503444){_0x2df6f8=_0x503444;_0x703ab2=0xc8;}else{_0x703ab2=0xce;}_0x115840[_0xc16c('0x19')](_0x703ab2);return _0x115840['set'](_0xc16c('0x20'),_0x48b9ac+'-'+_0x2df6f8+'/'+_0x503444)['json'](_0x2333c5);}return null;};}function patchUpdates(_0x2c8a65){return function(_0x320a15){try{jsonpatch[_0xc16c('0x21')](_0x320a15,_0x2c8a65,!![]);}catch(_0x1b6a75){return BPromise[_0xc16c('0x22')](_0x1b6a75);}return _0x320a15[_0xc16c('0x23')]();};}function saveUpdates(_0x1adac0,_0x44b26a){return function(_0x104b9c){if(_0x104b9c){return _0x104b9c[_0xc16c('0x24')](_0x1adac0)[_0xc16c('0x25')](function(_0x4c9975){return _0x4c9975;});}return null;};}function removeEntity(_0x17d299,_0x127594){return function(_0x26338e){if(_0x26338e){return _0x26338e['destroy']()['then'](function(){_0x17d299['status'](0xcc)[_0xc16c('0x1a')]();});}};}function handleEntityNotFound(_0x16ccd7,_0x5f355f){return function(_0x30156d){if(!_0x30156d){_0x16ccd7[_0xc16c('0x18')](0x194);}return _0x30156d;};}function handleError(_0x33d104,_0x58962b){_0x58962b=_0x58962b||0x1f4;return function(_0x36d2d3){logger[_0xc16c('0x26')](_0x36d2d3['stack']);if(_0x36d2d3['name']){delete _0x36d2d3[_0xc16c('0x27')];}_0x33d104['status'](_0x58962b)['send'](_0x36d2d3);};}exports[_0xc16c('0x28')]=function(_0x49582c,_0x50fc24){var _0x6f56f1={},_0x590ad1={},_0x54c3c0={'count':0x0,'rows':[]};var _0x31bbe7=_[_0xc16c('0x29')](db[_0xc16c('0x2a')][_0xc16c('0x2b')],function(_0x469c25){return{'name':_0x469c25[_0xc16c('0x2c')],'type':_0x469c25[_0xc16c('0x2d')][_0xc16c('0x2e')]};});_0x590ad1['model']=_[_0xc16c('0x29')](_0x31bbe7,_0xc16c('0x27'));_0x590ad1['query']=_[_0xc16c('0x2f')](_0x49582c[_0xc16c('0x30')]);_0x590ad1[_0xc16c('0x31')]=_[_0xc16c('0x32')](_0x590ad1[_0xc16c('0x33')],_0x590ad1['query']);_0x6f56f1[_0xc16c('0x34')]=_[_0xc16c('0x32')](_0x590ad1[_0xc16c('0x33')],qs[_0xc16c('0x35')](_0x49582c[_0xc16c('0x30')]['fields']));_0x6f56f1[_0xc16c('0x34')]=_0x6f56f1[_0xc16c('0x34')][_0xc16c('0x36')]?_0x6f56f1[_0xc16c('0x34')]:_0x590ad1[_0xc16c('0x33')];if(!_0x49582c[_0xc16c('0x30')][_0xc16c('0x37')](_0xc16c('0x38'))){_0x6f56f1[_0xc16c('0x1e')]=qs['limit'](_0x49582c[_0xc16c('0x30')][_0xc16c('0x1e')]);_0x6f56f1[_0xc16c('0x1c')]=qs[_0xc16c('0x1c')](_0x49582c[_0xc16c('0x30')][_0xc16c('0x1c')]);}_0x6f56f1['order']=qs[_0xc16c('0x39')](_0x49582c[_0xc16c('0x30')][_0xc16c('0x39')]);_0x6f56f1[_0xc16c('0x3a')]=qs[_0xc16c('0x31')](_['pick'](_0x49582c[_0xc16c('0x30')],_0x590ad1[_0xc16c('0x31')]),_0x31bbe7);if(_0x49582c[_0xc16c('0x30')]['filter']){_0x6f56f1[_0xc16c('0x3a')]=_[_0xc16c('0x3b')](_0x6f56f1['where'],{'$or':_[_0xc16c('0x29')](_0x31bbe7,function(_0x2b6835){if(_0x2b6835[_0xc16c('0x2d')]!==_0xc16c('0x3c')){var _0x415159={};_0x415159[_0x2b6835['name']]={'$like':'%'+_0x49582c[_0xc16c('0x30')]['filter']+'%'};return _0x415159;}})});}_0x6f56f1=_[_0xc16c('0x3b')]({},_0x6f56f1,_0x49582c['options']);var _0x18deee={'where':_0x6f56f1['where']};return db['CmHopperHistory']['count'](_0x18deee)[_0xc16c('0x25')](function(_0x225477){_0x54c3c0[_0xc16c('0x1f')]=_0x225477;if(_0x49582c[_0xc16c('0x30')][_0xc16c('0x3d')]){_0x6f56f1[_0xc16c('0x3e')]=[{'all':!![]}];}return db[_0xc16c('0x2a')][_0xc16c('0x3f')](_0x6f56f1);})[_0xc16c('0x25')](function(_0x7285eb){_0x54c3c0[_0xc16c('0x40')]=_0x7285eb;return _0x54c3c0;})[_0xc16c('0x25')](respondWithFilteredResult(_0x50fc24,_0x6f56f1))['catch'](handleError(_0x50fc24,null));};exports['show']=function(_0xdacbc7,_0x532a61){var _0x3b6548={'raw':!![],'where':{'id':_0xdacbc7[_0xc16c('0x41')]['id']}},_0x16fa2c={};_0x16fa2c[_0xc16c('0x33')]=_['keys'](db['CmHopperHistory'][_0xc16c('0x2b')]);_0x16fa2c[_0xc16c('0x30')]=_['keys'](_0xdacbc7[_0xc16c('0x30')]);_0x16fa2c[_0xc16c('0x31')]=_[_0xc16c('0x32')](_0x16fa2c[_0xc16c('0x33')],_0x16fa2c['query']);_0x3b6548['attributes']=_[_0xc16c('0x32')](_0x16fa2c[_0xc16c('0x33')],qs[_0xc16c('0x35')](_0xdacbc7[_0xc16c('0x30')][_0xc16c('0x35')]));_0x3b6548[_0xc16c('0x34')]=_0x3b6548[_0xc16c('0x34')]['length']?_0x3b6548[_0xc16c('0x34')]:_0x16fa2c['model'];if(_0xdacbc7[_0xc16c('0x30')][_0xc16c('0x3d')]){_0x3b6548[_0xc16c('0x3e')]=[{'all':!![]}];}_0x3b6548=_['merge']({},_0x3b6548,_0xdacbc7[_0xc16c('0x42')]);return db[_0xc16c('0x2a')][_0xc16c('0x43')](_0x3b6548)[_0xc16c('0x25')](handleEntityNotFound(_0x532a61,null))[_0xc16c('0x25')](respondWithResult(_0x532a61,null))[_0xc16c('0x44')](handleError(_0x532a61,null));};exports['create']=function(_0x2ea2c0,_0x5c9461){return db[_0xc16c('0x2a')][_0xc16c('0x45')](_0x2ea2c0[_0xc16c('0x46')],{})[_0xc16c('0x25')](respondWithResult(_0x5c9461,0xc9))[_0xc16c('0x44')](handleError(_0x5c9461,null));};exports['describe']=function(_0x4cc89b,_0x4ce332){return db[_0xc16c('0x2a')]['describe']()[_0xc16c('0x25')](respondWithResult(_0x4ce332,null))[_0xc16c('0x44')](handleError(_0x4ce332,null));};exports[_0xc16c('0x24')]=function(_0x29612d,_0x163a8f){if(_0x29612d[_0xc16c('0x46')][_0xc16c('0x47')]){delete _0x29612d[_0xc16c('0x46')][_0xc16c('0x47')];}return db[_0xc16c('0x2a')]['find']({'where':{'uniqueid':_0x29612d[_0xc16c('0x41')]['id']}})['then'](handleEntityNotFound(_0x163a8f,null))[_0xc16c('0x25')](saveUpdates(_0x29612d[_0xc16c('0x46')],null))[_0xc16c('0x25')](respondWithResult(_0x163a8f,null))['catch'](handleError(_0x163a8f,null));};
\ No newline at end of file