Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / components / parsers / qs.js
index 4cf09a8..703903c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5334=['value','merge','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','getOptions','query','$id','model','intersection','attributes','nolimit','limit','offset','order','where','pick','filter','object','columns'];(function(_0x2ccc05,_0x345621){var _0x2d0ff8=function(_0x285b5d){while(--_0x285b5d){_0x2ccc05['push'](_0x2ccc05['shift']());}};_0x2d0ff8(++_0x345621);}(_0x5334,0x84));var _0x4533=function(_0x459ce9,_0x512b3d){_0x459ce9=_0x459ce9-0x0;var _0x183b79=_0x5334[_0x459ce9];return _0x183b79;};'use strict';var _=require(_0x4533('0x0'));var sequelize=require(_0x4533('0x1'));var moment=require(_0x4533('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x35fb80){var _0x39af56=['ne'];try{var _0x52b768=JSON[_0x4533('0x3')](_0x35fb80);var _0x5176b5=Object[_0x4533('0x4')](_0x52b768)[0x0];return _0x39af56[_0x4533('0x5')](_0x5176b5);}catch(_0x5cbca4){return![];}}function getOperatorValue(_0x4a576a){var _0x51b4ce=JSON[_0x4533('0x3')](_0x4a576a);var _0x4dea06=Object['keys'](_0x51b4ce)[0x0];var _0x487906=_0x51b4ce[_0x4dea06];return{['$'+_0x4dea06]:_0x487906};}exports[_0x4533('0x6')]=function(_0x42f94b){var _0x300877=null;if(_0x42f94b){_0x300877=_0x42f94b[_0x4533('0x7')](',');}return _0x300877;};exports[_0x4533('0x8')]=function(_0x21b22f,_0xd417){var _0x4fdbda={};if(!_[_0x4533('0x9')](_0x21b22f)){_[_0x4533('0xa')](_0x21b22f,function(_0x1b52ee,_0x12131a){try{if(_0xd417){var _0x5465bf=_[_0x4533('0xb')](_0xd417,{'name':_0x12131a})||{};if(hasSequelizeOperator(_0x1b52ee)){_0x4fdbda[_0x12131a]=getOperatorValue(_0x1b52ee);}else if(_0x5465bf['type']===_0x4533('0xc')&&_[_0x4533('0xd')](_0x1b52ee)){var _0x45ba67=JSON[_0x4533('0x3')](_0x1b52ee);var _0x57ff74={'$gte':moment(moment(_0x45ba67[_0x4533('0xe')])[_0x4533('0xf')](_0x4533('0x10')))[_0x4533('0x11')]()['format'](),'$lte':moment(moment(_0x45ba67[_0x4533('0x12')])['format']('YYYY-MM-DD'))[_0x4533('0x11')]()[_0x4533('0x13')](0x1,'s')['format']()};_0x4fdbda[_0x12131a]=_0x57ff74;}else if(_0x5465bf[_0x4533('0x14')]===_0x4533('0x15')){_0x4fdbda[_0x12131a]=_0x1b52ee;}else{_0x4fdbda[_0x12131a]=_[_0x4533('0x16')](_0x1b52ee)?_0x1b52ee:JSON['parse'](_0x1b52ee);}}else{_0x4fdbda[_0x12131a]=_[_0x4533('0x16')](_0x1b52ee)?_0x1b52ee:JSON['parse'](_0x1b52ee);}}catch(_0x3ddb36){_0x4fdbda[_0x12131a]=_0x1b52ee[_0x4533('0x7')](',');}});}return _0x4fdbda;};exports['limit']=function(_0xd10c6a){_0xd10c6a=parseInt(_0xd10c6a,0xa);if(!_0xd10c6a||_0xd10c6a<0x0){_0xd10c6a=LIMIT_VALUE;}return _0xd10c6a;};exports['offset']=function(_0x5c2c9c){_0x5c2c9c=parseInt(_0x5c2c9c,0xa);if(!_0x5c2c9c||_0x5c2c9c<0x0){_0x5c2c9c=0x0;}return _0x5c2c9c;};exports[_0x4533('0x17')]=function(_0x9740a6){var _0x49fb91,_0x53fe43=null;if(_0x9740a6){_0x49fb91=_0x9740a6[_0x4533('0x7')](',');_0x53fe43=_[_0x4533('0x18')](_0x49fb91,function(_0x3467ba){if(_0x3467ba[_0x4533('0x19')]('-')===0x0){return[_0x3467ba===_0x4533('0x1a')?sequelize[_0x4533('0x1b')](sequelize[_0x4533('0x1c')]('priority'),_0x4533('0x1d')):_0x3467ba[_0x4533('0x1e')](0x1),_0x4533('0x1f')];}else{return[_0x3467ba==='priority'?sequelize['cast'](sequelize[_0x4533('0x1c')](_0x4533('0x1a')),'unsigned'):_0x3467ba,'ASC'];}});}return _0x53fe43;};exports[_0x4533('0x20')]=function(_0x1fa8be,_0xfd9409){if(_['isEmpty'](_0x1fa8be)){return _0x1fa8be;}if(_[_0x4533('0x16')](_0x1fa8be)){for(var _0x39b261=0x0;_0x39b261<_0x1fa8be[_0x4533('0x21')];_0x39b261+=0x1){_0x1fa8be[_0x39b261]=this[_0x4533('0x20')](_0x1fa8be[_0x39b261],_0xfd9409);}return _0x1fa8be;}if(!_[_0x4533('0x22')](_0x1fa8be)){return _0x1fa8be;}if(_[_0x4533('0x23')](_0xfd9409)){_0xfd9409=[_0xfd9409];}if(!_[_0x4533('0x16')](_0xfd9409)){return _0x1fa8be;}for(var _0x27b653=0x0;_0x27b653<_0xfd9409[_0x4533('0x21')];_0x27b653+=0x1){_['unset'](_0x1fa8be,_0xfd9409[_0x27b653]);}for(var _0x5c1e24 in _0x1fa8be){if(_0x1fa8be[_0x4533('0x24')](_0x5c1e24)){_0x1fa8be[_0x5c1e24]=this['omit'](_0x1fa8be[_0x5c1e24],_0xfd9409);}}return _0x1fa8be;};exports[_0x4533('0x25')]=function(_0x4e2b80){return _0x4e2b80[_0x4533('0x26')](RegExp(_0x4533('0x27')))?!![]:![];};exports[_0x4533('0x28')]=function(_0x4300c1){return _0x4300c1[_0x4533('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x4533('0x29')]=function(_0xe584a2){var _0xa58dd1=[];_0xe584a2[_0x4533('0x7')](/[ ,]+/)[_0x4533('0x2a')](function(_0x728791){_0x728791=_0x728791[_0x4533('0x2b')](/([^:]")"+/g,'$1');_0x728791='+'+_0x728791+'*';var _0x7fc887=/[ `!@#$%^&*()_\-?~]/;if(_0x728791['match'](_0x7fc887))_0x728791='\x22'+_0x728791+'\x22';_0xa58dd1[_0x4533('0x2c')](_0x728791);});return _0xa58dd1['join']('\x20');};exports[_0x4533('0x2d')]=function(_0x3f7720,_0xb7f0b1,_0x3b89f0){var _0x24acf5={},_0x6d58aa={};if(_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x2f')]){_0xb7f0b1[_0x4533('0x2e')]['id']=_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x2f')];delete _0xb7f0b1[_0x4533('0x2e')]['$id'];}_0x24acf5[_0x4533('0x30')]=_[_0x4533('0x18')](_0x3f7720,_0x4533('0x14'));_0x24acf5[_0x4533('0x2e')]=_[_0x4533('0x4')](_0xb7f0b1['query']);_0x24acf5[_0x4533('0x8')]=_[_0x4533('0x31')](_0x24acf5[_0x4533('0x30')],_0x24acf5[_0x4533('0x2e')]);_0x6d58aa[_0x4533('0x32')]=_[_0x4533('0x31')](_0x24acf5['model'],this[_0x4533('0x6')](_0xb7f0b1[_0x4533('0x2e')]['fields']));_0x6d58aa[_0x4533('0x32')]=_0x6d58aa[_0x4533('0x32')][_0x4533('0x21')]?_0x6d58aa[_0x4533('0x32')]:_0x24acf5[_0x4533('0x30')];if(!_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x24')](_0x4533('0x33'))){_0x6d58aa[_0x4533('0x34')]=this[_0x4533('0x34')](_0xb7f0b1['query'][_0x4533('0x34')]);_0x6d58aa[_0x4533('0x35')]=this[_0x4533('0x35')](_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x35')]);}_0x6d58aa[_0x4533('0x36')]=this[_0x4533('0x17')](_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x17')]);_0x6d58aa[_0x4533('0x37')]=this[_0x4533('0x8')](_[_0x4533('0x38')](_0xb7f0b1['query'],_0x24acf5['filters']),_0x3f7720);if(_0xb7f0b1[_0x4533('0x2e')]['filter']){var _0x4260e6=_0x3f7720;var _0x97aa9e=_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x39')];if(typeof _0x97aa9e===_0x4533('0x3a')){_0x4260e6=_[_0x4533('0x39')](_0x3f7720,function(_0x2df795){return _[_0x4533('0x5')](_0x97aa9e[_0x4533('0x3b')],_0x2df795[_0x4533('0x14')]);});_0x97aa9e=_0x97aa9e[_0x4533('0x3c')];}_0x6d58aa[_0x4533('0x37')]=_[_0x4533('0x3d')](_0x6d58aa['where'],{'$or':_[_0x4533('0x18')](_0x4260e6,function(_0x556dd9){if(_0x556dd9['type']!=='VIRTUAL'){if(_0x3b89f0){return sequelize['where'](sequelize['fn'](_0x4533('0x3e'),sequelize[_0x4533('0x1c')](_0x556dd9[_0x4533('0x14')])),{'$like':sequelize['fn'](_0x4533('0x3e'),'%'+_0xb7f0b1['query'][_0x4533('0x39')]+'%')});}else{var _0x369284={};_0x369284[_0x556dd9[_0x4533('0x14')]]={'$like':'%'+_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x39')]+'%'};return _0x369284;}}})});}_0x6d58aa=_[_0x4533('0x3d')]({},_0x6d58aa,_0xb7f0b1[_0x4533('0x3f')]);return _0x6d58aa;};
\ No newline at end of file
+var _0x3b18=['$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','limit','map','indexOf','cast','col','unsigned','DESC','ASC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','trim','forEach','replace','push','query','$id','attributes','intersection','nolimit','offset','order','sort','where','pick','filter','columns','value','merge','VIRTUAL','lower','options','include','includeAll','escapeLIKESpecialChars','lodash','sequelize','parse','keys','includes','model','alias','fields','split','filters','isEmpty','find','type','isPlainObject'];(function(_0x36f5e7,_0x2d2629){var _0x291882=function(_0x20b013){while(--_0x20b013){_0x36f5e7['push'](_0x36f5e7['shift']());}};_0x291882(++_0x2d2629);}(_0x3b18,0x16c));var _0x83b1=function(_0x386381,_0x33a068){_0x386381=_0x386381-0x0;var _0x25fcfb=_0x3b18[_0x386381];return _0x25fcfb;};'use strict';var _=require(_0x83b1('0x0'));var sequelize=require(_0x83b1('0x1'));var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1db948){var _0xb16109=['ne'];try{var _0x38bf1d=JSON[_0x83b1('0x2')](_0x1db948);var _0x46a6fe=Object[_0x83b1('0x3')](_0x38bf1d)[0x0];return _0xb16109[_0x83b1('0x4')](_0x46a6fe);}catch(_0x2265db){return![];}}function getOperatorValue(_0x473069){var _0x23f0cf=JSON[_0x83b1('0x2')](_0x473069);var _0x5f5d55=Object['keys'](_0x23f0cf)[0x0];var _0x126c89=_0x23f0cf[_0x5f5d55];return{['$'+_0x5f5d55]:_0x126c89};}function parseIncludeModel(_0x342cdd){var _0x17db45=JSON[_0x83b1('0x2')](_0x342cdd);return{'model':db[_0x17db45[_0x83b1('0x5')]],'as':_0x17db45[_0x83b1('0x6')],'attributes':_0x17db45[_0x83b1('0x7')],'raw':_0x17db45['raw']};}exports[_0x83b1('0x7')]=function(_0xf5367c){var _0x204f22=null;if(_0xf5367c){_0x204f22=_0xf5367c[_0x83b1('0x8')](',');}return _0x204f22;};exports[_0x83b1('0x9')]=function(_0x43b3ff,_0xf79298){var _0x507a6b={};if(!_[_0x83b1('0xa')](_0x43b3ff)){_['forOwn'](_0x43b3ff,function(_0x46e8b5,_0x192d13){try{if(_0xf79298){var _0x2be5b1=_[_0x83b1('0xb')](_0xf79298,{'name':_0x192d13})||{};if(hasSequelizeOperator(_0x46e8b5)){_0x507a6b[_0x192d13]=getOperatorValue(_0x46e8b5);}else if(_0x2be5b1[_0x83b1('0xc')]==='DATE'&&_[_0x83b1('0xd')](_0x46e8b5)){var _0x106b9c=JSON[_0x83b1('0x2')](_0x46e8b5);var _0x5b0076={'$gte':moment(moment(_0x106b9c[_0x83b1('0xe')])['format'](_0x83b1('0xf')))[_0x83b1('0x10')]()[_0x83b1('0x11')](),'$lte':moment(moment(_0x106b9c[_0x83b1('0x12')])[_0x83b1('0x11')](_0x83b1('0xf')))['utc']()[_0x83b1('0x13')](0x1,'s')[_0x83b1('0x11')]()};_0x507a6b[_0x192d13]=_0x5b0076;}else if(_0x2be5b1[_0x83b1('0x14')]===_0x83b1('0x15')){_0x507a6b[_0x192d13]=_0x46e8b5;}else{_0x507a6b[_0x192d13]=_[_0x83b1('0x16')](_0x46e8b5)?_0x46e8b5:JSON[_0x83b1('0x2')](_0x46e8b5);}}else{_0x507a6b[_0x192d13]=_[_0x83b1('0x16')](_0x46e8b5)?_0x46e8b5:JSON[_0x83b1('0x2')](_0x46e8b5);}}catch(_0x86122){_0x507a6b[_0x192d13]=_0x46e8b5[_0x83b1('0x8')](',');}});}return _0x507a6b;};exports[_0x83b1('0x17')]=function(_0xa8627){_0xa8627=parseInt(_0xa8627,0xa);if(!_0xa8627||_0xa8627<0x0){_0xa8627=LIMIT_VALUE;}return _0xa8627;};exports['offset']=function(_0x27d44b){_0x27d44b=parseInt(_0x27d44b,0xa);if(!_0x27d44b||_0x27d44b<0x0){_0x27d44b=0x0;}return _0x27d44b;};exports['sort']=function(_0x5a09ac){var _0x57be27,_0x37c4ca=null;if(_0x5a09ac){_0x57be27=_0x5a09ac['split'](',');_0x37c4ca=_[_0x83b1('0x18')](_0x57be27,function(_0x46fea6){if(_0x46fea6[_0x83b1('0x19')]('-')===0x0){return[_0x46fea6==='priority'?sequelize[_0x83b1('0x1a')](sequelize[_0x83b1('0x1b')]('priority'),_0x83b1('0x1c')):_0x46fea6['substr'](0x1),_0x83b1('0x1d')];}else{return[_0x46fea6==='priority'?sequelize[_0x83b1('0x1a')](sequelize[_0x83b1('0x1b')]('priority'),'unsigned'):_0x46fea6,_0x83b1('0x1e')];}});}return _0x37c4ca;};exports['omit']=function(_0x2f49d8,_0x10d426){if(_[_0x83b1('0xa')](_0x2f49d8)){return _0x2f49d8;}if(_[_0x83b1('0x16')](_0x2f49d8)){for(var _0x35d946=0x0;_0x35d946<_0x2f49d8[_0x83b1('0x1f')];_0x35d946+=0x1){_0x2f49d8[_0x35d946]=this[_0x83b1('0x20')](_0x2f49d8[_0x35d946],_0x10d426);}return _0x2f49d8;}if(!_[_0x83b1('0x21')](_0x2f49d8)){return _0x2f49d8;}if(_[_0x83b1('0x22')](_0x10d426)){_0x10d426=[_0x10d426];}if(!_[_0x83b1('0x16')](_0x10d426)){return _0x2f49d8;}for(var _0xa5d604=0x0;_0xa5d604<_0x10d426[_0x83b1('0x1f')];_0xa5d604+=0x1){_[_0x83b1('0x23')](_0x2f49d8,_0x10d426[_0xa5d604]);}for(var _0x14e090 in _0x2f49d8){if(_0x2f49d8[_0x83b1('0x24')](_0x14e090)){_0x2f49d8[_0x14e090]=this[_0x83b1('0x20')](_0x2f49d8[_0x14e090],_0x10d426);}}return _0x2f49d8;};exports[_0x83b1('0x25')]=function(_0x50b799){return _0x50b799[_0x83b1('0x26')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x11c7ed){return _0x11c7ed[_0x83b1('0x26')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x56982b,_0x455e9b){var _0x3dae2e=[];var _0x21136d=/([^:]")"+/g;var _0x2542da=/[*<>~@-]/g;var _0x2018ab=/[ `!@#$%^&*()_\-?~<>]/;var _0x2f463d=/[ ,]+/;var _0x5cf63f=_0x455e9b?'\x22{EXPR}\x22':'{EXPR}';if(_0x455e9b){_0x56982b=_0x56982b['replace'](_0x2542da,'\x20')[_0x83b1('0x27')]();}_0x56982b[_0x83b1('0x8')](_0x2f463d)[_0x83b1('0x28')](function(_0x2561e8){_0x2561e8=_0x2561e8[_0x83b1('0x29')](_0x21136d,'$1');_0x2561e8='+'+_0x2561e8+'*';var _0x3f75fa=_0x2561e8['match'](_0x2018ab);if(_0x3f75fa){_0x2561e8='\x22'+_0x2561e8+'\x22';}_0x3dae2e[_0x83b1('0x2a')](_0x2561e8);});_0x5cf63f=_0x5cf63f['replace']('{EXPR}',_0x3dae2e['join']('\x20'));return _0x5cf63f;};exports['getOptions']=function(_0x309217,_0x317fc1,_0x2511f6){var _0x4d878a={},_0x4ca154={};if(_0x317fc1[_0x83b1('0x2b')]['$id']){_0x317fc1[_0x83b1('0x2b')]['id']=_0x317fc1['query'][_0x83b1('0x2c')];delete _0x317fc1[_0x83b1('0x2b')][_0x83b1('0x2c')];}_0x4d878a[_0x83b1('0x5')]=_['map'](_0x309217,'name');_0x4d878a['query']=_[_0x83b1('0x3')](_0x317fc1[_0x83b1('0x2b')]);_0x4d878a[_0x83b1('0x9')]=_['intersection'](_0x4d878a[_0x83b1('0x5')],_0x4d878a[_0x83b1('0x2b')]);_0x4ca154[_0x83b1('0x2d')]=_[_0x83b1('0x2e')](_0x4d878a[_0x83b1('0x5')],this[_0x83b1('0x7')](_0x317fc1[_0x83b1('0x2b')][_0x83b1('0x7')]));_0x4ca154['attributes']=_0x4ca154[_0x83b1('0x2d')][_0x83b1('0x1f')]?_0x4ca154[_0x83b1('0x2d')]:_0x4d878a[_0x83b1('0x5')];if(!_0x317fc1['query'][_0x83b1('0x24')](_0x83b1('0x2f'))){_0x4ca154['limit']=this[_0x83b1('0x17')](_0x317fc1[_0x83b1('0x2b')][_0x83b1('0x17')]);_0x4ca154[_0x83b1('0x30')]=this[_0x83b1('0x30')](_0x317fc1[_0x83b1('0x2b')][_0x83b1('0x30')]);}_0x4ca154[_0x83b1('0x31')]=this['sort'](_0x317fc1['query'][_0x83b1('0x32')]);_0x4ca154[_0x83b1('0x33')]=this[_0x83b1('0x9')](_[_0x83b1('0x34')](_0x317fc1[_0x83b1('0x2b')],_0x4d878a[_0x83b1('0x9')]),_0x309217);if(_0x317fc1[_0x83b1('0x2b')][_0x83b1('0x35')]){var _0x25d51d=_0x309217;var _0x255746=_0x317fc1[_0x83b1('0x2b')][_0x83b1('0x35')];if(typeof _0x255746==='object'){_0x25d51d=_[_0x83b1('0x35')](_0x309217,function(_0x35e492){return _['includes'](_0x255746[_0x83b1('0x36')],_0x35e492['name']);});_0x255746=_0x255746[_0x83b1('0x37')];}_0x4ca154[_0x83b1('0x33')]=_[_0x83b1('0x38')](_0x4ca154[_0x83b1('0x33')],{'$or':_[_0x83b1('0x18')](_0x25d51d,function(_0x1ba1d5){if(_0x1ba1d5[_0x83b1('0xc')]!==_0x83b1('0x39')){if(_0x2511f6){return sequelize[_0x83b1('0x33')](sequelize['fn'](_0x83b1('0x3a'),sequelize[_0x83b1('0x1b')](_0x1ba1d5[_0x83b1('0x14')])),{'$like':sequelize['fn'](_0x83b1('0x3a'),'%'+_0x317fc1[_0x83b1('0x2b')][_0x83b1('0x35')]+'%')});}else{var _0x1703ca={};_0x1703ca[_0x1ba1d5['name']]={'$like':'%'+_0x317fc1[_0x83b1('0x2b')]['filter']+'%'};return _0x1703ca;}}})});}_0x4ca154=_[_0x83b1('0x38')]({},_0x4ca154,_0x317fc1[_0x83b1('0x3b')]);return _0x4ca154;};exports[_0x83b1('0x3c')]=function(_0x30bfaa){var _0x441427=[];if(_0x30bfaa[_0x83b1('0x3d')]){_0x441427['push']({'all':!![]});}else if(_0x30bfaa[_0x83b1('0x3c')]){if(Array['isArray'](_0x30bfaa[_0x83b1('0x3c')])){_0x441427=Object['keys'](_0x30bfaa[_0x83b1('0x3c')])[_0x83b1('0x18')](function(_0x5453d6){return parseIncludeModel(_0x30bfaa['include'][_0x5453d6]);});}else{var _0x4f4396=parseIncludeModel(_0x30bfaa[_0x83b1('0x3c')]);_0x441427['push'](_0x4f4396);}}return _0x441427;};exports[_0x83b1('0x3e')]=function(_0x4546d5){return _0x4546d5[_0x83b1('0x29')](/[%_^-]/g,function(_0x225d7c){return'\x5c'+_0x225d7c;});};
\ No newline at end of file