Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / components / parsers / qs.js
index 8075581..d695aa7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe4ff=['map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','unset','hasOwnProperty','^[+]?[0-9]*$','match','getFullTextValue','forEach','replace','push','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','isArray','limit','offset','sort'];(function(_0x34f702,_0x222471){var _0x5a339e=function(_0x3aebb4){while(--_0x3aebb4){_0x34f702['push'](_0x34f702['shift']());}};_0x5a339e(++_0x222471);}(_0xe4ff,0x1a3));var _0xfe4f=function(_0x3dd23c,_0x18c32f){_0x3dd23c=_0x3dd23c-0x0;var _0x520bf8=_0xe4ff[_0x3dd23c];return _0x520bf8;};'use strict';var _=require(_0xfe4f('0x0'));var sequelize=require(_0xfe4f('0x1'));var moment=require(_0xfe4f('0x2'));var LIMIT_VALUE=0xfa;exports[_0xfe4f('0x3')]=function(_0x47fff3){var _0x4732fe=null;if(_0x47fff3){_0x4732fe=_0x47fff3[_0xfe4f('0x4')](',');}return _0x4732fe;};exports[_0xfe4f('0x5')]=function(_0x11e1ae,_0x27ba60){var _0x1f1ffc={};if(!_[_0xfe4f('0x6')](_0x11e1ae)){_[_0xfe4f('0x7')](_0x11e1ae,function(_0x1a25eb,_0x519b41){try{if(_0x27ba60){var _0x1954ab=_[_0xfe4f('0x8')](_0x27ba60,{'name':_0x519b41})||{};if(_0x1954ab[_0xfe4f('0x9')]===_0xfe4f('0xa')&&_[_0xfe4f('0xb')](_0x1a25eb)){var _0x302a1c=JSON[_0xfe4f('0xc')](_0x1a25eb);var _0x84aef8={'$gte':moment(moment(_0x302a1c[_0xfe4f('0xd')])[_0xfe4f('0xe')](_0xfe4f('0xf')))['utc']()[_0xfe4f('0xe')](),'$lte':moment(moment(_0x302a1c[_0xfe4f('0x10')])[_0xfe4f('0xe')](_0xfe4f('0xf')))['utc']()['subtract'](0x1,'s')[_0xfe4f('0xe')]()};_0x1f1ffc[_0x519b41]=_0x84aef8;}else{_0x1f1ffc[_0x519b41]=_[_0xfe4f('0x11')](_0x1a25eb)?_0x1a25eb:JSON[_0xfe4f('0xc')](_0x1a25eb);}}else{_0x1f1ffc[_0x519b41]=_[_0xfe4f('0x11')](_0x1a25eb)?_0x1a25eb:JSON[_0xfe4f('0xc')](_0x1a25eb);}}catch(_0x13f63b){_0x1f1ffc[_0x519b41]=_0x1a25eb[_0xfe4f('0x4')](',');}});}return _0x1f1ffc;};exports[_0xfe4f('0x12')]=function(_0x481d0b){_0x481d0b=parseInt(_0x481d0b,0xa);if(!_0x481d0b||_0x481d0b<0x0){_0x481d0b=LIMIT_VALUE;}return _0x481d0b;};exports[_0xfe4f('0x13')]=function(_0x57106b){_0x57106b=parseInt(_0x57106b,0xa);if(!_0x57106b||_0x57106b<0x0){_0x57106b=0x0;}return _0x57106b;};exports[_0xfe4f('0x14')]=function(_0xd707c5){var _0x121d91,_0x54b4c0=null;if(_0xd707c5){_0x121d91=_0xd707c5[_0xfe4f('0x4')](',');_0x54b4c0=_[_0xfe4f('0x15')](_0x121d91,function(_0x41964a){if(_0x41964a[_0xfe4f('0x16')]('-')===0x0){return[_0x41964a===_0xfe4f('0x17')?sequelize[_0xfe4f('0x18')](sequelize[_0xfe4f('0x19')](_0xfe4f('0x17')),_0xfe4f('0x1a')):_0x41964a[_0xfe4f('0x1b')](0x1),'DESC'];}else{return[_0x41964a===_0xfe4f('0x17')?sequelize[_0xfe4f('0x18')](sequelize[_0xfe4f('0x19')](_0xfe4f('0x17')),_0xfe4f('0x1a')):_0x41964a,_0xfe4f('0x1c')];}});}return _0x54b4c0;};exports[_0xfe4f('0x1d')]=function(_0x16443a,_0x4e0189){if(_['isEmpty'](_0x16443a)){return _0x16443a;}if(_[_0xfe4f('0x11')](_0x16443a)){for(var _0x364f69=0x0;_0x364f69<_0x16443a[_0xfe4f('0x1e')];_0x364f69+=0x1){_0x16443a[_0x364f69]=this[_0xfe4f('0x1d')](_0x16443a[_0x364f69],_0x4e0189);}return _0x16443a;}if(!_['isObject'](_0x16443a)){return _0x16443a;}if(_['isString'](_0x4e0189)){_0x4e0189=[_0x4e0189];}if(!_['isArray'](_0x4e0189)){return _0x16443a;}for(var _0x24f570=0x0;_0x24f570<_0x4e0189[_0xfe4f('0x1e')];_0x24f570+=0x1){_[_0xfe4f('0x1f')](_0x16443a,_0x4e0189[_0x24f570]);}for(var _0x529b76 in _0x16443a){if(_0x16443a[_0xfe4f('0x20')](_0x529b76)){_0x16443a[_0x529b76]=this['omit'](_0x16443a[_0x529b76],_0x4e0189);}}return _0x16443a;};exports['isNumeric']=function(_0x15644b){return _0x15644b['match'](RegExp(_0xfe4f('0x21')))?!![]:![];};exports['isEmail']=function(_0x18aa57){return _0x18aa57[_0xfe4f('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xfe4f('0x23')]=function(_0x40f713){var _0x10c632=[];_0x40f713[_0xfe4f('0x4')](/[ ,]+/)[_0xfe4f('0x24')](function(_0x29eff8){_0x29eff8=_0x29eff8[_0xfe4f('0x25')](/([^:]")"+/g,'$1');_0x29eff8='+'+_0x29eff8+'*';if(_0x29eff8['includes']('@'))_0x29eff8='\x22'+_0x29eff8+'\x22';_0x10c632[_0xfe4f('0x26')](_0x29eff8);});return _0x10c632[_0xfe4f('0x27')]('\x20');};
\ No newline at end of file
+var _0x0faf=['value','where','merge','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','isEmpty','forOwn','type','isPlainObject','$gte','utc','$lte','format','YYYY-MM-DD','subtract','name','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','omit','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','query','$id','model','filters','intersection','attributes','fields','length','offset','order','pick','filter','object','columns'];(function(_0x17f96b,_0x76a64c){var _0x5c90d5=function(_0x141e85){while(--_0x141e85){_0x17f96b['push'](_0x17f96b['shift']());}};_0x5c90d5(++_0x76a64c);}(_0x0faf,0x132));var _0xf0fa=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0x0faf[_0x2f4d41];return _0x3b0bb2;};'use strict';var _=require(_0xf0fa('0x0'));var sequelize=require('sequelize');var moment=require(_0xf0fa('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b4763){var _0x2c6207=['ne'];try{var _0x35a260=JSON[_0xf0fa('0x2')](_0x1b4763);var _0xdc9ce3=Object[_0xf0fa('0x3')](_0x35a260)[0x0];return _0x2c6207[_0xf0fa('0x4')](_0xdc9ce3);}catch(_0x283f04){return![];}}function getOperatorValue(_0x5d9b58){var _0x3637a3=JSON[_0xf0fa('0x2')](_0x5d9b58);var _0x25b5c4=Object[_0xf0fa('0x3')](_0x3637a3)[0x0];var _0x2db1d9=_0x3637a3[_0x25b5c4];return{['$'+_0x25b5c4]:_0x2db1d9};}exports['fields']=function(_0x42f7fd){var _0x18db40=null;if(_0x42f7fd){_0x18db40=_0x42f7fd['split'](',');}return _0x18db40;};exports['filters']=function(_0x3bda51,_0x1e8cc0){var _0x25dfec={};if(!_[_0xf0fa('0x5')](_0x3bda51)){_[_0xf0fa('0x6')](_0x3bda51,function(_0x1151ea,_0x379ff6){try{if(_0x1e8cc0){var _0x20fd09=_['find'](_0x1e8cc0,{'name':_0x379ff6})||{};if(hasSequelizeOperator(_0x1151ea)){_0x25dfec[_0x379ff6]=getOperatorValue(_0x1151ea);}else if(_0x20fd09[_0xf0fa('0x7')]==='DATE'&&_[_0xf0fa('0x8')](_0x1151ea)){var _0x521034=JSON[_0xf0fa('0x2')](_0x1151ea);var _0x17326f={'$gte':moment(moment(_0x521034[_0xf0fa('0x9')])['format']('YYYY-MM-DD'))[_0xf0fa('0xa')]()['format'](),'$lte':moment(moment(_0x521034[_0xf0fa('0xb')])[_0xf0fa('0xc')](_0xf0fa('0xd')))[_0xf0fa('0xa')]()[_0xf0fa('0xe')](0x1,'s')[_0xf0fa('0xc')]()};_0x25dfec[_0x379ff6]=_0x17326f;}else if(_0x20fd09[_0xf0fa('0xf')]===_0xf0fa('0x10')){_0x25dfec[_0x379ff6]=_0x1151ea;}else{_0x25dfec[_0x379ff6]=_['isArray'](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}else{_0x25dfec[_0x379ff6]=_[_0xf0fa('0x11')](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}catch(_0x1d3c22){_0x25dfec[_0x379ff6]=_0x1151ea[_0xf0fa('0x12')](',');}});}return _0x25dfec;};exports[_0xf0fa('0x13')]=function(_0x5ba2eb){_0x5ba2eb=parseInt(_0x5ba2eb,0xa);if(!_0x5ba2eb||_0x5ba2eb<0x0){_0x5ba2eb=LIMIT_VALUE;}return _0x5ba2eb;};exports['offset']=function(_0x2f376d){_0x2f376d=parseInt(_0x2f376d,0xa);if(!_0x2f376d||_0x2f376d<0x0){_0x2f376d=0x0;}return _0x2f376d;};exports[_0xf0fa('0x14')]=function(_0x151d09){var _0x2385e2,_0x1a3620=null;if(_0x151d09){_0x2385e2=_0x151d09[_0xf0fa('0x12')](',');_0x1a3620=_[_0xf0fa('0x15')](_0x2385e2,function(_0x3de639){if(_0x3de639[_0xf0fa('0x16')]('-')===0x0){return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize['col'](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639[_0xf0fa('0x1a')](0x1),_0xf0fa('0x1b')];}else{return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize[_0xf0fa('0x1c')](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639,'ASC'];}});}return _0x1a3620;};exports[_0xf0fa('0x1d')]=function(_0x19e392,_0x56134e){if(_[_0xf0fa('0x5')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x11')](_0x19e392)){for(var _0x2efe88=0x0;_0x2efe88<_0x19e392['length'];_0x2efe88+=0x1){_0x19e392[_0x2efe88]=this[_0xf0fa('0x1d')](_0x19e392[_0x2efe88],_0x56134e);}return _0x19e392;}if(!_[_0xf0fa('0x1e')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x1f')](_0x56134e)){_0x56134e=[_0x56134e];}if(!_[_0xf0fa('0x11')](_0x56134e)){return _0x19e392;}for(var _0x4e6eef=0x0;_0x4e6eef<_0x56134e['length'];_0x4e6eef+=0x1){_[_0xf0fa('0x20')](_0x19e392,_0x56134e[_0x4e6eef]);}for(var _0x1c5eaf in _0x19e392){if(_0x19e392[_0xf0fa('0x21')](_0x1c5eaf)){_0x19e392[_0x1c5eaf]=this[_0xf0fa('0x1d')](_0x19e392[_0x1c5eaf],_0x56134e);}}return _0x19e392;};exports['isNumeric']=function(_0x4058d6){return _0x4058d6[_0xf0fa('0x22')](RegExp(_0xf0fa('0x23')))?!![]:![];};exports['isEmail']=function(_0x9ad0e3){return _0x9ad0e3['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf0fa('0x24')]=function(_0x1e3875){var _0x28e057=[];_0x1e3875['split'](/[ ,]+/)[_0xf0fa('0x25')](function(_0x33cc64){_0x33cc64=_0x33cc64[_0xf0fa('0x26')](/([^:]")"+/g,'$1');_0x33cc64='+'+_0x33cc64+'*';var _0x212986=/[ `!@#$%^&*()_\-?~]/;if(_0x33cc64[_0xf0fa('0x22')](_0x212986))_0x33cc64='\x22'+_0x33cc64+'\x22';_0x28e057[_0xf0fa('0x27')](_0x33cc64);});return _0x28e057['join']('\x20');};exports['getOptions']=function(_0x36173a,_0x255f9d,_0x485fe2){var _0x38cf8c={},_0x50e0bd={};if(_0x255f9d['query']['$id']){_0x255f9d[_0xf0fa('0x28')]['id']=_0x255f9d['query'][_0xf0fa('0x29')];delete _0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x29')];}_0x38cf8c[_0xf0fa('0x2a')]=_[_0xf0fa('0x15')](_0x36173a,_0xf0fa('0xf'));_0x38cf8c[_0xf0fa('0x28')]=_[_0xf0fa('0x3')](_0x255f9d['query']);_0x38cf8c[_0xf0fa('0x2b')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],_0x38cf8c['query']);_0x50e0bd[_0xf0fa('0x2d')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],this[_0xf0fa('0x2e')](_0x255f9d['query']['fields']));_0x50e0bd[_0xf0fa('0x2d')]=_0x50e0bd[_0xf0fa('0x2d')][_0xf0fa('0x2f')]?_0x50e0bd[_0xf0fa('0x2d')]:_0x38cf8c[_0xf0fa('0x2a')];if(!_0x255f9d['query']['hasOwnProperty']('nolimit')){_0x50e0bd['limit']=this[_0xf0fa('0x13')](_0x255f9d[_0xf0fa('0x28')]['limit']);_0x50e0bd['offset']=this[_0xf0fa('0x30')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x30')]);}_0x50e0bd[_0xf0fa('0x31')]=this[_0xf0fa('0x14')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x14')]);_0x50e0bd['where']=this['filters'](_[_0xf0fa('0x32')](_0x255f9d[_0xf0fa('0x28')],_0x38cf8c[_0xf0fa('0x2b')]),_0x36173a);if(_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]){var _0x1d0129=_0x36173a;var _0x5acfa4=_0x255f9d[_0xf0fa('0x28')]['filter'];if(typeof _0x5acfa4===_0xf0fa('0x34')){_0x1d0129=_[_0xf0fa('0x33')](_0x36173a,function(_0x6e1fd9){return _[_0xf0fa('0x4')](_0x5acfa4[_0xf0fa('0x35')],_0x6e1fd9[_0xf0fa('0xf')]);});_0x5acfa4=_0x5acfa4[_0xf0fa('0x36')];}_0x50e0bd[_0xf0fa('0x37')]=_[_0xf0fa('0x38')](_0x50e0bd['where'],{'$or':_['map'](_0x1d0129,function(_0x52221a){if(_0x52221a[_0xf0fa('0x7')]!==_0xf0fa('0x39')){if(_0x485fe2){return sequelize['where'](sequelize['fn'](_0xf0fa('0x3a'),sequelize[_0xf0fa('0x1c')](_0x52221a[_0xf0fa('0xf')])),{'$like':sequelize['fn'](_0xf0fa('0x3a'),'%'+_0x255f9d['query'][_0xf0fa('0x33')]+'%')});}else{var _0x1f3916={};_0x1f3916[_0x52221a[_0xf0fa('0xf')]]={'$like':'%'+_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]+'%'};return _0x1f3916;}}})});}_0x50e0bd=_[_0xf0fa('0x38')]({},_0x50e0bd,_0x255f9d[_0xf0fa('0x3b')]);return _0x50e0bd;};
\ No newline at end of file