Built motion from commit (unavailable).|2.5.24
[motion2.git] / server / api / cmHopperBlack / cmHopperBlack.controller.js
index bf7fee3..d7a878a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaac8=['type','query','keys','filters','attributes','intersection','model','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','count','include','rows','show','params','fields','includeAll','find','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','index','map','CmHopperBlack','fieldName'];(function(_0x390c42,_0x10e1ae){var _0x43894c=function(_0x510bd0){while(--_0x510bd0){_0x390c42['push'](_0x390c42['shift']());}};_0x43894c(++_0x10e1ae);}(_0xaac8,0xa2));var _0x8aac=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xaac8[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8aac('0x0'));var rimraf=require(_0x8aac('0x1'));var zipdir=require(_0x8aac('0x2'));var jsonpatch=require(_0x8aac('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8aac('0x4'));var Mustache=require(_0x8aac('0x5'));var util=require(_0x8aac('0x6'));var path=require(_0x8aac('0x7'));var sox=require(_0x8aac('0x8'));var csv=require(_0x8aac('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8aac('0xa'));var squel=require(_0x8aac('0xb'));var crypto=require(_0x8aac('0xc'));var jsforce=require(_0x8aac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8aac('0x9'));var querystring=require('querystring');var Papa=require(_0x8aac('0xe'));var Redis=require('ioredis');var authService=require(_0x8aac('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8aac('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aac('0x11'))(_0x8aac('0x12'));var utils=require(_0x8aac('0x13'));var config=require(_0x8aac('0x14'));var licenseUtil=require(_0x8aac('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1982e1,_0x3dd6b0){_0x3dd6b0=_0x3dd6b0||0xcc;return function(_0x22f735){if(_0x22f735){return _0x1982e1[_0x8aac('0x16')](_0x3dd6b0);}return _0x1982e1[_0x8aac('0x17')](_0x3dd6b0)['end']();};}function respondWithResult(_0x45ee0d,_0x5afa82){_0x5afa82=_0x5afa82||0xc8;return function(_0x28b1ba){if(_0x28b1ba){return _0x45ee0d[_0x8aac('0x17')](_0x5afa82)[_0x8aac('0x18')](_0x28b1ba);}};}function respondWithFilteredResult(_0x5d4354,_0x1affda){return function(_0x599b5e){if(_0x599b5e){var _0x14954e=_0x599b5e['count'],_0x3d421d=_0x1affda[_0x8aac('0x19')],_0x12783c=_0x1affda['offset']+_0x1affda[_0x8aac('0x1a')],_0x584930;if(_0x12783c>=_0x14954e){_0x12783c=_0x14954e;_0x584930=0xc8;}else{_0x584930=0xce;}_0x5d4354['status'](_0x584930);return _0x5d4354[_0x8aac('0x1b')](_0x8aac('0x1c'),_0x3d421d+'-'+_0x12783c+'/'+_0x14954e)[_0x8aac('0x18')](_0x599b5e);}return null;};}function patchUpdates(_0x443bf7){return function(_0xb44055){try{jsonpatch[_0x8aac('0x1d')](_0xb44055,_0x443bf7,!![]);}catch(_0x26ec21){return BPromise[_0x8aac('0x1e')](_0x26ec21);}return _0xb44055['save']();};}function saveUpdates(_0x445556,_0x427262){return function(_0x258561){if(_0x258561){return _0x258561[_0x8aac('0x1f')](_0x445556)['then'](function(_0x14dad2){return _0x14dad2;});}return null;};}function removeEntity(_0x55ddec,_0x4d9a55){return function(_0x53ff08){if(_0x53ff08){return _0x53ff08[_0x8aac('0x20')]()[_0x8aac('0x21')](function(){_0x55ddec[_0x8aac('0x17')](0xcc)[_0x8aac('0x22')]();});}};}function handleEntityNotFound(_0x26ed58,_0x430145){return function(_0x2c9d8a){if(!_0x2c9d8a){_0x26ed58['sendStatus'](0x194);}return _0x2c9d8a;};}function handleError(_0x389689,_0x190e64){_0x190e64=_0x190e64||0x1f4;return function(_0x28de1a){logger['error'](_0x28de1a[_0x8aac('0x23')]);if(_0x28de1a[_0x8aac('0x24')]){delete _0x28de1a[_0x8aac('0x24')];}_0x389689[_0x8aac('0x17')](_0x190e64)[_0x8aac('0x25')](_0x28de1a);};}exports[_0x8aac('0x26')]=function(_0x27c036,_0xaae03c){var _0x13af54={},_0x51f068={},_0x4edb86={'count':0x0,'rows':[]};var _0x28a647=_[_0x8aac('0x27')](db[_0x8aac('0x28')]['rawAttributes'],function(_0x968018){return{'name':_0x968018[_0x8aac('0x29')],'type':_0x968018[_0x8aac('0x2a')]['key']};});_0x51f068['model']=_[_0x8aac('0x27')](_0x28a647,_0x8aac('0x24'));_0x51f068[_0x8aac('0x2b')]=_[_0x8aac('0x2c')](_0x27c036['query']);_0x51f068[_0x8aac('0x2d')]=_['intersection'](_0x51f068['model'],_0x51f068[_0x8aac('0x2b')]);_0x13af54[_0x8aac('0x2e')]=_[_0x8aac('0x2f')](_0x51f068[_0x8aac('0x30')],qs['fields'](_0x27c036[_0x8aac('0x2b')]['fields']));_0x13af54[_0x8aac('0x2e')]=_0x13af54[_0x8aac('0x2e')][_0x8aac('0x31')]?_0x13af54['attributes']:_0x51f068[_0x8aac('0x30')];if(!_0x27c036['query'][_0x8aac('0x32')]('nolimit')){_0x13af54[_0x8aac('0x1a')]=qs[_0x8aac('0x1a')](_0x27c036[_0x8aac('0x2b')][_0x8aac('0x1a')]);_0x13af54[_0x8aac('0x19')]=qs[_0x8aac('0x19')](_0x27c036[_0x8aac('0x2b')][_0x8aac('0x19')]);}_0x13af54['order']=qs['sort'](_0x27c036[_0x8aac('0x2b')][_0x8aac('0x33')]);_0x13af54[_0x8aac('0x34')]=qs[_0x8aac('0x2d')](_[_0x8aac('0x35')](_0x27c036['query'],_0x51f068['filters']),_0x28a647);if(_0x27c036['query']['filter']){_0x13af54['where']=_[_0x8aac('0x36')](_0x13af54[_0x8aac('0x34')],{'$or':_['map'](_0x28a647,function(_0x11e4f9){if(_0x11e4f9[_0x8aac('0x2a')]!==_0x8aac('0x37')){var _0x1c6bf7={};_0x1c6bf7[_0x11e4f9['name']]={'$like':'%'+_0x27c036[_0x8aac('0x2b')][_0x8aac('0x38')]+'%'};return _0x1c6bf7;}})});}_0x13af54=_[_0x8aac('0x36')]({},_0x13af54,_0x27c036['options']);var _0x36131e={'where':_0x13af54[_0x8aac('0x34')]};return db[_0x8aac('0x28')][_0x8aac('0x39')](_0x36131e)[_0x8aac('0x21')](function(_0x70c6b0){_0x4edb86[_0x8aac('0x39')]=_0x70c6b0;if(_0x27c036[_0x8aac('0x2b')]['includeAll']){_0x13af54[_0x8aac('0x3a')]=[{'all':!![]}];}return db[_0x8aac('0x28')]['findAll'](_0x13af54);})[_0x8aac('0x21')](function(_0x2e24a7){_0x4edb86[_0x8aac('0x3b')]=_0x2e24a7;return _0x4edb86;})[_0x8aac('0x21')](respondWithFilteredResult(_0xaae03c,_0x13af54))['catch'](handleError(_0xaae03c,null));};exports[_0x8aac('0x3c')]=function(_0x306d2a,_0x2e1124){var _0x31538e={'raw':!![],'where':{'id':_0x306d2a[_0x8aac('0x3d')]['id']}},_0x4feca1={};_0x4feca1[_0x8aac('0x30')]=_[_0x8aac('0x2c')](db[_0x8aac('0x28')]['rawAttributes']);_0x4feca1[_0x8aac('0x2b')]=_['keys'](_0x306d2a[_0x8aac('0x2b')]);_0x4feca1['filters']=_[_0x8aac('0x2f')](_0x4feca1[_0x8aac('0x30')],_0x4feca1['query']);_0x31538e[_0x8aac('0x2e')]=_[_0x8aac('0x2f')](_0x4feca1[_0x8aac('0x30')],qs[_0x8aac('0x3e')](_0x306d2a[_0x8aac('0x2b')][_0x8aac('0x3e')]));_0x31538e[_0x8aac('0x2e')]=_0x31538e[_0x8aac('0x2e')][_0x8aac('0x31')]?_0x31538e[_0x8aac('0x2e')]:_0x4feca1[_0x8aac('0x30')];if(_0x306d2a[_0x8aac('0x2b')][_0x8aac('0x3f')]){_0x31538e[_0x8aac('0x3a')]=[{'all':!![]}];}_0x31538e=_['merge']({},_0x31538e,_0x306d2a['options']);return db[_0x8aac('0x28')][_0x8aac('0x40')](_0x31538e)[_0x8aac('0x21')](handleEntityNotFound(_0x2e1124,null))['then'](respondWithResult(_0x2e1124,null))['catch'](handleError(_0x2e1124,null));};exports[_0x8aac('0x1f')]=function(_0x13aaee,_0x145572){if(_0x13aaee[_0x8aac('0x41')]['id']){delete _0x13aaee[_0x8aac('0x41')]['id'];}return db[_0x8aac('0x28')][_0x8aac('0x40')]({'where':{'id':_0x13aaee[_0x8aac('0x3d')]['id']}})[_0x8aac('0x21')](handleEntityNotFound(_0x145572,null))[_0x8aac('0x21')](saveUpdates(_0x13aaee[_0x8aac('0x41')],null))[_0x8aac('0x21')](respondWithResult(_0x145572,null))[_0x8aac('0x42')](handleError(_0x145572,null));};exports[_0x8aac('0x20')]=function(_0x52077d,_0x2908cf){return db[_0x8aac('0x28')][_0x8aac('0x40')]({'where':{'id':_0x52077d[_0x8aac('0x3d')]['id']}})[_0x8aac('0x21')](handleEntityNotFound(_0x2908cf,null))['then'](removeEntity(_0x2908cf,null))[_0x8aac('0x42')](handleError(_0x2908cf,null));};exports[_0x8aac('0x43')]=function(_0x57853e,_0x6e39a2){return db['CmHopperBlack'][_0x8aac('0x43')]()[_0x8aac('0x21')](respondWithResult(_0x6e39a2,null))[_0x8aac('0x42')](handleError(_0x6e39a2,null));};
\ No newline at end of file
+var _0x7c9a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','options','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3e52df,_0x3f347d){var _0x4ab783=function(_0x43e021){while(--_0x43e021){_0x3e52df['push'](_0x3e52df['shift']());}};_0x4ab783(++_0x3f347d);}(_0x7c9a,0xd0));var _0xa7c9=function(_0x17e315,_0x361db6){_0x17e315=_0x17e315-0x0;var _0x3e7afb=_0x7c9a[_0x17e315];return _0x3e7afb;};'use strict';var pdf=require(_0xa7c9('0x0'));var emlformat=require(_0xa7c9('0x1'));var rimraf=require(_0xa7c9('0x2'));var zipdir=require(_0xa7c9('0x3'));var jsonpatch=require(_0xa7c9('0x4'));var rp=require(_0xa7c9('0x5'));var moment=require(_0xa7c9('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa7c9('0x7'));var util=require(_0xa7c9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa7c9('0x9'));var ejs=require(_0xa7c9('0xa'));var fs=require('fs');var _=require(_0xa7c9('0xb'));var squel=require(_0xa7c9('0xc'));var crypto=require(_0xa7c9('0xd'));var jsforce=require(_0xa7c9('0xe'));var deskjs=require(_0xa7c9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa7c9('0x10'));var Papa=require(_0xa7c9('0x11'));var Redis=require(_0xa7c9('0x12'));var authService=require(_0xa7c9('0x13'));var qs=require(_0xa7c9('0x14'));var as=require(_0xa7c9('0x15'));var hardwareService=require(_0xa7c9('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xa7c9('0x17'));var config=require(_0xa7c9('0x18'));var licenseUtil=require(_0xa7c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2934a3,_0x3fb059){_0x3fb059=_0x3fb059||0xcc;return function(_0x32cd1f){if(_0x32cd1f){return _0x2934a3['sendStatus'](_0x3fb059);}return _0x2934a3[_0xa7c9('0x1a')](_0x3fb059)[_0xa7c9('0x1b')]();};}function respondWithResult(_0x2b9798,_0x240901){_0x240901=_0x240901||0xc8;return function(_0x2c9f4f){if(_0x2c9f4f){return _0x2b9798['status'](_0x240901)[_0xa7c9('0x1c')](_0x2c9f4f);}};}function respondWithFilteredResult(_0x4bd046,_0x13e02b){return function(_0x43cc27){if(_0x43cc27){var _0x19d3e4=_0x43cc27[_0xa7c9('0x1d')],_0x539547=_0x13e02b[_0xa7c9('0x1e')],_0x572292=_0x13e02b[_0xa7c9('0x1e')]+_0x13e02b['limit'],_0x516483;if(_0x572292>=_0x19d3e4){_0x572292=_0x19d3e4;_0x516483=0xc8;}else{_0x516483=0xce;}_0x4bd046[_0xa7c9('0x1a')](_0x516483);return _0x4bd046[_0xa7c9('0x1f')](_0xa7c9('0x20'),_0x539547+'-'+_0x572292+'/'+_0x19d3e4)['json'](_0x43cc27);}return null;};}function patchUpdates(_0x100c7c){return function(_0x29476f){try{jsonpatch['apply'](_0x29476f,_0x100c7c,!![]);}catch(_0x15235b){return BPromise[_0xa7c9('0x21')](_0x15235b);}return _0x29476f[_0xa7c9('0x22')]();};}function saveUpdates(_0xaadf33,_0x3f4625){return function(_0x5867d9){if(_0x5867d9){return _0x5867d9[_0xa7c9('0x23')](_0xaadf33)[_0xa7c9('0x24')](function(_0x18b612){return _0x18b612;});}return null;};}function removeEntity(_0x1a0f69,_0x45c340){return function(_0x1b0353){if(_0x1b0353){return _0x1b0353[_0xa7c9('0x25')]()[_0xa7c9('0x24')](function(){_0x1a0f69[_0xa7c9('0x1a')](0xcc)[_0xa7c9('0x1b')]();});}};}function handleEntityNotFound(_0x55e9a6,_0x5746df){return function(_0x10fa00){if(!_0x10fa00){_0x55e9a6[_0xa7c9('0x26')](0x194);}return _0x10fa00;};}function handleError(_0x1d21e2,_0xf95438){_0xf95438=_0xf95438||0x1f4;return function(_0x26bbc2){logger['error'](_0x26bbc2[_0xa7c9('0x27')]);if(_0x26bbc2[_0xa7c9('0x28')]){delete _0x26bbc2[_0xa7c9('0x28')];}_0x1d21e2[_0xa7c9('0x1a')](_0xf95438)['send'](_0x26bbc2);};}exports[_0xa7c9('0x29')]=function(_0xc43ee9,_0x1e55c5){var _0x135289={},_0x24fc41={},_0x2adbbc={'count':0x0,'rows':[]};var _0x1ee1f9=_[_0xa7c9('0x2a')](db['CmHopperBlack'][_0xa7c9('0x2b')],function(_0x2bd8c8){return{'name':_0x2bd8c8[_0xa7c9('0x2c')],'type':_0x2bd8c8['type'][_0xa7c9('0x2d')]};});_0x24fc41[_0xa7c9('0x2e')]=_[_0xa7c9('0x2a')](_0x1ee1f9,_0xa7c9('0x28'));_0x24fc41[_0xa7c9('0x2f')]=_[_0xa7c9('0x30')](_0xc43ee9['query']);_0x24fc41[_0xa7c9('0x31')]=_['intersection'](_0x24fc41['model'],_0x24fc41[_0xa7c9('0x2f')]);_0x135289['attributes']=_[_0xa7c9('0x32')](_0x24fc41[_0xa7c9('0x2e')],qs[_0xa7c9('0x33')](_0xc43ee9[_0xa7c9('0x2f')][_0xa7c9('0x33')]));_0x135289[_0xa7c9('0x34')]=_0x135289[_0xa7c9('0x34')][_0xa7c9('0x35')]?_0x135289['attributes']:_0x24fc41[_0xa7c9('0x2e')];if(!_0xc43ee9[_0xa7c9('0x2f')][_0xa7c9('0x36')](_0xa7c9('0x37'))){_0x135289['limit']=qs['limit'](_0xc43ee9[_0xa7c9('0x2f')][_0xa7c9('0x38')]);_0x135289[_0xa7c9('0x1e')]=qs[_0xa7c9('0x1e')](_0xc43ee9[_0xa7c9('0x2f')][_0xa7c9('0x1e')]);}_0x135289[_0xa7c9('0x39')]=qs[_0xa7c9('0x3a')](_0xc43ee9['query']['sort']);_0x135289[_0xa7c9('0x3b')]=qs[_0xa7c9('0x31')](_[_0xa7c9('0x3c')](_0xc43ee9[_0xa7c9('0x2f')],_0x24fc41['filters']),_0x1ee1f9);if(_0xc43ee9['query']['filter']){_0x135289[_0xa7c9('0x3b')]=_['merge'](_0x135289['where'],{'$or':_[_0xa7c9('0x2a')](_0x1ee1f9,function(_0x31b4f1){if(_0x31b4f1['type']!=='VIRTUAL'){var _0x47aea2={};_0x47aea2[_0x31b4f1[_0xa7c9('0x28')]]={'$like':'%'+_0xc43ee9['query'][_0xa7c9('0x3d')]+'%'};return _0x47aea2;}})});}_0x135289=_[_0xa7c9('0x3e')]({},_0x135289,_0xc43ee9['options']);var _0x4a6402={'where':_0x135289['where']};return db[_0xa7c9('0x3f')][_0xa7c9('0x1d')](_0x4a6402)[_0xa7c9('0x24')](function(_0x37f27f){_0x2adbbc['count']=_0x37f27f;if(_0xc43ee9[_0xa7c9('0x2f')][_0xa7c9('0x40')]){_0x135289[_0xa7c9('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa7c9('0x42')](_0x135289);})[_0xa7c9('0x24')](function(_0x2f8c4d){_0x2adbbc[_0xa7c9('0x43')]=_0x2f8c4d;return _0x2adbbc;})[_0xa7c9('0x24')](respondWithFilteredResult(_0x1e55c5,_0x135289))[_0xa7c9('0x44')](handleError(_0x1e55c5,null));};exports[_0xa7c9('0x45')]=function(_0x4ae69c,_0x12f8fe){var _0x16e351={'raw':!![],'where':{'id':_0x4ae69c[_0xa7c9('0x46')]['id']}},_0x42d43d={};_0x42d43d[_0xa7c9('0x2e')]=_[_0xa7c9('0x30')](db[_0xa7c9('0x3f')][_0xa7c9('0x2b')]);_0x42d43d[_0xa7c9('0x2f')]=_[_0xa7c9('0x30')](_0x4ae69c[_0xa7c9('0x2f')]);_0x42d43d['filters']=_[_0xa7c9('0x32')](_0x42d43d[_0xa7c9('0x2e')],_0x42d43d[_0xa7c9('0x2f')]);_0x16e351[_0xa7c9('0x34')]=_[_0xa7c9('0x32')](_0x42d43d[_0xa7c9('0x2e')],qs['fields'](_0x4ae69c[_0xa7c9('0x2f')][_0xa7c9('0x33')]));_0x16e351[_0xa7c9('0x34')]=_0x16e351[_0xa7c9('0x34')][_0xa7c9('0x35')]?_0x16e351[_0xa7c9('0x34')]:_0x42d43d[_0xa7c9('0x2e')];if(_0x4ae69c[_0xa7c9('0x2f')][_0xa7c9('0x40')]){_0x16e351[_0xa7c9('0x41')]=[{'all':!![]}];}_0x16e351=_['merge']({},_0x16e351,_0x4ae69c[_0xa7c9('0x47')]);return db[_0xa7c9('0x3f')][_0xa7c9('0x48')](_0x16e351)[_0xa7c9('0x24')](handleEntityNotFound(_0x12f8fe,null))[_0xa7c9('0x24')](respondWithResult(_0x12f8fe,null))[_0xa7c9('0x44')](handleError(_0x12f8fe,null));};exports['update']=function(_0x2998f1,_0x3ca934){if(_0x2998f1[_0xa7c9('0x49')]['id']){delete _0x2998f1[_0xa7c9('0x49')]['id'];}return db[_0xa7c9('0x3f')][_0xa7c9('0x48')]({'where':{'id':_0x2998f1[_0xa7c9('0x46')]['id']}})[_0xa7c9('0x24')](handleEntityNotFound(_0x3ca934,null))[_0xa7c9('0x24')](saveUpdates(_0x2998f1[_0xa7c9('0x49')],null))[_0xa7c9('0x24')](respondWithResult(_0x3ca934,null))[_0xa7c9('0x44')](handleError(_0x3ca934,null));};exports['destroy']=function(_0x55ad0d,_0x46beed){return db['CmHopperBlack']['find']({'where':{'id':_0x55ad0d[_0xa7c9('0x46')]['id']}})[_0xa7c9('0x24')](handleEntityNotFound(_0x46beed,null))[_0xa7c9('0x24')](removeEntity(_0x46beed,null))[_0xa7c9('0x44')](handleError(_0x46beed,null));};exports[_0xa7c9('0x4a')]=function(_0x47ca4e,_0x344757){return db['CmHopperBlack'][_0xa7c9('0x4a')]()[_0xa7c9('0x24')](respondWithResult(_0x344757,null))[_0xa7c9('0x44')](handleError(_0x344757,null));};
\ No newline at end of file