Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / components / parsers / advancedSearch.js
index d4bcc3f..b211301 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf30f=['YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','format','hours','minutes','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','length','slice','split','shift','match','forEach','filter','indexOf','map','conditions','buildExpression','DATE','$eq','$between','value','$gt','operator','add','days'];(function(_0x487578,_0x540a0b){var _0x548568=function(_0x3b61cb){while(--_0x3b61cb){_0x487578['push'](_0x487578['shift']());}};_0x548568(++_0x540a0b);}(_0xf30f,0x1b6));var _0xff30=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xf30f[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xff30('0x0'));var moment=require(_0xff30('0x1'));exports['parseSearch']=function(_0x195ce4){var _0x18be59={'conditions':[]};_0x18be59[_0xff30('0x2')]=_[_0xff30('0x3')](_0x195ce4,_0xff30('0x4'))?'or':_0xff30('0x5');var _0x1c042d=_0x195ce4['replace']('[$and]','')[_0xff30('0x6')](_0xff30('0x4'),'')['split']('||');for(var _0x1acf55=0x0;_0x1acf55<_0x1c042d[_0xff30('0x7')];_0x1acf55++){var _0x48eb83=_0x1c042d[_0x1acf55]['split'](':=');var _0xe457d=_0x48eb83[0x0];var _0x49ff46=_0x48eb83[_0xff30('0x8')](0x1);_0x49ff46['forEach'](function(_0x3cfcfc){var _0x38e50e=_0x3cfcfc[_0xff30('0x9')]('[')[_0xff30('0xa')]();var _0x8247a1=_0x3cfcfc[_0xff30('0xb')](/\[(.*?)\]/g);_0x8247a1[_0xff30('0xc')](function(_0xd572a5){var _0xa926f1=_0xd572a5[_0xff30('0x9')]('[')[_0xff30('0xd')](function(_0x166309){return _0x166309[_0xff30('0xe')](']')>-0x1;})[_0xff30('0xf')](function(_0x14e27d){return _0x14e27d[_0xff30('0x9')](']')[0x0];})[0x0];_0x18be59[_0xff30('0x10')]['push']({'field':_0xe457d,'operator':_0x38e50e,'value':_0xa926f1});});});}return _0x18be59;};exports[_0xff30('0x11')]=function(_0xbb8138,_0x58d974,_0x315c2d){var _0x40a7d8={};if(_0x58d974===_0xff30('0x12')){if(_0x315c2d['operator']===_0xff30('0x13')){_0x315c2d['operator']=_0xff30('0x14');_0x315c2d[_0xff30('0x15')]+=','+_0x315c2d[_0xff30('0x15')];}else if(_['includes']([_0xff30('0x16'),'$lte'],_0x315c2d[_0xff30('0x17')])){_0x315c2d['value']=moment(_0x315c2d['value'])[_0xff30('0x18')](0x1,_0xff30('0x19'))['format'](_0xff30('0x1a'));}}if(_0x315c2d[_0xff30('0x1b')]){_0x58d974=_0x315c2d[_0xff30('0x1b')];_0x40a7d8[_0xff30('0x1c')]=_0xff30('0x1d')+_0xbb8138+'.'+_0x315c2d[_0xff30('0x1e')]+_0xff30('0x1f')+_0x315c2d['castTo']+')\x20'+parseOperator(_0x315c2d[_0xff30('0x17')]);}else{_0x40a7d8[_0xff30('0x1c')]=_0xbb8138+'.'+_0x315c2d['field']+'\x20'+parseOperator(_0x315c2d[_0xff30('0x17')]);}if(_[_0xff30('0x20')]([_0xff30('0x21'),_0xff30('0x22')],_0x315c2d['operator']))_0x40a7d8['text']='('+_0x40a7d8['text']+'\x20OR\x20'+_0xbb8138+'.'+_0x315c2d[_0xff30('0x1e')]+_0xff30('0x23');_0x40a7d8[_0xff30('0x15')]=parseValue(_0x58d974,_0x315c2d['operator'],_0x315c2d['value']);return _0x40a7d8;};function parseOperator(_0x43a3a1){var _0x42a057;switch(_0x43a3a1){case _0xff30('0x24'):_0x42a057=_0xff30('0x25');break;case _0xff30('0x22'):_0x42a057=_0xff30('0x26');break;case'$eq':_0x42a057='=\x20?';break;case _0xff30('0x21'):_0x42a057=_0xff30('0x27');break;case _0xff30('0x28'):case _0xff30('0x29'):case _0xff30('0x2a'):_0x42a057=_0xff30('0x2b');break;case _0xff30('0x2c'):_0x42a057=_0xff30('0x2d');break;case _0xff30('0x16'):_0x42a057=_0xff30('0x2e');break;case _0xff30('0x2f'):_0x42a057=_0xff30('0x30');break;case _0xff30('0x31'):_0x42a057=_0xff30('0x32');break;case _0xff30('0x14'):_0x42a057=_0xff30('0x33');break;}return _0x42a057;}function parseValue(_0x49bb11,_0x58dce8,_0x49aeb7){var _0x4eb644={'start':undefined,'end':undefined};switch(_0x58dce8){case _0xff30('0x24'):case _0xff30('0x22'):_0x4eb644[_0xff30('0x34')]=_0x49aeb7[_0xff30('0x9')](',');break;case'$substring':_0x4eb644[_0xff30('0x34')]='%'+_0x49aeb7+'%';break;case _0xff30('0x29'):_0x4eb644['start']=_0x49aeb7+'%';break;case _0xff30('0x2a'):_0x4eb644[_0xff30('0x34')]='%'+_0x49aeb7;break;case _0xff30('0x14'):var _0x51b91b=_0x49aeb7['split'](',');var _0x49aeb7=_0x51b91b[_0xff30('0xa')]();var _0x3e674e=_0x51b91b[_0xff30('0x35')]();if(_0x49bb11===_0xff30('0x12')){_0x49aeb7=moment(_0x49aeb7)[_0xff30('0x36')](0x0,!![])[_0xff30('0x37')]();_0x3e674e=moment(_0x3e674e)[_0xff30('0x36')](0x0,!![])[_0xff30('0x18')](0x17,_0xff30('0x38'))[_0xff30('0x18')](0x3b,_0xff30('0x39'))[_0xff30('0x18')](0x3b,'seconds')[_0xff30('0x37')]();}_0x4eb644={'start':_0x49aeb7,'end':_0x3e674e};break;default:_0x4eb644[_0xff30('0x34')]=_0x49aeb7;break;}return _0x4eb644;}
\ No newline at end of file
+var _0x1ddb=['value','includes','$gt','$lte','operator','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','=\x20?','<>\x20?','$substring','LIKE\x20?','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','pop','utcOffset','format','hours','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','$eq','$between'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x1ddb,0x1ba));var _0xb1dd=function(_0x1ed354,_0x4bb5be){_0x1ed354=_0x1ed354-0x0;var _0x532757=_0x1ddb[_0x1ed354];return _0x532757;};'use strict';var _=require(_0xb1dd('0x0'));var moment=require(_0xb1dd('0x1'));exports[_0xb1dd('0x2')]=function(_0x15fe20){var _0x390b03={'conditions':[]};_0x390b03[_0xb1dd('0x3')]=_[_0xb1dd('0x4')](_0x15fe20,_0xb1dd('0x5'))?'or':_0xb1dd('0x6');var _0x3f2bb8=_0x15fe20[_0xb1dd('0x7')](_0xb1dd('0x8'),'')[_0xb1dd('0x7')](_0xb1dd('0x5'),'')[_0xb1dd('0x9')]('||');for(var _0x2feaee=0x0;_0x2feaee<_0x3f2bb8['length'];_0x2feaee++){var _0x13084a=_0x3f2bb8[_0x2feaee][_0xb1dd('0x9')](':=');var _0xf7fefc=_0x13084a[0x0];var _0x681a7b=_0x13084a[_0xb1dd('0xa')](0x1);_0x681a7b[_0xb1dd('0xb')](function(_0x457e2d){var _0x27492f=_0x457e2d[_0xb1dd('0x9')]('[')[_0xb1dd('0xc')]();var _0x2438f3=_0x457e2d[_0xb1dd('0xd')](/\[(.*?)\]/g);_0x2438f3[_0xb1dd('0xb')](function(_0x3da7d9){var _0x3f5ab4=_0x3da7d9[_0xb1dd('0x9')]('[')[_0xb1dd('0xe')](function(_0x901550){return _0x901550[_0xb1dd('0xf')](']')>-0x1;})[_0xb1dd('0x10')](function(_0x108495){return _0x108495[_0xb1dd('0x9')](']')[0x0];})[0x0];_0x390b03[_0xb1dd('0x11')][_0xb1dd('0x12')]({'field':_0xf7fefc,'operator':_0x27492f,'value':_0x3f5ab4});});});}return _0x390b03;};exports['buildExpression']=function(_0x44d5be,_0x13d562,_0x33bde2){var _0x3d1b2f={};if(_0x13d562===_0xb1dd('0x13')){if(_0x33bde2['operator']===_0xb1dd('0x14')){_0x33bde2['operator']=_0xb1dd('0x15');_0x33bde2[_0xb1dd('0x16')]+=','+_0x33bde2['value'];}else if(_[_0xb1dd('0x17')]([_0xb1dd('0x18'),_0xb1dd('0x19')],_0x33bde2[_0xb1dd('0x1a')])){_0x33bde2[_0xb1dd('0x16')]=moment(_0x33bde2[_0xb1dd('0x16')])['add'](0x1,_0xb1dd('0x1b'))['format'](_0xb1dd('0x1c'));}}if(_0x33bde2[_0xb1dd('0x1d')]){_0x13d562=_0x33bde2[_0xb1dd('0x1d')];_0x3d1b2f[_0xb1dd('0x1e')]=_0xb1dd('0x1f')+_0x44d5be+'.'+_0x33bde2[_0xb1dd('0x20')]+_0xb1dd('0x21')+_0x33bde2[_0xb1dd('0x1d')]+')\x20'+parseOperator(_0x33bde2[_0xb1dd('0x1a')]);}else{_0x3d1b2f[_0xb1dd('0x1e')]=_0x44d5be+'.'+_0x33bde2['field']+'\x20'+parseOperator(_0x33bde2[_0xb1dd('0x1a')]);}if(_[_0xb1dd('0x17')]([_0xb1dd('0x22'),'$notIn'],_0x33bde2[_0xb1dd('0x1a')]))_0x3d1b2f['text']='('+_0x3d1b2f[_0xb1dd('0x1e')]+_0xb1dd('0x23')+_0x44d5be+'.'+_0x33bde2[_0xb1dd('0x20')]+_0xb1dd('0x24');_0x3d1b2f['value']=parseValue(_0x13d562,_0x33bde2[_0xb1dd('0x1a')],_0x33bde2[_0xb1dd('0x16')]);return _0x3d1b2f;};function parseOperator(_0x3107c4){var _0x3e2c04;switch(_0x3107c4){case'$in':_0x3e2c04=_0xb1dd('0x25');break;case _0xb1dd('0x26'):_0x3e2c04='NOT\x20IN\x20?';break;case'$eq':_0x3e2c04=_0xb1dd('0x27');break;case'$ne':_0x3e2c04=_0xb1dd('0x28');break;case _0xb1dd('0x29'):case'$startsWith':case'$endsWith':_0x3e2c04=_0xb1dd('0x2a');break;case'$lt':_0x3e2c04=_0xb1dd('0x2b');break;case'$gt':_0x3e2c04='>\x20?';break;case _0xb1dd('0x19'):_0x3e2c04=_0xb1dd('0x2c');break;case _0xb1dd('0x2d'):_0x3e2c04=_0xb1dd('0x2e');break;case'$between':_0x3e2c04=_0xb1dd('0x2f');break;}return _0x3e2c04;}function parseValue(_0x755b12,_0x514faa,_0x556e67){var _0x23060c={'start':undefined,'end':undefined};switch(_0x514faa){case _0xb1dd('0x30'):case'$notIn':_0x23060c[_0xb1dd('0x31')]=_0x556e67[_0xb1dd('0x9')](',');break;case'$substring':_0x23060c['start']='%'+_0x556e67+'%';break;case _0xb1dd('0x32'):_0x23060c[_0xb1dd('0x31')]=_0x556e67+'%';break;case'$endsWith':_0x23060c[_0xb1dd('0x31')]='%'+_0x556e67;break;case'$between':var _0xd6d8cc=_0x556e67[_0xb1dd('0x9')](',');var _0x556e67=_0xd6d8cc[_0xb1dd('0xc')]();var _0x7821e2=_0xd6d8cc[_0xb1dd('0x33')]();if(_0x755b12===_0xb1dd('0x13')){_0x556e67=moment(_0x556e67)[_0xb1dd('0x34')](0x0,!![])[_0xb1dd('0x35')]();_0x7821e2=moment(_0x7821e2)['utcOffset'](0x0,!![])['add'](0x17,_0xb1dd('0x36'))[_0xb1dd('0x37')](0x3b,_0xb1dd('0x38'))[_0xb1dd('0x37')](0x3b,_0xb1dd('0x39'))[_0xb1dd('0x35')]();}_0x23060c={'start':_0x556e67,'end':_0x7821e2};break;default:_0x23060c[_0xb1dd('0x31')]=_0x556e67;break;}return _0x23060c;}
\ No newline at end of file