Built motion from commit dc14b02d.|2.6.27
[motion2.git] / server / components / parsers / qs.js
index 9d2ad19..144170e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x052a=['keys','model','alias','raw','split','filters','isEmpty','forOwn','find','DATE','format','YYYY-MM-DD','utc','uniqueid','isArray','offset','map','indexOf','col','priority','unsigned','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','join','getOptions','$id','query','name','attributes','fields','nolimit','limit','sort','where','pick','filter','object','columns','merge','lower','options','include','includeAll','push','sequelize','moment','../../mysqldb','parse','includes'];(function(_0x17798a,_0x5be977){var _0x5b08ac=function(_0x1b22de){while(--_0x1b22de){_0x17798a['push'](_0x17798a['shift']());}};_0x5b08ac(++_0x5be977);}(_0x052a,0x16f));var _0xa052=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x052a[_0x5caf7e];return _0x5c3435;};'use strict';var _=require('lodash');var sequelize=require(_0xa052('0x0'));var moment=require(_0xa052('0x1'));var db=require(_0xa052('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x19d4e6){var _0x348585=['ne'];try{var _0x192c9a=JSON[_0xa052('0x3')](_0x19d4e6);var _0x3d695a=Object['keys'](_0x192c9a)[0x0];return _0x348585[_0xa052('0x4')](_0x3d695a);}catch(_0x174ba5){return![];}}function getOperatorValue(_0x2cddac){var _0x36190b=JSON[_0xa052('0x3')](_0x2cddac);var _0x4daf61=Object[_0xa052('0x5')](_0x36190b)[0x0];var _0x4b0273=_0x36190b[_0x4daf61];return{['$'+_0x4daf61]:_0x4b0273};}function parseIncludeModel(_0x40814b){var _0x19c8ac=JSON[_0xa052('0x3')](_0x40814b);return{'model':db[_0x19c8ac[_0xa052('0x6')]],'as':_0x19c8ac[_0xa052('0x7')],'attributes':_0x19c8ac['fields'],'raw':_0x19c8ac[_0xa052('0x8')]};}exports['fields']=function(_0x185d83){var _0x1bf4c1=null;if(_0x185d83){_0x1bf4c1=_0x185d83[_0xa052('0x9')](',');}return _0x1bf4c1;};exports[_0xa052('0xa')]=function(_0x36b465,_0x2365b4){var _0x4231bd={};if(!_[_0xa052('0xb')](_0x36b465)){_[_0xa052('0xc')](_0x36b465,function(_0x1ef6e3,_0x5a8931){try{if(_0x2365b4){var _0x5438cc=_[_0xa052('0xd')](_0x2365b4,{'name':_0x5a8931})||{};if(hasSequelizeOperator(_0x1ef6e3)){_0x4231bd[_0x5a8931]=getOperatorValue(_0x1ef6e3);}else if(_0x5438cc['type']===_0xa052('0xe')&&_['isPlainObject'](_0x1ef6e3)){var _0x291709=JSON['parse'](_0x1ef6e3);var _0x2387d0={'$gte':moment(moment(_0x291709['$gte'])[_0xa052('0xf')](_0xa052('0x10')))[_0xa052('0x11')]()['format'](),'$lte':moment(moment(_0x291709['$lte'])[_0xa052('0xf')](_0xa052('0x10')))[_0xa052('0x11')]()['subtract'](0x1,'s')[_0xa052('0xf')]()};_0x4231bd[_0x5a8931]=_0x2387d0;}else if(_0x5438cc['name']===_0xa052('0x12')){_0x4231bd[_0x5a8931]=_0x1ef6e3;}else{_0x4231bd[_0x5a8931]=_[_0xa052('0x13')](_0x1ef6e3)?_0x1ef6e3:JSON[_0xa052('0x3')](_0x1ef6e3);}}else{_0x4231bd[_0x5a8931]=_[_0xa052('0x13')](_0x1ef6e3)?_0x1ef6e3:JSON['parse'](_0x1ef6e3);}}catch(_0x371bd2){_0x4231bd[_0x5a8931]=_0x1ef6e3[_0xa052('0x9')](',');}});}return _0x4231bd;};exports['limit']=function(_0x1913ec){_0x1913ec=parseInt(_0x1913ec,0xa);if(!_0x1913ec||_0x1913ec<0x0){_0x1913ec=LIMIT_VALUE;}return _0x1913ec;};exports[_0xa052('0x14')]=function(_0x39b104){_0x39b104=parseInt(_0x39b104,0xa);if(!_0x39b104||_0x39b104<0x0){_0x39b104=0x0;}return _0x39b104;};exports['sort']=function(_0x1ba059){var _0xf03c6d,_0x5d3bea=null;if(_0x1ba059){_0xf03c6d=_0x1ba059[_0xa052('0x9')](',');_0x5d3bea=_[_0xa052('0x15')](_0xf03c6d,function(_0x45a66a){if(_0x45a66a[_0xa052('0x16')]('-')===0x0){return[_0x45a66a==='priority'?sequelize['cast'](sequelize[_0xa052('0x17')](_0xa052('0x18')),_0xa052('0x19')):_0x45a66a['substr'](0x1),'DESC'];}else{return[_0x45a66a===_0xa052('0x18')?sequelize[_0xa052('0x1a')](sequelize[_0xa052('0x17')](_0xa052('0x18')),_0xa052('0x19')):_0x45a66a,_0xa052('0x1b')];}});}return _0x5d3bea;};exports[_0xa052('0x1c')]=function(_0x21cca2,_0x541e4f){if(_[_0xa052('0xb')](_0x21cca2)){return _0x21cca2;}if(_['isArray'](_0x21cca2)){for(var _0x3cc544=0x0;_0x3cc544<_0x21cca2[_0xa052('0x1d')];_0x3cc544+=0x1){_0x21cca2[_0x3cc544]=this['omit'](_0x21cca2[_0x3cc544],_0x541e4f);}return _0x21cca2;}if(!_[_0xa052('0x1e')](_0x21cca2)){return _0x21cca2;}if(_[_0xa052('0x1f')](_0x541e4f)){_0x541e4f=[_0x541e4f];}if(!_[_0xa052('0x13')](_0x541e4f)){return _0x21cca2;}for(var _0x218696=0x0;_0x218696<_0x541e4f['length'];_0x218696+=0x1){_[_0xa052('0x20')](_0x21cca2,_0x541e4f[_0x218696]);}for(var _0x432d8a in _0x21cca2){if(_0x21cca2[_0xa052('0x21')](_0x432d8a)){_0x21cca2[_0x432d8a]=this['omit'](_0x21cca2[_0x432d8a],_0x541e4f);}}return _0x21cca2;};exports[_0xa052('0x22')]=function(_0x57bc66){return _0x57bc66[_0xa052('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa052('0x24')]=function(_0x4ddee7){return _0x4ddee7[_0xa052('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xa052('0x25')]=function(_0x1ee468,_0xb3c08e){var _0x39aff7=[];var _0x1b836e=/[ `!@#$%^&*()_\-?~]/;var _0x1abfbc=_0xb3c08e?_0xa052('0x26'):_0xa052('0x27');_0x1ee468[_0xa052('0x9')](/[ ,]+/)['forEach'](function(_0x45f7a2){_0x45f7a2=_0x45f7a2[_0xa052('0x28')](/([^:]")"+/g,'$1');_0x45f7a2='+'+_0x45f7a2+'*';var _0x6319a1=_0x45f7a2[_0xa052('0x23')](_0x1b836e);if(_0x6319a1){_0x45f7a2='\x22'+_0x45f7a2+'\x22';}_0x39aff7['push'](_0x45f7a2);});_0x1abfbc=_0x1abfbc[_0xa052('0x28')](_0xa052('0x27'),_0x39aff7[_0xa052('0x29')]('\x20'));return _0x1abfbc;};exports[_0xa052('0x2a')]=function(_0x2ce27e,_0x47a332,_0x1622f6){var _0x2471c7={},_0x3a062c={};if(_0x47a332['query'][_0xa052('0x2b')]){_0x47a332[_0xa052('0x2c')]['id']=_0x47a332[_0xa052('0x2c')]['$id'];delete _0x47a332[_0xa052('0x2c')][_0xa052('0x2b')];}_0x2471c7[_0xa052('0x6')]=_[_0xa052('0x15')](_0x2ce27e,_0xa052('0x2d'));_0x2471c7['query']=_[_0xa052('0x5')](_0x47a332[_0xa052('0x2c')]);_0x2471c7[_0xa052('0xa')]=_['intersection'](_0x2471c7[_0xa052('0x6')],_0x2471c7[_0xa052('0x2c')]);_0x3a062c[_0xa052('0x2e')]=_['intersection'](_0x2471c7[_0xa052('0x6')],this[_0xa052('0x2f')](_0x47a332[_0xa052('0x2c')]['fields']));_0x3a062c[_0xa052('0x2e')]=_0x3a062c['attributes'][_0xa052('0x1d')]?_0x3a062c[_0xa052('0x2e')]:_0x2471c7['model'];if(!_0x47a332[_0xa052('0x2c')][_0xa052('0x21')](_0xa052('0x30'))){_0x3a062c[_0xa052('0x31')]=this[_0xa052('0x31')](_0x47a332[_0xa052('0x2c')][_0xa052('0x31')]);_0x3a062c[_0xa052('0x14')]=this[_0xa052('0x14')](_0x47a332['query']['offset']);}_0x3a062c['order']=this['sort'](_0x47a332[_0xa052('0x2c')][_0xa052('0x32')]);_0x3a062c[_0xa052('0x33')]=this['filters'](_[_0xa052('0x34')](_0x47a332[_0xa052('0x2c')],_0x2471c7[_0xa052('0xa')]),_0x2ce27e);if(_0x47a332['query'][_0xa052('0x35')]){var _0xe32945=_0x2ce27e;var _0x4c491e=_0x47a332[_0xa052('0x2c')][_0xa052('0x35')];if(typeof _0x4c491e===_0xa052('0x36')){_0xe32945=_[_0xa052('0x35')](_0x2ce27e,function(_0x40e461){return _[_0xa052('0x4')](_0x4c491e[_0xa052('0x37')],_0x40e461[_0xa052('0x2d')]);});_0x4c491e=_0x4c491e['value'];}_0x3a062c[_0xa052('0x33')]=_[_0xa052('0x38')](_0x3a062c['where'],{'$or':_['map'](_0xe32945,function(_0x2de2bb){if(_0x2de2bb['type']!=='VIRTUAL'){if(_0x1622f6){return sequelize['where'](sequelize['fn'](_0xa052('0x39'),sequelize[_0xa052('0x17')](_0x2de2bb['name'])),{'$like':sequelize['fn'](_0xa052('0x39'),'%'+_0x47a332[_0xa052('0x2c')]['filter']+'%')});}else{var _0x340233={};_0x340233[_0x2de2bb[_0xa052('0x2d')]]={'$like':'%'+_0x47a332['query'][_0xa052('0x35')]+'%'};return _0x340233;}}})});}_0x3a062c=_[_0xa052('0x38')]({},_0x3a062c,_0x47a332[_0xa052('0x3a')]);return _0x3a062c;};exports[_0xa052('0x3b')]=function(_0x527215){var _0xcc6ac7=[];if(_0x527215[_0xa052('0x3c')]){_0xcc6ac7[_0xa052('0x3d')]({'all':!![]});}else if(_0x527215[_0xa052('0x3b')]){if(Array[_0xa052('0x13')](_0x527215[_0xa052('0x3b')])){_0xcc6ac7=Object[_0xa052('0x5')](_0x527215[_0xa052('0x3b')])[_0xa052('0x15')](function(_0x2bf3a6){return parseIncludeModel(_0x527215[_0xa052('0x3b')][_0x2bf3a6]);});}else{var _0x2d65e2=parseIncludeModel(_0x527215[_0xa052('0x3b')]);_0xcc6ac7[_0xa052('0x3d')](_0x2d65e2);}}return _0xcc6ac7;};
\ No newline at end of file
+var _0x154f=['push','include','sequelize','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','filters','isEmpty','forOwn','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','offset','indexOf','priority','cast','col','unsigned','DESC','omit','length','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','$id','query','map','intersection','attributes','limit','order','sort','where','pick','filter','object','columns','merge','VIRTUAL','lower','options'];(function(_0x3d2189,_0x1fb57f){var _0x20ad50=function(_0x33b288){while(--_0x33b288){_0x3d2189['push'](_0x3d2189['shift']());}};_0x20ad50(++_0x1fb57f);}(_0x154f,0x82));var _0xf154=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x154f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require(_0xf154('0x0'));var moment=require('moment');var db=require(_0xf154('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xdc5719){var _0x37df6f=['ne'];try{var _0x4e5e7c=JSON[_0xf154('0x2')](_0xdc5719);var _0x2e74b4=Object[_0xf154('0x3')](_0x4e5e7c)[0x0];return _0x37df6f[_0xf154('0x4')](_0x2e74b4);}catch(_0x301460){return![];}}function getOperatorValue(_0x5c356d){var _0x312043=JSON[_0xf154('0x2')](_0x5c356d);var _0x333300=Object[_0xf154('0x3')](_0x312043)[0x0];var _0x201cfb=_0x312043[_0x333300];return{['$'+_0x333300]:_0x201cfb};}function parseIncludeModel(_0x47cd79){var _0x9c503e=JSON['parse'](_0x47cd79);return{'model':db[_0x9c503e[_0xf154('0x5')]],'as':_0x9c503e[_0xf154('0x6')],'attributes':_0x9c503e[_0xf154('0x7')],'raw':_0x9c503e[_0xf154('0x8')]};}exports[_0xf154('0x7')]=function(_0x2076c0){var _0x280fa6=null;if(_0x2076c0){_0x280fa6=_0x2076c0[_0xf154('0x9')](',');}return _0x280fa6;};exports[_0xf154('0xa')]=function(_0xd60b67,_0x35ea49){var _0x419f05={};if(!_[_0xf154('0xb')](_0xd60b67)){_[_0xf154('0xc')](_0xd60b67,function(_0x1328b3,_0x5c7b4e){try{if(_0x35ea49){var _0x1668eb=_['find'](_0x35ea49,{'name':_0x5c7b4e})||{};if(hasSequelizeOperator(_0x1328b3)){_0x419f05[_0x5c7b4e]=getOperatorValue(_0x1328b3);}else if(_0x1668eb[_0xf154('0xd')]==='DATE'&&_[_0xf154('0xe')](_0x1328b3)){var _0x2cc345=JSON[_0xf154('0x2')](_0x1328b3);var _0x164ed0={'$gte':moment(moment(_0x2cc345[_0xf154('0xf')])[_0xf154('0x10')](_0xf154('0x11')))[_0xf154('0x12')]()[_0xf154('0x10')](),'$lte':moment(moment(_0x2cc345['$lte'])[_0xf154('0x10')](_0xf154('0x11')))[_0xf154('0x12')]()[_0xf154('0x13')](0x1,'s')[_0xf154('0x10')]()};_0x419f05[_0x5c7b4e]=_0x164ed0;}else if(_0x1668eb[_0xf154('0x14')]===_0xf154('0x15')){_0x419f05[_0x5c7b4e]=_0x1328b3;}else{_0x419f05[_0x5c7b4e]=_[_0xf154('0x16')](_0x1328b3)?_0x1328b3:JSON[_0xf154('0x2')](_0x1328b3);}}else{_0x419f05[_0x5c7b4e]=_['isArray'](_0x1328b3)?_0x1328b3:JSON[_0xf154('0x2')](_0x1328b3);}}catch(_0x1bd73a){_0x419f05[_0x5c7b4e]=_0x1328b3[_0xf154('0x9')](',');}});}return _0x419f05;};exports['limit']=function(_0x357444){_0x357444=parseInt(_0x357444,0xa);if(!_0x357444||_0x357444<0x0){_0x357444=LIMIT_VALUE;}return _0x357444;};exports[_0xf154('0x17')]=function(_0x443668){_0x443668=parseInt(_0x443668,0xa);if(!_0x443668||_0x443668<0x0){_0x443668=0x0;}return _0x443668;};exports['sort']=function(_0x22c73c){var _0x12cf88,_0x423eb0=null;if(_0x22c73c){_0x12cf88=_0x22c73c[_0xf154('0x9')](',');_0x423eb0=_['map'](_0x12cf88,function(_0xfb2661){if(_0xfb2661[_0xf154('0x18')]('-')===0x0){return[_0xfb2661===_0xf154('0x19')?sequelize[_0xf154('0x1a')](sequelize[_0xf154('0x1b')](_0xf154('0x19')),_0xf154('0x1c')):_0xfb2661['substr'](0x1),_0xf154('0x1d')];}else{return[_0xfb2661==='priority'?sequelize[_0xf154('0x1a')](sequelize[_0xf154('0x1b')](_0xf154('0x19')),_0xf154('0x1c')):_0xfb2661,'ASC'];}});}return _0x423eb0;};exports[_0xf154('0x1e')]=function(_0x5255b2,_0x565f4e){if(_[_0xf154('0xb')](_0x5255b2)){return _0x5255b2;}if(_['isArray'](_0x5255b2)){for(var _0x13f5fb=0x0;_0x13f5fb<_0x5255b2[_0xf154('0x1f')];_0x13f5fb+=0x1){_0x5255b2[_0x13f5fb]=this[_0xf154('0x1e')](_0x5255b2[_0x13f5fb],_0x565f4e);}return _0x5255b2;}if(!_[_0xf154('0x20')](_0x5255b2)){return _0x5255b2;}if(_[_0xf154('0x21')](_0x565f4e)){_0x565f4e=[_0x565f4e];}if(!_[_0xf154('0x16')](_0x565f4e)){return _0x5255b2;}for(var _0xcad592=0x0;_0xcad592<_0x565f4e['length'];_0xcad592+=0x1){_[_0xf154('0x22')](_0x5255b2,_0x565f4e[_0xcad592]);}for(var _0x556335 in _0x5255b2){if(_0x5255b2[_0xf154('0x23')](_0x556335)){_0x5255b2[_0x556335]=this['omit'](_0x5255b2[_0x556335],_0x565f4e);}}return _0x5255b2;};exports['isNumeric']=function(_0x5b328c){return _0x5b328c['match'](RegExp(_0xf154('0x24')))?!![]:![];};exports[_0xf154('0x25')]=function(_0x360d2f){return _0x360d2f[_0xf154('0x26')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x164705,_0x935708){var _0xe188a=[];var _0x4a4987=/[ `!@#$%^&*()_\-?~]/;var _0x318020=_0x935708?_0xf154('0x27'):_0xf154('0x28');_0x164705[_0xf154('0x9')](/[ ,]+/)[_0xf154('0x29')](function(_0x41572e){_0x41572e=_0x41572e[_0xf154('0x2a')](/([^:]")"+/g,'$1');_0x41572e='+'+_0x41572e+'*';var _0x3127d0=_0x41572e[_0xf154('0x26')](_0x4a4987);if(_0x3127d0){_0x41572e='\x22'+_0x41572e+'\x22';}_0xe188a['push'](_0x41572e);});_0x318020=_0x318020[_0xf154('0x2a')]('{EXPR}',_0xe188a[_0xf154('0x2b')]('\x20'));return _0x318020;};exports[_0xf154('0x2c')]=function(_0x458867,_0x59a2f7,_0x2dbe9b){var _0x222b62={},_0x52c177={};if(_0x59a2f7['query'][_0xf154('0x2d')]){_0x59a2f7['query']['id']=_0x59a2f7[_0xf154('0x2e')][_0xf154('0x2d')];delete _0x59a2f7[_0xf154('0x2e')][_0xf154('0x2d')];}_0x222b62[_0xf154('0x5')]=_[_0xf154('0x2f')](_0x458867,_0xf154('0x14'));_0x222b62['query']=_[_0xf154('0x3')](_0x59a2f7['query']);_0x222b62['filters']=_[_0xf154('0x30')](_0x222b62[_0xf154('0x5')],_0x222b62['query']);_0x52c177['attributes']=_[_0xf154('0x30')](_0x222b62[_0xf154('0x5')],this[_0xf154('0x7')](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x7')]));_0x52c177[_0xf154('0x31')]=_0x52c177[_0xf154('0x31')][_0xf154('0x1f')]?_0x52c177[_0xf154('0x31')]:_0x222b62[_0xf154('0x5')];if(!_0x59a2f7['query'][_0xf154('0x23')]('nolimit')){_0x52c177['limit']=this[_0xf154('0x32')](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x32')]);_0x52c177['offset']=this[_0xf154('0x17')](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x17')]);}_0x52c177[_0xf154('0x33')]=this['sort'](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x34')]);_0x52c177[_0xf154('0x35')]=this[_0xf154('0xa')](_[_0xf154('0x36')](_0x59a2f7['query'],_0x222b62[_0xf154('0xa')]),_0x458867);if(_0x59a2f7[_0xf154('0x2e')][_0xf154('0x37')]){var _0x356e21=_0x458867;var _0x5b2115=_0x59a2f7[_0xf154('0x2e')][_0xf154('0x37')];if(typeof _0x5b2115===_0xf154('0x38')){_0x356e21=_['filter'](_0x458867,function(_0x45b546){return _['includes'](_0x5b2115[_0xf154('0x39')],_0x45b546['name']);});_0x5b2115=_0x5b2115['value'];}_0x52c177['where']=_[_0xf154('0x3a')](_0x52c177[_0xf154('0x35')],{'$or':_[_0xf154('0x2f')](_0x356e21,function(_0x48623f){if(_0x48623f[_0xf154('0xd')]!==_0xf154('0x3b')){if(_0x2dbe9b){return sequelize[_0xf154('0x35')](sequelize['fn'](_0xf154('0x3c'),sequelize['col'](_0x48623f['name'])),{'$like':sequelize['fn'](_0xf154('0x3c'),'%'+_0x59a2f7[_0xf154('0x2e')][_0xf154('0x37')]+'%')});}else{var _0x4a9c1c={};_0x4a9c1c[_0x48623f[_0xf154('0x14')]]={'$like':'%'+_0x59a2f7['query']['filter']+'%'};return _0x4a9c1c;}}})});}_0x52c177=_[_0xf154('0x3a')]({},_0x52c177,_0x59a2f7[_0xf154('0x3d')]);return _0x52c177;};exports['include']=function(_0x530b8f){var _0xe7f144=[];if(_0x530b8f['includeAll']){_0xe7f144[_0xf154('0x3e')]({'all':!![]});}else if(_0x530b8f[_0xf154('0x3f')]){if(Array[_0xf154('0x16')](_0x530b8f[_0xf154('0x3f')])){_0xe7f144=Object[_0xf154('0x3')](_0x530b8f['include'])[_0xf154('0x2f')](function(_0x98d80f){return parseIncludeModel(_0x530b8f[_0xf154('0x3f')][_0x98d80f]);});}else{var _0x2bc51f=parseIncludeModel(_0x530b8f[_0xf154('0x3f')]);_0xe7f144[_0xf154('0x3e')](_0x2bc51f);}}return _0xe7f144;};
\ No newline at end of file