Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / components / parsers / advancedSearch.js
index d6905fa..179e830 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x77f8=['parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','shift','match','forEach','filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','includes','$gt','$lte','value','add','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','hours','minutes','lodash','moment'];(function(_0x2ae9ab,_0x54da0a){var _0x5579e1=function(_0x488c5a){while(--_0x488c5a){_0x2ae9ab['push'](_0x2ae9ab['shift']());}};_0x5579e1(++_0x54da0a);}(_0x77f8,0x186));var _0x877f=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x77f8[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x877f('0x0'));var moment=require(_0x877f('0x1'));exports[_0x877f('0x2')]=function(_0x101796){var _0x23fb07={'conditions':[]};_0x23fb07[_0x877f('0x3')]=_['startsWith'](_0x101796,_0x877f('0x4'))?'or':_0x877f('0x5');var _0x5df9c1=_0x101796[_0x877f('0x6')](_0x877f('0x7'),'')[_0x877f('0x6')]('[$or]','')[_0x877f('0x8')]('||');for(var _0xc34230=0x0;_0xc34230<_0x5df9c1[_0x877f('0x9')];_0xc34230++){var _0x1d5620=_0x5df9c1[_0xc34230][_0x877f('0x8')](':=');var _0x1ddf88=_0x1d5620[0x0];var _0x1852e9=_0x1d5620['slice'](0x1);_0x1852e9['forEach'](function(_0x26ee70){var _0x564b48=_0x26ee70[_0x877f('0x8')]('[')[_0x877f('0xa')]();var _0x54787d=_0x26ee70[_0x877f('0xb')](/\[(.*?)\]/g);_0x54787d[_0x877f('0xc')](function(_0x17eab2){var _0x316d8b=_0x17eab2[_0x877f('0x8')]('[')[_0x877f('0xd')](function(_0xa77660){return _0xa77660[_0x877f('0xe')](']')>-0x1;})[_0x877f('0xf')](function(_0x28125b){return _0x28125b['split'](']')[0x0];})[0x0];_0x23fb07[_0x877f('0x10')][_0x877f('0x11')]({'field':_0x1ddf88,'operator':_0x564b48,'value':_0x316d8b});});});}return _0x23fb07;};exports['buildExpression']=function(_0x641dc3,_0x5986a4,_0x10864a){var _0x4b08aa={};if(_0x5986a4===_0x877f('0x12')){if(_0x10864a[_0x877f('0x13')]===_0x877f('0x14')){_0x10864a['operator']=_0x877f('0x15');_0x10864a['value']+=','+_0x10864a['value'];}else if(_[_0x877f('0x16')]([_0x877f('0x17'),_0x877f('0x18')],_0x10864a[_0x877f('0x13')])){_0x10864a[_0x877f('0x19')]=moment(_0x10864a[_0x877f('0x19')])[_0x877f('0x1a')](0x1,'days')[_0x877f('0x1b')](_0x877f('0x1c'));}}if(_0x10864a[_0x877f('0x1d')]){_0x5986a4=_0x10864a[_0x877f('0x1d')];_0x4b08aa[_0x877f('0x1e')]=_0x877f('0x1f')+_0x641dc3+'.'+_0x10864a['field']+'\x20AS\x20'+_0x10864a[_0x877f('0x1d')]+')\x20'+parseOperator(_0x10864a[_0x877f('0x13')]);}else{_0x4b08aa[_0x877f('0x1e')]=_0x641dc3+'.'+_0x10864a[_0x877f('0x20')]+'\x20'+parseOperator(_0x10864a[_0x877f('0x13')]);}if(_[_0x877f('0x16')]([_0x877f('0x21'),_0x877f('0x22')],_0x10864a['operator']))_0x4b08aa[_0x877f('0x1e')]='('+_0x4b08aa[_0x877f('0x1e')]+'\x20OR\x20'+_0x641dc3+'.'+_0x10864a['field']+_0x877f('0x23');_0x4b08aa[_0x877f('0x19')]=parseValue(_0x5986a4,_0x10864a[_0x877f('0x13')],_0x10864a[_0x877f('0x19')]);return _0x4b08aa;};function parseOperator(_0x36e9c4){var _0x23edce;switch(_0x36e9c4){case _0x877f('0x24'):_0x23edce=_0x877f('0x25');break;case _0x877f('0x22'):_0x23edce=_0x877f('0x26');break;case _0x877f('0x14'):_0x23edce=_0x877f('0x27');break;case _0x877f('0x21'):_0x23edce=_0x877f('0x28');break;case _0x877f('0x29'):case'$startsWith':case _0x877f('0x2a'):_0x23edce=_0x877f('0x2b');break;case _0x877f('0x2c'):_0x23edce=_0x877f('0x2d');break;case'$gt':_0x23edce=_0x877f('0x2e');break;case _0x877f('0x18'):_0x23edce=_0x877f('0x2f');break;case'$gte':_0x23edce=_0x877f('0x30');break;case _0x877f('0x15'):_0x23edce=_0x877f('0x31');break;}return _0x23edce;}function parseValue(_0x98cff6,_0x38c3bf,_0x569888){var _0x1b8eef={'start':undefined,'end':undefined};switch(_0x38c3bf){case _0x877f('0x24'):case'$notIn':_0x1b8eef[_0x877f('0x32')]=_0x569888[_0x877f('0x8')](',');break;case _0x877f('0x29'):_0x1b8eef[_0x877f('0x32')]='%'+_0x569888+'%';break;case _0x877f('0x33'):_0x1b8eef[_0x877f('0x32')]=_0x569888+'%';break;case _0x877f('0x2a'):_0x1b8eef['start']='%'+_0x569888;break;case'$between':var _0x25e456=_0x569888[_0x877f('0x8')](',');var _0x569888=_0x25e456[_0x877f('0xa')]();var _0x44b948=_0x25e456[_0x877f('0x34')]();if(_0x98cff6===_0x877f('0x12')){_0x569888=moment(_0x569888)[_0x877f('0x35')](0x0,!![])[_0x877f('0x1b')]();_0x44b948=moment(_0x44b948)[_0x877f('0x35')](0x0,!![])[_0x877f('0x1a')](0x17,_0x877f('0x36'))[_0x877f('0x1a')](0x3b,_0x877f('0x37'))[_0x877f('0x1a')](0x3b,'seconds')[_0x877f('0x1b')]();}_0x1b8eef={'start':_0x569888,'end':_0x44b948};break;default:_0x1b8eef['start']=_0x569888;break;}return _0x1b8eef;}
\ No newline at end of file
+var _0x1542=['conditions','buildExpression','operator','$between','value','includes','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','start','shift','pop','DATE','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','match','filter','indexOf'];(function(_0x46f925,_0x40dece){var _0x43feab=function(_0x89db2c){while(--_0x89db2c){_0x46f925['push'](_0x46f925['shift']());}};_0x43feab(++_0x40dece);}(_0x1542,0x99));var _0x2154=function(_0x28c0ac,_0x4b016f){_0x28c0ac=_0x28c0ac-0x0;var _0x4906fa=_0x1542[_0x28c0ac];return _0x4906fa;};'use strict';var _=require(_0x2154('0x0'));var moment=require(_0x2154('0x1'));exports[_0x2154('0x2')]=function(_0x31c3fd){var _0x870d21={'conditions':[]};_0x870d21[_0x2154('0x3')]=_['startsWith'](_0x31c3fd,_0x2154('0x4'))?'or':_0x2154('0x5');var _0x5987fb=_0x31c3fd[_0x2154('0x6')](_0x2154('0x7'),'')[_0x2154('0x6')]('[$or]','')[_0x2154('0x8')]('||');for(var _0x37ed0a=0x0;_0x37ed0a<_0x5987fb[_0x2154('0x9')];_0x37ed0a++){var _0x306f64=_0x5987fb[_0x37ed0a]['split'](':=');var _0x3f1a2a=_0x306f64[0x0];var _0x2d9405=_0x306f64[_0x2154('0xa')](0x1);_0x2d9405[_0x2154('0xb')](function(_0x24f16b){var _0xbf8015=_0x24f16b[_0x2154('0x8')]('[')['shift']();var _0x4bdc12=_0x24f16b[_0x2154('0xc')](/\[(.*?)\]/g);_0x4bdc12['forEach'](function(_0x25297d){var _0x5d4af1=_0x25297d[_0x2154('0x8')]('[')[_0x2154('0xd')](function(_0x38b9b5){return _0x38b9b5[_0x2154('0xe')](']')>-0x1;})['map'](function(_0x3f181e){return _0x3f181e[_0x2154('0x8')](']')[0x0];})[0x0];_0x870d21[_0x2154('0xf')]['push']({'field':_0x3f1a2a,'operator':_0xbf8015,'value':_0x5d4af1});});});}return _0x870d21;};exports[_0x2154('0x10')]=function(_0x297da5,_0x579d10,_0x8963cf){var _0x17e949={};if(_0x579d10==='DATE'){if(_0x8963cf[_0x2154('0x11')]==='$eq'){_0x8963cf['operator']=_0x2154('0x12');_0x8963cf[_0x2154('0x13')]+=','+_0x8963cf[_0x2154('0x13')];}else if(_[_0x2154('0x14')](['$gt','$lte'],_0x8963cf[_0x2154('0x11')])){_0x8963cf[_0x2154('0x13')]=moment(_0x8963cf[_0x2154('0x13')])[_0x2154('0x15')](0x1,_0x2154('0x16'))[_0x2154('0x17')](_0x2154('0x18'));}}if(_0x8963cf['castTo']){_0x579d10=_0x8963cf[_0x2154('0x19')];_0x17e949[_0x2154('0x1a')]=_0x2154('0x1b')+_0x297da5+'.'+_0x8963cf[_0x2154('0x1c')]+_0x2154('0x1d')+_0x8963cf['castTo']+')\x20'+parseOperator(_0x8963cf[_0x2154('0x11')]);}else{_0x17e949[_0x2154('0x1a')]=_0x297da5+'.'+_0x8963cf[_0x2154('0x1c')]+'\x20'+parseOperator(_0x8963cf['operator']);}if(_['includes']([_0x2154('0x1e'),_0x2154('0x1f')],_0x8963cf[_0x2154('0x11')]))_0x17e949[_0x2154('0x1a')]='('+_0x17e949[_0x2154('0x1a')]+_0x2154('0x20')+_0x297da5+'.'+_0x8963cf[_0x2154('0x1c')]+'\x20IS\x20NULL)';_0x17e949[_0x2154('0x13')]=parseValue(_0x579d10,_0x8963cf[_0x2154('0x11')],_0x8963cf[_0x2154('0x13')]);return _0x17e949;};function parseOperator(_0x523f4a){var _0xb2cbd7;switch(_0x523f4a){case _0x2154('0x21'):_0xb2cbd7='IN\x20?';break;case _0x2154('0x1f'):_0xb2cbd7=_0x2154('0x22');break;case'$eq':_0xb2cbd7=_0x2154('0x23');break;case _0x2154('0x1e'):_0xb2cbd7=_0x2154('0x24');break;case _0x2154('0x25'):case _0x2154('0x26'):case _0x2154('0x27'):_0xb2cbd7=_0x2154('0x28');break;case _0x2154('0x29'):_0xb2cbd7=_0x2154('0x2a');break;case _0x2154('0x2b'):_0xb2cbd7=_0x2154('0x2c');break;case _0x2154('0x2d'):_0xb2cbd7=_0x2154('0x2e');break;case _0x2154('0x2f'):_0xb2cbd7=_0x2154('0x30');break;case _0x2154('0x12'):_0xb2cbd7='BETWEEN\x20?\x20AND\x20?';break;}return _0xb2cbd7;}function parseValue(_0x239fa1,_0x47a816,_0xb0c863){var _0x414566={'start':undefined,'end':undefined};switch(_0x47a816){case _0x2154('0x21'):case'$notIn':_0x414566[_0x2154('0x31')]=_0xb0c863[_0x2154('0x8')](',');break;case'$substring':_0x414566[_0x2154('0x31')]='%'+_0xb0c863+'%';break;case _0x2154('0x26'):_0x414566[_0x2154('0x31')]=_0xb0c863+'%';break;case _0x2154('0x27'):_0x414566[_0x2154('0x31')]='%'+_0xb0c863;break;case'$between':var _0x1aeb00=_0xb0c863[_0x2154('0x8')](',');var _0xb0c863=_0x1aeb00[_0x2154('0x32')]();var _0x7a4ed2=_0x1aeb00[_0x2154('0x33')]();if(_0x239fa1===_0x2154('0x34')){_0xb0c863=moment(_0xb0c863)[_0x2154('0x35')](0x0,!![])[_0x2154('0x17')]();_0x7a4ed2=moment(_0x7a4ed2)[_0x2154('0x35')](0x0,!![])[_0x2154('0x15')](0x17,_0x2154('0x36'))[_0x2154('0x15')](0x3b,_0x2154('0x37'))['add'](0x3b,'seconds')[_0x2154('0x17')]();}_0x414566={'start':_0xb0c863,'end':_0x7a4ed2};break;default:_0x414566[_0x2154('0x31')]=_0xb0c863;break;}return _0x414566;}
\ No newline at end of file