Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index 560430e..2b0d00d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c57=['catch','show','params','length','include','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','apply','save','then','error','stack','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','name','merge','options','includeAll','findAll','rows'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x3c57,0x1ae));var _0x73c5=function(_0x5a267f,_0x26decc){_0x5a267f=_0x5a267f-0x0;var _0x43c8ee=_0x3c57[_0x5a267f];return _0x43c8ee;};'use strict';var emlformat=require(_0x73c5('0x0'));var rimraf=require(_0x73c5('0x1'));var zipdir=require(_0x73c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73c5('0x3'));var moment=require(_0x73c5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73c5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x73c5('0x6'));var csv=require(_0x73c5('0x7'));var ejs=require(_0x73c5('0x8'));var fs=require('fs');var fs_extra=require(_0x73c5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x73c5('0xa'));var deskjs=require(_0x73c5('0xb'));var toCsv=require(_0x73c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x73c5('0xc'));var as=require(_0x73c5('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73c5('0xe'))(_0x73c5('0xf'));var utils=require(_0x73c5('0x10'));var config=require(_0x73c5('0x11'));var licenseUtil=require(_0x73c5('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cffb2,_0x3d65e5){_0x3d65e5=_0x3d65e5||0xcc;return function(_0x2b8e97){if(_0x2b8e97){return _0x4cffb2[_0x73c5('0x13')](_0x3d65e5);}return _0x4cffb2[_0x73c5('0x14')](_0x3d65e5)[_0x73c5('0x15')]();};}function respondWithResult(_0x54beae,_0x39bdbf){_0x39bdbf=_0x39bdbf||0xc8;return function(_0x1ec79c){if(_0x1ec79c){return _0x54beae[_0x73c5('0x14')](_0x39bdbf)[_0x73c5('0x16')](_0x1ec79c);}};}function respondWithFilteredResult(_0x582de8,_0x23a5d1){return function(_0x58661f){if(_0x58661f){var _0x845968=_0x58661f[_0x73c5('0x17')],_0x4cd55c=_0x23a5d1[_0x73c5('0x18')],_0x8f241f=_0x23a5d1['offset']+_0x23a5d1['limit'],_0x380043;if(_0x8f241f>=_0x845968){_0x8f241f=_0x845968;_0x380043=0xc8;}else{_0x380043=0xce;}_0x582de8[_0x73c5('0x14')](_0x380043);return _0x582de8[_0x73c5('0x19')]('Content-Range',_0x4cd55c+'-'+_0x8f241f+'/'+_0x845968)[_0x73c5('0x16')](_0x58661f);}return null;};}function patchUpdates(_0x3e6123){return function(_0x3cda31){try{jsonpatch[_0x73c5('0x1a')](_0x3cda31,_0x3e6123,!![]);}catch(_0x3d72d2){return BPromise['reject'](_0x3d72d2);}return _0x3cda31[_0x73c5('0x1b')]();};}function saveUpdates(_0x30c499,_0x25a3cf){return function(_0x476689){if(_0x476689){return _0x476689['update'](_0x30c499)[_0x73c5('0x1c')](function(_0x30757c){return _0x30757c;});}return null;};}function removeEntity(_0x456b04,_0x2b7107){return function(_0x1646b4){if(_0x1646b4){return _0x1646b4['destroy']()[_0x73c5('0x1c')](function(){_0x456b04[_0x73c5('0x14')](0xcc)[_0x73c5('0x15')]();});}};}function handleEntityNotFound(_0x15be3c,_0x4044f6){return function(_0x3eb296){if(!_0x3eb296){_0x15be3c[_0x73c5('0x13')](0x194);}return _0x3eb296;};}function handleError(_0x583246,_0x25d64b){_0x25d64b=_0x25d64b||0x1f4;return function(_0x2ce85b){logger[_0x73c5('0x1d')](_0x2ce85b[_0x73c5('0x1e')]);if(_0x2ce85b['name']){delete _0x2ce85b['name'];}_0x583246[_0x73c5('0x14')](_0x25d64b)[_0x73c5('0x1f')](_0x2ce85b);};}exports[_0x73c5('0x20')]=function(_0x4abd00,_0x5edfee){var _0x56107c={},_0x28927={},_0x5c123e={'count':0x0,'rows':[]};var _0x57d5ee=_[_0x73c5('0x21')](db[_0x73c5('0x22')][_0x73c5('0x23')],function(_0x490461){return{'name':_0x490461[_0x73c5('0x24')],'type':_0x490461[_0x73c5('0x25')][_0x73c5('0x26')]};});_0x28927[_0x73c5('0x27')]=_['map'](_0x57d5ee,'name');_0x28927[_0x73c5('0x28')]=_[_0x73c5('0x29')](_0x4abd00[_0x73c5('0x28')]);_0x28927[_0x73c5('0x2a')]=_[_0x73c5('0x2b')](_0x28927[_0x73c5('0x27')],_0x28927[_0x73c5('0x28')]);_0x56107c[_0x73c5('0x2c')]=_[_0x73c5('0x2b')](_0x28927['model'],qs[_0x73c5('0x2d')](_0x4abd00[_0x73c5('0x28')]['fields']));_0x56107c[_0x73c5('0x2c')]=_0x56107c[_0x73c5('0x2c')]['length']?_0x56107c['attributes']:_0x28927[_0x73c5('0x27')];if(!_0x4abd00[_0x73c5('0x28')][_0x73c5('0x2e')](_0x73c5('0x2f'))){_0x56107c[_0x73c5('0x30')]=qs[_0x73c5('0x30')](_0x4abd00[_0x73c5('0x28')][_0x73c5('0x30')]);_0x56107c[_0x73c5('0x18')]=qs['offset'](_0x4abd00[_0x73c5('0x28')]['offset']);}_0x56107c[_0x73c5('0x31')]=qs[_0x73c5('0x32')](_0x4abd00[_0x73c5('0x28')]['sort']);_0x56107c[_0x73c5('0x33')]=qs[_0x73c5('0x2a')](_[_0x73c5('0x34')](_0x4abd00['query'],_0x28927[_0x73c5('0x2a')]),_0x57d5ee);if(_0x4abd00[_0x73c5('0x28')][_0x73c5('0x35')]){_0x56107c[_0x73c5('0x33')]=_['merge'](_0x56107c[_0x73c5('0x33')],{'$or':_['map'](_0x57d5ee,function(_0xf5c072){if(_0xf5c072['type']!=='VIRTUAL'){var _0x111fcf={};_0x111fcf[_0xf5c072[_0x73c5('0x36')]]={'$like':'%'+_0x4abd00[_0x73c5('0x28')][_0x73c5('0x35')]+'%'};return _0x111fcf;}})});}_0x56107c=_[_0x73c5('0x37')]({},_0x56107c,_0x4abd00[_0x73c5('0x38')]);var _0x2488f7={'where':_0x56107c[_0x73c5('0x33')]};return db['CmHopperHistory']['count'](_0x2488f7)['then'](function(_0x75abb0){_0x5c123e['count']=_0x75abb0;if(_0x4abd00[_0x73c5('0x28')][_0x73c5('0x39')]){_0x56107c['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x73c5('0x3a')](_0x56107c);})['then'](function(_0x473161){_0x5c123e[_0x73c5('0x3b')]=_0x473161;return _0x5c123e;})[_0x73c5('0x1c')](respondWithFilteredResult(_0x5edfee,_0x56107c))[_0x73c5('0x3c')](handleError(_0x5edfee,null));};exports[_0x73c5('0x3d')]=function(_0x42e33e,_0x3c8c34){var _0x3bf0c5={'raw':!![],'where':{'id':_0x42e33e[_0x73c5('0x3e')]['id']}},_0x2c4aa7={};_0x2c4aa7['model']=_[_0x73c5('0x29')](db[_0x73c5('0x22')][_0x73c5('0x23')]);_0x2c4aa7[_0x73c5('0x28')]=_[_0x73c5('0x29')](_0x42e33e[_0x73c5('0x28')]);_0x2c4aa7['filters']=_[_0x73c5('0x2b')](_0x2c4aa7[_0x73c5('0x27')],_0x2c4aa7[_0x73c5('0x28')]);_0x3bf0c5[_0x73c5('0x2c')]=_[_0x73c5('0x2b')](_0x2c4aa7[_0x73c5('0x27')],qs[_0x73c5('0x2d')](_0x42e33e[_0x73c5('0x28')]['fields']));_0x3bf0c5[_0x73c5('0x2c')]=_0x3bf0c5[_0x73c5('0x2c')][_0x73c5('0x3f')]?_0x3bf0c5['attributes']:_0x2c4aa7['model'];if(_0x42e33e['query'][_0x73c5('0x39')]){_0x3bf0c5[_0x73c5('0x40')]=[{'all':!![]}];}_0x3bf0c5=_['merge']({},_0x3bf0c5,_0x42e33e[_0x73c5('0x38')]);return db['CmHopperHistory']['find'](_0x3bf0c5)[_0x73c5('0x1c')](handleEntityNotFound(_0x3c8c34,null))['then'](respondWithResult(_0x3c8c34,null))[_0x73c5('0x3c')](handleError(_0x3c8c34,null));};exports[_0x73c5('0x41')]=function(_0x159e48,_0x95e787){return db[_0x73c5('0x22')][_0x73c5('0x41')](_0x159e48[_0x73c5('0x42')],{})[_0x73c5('0x1c')](respondWithResult(_0x95e787,0xc9))[_0x73c5('0x3c')](handleError(_0x95e787,null));};exports['describe']=function(_0x71dc27,_0x3fcd04){return db['CmHopperHistory'][_0x73c5('0x43')]()[_0x73c5('0x1c')](respondWithResult(_0x3fcd04,null))[_0x73c5('0x3c')](handleError(_0x3fcd04,null));};exports[_0x73c5('0x44')]=function(_0x296200,_0x5bf40b){if(_0x296200[_0x73c5('0x42')][_0x73c5('0x45')]){delete _0x296200['body'][_0x73c5('0x45')];}return db[_0x73c5('0x22')]['find']({'where':{'uniqueid':_0x296200[_0x73c5('0x3e')]['id']}})[_0x73c5('0x1c')](handleEntityNotFound(_0x5bf40b,null))[_0x73c5('0x1c')](saveUpdates(_0x296200[_0x73c5('0x42')],null))[_0x73c5('0x1c')](respondWithResult(_0x5bf40b,null))[_0x73c5('0x3c')](handleError(_0x5bf40b,null));};
\ No newline at end of file
+var _0xce5d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','CmHopperHistory','findAll','rows','show','params','keys','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0xce5d,0x120));var _0xdce5=function(_0x35bca2,_0x4ce50d){_0x35bca2=_0x35bca2-0x0;var _0x295d7a=_0xce5d[_0x35bca2];return _0x295d7a;};'use strict';var emlformat=require(_0xdce5('0x0'));var rimraf=require(_0xdce5('0x1'));var zipdir=require(_0xdce5('0x2'));var jsonpatch=require(_0xdce5('0x3'));var rp=require(_0xdce5('0x4'));var moment=require(_0xdce5('0x5'));var BPromise=require(_0xdce5('0x6'));var Mustache=require(_0xdce5('0x7'));var util=require(_0xdce5('0x8'));var path=require(_0xdce5('0x9'));var sox=require('sox');var csv=require(_0xdce5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdce5('0xb'));var _=require(_0xdce5('0xc'));var squel=require('squel');var crypto=require(_0xdce5('0xd'));var jsforce=require(_0xdce5('0xe'));var deskjs=require(_0xdce5('0xf'));var toCsv=require(_0xdce5('0xa'));var querystring=require(_0xdce5('0x10'));var Papa=require(_0xdce5('0x11'));var Redis=require('ioredis');var authService=require(_0xdce5('0x12'));var qs=require(_0xdce5('0x13'));var as=require(_0xdce5('0x14'));var hardwareService=require(_0xdce5('0x15'));var logger=require(_0xdce5('0x16'))('api');var utils=require(_0xdce5('0x17'));var config=require(_0xdce5('0x18'));var licenseUtil=require(_0xdce5('0x19'));var db=require(_0xdce5('0x1a'))['db'];function respondWithStatusCode(_0x4fb36d,_0x187f78){_0x187f78=_0x187f78||0xcc;return function(_0x23253e){if(_0x23253e){return _0x4fb36d[_0xdce5('0x1b')](_0x187f78);}return _0x4fb36d[_0xdce5('0x1c')](_0x187f78)[_0xdce5('0x1d')]();};}function respondWithResult(_0x3dd253,_0x467043){_0x467043=_0x467043||0xc8;return function(_0x5ed86f){if(_0x5ed86f){return _0x3dd253[_0xdce5('0x1c')](_0x467043)[_0xdce5('0x1e')](_0x5ed86f);}};}function respondWithFilteredResult(_0x50730a,_0x4b6b02){return function(_0x3b3903){if(_0x3b3903){var _0x1025d8=typeof _0x4b6b02['offset']===_0xdce5('0x1f')&&typeof _0x4b6b02[_0xdce5('0x20')]===_0xdce5('0x1f');var _0x195907=_0x3b3903['count'];var _0x1e4da1=_0x1025d8?0x0:_0x4b6b02['offset'];var _0x18ec57=_0x1025d8?_0x3b3903[_0xdce5('0x21')]:_0x4b6b02[_0xdce5('0x22')]+_0x4b6b02['limit'];var _0x57262f;if(_0x18ec57>=_0x195907){_0x18ec57=_0x195907;_0x57262f=0xc8;}else{_0x57262f=0xce;}_0x50730a[_0xdce5('0x1c')](_0x57262f);return _0x50730a['set'](_0xdce5('0x23'),_0x1e4da1+'-'+_0x18ec57+'/'+_0x195907)[_0xdce5('0x1e')](_0x3b3903);}return null;};}function patchUpdates(_0x899213){return function(_0x301618){try{jsonpatch[_0xdce5('0x24')](_0x301618,_0x899213,!![]);}catch(_0x39541d){return BPromise[_0xdce5('0x25')](_0x39541d);}return _0x301618['save']();};}function saveUpdates(_0x1be9f2,_0x4fcfb6){return function(_0x1c366c){if(_0x1c366c){return _0x1c366c[_0xdce5('0x26')](_0x1be9f2)[_0xdce5('0x27')](function(_0x1dfb5d){return _0x1dfb5d;});}return null;};}function removeEntity(_0x1ad119,_0x3b8c8e){return function(_0x5c6fe3){if(_0x5c6fe3){return _0x5c6fe3[_0xdce5('0x28')]()[_0xdce5('0x27')](function(){_0x1ad119[_0xdce5('0x1c')](0xcc)[_0xdce5('0x1d')]();});}};}function handleEntityNotFound(_0x4db274,_0x2a2fed){return function(_0x3d594e){if(!_0x3d594e){_0x4db274[_0xdce5('0x1b')](0x194);}return _0x3d594e;};}function handleError(_0x19e29a,_0x1b4eff){_0x1b4eff=_0x1b4eff||0x1f4;return function(_0x18ec78){logger[_0xdce5('0x29')](_0x18ec78[_0xdce5('0x2a')]);if(_0x18ec78[_0xdce5('0x2b')]){delete _0x18ec78[_0xdce5('0x2b')];}_0x19e29a[_0xdce5('0x1c')](_0x1b4eff)['send'](_0x18ec78);};}exports[_0xdce5('0x2c')]=function(_0x14ce8a,_0x237434){var _0x19ba50={},_0x32f6d0={},_0x144799={'count':0x0,'rows':[]};var _0x282e44=_['map'](db['CmHopperHistory'][_0xdce5('0x2d')],function(_0x3fd548){return{'name':_0x3fd548[_0xdce5('0x2e')],'type':_0x3fd548[_0xdce5('0x2f')][_0xdce5('0x30')]};});_0x32f6d0[_0xdce5('0x31')]=_[_0xdce5('0x32')](_0x282e44,_0xdce5('0x2b'));_0x32f6d0[_0xdce5('0x33')]=_['keys'](_0x14ce8a['query']);_0x32f6d0['filters']=_['intersection'](_0x32f6d0[_0xdce5('0x31')],_0x32f6d0['query']);_0x19ba50[_0xdce5('0x34')]=_[_0xdce5('0x35')](_0x32f6d0['model'],qs[_0xdce5('0x36')](_0x14ce8a['query']['fields']));_0x19ba50['attributes']=_0x19ba50[_0xdce5('0x34')][_0xdce5('0x37')]?_0x19ba50['attributes']:_0x32f6d0['model'];if(!_0x14ce8a['query']['hasOwnProperty'](_0xdce5('0x38'))){_0x19ba50[_0xdce5('0x20')]=qs['limit'](_0x14ce8a['query']['limit']);_0x19ba50[_0xdce5('0x22')]=qs['offset'](_0x14ce8a[_0xdce5('0x33')][_0xdce5('0x22')]);}_0x19ba50[_0xdce5('0x39')]=qs[_0xdce5('0x3a')](_0x14ce8a[_0xdce5('0x33')][_0xdce5('0x3a')]);_0x19ba50[_0xdce5('0x3b')]=qs[_0xdce5('0x3c')](_['pick'](_0x14ce8a['query'],_0x32f6d0[_0xdce5('0x3c')]),_0x282e44);if(_0x14ce8a[_0xdce5('0x33')]['filter']){_0x19ba50['where']=_[_0xdce5('0x3d')](_0x19ba50[_0xdce5('0x3b')],{'$or':_[_0xdce5('0x32')](_0x282e44,function(_0xae5b26){if(_0xae5b26['type']!==_0xdce5('0x3e')){var _0x3d5c7e={};_0x3d5c7e[_0xae5b26[_0xdce5('0x2b')]]={'$like':'%'+_0x14ce8a[_0xdce5('0x33')]['filter']+'%'};return _0x3d5c7e;}})});}_0x19ba50=_[_0xdce5('0x3d')]({},_0x19ba50,_0x14ce8a[_0xdce5('0x3f')]);var _0x3d2eea={'where':_0x19ba50['where']};return db['CmHopperHistory'][_0xdce5('0x21')](_0x3d2eea)[_0xdce5('0x27')](function(_0x41aac0){_0x144799['count']=_0x41aac0;if(_0x14ce8a[_0xdce5('0x33')][_0xdce5('0x40')]){_0x19ba50[_0xdce5('0x41')]=[{'all':!![]}];}return db[_0xdce5('0x42')][_0xdce5('0x43')](_0x19ba50);})['then'](function(_0x63ab2c){_0x144799[_0xdce5('0x44')]=_0x63ab2c;return _0x144799;})['then'](respondWithFilteredResult(_0x237434,_0x19ba50))['catch'](handleError(_0x237434,null));};exports[_0xdce5('0x45')]=function(_0x7788e2,_0x501ec5){var _0x3771b0={'raw':!![],'where':{'id':_0x7788e2[_0xdce5('0x46')]['id']}},_0x366399={};_0x366399[_0xdce5('0x31')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x366399[_0xdce5('0x33')]=_[_0xdce5('0x47')](_0x7788e2['query']);_0x366399['filters']=_[_0xdce5('0x35')](_0x366399['model'],_0x366399[_0xdce5('0x33')]);_0x3771b0[_0xdce5('0x34')]=_[_0xdce5('0x35')](_0x366399[_0xdce5('0x31')],qs[_0xdce5('0x36')](_0x7788e2[_0xdce5('0x33')]['fields']));_0x3771b0[_0xdce5('0x34')]=_0x3771b0['attributes'][_0xdce5('0x37')]?_0x3771b0[_0xdce5('0x34')]:_0x366399[_0xdce5('0x31')];if(_0x7788e2[_0xdce5('0x33')]['includeAll']){_0x3771b0['include']=[{'all':!![]}];}_0x3771b0=_[_0xdce5('0x3d')]({},_0x3771b0,_0x7788e2['options']);return db[_0xdce5('0x42')][_0xdce5('0x48')](_0x3771b0)[_0xdce5('0x27')](handleEntityNotFound(_0x501ec5,null))[_0xdce5('0x27')](respondWithResult(_0x501ec5,null))[_0xdce5('0x49')](handleError(_0x501ec5,null));};exports[_0xdce5('0x4a')]=function(_0x13d972,_0x4114af){return db['CmHopperHistory'][_0xdce5('0x4a')](_0x13d972[_0xdce5('0x4b')],{})[_0xdce5('0x27')](respondWithResult(_0x4114af,0xc9))[_0xdce5('0x49')](handleError(_0x4114af,null));};exports[_0xdce5('0x4c')]=function(_0x4d0a07,_0x33741c){return db[_0xdce5('0x42')][_0xdce5('0x4c')]()[_0xdce5('0x27')](respondWithResult(_0x33741c,null))[_0xdce5('0x49')](handleError(_0x33741c,null));};exports[_0xdce5('0x26')]=function(_0x868e48,_0x7afb18){if(_0x868e48[_0xdce5('0x4b')][_0xdce5('0x4d')]){delete _0x868e48['body'][_0xdce5('0x4d')];}return db[_0xdce5('0x42')][_0xdce5('0x48')]({'where':{'uniqueid':_0x868e48['params']['id']}})[_0xdce5('0x27')](handleEntityNotFound(_0x7afb18,null))[_0xdce5('0x27')](saveUpdates(_0x868e48[_0xdce5('0x4b')],null))[_0xdce5('0x27')](respondWithResult(_0x7afb18,null))['catch'](handleError(_0x7afb18,null));};
\ No newline at end of file