Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / cmHopperBlack / cmHopperBlack.controller.js
index d5ad518..5e89486 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce8a=['keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','rows','catch','show','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','model','query'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xce8a,0x13b));var _0xace8=function(_0x3ebda0,_0x52ed01){_0x3ebda0=_0x3ebda0-0x0;var _0x29828b=_0xce8a[_0x3ebda0];return _0x29828b;};'use strict';var pdf=require(_0xace8('0x0'));var emlformat=require(_0xace8('0x1'));var rimraf=require(_0xace8('0x2'));var zipdir=require(_0xace8('0x3'));var jsonpatch=require(_0xace8('0x4'));var rp=require(_0xace8('0x5'));var moment=require(_0xace8('0x6'));var BPromise=require(_0xace8('0x7'));var Mustache=require('mustache');var util=require(_0xace8('0x8'));var path=require(_0xace8('0x9'));var sox=require('sox');var csv=require(_0xace8('0xa'));var ejs=require(_0xace8('0xb'));var fs=require('fs');var _=require(_0xace8('0xc'));var squel=require(_0xace8('0xd'));var crypto=require(_0xace8('0xe'));var jsforce=require(_0xace8('0xf'));var deskjs=require(_0xace8('0x10'));var toCsv=require(_0xace8('0xa'));var querystring=require(_0xace8('0x11'));var Papa=require(_0xace8('0x12'));var Redis=require('ioredis');var authService=require(_0xace8('0x13'));var qs=require(_0xace8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xace8('0x15'));var utils=require(_0xace8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xace8('0x17'));var db=require(_0xace8('0x18'))['db'];function respondWithStatusCode(_0x19d4c9,_0x3e75e4){_0x3e75e4=_0x3e75e4||0xcc;return function(_0x3f5019){if(_0x3f5019){return _0x19d4c9[_0xace8('0x19')](_0x3e75e4);}return _0x19d4c9[_0xace8('0x1a')](_0x3e75e4)[_0xace8('0x1b')]();};}function respondWithResult(_0x48731a,_0x50bea5){_0x50bea5=_0x50bea5||0xc8;return function(_0x5f271a){if(_0x5f271a){return _0x48731a[_0xace8('0x1a')](_0x50bea5)[_0xace8('0x1c')](_0x5f271a);}};}function respondWithFilteredResult(_0x3fdc7b,_0x55bc40){return function(_0x1e3b42){if(_0x1e3b42){var _0x514e45=_0x1e3b42[_0xace8('0x1d')],_0x313907=_0x55bc40[_0xace8('0x1e')],_0x12ae32=_0x55bc40[_0xace8('0x1e')]+_0x55bc40[_0xace8('0x1f')],_0x563ca2;if(_0x12ae32>=_0x514e45){_0x12ae32=_0x514e45;_0x563ca2=0xc8;}else{_0x563ca2=0xce;}_0x3fdc7b[_0xace8('0x1a')](_0x563ca2);return _0x3fdc7b[_0xace8('0x20')](_0xace8('0x21'),_0x313907+'-'+_0x12ae32+'/'+_0x514e45)[_0xace8('0x1c')](_0x1e3b42);}return null;};}function patchUpdates(_0xb4f063){return function(_0x48e54d){try{jsonpatch[_0xace8('0x22')](_0x48e54d,_0xb4f063,!![]);}catch(_0x506899){return BPromise[_0xace8('0x23')](_0x506899);}return _0x48e54d[_0xace8('0x24')]();};}function saveUpdates(_0x3d9689,_0x57a530){return function(_0x3b65c0){if(_0x3b65c0){return _0x3b65c0[_0xace8('0x25')](_0x3d9689)[_0xace8('0x26')](function(_0x5977a0){return _0x5977a0;});}return null;};}function removeEntity(_0x1a3656,_0x1d44db){return function(_0x442e13){if(_0x442e13){return _0x442e13[_0xace8('0x27')]()['then'](function(){_0x1a3656[_0xace8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb500,_0x13c12c){return function(_0x44c65a){if(!_0x44c65a){_0x2fb500[_0xace8('0x19')](0x194);}return _0x44c65a;};}function handleError(_0x25c855,_0x3ee3b7){_0x3ee3b7=_0x3ee3b7||0x1f4;return function(_0x29ed17){logger[_0xace8('0x28')](_0x29ed17[_0xace8('0x29')]);if(_0x29ed17[_0xace8('0x2a')]){delete _0x29ed17[_0xace8('0x2a')];}_0x25c855[_0xace8('0x1a')](_0x3ee3b7)['send'](_0x29ed17);};}exports[_0xace8('0x2b')]=function(_0x544c5b,_0x354d73){var _0x100d7e={},_0x28849d={},_0x280cf8={'count':0x0,'rows':[]};var _0x4a1302=_[_0xace8('0x2c')](db[_0xace8('0x2d')][_0xace8('0x2e')],function(_0x261ea7){return{'name':_0x261ea7[_0xace8('0x2f')],'type':_0x261ea7['type']['key']};});_0x28849d[_0xace8('0x30')]=_['map'](_0x4a1302,_0xace8('0x2a'));_0x28849d[_0xace8('0x31')]=_[_0xace8('0x32')](_0x544c5b[_0xace8('0x31')]);_0x28849d['filters']=_[_0xace8('0x33')](_0x28849d[_0xace8('0x30')],_0x28849d[_0xace8('0x31')]);_0x100d7e[_0xace8('0x34')]=_['intersection'](_0x28849d[_0xace8('0x30')],qs[_0xace8('0x35')](_0x544c5b[_0xace8('0x31')]['fields']));_0x100d7e[_0xace8('0x34')]=_0x100d7e[_0xace8('0x34')][_0xace8('0x36')]?_0x100d7e[_0xace8('0x34')]:_0x28849d[_0xace8('0x30')];if(!_0x544c5b[_0xace8('0x31')][_0xace8('0x37')]('nolimit')){_0x100d7e[_0xace8('0x1f')]=qs['limit'](_0x544c5b[_0xace8('0x31')]['limit']);_0x100d7e[_0xace8('0x1e')]=qs['offset'](_0x544c5b[_0xace8('0x31')][_0xace8('0x1e')]);}_0x100d7e[_0xace8('0x38')]=qs[_0xace8('0x39')](_0x544c5b[_0xace8('0x31')][_0xace8('0x39')]);_0x100d7e[_0xace8('0x3a')]=qs['filters'](_[_0xace8('0x3b')](_0x544c5b[_0xace8('0x31')],_0x28849d[_0xace8('0x3c')]),_0x4a1302);if(_0x544c5b['query'][_0xace8('0x3d')]){_0x100d7e['where']=_[_0xace8('0x3e')](_0x100d7e[_0xace8('0x3a')],{'$or':_['map'](_0x4a1302,function(_0x293d68){if(_0x293d68[_0xace8('0x3f')]!=='VIRTUAL'){var _0x14ec6b={};_0x14ec6b[_0x293d68[_0xace8('0x2a')]]={'$like':'%'+_0x544c5b[_0xace8('0x31')][_0xace8('0x3d')]+'%'};return _0x14ec6b;}})});}_0x100d7e=_['merge']({},_0x100d7e,_0x544c5b[_0xace8('0x40')]);var _0x3c4f39={'where':_0x100d7e['where']};return db['CmHopperBlack'][_0xace8('0x1d')](_0x3c4f39)[_0xace8('0x26')](function(_0x59cc25){_0x280cf8[_0xace8('0x1d')]=_0x59cc25;if(_0x544c5b[_0xace8('0x31')][_0xace8('0x41')]){_0x100d7e[_0xace8('0x42')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x100d7e);})[_0xace8('0x26')](function(_0x4a6624){_0x280cf8[_0xace8('0x43')]=_0x4a6624;return _0x280cf8;})['then'](respondWithFilteredResult(_0x354d73,_0x100d7e))[_0xace8('0x44')](handleError(_0x354d73,null));};exports[_0xace8('0x45')]=function(_0x3068d9,_0xe8a8f){var _0x32bc1d={'raw':!![],'where':{'id':_0x3068d9[_0xace8('0x46')]['id']}},_0x44fa8f={};_0x44fa8f[_0xace8('0x30')]=_[_0xace8('0x32')](db['CmHopperBlack'][_0xace8('0x2e')]);_0x44fa8f['query']=_['keys'](_0x3068d9[_0xace8('0x31')]);_0x44fa8f[_0xace8('0x3c')]=_[_0xace8('0x33')](_0x44fa8f[_0xace8('0x30')],_0x44fa8f[_0xace8('0x31')]);_0x32bc1d[_0xace8('0x34')]=_[_0xace8('0x33')](_0x44fa8f[_0xace8('0x30')],qs[_0xace8('0x35')](_0x3068d9['query'][_0xace8('0x35')]));_0x32bc1d[_0xace8('0x34')]=_0x32bc1d['attributes'][_0xace8('0x36')]?_0x32bc1d[_0xace8('0x34')]:_0x44fa8f['model'];if(_0x3068d9['query']['includeAll']){_0x32bc1d[_0xace8('0x42')]=[{'all':!![]}];}_0x32bc1d=_[_0xace8('0x3e')]({},_0x32bc1d,_0x3068d9[_0xace8('0x40')]);return db['CmHopperBlack'][_0xace8('0x47')](_0x32bc1d)[_0xace8('0x26')](handleEntityNotFound(_0xe8a8f,null))[_0xace8('0x26')](respondWithResult(_0xe8a8f,null))[_0xace8('0x44')](handleError(_0xe8a8f,null));};exports[_0xace8('0x25')]=function(_0x13d1b2,_0x38e2b5){if(_0x13d1b2['body']['id']){delete _0x13d1b2['body']['id'];}return db[_0xace8('0x2d')][_0xace8('0x47')]({'where':{'id':_0x13d1b2[_0xace8('0x46')]['id']}})[_0xace8('0x26')](handleEntityNotFound(_0x38e2b5,null))[_0xace8('0x26')](saveUpdates(_0x13d1b2['body'],null))['then'](respondWithResult(_0x38e2b5,null))[_0xace8('0x44')](handleError(_0x38e2b5,null));};exports[_0xace8('0x27')]=function(_0x175045,_0x3158a2){return db[_0xace8('0x2d')][_0xace8('0x47')]({'where':{'id':_0x175045['params']['id']}})[_0xace8('0x26')](handleEntityNotFound(_0x3158a2,null))['then'](removeEntity(_0x3158a2,null))[_0xace8('0x44')](handleError(_0x3158a2,null));};exports['describe']=function(_0x5614f7,_0x469705){return db[_0xace8('0x2d')][_0xace8('0x48')]()[_0xace8('0x26')](respondWithResult(_0x469705,null))[_0xace8('0x44')](handleError(_0x469705,null));};
\ No newline at end of file
+var _0xd072=['show','params','keys','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','undefined','limit','offset','count','status','set','Content-Range','apply','save','then','destroy','stack','name','index','CmHopperBlack','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd072,0x9a));var _0x2d07=function(_0xe4354e,_0x2de609){_0xe4354e=_0xe4354e-0x0;var _0xddcb2a=_0xd072[_0xe4354e];return _0xddcb2a;};'use strict';var emlformat=require(_0x2d07('0x0'));var rimraf=require(_0x2d07('0x1'));var zipdir=require(_0x2d07('0x2'));var jsonpatch=require(_0x2d07('0x3'));var rp=require(_0x2d07('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d07('0x5'));var path=require(_0x2d07('0x6'));var sox=require('sox');var csv=require(_0x2d07('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d07('0x8'));var _=require(_0x2d07('0x9'));var squel=require(_0x2d07('0xa'));var crypto=require(_0x2d07('0xb'));var jsforce=require(_0x2d07('0xc'));var deskjs=require(_0x2d07('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2d07('0xe'));var Papa=require('papaparse');var Redis=require(_0x2d07('0xf'));var authService=require(_0x2d07('0x10'));var qs=require(_0x2d07('0x11'));var as=require(_0x2d07('0x12'));var hardwareService=require(_0x2d07('0x13'));var logger=require(_0x2d07('0x14'))(_0x2d07('0x15'));var utils=require(_0x2d07('0x16'));var config=require(_0x2d07('0x17'));var licenseUtil=require(_0x2d07('0x18'));var db=require(_0x2d07('0x19'))['db'];function respondWithStatusCode(_0x4e5204,_0x11ee90){_0x11ee90=_0x11ee90||0xcc;return function(_0x230fcd){if(_0x230fcd){return _0x4e5204[_0x2d07('0x1a')](_0x11ee90);}return _0x4e5204['status'](_0x11ee90)['end']();};}function respondWithResult(_0x13d479,_0xf21aec){_0xf21aec=_0xf21aec||0xc8;return function(_0x3ab583){if(_0x3ab583){return _0x13d479['status'](_0xf21aec)['json'](_0x3ab583);}};}function respondWithFilteredResult(_0x211cc5,_0x44462a){return function(_0x230345){if(_0x230345){var _0x2ff22f=typeof _0x44462a['offset']===_0x2d07('0x1b')&&typeof _0x44462a[_0x2d07('0x1c')]==='undefined';var _0x598878=_0x230345['count'];var _0x1097b7=_0x2ff22f?0x0:_0x44462a[_0x2d07('0x1d')];var _0x5d0305=_0x2ff22f?_0x230345[_0x2d07('0x1e')]:_0x44462a[_0x2d07('0x1d')]+_0x44462a[_0x2d07('0x1c')];var _0x13e059;if(_0x5d0305>=_0x598878){_0x5d0305=_0x598878;_0x13e059=0xc8;}else{_0x13e059=0xce;}_0x211cc5[_0x2d07('0x1f')](_0x13e059);return _0x211cc5[_0x2d07('0x20')](_0x2d07('0x21'),_0x1097b7+'-'+_0x5d0305+'/'+_0x598878)['json'](_0x230345);}return null;};}function patchUpdates(_0x4414cc){return function(_0x1012f8){try{jsonpatch[_0x2d07('0x22')](_0x1012f8,_0x4414cc,!![]);}catch(_0x4d9ad2){return BPromise['reject'](_0x4d9ad2);}return _0x1012f8[_0x2d07('0x23')]();};}function saveUpdates(_0xce80d7,_0x4a276b){return function(_0x384216){if(_0x384216){return _0x384216['update'](_0xce80d7)[_0x2d07('0x24')](function(_0x2a52c9){return _0x2a52c9;});}return null;};}function removeEntity(_0x581dd7,_0x319f52){return function(_0xba1fd4){if(_0xba1fd4){return _0xba1fd4[_0x2d07('0x25')]()[_0x2d07('0x24')](function(){_0x581dd7[_0x2d07('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3225a9,_0x2ecf1b){return function(_0x366fcc){if(!_0x366fcc){_0x3225a9[_0x2d07('0x1a')](0x194);}return _0x366fcc;};}function handleError(_0x15ff7d,_0x127095){_0x127095=_0x127095||0x1f4;return function(_0x41acd0){logger['error'](_0x41acd0[_0x2d07('0x26')]);if(_0x41acd0[_0x2d07('0x27')]){delete _0x41acd0['name'];}_0x15ff7d[_0x2d07('0x1f')](_0x127095)['send'](_0x41acd0);};}exports[_0x2d07('0x28')]=function(_0x5488a6,_0x487732){var _0x2993a7={},_0x579110={},_0x39a688={'count':0x0,'rows':[]};var _0x5580ab=_['map'](db[_0x2d07('0x29')][_0x2d07('0x2a')],function(_0x46f706){return{'name':_0x46f706[_0x2d07('0x2b')],'type':_0x46f706['type'][_0x2d07('0x2c')]};});_0x579110[_0x2d07('0x2d')]=_['map'](_0x5580ab,_0x2d07('0x27'));_0x579110['query']=_['keys'](_0x5488a6[_0x2d07('0x2e')]);_0x579110[_0x2d07('0x2f')]=_[_0x2d07('0x30')](_0x579110[_0x2d07('0x2d')],_0x579110[_0x2d07('0x2e')]);_0x2993a7[_0x2d07('0x31')]=_[_0x2d07('0x30')](_0x579110[_0x2d07('0x2d')],qs[_0x2d07('0x32')](_0x5488a6[_0x2d07('0x2e')][_0x2d07('0x32')]));_0x2993a7[_0x2d07('0x31')]=_0x2993a7[_0x2d07('0x31')][_0x2d07('0x33')]?_0x2993a7[_0x2d07('0x31')]:_0x579110[_0x2d07('0x2d')];if(!_0x5488a6[_0x2d07('0x2e')][_0x2d07('0x34')](_0x2d07('0x35'))){_0x2993a7[_0x2d07('0x1c')]=qs['limit'](_0x5488a6[_0x2d07('0x2e')]['limit']);_0x2993a7[_0x2d07('0x1d')]=qs[_0x2d07('0x1d')](_0x5488a6['query'][_0x2d07('0x1d')]);}_0x2993a7[_0x2d07('0x36')]=qs[_0x2d07('0x37')](_0x5488a6[_0x2d07('0x2e')][_0x2d07('0x37')]);_0x2993a7[_0x2d07('0x38')]=qs[_0x2d07('0x2f')](_[_0x2d07('0x39')](_0x5488a6[_0x2d07('0x2e')],_0x579110['filters']),_0x5580ab);if(_0x5488a6['query'][_0x2d07('0x3a')]){_0x2993a7[_0x2d07('0x38')]=_[_0x2d07('0x3b')](_0x2993a7[_0x2d07('0x38')],{'$or':_[_0x2d07('0x3c')](_0x5580ab,function(_0x155245){if(_0x155245[_0x2d07('0x3d')]!==_0x2d07('0x3e')){var _0x415240={};_0x415240[_0x155245[_0x2d07('0x27')]]={'$like':'%'+_0x5488a6[_0x2d07('0x2e')][_0x2d07('0x3a')]+'%'};return _0x415240;}})});}_0x2993a7=_[_0x2d07('0x3b')]({},_0x2993a7,_0x5488a6[_0x2d07('0x3f')]);var _0x4710fb={'where':_0x2993a7[_0x2d07('0x38')]};return db[_0x2d07('0x29')]['count'](_0x4710fb)[_0x2d07('0x24')](function(_0x55881e){_0x39a688[_0x2d07('0x1e')]=_0x55881e;if(_0x5488a6[_0x2d07('0x2e')][_0x2d07('0x40')]){_0x2993a7[_0x2d07('0x41')]=[{'all':!![]}];}return db[_0x2d07('0x29')][_0x2d07('0x42')](_0x2993a7);})[_0x2d07('0x24')](function(_0x5bc965){_0x39a688['rows']=_0x5bc965;return _0x39a688;})[_0x2d07('0x24')](respondWithFilteredResult(_0x487732,_0x2993a7))[_0x2d07('0x43')](handleError(_0x487732,null));};exports[_0x2d07('0x44')]=function(_0xd926ef,_0x380543){var _0x5922ab={'raw':!![],'where':{'id':_0xd926ef[_0x2d07('0x45')]['id']}},_0x399593={};_0x399593[_0x2d07('0x2d')]=_[_0x2d07('0x46')](db[_0x2d07('0x29')][_0x2d07('0x2a')]);_0x399593['query']=_[_0x2d07('0x46')](_0xd926ef['query']);_0x399593[_0x2d07('0x2f')]=_[_0x2d07('0x30')](_0x399593[_0x2d07('0x2d')],_0x399593['query']);_0x5922ab['attributes']=_[_0x2d07('0x30')](_0x399593['model'],qs[_0x2d07('0x32')](_0xd926ef['query'][_0x2d07('0x32')]));_0x5922ab[_0x2d07('0x31')]=_0x5922ab[_0x2d07('0x31')]['length']?_0x5922ab[_0x2d07('0x31')]:_0x399593[_0x2d07('0x2d')];if(_0xd926ef[_0x2d07('0x2e')]['includeAll']){_0x5922ab[_0x2d07('0x41')]=[{'all':!![]}];}_0x5922ab=_[_0x2d07('0x3b')]({},_0x5922ab,_0xd926ef['options']);return db[_0x2d07('0x29')]['find'](_0x5922ab)['then'](handleEntityNotFound(_0x380543,null))[_0x2d07('0x24')](respondWithResult(_0x380543,null))[_0x2d07('0x43')](handleError(_0x380543,null));};exports['update']=function(_0x9e25a4,_0x5333ae){if(_0x9e25a4['body']['id']){delete _0x9e25a4[_0x2d07('0x47')]['id'];}return db['CmHopperBlack'][_0x2d07('0x48')]({'where':{'id':_0x9e25a4['params']['id']}})[_0x2d07('0x24')](handleEntityNotFound(_0x5333ae,null))['then'](saveUpdates(_0x9e25a4[_0x2d07('0x47')],null))[_0x2d07('0x24')](respondWithResult(_0x5333ae,null))[_0x2d07('0x43')](handleError(_0x5333ae,null));};exports['destroy']=function(_0x34aaac,_0xf617bf){return db['CmHopperBlack'][_0x2d07('0x48')]({'where':{'id':_0x34aaac['params']['id']}})[_0x2d07('0x24')](handleEntityNotFound(_0xf617bf,null))[_0x2d07('0x24')](removeEntity(_0xf617bf,null))[_0x2d07('0x43')](handleError(_0xf617bf,null));};exports['describe']=function(_0x50fc44,_0x45dcbf){return db[_0x2d07('0x29')][_0x2d07('0x49')]()[_0x2d07('0x24')](respondWithResult(_0x45dcbf,null))['catch'](handleError(_0x45dcbf,null));};
\ No newline at end of file