Built motion from commit 449495f6.|2.6.27
[motion2.git] / server / api / cmHopperBlack / cmHopperBlack.controller.js
index e593932..77c6ab4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa042=['type','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','CmHopperBlack','key','map','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x53ff4a,_0x355b54){var _0x196b6=function(_0x264e6d){while(--_0x264e6d){_0x53ff4a['push'](_0x53ff4a['shift']());}};_0x196b6(++_0x355b54);}(_0xa042,0x1bd));var _0x2a04=function(_0x4b3a15,_0x23d26a){_0x4b3a15=_0x4b3a15-0x0;var _0x1217ae=_0xa042[_0x4b3a15];return _0x1217ae;};'use strict';var pdf=require(_0x2a04('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2a04('0x1'));var zipdir=require(_0x2a04('0x2'));var jsonpatch=require(_0x2a04('0x3'));var rp=require(_0x2a04('0x4'));var moment=require(_0x2a04('0x5'));var BPromise=require(_0x2a04('0x6'));var Mustache=require(_0x2a04('0x7'));var util=require(_0x2a04('0x8'));var path=require(_0x2a04('0x9'));var sox=require(_0x2a04('0xa'));var csv=require(_0x2a04('0xb'));var ejs=require(_0x2a04('0xc'));var fs=require('fs');var _=require(_0x2a04('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a04('0xe'));var deskjs=require(_0x2a04('0xf'));var toCsv=require(_0x2a04('0xb'));var querystring=require(_0x2a04('0x10'));var Papa=require('papaparse');var Redis=require(_0x2a04('0x11'));var authService=require(_0x2a04('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2a04('0x13'));var hardwareService=require(_0x2a04('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2a04('0x15'));var config=require(_0x2a04('0x16'));var licenseUtil=require(_0x2a04('0x17'));var db=require(_0x2a04('0x18'))['db'];function respondWithStatusCode(_0x2c3b6e,_0x264aa3){_0x264aa3=_0x264aa3||0xcc;return function(_0x2ab8a7){if(_0x2ab8a7){return _0x2c3b6e[_0x2a04('0x19')](_0x264aa3);}return _0x2c3b6e[_0x2a04('0x1a')](_0x264aa3)[_0x2a04('0x1b')]();};}function respondWithResult(_0x49ffc2,_0x52741d){_0x52741d=_0x52741d||0xc8;return function(_0x169395){if(_0x169395){return _0x49ffc2[_0x2a04('0x1a')](_0x52741d)[_0x2a04('0x1c')](_0x169395);}};}function respondWithFilteredResult(_0x5a2c66,_0x16d5a6){return function(_0x9cf38a){if(_0x9cf38a){var _0x36024f=_0x9cf38a[_0x2a04('0x1d')],_0x2fe05e=_0x16d5a6[_0x2a04('0x1e')],_0x2aa24e=_0x16d5a6[_0x2a04('0x1e')]+_0x16d5a6[_0x2a04('0x1f')],_0x2af40b;if(_0x2aa24e>=_0x36024f){_0x2aa24e=_0x36024f;_0x2af40b=0xc8;}else{_0x2af40b=0xce;}_0x5a2c66[_0x2a04('0x1a')](_0x2af40b);return _0x5a2c66[_0x2a04('0x20')](_0x2a04('0x21'),_0x2fe05e+'-'+_0x2aa24e+'/'+_0x36024f)[_0x2a04('0x1c')](_0x9cf38a);}return null;};}function patchUpdates(_0x176c52){return function(_0x3b379e){try{jsonpatch['apply'](_0x3b379e,_0x176c52,!![]);}catch(_0x43b12c){return BPromise[_0x2a04('0x22')](_0x43b12c);}return _0x3b379e[_0x2a04('0x23')]();};}function saveUpdates(_0x3108aa,_0x9907e1){return function(_0x412260){if(_0x412260){return _0x412260[_0x2a04('0x24')](_0x3108aa)[_0x2a04('0x25')](function(_0x1f222f){return _0x1f222f;});}return null;};}function removeEntity(_0xdac214,_0x29e919){return function(_0x4674fd){if(_0x4674fd){return _0x4674fd[_0x2a04('0x26')]()[_0x2a04('0x25')](function(){_0xdac214[_0x2a04('0x1a')](0xcc)[_0x2a04('0x1b')]();});}};}function handleEntityNotFound(_0x142d69,_0x15441b){return function(_0x42366a){if(!_0x42366a){_0x142d69[_0x2a04('0x19')](0x194);}return _0x42366a;};}function handleError(_0x559d8c,_0x39ad68){_0x39ad68=_0x39ad68||0x1f4;return function(_0x2e8c2c){logger['error'](_0x2e8c2c['stack']);if(_0x2e8c2c[_0x2a04('0x27')]){delete _0x2e8c2c['name'];}_0x559d8c['status'](_0x39ad68)[_0x2a04('0x28')](_0x2e8c2c);};}exports[_0x2a04('0x29')]=function(_0x1d59e5,_0x33c7fd){var _0xfeba01={},_0x58ac57={},_0x3cfec2={'count':0x0,'rows':[]};var _0x23160b=_['map'](db[_0x2a04('0x2a')]['rawAttributes'],function(_0x501136){return{'name':_0x501136['fieldName'],'type':_0x501136['type'][_0x2a04('0x2b')]};});_0x58ac57['model']=_[_0x2a04('0x2c')](_0x23160b,_0x2a04('0x27'));_0x58ac57[_0x2a04('0x2d')]=_[_0x2a04('0x2e')](_0x1d59e5[_0x2a04('0x2d')]);_0x58ac57[_0x2a04('0x2f')]=_[_0x2a04('0x30')](_0x58ac57['model'],_0x58ac57[_0x2a04('0x2d')]);_0xfeba01[_0x2a04('0x31')]=_[_0x2a04('0x30')](_0x58ac57[_0x2a04('0x32')],qs['fields'](_0x1d59e5[_0x2a04('0x2d')]['fields']));_0xfeba01[_0x2a04('0x31')]=_0xfeba01['attributes'][_0x2a04('0x33')]?_0xfeba01[_0x2a04('0x31')]:_0x58ac57[_0x2a04('0x32')];if(!_0x1d59e5[_0x2a04('0x2d')][_0x2a04('0x34')](_0x2a04('0x35'))){_0xfeba01[_0x2a04('0x1f')]=qs[_0x2a04('0x1f')](_0x1d59e5[_0x2a04('0x2d')]['limit']);_0xfeba01[_0x2a04('0x1e')]=qs['offset'](_0x1d59e5['query'][_0x2a04('0x1e')]);}_0xfeba01[_0x2a04('0x36')]=qs[_0x2a04('0x37')](_0x1d59e5[_0x2a04('0x2d')][_0x2a04('0x37')]);_0xfeba01[_0x2a04('0x38')]=qs[_0x2a04('0x2f')](_['pick'](_0x1d59e5[_0x2a04('0x2d')],_0x58ac57['filters']),_0x23160b);if(_0x1d59e5['query'][_0x2a04('0x39')]){_0xfeba01[_0x2a04('0x38')]=_[_0x2a04('0x3a')](_0xfeba01['where'],{'$or':_[_0x2a04('0x2c')](_0x23160b,function(_0x4dfa83){if(_0x4dfa83[_0x2a04('0x3b')]!==_0x2a04('0x3c')){var _0x23e181={};_0x23e181[_0x4dfa83[_0x2a04('0x27')]]={'$like':'%'+_0x1d59e5[_0x2a04('0x2d')]['filter']+'%'};return _0x23e181;}})});}_0xfeba01=_[_0x2a04('0x3a')]({},_0xfeba01,_0x1d59e5[_0x2a04('0x3d')]);var _0x186dbe={'where':_0xfeba01[_0x2a04('0x38')]};return db[_0x2a04('0x2a')][_0x2a04('0x1d')](_0x186dbe)['then'](function(_0x39d491){_0x3cfec2[_0x2a04('0x1d')]=_0x39d491;if(_0x1d59e5['query']['includeAll']){_0xfeba01[_0x2a04('0x3e')]=[{'all':!![]}];}return db[_0x2a04('0x2a')][_0x2a04('0x3f')](_0xfeba01);})[_0x2a04('0x25')](function(_0x3bc97c){_0x3cfec2[_0x2a04('0x40')]=_0x3bc97c;return _0x3cfec2;})[_0x2a04('0x25')](respondWithFilteredResult(_0x33c7fd,_0xfeba01))[_0x2a04('0x41')](handleError(_0x33c7fd,null));};exports['show']=function(_0x110795,_0x2fde47){var _0x584350={'raw':!![],'where':{'id':_0x110795[_0x2a04('0x42')]['id']}},_0x4a83f9={};_0x4a83f9['model']=_[_0x2a04('0x2e')](db[_0x2a04('0x2a')][_0x2a04('0x43')]);_0x4a83f9[_0x2a04('0x2d')]=_[_0x2a04('0x2e')](_0x110795['query']);_0x4a83f9[_0x2a04('0x2f')]=_[_0x2a04('0x30')](_0x4a83f9[_0x2a04('0x32')],_0x4a83f9['query']);_0x584350[_0x2a04('0x31')]=_[_0x2a04('0x30')](_0x4a83f9[_0x2a04('0x32')],qs['fields'](_0x110795[_0x2a04('0x2d')]['fields']));_0x584350[_0x2a04('0x31')]=_0x584350[_0x2a04('0x31')][_0x2a04('0x33')]?_0x584350['attributes']:_0x4a83f9['model'];if(_0x110795[_0x2a04('0x2d')][_0x2a04('0x44')]){_0x584350['include']=[{'all':!![]}];}_0x584350=_[_0x2a04('0x3a')]({},_0x584350,_0x110795[_0x2a04('0x3d')]);return db[_0x2a04('0x2a')][_0x2a04('0x45')](_0x584350)[_0x2a04('0x25')](handleEntityNotFound(_0x2fde47,null))[_0x2a04('0x25')](respondWithResult(_0x2fde47,null))['catch'](handleError(_0x2fde47,null));};exports[_0x2a04('0x24')]=function(_0x4d9a29,_0x3a1985){if(_0x4d9a29[_0x2a04('0x46')]['id']){delete _0x4d9a29['body']['id'];}return db['CmHopperBlack'][_0x2a04('0x45')]({'where':{'id':_0x4d9a29[_0x2a04('0x42')]['id']}})[_0x2a04('0x25')](handleEntityNotFound(_0x3a1985,null))[_0x2a04('0x25')](saveUpdates(_0x4d9a29['body'],null))[_0x2a04('0x25')](respondWithResult(_0x3a1985,null))['catch'](handleError(_0x3a1985,null));};exports[_0x2a04('0x26')]=function(_0x58653f,_0x315a52){return db[_0x2a04('0x2a')][_0x2a04('0x45')]({'where':{'id':_0x58653f[_0x2a04('0x42')]['id']}})[_0x2a04('0x25')](handleEntityNotFound(_0x315a52,null))['then'](removeEntity(_0x315a52,null))[_0x2a04('0x41')](handleError(_0x315a52,null));};exports['describe']=function(_0x27ee75,_0x37f61c){return db[_0x2a04('0x2a')][_0x2a04('0x47')]()[_0x2a04('0x25')](respondWithResult(_0x37f61c,null))[_0x2a04('0x41')](handleError(_0x37f61c,null));};
\ No newline at end of file
+var _0xf71f=['fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','save','then','destroy','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','update','body','catch','describe','eml-format','bluebird','mustache','sox','to-csv','ejs'];(function(_0x4bb12f,_0x358cfe){var _0x1bc623=function(_0x114623){while(--_0x114623){_0x4bb12f['push'](_0x4bb12f['shift']());}};_0x1bc623(++_0x358cfe);}(_0xf71f,0x112));var _0xff71=function(_0x2dfb97,_0x14d8e0){_0x2dfb97=_0x2dfb97-0x0;var _0x29cef6=_0xf71f[_0x2dfb97];return _0x29cef6;};'use strict';var emlformat=require(_0xff71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff71('0x1'));var Mustache=require(_0xff71('0x2'));var util=require('util');var path=require('path');var sox=require(_0xff71('0x3'));var csv=require(_0xff71('0x4'));var ejs=require(_0xff71('0x5'));var fs=require('fs');var fs_extra=require(_0xff71('0x6'));var _=require(_0xff71('0x7'));var squel=require('squel');var crypto=require(_0xff71('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xff71('0x9'));var toCsv=require(_0xff71('0x4'));var querystring=require(_0xff71('0xa'));var Papa=require(_0xff71('0xb'));var Redis=require(_0xff71('0xc'));var authService=require(_0xff71('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xff71('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xff71('0xf'));var utils=require(_0xff71('0x10'));var config=require(_0xff71('0x11'));var licenseUtil=require(_0xff71('0x12'));var db=require(_0xff71('0x13'))['db'];function respondWithStatusCode(_0x3cb7e0,_0x2980da){_0x2980da=_0x2980da||0xcc;return function(_0x32cacb){if(_0x32cacb){return _0x3cb7e0[_0xff71('0x14')](_0x2980da);}return _0x3cb7e0[_0xff71('0x15')](_0x2980da)['end']();};}function respondWithResult(_0x1d1860,_0x3b66d6){_0x3b66d6=_0x3b66d6||0xc8;return function(_0x572dff){if(_0x572dff){return _0x1d1860[_0xff71('0x15')](_0x3b66d6)[_0xff71('0x16')](_0x572dff);}};}function respondWithFilteredResult(_0x7ec93d,_0x5f2e3a){return function(_0x4350f7){if(_0x4350f7){var _0x8885f1=typeof _0x5f2e3a[_0xff71('0x17')]===_0xff71('0x18')&&typeof _0x5f2e3a[_0xff71('0x19')]===_0xff71('0x18');var _0x525dec=_0x4350f7[_0xff71('0x1a')];var _0x10bc87=_0x8885f1?0x0:_0x5f2e3a[_0xff71('0x17')];var _0x11ab2d=_0x8885f1?_0x4350f7[_0xff71('0x1a')]:_0x5f2e3a[_0xff71('0x17')]+_0x5f2e3a[_0xff71('0x19')];var _0x2d1276;if(_0x11ab2d>=_0x525dec){_0x11ab2d=_0x525dec;_0x2d1276=0xc8;}else{_0x2d1276=0xce;}_0x7ec93d['status'](_0x2d1276);return _0x7ec93d[_0xff71('0x1b')]('Content-Range',_0x10bc87+'-'+_0x11ab2d+'/'+_0x525dec)[_0xff71('0x16')](_0x4350f7);}return null;};}function patchUpdates(_0x2d6ee7){return function(_0x23a5de){try{jsonpatch['apply'](_0x23a5de,_0x2d6ee7,!![]);}catch(_0x4fbde4){return BPromise['reject'](_0x4fbde4);}return _0x23a5de[_0xff71('0x1c')]();};}function saveUpdates(_0x24b867,_0x4c7f32){return function(_0x4f665d){if(_0x4f665d){return _0x4f665d['update'](_0x24b867)[_0xff71('0x1d')](function(_0x40c7c7){return _0x40c7c7;});}return null;};}function removeEntity(_0x3ac5b6,_0x1a6a8f){return function(_0x401be3){if(_0x401be3){return _0x401be3[_0xff71('0x1e')]()['then'](function(){_0x3ac5b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ea253,_0x230970){return function(_0x52b023){if(!_0x52b023){_0x2ea253['sendStatus'](0x194);}return _0x52b023;};}function handleError(_0x501fd1,_0x149633){_0x149633=_0x149633||0x1f4;return function(_0x1e0cb8){logger[_0xff71('0x1f')](_0x1e0cb8[_0xff71('0x20')]);if(_0x1e0cb8[_0xff71('0x21')]){delete _0x1e0cb8[_0xff71('0x21')];}_0x501fd1[_0xff71('0x15')](_0x149633)[_0xff71('0x22')](_0x1e0cb8);};}exports[_0xff71('0x23')]=function(_0x268306,_0x433a41){var _0x1e7ce2={},_0xac7214={},_0x2bc1f0={'count':0x0,'rows':[]};var _0x5a4869=_[_0xff71('0x24')](db[_0xff71('0x25')]['rawAttributes'],function(_0x935dc2){return{'name':_0x935dc2[_0xff71('0x26')],'type':_0x935dc2[_0xff71('0x27')][_0xff71('0x28')]};});_0xac7214[_0xff71('0x29')]=_[_0xff71('0x24')](_0x5a4869,_0xff71('0x21'));_0xac7214[_0xff71('0x2a')]=_[_0xff71('0x2b')](_0x268306[_0xff71('0x2a')]);_0xac7214[_0xff71('0x2c')]=_['intersection'](_0xac7214[_0xff71('0x29')],_0xac7214['query']);_0x1e7ce2['attributes']=_[_0xff71('0x2d')](_0xac7214[_0xff71('0x29')],qs[_0xff71('0x2e')](_0x268306[_0xff71('0x2a')][_0xff71('0x2e')]));_0x1e7ce2['attributes']=_0x1e7ce2[_0xff71('0x2f')][_0xff71('0x30')]?_0x1e7ce2[_0xff71('0x2f')]:_0xac7214[_0xff71('0x29')];if(!_0x268306['query']['hasOwnProperty'](_0xff71('0x31'))){_0x1e7ce2[_0xff71('0x19')]=qs[_0xff71('0x19')](_0x268306['query'][_0xff71('0x19')]);_0x1e7ce2[_0xff71('0x17')]=qs[_0xff71('0x17')](_0x268306['query'][_0xff71('0x17')]);}_0x1e7ce2[_0xff71('0x32')]=qs['sort'](_0x268306[_0xff71('0x2a')][_0xff71('0x33')]);_0x1e7ce2[_0xff71('0x34')]=qs['filters'](_[_0xff71('0x35')](_0x268306[_0xff71('0x2a')],_0xac7214[_0xff71('0x2c')]),_0x5a4869);if(_0x268306['query'][_0xff71('0x36')]){_0x1e7ce2[_0xff71('0x34')]=_[_0xff71('0x37')](_0x1e7ce2[_0xff71('0x34')],{'$or':_[_0xff71('0x24')](_0x5a4869,function(_0x18eb4c){if(_0x18eb4c['type']!==_0xff71('0x38')){var _0x18b93b={};_0x18b93b[_0x18eb4c[_0xff71('0x21')]]={'$like':'%'+_0x268306[_0xff71('0x2a')][_0xff71('0x36')]+'%'};return _0x18b93b;}})});}_0x1e7ce2=_['merge']({},_0x1e7ce2,_0x268306['options']);var _0x3c9b4a={'where':_0x1e7ce2['where']};return db[_0xff71('0x25')]['count'](_0x3c9b4a)[_0xff71('0x1d')](function(_0x17b44b){_0x2bc1f0[_0xff71('0x1a')]=_0x17b44b;if(_0x268306[_0xff71('0x2a')][_0xff71('0x39')]){_0x1e7ce2[_0xff71('0x3a')]=[{'all':!![]}];}return db[_0xff71('0x25')][_0xff71('0x3b')](_0x1e7ce2);})['then'](function(_0x2247cb){_0x2bc1f0[_0xff71('0x3c')]=_0x2247cb;return _0x2bc1f0;})[_0xff71('0x1d')](respondWithFilteredResult(_0x433a41,_0x1e7ce2))['catch'](handleError(_0x433a41,null));};exports[_0xff71('0x3d')]=function(_0x2756d7,_0x4931a8){var _0x2e2e04={'raw':!![],'where':{'id':_0x2756d7[_0xff71('0x3e')]['id']}},_0x353045={};_0x353045[_0xff71('0x29')]=_[_0xff71('0x2b')](db[_0xff71('0x25')][_0xff71('0x3f')]);_0x353045['query']=_[_0xff71('0x2b')](_0x2756d7['query']);_0x353045[_0xff71('0x2c')]=_['intersection'](_0x353045[_0xff71('0x29')],_0x353045[_0xff71('0x2a')]);_0x2e2e04[_0xff71('0x2f')]=_[_0xff71('0x2d')](_0x353045[_0xff71('0x29')],qs[_0xff71('0x2e')](_0x2756d7['query'][_0xff71('0x2e')]));_0x2e2e04['attributes']=_0x2e2e04['attributes'][_0xff71('0x30')]?_0x2e2e04[_0xff71('0x2f')]:_0x353045[_0xff71('0x29')];if(_0x2756d7[_0xff71('0x2a')][_0xff71('0x39')]){_0x2e2e04[_0xff71('0x3a')]=[{'all':!![]}];}_0x2e2e04=_['merge']({},_0x2e2e04,_0x2756d7[_0xff71('0x40')]);return db[_0xff71('0x25')][_0xff71('0x41')](_0x2e2e04)['then'](handleEntityNotFound(_0x4931a8,null))[_0xff71('0x1d')](respondWithResult(_0x4931a8,null))['catch'](handleError(_0x4931a8,null));};exports[_0xff71('0x42')]=function(_0x3c4607,_0x5e1e30){if(_0x3c4607[_0xff71('0x43')]['id']){delete _0x3c4607['body']['id'];}return db[_0xff71('0x25')][_0xff71('0x41')]({'where':{'id':_0x3c4607[_0xff71('0x3e')]['id']}})[_0xff71('0x1d')](handleEntityNotFound(_0x5e1e30,null))['then'](saveUpdates(_0x3c4607[_0xff71('0x43')],null))[_0xff71('0x1d')](respondWithResult(_0x5e1e30,null))[_0xff71('0x44')](handleError(_0x5e1e30,null));};exports['destroy']=function(_0x445671,_0x2f3365){return db[_0xff71('0x25')][_0xff71('0x41')]({'where':{'id':_0x445671[_0xff71('0x3e')]['id']}})[_0xff71('0x1d')](handleEntityNotFound(_0x2f3365,null))[_0xff71('0x1d')](removeEntity(_0x2f3365,null))[_0xff71('0x44')](handleError(_0x2f3365,null));};exports[_0xff71('0x45')]=function(_0x58b984,_0x418bdf){return db[_0xff71('0x25')]['describe']()[_0xff71('0x1d')](respondWithResult(_0x418bdf,null))['catch'](handleError(_0x418bdf,null));};
\ No newline at end of file