Built motion from commit 37e1ed56.|2.6.29
[motion2.git] / server / api / cmHopperHistory / cmHopperHistory.controller.js
index ef9d429..de9dd41 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x955f=['merge','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x28591f,_0x4a012d){var _0x314e4c=function(_0x1f21a7){while(--_0x1f21a7){_0x28591f['push'](_0x28591f['shift']());}};_0x314e4c(++_0x4a012d);}(_0x955f,0x1cd));var _0xf955=function(_0x5678c5,_0x31c5ca){_0x5678c5=_0x5678c5-0x0;var _0x1c9a76=_0x955f[_0x5678c5];return _0x1c9a76;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf955('0x2'));var rp=require(_0xf955('0x3'));var moment=require('moment');var BPromise=require(_0xf955('0x4'));var Mustache=require(_0xf955('0x5'));var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require('to-csv');var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require(_0xf955('0xa'));var squel=require(_0xf955('0xb'));var crypto=require(_0xf955('0xc'));var jsforce=require(_0xf955('0xd'));var deskjs=require(_0xf955('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf955('0xf'));var Papa=require(_0xf955('0x10'));var Redis=require('ioredis');var authService=require(_0xf955('0x11'));var qs=require(_0xf955('0x12'));var as=require(_0xf955('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf955('0x14'))(_0xf955('0x15'));var utils=require(_0xf955('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf955('0x17'));var db=require(_0xf955('0x18'))['db'];function respondWithStatusCode(_0xe03645,_0x2d1895){_0x2d1895=_0x2d1895||0xcc;return function(_0x492daf){if(_0x492daf){return _0xe03645[_0xf955('0x19')](_0x2d1895);}return _0xe03645[_0xf955('0x1a')](_0x2d1895)[_0xf955('0x1b')]();};}function respondWithResult(_0x28cd39,_0x4bf688){_0x4bf688=_0x4bf688||0xc8;return function(_0x547367){if(_0x547367){return _0x28cd39['status'](_0x4bf688)[_0xf955('0x1c')](_0x547367);}};}function respondWithFilteredResult(_0x11550a,_0x4f5397){return function(_0x78d687){if(_0x78d687){var _0x22eb57=typeof _0x4f5397['offset']===_0xf955('0x1d')&&typeof _0x4f5397[_0xf955('0x1e')]===_0xf955('0x1d');var _0x13ba7c=_0x78d687[_0xf955('0x1f')];var _0x224ec0=_0x22eb57?0x0:_0x4f5397[_0xf955('0x20')];var _0x5e4877=_0x22eb57?_0x78d687[_0xf955('0x1f')]:_0x4f5397[_0xf955('0x20')]+_0x4f5397[_0xf955('0x1e')];var _0x4a2231;if(_0x5e4877>=_0x13ba7c){_0x5e4877=_0x13ba7c;_0x4a2231=0xc8;}else{_0x4a2231=0xce;}_0x11550a[_0xf955('0x1a')](_0x4a2231);return _0x11550a[_0xf955('0x21')]('Content-Range',_0x224ec0+'-'+_0x5e4877+'/'+_0x13ba7c)[_0xf955('0x1c')](_0x78d687);}return null;};}function patchUpdates(_0x4d63ac){return function(_0x23f905){try{jsonpatch['apply'](_0x23f905,_0x4d63ac,!![]);}catch(_0xebfd93){return BPromise[_0xf955('0x22')](_0xebfd93);}return _0x23f905[_0xf955('0x23')]();};}function saveUpdates(_0x411dec,_0x5667e5){return function(_0x4088aa){if(_0x4088aa){return _0x4088aa[_0xf955('0x24')](_0x411dec)[_0xf955('0x25')](function(_0x143e51){return _0x143e51;});}return null;};}function removeEntity(_0x22faac,_0x4f6dac){return function(_0x272749){if(_0x272749){return _0x272749['destroy']()[_0xf955('0x25')](function(){_0x22faac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x84cce3,_0x40b472){return function(_0x51a4e6){if(!_0x51a4e6){_0x84cce3[_0xf955('0x19')](0x194);}return _0x51a4e6;};}function handleError(_0x5b3e2d,_0x772435){_0x772435=_0x772435||0x1f4;return function(_0x1df7da){logger[_0xf955('0x26')](_0x1df7da[_0xf955('0x27')]);if(_0x1df7da[_0xf955('0x28')]){delete _0x1df7da[_0xf955('0x28')];}_0x5b3e2d['status'](_0x772435)['send'](_0x1df7da);};}exports[_0xf955('0x29')]=function(_0x3f5142,_0x3e069c){var _0x1bfcd0={},_0x3d6228={},_0x43bf75={'count':0x0,'rows':[]};var _0x308384=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x326e10){return{'name':_0x326e10[_0xf955('0x2a')],'type':_0x326e10[_0xf955('0x2b')][_0xf955('0x2c')]};});_0x3d6228[_0xf955('0x2d')]=_[_0xf955('0x2e')](_0x308384,'name');_0x3d6228[_0xf955('0x2f')]=_[_0xf955('0x30')](_0x3f5142[_0xf955('0x2f')]);_0x3d6228[_0xf955('0x31')]=_[_0xf955('0x32')](_0x3d6228[_0xf955('0x2d')],_0x3d6228[_0xf955('0x2f')]);_0x1bfcd0['attributes']=_[_0xf955('0x32')](_0x3d6228[_0xf955('0x2d')],qs['fields'](_0x3f5142['query'][_0xf955('0x33')]));_0x1bfcd0[_0xf955('0x34')]=_0x1bfcd0[_0xf955('0x34')][_0xf955('0x35')]?_0x1bfcd0['attributes']:_0x3d6228[_0xf955('0x2d')];if(!_0x3f5142[_0xf955('0x2f')][_0xf955('0x36')](_0xf955('0x37'))){_0x1bfcd0[_0xf955('0x1e')]=qs[_0xf955('0x1e')](_0x3f5142['query'][_0xf955('0x1e')]);_0x1bfcd0['offset']=qs['offset'](_0x3f5142[_0xf955('0x2f')][_0xf955('0x20')]);}_0x1bfcd0[_0xf955('0x38')]=qs[_0xf955('0x39')](_0x3f5142['query'][_0xf955('0x39')]);_0x1bfcd0['where']=qs['filters'](_[_0xf955('0x3a')](_0x3f5142[_0xf955('0x2f')],_0x3d6228['filters']),_0x308384);if(_0x3f5142[_0xf955('0x2f')][_0xf955('0x3b')]){_0x1bfcd0['where']=_['merge'](_0x1bfcd0['where'],{'$or':_[_0xf955('0x2e')](_0x308384,function(_0x342e98){if(_0x342e98[_0xf955('0x2b')]!==_0xf955('0x3c')){var _0x30597d={};_0x30597d[_0x342e98['name']]={'$like':'%'+_0x3f5142[_0xf955('0x2f')][_0xf955('0x3b')]+'%'};return _0x30597d;}})});}_0x1bfcd0=_['merge']({},_0x1bfcd0,_0x3f5142[_0xf955('0x3d')]);var _0x102281={'where':_0x1bfcd0['where']};return db[_0xf955('0x3e')][_0xf955('0x1f')](_0x102281)['then'](function(_0x5c3d10){_0x43bf75[_0xf955('0x1f')]=_0x5c3d10;if(_0x3f5142[_0xf955('0x2f')][_0xf955('0x3f')]){_0x1bfcd0[_0xf955('0x40')]=[{'all':!![]}];}return db[_0xf955('0x3e')][_0xf955('0x41')](_0x1bfcd0);})['then'](function(_0x1f1ac4){_0x43bf75[_0xf955('0x42')]=_0x1f1ac4;return _0x43bf75;})['then'](respondWithFilteredResult(_0x3e069c,_0x1bfcd0))[_0xf955('0x43')](handleError(_0x3e069c,null));};exports[_0xf955('0x44')]=function(_0x194736,_0x43e211){var _0x10788d={'raw':!![],'where':{'id':_0x194736[_0xf955('0x45')]['id']}},_0x200eec={};_0x200eec[_0xf955('0x2d')]=_['keys'](db['CmHopperHistory'][_0xf955('0x46')]);_0x200eec[_0xf955('0x2f')]=_['keys'](_0x194736[_0xf955('0x2f')]);_0x200eec[_0xf955('0x31')]=_[_0xf955('0x32')](_0x200eec[_0xf955('0x2d')],_0x200eec[_0xf955('0x2f')]);_0x10788d[_0xf955('0x34')]=_[_0xf955('0x32')](_0x200eec[_0xf955('0x2d')],qs[_0xf955('0x33')](_0x194736[_0xf955('0x2f')][_0xf955('0x33')]));_0x10788d[_0xf955('0x34')]=_0x10788d[_0xf955('0x34')]['length']?_0x10788d[_0xf955('0x34')]:_0x200eec[_0xf955('0x2d')];if(_0x194736['query'][_0xf955('0x3f')]){_0x10788d[_0xf955('0x40')]=[{'all':!![]}];}_0x10788d=_[_0xf955('0x47')]({},_0x10788d,_0x194736[_0xf955('0x3d')]);return db[_0xf955('0x3e')]['find'](_0x10788d)[_0xf955('0x25')](handleEntityNotFound(_0x43e211,null))[_0xf955('0x25')](respondWithResult(_0x43e211,null))[_0xf955('0x43')](handleError(_0x43e211,null));};exports[_0xf955('0x48')]=function(_0x181746,_0x181686){return db[_0xf955('0x3e')][_0xf955('0x48')](_0x181746[_0xf955('0x49')],{})['then'](respondWithResult(_0x181686,0xc9))[_0xf955('0x43')](handleError(_0x181686,null));};exports[_0xf955('0x4a')]=function(_0x103cd6,_0x2feeef){return db['CmHopperHistory']['describe']()[_0xf955('0x25')](respondWithResult(_0x2feeef,null))['catch'](handleError(_0x2feeef,null));};exports[_0xf955('0x24')]=function(_0x5974b8,_0x56122f){if(_0x5974b8['body']['uniqueid']){delete _0x5974b8[_0xf955('0x49')][_0xf955('0x4b')];}return db[_0xf955('0x3e')]['find']({'where':{'uniqueid':_0x5974b8[_0xf955('0x45')]['id']}})[_0xf955('0x25')](handleEntityNotFound(_0x56122f,null))[_0xf955('0x25')](saveUpdates(_0x5974b8[_0xf955('0x49')],null))[_0xf955('0x25')](respondWithResult(_0x56122f,null))[_0xf955('0x43')](handleError(_0x56122f,null));};
\ No newline at end of file
+var _0x9224=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x25ac65,_0x7ec673){var _0x4510d3=function(_0x2a5e0d){while(--_0x2a5e0d){_0x25ac65['push'](_0x25ac65['shift']());}};_0x4510d3(++_0x7ec673);}(_0x9224,0xd3));var _0x4922=function(_0xb0327f,_0x35e914){_0xb0327f=_0xb0327f-0x0;var _0x5b694a=_0x9224[_0xb0327f];return _0x5b694a;};'use strict';var emlformat=require(_0x4922('0x0'));var rimraf=require(_0x4922('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4922('0x2'));var rp=require(_0x4922('0x3'));var moment=require(_0x4922('0x4'));var BPromise=require(_0x4922('0x5'));var Mustache=require('mustache');var util=require(_0x4922('0x6'));var path=require(_0x4922('0x7'));var sox=require(_0x4922('0x8'));var csv=require(_0x4922('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4922('0xa'));var _=require(_0x4922('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4922('0xc'));var deskjs=require(_0x4922('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4922('0xe'));var Redis=require(_0x4922('0xf'));var authService=require(_0x4922('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4922('0x11'));var hardwareService=require(_0x4922('0x12'));var logger=require(_0x4922('0x13'))('api');var utils=require(_0x4922('0x14'));var config=require(_0x4922('0x15'));var licenseUtil=require(_0x4922('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc4c8cf,_0x248015){_0x248015=_0x248015||0xcc;return function(_0x1ff263){if(_0x1ff263){return _0xc4c8cf[_0x4922('0x17')](_0x248015);}return _0xc4c8cf[_0x4922('0x18')](_0x248015)[_0x4922('0x19')]();};}function respondWithResult(_0x3b8107,_0x300590){_0x300590=_0x300590||0xc8;return function(_0x175433){if(_0x175433){return _0x3b8107['status'](_0x300590)[_0x4922('0x1a')](_0x175433);}};}function respondWithFilteredResult(_0x2aa94d,_0x4935a9){return function(_0x1c337e){if(_0x1c337e){var _0x231c2d=typeof _0x4935a9['offset']===_0x4922('0x1b')&&typeof _0x4935a9[_0x4922('0x1c')]===_0x4922('0x1b');var _0x140d1f=_0x1c337e[_0x4922('0x1d')];var _0x2cc3a0=_0x231c2d?0x0:_0x4935a9[_0x4922('0x1e')];var _0x9fa235=_0x231c2d?_0x1c337e[_0x4922('0x1d')]:_0x4935a9[_0x4922('0x1e')]+_0x4935a9['limit'];var _0x5470f0;if(_0x9fa235>=_0x140d1f){_0x9fa235=_0x140d1f;_0x5470f0=0xc8;}else{_0x5470f0=0xce;}_0x2aa94d[_0x4922('0x18')](_0x5470f0);return _0x2aa94d[_0x4922('0x1f')](_0x4922('0x20'),_0x2cc3a0+'-'+_0x9fa235+'/'+_0x140d1f)[_0x4922('0x1a')](_0x1c337e);}return null;};}function patchUpdates(_0x3367f3){return function(_0x288621){try{jsonpatch['apply'](_0x288621,_0x3367f3,!![]);}catch(_0x17f4ea){return BPromise[_0x4922('0x21')](_0x17f4ea);}return _0x288621[_0x4922('0x22')]();};}function saveUpdates(_0x33b0d5,_0x56120f){return function(_0x2e5244){if(_0x2e5244){return _0x2e5244[_0x4922('0x23')](_0x33b0d5)[_0x4922('0x24')](function(_0x445388){return _0x445388;});}return null;};}function removeEntity(_0x33d8b1,_0x4535cf){return function(_0x176e19){if(_0x176e19){return _0x176e19[_0x4922('0x25')]()[_0x4922('0x24')](function(){_0x33d8b1[_0x4922('0x18')](0xcc)[_0x4922('0x19')]();});}};}function handleEntityNotFound(_0x14cc21,_0x2850dd){return function(_0x1c3a21){if(!_0x1c3a21){_0x14cc21[_0x4922('0x17')](0x194);}return _0x1c3a21;};}function handleError(_0x3ee0e9,_0x18f777){_0x18f777=_0x18f777||0x1f4;return function(_0x5eefc8){logger[_0x4922('0x26')](_0x5eefc8[_0x4922('0x27')]);if(_0x5eefc8[_0x4922('0x28')]){delete _0x5eefc8[_0x4922('0x28')];}_0x3ee0e9[_0x4922('0x18')](_0x18f777)[_0x4922('0x29')](_0x5eefc8);};}exports[_0x4922('0x2a')]=function(_0x215bc7,_0xa2eb9e){var _0x37aa1d={},_0x45334e={},_0x4a3150={'count':0x0,'rows':[]};var _0x182e1d=_[_0x4922('0x2b')](db[_0x4922('0x2c')][_0x4922('0x2d')],function(_0x17590b){return{'name':_0x17590b[_0x4922('0x2e')],'type':_0x17590b[_0x4922('0x2f')]['key']};});_0x45334e[_0x4922('0x30')]=_['map'](_0x182e1d,_0x4922('0x28'));_0x45334e[_0x4922('0x31')]=_[_0x4922('0x32')](_0x215bc7['query']);_0x45334e[_0x4922('0x33')]=_[_0x4922('0x34')](_0x45334e[_0x4922('0x30')],_0x45334e[_0x4922('0x31')]);_0x37aa1d[_0x4922('0x35')]=_[_0x4922('0x34')](_0x45334e['model'],qs[_0x4922('0x36')](_0x215bc7[_0x4922('0x31')][_0x4922('0x36')]));_0x37aa1d[_0x4922('0x35')]=_0x37aa1d[_0x4922('0x35')][_0x4922('0x37')]?_0x37aa1d['attributes']:_0x45334e[_0x4922('0x30')];if(!_0x215bc7['query'][_0x4922('0x38')](_0x4922('0x39'))){_0x37aa1d[_0x4922('0x1c')]=qs[_0x4922('0x1c')](_0x215bc7[_0x4922('0x31')][_0x4922('0x1c')]);_0x37aa1d[_0x4922('0x1e')]=qs[_0x4922('0x1e')](_0x215bc7[_0x4922('0x31')][_0x4922('0x1e')]);}_0x37aa1d[_0x4922('0x3a')]=qs[_0x4922('0x3b')](_0x215bc7[_0x4922('0x31')][_0x4922('0x3b')]);_0x37aa1d[_0x4922('0x3c')]=qs['filters'](_[_0x4922('0x3d')](_0x215bc7[_0x4922('0x31')],_0x45334e['filters']),_0x182e1d);if(_0x215bc7[_0x4922('0x31')][_0x4922('0x3e')]){_0x37aa1d[_0x4922('0x3c')]=_[_0x4922('0x3f')](_0x37aa1d[_0x4922('0x3c')],{'$or':_[_0x4922('0x2b')](_0x182e1d,function(_0x1e0bd7){if(_0x1e0bd7['type']!==_0x4922('0x40')){var _0x1f3fd7={};_0x1f3fd7[_0x1e0bd7['name']]={'$like':'%'+_0x215bc7[_0x4922('0x31')][_0x4922('0x3e')]+'%'};return _0x1f3fd7;}})});}_0x37aa1d=_['merge']({},_0x37aa1d,_0x215bc7['options']);var _0x5e6274={'where':_0x37aa1d[_0x4922('0x3c')]};return db[_0x4922('0x2c')][_0x4922('0x1d')](_0x5e6274)[_0x4922('0x24')](function(_0x563eb2){_0x4a3150[_0x4922('0x1d')]=_0x563eb2;if(_0x215bc7[_0x4922('0x31')][_0x4922('0x41')]){_0x37aa1d[_0x4922('0x42')]=[{'all':!![]}];}return db[_0x4922('0x2c')][_0x4922('0x43')](_0x37aa1d);})[_0x4922('0x24')](function(_0x9e2b16){_0x4a3150[_0x4922('0x44')]=_0x9e2b16;return _0x4a3150;})[_0x4922('0x24')](respondWithFilteredResult(_0xa2eb9e,_0x37aa1d))['catch'](handleError(_0xa2eb9e,null));};exports[_0x4922('0x45')]=function(_0x3d35f5,_0x3da89c){var _0x223581={'raw':!![],'where':{'id':_0x3d35f5[_0x4922('0x46')]['id']}},_0x32b988={};_0x32b988[_0x4922('0x30')]=_[_0x4922('0x32')](db[_0x4922('0x2c')]['rawAttributes']);_0x32b988[_0x4922('0x31')]=_[_0x4922('0x32')](_0x3d35f5[_0x4922('0x31')]);_0x32b988[_0x4922('0x33')]=_[_0x4922('0x34')](_0x32b988['model'],_0x32b988['query']);_0x223581[_0x4922('0x35')]=_[_0x4922('0x34')](_0x32b988[_0x4922('0x30')],qs['fields'](_0x3d35f5[_0x4922('0x31')][_0x4922('0x36')]));_0x223581[_0x4922('0x35')]=_0x223581[_0x4922('0x35')][_0x4922('0x37')]?_0x223581[_0x4922('0x35')]:_0x32b988['model'];if(_0x3d35f5[_0x4922('0x31')]['includeAll']){_0x223581[_0x4922('0x42')]=[{'all':!![]}];}_0x223581=_[_0x4922('0x3f')]({},_0x223581,_0x3d35f5['options']);return db[_0x4922('0x2c')][_0x4922('0x47')](_0x223581)['then'](handleEntityNotFound(_0x3da89c,null))[_0x4922('0x24')](respondWithResult(_0x3da89c,null))[_0x4922('0x48')](handleError(_0x3da89c,null));};exports[_0x4922('0x49')]=function(_0x31f6ee,_0x36cf11){return db[_0x4922('0x2c')][_0x4922('0x49')](_0x31f6ee[_0x4922('0x4a')],{})[_0x4922('0x24')](respondWithResult(_0x36cf11,0xc9))['catch'](handleError(_0x36cf11,null));};exports[_0x4922('0x4b')]=function(_0x134c03,_0x598a97){return db[_0x4922('0x2c')][_0x4922('0x4b')]()['then'](respondWithResult(_0x598a97,null))[_0x4922('0x48')](handleError(_0x598a97,null));};exports['update']=function(_0x3bed22,_0x51b98e){if(_0x3bed22[_0x4922('0x4a')][_0x4922('0x4c')]){delete _0x3bed22[_0x4922('0x4a')][_0x4922('0x4c')];}return db[_0x4922('0x2c')][_0x4922('0x47')]({'where':{'uniqueid':_0x3bed22[_0x4922('0x46')]['id']}})[_0x4922('0x24')](handleEntityNotFound(_0x51b98e,null))[_0x4922('0x24')](saveUpdates(_0x3bed22[_0x4922('0x4a')],null))[_0x4922('0x24')](respondWithResult(_0x51b98e,null))[_0x4922('0x48')](handleError(_0x51b98e,null));};
\ No newline at end of file