Built motion from commit (unavailable).|2.5.19
[motion2.git] / server / api / cmHopperBlack / cmHopperBlack.controller.js
index 0ffb113..7a42369 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x235b=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','CmHopperBlack','fieldName','type','query','filters','intersection','attributes','model','fields','length','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash'];(function(_0x1a5f4e,_0x25b10c){var _0x47165e=function(_0x18ae02){while(--_0x18ae02){_0x1a5f4e['push'](_0x1a5f4e['shift']());}};_0x47165e(++_0x25b10c);}(_0x235b,0x1ed));var _0xb235=function(_0x58d71e,_0x1c86cc){_0x58d71e=_0x58d71e-0x0;var _0x345456=_0x235b[_0x58d71e];return _0x345456;};'use strict';var pdf=require(_0xb235('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb235('0x1'));var jsonpatch=require(_0xb235('0x2'));var rp=require(_0xb235('0x3'));var moment=require(_0xb235('0x4'));var BPromise=require(_0xb235('0x5'));var Mustache=require(_0xb235('0x6'));var util=require('util');var path=require(_0xb235('0x7'));var sox=require(_0xb235('0x8'));var csv=require(_0xb235('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb235('0xa'));var squel=require(_0xb235('0xb'));var crypto=require(_0xb235('0xc'));var jsforce=require(_0xb235('0xd'));var deskjs=require(_0xb235('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb235('0xf'));var Redis=require(_0xb235('0x10'));var authService=require(_0xb235('0x11'));var qs=require(_0xb235('0x12'));var as=require(_0xb235('0x13'));var hardwareService=require(_0xb235('0x14'));var logger=require(_0xb235('0x15'))(_0xb235('0x16'));var utils=require('../../config/utils');var config=require(_0xb235('0x17'));var db=require(_0xb235('0x18'))['db'];function respondWithStatusCode(_0x297f8a,_0x4e9804){_0x4e9804=_0x4e9804||0xcc;return function(_0x438371){if(_0x438371){return _0x297f8a['sendStatus'](_0x4e9804);}return _0x297f8a[_0xb235('0x19')](_0x4e9804)[_0xb235('0x1a')]();};}function respondWithResult(_0x2457ee,_0x147c1e){_0x147c1e=_0x147c1e||0xc8;return function(_0x47510a){if(_0x47510a){return _0x2457ee[_0xb235('0x19')](_0x147c1e)[_0xb235('0x1b')](_0x47510a);}};}function respondWithFilteredResult(_0x53b15a,_0xa2ac23){return function(_0x2f5a4d){if(_0x2f5a4d){var _0x3d6ebc=_0x2f5a4d[_0xb235('0x1c')],_0xa5e185=_0xa2ac23[_0xb235('0x1d')],_0x3fe421=_0xa2ac23[_0xb235('0x1d')]+_0xa2ac23[_0xb235('0x1e')],_0x34419c;if(_0x3fe421>=_0x3d6ebc){_0x3fe421=_0x3d6ebc;_0x34419c=0xc8;}else{_0x34419c=0xce;}_0x53b15a[_0xb235('0x19')](_0x34419c);return _0x53b15a[_0xb235('0x1f')](_0xb235('0x20'),_0xa5e185+'-'+_0x3fe421+'/'+_0x3d6ebc)['json'](_0x2f5a4d);}return null;};}function patchUpdates(_0x167be5){return function(_0x59f9bc){try{jsonpatch[_0xb235('0x21')](_0x59f9bc,_0x167be5,!![]);}catch(_0x5d73bc){return BPromise[_0xb235('0x22')](_0x5d73bc);}return _0x59f9bc[_0xb235('0x23')]();};}function saveUpdates(_0x4c71ac,_0x447ec6){return function(_0x3a9699){if(_0x3a9699){return _0x3a9699[_0xb235('0x24')](_0x4c71ac)[_0xb235('0x25')](function(_0x2af268){return _0x2af268;});}return null;};}function removeEntity(_0x5608cc,_0x26d55d){return function(_0x12f787){if(_0x12f787){return _0x12f787[_0xb235('0x26')]()[_0xb235('0x25')](function(){_0x5608cc[_0xb235('0x19')](0xcc)[_0xb235('0x1a')]();});}};}function handleEntityNotFound(_0x57a3a8,_0x3eaa0d){return function(_0x57d7f5){if(!_0x57d7f5){_0x57a3a8[_0xb235('0x27')](0x194);}return _0x57d7f5;};}function handleError(_0x1d7122,_0xb97b29){_0xb97b29=_0xb97b29||0x1f4;return function(_0x4b1463){logger['error'](_0x4b1463['stack']);if(_0x4b1463[_0xb235('0x28')]){delete _0x4b1463['name'];}_0x1d7122['status'](_0xb97b29)[_0xb235('0x29')](_0x4b1463);};}exports[_0xb235('0x2a')]=function(_0x3ddd77,_0x48814e){var _0x2cf4a1={},_0x5a39ac={},_0x4da8fc={'count':0x0,'rows':[]};var _0x33ac0c=_[_0xb235('0x2b')](db[_0xb235('0x2c')]['rawAttributes'],function(_0xa6def8){return{'name':_0xa6def8[_0xb235('0x2d')],'type':_0xa6def8[_0xb235('0x2e')]['key']};});_0x5a39ac['model']=_[_0xb235('0x2b')](_0x33ac0c,'name');_0x5a39ac[_0xb235('0x2f')]=_['keys'](_0x3ddd77['query']);_0x5a39ac[_0xb235('0x30')]=_[_0xb235('0x31')](_0x5a39ac['model'],_0x5a39ac[_0xb235('0x2f')]);_0x2cf4a1[_0xb235('0x32')]=_[_0xb235('0x31')](_0x5a39ac[_0xb235('0x33')],qs[_0xb235('0x34')](_0x3ddd77[_0xb235('0x2f')][_0xb235('0x34')]));_0x2cf4a1[_0xb235('0x32')]=_0x2cf4a1[_0xb235('0x32')][_0xb235('0x35')]?_0x2cf4a1['attributes']:_0x5a39ac['model'];if(!_0x3ddd77[_0xb235('0x2f')]['hasOwnProperty']('nolimit')){_0x2cf4a1[_0xb235('0x1e')]=qs[_0xb235('0x1e')](_0x3ddd77[_0xb235('0x2f')][_0xb235('0x1e')]);_0x2cf4a1[_0xb235('0x1d')]=qs['offset'](_0x3ddd77[_0xb235('0x2f')][_0xb235('0x1d')]);}_0x2cf4a1[_0xb235('0x36')]=qs[_0xb235('0x37')](_0x3ddd77[_0xb235('0x2f')][_0xb235('0x37')]);_0x2cf4a1[_0xb235('0x38')]=qs[_0xb235('0x30')](_['pick'](_0x3ddd77[_0xb235('0x2f')],_0x5a39ac['filters']));if(_0x3ddd77[_0xb235('0x2f')]['filter']){_0x2cf4a1[_0xb235('0x38')]=_[_0xb235('0x39')](_0x2cf4a1['where'],{'$or':_[_0xb235('0x2b')](_0x33ac0c,function(_0x5a3b64){if(_0x5a3b64[_0xb235('0x2e')]!==_0xb235('0x3a')){var _0x2efa3c={};_0x2efa3c[_0x5a3b64[_0xb235('0x28')]]={'$like':'%'+_0x3ddd77['query']['filter']+'%'};return _0x2efa3c;}})});}_0x2cf4a1=_[_0xb235('0x39')]({},_0x2cf4a1,_0x3ddd77[_0xb235('0x3b')]);var _0x5d9a1a={'where':_0x2cf4a1[_0xb235('0x38')]};return db['CmHopperBlack'][_0xb235('0x1c')](_0x5d9a1a)['then'](function(_0x126f2f){_0x4da8fc[_0xb235('0x1c')]=_0x126f2f;if(_0x3ddd77[_0xb235('0x2f')]['includeAll']){_0x2cf4a1[_0xb235('0x3c')]=[{'all':!![]}];}return db[_0xb235('0x2c')][_0xb235('0x3d')](_0x2cf4a1);})[_0xb235('0x25')](function(_0x5eb410){_0x4da8fc[_0xb235('0x3e')]=_0x5eb410;return _0x4da8fc;})[_0xb235('0x25')](respondWithFilteredResult(_0x48814e,_0x2cf4a1))[_0xb235('0x3f')](handleError(_0x48814e,null));};exports[_0xb235('0x40')]=function(_0x3b3c7e,_0x436d6e){var _0x274ed8={'raw':!![],'where':{'id':_0x3b3c7e[_0xb235('0x41')]['id']}},_0x4e0292={};_0x4e0292[_0xb235('0x33')]=_[_0xb235('0x42')](db[_0xb235('0x2c')][_0xb235('0x43')]);_0x4e0292['query']=_['keys'](_0x3b3c7e[_0xb235('0x2f')]);_0x4e0292[_0xb235('0x30')]=_[_0xb235('0x31')](_0x4e0292['model'],_0x4e0292[_0xb235('0x2f')]);_0x274ed8[_0xb235('0x32')]=_[_0xb235('0x31')](_0x4e0292[_0xb235('0x33')],qs[_0xb235('0x34')](_0x3b3c7e[_0xb235('0x2f')]['fields']));_0x274ed8['attributes']=_0x274ed8['attributes'][_0xb235('0x35')]?_0x274ed8[_0xb235('0x32')]:_0x4e0292[_0xb235('0x33')];if(_0x3b3c7e[_0xb235('0x2f')][_0xb235('0x44')]){_0x274ed8[_0xb235('0x3c')]=[{'all':!![]}];}_0x274ed8=_['merge']({},_0x274ed8,_0x3b3c7e[_0xb235('0x3b')]);return db[_0xb235('0x2c')][_0xb235('0x45')](_0x274ed8)[_0xb235('0x25')](handleEntityNotFound(_0x436d6e,null))[_0xb235('0x25')](respondWithResult(_0x436d6e,null))[_0xb235('0x3f')](handleError(_0x436d6e,null));};exports[_0xb235('0x24')]=function(_0x54c68c,_0x54bd20){if(_0x54c68c['body']['id']){delete _0x54c68c[_0xb235('0x46')]['id'];}return db['CmHopperBlack'][_0xb235('0x45')]({'where':{'id':_0x54c68c[_0xb235('0x41')]['id']}})[_0xb235('0x25')](handleEntityNotFound(_0x54bd20,null))[_0xb235('0x25')](saveUpdates(_0x54c68c[_0xb235('0x46')],null))['then'](respondWithResult(_0x54bd20,null))['catch'](handleError(_0x54bd20,null));};exports['destroy']=function(_0x250b3d,_0x1608fe){return db[_0xb235('0x2c')][_0xb235('0x45')]({'where':{'id':_0x250b3d[_0xb235('0x41')]['id']}})['then'](handleEntityNotFound(_0x1608fe,null))[_0xb235('0x25')](removeEntity(_0x1608fe,null))[_0xb235('0x3f')](handleError(_0x1608fe,null));};exports['describe']=function(_0x49625d,_0x444958){return db['CmHopperBlack'][_0xb235('0x47')]()[_0xb235('0x25')](respondWithResult(_0x444958,null))[_0xb235('0x3f')](handleError(_0x444958,null));};
\ No newline at end of file
+var _0xddc9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','includeAll','CmHopperBlack','findAll','rows','catch','show','options','find','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5894ac,_0x149226){var _0x2c3bae=function(_0x4b7bee){while(--_0x4b7bee){_0x5894ac['push'](_0x5894ac['shift']());}};_0x2c3bae(++_0x149226);}(_0xddc9,0x11d));var _0x9ddc=function(_0x376d9a,_0x26a6d9){_0x376d9a=_0x376d9a-0x0;var _0x5a12ea=_0xddc9[_0x376d9a];return _0x5a12ea;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9ddc('0x0'));var rimraf=require(_0x9ddc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ddc('0x2'));var rp=require(_0x9ddc('0x3'));var moment=require(_0x9ddc('0x4'));var BPromise=require(_0x9ddc('0x5'));var Mustache=require(_0x9ddc('0x6'));var util=require(_0x9ddc('0x7'));var path=require(_0x9ddc('0x8'));var sox=require('sox');var csv=require(_0x9ddc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ddc('0xa'));var squel=require(_0x9ddc('0xb'));var crypto=require(_0x9ddc('0xc'));var jsforce=require(_0x9ddc('0xd'));var deskjs=require(_0x9ddc('0xe'));var toCsv=require(_0x9ddc('0x9'));var querystring=require('querystring');var Papa=require(_0x9ddc('0xf'));var Redis=require(_0x9ddc('0x10'));var authService=require(_0x9ddc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ddc('0x12'));var hardwareService=require(_0x9ddc('0x13'));var logger=require(_0x9ddc('0x14'))(_0x9ddc('0x15'));var utils=require(_0x9ddc('0x16'));var config=require(_0x9ddc('0x17'));var licenseUtil=require(_0x9ddc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa6b90,_0x165709){_0x165709=_0x165709||0xcc;return function(_0x3fac28){if(_0x3fac28){return _0xaa6b90[_0x9ddc('0x19')](_0x165709);}return _0xaa6b90[_0x9ddc('0x1a')](_0x165709)[_0x9ddc('0x1b')]();};}function respondWithResult(_0x52be17,_0x4a8eb6){_0x4a8eb6=_0x4a8eb6||0xc8;return function(_0x24a75e){if(_0x24a75e){return _0x52be17[_0x9ddc('0x1a')](_0x4a8eb6)[_0x9ddc('0x1c')](_0x24a75e);}};}function respondWithFilteredResult(_0x3655b2,_0x403523){return function(_0x2a4dcb){if(_0x2a4dcb){var _0x2714fc=_0x2a4dcb[_0x9ddc('0x1d')],_0xc84407=_0x403523[_0x9ddc('0x1e')],_0x52129a=_0x403523[_0x9ddc('0x1e')]+_0x403523['limit'],_0x2bb6ee;if(_0x52129a>=_0x2714fc){_0x52129a=_0x2714fc;_0x2bb6ee=0xc8;}else{_0x2bb6ee=0xce;}_0x3655b2['status'](_0x2bb6ee);return _0x3655b2[_0x9ddc('0x1f')](_0x9ddc('0x20'),_0xc84407+'-'+_0x52129a+'/'+_0x2714fc)[_0x9ddc('0x1c')](_0x2a4dcb);}return null;};}function patchUpdates(_0x15f93c){return function(_0x3277f7){try{jsonpatch[_0x9ddc('0x21')](_0x3277f7,_0x15f93c,!![]);}catch(_0x520834){return BPromise[_0x9ddc('0x22')](_0x520834);}return _0x3277f7[_0x9ddc('0x23')]();};}function saveUpdates(_0x2be643,_0xb48d63){return function(_0xde665e){if(_0xde665e){return _0xde665e[_0x9ddc('0x24')](_0x2be643)[_0x9ddc('0x25')](function(_0x1f0a68){return _0x1f0a68;});}return null;};}function removeEntity(_0x67b83,_0x10bbad){return function(_0x41a880){if(_0x41a880){return _0x41a880[_0x9ddc('0x26')]()['then'](function(){_0x67b83[_0x9ddc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e70e7,_0x571cf7){return function(_0x476ca4){if(!_0x476ca4){_0x5e70e7[_0x9ddc('0x19')](0x194);}return _0x476ca4;};}function handleError(_0x7698c9,_0x54937b){_0x54937b=_0x54937b||0x1f4;return function(_0x589c20){logger[_0x9ddc('0x27')](_0x589c20[_0x9ddc('0x28')]);if(_0x589c20[_0x9ddc('0x29')]){delete _0x589c20[_0x9ddc('0x29')];}_0x7698c9[_0x9ddc('0x1a')](_0x54937b)[_0x9ddc('0x2a')](_0x589c20);};}exports[_0x9ddc('0x2b')]=function(_0x303029,_0x4f961c){var _0x46ef7f={},_0x257d93={},_0x4f48cd={'count':0x0,'rows':[]};var _0x9fba59=_['map'](db['CmHopperBlack'][_0x9ddc('0x2c')],function(_0x1722bf){return{'name':_0x1722bf[_0x9ddc('0x2d')],'type':_0x1722bf[_0x9ddc('0x2e')][_0x9ddc('0x2f')]};});_0x257d93[_0x9ddc('0x30')]=_[_0x9ddc('0x31')](_0x9fba59,'name');_0x257d93['query']=_[_0x9ddc('0x32')](_0x303029[_0x9ddc('0x33')]);_0x257d93[_0x9ddc('0x34')]=_['intersection'](_0x257d93[_0x9ddc('0x30')],_0x257d93['query']);_0x46ef7f[_0x9ddc('0x35')]=_[_0x9ddc('0x36')](_0x257d93[_0x9ddc('0x30')],qs[_0x9ddc('0x37')](_0x303029[_0x9ddc('0x33')]['fields']));_0x46ef7f['attributes']=_0x46ef7f[_0x9ddc('0x35')][_0x9ddc('0x38')]?_0x46ef7f[_0x9ddc('0x35')]:_0x257d93[_0x9ddc('0x30')];if(!_0x303029['query']['hasOwnProperty'](_0x9ddc('0x39'))){_0x46ef7f[_0x9ddc('0x3a')]=qs['limit'](_0x303029['query'][_0x9ddc('0x3a')]);_0x46ef7f[_0x9ddc('0x1e')]=qs[_0x9ddc('0x1e')](_0x303029['query']['offset']);}_0x46ef7f['order']=qs[_0x9ddc('0x3b')](_0x303029[_0x9ddc('0x33')][_0x9ddc('0x3b')]);_0x46ef7f[_0x9ddc('0x3c')]=qs['filters'](_[_0x9ddc('0x3d')](_0x303029[_0x9ddc('0x33')],_0x257d93[_0x9ddc('0x34')]),_0x9fba59);if(_0x303029[_0x9ddc('0x33')][_0x9ddc('0x3e')]){_0x46ef7f[_0x9ddc('0x3c')]=_[_0x9ddc('0x3f')](_0x46ef7f[_0x9ddc('0x3c')],{'$or':_[_0x9ddc('0x31')](_0x9fba59,function(_0x4803b3){if(_0x4803b3[_0x9ddc('0x2e')]!=='VIRTUAL'){var _0x2f57c1={};_0x2f57c1[_0x4803b3[_0x9ddc('0x29')]]={'$like':'%'+_0x303029[_0x9ddc('0x33')][_0x9ddc('0x3e')]+'%'};return _0x2f57c1;}})});}_0x46ef7f=_[_0x9ddc('0x3f')]({},_0x46ef7f,_0x303029['options']);var _0x4f73e0={'where':_0x46ef7f['where']};return db['CmHopperBlack'][_0x9ddc('0x1d')](_0x4f73e0)[_0x9ddc('0x25')](function(_0x8b1638){_0x4f48cd[_0x9ddc('0x1d')]=_0x8b1638;if(_0x303029[_0x9ddc('0x33')][_0x9ddc('0x40')]){_0x46ef7f['include']=[{'all':!![]}];}return db[_0x9ddc('0x41')][_0x9ddc('0x42')](_0x46ef7f);})[_0x9ddc('0x25')](function(_0x262f68){_0x4f48cd[_0x9ddc('0x43')]=_0x262f68;return _0x4f48cd;})[_0x9ddc('0x25')](respondWithFilteredResult(_0x4f961c,_0x46ef7f))[_0x9ddc('0x44')](handleError(_0x4f961c,null));};exports[_0x9ddc('0x45')]=function(_0x5c43c2,_0x34f41a){var _0x4ece3a={'raw':!![],'where':{'id':_0x5c43c2['params']['id']}},_0x44f30e={};_0x44f30e[_0x9ddc('0x30')]=_[_0x9ddc('0x32')](db[_0x9ddc('0x41')][_0x9ddc('0x2c')]);_0x44f30e['query']=_[_0x9ddc('0x32')](_0x5c43c2[_0x9ddc('0x33')]);_0x44f30e['filters']=_['intersection'](_0x44f30e['model'],_0x44f30e[_0x9ddc('0x33')]);_0x4ece3a[_0x9ddc('0x35')]=_[_0x9ddc('0x36')](_0x44f30e[_0x9ddc('0x30')],qs[_0x9ddc('0x37')](_0x5c43c2[_0x9ddc('0x33')][_0x9ddc('0x37')]));_0x4ece3a[_0x9ddc('0x35')]=_0x4ece3a[_0x9ddc('0x35')][_0x9ddc('0x38')]?_0x4ece3a[_0x9ddc('0x35')]:_0x44f30e[_0x9ddc('0x30')];if(_0x5c43c2[_0x9ddc('0x33')][_0x9ddc('0x40')]){_0x4ece3a['include']=[{'all':!![]}];}_0x4ece3a=_['merge']({},_0x4ece3a,_0x5c43c2[_0x9ddc('0x46')]);return db[_0x9ddc('0x41')][_0x9ddc('0x47')](_0x4ece3a)[_0x9ddc('0x25')](handleEntityNotFound(_0x34f41a,null))[_0x9ddc('0x25')](respondWithResult(_0x34f41a,null))[_0x9ddc('0x44')](handleError(_0x34f41a,null));};exports[_0x9ddc('0x24')]=function(_0x48ddc5,_0x3c4952){if(_0x48ddc5[_0x9ddc('0x48')]['id']){delete _0x48ddc5[_0x9ddc('0x48')]['id'];}return db[_0x9ddc('0x41')]['find']({'where':{'id':_0x48ddc5[_0x9ddc('0x49')]['id']}})[_0x9ddc('0x25')](handleEntityNotFound(_0x3c4952,null))[_0x9ddc('0x25')](saveUpdates(_0x48ddc5[_0x9ddc('0x48')],null))[_0x9ddc('0x25')](respondWithResult(_0x3c4952,null))['catch'](handleError(_0x3c4952,null));};exports[_0x9ddc('0x26')]=function(_0x113e60,_0x2ca70b){return db[_0x9ddc('0x41')]['find']({'where':{'id':_0x113e60[_0x9ddc('0x49')]['id']}})[_0x9ddc('0x25')](handleEntityNotFound(_0x2ca70b,null))['then'](removeEntity(_0x2ca70b,null))[_0x9ddc('0x44')](handleError(_0x2ca70b,null));};exports[_0x9ddc('0x4a')]=function(_0xacf632,_0x16bab9){return db[_0x9ddc('0x41')]['describe']()[_0x9ddc('0x25')](respondWithResult(_0x16bab9,null))[_0x9ddc('0x44')](handleError(_0x16bab9,null));};
\ No newline at end of file