Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / components / parsers / qs.js
index 882a3a7..eb9eaff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x832f=['^[+]?[0-9]*$','isEmail','getFullTextValue','split','forEach','push','query','$id','model','intersection','attributes','length','nolimit','order','where','filters','pick','merge','col','filter','lodash','moment','keys','includes','parse','fields','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','ASC','omit','isObject','isString','hasOwnProperty','isNumeric','match'];(function(_0x2a6501,_0x9c5a0e){var _0x34d3ae=function(_0x204c8b){while(--_0x204c8b){_0x2a6501['push'](_0x2a6501['shift']());}};_0x34d3ae(++_0x9c5a0e);}(_0x832f,0xb6));var _0xf832=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0x832f[_0x4327fe];return _0x138651;};'use strict';var _=require(_0xf832('0x0'));var sequelize=require('sequelize');var moment=require(_0xf832('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x41330f){var _0xc433b7=['ne'];try{var _0x1c8595=JSON['parse'](_0x41330f);var _0x2766d5=Object[_0xf832('0x2')](_0x1c8595)[0x0];return _0xc433b7[_0xf832('0x3')](_0x2766d5);}catch(_0x413029){return![];}}function getOperatorValue(_0x4266f8){var _0x151794=JSON[_0xf832('0x4')](_0x4266f8);var _0x3b7153=Object[_0xf832('0x2')](_0x151794)[0x0];var _0xe001bd=_0x151794[_0x3b7153];return{['$'+_0x3b7153]:_0xe001bd};}exports[_0xf832('0x5')]=function(_0x1aab83){var _0x2ee5dd=null;if(_0x1aab83){_0x2ee5dd=_0x1aab83['split'](',');}return _0x2ee5dd;};exports['filters']=function(_0x112fdb,_0x1b2248){var _0x90eab2={};if(!_[_0xf832('0x6')](_0x112fdb)){_['forOwn'](_0x112fdb,function(_0x40c5d3,_0x195a84){try{if(_0x1b2248){var _0x5ef394=_[_0xf832('0x7')](_0x1b2248,{'name':_0x195a84})||{};if(hasSequelizeOperator(_0x40c5d3)){_0x90eab2[_0x195a84]=getOperatorValue(_0x40c5d3);}else if(_0x5ef394[_0xf832('0x8')]===_0xf832('0x9')&&_[_0xf832('0xa')](_0x40c5d3)){var _0x5b391a=JSON[_0xf832('0x4')](_0x40c5d3);var _0x4255c5={'$gte':moment(moment(_0x5b391a[_0xf832('0xb')])[_0xf832('0xc')](_0xf832('0xd')))[_0xf832('0xe')]()['format'](),'$lte':moment(moment(_0x5b391a['$lte'])[_0xf832('0xc')]('YYYY-MM-DD'))[_0xf832('0xe')]()[_0xf832('0xf')](0x1,'s')[_0xf832('0xc')]()};_0x90eab2[_0x195a84]=_0x4255c5;}else if(_0x5ef394[_0xf832('0x10')]===_0xf832('0x11')){_0x90eab2[_0x195a84]=_0x40c5d3;}else{_0x90eab2[_0x195a84]=_[_0xf832('0x12')](_0x40c5d3)?_0x40c5d3:JSON[_0xf832('0x4')](_0x40c5d3);}}else{_0x90eab2[_0x195a84]=_['isArray'](_0x40c5d3)?_0x40c5d3:JSON[_0xf832('0x4')](_0x40c5d3);}}catch(_0x507148){_0x90eab2[_0x195a84]=_0x40c5d3['split'](',');}});}return _0x90eab2;};exports[_0xf832('0x13')]=function(_0x4c2a73){_0x4c2a73=parseInt(_0x4c2a73,0xa);if(!_0x4c2a73||_0x4c2a73<0x0){_0x4c2a73=LIMIT_VALUE;}return _0x4c2a73;};exports[_0xf832('0x14')]=function(_0x4ee01e){_0x4ee01e=parseInt(_0x4ee01e,0xa);if(!_0x4ee01e||_0x4ee01e<0x0){_0x4ee01e=0x0;}return _0x4ee01e;};exports[_0xf832('0x15')]=function(_0x4f3d5d){var _0x34d2d3,_0x8a08c7=null;if(_0x4f3d5d){_0x34d2d3=_0x4f3d5d['split'](',');_0x8a08c7=_[_0xf832('0x16')](_0x34d2d3,function(_0x47be7a){if(_0x47be7a[_0xf832('0x17')]('-')===0x0){return[_0x47be7a===_0xf832('0x18')?sequelize[_0xf832('0x19')](sequelize['col'](_0xf832('0x18')),_0xf832('0x1a')):_0x47be7a['substr'](0x1),'DESC'];}else{return[_0x47be7a===_0xf832('0x18')?sequelize['cast'](sequelize['col']('priority'),'unsigned'):_0x47be7a,_0xf832('0x1b')];}});}return _0x8a08c7;};exports[_0xf832('0x1c')]=function(_0x2047d1,_0x1b03b1){if(_[_0xf832('0x6')](_0x2047d1)){return _0x2047d1;}if(_[_0xf832('0x12')](_0x2047d1)){for(var _0x4f91de=0x0;_0x4f91de<_0x2047d1['length'];_0x4f91de+=0x1){_0x2047d1[_0x4f91de]=this['omit'](_0x2047d1[_0x4f91de],_0x1b03b1);}return _0x2047d1;}if(!_[_0xf832('0x1d')](_0x2047d1)){return _0x2047d1;}if(_[_0xf832('0x1e')](_0x1b03b1)){_0x1b03b1=[_0x1b03b1];}if(!_[_0xf832('0x12')](_0x1b03b1)){return _0x2047d1;}for(var _0x52af07=0x0;_0x52af07<_0x1b03b1['length'];_0x52af07+=0x1){_['unset'](_0x2047d1,_0x1b03b1[_0x52af07]);}for(var _0x41c307 in _0x2047d1){if(_0x2047d1[_0xf832('0x1f')](_0x41c307)){_0x2047d1[_0x41c307]=this[_0xf832('0x1c')](_0x2047d1[_0x41c307],_0x1b03b1);}}return _0x2047d1;};exports[_0xf832('0x20')]=function(_0x198bfa){return _0x198bfa[_0xf832('0x21')](RegExp(_0xf832('0x22')))?!![]:![];};exports[_0xf832('0x23')]=function(_0x348eec){return _0x348eec[_0xf832('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xf832('0x24')]=function(_0x54f3b6){var _0x3b7dbf=[];_0x54f3b6[_0xf832('0x25')](/[ ,]+/)[_0xf832('0x26')](function(_0x476bbc){_0x476bbc=_0x476bbc['replace'](/([^:]")"+/g,'$1');_0x476bbc='+'+_0x476bbc+'*';if(_0x476bbc[_0xf832('0x3')]('@'))_0x476bbc='\x22'+_0x476bbc+'\x22';_0x3b7dbf[_0xf832('0x27')](_0x476bbc);});return _0x3b7dbf['join']('\x20');};exports['getOptions']=function(_0x787012,_0x430e5e,_0x40e370){var _0x3e649e={},_0x4c8d33={};if(_0x430e5e[_0xf832('0x28')][_0xf832('0x29')]){_0x430e5e[_0xf832('0x28')]['id']=_0x430e5e['query']['$id'];delete _0x430e5e['query'][_0xf832('0x29')];}_0x3e649e[_0xf832('0x2a')]=_[_0xf832('0x16')](_0x787012,_0xf832('0x10'));_0x3e649e[_0xf832('0x28')]=_[_0xf832('0x2')](_0x430e5e[_0xf832('0x28')]);_0x3e649e['filters']=_['intersection'](_0x3e649e[_0xf832('0x2a')],_0x3e649e[_0xf832('0x28')]);_0x4c8d33['attributes']=_[_0xf832('0x2b')](_0x3e649e[_0xf832('0x2a')],this[_0xf832('0x5')](_0x430e5e['query']['fields']));_0x4c8d33[_0xf832('0x2c')]=_0x4c8d33[_0xf832('0x2c')][_0xf832('0x2d')]?_0x4c8d33[_0xf832('0x2c')]:_0x3e649e[_0xf832('0x2a')];if(!_0x430e5e[_0xf832('0x28')][_0xf832('0x1f')](_0xf832('0x2e'))){_0x4c8d33['limit']=this[_0xf832('0x13')](_0x430e5e[_0xf832('0x28')][_0xf832('0x13')]);_0x4c8d33['offset']=this[_0xf832('0x14')](_0x430e5e[_0xf832('0x28')][_0xf832('0x14')]);}_0x4c8d33[_0xf832('0x2f')]=this[_0xf832('0x15')](_0x430e5e['query'][_0xf832('0x15')]);_0x4c8d33[_0xf832('0x30')]=this[_0xf832('0x31')](_[_0xf832('0x32')](_0x430e5e[_0xf832('0x28')],_0x3e649e['filters']),_0x787012);if(_0x430e5e[_0xf832('0x28')]['filter']){_0x4c8d33['where']=_[_0xf832('0x33')](_0x4c8d33[_0xf832('0x30')],{'$or':_[_0xf832('0x16')](_0x787012,function(_0x4fa2a4){if(_0x4fa2a4[_0xf832('0x8')]!=='VIRTUAL'){if(_0x40e370){return sequelize['where'](sequelize['fn']('lower',sequelize[_0xf832('0x34')](_0x4fa2a4[_0xf832('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x430e5e['query'][_0xf832('0x35')]+'%')});}else{var _0x82fc1c={};_0x82fc1c[_0x4fa2a4['name']]={'$like':'%'+_0x430e5e[_0xf832('0x28')][_0xf832('0x35')]+'%'};return _0x82fc1c;}}})});}_0x4c8d33=_['merge']({},_0x4c8d33,_0x430e5e['options']);return _0x4c8d33;};
\ No newline at end of file
+var _0x34af=['intersection','attributes','nolimit','offset','where','pick','filter','object','includes','value','merge','VIRTUAL','lower','options','push','include','lodash','sequelize','moment','../../mysqldb','parse','keys','model','raw','fields','isEmpty','type','DATE','$gte','format','YYYY-MM-DD','utc','subtract','name','isArray','limit','sort','split','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','getOptions','query','$id','filters'];(function(_0x889daa,_0x22527c){var _0x267d0b=function(_0x33af1e){while(--_0x33af1e){_0x889daa['push'](_0x889daa['shift']());}};_0x267d0b(++_0x22527c);}(_0x34af,0x18a));var _0xf34a=function(_0x3268eb,_0x978d){_0x3268eb=_0x3268eb-0x0;var _0x5c8671=_0x34af[_0x3268eb];return _0x5c8671;};'use strict';var _=require(_0xf34a('0x0'));var sequelize=require(_0xf34a('0x1'));var moment=require(_0xf34a('0x2'));var db=require(_0xf34a('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x46faf4){var _0x2b9d0e=['ne'];try{var _0x13e438=JSON[_0xf34a('0x4')](_0x46faf4);var _0x2628dd=Object['keys'](_0x13e438)[0x0];return _0x2b9d0e['includes'](_0x2628dd);}catch(_0xe0e643){return![];}}function getOperatorValue(_0x509e73){var _0x3f72fd=JSON[_0xf34a('0x4')](_0x509e73);var _0x3431da=Object[_0xf34a('0x5')](_0x3f72fd)[0x0];var _0x29cbe8=_0x3f72fd[_0x3431da];return{['$'+_0x3431da]:_0x29cbe8};}function parseIncludeModel(_0x4d751c){var _0x1254ab=JSON[_0xf34a('0x4')](_0x4d751c);return{'model':db[_0x1254ab[_0xf34a('0x6')]],'as':_0x1254ab['alias'],'attributes':_0x1254ab['fields'],'raw':_0x1254ab[_0xf34a('0x7')]};}exports[_0xf34a('0x8')]=function(_0x20f48f){var _0x362d58=null;if(_0x20f48f){_0x362d58=_0x20f48f['split'](',');}return _0x362d58;};exports['filters']=function(_0x51d289,_0x59268e){var _0x4c3809={};if(!_[_0xf34a('0x9')](_0x51d289)){_['forOwn'](_0x51d289,function(_0x3f2bd6,_0x404eac){try{if(_0x59268e){var _0x4138a1=_['find'](_0x59268e,{'name':_0x404eac})||{};if(hasSequelizeOperator(_0x3f2bd6)){_0x4c3809[_0x404eac]=getOperatorValue(_0x3f2bd6);}else if(_0x4138a1[_0xf34a('0xa')]===_0xf34a('0xb')&&_['isPlainObject'](_0x3f2bd6)){var _0xd3c703=JSON[_0xf34a('0x4')](_0x3f2bd6);var _0xffa111={'$gte':moment(moment(_0xd3c703[_0xf34a('0xc')])[_0xf34a('0xd')](_0xf34a('0xe')))[_0xf34a('0xf')]()[_0xf34a('0xd')](),'$lte':moment(moment(_0xd3c703['$lte'])['format']('YYYY-MM-DD'))[_0xf34a('0xf')]()[_0xf34a('0x10')](0x1,'s')[_0xf34a('0xd')]()};_0x4c3809[_0x404eac]=_0xffa111;}else if(_0x4138a1[_0xf34a('0x11')]==='uniqueid'){_0x4c3809[_0x404eac]=_0x3f2bd6;}else{_0x4c3809[_0x404eac]=_[_0xf34a('0x12')](_0x3f2bd6)?_0x3f2bd6:JSON[_0xf34a('0x4')](_0x3f2bd6);}}else{_0x4c3809[_0x404eac]=_[_0xf34a('0x12')](_0x3f2bd6)?_0x3f2bd6:JSON[_0xf34a('0x4')](_0x3f2bd6);}}catch(_0x2ec3d0){_0x4c3809[_0x404eac]=_0x3f2bd6['split'](',');}});}return _0x4c3809;};exports[_0xf34a('0x13')]=function(_0x4dbbf9){_0x4dbbf9=parseInt(_0x4dbbf9,0xa);if(!_0x4dbbf9||_0x4dbbf9<0x0){_0x4dbbf9=LIMIT_VALUE;}return _0x4dbbf9;};exports['offset']=function(_0x4594d3){_0x4594d3=parseInt(_0x4594d3,0xa);if(!_0x4594d3||_0x4594d3<0x0){_0x4594d3=0x0;}return _0x4594d3;};exports[_0xf34a('0x14')]=function(_0x358edf){var _0x5ececc,_0x10e2ff=null;if(_0x358edf){_0x5ececc=_0x358edf[_0xf34a('0x15')](',');_0x10e2ff=_[_0xf34a('0x16')](_0x5ececc,function(_0xc8225a){if(_0xc8225a[_0xf34a('0x17')]('-')===0x0){return[_0xc8225a===_0xf34a('0x18')?sequelize['cast'](sequelize[_0xf34a('0x19')]('priority'),_0xf34a('0x1a')):_0xc8225a[_0xf34a('0x1b')](0x1),_0xf34a('0x1c')];}else{return[_0xc8225a===_0xf34a('0x18')?sequelize[_0xf34a('0x1d')](sequelize[_0xf34a('0x19')](_0xf34a('0x18')),'unsigned'):_0xc8225a,_0xf34a('0x1e')];}});}return _0x10e2ff;};exports['omit']=function(_0x18d936,_0xa6c0b2){if(_[_0xf34a('0x9')](_0x18d936)){return _0x18d936;}if(_[_0xf34a('0x12')](_0x18d936)){for(var _0x43ef3d=0x0;_0x43ef3d<_0x18d936[_0xf34a('0x1f')];_0x43ef3d+=0x1){_0x18d936[_0x43ef3d]=this['omit'](_0x18d936[_0x43ef3d],_0xa6c0b2);}return _0x18d936;}if(!_[_0xf34a('0x20')](_0x18d936)){return _0x18d936;}if(_[_0xf34a('0x21')](_0xa6c0b2)){_0xa6c0b2=[_0xa6c0b2];}if(!_[_0xf34a('0x12')](_0xa6c0b2)){return _0x18d936;}for(var _0x140d9a=0x0;_0x140d9a<_0xa6c0b2['length'];_0x140d9a+=0x1){_[_0xf34a('0x22')](_0x18d936,_0xa6c0b2[_0x140d9a]);}for(var _0x23465e in _0x18d936){if(_0x18d936[_0xf34a('0x23')](_0x23465e)){_0x18d936[_0x23465e]=this['omit'](_0x18d936[_0x23465e],_0xa6c0b2);}}return _0x18d936;};exports[_0xf34a('0x24')]=function(_0x5e3b35){return _0x5e3b35[_0xf34a('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xf34a('0x26')]=function(_0x1fa2a3){return _0x1fa2a3['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf34a('0x27')]=function(_0x1c609e,_0x2b955c){var _0x4bdb13=[];var _0x24ae63=/[ `!@#$%^&*()_\-?~]/;var _0x4d056f=_0x2b955c?_0xf34a('0x28'):_0xf34a('0x29');_0x1c609e[_0xf34a('0x15')](/[ ,]+/)['forEach'](function(_0x39b377){_0x39b377=_0x39b377[_0xf34a('0x2a')](/([^:]")"+/g,'$1');_0x39b377='+'+_0x39b377+'*';var _0x3dc5ed=_0x39b377['match'](_0x24ae63);if(_0x3dc5ed){_0x39b377='\x22'+_0x39b377+'\x22';}_0x4bdb13['push'](_0x39b377);});_0x4d056f=_0x4d056f[_0xf34a('0x2a')]('{EXPR}',_0x4bdb13['join']('\x20'));return _0x4d056f;};exports[_0xf34a('0x2b')]=function(_0x821dd0,_0x1fc999,_0x1e3f44){var _0x903f64={},_0x1d20d7={};if(_0x1fc999[_0xf34a('0x2c')]['$id']){_0x1fc999[_0xf34a('0x2c')]['id']=_0x1fc999[_0xf34a('0x2c')][_0xf34a('0x2d')];delete _0x1fc999[_0xf34a('0x2c')][_0xf34a('0x2d')];}_0x903f64[_0xf34a('0x6')]=_[_0xf34a('0x16')](_0x821dd0,_0xf34a('0x11'));_0x903f64[_0xf34a('0x2c')]=_[_0xf34a('0x5')](_0x1fc999[_0xf34a('0x2c')]);_0x903f64[_0xf34a('0x2e')]=_[_0xf34a('0x2f')](_0x903f64[_0xf34a('0x6')],_0x903f64['query']);_0x1d20d7[_0xf34a('0x30')]=_[_0xf34a('0x2f')](_0x903f64[_0xf34a('0x6')],this[_0xf34a('0x8')](_0x1fc999['query'][_0xf34a('0x8')]));_0x1d20d7[_0xf34a('0x30')]=_0x1d20d7['attributes'][_0xf34a('0x1f')]?_0x1d20d7[_0xf34a('0x30')]:_0x903f64[_0xf34a('0x6')];if(!_0x1fc999['query'][_0xf34a('0x23')](_0xf34a('0x31'))){_0x1d20d7[_0xf34a('0x13')]=this[_0xf34a('0x13')](_0x1fc999['query'][_0xf34a('0x13')]);_0x1d20d7['offset']=this['offset'](_0x1fc999[_0xf34a('0x2c')][_0xf34a('0x32')]);}_0x1d20d7['order']=this[_0xf34a('0x14')](_0x1fc999[_0xf34a('0x2c')]['sort']);_0x1d20d7[_0xf34a('0x33')]=this[_0xf34a('0x2e')](_[_0xf34a('0x34')](_0x1fc999[_0xf34a('0x2c')],_0x903f64['filters']),_0x821dd0);if(_0x1fc999[_0xf34a('0x2c')][_0xf34a('0x35')]){var _0x312cdd=_0x821dd0;var _0x28bbed=_0x1fc999[_0xf34a('0x2c')][_0xf34a('0x35')];if(typeof _0x28bbed===_0xf34a('0x36')){_0x312cdd=_[_0xf34a('0x35')](_0x821dd0,function(_0x5b4010){return _[_0xf34a('0x37')](_0x28bbed['columns'],_0x5b4010[_0xf34a('0x11')]);});_0x28bbed=_0x28bbed[_0xf34a('0x38')];}_0x1d20d7[_0xf34a('0x33')]=_[_0xf34a('0x39')](_0x1d20d7[_0xf34a('0x33')],{'$or':_[_0xf34a('0x16')](_0x312cdd,function(_0x64d238){if(_0x64d238['type']!==_0xf34a('0x3a')){if(_0x1e3f44){return sequelize[_0xf34a('0x33')](sequelize['fn'](_0xf34a('0x3b'),sequelize[_0xf34a('0x19')](_0x64d238[_0xf34a('0x11')])),{'$like':sequelize['fn'](_0xf34a('0x3b'),'%'+_0x1fc999['query'][_0xf34a('0x35')]+'%')});}else{var _0x286fb7={};_0x286fb7[_0x64d238[_0xf34a('0x11')]]={'$like':'%'+_0x1fc999[_0xf34a('0x2c')][_0xf34a('0x35')]+'%'};return _0x286fb7;}}})});}_0x1d20d7=_[_0xf34a('0x39')]({},_0x1d20d7,_0x1fc999[_0xf34a('0x3c')]);return _0x1d20d7;};exports['include']=function(_0xb9d50b){var _0x1437cf=[];if(_0xb9d50b['includeAll']){_0x1437cf[_0xf34a('0x3d')]({'all':!![]});}else if(_0xb9d50b[_0xf34a('0x3e')]){if(Array['isArray'](_0xb9d50b[_0xf34a('0x3e')])){_0x1437cf=Object['keys'](_0xb9d50b[_0xf34a('0x3e')])['map'](function(_0x5cf550){return parseIncludeModel(_0xb9d50b[_0xf34a('0x3e')][_0x5cf550]);});}else{var _0x342dc9=parseIncludeModel(_0xb9d50b[_0xf34a('0x3e')]);_0x1437cf[_0xf34a('0x3d')](_0x342dc9);}}return _0x1437cf;};
\ No newline at end of file