Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / api / cmHopperBlack / cmHopperBlack.controller.js
index b913e58..8ab6618 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50ed=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','update','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra'];(function(_0x4f4d72,_0x3717bf){var _0x55fc6c=function(_0x44a0e4){while(--_0x44a0e4){_0x4f4d72['push'](_0x4f4d72['shift']());}};_0x55fc6c(++_0x3717bf);}(_0x50ed,0x8e));var _0xd50e=function(_0x3e1fee,_0x5a0b8e){_0x3e1fee=_0x3e1fee-0x0;var _0x234574=_0x50ed[_0x3e1fee];return _0x234574;};'use strict';var emlformat=require(_0xd50e('0x0'));var rimraf=require(_0xd50e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd50e('0x2'));var rp=require(_0xd50e('0x3'));var moment=require(_0xd50e('0x4'));var BPromise=require(_0xd50e('0x5'));var Mustache=require('mustache');var util=require(_0xd50e('0x6'));var path=require(_0xd50e('0x7'));var sox=require('sox');var csv=require(_0xd50e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd50e('0x9'));var _=require(_0xd50e('0xa'));var squel=require(_0xd50e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd50e('0xc'));var deskjs=require(_0xd50e('0xd'));var toCsv=require(_0xd50e('0x8'));var querystring=require(_0xd50e('0xe'));var Papa=require(_0xd50e('0xf'));var Redis=require(_0xd50e('0x10'));var authService=require(_0xd50e('0x11'));var qs=require(_0xd50e('0x12'));var as=require(_0xd50e('0x13'));var hardwareService=require(_0xd50e('0x14'));var logger=require(_0xd50e('0x15'))(_0xd50e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd50e('0x17'));var db=require(_0xd50e('0x18'))['db'];function respondWithStatusCode(_0x1bf4be,_0x5a4a4c){_0x5a4a4c=_0x5a4a4c||0xcc;return function(_0x3f69b7){if(_0x3f69b7){return _0x1bf4be[_0xd50e('0x19')](_0x5a4a4c);}return _0x1bf4be[_0xd50e('0x1a')](_0x5a4a4c)[_0xd50e('0x1b')]();};}function respondWithResult(_0x2a0165,_0x119e81){_0x119e81=_0x119e81||0xc8;return function(_0x28c06d){if(_0x28c06d){return _0x2a0165[_0xd50e('0x1a')](_0x119e81)[_0xd50e('0x1c')](_0x28c06d);}};}function respondWithFilteredResult(_0x33449b,_0x62c4b5){return function(_0x3deb7f){if(_0x3deb7f){var _0x417f41=typeof _0x62c4b5['offset']===_0xd50e('0x1d')&&typeof _0x62c4b5[_0xd50e('0x1e')]===_0xd50e('0x1d');var _0x582299=_0x3deb7f[_0xd50e('0x1f')];var _0x5b481a=_0x417f41?0x0:_0x62c4b5['offset'];var _0x4dbdfb=_0x417f41?_0x3deb7f[_0xd50e('0x1f')]:_0x62c4b5[_0xd50e('0x20')]+_0x62c4b5[_0xd50e('0x1e')];var _0x688a93;if(_0x4dbdfb>=_0x582299){_0x4dbdfb=_0x582299;_0x688a93=0xc8;}else{_0x688a93=0xce;}_0x33449b[_0xd50e('0x1a')](_0x688a93);return _0x33449b[_0xd50e('0x21')](_0xd50e('0x22'),_0x5b481a+'-'+_0x4dbdfb+'/'+_0x582299)[_0xd50e('0x1c')](_0x3deb7f);}return null;};}function patchUpdates(_0xb1427b){return function(_0x489c17){try{jsonpatch[_0xd50e('0x23')](_0x489c17,_0xb1427b,!![]);}catch(_0x181ba1){return BPromise[_0xd50e('0x24')](_0x181ba1);}return _0x489c17[_0xd50e('0x25')]();};}function saveUpdates(_0x17ef69,_0x33a3f7){return function(_0xa19f99){if(_0xa19f99){return _0xa19f99['update'](_0x17ef69)['then'](function(_0x3c5b19){return _0x3c5b19;});}return null;};}function removeEntity(_0xfa26f1,_0x4f85e9){return function(_0x175618){if(_0x175618){return _0x175618[_0xd50e('0x26')]()[_0xd50e('0x27')](function(){_0xfa26f1[_0xd50e('0x1a')](0xcc)[_0xd50e('0x1b')]();});}};}function handleEntityNotFound(_0x4401aa,_0x463fe2){return function(_0x2f6c95){if(!_0x2f6c95){_0x4401aa[_0xd50e('0x19')](0x194);}return _0x2f6c95;};}function handleError(_0x521500,_0x17934d){_0x17934d=_0x17934d||0x1f4;return function(_0x12bd44){logger[_0xd50e('0x28')](_0x12bd44['stack']);if(_0x12bd44['name']){delete _0x12bd44[_0xd50e('0x29')];}_0x521500[_0xd50e('0x1a')](_0x17934d)[_0xd50e('0x2a')](_0x12bd44);};}exports['index']=function(_0x4b7cf6,_0x165733){var _0x5e05f1={},_0x19264b={},_0x513c53={'count':0x0,'rows':[]};var _0x447c0c=_[_0xd50e('0x2b')](db[_0xd50e('0x2c')][_0xd50e('0x2d')],function(_0x7deb2b){return{'name':_0x7deb2b[_0xd50e('0x2e')],'type':_0x7deb2b[_0xd50e('0x2f')]['key']};});_0x19264b[_0xd50e('0x30')]=_['map'](_0x447c0c,_0xd50e('0x29'));_0x19264b['query']=_[_0xd50e('0x31')](_0x4b7cf6[_0xd50e('0x32')]);_0x19264b[_0xd50e('0x33')]=_[_0xd50e('0x34')](_0x19264b['model'],_0x19264b[_0xd50e('0x32')]);_0x5e05f1[_0xd50e('0x35')]=_[_0xd50e('0x34')](_0x19264b[_0xd50e('0x30')],qs[_0xd50e('0x36')](_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x36')]));_0x5e05f1['attributes']=_0x5e05f1['attributes'][_0xd50e('0x37')]?_0x5e05f1[_0xd50e('0x35')]:_0x19264b[_0xd50e('0x30')];if(!_0x4b7cf6[_0xd50e('0x32')]['hasOwnProperty'](_0xd50e('0x38'))){_0x5e05f1[_0xd50e('0x1e')]=qs[_0xd50e('0x1e')](_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x1e')]);_0x5e05f1[_0xd50e('0x20')]=qs['offset'](_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x20')]);}_0x5e05f1[_0xd50e('0x39')]=qs[_0xd50e('0x3a')](_0x4b7cf6['query']['sort']);_0x5e05f1[_0xd50e('0x3b')]=qs['filters'](_[_0xd50e('0x3c')](_0x4b7cf6[_0xd50e('0x32')],_0x19264b[_0xd50e('0x33')]),_0x447c0c);if(_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x3d')]){_0x5e05f1[_0xd50e('0x3b')]=_[_0xd50e('0x3e')](_0x5e05f1[_0xd50e('0x3b')],{'$or':_['map'](_0x447c0c,function(_0x4b93f2){if(_0x4b93f2[_0xd50e('0x2f')]!==_0xd50e('0x3f')){var _0x1b4523={};_0x1b4523[_0x4b93f2[_0xd50e('0x29')]]={'$like':'%'+_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x3d')]+'%'};return _0x1b4523;}})});}_0x5e05f1=_['merge']({},_0x5e05f1,_0x4b7cf6[_0xd50e('0x40')]);var _0x379adb={'where':_0x5e05f1[_0xd50e('0x3b')]};return db[_0xd50e('0x2c')][_0xd50e('0x1f')](_0x379adb)[_0xd50e('0x27')](function(_0x367ab7){_0x513c53[_0xd50e('0x1f')]=_0x367ab7;if(_0x4b7cf6[_0xd50e('0x32')][_0xd50e('0x41')]){_0x5e05f1[_0xd50e('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xd50e('0x43')](_0x5e05f1);})['then'](function(_0x30dc01){_0x513c53[_0xd50e('0x44')]=_0x30dc01;return _0x513c53;})['then'](respondWithFilteredResult(_0x165733,_0x5e05f1))[_0xd50e('0x45')](handleError(_0x165733,null));};exports[_0xd50e('0x46')]=function(_0x1d6ed0,_0x5893ec){var _0x211753={'raw':!![],'where':{'id':_0x1d6ed0['params']['id']}},_0x45dbe2={};_0x45dbe2[_0xd50e('0x30')]=_[_0xd50e('0x31')](db[_0xd50e('0x2c')][_0xd50e('0x2d')]);_0x45dbe2[_0xd50e('0x32')]=_['keys'](_0x1d6ed0[_0xd50e('0x32')]);_0x45dbe2[_0xd50e('0x33')]=_[_0xd50e('0x34')](_0x45dbe2[_0xd50e('0x30')],_0x45dbe2[_0xd50e('0x32')]);_0x211753[_0xd50e('0x35')]=_[_0xd50e('0x34')](_0x45dbe2[_0xd50e('0x30')],qs[_0xd50e('0x36')](_0x1d6ed0[_0xd50e('0x32')][_0xd50e('0x36')]));_0x211753['attributes']=_0x211753[_0xd50e('0x35')][_0xd50e('0x37')]?_0x211753[_0xd50e('0x35')]:_0x45dbe2['model'];if(_0x1d6ed0['query'][_0xd50e('0x41')]){_0x211753[_0xd50e('0x42')]=[{'all':!![]}];}_0x211753=_['merge']({},_0x211753,_0x1d6ed0['options']);return db[_0xd50e('0x2c')][_0xd50e('0x47')](_0x211753)[_0xd50e('0x27')](handleEntityNotFound(_0x5893ec,null))['then'](respondWithResult(_0x5893ec,null))[_0xd50e('0x45')](handleError(_0x5893ec,null));};exports[_0xd50e('0x48')]=function(_0x5eb745,_0x245af0){if(_0x5eb745['body']['id']){delete _0x5eb745[_0xd50e('0x49')]['id'];}return db[_0xd50e('0x2c')][_0xd50e('0x47')]({'where':{'id':_0x5eb745['params']['id']}})[_0xd50e('0x27')](handleEntityNotFound(_0x245af0,null))['then'](saveUpdates(_0x5eb745[_0xd50e('0x49')],null))[_0xd50e('0x27')](respondWithResult(_0x245af0,null))['catch'](handleError(_0x245af0,null));};exports[_0xd50e('0x26')]=function(_0x219d1d,_0x46a5de){return db['CmHopperBlack']['find']({'where':{'id':_0x219d1d[_0xd50e('0x4a')]['id']}})[_0xd50e('0x27')](handleEntityNotFound(_0x46a5de,null))[_0xd50e('0x27')](removeEntity(_0x46a5de,null))[_0xd50e('0x45')](handleError(_0x46a5de,null));};exports['describe']=function(_0xfa2ebe,_0x270b52){return db['CmHopperBlack'][_0xd50e('0x4b')]()[_0xd50e('0x27')](respondWithResult(_0x270b52,null))[_0xd50e('0x45')](handleError(_0x270b52,null));};
\ No newline at end of file
+var _0x323a=['type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName'];(function(_0x3a63b4,_0x6e7870){var _0x36006b=function(_0x493681){while(--_0x493681){_0x3a63b4['push'](_0x3a63b4['shift']());}};_0x36006b(++_0x6e7870);}(_0x323a,0x68));var _0xa323=function(_0x36e1bf,_0x47317e){_0x36e1bf=_0x36e1bf-0x0;var _0x3a2aba=_0x323a[_0x36e1bf];return _0x3a2aba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa323('0x0'));var zipdir=require(_0xa323('0x1'));var jsonpatch=require(_0xa323('0x2'));var rp=require(_0xa323('0x3'));var moment=require(_0xa323('0x4'));var BPromise=require(_0xa323('0x5'));var Mustache=require('mustache');var util=require(_0xa323('0x6'));var path=require('path');var sox=require(_0xa323('0x7'));var csv=require('to-csv');var ejs=require(_0xa323('0x8'));var fs=require('fs');var fs_extra=require(_0xa323('0x9'));var _=require(_0xa323('0xa'));var squel=require(_0xa323('0xb'));var crypto=require(_0xa323('0xc'));var jsforce=require(_0xa323('0xd'));var deskjs=require(_0xa323('0xe'));var toCsv=require(_0xa323('0xf'));var querystring=require(_0xa323('0x10'));var Papa=require(_0xa323('0x11'));var Redis=require(_0xa323('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa323('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa323('0x14'));var logger=require(_0xa323('0x15'))(_0xa323('0x16'));var utils=require(_0xa323('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa323('0x18'));var db=require(_0xa323('0x19'))['db'];function respondWithStatusCode(_0x58e1b5,_0x1ec74f){_0x1ec74f=_0x1ec74f||0xcc;return function(_0x340dfe){if(_0x340dfe){return _0x58e1b5['sendStatus'](_0x1ec74f);}return _0x58e1b5[_0xa323('0x1a')](_0x1ec74f)[_0xa323('0x1b')]();};}function respondWithResult(_0x2e7999,_0x1d4965){_0x1d4965=_0x1d4965||0xc8;return function(_0x1f612c){if(_0x1f612c){return _0x2e7999[_0xa323('0x1a')](_0x1d4965)['json'](_0x1f612c);}};}function respondWithFilteredResult(_0x4e5685,_0x3b7395){return function(_0x304797){if(_0x304797){var _0x543d8a=typeof _0x3b7395[_0xa323('0x1c')]===_0xa323('0x1d')&&typeof _0x3b7395[_0xa323('0x1e')]==='undefined';var _0x38e158=_0x304797[_0xa323('0x1f')];var _0x32205f=_0x543d8a?0x0:_0x3b7395[_0xa323('0x1c')];var _0x344dbd=_0x543d8a?_0x304797[_0xa323('0x1f')]:_0x3b7395['offset']+_0x3b7395[_0xa323('0x1e')];var _0x401b34;if(_0x344dbd>=_0x38e158){_0x344dbd=_0x38e158;_0x401b34=0xc8;}else{_0x401b34=0xce;}_0x4e5685[_0xa323('0x1a')](_0x401b34);return _0x4e5685[_0xa323('0x20')](_0xa323('0x21'),_0x32205f+'-'+_0x344dbd+'/'+_0x38e158)[_0xa323('0x22')](_0x304797);}return null;};}function patchUpdates(_0x11f3a8){return function(_0x6c5f1f){try{jsonpatch[_0xa323('0x23')](_0x6c5f1f,_0x11f3a8,!![]);}catch(_0x45eb32){return BPromise[_0xa323('0x24')](_0x45eb32);}return _0x6c5f1f[_0xa323('0x25')]();};}function saveUpdates(_0x5c4c98,_0x5c3b51){return function(_0x2b810b){if(_0x2b810b){return _0x2b810b[_0xa323('0x26')](_0x5c4c98)[_0xa323('0x27')](function(_0x595a25){return _0x595a25;});}return null;};}function removeEntity(_0x45ef03,_0x50efce){return function(_0x4884af){if(_0x4884af){return _0x4884af[_0xa323('0x28')]()[_0xa323('0x27')](function(){_0x45ef03[_0xa323('0x1a')](0xcc)[_0xa323('0x1b')]();});}};}function handleEntityNotFound(_0x336943,_0x4ec476){return function(_0x27bb4f){if(!_0x27bb4f){_0x336943[_0xa323('0x29')](0x194);}return _0x27bb4f;};}function handleError(_0x57dd52,_0x85896b){_0x85896b=_0x85896b||0x1f4;return function(_0x18d8cd){logger[_0xa323('0x2a')](_0x18d8cd['stack']);if(_0x18d8cd[_0xa323('0x2b')]){delete _0x18d8cd[_0xa323('0x2b')];}_0x57dd52[_0xa323('0x1a')](_0x85896b)[_0xa323('0x2c')](_0x18d8cd);};}exports[_0xa323('0x2d')]=function(_0x254027,_0x4ab20b){var _0xf8c6b3={},_0x3ea25a={},_0x294911={'count':0x0,'rows':[]};var _0x1071ac=_[_0xa323('0x2e')](db[_0xa323('0x2f')][_0xa323('0x30')],function(_0x241591){return{'name':_0x241591[_0xa323('0x31')],'type':_0x241591[_0xa323('0x32')][_0xa323('0x33')]};});_0x3ea25a[_0xa323('0x34')]=_['map'](_0x1071ac,'name');_0x3ea25a['query']=_[_0xa323('0x35')](_0x254027['query']);_0x3ea25a[_0xa323('0x36')]=_[_0xa323('0x37')](_0x3ea25a[_0xa323('0x34')],_0x3ea25a[_0xa323('0x38')]);_0xf8c6b3[_0xa323('0x39')]=_['intersection'](_0x3ea25a[_0xa323('0x34')],qs['fields'](_0x254027[_0xa323('0x38')]['fields']));_0xf8c6b3['attributes']=_0xf8c6b3[_0xa323('0x39')]['length']?_0xf8c6b3['attributes']:_0x3ea25a[_0xa323('0x34')];if(!_0x254027[_0xa323('0x38')][_0xa323('0x3a')](_0xa323('0x3b'))){_0xf8c6b3['limit']=qs['limit'](_0x254027[_0xa323('0x38')][_0xa323('0x1e')]);_0xf8c6b3[_0xa323('0x1c')]=qs[_0xa323('0x1c')](_0x254027[_0xa323('0x38')]['offset']);}_0xf8c6b3[_0xa323('0x3c')]=qs['sort'](_0x254027[_0xa323('0x38')][_0xa323('0x3d')]);_0xf8c6b3[_0xa323('0x3e')]=qs[_0xa323('0x36')](_[_0xa323('0x3f')](_0x254027['query'],_0x3ea25a[_0xa323('0x36')]),_0x1071ac);if(_0x254027['query'][_0xa323('0x40')]){_0xf8c6b3['where']=_['merge'](_0xf8c6b3[_0xa323('0x3e')],{'$or':_['map'](_0x1071ac,function(_0x244a88){if(_0x244a88[_0xa323('0x32')]!=='VIRTUAL'){var _0x220f7d={};_0x220f7d[_0x244a88[_0xa323('0x2b')]]={'$like':'%'+_0x254027[_0xa323('0x38')][_0xa323('0x40')]+'%'};return _0x220f7d;}})});}_0xf8c6b3=_[_0xa323('0x41')]({},_0xf8c6b3,_0x254027[_0xa323('0x42')]);var _0x3fd832={'where':_0xf8c6b3['where']};return db[_0xa323('0x2f')][_0xa323('0x1f')](_0x3fd832)['then'](function(_0x3b5c0d){_0x294911[_0xa323('0x1f')]=_0x3b5c0d;if(_0x254027['query'][_0xa323('0x43')]){_0xf8c6b3[_0xa323('0x44')]=[{'all':!![]}];}return db[_0xa323('0x2f')][_0xa323('0x45')](_0xf8c6b3);})[_0xa323('0x27')](function(_0x28dfeb){_0x294911[_0xa323('0x46')]=_0x28dfeb;return _0x294911;})[_0xa323('0x27')](respondWithFilteredResult(_0x4ab20b,_0xf8c6b3))[_0xa323('0x47')](handleError(_0x4ab20b,null));};exports[_0xa323('0x48')]=function(_0x51743c,_0x4624ce){var _0x599759={'raw':!![],'where':{'id':_0x51743c['params']['id']}},_0x3d42ab={};_0x3d42ab['model']=_['keys'](db[_0xa323('0x2f')][_0xa323('0x30')]);_0x3d42ab[_0xa323('0x38')]=_['keys'](_0x51743c[_0xa323('0x38')]);_0x3d42ab[_0xa323('0x36')]=_['intersection'](_0x3d42ab[_0xa323('0x34')],_0x3d42ab['query']);_0x599759[_0xa323('0x39')]=_[_0xa323('0x37')](_0x3d42ab[_0xa323('0x34')],qs['fields'](_0x51743c['query']['fields']));_0x599759[_0xa323('0x39')]=_0x599759['attributes']['length']?_0x599759[_0xa323('0x39')]:_0x3d42ab[_0xa323('0x34')];if(_0x51743c[_0xa323('0x38')][_0xa323('0x43')]){_0x599759[_0xa323('0x44')]=[{'all':!![]}];}_0x599759=_[_0xa323('0x41')]({},_0x599759,_0x51743c[_0xa323('0x42')]);return db['CmHopperBlack']['find'](_0x599759)['then'](handleEntityNotFound(_0x4624ce,null))[_0xa323('0x27')](respondWithResult(_0x4624ce,null))['catch'](handleError(_0x4624ce,null));};exports[_0xa323('0x26')]=function(_0x2bd8d4,_0x227d47){if(_0x2bd8d4[_0xa323('0x49')]['id']){delete _0x2bd8d4['body']['id'];}return db[_0xa323('0x2f')]['find']({'where':{'id':_0x2bd8d4['params']['id']}})[_0xa323('0x27')](handleEntityNotFound(_0x227d47,null))[_0xa323('0x27')](saveUpdates(_0x2bd8d4[_0xa323('0x49')],null))[_0xa323('0x27')](respondWithResult(_0x227d47,null))[_0xa323('0x47')](handleError(_0x227d47,null));};exports[_0xa323('0x28')]=function(_0x38c4a3,_0x350622){return db['CmHopperBlack'][_0xa323('0x4a')]({'where':{'id':_0x38c4a3[_0xa323('0x4b')]['id']}})[_0xa323('0x27')](handleEntityNotFound(_0x350622,null))[_0xa323('0x27')](removeEntity(_0x350622,null))[_0xa323('0x47')](handleError(_0x350622,null));};exports['describe']=function(_0x5332b9,_0x4c8348){return db[_0xa323('0x2f')][_0xa323('0x4c')]()[_0xa323('0x27')](respondWithResult(_0x4c8348,null))[_0xa323('0x47')](handleError(_0x4c8348,null));};
\ No newline at end of file