Built motion from commit da617fac.|2.6.6
[motion2.git] / server / components / parsers / qs.js
index 4c2876b..d4fdc00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x038b=['isEmpty','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','join','query','$id','intersection','model','attributes','fields','nolimit','limit','order','where','pick','filters','filter','includes','columns','value','merge','lower','options','sequelize','moment','keys','split','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','sort','map','priority','cast','col','substr','DESC','unsigned','omit'];(function(_0xc010d4,_0x37768a){var _0x1c9a4b=function(_0x74e63a){while(--_0x74e63a){_0xc010d4['push'](_0xc010d4['shift']());}};_0x1c9a4b(++_0x37768a);}(_0x038b,0x114));var _0xb038=function(_0x1a995c,_0xc3fafc){_0x1a995c=_0x1a995c-0x0;var _0x5a41de=_0x038b[_0x1a995c];return _0x5a41de;};'use strict';var _=require('lodash');var sequelize=require(_0xb038('0x0'));var moment=require(_0xb038('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x449fef){var _0x5623c3=['ne'];try{var _0x3d7dfe=JSON['parse'](_0x449fef);var _0x23574d=Object[_0xb038('0x2')](_0x3d7dfe)[0x0];return _0x5623c3['includes'](_0x23574d);}catch(_0x3737b5){return![];}}function getOperatorValue(_0x11da3a){var _0x4fe092=JSON['parse'](_0x11da3a);var _0x2e3e64=Object[_0xb038('0x2')](_0x4fe092)[0x0];var _0x1534a9=_0x4fe092[_0x2e3e64];return{['$'+_0x2e3e64]:_0x1534a9};}exports['fields']=function(_0x48a4d7){var _0x462e8f=null;if(_0x48a4d7){_0x462e8f=_0x48a4d7[_0xb038('0x3')](',');}return _0x462e8f;};exports['filters']=function(_0x53bcc0,_0xe3d046){var _0x2d1ae5={};if(!_['isEmpty'](_0x53bcc0)){_[_0xb038('0x4')](_0x53bcc0,function(_0x162ae7,_0x3fc2c1){try{if(_0xe3d046){var _0x3368c1=_[_0xb038('0x5')](_0xe3d046,{'name':_0x3fc2c1})||{};if(hasSequelizeOperator(_0x162ae7)){_0x2d1ae5[_0x3fc2c1]=getOperatorValue(_0x162ae7);}else if(_0x3368c1[_0xb038('0x6')]===_0xb038('0x7')&&_[_0xb038('0x8')](_0x162ae7)){var _0x16e4a3=JSON[_0xb038('0x9')](_0x162ae7);var _0x60f332={'$gte':moment(moment(_0x16e4a3[_0xb038('0xa')])[_0xb038('0xb')](_0xb038('0xc')))[_0xb038('0xd')]()[_0xb038('0xb')](),'$lte':moment(moment(_0x16e4a3[_0xb038('0xe')])['format'](_0xb038('0xc')))[_0xb038('0xd')]()[_0xb038('0xf')](0x1,'s')[_0xb038('0xb')]()};_0x2d1ae5[_0x3fc2c1]=_0x60f332;}else if(_0x3368c1[_0xb038('0x10')]===_0xb038('0x11')){_0x2d1ae5[_0x3fc2c1]=_0x162ae7;}else{_0x2d1ae5[_0x3fc2c1]=_['isArray'](_0x162ae7)?_0x162ae7:JSON[_0xb038('0x9')](_0x162ae7);}}else{_0x2d1ae5[_0x3fc2c1]=_[_0xb038('0x12')](_0x162ae7)?_0x162ae7:JSON[_0xb038('0x9')](_0x162ae7);}}catch(_0x3b095a){_0x2d1ae5[_0x3fc2c1]=_0x162ae7['split'](',');}});}return _0x2d1ae5;};exports['limit']=function(_0x20cea2){_0x20cea2=parseInt(_0x20cea2,0xa);if(!_0x20cea2||_0x20cea2<0x0){_0x20cea2=LIMIT_VALUE;}return _0x20cea2;};exports[_0xb038('0x13')]=function(_0x3e06ef){_0x3e06ef=parseInt(_0x3e06ef,0xa);if(!_0x3e06ef||_0x3e06ef<0x0){_0x3e06ef=0x0;}return _0x3e06ef;};exports[_0xb038('0x14')]=function(_0x4fd2e8){var _0x222b84,_0x42c8ee=null;if(_0x4fd2e8){_0x222b84=_0x4fd2e8[_0xb038('0x3')](',');_0x42c8ee=_[_0xb038('0x15')](_0x222b84,function(_0xc6cd61){if(_0xc6cd61['indexOf']('-')===0x0){return[_0xc6cd61===_0xb038('0x16')?sequelize[_0xb038('0x17')](sequelize[_0xb038('0x18')](_0xb038('0x16')),'unsigned'):_0xc6cd61[_0xb038('0x19')](0x1),_0xb038('0x1a')];}else{return[_0xc6cd61==='priority'?sequelize[_0xb038('0x17')](sequelize[_0xb038('0x18')]('priority'),_0xb038('0x1b')):_0xc6cd61,'ASC'];}});}return _0x42c8ee;};exports[_0xb038('0x1c')]=function(_0x36eb5b,_0x27ff21){if(_[_0xb038('0x1d')](_0x36eb5b)){return _0x36eb5b;}if(_[_0xb038('0x12')](_0x36eb5b)){for(var _0xe4ceda=0x0;_0xe4ceda<_0x36eb5b[_0xb038('0x1e')];_0xe4ceda+=0x1){_0x36eb5b[_0xe4ceda]=this['omit'](_0x36eb5b[_0xe4ceda],_0x27ff21);}return _0x36eb5b;}if(!_[_0xb038('0x1f')](_0x36eb5b)){return _0x36eb5b;}if(_[_0xb038('0x20')](_0x27ff21)){_0x27ff21=[_0x27ff21];}if(!_[_0xb038('0x12')](_0x27ff21)){return _0x36eb5b;}for(var _0x5d18c8=0x0;_0x5d18c8<_0x27ff21[_0xb038('0x1e')];_0x5d18c8+=0x1){_[_0xb038('0x21')](_0x36eb5b,_0x27ff21[_0x5d18c8]);}for(var _0x1fa72d in _0x36eb5b){if(_0x36eb5b['hasOwnProperty'](_0x1fa72d)){_0x36eb5b[_0x1fa72d]=this[_0xb038('0x1c')](_0x36eb5b[_0x1fa72d],_0x27ff21);}}return _0x36eb5b;};exports[_0xb038('0x22')]=function(_0x28a6a9){return _0x28a6a9[_0xb038('0x23')](RegExp(_0xb038('0x24')))?!![]:![];};exports['isEmail']=function(_0x1783d4){return _0x1783d4[_0xb038('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xb038('0x25')]=function(_0x3464be){var _0x1abe23=[];_0x3464be[_0xb038('0x3')](/[ ,]+/)[_0xb038('0x26')](function(_0x3695aa){_0x3695aa=_0x3695aa[_0xb038('0x27')](/([^:]")"+/g,'$1');_0x3695aa='+'+_0x3695aa+'*';var _0x22fb2c=/[ `!@#$%^&*()_\-?~]/;if(_0x3695aa[_0xb038('0x23')](_0x22fb2c))_0x3695aa='\x22'+_0x3695aa+'\x22';_0x1abe23[_0xb038('0x28')](_0x3695aa);});return _0x1abe23[_0xb038('0x29')]('\x20');};exports['getOptions']=function(_0x1d807a,_0x598554,_0x908d1f){var _0x13bf20={},_0x495253={};if(_0x598554[_0xb038('0x2a')][_0xb038('0x2b')]){_0x598554[_0xb038('0x2a')]['id']=_0x598554[_0xb038('0x2a')][_0xb038('0x2b')];delete _0x598554[_0xb038('0x2a')][_0xb038('0x2b')];}_0x13bf20['model']=_[_0xb038('0x15')](_0x1d807a,_0xb038('0x10'));_0x13bf20[_0xb038('0x2a')]=_['keys'](_0x598554['query']);_0x13bf20['filters']=_[_0xb038('0x2c')](_0x13bf20[_0xb038('0x2d')],_0x13bf20[_0xb038('0x2a')]);_0x495253[_0xb038('0x2e')]=_[_0xb038('0x2c')](_0x13bf20[_0xb038('0x2d')],this['fields'](_0x598554[_0xb038('0x2a')][_0xb038('0x2f')]));_0x495253[_0xb038('0x2e')]=_0x495253[_0xb038('0x2e')]['length']?_0x495253[_0xb038('0x2e')]:_0x13bf20[_0xb038('0x2d')];if(!_0x598554['query']['hasOwnProperty'](_0xb038('0x30'))){_0x495253[_0xb038('0x31')]=this[_0xb038('0x31')](_0x598554[_0xb038('0x2a')][_0xb038('0x31')]);_0x495253['offset']=this[_0xb038('0x13')](_0x598554[_0xb038('0x2a')][_0xb038('0x13')]);}_0x495253[_0xb038('0x32')]=this['sort'](_0x598554[_0xb038('0x2a')][_0xb038('0x14')]);_0x495253[_0xb038('0x33')]=this['filters'](_[_0xb038('0x34')](_0x598554['query'],_0x13bf20[_0xb038('0x35')]),_0x1d807a);if(_0x598554[_0xb038('0x2a')][_0xb038('0x36')]){var _0x5ce40c=_0x1d807a;var _0x322ab1=_0x598554[_0xb038('0x2a')][_0xb038('0x36')];if(typeof _0x322ab1==='object'){_0x5ce40c=_[_0xb038('0x36')](_0x1d807a,function(_0xa5971a){return _[_0xb038('0x37')](_0x322ab1[_0xb038('0x38')],_0xa5971a['name']);});_0x322ab1=_0x322ab1[_0xb038('0x39')];}_0x495253[_0xb038('0x33')]=_[_0xb038('0x3a')](_0x495253[_0xb038('0x33')],{'$or':_['map'](_0x5ce40c,function(_0x19dc7b){if(_0x19dc7b[_0xb038('0x6')]!=='VIRTUAL'){if(_0x908d1f){return sequelize[_0xb038('0x33')](sequelize['fn'](_0xb038('0x3b'),sequelize[_0xb038('0x18')](_0x19dc7b['name'])),{'$like':sequelize['fn'](_0xb038('0x3b'),'%'+_0x598554[_0xb038('0x2a')]['filter']+'%')});}else{var _0x527eaa={};_0x527eaa[_0x19dc7b[_0xb038('0x10')]]={'$like':'%'+_0x598554[_0xb038('0x2a')][_0xb038('0x36')]+'%'};return _0x527eaa;}}})});}_0x495253=_[_0xb038('0x3a')]({},_0x495253,_0x598554[_0xb038('0x3c')]);return _0x495253;};
\ No newline at end of file
+var _0x5fc3=['YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','$id','query','model','keys','intersection','attributes','nolimit','offset','order','where','pick','filter','object','value','merge','lower','options','lodash','sequelize','parse','includes','fields','split','filters','isEmpty','find','type','$gte','format'];(function(_0x1166d0,_0x3efab0){var _0x74e247=function(_0x52d868){while(--_0x52d868){_0x1166d0['push'](_0x1166d0['shift']());}};_0x74e247(++_0x3efab0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x5fc3[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0x35fc('0x0'));var sequelize=require(_0x35fc('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x253d6e){var _0x2ac6da=['ne'];try{var _0x196bc2=JSON[_0x35fc('0x2')](_0x253d6e);var _0xb4f9ce=Object['keys'](_0x196bc2)[0x0];return _0x2ac6da[_0x35fc('0x3')](_0xb4f9ce);}catch(_0x1d5fec){return![];}}function getOperatorValue(_0x186a06){var _0x5b85ad=JSON['parse'](_0x186a06);var _0x19a0d1=Object['keys'](_0x5b85ad)[0x0];var _0x16e153=_0x5b85ad[_0x19a0d1];return{['$'+_0x19a0d1]:_0x16e153};}exports[_0x35fc('0x4')]=function(_0xc72d93){var _0x1e5f90=null;if(_0xc72d93){_0x1e5f90=_0xc72d93[_0x35fc('0x5')](',');}return _0x1e5f90;};exports[_0x35fc('0x6')]=function(_0x2051ab,_0x565f95){var _0x1083a9={};if(!_[_0x35fc('0x7')](_0x2051ab)){_['forOwn'](_0x2051ab,function(_0x471549,_0x33f491){try{if(_0x565f95){var _0x5021d4=_[_0x35fc('0x8')](_0x565f95,{'name':_0x33f491})||{};if(hasSequelizeOperator(_0x471549)){_0x1083a9[_0x33f491]=getOperatorValue(_0x471549);}else if(_0x5021d4[_0x35fc('0x9')]==='DATE'&&_['isPlainObject'](_0x471549)){var _0x409357=JSON['parse'](_0x471549);var _0x397738={'$gte':moment(moment(_0x409357[_0x35fc('0xa')])[_0x35fc('0xb')](_0x35fc('0xc')))[_0x35fc('0xd')]()['format'](),'$lte':moment(moment(_0x409357['$lte'])['format']('YYYY-MM-DD'))[_0x35fc('0xd')]()[_0x35fc('0xe')](0x1,'s')[_0x35fc('0xb')]()};_0x1083a9[_0x33f491]=_0x397738;}else if(_0x5021d4[_0x35fc('0xf')]===_0x35fc('0x10')){_0x1083a9[_0x33f491]=_0x471549;}else{_0x1083a9[_0x33f491]=_[_0x35fc('0x11')](_0x471549)?_0x471549:JSON['parse'](_0x471549);}}else{_0x1083a9[_0x33f491]=_[_0x35fc('0x11')](_0x471549)?_0x471549:JSON[_0x35fc('0x2')](_0x471549);}}catch(_0x553677){_0x1083a9[_0x33f491]=_0x471549[_0x35fc('0x5')](',');}});}return _0x1083a9;};exports[_0x35fc('0x12')]=function(_0x2e513b){_0x2e513b=parseInt(_0x2e513b,0xa);if(!_0x2e513b||_0x2e513b<0x0){_0x2e513b=LIMIT_VALUE;}return _0x2e513b;};exports['offset']=function(_0x1a86e9){_0x1a86e9=parseInt(_0x1a86e9,0xa);if(!_0x1a86e9||_0x1a86e9<0x0){_0x1a86e9=0x0;}return _0x1a86e9;};exports[_0x35fc('0x13')]=function(_0x465eb3){var _0x488234,_0x402cff=null;if(_0x465eb3){_0x488234=_0x465eb3[_0x35fc('0x5')](',');_0x402cff=_[_0x35fc('0x14')](_0x488234,function(_0x251a1f){if(_0x251a1f[_0x35fc('0x15')]('-')===0x0){return[_0x251a1f===_0x35fc('0x16')?sequelize[_0x35fc('0x17')](sequelize[_0x35fc('0x18')](_0x35fc('0x16')),_0x35fc('0x19')):_0x251a1f['substr'](0x1),_0x35fc('0x1a')];}else{return[_0x251a1f===_0x35fc('0x16')?sequelize[_0x35fc('0x17')](sequelize[_0x35fc('0x18')](_0x35fc('0x16')),'unsigned'):_0x251a1f,_0x35fc('0x1b')];}});}return _0x402cff;};exports[_0x35fc('0x1c')]=function(_0x561bf8,_0x265324){if(_[_0x35fc('0x7')](_0x561bf8)){return _0x561bf8;}if(_[_0x35fc('0x11')](_0x561bf8)){for(var _0x51cfec=0x0;_0x51cfec<_0x561bf8[_0x35fc('0x1d')];_0x51cfec+=0x1){_0x561bf8[_0x51cfec]=this['omit'](_0x561bf8[_0x51cfec],_0x265324);}return _0x561bf8;}if(!_[_0x35fc('0x1e')](_0x561bf8)){return _0x561bf8;}if(_[_0x35fc('0x1f')](_0x265324)){_0x265324=[_0x265324];}if(!_['isArray'](_0x265324)){return _0x561bf8;}for(var _0x519264=0x0;_0x519264<_0x265324[_0x35fc('0x1d')];_0x519264+=0x1){_['unset'](_0x561bf8,_0x265324[_0x519264]);}for(var _0x274208 in _0x561bf8){if(_0x561bf8[_0x35fc('0x20')](_0x274208)){_0x561bf8[_0x274208]=this['omit'](_0x561bf8[_0x274208],_0x265324);}}return _0x561bf8;};exports[_0x35fc('0x21')]=function(_0x645eac){return _0x645eac[_0x35fc('0x22')](RegExp(_0x35fc('0x23')))?!![]:![];};exports[_0x35fc('0x24')]=function(_0x134dfa){return _0x134dfa[_0x35fc('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x35fc('0x25')]=function(_0x54aedc){var _0x1cd1ae=[];_0x54aedc[_0x35fc('0x5')](/[ ,]+/)[_0x35fc('0x26')](function(_0x52acc5){_0x52acc5=_0x52acc5[_0x35fc('0x27')](/([^:]")"+/g,'$1');_0x52acc5='+'+_0x52acc5+'*';var _0x16f067=/[ `!@#$%^&*()_\-?~]/;if(_0x52acc5[_0x35fc('0x22')](_0x16f067))_0x52acc5='\x22'+_0x52acc5+'\x22';_0x1cd1ae[_0x35fc('0x28')](_0x52acc5);});return _0x1cd1ae[_0x35fc('0x29')]('\x20');};exports[_0x35fc('0x2a')]=function(_0x222ddb,_0x37b435,_0xf4dfab){var _0x127bfc={},_0x57072d={};if(_0x37b435['query'][_0x35fc('0x2b')]){_0x37b435['query']['id']=_0x37b435[_0x35fc('0x2c')][_0x35fc('0x2b')];delete _0x37b435[_0x35fc('0x2c')][_0x35fc('0x2b')];}_0x127bfc[_0x35fc('0x2d')]=_[_0x35fc('0x14')](_0x222ddb,'name');_0x127bfc[_0x35fc('0x2c')]=_[_0x35fc('0x2e')](_0x37b435[_0x35fc('0x2c')]);_0x127bfc[_0x35fc('0x6')]=_[_0x35fc('0x2f')](_0x127bfc[_0x35fc('0x2d')],_0x127bfc['query']);_0x57072d[_0x35fc('0x30')]=_[_0x35fc('0x2f')](_0x127bfc[_0x35fc('0x2d')],this['fields'](_0x37b435[_0x35fc('0x2c')]['fields']));_0x57072d[_0x35fc('0x30')]=_0x57072d[_0x35fc('0x30')][_0x35fc('0x1d')]?_0x57072d[_0x35fc('0x30')]:_0x127bfc['model'];if(!_0x37b435['query']['hasOwnProperty'](_0x35fc('0x31'))){_0x57072d['limit']=this[_0x35fc('0x12')](_0x37b435['query'][_0x35fc('0x12')]);_0x57072d[_0x35fc('0x32')]=this[_0x35fc('0x32')](_0x37b435[_0x35fc('0x2c')][_0x35fc('0x32')]);}_0x57072d[_0x35fc('0x33')]=this[_0x35fc('0x13')](_0x37b435['query'][_0x35fc('0x13')]);_0x57072d[_0x35fc('0x34')]=this['filters'](_[_0x35fc('0x35')](_0x37b435[_0x35fc('0x2c')],_0x127bfc[_0x35fc('0x6')]),_0x222ddb);if(_0x37b435[_0x35fc('0x2c')][_0x35fc('0x36')]){var _0x31d926=_0x222ddb;var _0x58f25c=_0x37b435[_0x35fc('0x2c')][_0x35fc('0x36')];if(typeof _0x58f25c===_0x35fc('0x37')){_0x31d926=_['filter'](_0x222ddb,function(_0x17821e){return _[_0x35fc('0x3')](_0x58f25c['columns'],_0x17821e[_0x35fc('0xf')]);});_0x58f25c=_0x58f25c[_0x35fc('0x38')];}_0x57072d[_0x35fc('0x34')]=_[_0x35fc('0x39')](_0x57072d[_0x35fc('0x34')],{'$or':_[_0x35fc('0x14')](_0x31d926,function(_0x211b70){if(_0x211b70[_0x35fc('0x9')]!=='VIRTUAL'){if(_0xf4dfab){return sequelize['where'](sequelize['fn'](_0x35fc('0x3a'),sequelize[_0x35fc('0x18')](_0x211b70['name'])),{'$like':sequelize['fn']('lower','%'+_0x37b435['query'][_0x35fc('0x36')]+'%')});}else{var _0x10f98b={};_0x10f98b[_0x211b70['name']]={'$like':'%'+_0x37b435[_0x35fc('0x2c')][_0x35fc('0x36')]+'%'};return _0x10f98b;}}})});}_0x57072d=_[_0x35fc('0x39')]({},_0x57072d,_0x37b435[_0x35fc('0x3b')]);return _0x57072d;};
\ No newline at end of file