Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / migration / migration.controller.js
index 72b377c..044b143 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc79=['to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','stack','name','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Migration','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x111ee6,_0xd8a3ea){var _0x8bbb51=function(_0x273011){while(--_0x273011){_0x111ee6['push'](_0x111ee6['shift']());}};_0x8bbb51(++_0xd8a3ea);}(_0xbc79,0xb8));var _0x9bc7=function(_0x4a1b9e,_0x528b53){_0x4a1b9e=_0x4a1b9e-0x0;var _0x56e86c=_0xbc79[_0x4a1b9e];return _0x56e86c;};'use strict';var pdf=require(_0x9bc7('0x0'));var emlformat=require(_0x9bc7('0x1'));var rimraf=require(_0x9bc7('0x2'));var zipdir=require(_0x9bc7('0x3'));var jsonpatch=require(_0x9bc7('0x4'));var rp=require(_0x9bc7('0x5'));var moment=require(_0x9bc7('0x6'));var BPromise=require(_0x9bc7('0x7'));var Mustache=require(_0x9bc7('0x8'));var util=require(_0x9bc7('0x9'));var path=require(_0x9bc7('0xa'));var sox=require('sox');var csv=require(_0x9bc7('0xb'));var ejs=require(_0x9bc7('0xc'));var fs=require('fs');var _=require(_0x9bc7('0xd'));var squel=require(_0x9bc7('0xe'));var crypto=require(_0x9bc7('0xf'));var jsforce=require(_0x9bc7('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9bc7('0x11'));var Redis=require(_0x9bc7('0x12'));var authService=require(_0x9bc7('0x13'));var qs=require(_0x9bc7('0x14'));var as=require(_0x9bc7('0x15'));var hardwareService=require(_0x9bc7('0x16'));var logger=require(_0x9bc7('0x17'))(_0x9bc7('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9bc7('0x19'))['db'];function respondWithStatusCode(_0x519414,_0x219dea){_0x219dea=_0x219dea||0xcc;return function(_0x333fe8){if(_0x333fe8){return _0x519414['sendStatus'](_0x219dea);}return _0x519414[_0x9bc7('0x1a')](_0x219dea)['end']();};}function respondWithResult(_0x156385,_0x102fa1){_0x102fa1=_0x102fa1||0xc8;return function(_0x44a32d){if(_0x44a32d){return _0x156385[_0x9bc7('0x1a')](_0x102fa1)[_0x9bc7('0x1b')](_0x44a32d);}};}function respondWithFilteredResult(_0x51a620,_0xbff6b9){return function(_0x4cb40a){if(_0x4cb40a){var _0x5c9095=_0x4cb40a[_0x9bc7('0x1c')],_0x3ea430=_0xbff6b9[_0x9bc7('0x1d')],_0x2c2be5=_0xbff6b9[_0x9bc7('0x1d')]+_0xbff6b9[_0x9bc7('0x1e')],_0x13aa39;if(_0x2c2be5>=_0x5c9095){_0x2c2be5=_0x5c9095;_0x13aa39=0xc8;}else{_0x13aa39=0xce;}_0x51a620[_0x9bc7('0x1a')](_0x13aa39);return _0x51a620['set'](_0x9bc7('0x1f'),_0x3ea430+'-'+_0x2c2be5+'/'+_0x5c9095)['json'](_0x4cb40a);}return null;};}function patchUpdates(_0x1cd779){return function(_0x5cc798){try{jsonpatch[_0x9bc7('0x20')](_0x5cc798,_0x1cd779,!![]);}catch(_0x44704f){return BPromise[_0x9bc7('0x21')](_0x44704f);}return _0x5cc798[_0x9bc7('0x22')]();};}function saveUpdates(_0x5da16c,_0x17a53a){return function(_0x34b4db){if(_0x34b4db){return _0x34b4db['update'](_0x5da16c)[_0x9bc7('0x23')](function(_0x508f0f){return _0x508f0f;});}return null;};}function removeEntity(_0x319201,_0x473058){return function(_0x3c4920){if(_0x3c4920){return _0x3c4920[_0x9bc7('0x24')]()[_0x9bc7('0x23')](function(){_0x319201['status'](0xcc)[_0x9bc7('0x25')]();});}};}function handleEntityNotFound(_0x10dbb1,_0x23c88f){return function(_0x5b5619){if(!_0x5b5619){_0x10dbb1['sendStatus'](0x194);}return _0x5b5619;};}function handleError(_0x3442b0,_0x116d5f){_0x116d5f=_0x116d5f||0x1f4;return function(_0x1fafb7){logger['error'](_0x1fafb7[_0x9bc7('0x26')]);if(_0x1fafb7['name']){delete _0x1fafb7[_0x9bc7('0x27')];}_0x3442b0[_0x9bc7('0x1a')](_0x116d5f)['send'](_0x1fafb7);};}exports[_0x9bc7('0x28')]=function(_0x57077d,_0x57a0ff){var _0x51a61e={},_0x19f9b3={},_0x57b5a4={'count':0x0,'rows':[]};var _0x25e732=_[_0x9bc7('0x29')](db['Migration'][_0x9bc7('0x2a')],function(_0x38746f){return{'name':_0x38746f['fieldName'],'type':_0x38746f[_0x9bc7('0x2b')]['key']};});_0x19f9b3['model']=_[_0x9bc7('0x29')](_0x25e732,'name');_0x19f9b3[_0x9bc7('0x2c')]=_[_0x9bc7('0x2d')](_0x57077d[_0x9bc7('0x2c')]);_0x19f9b3[_0x9bc7('0x2e')]=_[_0x9bc7('0x2f')](_0x19f9b3[_0x9bc7('0x30')],_0x19f9b3[_0x9bc7('0x2c')]);_0x51a61e[_0x9bc7('0x31')]=_[_0x9bc7('0x2f')](_0x19f9b3[_0x9bc7('0x30')],qs[_0x9bc7('0x32')](_0x57077d[_0x9bc7('0x2c')]['fields']));_0x51a61e['attributes']=_0x51a61e['attributes'][_0x9bc7('0x33')]?_0x51a61e[_0x9bc7('0x31')]:_0x19f9b3[_0x9bc7('0x30')];if(!_0x57077d['query']['hasOwnProperty'](_0x9bc7('0x34'))){_0x51a61e[_0x9bc7('0x1e')]=qs[_0x9bc7('0x1e')](_0x57077d[_0x9bc7('0x2c')][_0x9bc7('0x1e')]);_0x51a61e['offset']=qs[_0x9bc7('0x1d')](_0x57077d[_0x9bc7('0x2c')][_0x9bc7('0x1d')]);}_0x51a61e[_0x9bc7('0x35')]=qs['sort'](_0x57077d['query'][_0x9bc7('0x36')]);_0x51a61e[_0x9bc7('0x37')]=qs[_0x9bc7('0x2e')](_['pick'](_0x57077d['query'],_0x19f9b3[_0x9bc7('0x2e')]),_0x25e732);if(_0x57077d[_0x9bc7('0x2c')][_0x9bc7('0x38')]){_0x51a61e['where']=_[_0x9bc7('0x39')](_0x51a61e[_0x9bc7('0x37')],{'$or':_['map'](_0x25e732,function(_0x290aec){if(_0x290aec['type']!==_0x9bc7('0x3a')){var _0x34a058={};_0x34a058[_0x290aec[_0x9bc7('0x27')]]={'$like':'%'+_0x57077d['query'][_0x9bc7('0x38')]+'%'};return _0x34a058;}})});}_0x51a61e=_['merge']({},_0x51a61e,_0x57077d[_0x9bc7('0x3b')]);var _0x3b66a4={'where':_0x51a61e[_0x9bc7('0x37')]};return db[_0x9bc7('0x3c')]['count'](_0x3b66a4)['then'](function(_0x43fd){_0x57b5a4[_0x9bc7('0x1c')]=_0x43fd;if(_0x57077d[_0x9bc7('0x2c')][_0x9bc7('0x3d')]){_0x51a61e['include']=[{'all':!![]}];}return db[_0x9bc7('0x3c')][_0x9bc7('0x3e')](_0x51a61e);})['then'](function(_0x2a24d0){_0x57b5a4[_0x9bc7('0x3f')]=_0x2a24d0;return _0x57b5a4;})['then'](respondWithFilteredResult(_0x57a0ff,_0x51a61e))[_0x9bc7('0x40')](handleError(_0x57a0ff,null));};
\ No newline at end of file
+var _0x4591=['end','error','stack','name','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','include','Migration','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then'];(function(_0x55e513,_0x32bd07){var _0x225f26=function(_0x168eb4){while(--_0x168eb4){_0x55e513['push'](_0x55e513['shift']());}};_0x225f26(++_0x32bd07);}(_0x4591,0x168));var _0x1459=function(_0x483d2c,_0x34dc13){_0x483d2c=_0x483d2c-0x0;var _0x25239a=_0x4591[_0x483d2c];return _0x25239a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1459('0x0'));var zipdir=require(_0x1459('0x1'));var jsonpatch=require(_0x1459('0x2'));var rp=require(_0x1459('0x3'));var moment=require(_0x1459('0x4'));var BPromise=require(_0x1459('0x5'));var Mustache=require(_0x1459('0x6'));var util=require(_0x1459('0x7'));var path=require(_0x1459('0x8'));var sox=require('sox');var csv=require(_0x1459('0x9'));var ejs=require(_0x1459('0xa'));var fs=require('fs');var fs_extra=require(_0x1459('0xb'));var _=require(_0x1459('0xc'));var squel=require('squel');var crypto=require(_0x1459('0xd'));var jsforce=require(_0x1459('0xe'));var deskjs=require(_0x1459('0xf'));var toCsv=require(_0x1459('0x9'));var querystring=require(_0x1459('0x10'));var Papa=require('papaparse');var Redis=require(_0x1459('0x11'));var authService=require(_0x1459('0x12'));var qs=require(_0x1459('0x13'));var as=require(_0x1459('0x14'));var hardwareService=require(_0x1459('0x15'));var logger=require(_0x1459('0x16'))(_0x1459('0x17'));var utils=require('../../config/utils');var config=require(_0x1459('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dd5c4,_0x2f6a1f){_0x2f6a1f=_0x2f6a1f||0xcc;return function(_0x977afd){if(_0x977afd){return _0x3dd5c4['sendStatus'](_0x2f6a1f);}return _0x3dd5c4[_0x1459('0x19')](_0x2f6a1f)['end']();};}function respondWithResult(_0x217c3c,_0x369041){_0x369041=_0x369041||0xc8;return function(_0x46daeb){if(_0x46daeb){return _0x217c3c[_0x1459('0x19')](_0x369041)[_0x1459('0x1a')](_0x46daeb);}};}function respondWithFilteredResult(_0x4237b2,_0x3857a6){return function(_0x7b1647){if(_0x7b1647){var _0xa1474e=typeof _0x3857a6[_0x1459('0x1b')]===_0x1459('0x1c')&&typeof _0x3857a6[_0x1459('0x1d')]==='undefined';var _0x3385e6=_0x7b1647[_0x1459('0x1e')];var _0x3233ab=_0xa1474e?0x0:_0x3857a6['offset'];var _0x12f43a=_0xa1474e?_0x7b1647[_0x1459('0x1e')]:_0x3857a6[_0x1459('0x1b')]+_0x3857a6[_0x1459('0x1d')];var _0x2e5d9c;if(_0x12f43a>=_0x3385e6){_0x12f43a=_0x3385e6;_0x2e5d9c=0xc8;}else{_0x2e5d9c=0xce;}_0x4237b2[_0x1459('0x19')](_0x2e5d9c);return _0x4237b2['set'](_0x1459('0x1f'),_0x3233ab+'-'+_0x12f43a+'/'+_0x3385e6)[_0x1459('0x1a')](_0x7b1647);}return null;};}function patchUpdates(_0x4c4cd7){return function(_0x20187e){try{jsonpatch[_0x1459('0x20')](_0x20187e,_0x4c4cd7,!![]);}catch(_0x479019){return BPromise['reject'](_0x479019);}return _0x20187e[_0x1459('0x21')]();};}function saveUpdates(_0x2424e1,_0x14179b){return function(_0xbd6f2a){if(_0xbd6f2a){return _0xbd6f2a[_0x1459('0x22')](_0x2424e1)[_0x1459('0x23')](function(_0x5e196e){return _0x5e196e;});}return null;};}function removeEntity(_0x20c113,_0x62fd9c){return function(_0x4bb449){if(_0x4bb449){return _0x4bb449['destroy']()[_0x1459('0x23')](function(){_0x20c113[_0x1459('0x19')](0xcc)[_0x1459('0x24')]();});}};}function handleEntityNotFound(_0x289e5f,_0x444513){return function(_0x54f869){if(!_0x54f869){_0x289e5f['sendStatus'](0x194);}return _0x54f869;};}function handleError(_0x183c45,_0x14e6cb){_0x14e6cb=_0x14e6cb||0x1f4;return function(_0x3dc97f){logger[_0x1459('0x25')](_0x3dc97f[_0x1459('0x26')]);if(_0x3dc97f[_0x1459('0x27')]){delete _0x3dc97f['name'];}_0x183c45[_0x1459('0x19')](_0x14e6cb)['send'](_0x3dc97f);};}exports['index']=function(_0x719b5,_0x56e9c6){var _0x440b33={},_0x62973d={},_0xd05f89={'count':0x0,'rows':[]};var _0x4ccd51=_['map'](db['Migration'][_0x1459('0x28')],function(_0x418eed){return{'name':_0x418eed[_0x1459('0x29')],'type':_0x418eed[_0x1459('0x2a')][_0x1459('0x2b')]};});_0x62973d[_0x1459('0x2c')]=_[_0x1459('0x2d')](_0x4ccd51,_0x1459('0x27'));_0x62973d['query']=_[_0x1459('0x2e')](_0x719b5['query']);_0x62973d[_0x1459('0x2f')]=_[_0x1459('0x30')](_0x62973d[_0x1459('0x2c')],_0x62973d[_0x1459('0x31')]);_0x440b33['attributes']=_[_0x1459('0x30')](_0x62973d[_0x1459('0x2c')],qs['fields'](_0x719b5[_0x1459('0x31')][_0x1459('0x32')]));_0x440b33[_0x1459('0x33')]=_0x440b33[_0x1459('0x33')][_0x1459('0x34')]?_0x440b33['attributes']:_0x62973d[_0x1459('0x2c')];if(!_0x719b5['query'][_0x1459('0x35')](_0x1459('0x36'))){_0x440b33[_0x1459('0x1d')]=qs[_0x1459('0x1d')](_0x719b5[_0x1459('0x31')]['limit']);_0x440b33[_0x1459('0x1b')]=qs['offset'](_0x719b5[_0x1459('0x31')][_0x1459('0x1b')]);}_0x440b33[_0x1459('0x37')]=qs['sort'](_0x719b5[_0x1459('0x31')]['sort']);_0x440b33[_0x1459('0x38')]=qs[_0x1459('0x2f')](_[_0x1459('0x39')](_0x719b5[_0x1459('0x31')],_0x62973d[_0x1459('0x2f')]),_0x4ccd51);if(_0x719b5['query']['filter']){_0x440b33[_0x1459('0x38')]=_[_0x1459('0x3a')](_0x440b33[_0x1459('0x38')],{'$or':_[_0x1459('0x2d')](_0x4ccd51,function(_0x3cfd60){if(_0x3cfd60['type']!==_0x1459('0x3b')){var _0x288355={};_0x288355[_0x3cfd60[_0x1459('0x27')]]={'$like':'%'+_0x719b5[_0x1459('0x31')]['filter']+'%'};return _0x288355;}})});}_0x440b33=_[_0x1459('0x3a')]({},_0x440b33,_0x719b5[_0x1459('0x3c')]);var _0x14d5ff={'where':_0x440b33['where']};return db['Migration'][_0x1459('0x1e')](_0x14d5ff)[_0x1459('0x23')](function(_0x5bdbee){_0xd05f89['count']=_0x5bdbee;if(_0x719b5[_0x1459('0x31')]['includeAll']){_0x440b33[_0x1459('0x3d')]=[{'all':!![]}];}return db[_0x1459('0x3e')][_0x1459('0x3f')](_0x440b33);})['then'](function(_0x3da259){_0xd05f89[_0x1459('0x40')]=_0x3da259;return _0xd05f89;})[_0x1459('0x23')](respondWithFilteredResult(_0x56e9c6,_0x440b33))[_0x1459('0x41')](handleError(_0x56e9c6,null));};
\ No newline at end of file