Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index 560430e..45848a1 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 _0xcfd5=['crypto','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','intersection','options','find','body','catch','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4f39de,_0x595d15){var _0xe8eeb9=function(_0x4cd423){while(--_0x4cd423){_0x4f39de['push'](_0x4f39de['shift']());}};_0xe8eeb9(++_0x595d15);}(_0xcfd5,0x112));var _0x5cfd=function(_0xde9c14,_0x5947d4){_0xde9c14=_0xde9c14-0x0;var _0x14fedd=_0xcfd5[_0xde9c14];return _0x14fedd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cfd('0x0'));var zipdir=require(_0x5cfd('0x1'));var jsonpatch=require(_0x5cfd('0x2'));var rp=require(_0x5cfd('0x3'));var moment=require(_0x5cfd('0x4'));var BPromise=require(_0x5cfd('0x5'));var Mustache=require('mustache');var util=require(_0x5cfd('0x6'));var path=require(_0x5cfd('0x7'));var sox=require(_0x5cfd('0x8'));var csv=require(_0x5cfd('0x9'));var ejs=require(_0x5cfd('0xa'));var fs=require('fs');var fs_extra=require(_0x5cfd('0xb'));var _=require(_0x5cfd('0xc'));var squel=require(_0x5cfd('0xd'));var crypto=require(_0x5cfd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5cfd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5cfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5cfd('0x10'));var hardwareService=require(_0x5cfd('0x11'));var logger=require(_0x5cfd('0x12'))(_0x5cfd('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5cfd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0309,_0x14d3bf){_0x14d3bf=_0x14d3bf||0xcc;return function(_0x54d648){if(_0x54d648){return _0x4c0309[_0x5cfd('0x15')](_0x14d3bf);}return _0x4c0309[_0x5cfd('0x16')](_0x14d3bf)[_0x5cfd('0x17')]();};}function respondWithResult(_0x56b4d4,_0x1f218a){_0x1f218a=_0x1f218a||0xc8;return function(_0x38959b){if(_0x38959b){return _0x56b4d4[_0x5cfd('0x16')](_0x1f218a)[_0x5cfd('0x18')](_0x38959b);}};}function respondWithFilteredResult(_0x46b050,_0x1da81e){return function(_0x10da32){if(_0x10da32){var _0x10d1fe=typeof _0x1da81e['offset']===_0x5cfd('0x19')&&typeof _0x1da81e[_0x5cfd('0x1a')]===_0x5cfd('0x19');var _0x5a78ff=_0x10da32[_0x5cfd('0x1b')];var _0x53754d=_0x10d1fe?0x0:_0x1da81e[_0x5cfd('0x1c')];var _0xb25381=_0x10d1fe?_0x10da32['count']:_0x1da81e['offset']+_0x1da81e[_0x5cfd('0x1a')];var _0x2a2798;if(_0xb25381>=_0x5a78ff){_0xb25381=_0x5a78ff;_0x2a2798=0xc8;}else{_0x2a2798=0xce;}_0x46b050[_0x5cfd('0x16')](_0x2a2798);return _0x46b050[_0x5cfd('0x1d')](_0x5cfd('0x1e'),_0x53754d+'-'+_0xb25381+'/'+_0x5a78ff)[_0x5cfd('0x18')](_0x10da32);}return null;};}function patchUpdates(_0x385a49){return function(_0x34245d){try{jsonpatch[_0x5cfd('0x1f')](_0x34245d,_0x385a49,!![]);}catch(_0x43a142){return BPromise['reject'](_0x43a142);}return _0x34245d[_0x5cfd('0x20')]();};}function saveUpdates(_0x3b0e13,_0x470f29){return function(_0x1eb528){if(_0x1eb528){return _0x1eb528[_0x5cfd('0x21')](_0x3b0e13)[_0x5cfd('0x22')](function(_0x46fe71){return _0x46fe71;});}return null;};}function removeEntity(_0x1c111a,_0x5a914c){return function(_0x2be2d1){if(_0x2be2d1){return _0x2be2d1['destroy']()[_0x5cfd('0x22')](function(){_0x1c111a[_0x5cfd('0x16')](0xcc)[_0x5cfd('0x17')]();});}};}function handleEntityNotFound(_0x5c847f,_0x358f9c){return function(_0x1efd35){if(!_0x1efd35){_0x5c847f[_0x5cfd('0x15')](0x194);}return _0x1efd35;};}function handleError(_0x5cf553,_0x5633db){_0x5633db=_0x5633db||0x1f4;return function(_0x3dbe62){logger[_0x5cfd('0x23')](_0x3dbe62[_0x5cfd('0x24')]);if(_0x3dbe62[_0x5cfd('0x25')]){delete _0x3dbe62[_0x5cfd('0x25')];}_0x5cf553[_0x5cfd('0x16')](_0x5633db)[_0x5cfd('0x26')](_0x3dbe62);};}exports[_0x5cfd('0x27')]=function(_0x410ae7,_0x239a96){var _0x24b586={},_0x12b719={},_0x2f1b50={'count':0x0,'rows':[]};var _0x8b7fa0=_[_0x5cfd('0x28')](db[_0x5cfd('0x29')][_0x5cfd('0x2a')],function(_0x63d80f){return{'name':_0x63d80f[_0x5cfd('0x2b')],'type':_0x63d80f[_0x5cfd('0x2c')][_0x5cfd('0x2d')]};});_0x12b719[_0x5cfd('0x2e')]=_[_0x5cfd('0x28')](_0x8b7fa0,'name');_0x12b719[_0x5cfd('0x2f')]=_[_0x5cfd('0x30')](_0x410ae7[_0x5cfd('0x2f')]);_0x12b719[_0x5cfd('0x31')]=_['intersection'](_0x12b719['model'],_0x12b719[_0x5cfd('0x2f')]);_0x24b586['attributes']=_['intersection'](_0x12b719[_0x5cfd('0x2e')],qs[_0x5cfd('0x32')](_0x410ae7[_0x5cfd('0x2f')]['fields']));_0x24b586[_0x5cfd('0x33')]=_0x24b586[_0x5cfd('0x33')][_0x5cfd('0x34')]?_0x24b586[_0x5cfd('0x33')]:_0x12b719['model'];if(!_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x35')]('nolimit')){_0x24b586['limit']=qs[_0x5cfd('0x1a')](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x1a')]);_0x24b586[_0x5cfd('0x1c')]=qs['offset'](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x1c')]);}_0x24b586['order']=qs[_0x5cfd('0x36')](_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x36')]);_0x24b586[_0x5cfd('0x37')]=qs[_0x5cfd('0x31')](_[_0x5cfd('0x38')](_0x410ae7[_0x5cfd('0x2f')],_0x12b719[_0x5cfd('0x31')]),_0x8b7fa0);if(_0x410ae7[_0x5cfd('0x2f')]['filter']){_0x24b586['where']=_[_0x5cfd('0x39')](_0x24b586['where'],{'$or':_[_0x5cfd('0x28')](_0x8b7fa0,function(_0x28e9ee){if(_0x28e9ee[_0x5cfd('0x2c')]!==_0x5cfd('0x3a')){var _0x447184={};_0x447184[_0x28e9ee['name']]={'$like':'%'+_0x410ae7[_0x5cfd('0x2f')][_0x5cfd('0x3b')]+'%'};return _0x447184;}})});}_0x24b586=_[_0x5cfd('0x39')]({},_0x24b586,_0x410ae7['options']);var _0x51218d={'where':_0x24b586[_0x5cfd('0x37')]};return db[_0x5cfd('0x29')][_0x5cfd('0x1b')](_0x51218d)[_0x5cfd('0x22')](function(_0x3d6bba){_0x2f1b50['count']=_0x3d6bba;if(_0x410ae7['query'][_0x5cfd('0x3c')]){_0x24b586[_0x5cfd('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5cfd('0x3e')](_0x24b586);})[_0x5cfd('0x22')](function(_0x59eae3){_0x2f1b50[_0x5cfd('0x3f')]=_0x59eae3;return _0x2f1b50;})['then'](respondWithFilteredResult(_0x239a96,_0x24b586))['catch'](handleError(_0x239a96,null));};exports['show']=function(_0x3785,_0x1ab837){var _0x1ee2ad={'raw':!![],'where':{'id':_0x3785[_0x5cfd('0x40')]['id']}},_0x2edf9e={};_0x2edf9e['model']=_[_0x5cfd('0x30')](db['CmHopperHistory']['rawAttributes']);_0x2edf9e[_0x5cfd('0x2f')]=_[_0x5cfd('0x30')](_0x3785[_0x5cfd('0x2f')]);_0x2edf9e[_0x5cfd('0x31')]=_[_0x5cfd('0x41')](_0x2edf9e['model'],_0x2edf9e[_0x5cfd('0x2f')]);_0x1ee2ad[_0x5cfd('0x33')]=_[_0x5cfd('0x41')](_0x2edf9e[_0x5cfd('0x2e')],qs[_0x5cfd('0x32')](_0x3785[_0x5cfd('0x2f')][_0x5cfd('0x32')]));_0x1ee2ad[_0x5cfd('0x33')]=_0x1ee2ad[_0x5cfd('0x33')][_0x5cfd('0x34')]?_0x1ee2ad['attributes']:_0x2edf9e[_0x5cfd('0x2e')];if(_0x3785[_0x5cfd('0x2f')][_0x5cfd('0x3c')]){_0x1ee2ad[_0x5cfd('0x3d')]=[{'all':!![]}];}_0x1ee2ad=_['merge']({},_0x1ee2ad,_0x3785[_0x5cfd('0x42')]);return db['CmHopperHistory'][_0x5cfd('0x43')](_0x1ee2ad)['then'](handleEntityNotFound(_0x1ab837,null))['then'](respondWithResult(_0x1ab837,null))['catch'](handleError(_0x1ab837,null));};exports['create']=function(_0x212ad4,_0x421c57){return db['CmHopperHistory']['create'](_0x212ad4[_0x5cfd('0x44')],{})[_0x5cfd('0x22')](respondWithResult(_0x421c57,0xc9))[_0x5cfd('0x45')](handleError(_0x421c57,null));};exports[_0x5cfd('0x46')]=function(_0x29476c,_0x3b021e){return db[_0x5cfd('0x29')][_0x5cfd('0x46')]()[_0x5cfd('0x22')](respondWithResult(_0x3b021e,null))[_0x5cfd('0x45')](handleError(_0x3b021e,null));};exports[_0x5cfd('0x21')]=function(_0x320078,_0x2d968b){if(_0x320078[_0x5cfd('0x44')][_0x5cfd('0x47')]){delete _0x320078['body']['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x320078[_0x5cfd('0x40')]['id']}})[_0x5cfd('0x22')](handleEntityNotFound(_0x2d968b,null))['then'](saveUpdates(_0x320078[_0x5cfd('0x44')],null))[_0x5cfd('0x22')](respondWithResult(_0x2d968b,null))[_0x5cfd('0x45')](handleError(_0x2d968b,null));};
\ No newline at end of file