Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / migration / migration.controller.js
index 5bd3e1b..3d141ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd69e=['json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','Migration','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','end','status','offset','undefined','limit','count','set'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0xd69e,0xa0));var _0xed69=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd69e[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xed69('0x0'));var rimraf=require(_0xed69('0x1'));var zipdir=require(_0xed69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed69('0x3'));var moment=require(_0xed69('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xed69('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed69('0x6'));var _=require(_0xed69('0x7'));var squel=require(_0xed69('0x8'));var crypto=require(_0xed69('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xed69('0xa'));var toCsv=require('to-csv');var querystring=require(_0xed69('0xb'));var Papa=require(_0xed69('0xc'));var Redis=require('ioredis');var authService=require(_0xed69('0xd'));var qs=require(_0xed69('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed69('0xf'));var logger=require('../../config/logger')(_0xed69('0x10'));var utils=require(_0xed69('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xed69('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456e35,_0x39fe5e){_0x39fe5e=_0x39fe5e||0xcc;return function(_0x382f4b){if(_0x382f4b){return _0x456e35['sendStatus'](_0x39fe5e);}return _0x456e35['status'](_0x39fe5e)[_0xed69('0x13')]();};}function respondWithResult(_0x137f8c,_0x6c3dab){_0x6c3dab=_0x6c3dab||0xc8;return function(_0x476524){if(_0x476524){return _0x137f8c[_0xed69('0x14')](_0x6c3dab)['json'](_0x476524);}};}function respondWithFilteredResult(_0xc03c8d,_0x1e318a){return function(_0x19af14){if(_0x19af14){var _0x118ab3=typeof _0x1e318a[_0xed69('0x15')]===_0xed69('0x16')&&typeof _0x1e318a[_0xed69('0x17')]===_0xed69('0x16');var _0x1e7446=_0x19af14[_0xed69('0x18')];var _0x4df35e=_0x118ab3?0x0:_0x1e318a['offset'];var _0x553824=_0x118ab3?_0x19af14[_0xed69('0x18')]:_0x1e318a[_0xed69('0x15')]+_0x1e318a[_0xed69('0x17')];var _0x576a71;if(_0x553824>=_0x1e7446){_0x553824=_0x1e7446;_0x576a71=0xc8;}else{_0x576a71=0xce;}_0xc03c8d[_0xed69('0x14')](_0x576a71);return _0xc03c8d[_0xed69('0x19')]('Content-Range',_0x4df35e+'-'+_0x553824+'/'+_0x1e7446)[_0xed69('0x1a')](_0x19af14);}return null;};}function patchUpdates(_0x10285d){return function(_0x1fcd0e){try{jsonpatch[_0xed69('0x1b')](_0x1fcd0e,_0x10285d,!![]);}catch(_0x4ef2fe){return BPromise[_0xed69('0x1c')](_0x4ef2fe);}return _0x1fcd0e[_0xed69('0x1d')]();};}function saveUpdates(_0x5c3a04,_0x12a1b7){return function(_0x350f01){if(_0x350f01){return _0x350f01[_0xed69('0x1e')](_0x5c3a04)[_0xed69('0x1f')](function(_0xa3486a){return _0xa3486a;});}return null;};}function removeEntity(_0x169398,_0x513337){return function(_0x35e7ec){if(_0x35e7ec){return _0x35e7ec[_0xed69('0x20')]()[_0xed69('0x1f')](function(){_0x169398[_0xed69('0x14')](0xcc)[_0xed69('0x13')]();});}};}function handleEntityNotFound(_0xd182bd,_0x33f01f){return function(_0x1e34c8){if(!_0x1e34c8){_0xd182bd[_0xed69('0x21')](0x194);}return _0x1e34c8;};}function handleError(_0x25a097,_0x360fa5){_0x360fa5=_0x360fa5||0x1f4;return function(_0x4c2986){logger['error'](_0x4c2986[_0xed69('0x22')]);if(_0x4c2986[_0xed69('0x23')]){delete _0x4c2986[_0xed69('0x23')];}_0x25a097[_0xed69('0x14')](_0x360fa5)[_0xed69('0x24')](_0x4c2986);};}exports[_0xed69('0x25')]=function(_0x5b6ee3,_0x3ec72b){var _0x28cbc8={},_0x1b24d7={},_0x582fdc={'count':0x0,'rows':[]};var _0x53b95c=_[_0xed69('0x26')](db['Migration'][_0xed69('0x27')],function(_0x234c8a){return{'name':_0x234c8a[_0xed69('0x28')],'type':_0x234c8a[_0xed69('0x29')][_0xed69('0x2a')]};});_0x1b24d7[_0xed69('0x2b')]=_[_0xed69('0x26')](_0x53b95c,'name');_0x1b24d7[_0xed69('0x2c')]=_[_0xed69('0x2d')](_0x5b6ee3[_0xed69('0x2c')]);_0x1b24d7[_0xed69('0x2e')]=_[_0xed69('0x2f')](_0x1b24d7[_0xed69('0x2b')],_0x1b24d7[_0xed69('0x2c')]);_0x28cbc8['attributes']=_['intersection'](_0x1b24d7[_0xed69('0x2b')],qs[_0xed69('0x30')](_0x5b6ee3[_0xed69('0x2c')][_0xed69('0x30')]));_0x28cbc8[_0xed69('0x31')]=_0x28cbc8[_0xed69('0x31')]['length']?_0x28cbc8[_0xed69('0x31')]:_0x1b24d7[_0xed69('0x2b')];if(!_0x5b6ee3[_0xed69('0x2c')][_0xed69('0x32')](_0xed69('0x33'))){_0x28cbc8[_0xed69('0x17')]=qs['limit'](_0x5b6ee3['query']['limit']);_0x28cbc8[_0xed69('0x15')]=qs[_0xed69('0x15')](_0x5b6ee3[_0xed69('0x2c')][_0xed69('0x15')]);}_0x28cbc8['order']=qs[_0xed69('0x34')](_0x5b6ee3[_0xed69('0x2c')]['sort']);_0x28cbc8[_0xed69('0x35')]=qs[_0xed69('0x2e')](_[_0xed69('0x36')](_0x5b6ee3[_0xed69('0x2c')],_0x1b24d7['filters']),_0x53b95c);if(_0x5b6ee3[_0xed69('0x2c')][_0xed69('0x37')]){_0x28cbc8[_0xed69('0x35')]=_[_0xed69('0x38')](_0x28cbc8[_0xed69('0x35')],{'$or':_[_0xed69('0x26')](_0x53b95c,function(_0x32b40a){if(_0x32b40a[_0xed69('0x29')]!=='VIRTUAL'){var _0x43047a={};_0x43047a[_0x32b40a['name']]={'$like':'%'+_0x5b6ee3[_0xed69('0x2c')][_0xed69('0x37')]+'%'};return _0x43047a;}})});}_0x28cbc8=_[_0xed69('0x38')]({},_0x28cbc8,_0x5b6ee3['options']);var _0x46a72b={'where':_0x28cbc8['where']};return db[_0xed69('0x39')][_0xed69('0x18')](_0x46a72b)[_0xed69('0x1f')](function(_0x39c99d){_0x582fdc[_0xed69('0x18')]=_0x39c99d;if(_0x5b6ee3[_0xed69('0x2c')][_0xed69('0x3a')]){_0x28cbc8['include']=[{'all':!![]}];}return db['Migration'][_0xed69('0x3b')](_0x28cbc8);})[_0xed69('0x1f')](function(_0x3fac9c){_0x582fdc[_0xed69('0x3c')]=_0x3fac9c;return _0x582fdc;})['then'](respondWithFilteredResult(_0x3ec72b,_0x28cbc8))[_0xed69('0x3d')](handleError(_0x3ec72b,null));};
\ No newline at end of file
+var _0xba03=['index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x4d2ed7,_0x1999e5){var _0x12af27=function(_0x28e2d4){while(--_0x28e2d4){_0x4d2ed7['push'](_0x4d2ed7['shift']());}};_0x12af27(++_0x1999e5);}(_0xba03,0x161));var _0x3ba0=function(_0x23a87e,_0x56a844){_0x23a87e=_0x23a87e-0x0;var _0x3140d1=_0xba03[_0x23a87e];return _0x3140d1;};'use strict';var emlformat=require(_0x3ba0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ba0('0x1'));var jsonpatch=require(_0x3ba0('0x2'));var rp=require(_0x3ba0('0x3'));var moment=require(_0x3ba0('0x4'));var BPromise=require(_0x3ba0('0x5'));var Mustache=require('mustache');var util=require(_0x3ba0('0x6'));var path=require('path');var sox=require(_0x3ba0('0x7'));var csv=require(_0x3ba0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ba0('0x9'));var crypto=require(_0x3ba0('0xa'));var jsforce=require(_0x3ba0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3ba0('0x8'));var querystring=require(_0x3ba0('0xc'));var Papa=require(_0x3ba0('0xd'));var Redis=require(_0x3ba0('0xe'));var authService=require(_0x3ba0('0xf'));var qs=require(_0x3ba0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ba0('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3ba0('0x12'));var licenseUtil=require(_0x3ba0('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a3619,_0x2d6b23){_0x2d6b23=_0x2d6b23||0xcc;return function(_0x8817df){if(_0x8817df){return _0x4a3619[_0x3ba0('0x14')](_0x2d6b23);}return _0x4a3619[_0x3ba0('0x15')](_0x2d6b23)[_0x3ba0('0x16')]();};}function respondWithResult(_0x5c5d1f,_0x21181e){_0x21181e=_0x21181e||0xc8;return function(_0x1f184b){if(_0x1f184b){return _0x5c5d1f['status'](_0x21181e)[_0x3ba0('0x17')](_0x1f184b);}};}function respondWithFilteredResult(_0x34a469,_0x16def9){return function(_0x55b4f1){if(_0x55b4f1){var _0x1bcb29=typeof _0x16def9['offset']===_0x3ba0('0x18')&&typeof _0x16def9[_0x3ba0('0x19')]===_0x3ba0('0x18');var _0x14b875=_0x55b4f1[_0x3ba0('0x1a')];var _0x238b53=_0x1bcb29?0x0:_0x16def9[_0x3ba0('0x1b')];var _0x5ef0ad=_0x1bcb29?_0x55b4f1['count']:_0x16def9[_0x3ba0('0x1b')]+_0x16def9['limit'];var _0x38d694;if(_0x5ef0ad>=_0x14b875){_0x5ef0ad=_0x14b875;_0x38d694=0xc8;}else{_0x38d694=0xce;}_0x34a469[_0x3ba0('0x15')](_0x38d694);return _0x34a469['set'](_0x3ba0('0x1c'),_0x238b53+'-'+_0x5ef0ad+'/'+_0x14b875)[_0x3ba0('0x17')](_0x55b4f1);}return null;};}function patchUpdates(_0x375715){return function(_0x448dd8){try{jsonpatch[_0x3ba0('0x1d')](_0x448dd8,_0x375715,!![]);}catch(_0x521aa6){return BPromise[_0x3ba0('0x1e')](_0x521aa6);}return _0x448dd8[_0x3ba0('0x1f')]();};}function saveUpdates(_0x361c2e,_0x14ecaa){return function(_0x1074a2){if(_0x1074a2){return _0x1074a2['update'](_0x361c2e)[_0x3ba0('0x20')](function(_0x169283){return _0x169283;});}return null;};}function removeEntity(_0x4bb896,_0x113c65){return function(_0x4044e7){if(_0x4044e7){return _0x4044e7[_0x3ba0('0x21')]()['then'](function(){_0x4bb896[_0x3ba0('0x15')](0xcc)[_0x3ba0('0x16')]();});}};}function handleEntityNotFound(_0x4e88f0,_0xd2e049){return function(_0x29e823){if(!_0x29e823){_0x4e88f0[_0x3ba0('0x14')](0x194);}return _0x29e823;};}function handleError(_0x1f42fc,_0x590be0){_0x590be0=_0x590be0||0x1f4;return function(_0x5560c4){logger[_0x3ba0('0x22')](_0x5560c4[_0x3ba0('0x23')]);if(_0x5560c4[_0x3ba0('0x24')]){delete _0x5560c4[_0x3ba0('0x24')];}_0x1f42fc[_0x3ba0('0x15')](_0x590be0)['send'](_0x5560c4);};}exports[_0x3ba0('0x25')]=function(_0xe757a3,_0x1b5a0a){var _0xaf6723={},_0x63c95a={},_0x89e3cc={'count':0x0,'rows':[]};var _0x1730ed=_[_0x3ba0('0x26')](db[_0x3ba0('0x27')][_0x3ba0('0x28')],function(_0x575175){return{'name':_0x575175[_0x3ba0('0x29')],'type':_0x575175[_0x3ba0('0x2a')][_0x3ba0('0x2b')]};});_0x63c95a[_0x3ba0('0x2c')]=_[_0x3ba0('0x26')](_0x1730ed,_0x3ba0('0x24'));_0x63c95a[_0x3ba0('0x2d')]=_[_0x3ba0('0x2e')](_0xe757a3[_0x3ba0('0x2d')]);_0x63c95a[_0x3ba0('0x2f')]=_[_0x3ba0('0x30')](_0x63c95a[_0x3ba0('0x2c')],_0x63c95a['query']);_0xaf6723[_0x3ba0('0x31')]=_[_0x3ba0('0x30')](_0x63c95a[_0x3ba0('0x2c')],qs[_0x3ba0('0x32')](_0xe757a3[_0x3ba0('0x2d')][_0x3ba0('0x32')]));_0xaf6723['attributes']=_0xaf6723['attributes'][_0x3ba0('0x33')]?_0xaf6723[_0x3ba0('0x31')]:_0x63c95a['model'];if(!_0xe757a3[_0x3ba0('0x2d')]['hasOwnProperty']('nolimit')){_0xaf6723[_0x3ba0('0x19')]=qs[_0x3ba0('0x19')](_0xe757a3[_0x3ba0('0x2d')][_0x3ba0('0x19')]);_0xaf6723[_0x3ba0('0x1b')]=qs[_0x3ba0('0x1b')](_0xe757a3[_0x3ba0('0x2d')][_0x3ba0('0x1b')]);}_0xaf6723[_0x3ba0('0x34')]=qs[_0x3ba0('0x35')](_0xe757a3[_0x3ba0('0x2d')][_0x3ba0('0x35')]);_0xaf6723[_0x3ba0('0x36')]=qs['filters'](_[_0x3ba0('0x37')](_0xe757a3[_0x3ba0('0x2d')],_0x63c95a[_0x3ba0('0x2f')]),_0x1730ed);if(_0xe757a3[_0x3ba0('0x2d')][_0x3ba0('0x38')]){_0xaf6723[_0x3ba0('0x36')]=_[_0x3ba0('0x39')](_0xaf6723['where'],{'$or':_[_0x3ba0('0x26')](_0x1730ed,function(_0x18aab7){if(_0x18aab7[_0x3ba0('0x2a')]!==_0x3ba0('0x3a')){var _0x4772d0={};_0x4772d0[_0x18aab7['name']]={'$like':'%'+_0xe757a3[_0x3ba0('0x2d')][_0x3ba0('0x38')]+'%'};return _0x4772d0;}})});}_0xaf6723=_[_0x3ba0('0x39')]({},_0xaf6723,_0xe757a3[_0x3ba0('0x3b')]);var _0x11f406={'where':_0xaf6723[_0x3ba0('0x36')]};return db[_0x3ba0('0x27')][_0x3ba0('0x1a')](_0x11f406)['then'](function(_0x1bab83){_0x89e3cc[_0x3ba0('0x1a')]=_0x1bab83;if(_0xe757a3[_0x3ba0('0x2d')][_0x3ba0('0x3c')]){_0xaf6723[_0x3ba0('0x3d')]=[{'all':!![]}];}return db['Migration'][_0x3ba0('0x3e')](_0xaf6723);})[_0x3ba0('0x20')](function(_0x1c4d2c){_0x89e3cc[_0x3ba0('0x3f')]=_0x1c4d2c;return _0x89e3cc;})[_0x3ba0('0x20')](respondWithFilteredResult(_0x1b5a0a,_0xaf6723))[_0x3ba0('0x40')](handleError(_0x1b5a0a,null));};
\ No newline at end of file