@lovrabet/dataset-mcp-server 1.3.2-beta.2 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(_0x4e07be,_0x527ec9){const _0x25d701=a17_0x44ae,_0x1774cc=_0x4e07be();while(!![]){try{const _0x3e23e4=-parseInt(_0x25d701(0x1b4))/0x1*(-parseInt(_0x25d701(0x1b2))/0x2)+-parseInt(_0x25d701(0x1c7))/0x3+parseInt(_0x25d701(0x1b9))/0x4*(parseInt(_0x25d701(0x1c3))/0x5)+-parseInt(_0x25d701(0x1d2))/0x6+-parseInt(_0x25d701(0x19f))/0x7+parseInt(_0x25d701(0x1d1))/0x8+-parseInt(_0x25d701(0x1c1))/0x9*(-parseInt(_0x25d701(0x1cf))/0xa);if(_0x3e23e4===_0x527ec9)break;else _0x1774cc['push'](_0x1774cc['shift']());}catch(_0x430082){_0x1774cc['push'](_0x1774cc['shift']());}}}(a17_0x2d41,0x3fc7a));import{DevApiClient}from'../api/dev-api-client.js';function a17_0x44ae(_0x465756,_0x561891){_0x465756=_0x465756-0x19b;const _0x2d4187=a17_0x2d41();let _0x44aee5=_0x2d4187[_0x465756];return _0x44aee5;}import{getEnvAppCode,getEnvironment}from'../config/env.js';export async function listSqlQueries(_0x4cbba8={}){const _0x226e0f=a17_0x44ae,{appCode:appCode=getEnvAppCode(),cookie:_0x238fe4,keyword:_0x5ba126,category:_0x5b9761,sqlCode:_0x4a7f2b,sqlName:_0xf9d9ca,pageSize:pageSize=0x3e7,currentPage:currentPage=0x1}=_0x4cbba8;if(!appCode)throw new Error(_0x226e0f(0x1b3));const _0xe562cf=new DevApiClient({'appCode':appCode,'cookie':_0x238fe4}),_0xc8fd06=getEnvironment();try{const _0x1e606=await _0xe562cf[_0x226e0f(0x1ac)]({'pageSize':pageSize,'currentPage':currentPage,'sqlCode':_0x4a7f2b,'sqlName':_0xf9d9ca}),_0x1da344=_0x1e606['data']||_0x1e606,_0x41481f=_0x1da344['tableData']||[],_0x400e94=_0x1da344['total']||_0x41481f[_0x226e0f(0x1a5)];let _0x301820=_0x41481f[_0x226e0f(0x1d0)](_0x243c23=>{const _0x94a1c7=_0x226e0f,_0x2e5252=_0x243c23[_0x94a1c7(0x1bb)]||appCode+'-'+(_0x243c23[_0x94a1c7(0x1d9)]||_0x243c23['id']),_0xa9e658=_0x243c23['sqlId']||_0x243c23['id'];let _0x329b7d;if(_0x243c23[_0x94a1c7(0x1a4)]||_0x243c23[_0x94a1c7(0x1a2)]){const _0x1f2c5b=_0x243c23[_0x94a1c7(0x1a4)]||_0x243c23['sql'],_0x50c55b=_0x1f2c5b[_0x94a1c7(0x1a8)](/[:$]\{?(\w+)\}?/g);if(_0x50c55b){const _0x5430e9=Array[_0x94a1c7(0x1ce)](new Set(_0x50c55b[_0x94a1c7(0x1d0)](_0x2051d9=>_0x2051d9[_0x94a1c7(0x1cb)](/[:${}]/g,''))));_0x329b7d=_0x5430e9[_0x94a1c7(0x1d0)](_0x33d7ae=>{const _0x47e301=_0x94a1c7;let _0x28e075=_0x47e301(0x1ae);if(_0x33d7ae[_0x47e301(0x1a7)]()['includes']('date')||_0x33d7ae[_0x47e301(0x1a7)]()[_0x47e301(0x1af)](_0x47e301(0x1d3)))_0x28e075='2024-01-01';else{if(_0x33d7ae[_0x47e301(0x1a7)]()[_0x47e301(0x1af)]('id'))_0x28e075=0x7b;else(_0x33d7ae[_0x47e301(0x1a7)]()['includes'](_0x47e301(0x1aa))||_0x33d7ae['toLowerCase']()[_0x47e301(0x1af)](_0x47e301(0x1bf)))&&(_0x28e075=0xa);}return{'name':_0x33d7ae,'type':_0x47e301(0x1d5),'required':!![],'description':_0x47e301(0x1b8)+_0x33d7ae,'example':_0x28e075};});}}const _0x162de4=_0x329b7d&&_0x329b7d[_0x94a1c7(0x1a5)]>0x0,_0x12218a=_0x162de4?_0x329b7d['reduce']((_0x1bf10d,_0x50609f)=>({..._0x1bf10d,[_0x50609f[_0x94a1c7(0x19b)]]:_0x50609f[_0x94a1c7(0x1c4)]}),{}):undefined,_0x1b00f9={'typescript':_0x94a1c7(0x1cd)+appCode+_0x94a1c7(0x1a6)+(_0xc8fd06||_0x94a1c7(0x1a0))+_0x94a1c7(0x1c6)+(_0x243c23['sqlName']||_0x243c23[_0x94a1c7(0x19b)]||'SQL\x20Query')+_0x94a1c7(0x1a3)+_0x2e5252+'\x27'+(_0x162de4?',\x20'+JSON[_0x94a1c7(0x1be)](_0x12218a,null,0x2):'')+_0x94a1c7(0x1d8),'description':'Execute\x20SQL\x20query:\x20'+(_0x243c23[_0x94a1c7(0x1ab)]||_0x243c23['name']||_0x94a1c7(0x1d6)),'important':['SDK\x20returns\x20{\x20execSuccess:\x20boolean,\x20execResult?:\x20any[]\x20}\x20-\x20Always\x20check\x20execSuccess\x20before\x20using\x20execResult','The\x20executeSql\x20method\x20accepts\x20two\x20parameters:\x20sqlCode\x20(string)\x20and\x20optional\x20params\x20(object)',_0x162de4?'This\x20SQL\x20requires\x20parameters:\x20'+_0x329b7d[_0x94a1c7(0x1d0)](_0x3b88ea=>_0x3b88ea[_0x94a1c7(0x19b)]+'\x20('+_0x3b88ea['type']+')')[_0x94a1c7(0x1c2)](',\x20'):'This\x20SQL\x20does\x20not\x20require\x20any\x20parameters','On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20exception\x20-\x20use\x20try-catch\x20for\x20error\x20handling',_0x94a1c7(0x1bc)]},_0x22f511={'sqlCode':_0x2e5252,'sqlId':_0xa9e658,'name':_0x243c23['sqlName']||_0x243c23[_0x94a1c7(0x19b)]||_0x94a1c7(0x1bd)+_0xa9e658,'description':_0x243c23[_0x94a1c7(0x1a9)]||_0x243c23[_0x94a1c7(0x19c)],'category':_0x243c23['category']||_0x243c23['sqlType']||'other','sqlContent':_0x243c23[_0x94a1c7(0x1a4)]||_0x243c23['sql'],'parameters':_0x329b7d,'createdTime':_0x243c23['createdTime']||_0x243c23[_0x94a1c7(0x1ba)],'updatedTime':_0x243c23[_0x94a1c7(0x1b7)]||_0x243c23[_0x94a1c7(0x1d7)],'codeExample':_0x1b00f9};return _0x22f511;});if(_0x5ba126){const _0x5bcdfb=_0x5ba126[_0x226e0f(0x1a7)]();_0x301820=_0x301820[_0x226e0f(0x1c5)](_0x587b1d=>_0x587b1d[_0x226e0f(0x19b)][_0x226e0f(0x1a7)]()[_0x226e0f(0x1af)](_0x5bcdfb)||_0x587b1d['description']&&_0x587b1d[_0x226e0f(0x19c)][_0x226e0f(0x1a7)]()[_0x226e0f(0x1af)](_0x5bcdfb)||_0x587b1d[_0x226e0f(0x1bb)][_0x226e0f(0x1a7)]()[_0x226e0f(0x1af)](_0x5bcdfb)||_0x587b1d[_0x226e0f(0x1a4)]&&_0x587b1d[_0x226e0f(0x1a4)][_0x226e0f(0x1a7)]()[_0x226e0f(0x1af)](_0x5bcdfb));}_0x5b9761&&_0x5b9761!=='all'&&(_0x301820=_0x301820[_0x226e0f(0x1c5)](_0x4400d7=>_0x4400d7['category']&&_0x4400d7[_0x226e0f(0x1c8)]['toLowerCase']()===_0x5b9761[_0x226e0f(0x1a7)]()));const _0x1bf776=Math[_0x226e0f(0x1c0)](_0x301820[_0x226e0f(0x1a5)]/pageSize),_0x465954=_0x301820[_0x226e0f(0x1d4)]((currentPage-0x1)*pageSize,currentPage*pageSize),_0x2804e7=_0x465954[_0x226e0f(0x1a5)]>0x0?_0x465954[0x0]:null,_0x14cdad=_0x2804e7?_0x226e0f(0x1cc)+_0x2804e7['name']+'\x22\x0aconst\x20data\x20=\x20await\x20client.api.executeSql(\x27'+_0x2804e7['sqlCode']+_0x226e0f(0x1c9):'';return{'type':'sql_list','total':_0x301820['length'],'sqls':_0x465954,'pagination':{'currentPage':currentPage,'pageSize':pageSize,'totalPages':_0x1bf776},'usage':{'description':_0x226e0f(0x1ad)+_0x301820['length']+'\x20SQL\x20queries\x20for\x20application\x20'+appCode+_0x226e0f(0x1b5),'important':['IMPORTANT:\x20All\x20SQL\x20queries\x20use\x20the\x20same\x20execution\x20pattern\x20-\x20client.api.executeSql(sqlCode,\x20params)',_0x226e0f(0x1ca),_0x226e0f(0x19e),_0x226e0f(0x19d),_0x226e0f(0x1b0),'Each\x20SQL\x20query\x20above\x20includes\x20a\x20codeExample\x20field\x20with\x20complete\x20TypeScript\x20code\x20ready\x20to\x20use','For\x20more\x20customization,\x20use\x20generate_sql_code\x20tool\x20to\x20get\x20code\x20with\x20type\x20inference'],'example':_0x14cdad||_0x226e0f(0x1b1)}};}catch(_0x22d867){throw new Error(_0x226e0f(0x1a1)+_0x22d867[_0x226e0f(0x1b6)]);}}function a17_0x2d41(){const _0xe7682b=['\x27,\x0a\x20\x20env:\x20\x27','toLowerCase','match','sqlDesc','limit','sqlName','getCustomSqlList','Found\x20','value','includes','IMPORTANT:\x20Business\x20logic\x20errors\x20(SQL\x20failures)\x20are\x20returned\x20in\x20data.execError,\x20not\x20thrown','No\x20SQL\x20queries\x20found.\x20Check\x20your\x20appCode\x20and\x20authentication.','18GbExKO','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','28393kOCWNO','.\x20Each\x20SQL\x20includes\x20a\x20complete\x20code\x20example\x20showing\x20how\x20to\x20execute\x20it\x20using\x20the\x20SDK.','message','updatedTime','Parameter:\x20','12DvWEzU','createTime','sqlCode','The\x20execResult\x20contains\x20an\x20array\x20of\x20row\x20objects\x20matching\x20your\x20SQL\x20query\x20structure','SQL-','stringify','count','ceil','153imAFpG','join','312810nPCcbq','example','filter','\x27,\x0a});\x0a\x0a//\x20Execute\x20the\x20SQL\x20query:\x20','532740wDPMXG','category','\x27);\x0aif\x20(!data.execSuccess)\x20{\x0a\x20\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);\x0a}\x0aconst\x20results\x20=\x20data.execResult\x20||\x20[];','IMPORTANT:\x20Always\x20check\x20data.execSuccess\x20before\x20using\x20data.execResult','replace','\x0a//\x20Example:\x20Using\x20SQL\x20\x22','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;\x0a\x0a//\x20Initialize\x20the\x20SDK\x20client\x0aconst\x20client\x20=\x20new\x20LovrabetClient({\x0a\x20\x20appCode:\x20\x27','from','279530lJcahn','map','1355080gDlsSd','1515126WFsnHR','time','slice','string','Custom\x20SQL','updateTime',');\x0a\x0a//\x20IMPORTANT:\x20Check\x20execution\x20status\x20before\x20using\x20results\x0aif\x20(!data.execSuccess)\x20{\x0a\x20\x20throw\x20new\x20Error(`SQL\x20execution\x20failed:\x20${data.execError\x20||\x20\x27Unknown\x20error\x27}`);\x0a}\x0a\x0a//\x20Process\x20the\x20results\x0aconst\x20results\x20=\x20data.execResult\x20||\x20[];\x0aconsole.log(`Retrieved\x20${results.length}\x20rows`);\x0a\x0a//\x20Use\x20the\x20data\x0aresults.forEach(row\x20=>\x20{\x0a\x20\x20console.log(row);\x0a});','sqlId','name','description','IMPORTANT:\x20Use\x20try-catch\x20to\x20handle\x20HTTP\x20errors\x20(network\x20issues,\x20auth\x20failures)','IMPORTANT:\x20The\x20SDK\x20returns\x20{\x20execSuccess:\x20boolean,\x20execResult?:\x20any[],\x20execError?:\x20string\x20}','2775262lsncNL','online','Failed\x20to\x20list\x20SQL\x20queries:\x20','sql','\x0aconst\x20data\x20=\x20await\x20client.api.executeSql(\x27','sqlContent','length'];a17_0x2d41=function(){return _0xe7682b;};return a17_0x2d41();}
1
+ function a17_0x3376(){const _0x410827=['sqlDesc','match','2077290nfQwAU','13205VoMope','13403574CdIism','Found\x20','filter','264fGDDnd','sql','SQL-','446289IXYHeV','\x27,\x0a\x20\x20env:\x20\x27','\x0aconst\x20data\x20=\x20await\x20client.api.executeSql(\x27','78250ahweSb','includes','4pWZlZE','Each\x20SQL\x20query\x20above\x20includes\x20a\x20codeExample\x20field\x20with\x20complete\x20TypeScript\x20code\x20ready\x20to\x20use','Custom\x20SQL','getCustomSqlList','No\x20SQL\x20queries\x20found.\x20Check\x20your\x20appCode\x20and\x20authentication.','value','from','online','\x0a//\x20Example:\x20Using\x20SQL\x20\x22','sqlName','Parameter:\x20','type','sqlType','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;\x0a\x0a//\x20Initialize\x20the\x20SDK\x20client\x0aconst\x20client\x20=\x20new\x20LovrabetClient({\x0a\x20\x20appCode:\x20\x27','IMPORTANT:\x20Use\x20try-catch\x20to\x20handle\x20HTTP\x20errors\x20(network\x20issues,\x20auth\x20failures)','The\x20execResult\x20contains\x20an\x20array\x20of\x20row\x20objects\x20matching\x20your\x20SQL\x20query\x20structure','This\x20SQL\x20requires\x20parameters:\x20','example','total','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','SQL\x20Query','length','sql_list','reduce','For\x20more\x20customization,\x20use\x20generate_sql_code\x20tool\x20to\x20get\x20code\x20with\x20type\x20inference','time','sqlCode','IMPORTANT:\x20All\x20SQL\x20queries\x20use\x20the\x20same\x20execution\x20pattern\x20-\x20client.api.executeSql(sqlCode,\x20params)','name','2024-01-01','IMPORTANT:\x20Business\x20logic\x20errors\x20(SQL\x20failures)\x20are\x20returned\x20in\x20data.execError,\x20not\x20thrown','createTime','stringify','.\x20Each\x20SQL\x20includes\x20a\x20complete\x20code\x20example\x20showing\x20how\x20to\x20execute\x20it\x20using\x20the\x20SDK.','replace','count','join','SDK\x20returns\x20{\x20execSuccess:\x20boolean,\x20execResult?:\x20any[]\x20}\x20-\x20Always\x20check\x20execSuccess\x20before\x20using\x20execResult','Failed\x20to\x20list\x20SQL\x20queries:\x20','983432nJNaaf','category','toLowerCase','This\x20SQL\x20does\x20not\x20require\x20any\x20parameters','IMPORTANT:\x20Always\x20check\x20data.execSuccess\x20before\x20using\x20data.execResult','sqlId','ceil','other','1620192PRgbtH','description','date','limit','map','sqlContent'];a17_0x3376=function(){return _0x410827;};return a17_0x3376();}function a17_0x3e36(_0x55d31d,_0x1cbf22){_0x55d31d=_0x55d31d-0x1b3;const _0x337690=a17_0x3376();let _0x3e36f3=_0x337690[_0x55d31d];return _0x3e36f3;}(function(_0x1af4ba,_0x56e6e8){const _0x3a836c=a17_0x3e36,_0x115ffa=_0x1af4ba();while(!![]){try{const _0x20c88b=-parseInt(_0x3a836c(0x1de))/0x1*(parseInt(_0x3a836c(0x1e0))/0x2)+-parseInt(_0x3a836c(0x1db))/0x3+parseInt(_0x3a836c(0x1d8))/0x4*(-parseInt(_0x3a836c(0x1d4))/0x5)+-parseInt(_0x3a836c(0x1d3))/0x6+-parseInt(_0x3a836c(0x1cb))/0x7+-parseInt(_0x3a836c(0x1c3))/0x8+parseInt(_0x3a836c(0x1d5))/0x9;if(_0x20c88b===_0x56e6e8)break;else _0x115ffa['push'](_0x115ffa['shift']());}catch(_0x2286a5){_0x115ffa['push'](_0x115ffa['shift']());}}}(a17_0x3376,0x4b77d));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode,getEnvironment}from'../config/env.js';export async function listSqlQueries(_0x2ee518={}){const _0x13a491=a17_0x3e36,{appCode:appCode=getEnvAppCode(),cookie:_0x272fc9,keyword:_0x2bd6ba,category:_0x256174,sqlCode:_0x1bfdff,sqlName:_0x3b60ee,pageSize:pageSize=0x3e7,currentPage:currentPage=0x1}=_0x2ee518;if(!appCode)throw new Error(_0x13a491(0x1f3));const _0x3ecd8b=new DevApiClient({'appCode':appCode,'cookie':_0x272fc9}),_0x480f8a=getEnvironment();try{const _0x4b701c=await _0x3ecd8b[_0x13a491(0x1e3)]({'pageSize':pageSize,'currentPage':currentPage,'sqlCode':_0x1bfdff,'sqlName':_0x3b60ee}),_0x3d95ea=_0x4b701c['data']||_0x4b701c,_0x144923=_0x3d95ea['tableData']||[],_0x5a94b3=_0x3d95ea[_0x13a491(0x1f2)]||_0x144923[_0x13a491(0x1f5)];let _0x4a5dd0=_0x144923[_0x13a491(0x1cf)](_0x56fe16=>{const _0x23cb2b=_0x13a491,_0x387ecd=_0x56fe16[_0x23cb2b(0x1b6)]||appCode+'-'+(_0x56fe16[_0x23cb2b(0x1c8)]||_0x56fe16['id']),_0x183d86=_0x56fe16['sqlId']||_0x56fe16['id'];let _0x16347b;if(_0x56fe16[_0x23cb2b(0x1d0)]||_0x56fe16[_0x23cb2b(0x1d9)]){const _0x41caee=_0x56fe16[_0x23cb2b(0x1d0)]||_0x56fe16[_0x23cb2b(0x1d9)],_0x55a235=_0x41caee[_0x23cb2b(0x1d2)](/[:$]\{?(\w+)\}?/g);if(_0x55a235){const _0x5affac=Array[_0x23cb2b(0x1e6)](new Set(_0x55a235[_0x23cb2b(0x1cf)](_0x12a893=>_0x12a893[_0x23cb2b(0x1be)](/[:${}]/g,''))));_0x16347b=_0x5affac['map'](_0x2f7680=>{const _0x427129=_0x23cb2b;let _0x4bc5fe=_0x427129(0x1e5);if(_0x2f7680[_0x427129(0x1c5)]()[_0x427129(0x1df)](_0x427129(0x1cd))||_0x2f7680[_0x427129(0x1c5)]()[_0x427129(0x1df)](_0x427129(0x1b5)))_0x4bc5fe=_0x427129(0x1b9);else{if(_0x2f7680[_0x427129(0x1c5)]()[_0x427129(0x1df)]('id'))_0x4bc5fe=0x7b;else(_0x2f7680[_0x427129(0x1c5)]()[_0x427129(0x1df)](_0x427129(0x1ce))||_0x2f7680[_0x427129(0x1c5)]()[_0x427129(0x1df)](_0x427129(0x1bf)))&&(_0x4bc5fe=0xa);}return{'name':_0x2f7680,'type':'string','required':!![],'description':_0x427129(0x1ea)+_0x2f7680,'example':_0x4bc5fe};});}}const _0x56a2f1=_0x16347b&&_0x16347b[_0x23cb2b(0x1f5)]>0x0,_0x37fc50=_0x56a2f1?_0x16347b[_0x23cb2b(0x1b3)]((_0x53452b,_0x29a7bf)=>({..._0x53452b,[_0x29a7bf[_0x23cb2b(0x1b8)]]:_0x29a7bf[_0x23cb2b(0x1f1)]}),{}):undefined,_0x4bad58={'typescript':_0x23cb2b(0x1ed)+appCode+_0x23cb2b(0x1dc)+(_0x480f8a||_0x23cb2b(0x1e7))+'\x27,\x0a});\x0a\x0a//\x20Execute\x20the\x20SQL\x20query:\x20'+(_0x56fe16['sqlName']||_0x56fe16['name']||_0x23cb2b(0x1f4))+_0x23cb2b(0x1dd)+_0x387ecd+'\x27'+(_0x56a2f1?',\x20'+JSON[_0x23cb2b(0x1bc)](_0x37fc50,null,0x2):'')+');\x0a\x0a//\x20IMPORTANT:\x20Check\x20execution\x20status\x20before\x20using\x20results\x0aif\x20(!data.execSuccess)\x20{\x0a\x20\x20throw\x20new\x20Error(`SQL\x20execution\x20failed:\x20${data.execError\x20||\x20\x27Unknown\x20error\x27}`);\x0a}\x0a\x0a//\x20Process\x20the\x20results\x0aconst\x20results\x20=\x20data.execResult\x20||\x20[];\x0aconsole.log(`Retrieved\x20${results.length}\x20rows`);\x0a\x0a//\x20Use\x20the\x20data\x0aresults.forEach(row\x20=>\x20{\x0a\x20\x20console.log(row);\x0a});','description':'Execute\x20SQL\x20query:\x20'+(_0x56fe16[_0x23cb2b(0x1e9)]||_0x56fe16[_0x23cb2b(0x1b8)]||_0x23cb2b(0x1e2)),'important':[_0x23cb2b(0x1c1),'The\x20executeSql\x20method\x20accepts\x20two\x20parameters:\x20sqlCode\x20(string)\x20and\x20optional\x20params\x20(object)',_0x56a2f1?_0x23cb2b(0x1f0)+_0x16347b['map'](_0x30cf6f=>_0x30cf6f[_0x23cb2b(0x1b8)]+'\x20('+_0x30cf6f[_0x23cb2b(0x1eb)]+')')[_0x23cb2b(0x1c0)](',\x20'):_0x23cb2b(0x1c6),'On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20exception\x20-\x20use\x20try-catch\x20for\x20error\x20handling',_0x23cb2b(0x1ef)]},_0x4c3386={'sqlCode':_0x387ecd,'sqlId':_0x183d86,'name':_0x56fe16[_0x23cb2b(0x1e9)]||_0x56fe16['name']||_0x23cb2b(0x1da)+_0x183d86,'description':_0x56fe16[_0x23cb2b(0x1d1)]||_0x56fe16[_0x23cb2b(0x1cc)],'category':_0x56fe16['category']||_0x56fe16[_0x23cb2b(0x1ec)]||_0x23cb2b(0x1ca),'sqlContent':_0x56fe16[_0x23cb2b(0x1d0)]||_0x56fe16['sql'],'parameters':_0x16347b,'createdTime':_0x56fe16['createdTime']||_0x56fe16[_0x23cb2b(0x1bb)],'updatedTime':_0x56fe16['updatedTime']||_0x56fe16['updateTime'],'codeExample':_0x4bad58};return _0x4c3386;});if(_0x2bd6ba){const _0x52ef43=_0x2bd6ba[_0x13a491(0x1c5)]();_0x4a5dd0=_0x4a5dd0['filter'](_0x32f079=>_0x32f079[_0x13a491(0x1b8)][_0x13a491(0x1c5)]()[_0x13a491(0x1df)](_0x52ef43)||_0x32f079['description']&&_0x32f079[_0x13a491(0x1cc)]['toLowerCase']()[_0x13a491(0x1df)](_0x52ef43)||_0x32f079[_0x13a491(0x1b6)][_0x13a491(0x1c5)]()[_0x13a491(0x1df)](_0x52ef43)||_0x32f079[_0x13a491(0x1d0)]&&_0x32f079[_0x13a491(0x1d0)]['toLowerCase']()['includes'](_0x52ef43));}_0x256174&&_0x256174!=='all'&&(_0x4a5dd0=_0x4a5dd0[_0x13a491(0x1d7)](_0x5a9616=>_0x5a9616[_0x13a491(0x1c4)]&&_0x5a9616[_0x13a491(0x1c4)][_0x13a491(0x1c5)]()===_0x256174['toLowerCase']()));const _0x5d21cb=Math[_0x13a491(0x1c9)](_0x4a5dd0[_0x13a491(0x1f5)]/pageSize),_0x132520=_0x4a5dd0['slice']((currentPage-0x1)*pageSize,currentPage*pageSize),_0x26a10=_0x132520[_0x13a491(0x1f5)]>0x0?_0x132520[0x0]:null,_0x26f36f=_0x26a10?_0x13a491(0x1e8)+_0x26a10['name']+'\x22\x0aconst\x20data\x20=\x20await\x20client.api.executeSql(\x27'+_0x26a10[_0x13a491(0x1b6)]+'\x27);\x0aif\x20(!data.execSuccess)\x20{\x0a\x20\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);\x0a}\x0aconst\x20results\x20=\x20data.execResult\x20||\x20[];':'';return{'type':_0x13a491(0x1f6),'total':_0x4a5dd0['length'],'sqls':_0x132520,'pagination':{'currentPage':currentPage,'pageSize':pageSize,'totalPages':_0x5d21cb},'usage':{'description':_0x13a491(0x1d6)+_0x4a5dd0[_0x13a491(0x1f5)]+'\x20SQL\x20queries\x20for\x20application\x20'+appCode+_0x13a491(0x1bd),'important':[_0x13a491(0x1b7),_0x13a491(0x1c7),'IMPORTANT:\x20The\x20SDK\x20returns\x20{\x20execSuccess:\x20boolean,\x20execResult?:\x20any[],\x20execError?:\x20string\x20}',_0x13a491(0x1ee),_0x13a491(0x1ba),_0x13a491(0x1e1),_0x13a491(0x1b4)],'example':_0x26f36f||_0x13a491(0x1e4)}};}catch(_0x191150){throw new Error(_0x13a491(0x1c2)+_0x191150['message']);}}
@@ -1 +1 @@
1
- (function(_0x882bc9,_0x14087e){const _0x10a5f8=a18_0x421f,_0x54787e=_0x882bc9();while(!![]){try{const _0x18f5dd=parseInt(_0x10a5f8(0x1dd))/0x1*(parseInt(_0x10a5f8(0x1c8))/0x2)+-parseInt(_0x10a5f8(0x1d7))/0x3+parseInt(_0x10a5f8(0x1cd))/0x4+parseInt(_0x10a5f8(0x1ca))/0x5*(-parseInt(_0x10a5f8(0x1d5))/0x6)+parseInt(_0x10a5f8(0x1de))/0x7*(parseInt(_0x10a5f8(0x1d9))/0x8)+-parseInt(_0x10a5f8(0x1e6))/0x9*(-parseInt(_0x10a5f8(0x1db))/0xa)+-parseInt(_0x10a5f8(0x1e5))/0xb;if(_0x18f5dd===_0x14087e)break;else _0x54787e['push'](_0x54787e['shift']());}catch(_0x52fc9e){_0x54787e['push'](_0x54787e['shift']());}}}(a18_0x2975,0xc7d27));function a18_0x2975(){const _0x32a0df=['createServer','object','86avBupV','listen','5lfbleu','headers','cookie','3193928yPpodP','Login\x20timeout\x20-\x20no\x20response\x20received\x20within\x205\x20minutes','text/html;\x20charset=utf-8','writeHead','\x20environment','https://g.yuntooai.com/cert/lovrabet-dev.json','Internal\x20server\x20error','<!doctype\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>Login\x20Successful</title></head>\x0a<body>\x0a\x20\x20<div>Login\x20successful!\x20You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20your\x20vibe\x20editor.</div>\x0a\x20\x20<script>\x0a\x20\x20\x20\x20setTimeout(()\x20=>\x20{\x0a\x20\x20\x20\x20\x20\x20try\x20{\x20window.close();\x20}\x20catch(e)\x20{}\x0a\x20\x20\x20\x20},\x202000);\x0a\x20\x20</script>\x0a</body>\x0a</html>','1248138DhiTUy','Already\x20logged\x20in\x20to\x20','164403MpUbnn','json','10761832uFiDKz','/api/auth/get-session','170JnDENa','<!doctype\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>Login\x20Failed</title></head>\x0a<body>\x0a\x20\x20<div\x20style=\x22color:\x20red;\x22>\x0a\x20\x20\x20\x20<h2>Login\x20Successful,\x20but\x20Failed\x20to\x20Save\x20Cookie</h2>\x0a\x20\x20\x20\x20<p>Error:\x20','36435tLfreT','7rhBbOF','end','/sign-in?redirect=','127.0.0.1','</p>\x0a\x20\x20\x20\x20<p>Please\x20check\x20file\x20permissions\x20for\x20~/.lovrabet/cookie</p>\x0a\x20\x20</div>\x0a</body>\x0a</html>','Please\x20open\x20this\x20URL\x20in\x20your\x20browser\x20to\x20login:\x20','port','44319033suibzK','741114dcozxE','message','Failed\x20to\x20fetch\x20SSL\x20certificates\x20for\x20login\x20server','close','text/plain','Login\x20server\x20error:\x20','session','Login\x20successful\x20but\x20failed\x20to\x20save\x20cookie:\x20','user','https://dev.lovrabet.com:'];a18_0x2975=function(){return _0x32a0df;};return a18_0x2975();}import*as a18_0x1757da from'node:https';function a18_0x421f(_0x335ce3,_0x541094){_0x335ce3=_0x335ce3-0x1c4;const _0x29750f=a18_0x2975();let _0x421fff=_0x29750f[_0x335ce3];return _0x421fff;}import{saveCookie}from'../auth/cookie-manager.js';import{isSessionValid}from'../auth/session-validator.js';import{getUserDomain,getEnvironment}from'../config/env.js';export async function login(_0x385d81={}){const _0x103493=a18_0x421f,_0x38ba80=getEnvironment();if(await isSessionValid())return{'success':!![],'message':_0x103493(0x1d6)+_0x38ba80+_0x103493(0x1d1),'env':_0x38ba80};let _0x4b7814;try{const _0x2a9f00=await fetch(_0x103493(0x1d2));_0x4b7814=await _0x2a9f00[_0x103493(0x1d8)]();}catch(_0x4071cb){return{'success':![],'message':_0x103493(0x1e8),'env':_0x38ba80};}return new Promise(_0x3f3ba2=>{const _0x14876d=_0x103493;let _0x4d4a72=0x0;const _0xa96c7=a18_0x1757da[_0x14876d(0x1c6)](_0x4b7814,async(_0x4906d1,_0x3a1350)=>{const _0x188baa=_0x14876d,_0x179c5c=getUserDomain(),_0x174ddd=_0x4906d1[_0x188baa(0x1cb)][_0x188baa(0x1cc)]||'';try{const _0x4f9e9e=await fetch(_0x179c5c+_0x188baa(0x1da),{'headers':{'cookie':_0x174ddd}}),_0x598cbc=await _0x4f9e9e[_0x188baa(0x1d8)](),_0x26b5ab=_0x598cbc&&_0x598cbc[_0x188baa(0x1ec)]&&_0x598cbc[_0x188baa(0x1c4)];if(_0x26b5ab){try{saveCookie(_0x174ddd);}catch(_0x579240){const _0x4576a0=_0x188baa(0x1dc)+_0x579240[_0x188baa(0x1e7)]+_0x188baa(0x1e2);_0x3a1350[_0x188baa(0x1d0)](0x1f4,{'Content-Type':_0x188baa(0x1cf)}),_0x3a1350[_0x188baa(0x1df)](_0x4576a0),_0xa96c7['close'](),_0x3f3ba2({'success':![],'message':_0x188baa(0x1ed)+_0x579240[_0x188baa(0x1e7)],'env':_0x38ba80});return;}const _0x573f77=_0x188baa(0x1d4);_0x3a1350[_0x188baa(0x1d0)](0xc8,{'Content-Type':_0x188baa(0x1cf)}),_0x3a1350[_0x188baa(0x1df)](_0x573f77),_0xa96c7[_0x188baa(0x1e9)](),_0x3f3ba2({'success':!![],'message':'Successfully\x20logged\x20in\x20to\x20'+_0x38ba80+_0x188baa(0x1d1),'env':_0x38ba80});}else{const _0x41c49b=encodeURIComponent(_0x188baa(0x1c5)+_0x4d4a72);_0x3a1350[_0x188baa(0x1d0)](0x12e,{'location':_0x179c5c+_0x188baa(0x1e0)+_0x41c49b}),_0x3a1350[_0x188baa(0x1df)]();}}catch(_0x454bef){_0x3a1350['writeHead'](0x1f4,{'Content-Type':_0x188baa(0x1ea)}),_0x3a1350['end'](_0x188baa(0x1d3)),_0xa96c7['close'](),_0x3f3ba2({'success':![],'message':'Login\x20server\x20error','env':_0x38ba80});}});_0xa96c7[_0x14876d(0x1c9)](0x0,_0x14876d(0x1e1),()=>{const _0x23d618=_0x14876d,_0x2691c0=_0xa96c7['address']();_0x4d4a72=typeof _0x2691c0===_0x23d618(0x1c7)&&_0x2691c0?_0x2691c0[_0x23d618(0x1e4)]:0x0;const _0x1acd24='https://dev.lovrabet.com:'+_0x4d4a72;_0x3f3ba2({'success':![],'message':_0x23d618(0x1e3)+_0x1acd24,'loginUrl':_0x1acd24,'env':_0x38ba80});}),_0xa96c7['on']('error',_0x4666ed=>{const _0x19350c=_0x14876d;_0x3f3ba2({'success':![],'message':_0x19350c(0x1eb)+_0x4666ed[_0x19350c(0x1e7)],'env':_0x38ba80});}),setTimeout(()=>{const _0x4c8c84=_0x14876d;_0xa96c7[_0x4c8c84(0x1e9)](),_0x3f3ba2({'success':![],'message':_0x4c8c84(0x1ce),'env':_0x38ba80});},0x5*0x3c*0x3e8);});}
1
+ (function(_0x55a624,_0x8363b8){const _0x5d2664=a18_0x248e,_0xdd0fb0=_0x55a624();while(!![]){try{const _0x3f3d85=parseInt(_0x5d2664(0x17e))/0x1*(-parseInt(_0x5d2664(0x175))/0x2)+parseInt(_0x5d2664(0x17f))/0x3+-parseInt(_0x5d2664(0x186))/0x4*(-parseInt(_0x5d2664(0x185))/0x5)+-parseInt(_0x5d2664(0x168))/0x6+-parseInt(_0x5d2664(0x169))/0x7+-parseInt(_0x5d2664(0x171))/0x8*(parseInt(_0x5d2664(0x187))/0x9)+parseInt(_0x5d2664(0x17d))/0xa*(parseInt(_0x5d2664(0x17b))/0xb);if(_0x3f3d85===_0x8363b8)break;else _0xdd0fb0['push'](_0xdd0fb0['shift']());}catch(_0x690781){_0xdd0fb0['push'](_0xdd0fb0['shift']());}}}(a18_0x585a,0x8a98e));import*as a18_0x3c4254 from'node:https';import{saveCookie}from'../auth/cookie-manager.js';function a18_0x248e(_0x13820e,_0x3e5716){_0x13820e=_0x13820e-0x165;const _0x585a7c=a18_0x585a();let _0x248eb7=_0x585a7c[_0x13820e];return _0x248eb7;}import{isSessionValid}from'../auth/session-validator.js';import{getUserDomain,getEnvironment}from'../config/env.js';export async function login(_0x569572={}){const _0xb6fdc5=a18_0x248e,_0xe98544=getEnvironment();if(await isSessionValid())return{'success':!![],'message':_0xb6fdc5(0x173)+_0xe98544+_0xb6fdc5(0x16e),'env':_0xe98544};let _0x27d083;try{const _0x4b8422=await fetch(_0xb6fdc5(0x178));_0x27d083=await _0x4b8422[_0xb6fdc5(0x167)]();}catch(_0x3d409d){return{'success':![],'message':'Failed\x20to\x20fetch\x20SSL\x20certificates\x20for\x20login\x20server','env':_0xe98544};}return new Promise(_0x2ed97b=>{const _0x2b2970=_0xb6fdc5;let _0x18ecd8=0x0;const _0x2a36b5=a18_0x3c4254['createServer'](_0x27d083,async(_0x5ae109,_0x39faa2)=>{const _0x1d4d1a=a18_0x248e,_0x351c7b=getUserDomain(),_0x21af39=_0x5ae109[_0x1d4d1a(0x176)][_0x1d4d1a(0x16a)]||'';try{const _0x1da321=await fetch(_0x351c7b+_0x1d4d1a(0x16b),{'headers':{'cookie':_0x21af39}}),_0x527a0e=await _0x1da321['json'](),_0x2407e9=_0x527a0e&&_0x527a0e[_0x1d4d1a(0x180)]&&_0x527a0e[_0x1d4d1a(0x165)];if(_0x2407e9){try{saveCookie(_0x21af39);}catch(_0x3474db){const _0x315274=_0x1d4d1a(0x179)+_0x3474db['message']+'</p>\x0a\x20\x20\x20\x20<p>Please\x20check\x20file\x20permissions\x20for\x20~/.lovrabet/cookie</p>\x0a\x20\x20</div>\x0a</body>\x0a</html>';_0x39faa2[_0x1d4d1a(0x166)](0x1f4,{'Content-Type':_0x1d4d1a(0x181)}),_0x39faa2[_0x1d4d1a(0x183)](_0x315274),_0x2a36b5[_0x1d4d1a(0x182)](),_0x2ed97b({'success':![],'message':_0x1d4d1a(0x189)+_0x3474db['message'],'env':_0xe98544});return;}const _0x39fad4=_0x1d4d1a(0x174);_0x39faa2['writeHead'](0xc8,{'Content-Type':'text/html;\x20charset=utf-8'}),_0x39faa2[_0x1d4d1a(0x183)](_0x39fad4),_0x2a36b5['close'](),_0x2ed97b({'success':!![],'message':_0x1d4d1a(0x16d)+_0xe98544+_0x1d4d1a(0x16e),'env':_0xe98544});}else{const _0x3d8e5b=encodeURIComponent('https://dev.lovrabet.com:'+_0x18ecd8);_0x39faa2[_0x1d4d1a(0x166)](0x12e,{'location':_0x351c7b+'/sign-in?redirect='+_0x3d8e5b}),_0x39faa2['end']();}}catch(_0x27deec){_0x39faa2['writeHead'](0x1f4,{'Content-Type':'text/plain'}),_0x39faa2[_0x1d4d1a(0x183)](_0x1d4d1a(0x18a)),_0x2a36b5[_0x1d4d1a(0x182)](),_0x2ed97b({'success':![],'message':'Login\x20server\x20error','env':_0xe98544});}});_0x2a36b5[_0x2b2970(0x17c)](0x0,'127.0.0.1',()=>{const _0x21d988=_0x2b2970,_0x151aa6=_0x2a36b5['address']();_0x18ecd8=typeof _0x151aa6===_0x21d988(0x184)&&_0x151aa6?_0x151aa6[_0x21d988(0x172)]:0x0;const _0x39656f=_0x21d988(0x188)+_0x18ecd8;_0x2ed97b({'success':![],'message':_0x21d988(0x177)+_0x39656f,'loginUrl':_0x39656f,'env':_0xe98544});}),_0x2a36b5['on'](_0x2b2970(0x16c),_0x40569e=>{const _0x103fbf=_0x2b2970;_0x2ed97b({'success':![],'message':_0x103fbf(0x16f)+_0x40569e[_0x103fbf(0x17a)],'env':_0xe98544});}),setTimeout(()=>{const _0x1b4caa=_0x2b2970;_0x2a36b5[_0x1b4caa(0x182)](),_0x2ed97b({'success':![],'message':_0x1b4caa(0x170),'env':_0xe98544});},0x5*0x3c*0x3e8);});}function a18_0x585a(){const _0x1ae951=['10XRwzUy','1182648UgbIgT','45GzoWSr','https://dev.lovrabet.com:','Login\x20successful\x20but\x20failed\x20to\x20save\x20cookie:\x20','Internal\x20server\x20error','user','writeHead','json','3772872ZYFuZN','4423146gAdkCM','cookie','/api/auth/get-session','error','Successfully\x20logged\x20in\x20to\x20','\x20environment','Login\x20server\x20error:\x20','Login\x20timeout\x20-\x20no\x20response\x20received\x20within\x205\x20minutes','795784VUaYfW','port','Already\x20logged\x20in\x20to\x20','<!doctype\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>Login\x20Successful</title></head>\x0a<body>\x0a\x20\x20<div>Login\x20successful!\x20You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20your\x20vibe\x20editor.</div>\x0a\x20\x20<script>\x0a\x20\x20\x20\x20setTimeout(()\x20=>\x20{\x0a\x20\x20\x20\x20\x20\x20try\x20{\x20window.close();\x20}\x20catch(e)\x20{}\x0a\x20\x20\x20\x20},\x202000);\x0a\x20\x20</script>\x0a</body>\x0a</html>','802CXLUCz','headers','Please\x20open\x20this\x20URL\x20in\x20your\x20browser\x20to\x20login:\x20','https://g.yuntooai.com/cert/lovrabet-dev.json','<!doctype\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>Login\x20Failed</title></head>\x0a<body>\x0a\x20\x20<div\x20style=\x22color:\x20red;\x22>\x0a\x20\x20\x20\x20<h2>Login\x20Successful,\x20but\x20Failed\x20to\x20Save\x20Cookie</h2>\x0a\x20\x20\x20\x20<p>Error:\x20','message','1903gAdiFM','listen','42860LUZrjp','144AiNJrU','3152073xyUJks','session','text/html;\x20charset=utf-8','close','end','object'];a18_0x585a=function(){return _0x1ae951;};return a18_0x585a();}
@@ -1 +1 @@
1
- (function(_0x2c1857,_0x3a7506){const _0x435f03=a20_0x3951,_0xba31b9=_0x2c1857();while(!![]){try{const _0x13c689=-parseInt(_0x435f03(0x1f5))/0x1+-parseInt(_0x435f03(0x1d9))/0x2+parseInt(_0x435f03(0x1cb))/0x3+parseInt(_0x435f03(0x1f0))/0x4*(parseInt(_0x435f03(0x1c6))/0x5)+parseInt(_0x435f03(0x1df))/0x6*(parseInt(_0x435f03(0x1d1))/0x7)+-parseInt(_0x435f03(0x1c1))/0x8*(parseInt(_0x435f03(0x1dc))/0x9)+parseInt(_0x435f03(0x1ec))/0xa;if(_0x13c689===_0x3a7506)break;else _0xba31b9['push'](_0xba31b9['shift']());}catch(_0x32f86b){_0xba31b9['push'](_0xba31b9['shift']());}}}(a20_0x2809,0x208ca));import{DevApiClient}from'../api/dev-api-client.js';import{validateIsSelectOnly,parseSqlStructure,generateSqlSummary}from'../utils/sql-parser.js';function a20_0x3951(_0x191fc2,_0x2737d0){_0x191fc2=_0x191fc2-0x1be;const _0x2809cf=a20_0x2809();let _0x3951f4=_0x2809cf[_0x191fc2];return _0x3951f4;}import{getEnvAppCode,getEnvironment,shouldLog}from'../config/env.js';export async function saveOrUpdateCustomSql(_0x55a880){const _0xd60e69=a20_0x3951,_0x837122=Date[_0xd60e69(0x1e1)](),{appCode:appCode=getEnvAppCode(),cookie:_0x26489e,sqlName:_0x29ff6d,dbId:_0x370ad2,sqlContent:_0x307b70,id:_0x30cbd9,sqlCode:_0x1976fa,verifyAfterSave:verifyAfterSave=!![],validateSchema:validateSchema=![]}=_0x55a880;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');if(!_0x29ff6d||_0x29ff6d['trim']()==='')throw new Error('sqlName\x20is\x20required\x20and\x20cannot\x20be\x20empty.');if(!_0x370ad2)throw new Error(_0xd60e69(0x1c3));if(!_0x307b70||_0x307b70[_0xd60e69(0x1e6)]()==='')throw new Error(_0xd60e69(0x1c5));const _0x1931b6=_0x30cbd9!==undefined&&_0x30cbd9>0x0||_0x1976fa!==undefined&&_0x1976fa[_0xd60e69(0x1e6)]()!=='';if(_0x1931b6){if(!_0x30cbd9)throw new Error(_0xd60e69(0x1dd));if(!_0x1976fa)throw new Error(_0xd60e69(0x1c7));}const _0x45add9=validateIsSelectOnly(_0x307b70);if(!_0x45add9['valid'])throw new Error(_0xd60e69(0x1d0)+_0x45add9[_0xd60e69(0x1be)]);const _0x1106a1=parseSqlStructure(_0x307b70),_0x2a9c3b=generateSqlSummary(_0x307b70),_0x3db906=new DevApiClient({'appCode':appCode,'cookie':_0x26489e}),_0x201973=getEnvironment(),_0x1ad466=_0x29ff6d[_0xd60e69(0x1e6)]();let _0xb64561;_0x1931b6?_0xb64561=await _0x3db906[_0xd60e69(0x1ed)]({'id':_0x30cbd9,'sqlCode':_0x1976fa[_0xd60e69(0x1e6)](),'sqlName':_0x1ad466,'dbId':_0x370ad2,'sqlContent':_0x307b70['trim']()}):_0xb64561=await _0x3db906[_0xd60e69(0x1e4)]({'sqlName':_0x1ad466,'dbId':_0x370ad2,'sqlContent':_0x307b70[_0xd60e69(0x1e6)]()});const _0x110740=Date[_0xd60e69(0x1e1)]()-_0x837122;if(!_0xb64561['success'])return{'success':![],'action':_0x1931b6?_0xd60e69(0x1e9):'created','message':_0xb64561[_0xd60e69(0x1d2)]||_0xb64561['errorMsg']||_0xd60e69(0x1f6)+(_0x1931b6?'update':_0xd60e69(0x1ee))+'\x20custom\x20SQL','nextSteps':[{'action':_0xd60e69(0x1d8),'tool':'login','reason':_0xd60e69(0x1c0)},{'action':_0xd60e69(0x1d7),'tool':_0xd60e69(0x1c4),'params':{'datasetCode':'<dataset-code>'},'reason':_0xd60e69(0x1f7)}]};const _0x47b5aa=_0xb64561[_0xd60e69(0x1cc)]?.[_0xd60e69(0x1e7)]||_0xb64561[_0xd60e69(0x1cc)]?.[_0xd60e69(0x1d4)],_0x3055aa=_0xb64561[_0xd60e69(0x1cc)]?.['sqlId']||_0xb64561[_0xd60e69(0x1cc)]?.['id'],_0x237ddf=[{'action':_0xd60e69(0x1d3),'tool':_0xd60e69(0x1ce),'params':{'sqlCode':_0x47b5aa||''},'reason':_0xd60e69(0x1f1),'priority':_0xd60e69(0x1c9)},{'action':'Generate\x20SDK\x20code\x20for\x20this\x20SQL','tool':_0xd60e69(0x1e5),'params':{'sqlCode':_0x47b5aa||''},'reason':_0xd60e69(0x1da),'priority':_0xd60e69(0x1e3)}],_0x3cbafe={'success':!![],'action':_0x1931b6?_0xd60e69(0x1e9):_0xd60e69(0x1f4),'message':_0x1931b6?_0xd60e69(0x1ea)+_0x1ad466+'\x22\x20updated\x20successfully\x20('+_0x2a9c3b+')':_0xd60e69(0x1ea)+_0x1ad466+'\x22\x20saved\x20successfully\x20('+_0x2a9c3b+')','nextSteps':_0x237ddf,'parsedStructure':{'tables':_0x1106a1[_0xd60e69(0x1f3)],'columns':_0x1106a1[_0xd60e69(0x1ef)][_0xd60e69(0x1eb)],'parameters':_0x1106a1[_0xd60e69(0x1cd)],'summary':_0x2a9c3b},'data':_0xb64561[_0xd60e69(0x1cc)]};if(verifyAfterSave)try{const _0x443313=await _0x3db906[_0xd60e69(0x1f9)]({'pageSize':0xa,'currentPage':0x1,'sqlName':_0x1ad466}),_0x15cb2e=_0x443313['data']?.['tableData']||[],_0x49495d=_0x15cb2e[_0xd60e69(0x1ca)](_0x42e6b7=>_0x42e6b7[_0xd60e69(0x1f2)]===_0x1ad466||_0x42e6b7[_0xd60e69(0x1de)]===_0x1ad466);_0x49495d?(_0x3cbafe['verified']={'found':!![],'sqlInfo':{'sqlCode':_0x49495d[_0xd60e69(0x1e7)]||appCode+'-'+(_0x49495d[_0xd60e69(0x1cf)]||_0x49495d['id']),'sqlId':_0x49495d[_0xd60e69(0x1cf)]||_0x49495d['id'],'id':_0x49495d['id'],'name':_0x49495d[_0xd60e69(0x1f2)]||_0x49495d['name'],'sqlContent':_0x49495d[_0xd60e69(0x1c2)]||_0x49495d[_0xd60e69(0x1c8)],'createdTime':_0x49495d[_0xd60e69(0x1e0)]||_0x49495d[_0xd60e69(0x1e8)],'updatedTime':_0x49495d['updatedTime']||_0x49495d[_0xd60e69(0x1d5)]}},_0x3cbafe[_0xd60e69(0x1d6)][_0xd60e69(0x1bf)]?.[_0xd60e69(0x1e7)]&&(_0x237ddf[0x0][_0xd60e69(0x1f8)]={'sqlCode':_0x3cbafe[_0xd60e69(0x1d6)][_0xd60e69(0x1bf)]['sqlCode']},_0x237ddf[0x1][_0xd60e69(0x1f8)]={'sqlCode':_0x3cbafe['verified'][_0xd60e69(0x1bf)][_0xd60e69(0x1e7)]})):_0x3cbafe[_0xd60e69(0x1d6)]={'found':![]};}catch(_0xab581c){shouldLog()&&console[_0xd60e69(0x1db)](_0xd60e69(0x1e2),_0xab581c),_0x3cbafe[_0xd60e69(0x1d6)]={'found':![]};}return _0x3cbafe;}function a20_0x2809(){const _0x28feb6=['length','2683100iMBKGV','updateUserCustomSql','save','columns','651432CvUicL','Execute\x20the\x20SQL\x20to\x20check\x20for\x20runtime\x20errors','sqlName','tables','created','184172JNNCvr','Failed\x20to\x20','Confirm\x20the\x20dbId\x20matches\x20the\x20database\x20you\x20want\x20to\x20use','params','getCustomSqlList','reason','sqlInfo','Ensure\x20you\x20are\x20logged\x20in\x20with\x20proper\x20permissions','648nPlCPY','sqlContent','dbId\x20is\x20required.\x20Get\x20it\x20from\x20get_dataset_detail\x20->\x20basic.database.dbId','get_dataset_detail','sqlContent\x20is\x20required\x20and\x20cannot\x20be\x20empty.','5KpSfUX','sqlCode\x20is\x20required\x20for\x20updating\x20existing\x20SQL.','sql','high','find','13857TJvNNK','data','parameters','execute_custom_sql','sqlId','SQL\x20validation\x20failed:\x20','7JtDwKP','message','Test\x20the\x20SQL\x20to\x20verify\x20it\x20works\x20correctly','code','updateTime','verified','Verify\x20database\x20ID\x20is\x20correct','Check\x20database\x20connection\x20and\x20permissions','53194WrmbJq','Get\x20ready-to-use\x20TypeScript\x20code\x20for\x20your\x20application','warn','21519bVusuE','id\x20is\x20required\x20for\x20updating\x20existing\x20SQL.','name','611850ghXJOd','createdTime','now','[saveOrUpdateCustomSql]\x20Verification\x20query\x20failed:','medium','saveUserCustomSql','generate_sql_code','trim','sqlCode','createTime','updated','Custom\x20SQL\x20\x22'];a20_0x2809=function(){return _0x28feb6;};return a20_0x2809();}
1
+ (function(_0xef28e4,_0xa2e6ea){const _0x29cf3a=a19_0x29c4,_0x34975a=_0xef28e4();while(!![]){try{const _0x17045c=-parseInt(_0x29cf3a(0xb8))/0x1*(-parseInt(_0x29cf3a(0xc2))/0x2)+parseInt(_0x29cf3a(0xb5))/0x3*(-parseInt(_0x29cf3a(0xbc))/0x4)+-parseInt(_0x29cf3a(0x8f))/0x5+-parseInt(_0x29cf3a(0xb4))/0x6*(-parseInt(_0x29cf3a(0xa0))/0x7)+-parseInt(_0x29cf3a(0x8c))/0x8*(-parseInt(_0x29cf3a(0x7d))/0x9)+-parseInt(_0x29cf3a(0x9c))/0xa+-parseInt(_0x29cf3a(0x83))/0xb*(-parseInt(_0x29cf3a(0xae))/0xc);if(_0x17045c===_0xa2e6ea)break;else _0x34975a['push'](_0x34975a['shift']());}catch(_0xd9dc98){_0x34975a['push'](_0x34975a['shift']());}}}(a19_0x44fc,0xd9f4f));import{DevApiClient}from'../api/dev-api-client.js';function a19_0x44fc(){const _0x83b189=['getCustomSqlList','saveUserCustomSql','873028QNYgjg','Ensure\x20you\x20are\x20logged\x20in\x20with\x20proper\x20permissions','Confirm\x20the\x20dbId\x20matches\x20the\x20database\x20you\x20want\x20to\x20use','isSelectOnly','sql','\x22\x20保存被阻止:\x20','495202YyNAOv','length','data','351NBZMyT','sqlSave','sqlName\x20is\x20required\x20and\x20cannot\x20be\x20empty.','parameters','Test\x20the\x20SQL\x20to\x20verify\x20it\x20works\x20correctly','sqlInfo','12232XKvDfB','将此\x20SQL\x20保存到本地文件(手动导入到\x20Lovrabet\x20平台)','\x20语句,不会自动保存到\x20Lovrabet\x20平台','now','find','success','\x20语句(会修改数据/结构),为安全起见不会自动保存到\x20Lovrabet\x20平台','errorMsg','修改\x20SQL\x20为\x20SELECT\x20查询','365272fnQMtn','verified','update','7625180GMlyJa','name','Custom\x20SQL\x20\x22','Execute\x20the\x20SQL\x20to\x20check\x20for\x20runtime\x20errors','检测到\x20','type','Verify\x20database\x20ID\x20is\x20correct','save','params','createdTime','updateTime','sqlName','\x22\x20saved\x20successfully\x20(','10790800PQOCyJ','SQL\x20\x22','trim','id\x20is\x20required\x20for\x20updating\x20existing\x20SQL.','14NhpPUA','⚠️\x20检测到\x20','使用文件写入工具将\x20SQL\x20保存到本地,然后登录\x20Lovrabet\x20平台手动导入','columns','sqlCode','medium','isDangerous','warn','get_dataset_detail','如果只需要查询数据,请使用\x20SELECT\x20语句','updated','Check\x20database\x20connection\x20and\x20permissions','tables','code','10356viQOjr','updateUserCustomSql','sqlId','created','dbId\x20is\x20required.\x20Get\x20it\x20from\x20get_dataset_detail\x20->\x20basic.database.dbId','[saveOrUpdateCustomSql]\x20Verification\x20query\x20failed:','2093466OevFrD','6tDKMfC','throttle','sqlContent','2MjiRqb','Get\x20ready-to-use\x20TypeScript\x20code\x20for\x20your\x20application'];a19_0x44fc=function(){return _0x83b189;};return a19_0x44fc();}import{detectSqlType,parseSqlStructure,generateSqlSummary}from'../utils/sql-parser.js';function a19_0x29c4(_0xbfebce,_0x2f41c7){_0xbfebce=_0xbfebce-0x7d;const _0x44fcb3=a19_0x44fc();let _0x29c4e5=_0x44fcb3[_0xbfebce];return _0x29c4e5;}import{getEnvAppCode,getEnvironment,shouldLog}from'../config/env.js';import{rateLimiters}from'../utils/rate-limiter.js';export async function saveOrUpdateCustomSql(_0x130c04){const _0x407a3a=a19_0x29c4,_0x239342=Date[_0x407a3a(0x86)](),{appCode:appCode=getEnvAppCode(),cookie:_0x59637f,sqlName:_0x51e36b,dbId:_0x426f99,sqlContent:_0x4edf49,id:_0x271d27,verifyAfterSave:verifyAfterSave=!![],validateSchema:validateSchema=![]}=_0x130c04;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');if(!_0x51e36b||_0x51e36b[_0x407a3a(0x9e)]()==='')throw new Error(_0x407a3a(0x7f));if(!_0x426f99)throw new Error(_0x407a3a(0xb2));if(!_0x4edf49||_0x4edf49[_0x407a3a(0x9e)]()==='')throw new Error('sqlContent\x20is\x20required\x20and\x20cannot\x20be\x20empty.');const _0x2aa5ef=_0x271d27!==undefined&&_0x271d27>0x0;if(_0x2aa5ef&&!_0x271d27)throw new Error(_0x407a3a(0x9f));const _0x231859=detectSqlType(_0x4edf49),_0x4be9f5=parseSqlStructure(_0x4edf49),_0x1f73c2=generateSqlSummary(_0x4edf49),_0x5b2b19=_0x51e36b[_0x407a3a(0x9e)]();if(!_0x231859[_0x407a3a(0xbf)]){const _0x1932e0=_0x231859[_0x407a3a(0xa6)]?_0x407a3a(0xa1)+_0x231859[_0x407a3a(0x94)]+_0x407a3a(0x89):_0x407a3a(0x93)+_0x231859[_0x407a3a(0x94)]+_0x407a3a(0x85);return{'success':![],'action':'blocked','message':_0x407a3a(0x9d)+_0x5b2b19+_0x407a3a(0xc1)+_0x1932e0,'nextSteps':[{'action':_0x407a3a(0x84),'reason':_0x407a3a(0xa2),'priority':'high'},{'action':_0x407a3a(0x8b),'reason':_0x407a3a(0xa9),'priority':_0x407a3a(0xa5)}],'parsedStructure':{'tables':_0x4be9f5[_0x407a3a(0xac)],'columns':_0x4be9f5['columns']['length'],'parameters':_0x4be9f5[_0x407a3a(0x80)],'summary':_0x1f73c2},'sqlType':{'type':_0x231859[_0x407a3a(0x94)],'isSelectOnly':![],'isDangerous':_0x231859['isDangerous'],'warning':_0x1932e0}};}const _0x4a2201=new DevApiClient({'appCode':appCode,'cookie':_0x59637f}),_0x46dcf7=getEnvironment();let _0x3bc94d;_0x2aa5ef?_0x3bc94d=await rateLimiters[_0x407a3a(0x7e)][_0x407a3a(0xb6)](()=>_0x4a2201[_0x407a3a(0xaf)]({'id':_0x271d27,'sqlName':_0x5b2b19,'dbId':_0x426f99,'sqlContent':_0x4edf49[_0x407a3a(0x9e)]()})):_0x3bc94d=await rateLimiters[_0x407a3a(0x7e)][_0x407a3a(0xb6)](()=>_0x4a2201[_0x407a3a(0xbb)]({'sqlName':_0x5b2b19,'dbId':_0x426f99,'sqlContent':_0x4edf49[_0x407a3a(0x9e)]()}));const _0x513c0c=Date['now']()-_0x239342;if(!_0x3bc94d[_0x407a3a(0x88)])return{'success':![],'action':_0x2aa5ef?_0x407a3a(0xaa):_0x407a3a(0xb1),'message':_0x3bc94d['message']||_0x3bc94d[_0x407a3a(0x8a)]||'Failed\x20to\x20'+(_0x2aa5ef?_0x407a3a(0x8e):_0x407a3a(0x96))+'\x20custom\x20SQL','nextSteps':[{'action':_0x407a3a(0xab),'tool':'login','reason':_0x407a3a(0xbd)},{'action':_0x407a3a(0x95),'tool':_0x407a3a(0xa8),'params':{'datasetCode':'<dataset-code>'},'reason':_0x407a3a(0xbe)}],'sqlType':{'type':_0x231859[_0x407a3a(0x94)],'isSelectOnly':!![],'isDangerous':![]}};const _0xc04c5f=_0x3bc94d['data']?.['sqlCode']||_0x3bc94d[_0x407a3a(0xc4)]?.[_0x407a3a(0xad)],_0x21ede4=_0x3bc94d[_0x407a3a(0xc4)]?.['sqlId']||_0x3bc94d[_0x407a3a(0xc4)]?.['id'],_0x5810d2=[{'action':_0x407a3a(0x81),'tool':'execute_custom_sql','params':{'sqlCode':_0xc04c5f||''},'reason':_0x407a3a(0x92),'priority':'high'},{'action':'Generate\x20SDK\x20code\x20for\x20this\x20SQL','tool':'generate_sql_code','params':{'sqlCode':_0xc04c5f||''},'reason':_0x407a3a(0xb9),'priority':'medium'}],_0x2b3cf8={'success':!![],'action':_0x2aa5ef?'updated':'created','message':_0x2aa5ef?_0x407a3a(0x91)+_0x5b2b19+'\x22\x20updated\x20successfully\x20('+_0x1f73c2+')':_0x407a3a(0x91)+_0x5b2b19+_0x407a3a(0x9b)+_0x1f73c2+')','nextSteps':_0x5810d2,'parsedStructure':{'tables':_0x4be9f5[_0x407a3a(0xac)],'columns':_0x4be9f5[_0x407a3a(0xa3)][_0x407a3a(0xc3)],'parameters':_0x4be9f5[_0x407a3a(0x80)],'summary':_0x1f73c2},'sqlType':{'type':_0x231859[_0x407a3a(0x94)],'isSelectOnly':!![],'isDangerous':![]},'data':_0x3bc94d['data']};if(verifyAfterSave)try{const _0x3ccb3f=await _0x4a2201[_0x407a3a(0xba)]({'pageSize':0xa,'currentPage':0x1,'sqlName':_0x5b2b19}),_0x39031f=_0x3ccb3f[_0x407a3a(0xc4)]?.['tableData']||[],_0x360f22=_0x39031f[_0x407a3a(0x87)](_0x7a31dd=>_0x7a31dd[_0x407a3a(0x9a)]===_0x5b2b19||_0x7a31dd[_0x407a3a(0x90)]===_0x5b2b19);_0x360f22?(_0x2b3cf8[_0x407a3a(0x8d)]={'found':!![],'sqlInfo':{'sqlCode':_0x360f22[_0x407a3a(0xa4)]||appCode+'-'+(_0x360f22['sqlId']||_0x360f22['id']),'sqlId':_0x360f22[_0x407a3a(0xb0)]||_0x360f22['id'],'id':_0x360f22['id'],'name':_0x360f22[_0x407a3a(0x9a)]||_0x360f22['name'],'sqlContent':_0x360f22[_0x407a3a(0xb7)]||_0x360f22[_0x407a3a(0xc0)],'createdTime':_0x360f22[_0x407a3a(0x98)]||_0x360f22['createTime'],'updatedTime':_0x360f22['updatedTime']||_0x360f22[_0x407a3a(0x99)]}},_0x2b3cf8[_0x407a3a(0x8d)]['sqlInfo']?.[_0x407a3a(0xa4)]&&(_0x5810d2[0x0][_0x407a3a(0x97)]={'sqlCode':_0x2b3cf8[_0x407a3a(0x8d)][_0x407a3a(0x82)][_0x407a3a(0xa4)]},_0x5810d2[0x1]['params']={'sqlCode':_0x2b3cf8[_0x407a3a(0x8d)]['sqlInfo']['sqlCode']})):_0x2b3cf8[_0x407a3a(0x8d)]={'found':![]};}catch(_0x3a4407){shouldLog()&&console[_0x407a3a(0xa7)](_0x407a3a(0xb3),_0x3a4407),_0x2b3cf8[_0x407a3a(0x8d)]={'found':![]};}return _0x2b3cf8;}
@@ -1 +1 @@
1
- (function(_0xfd006c,_0x2b0e17){const _0x5cf1cc=a21_0x5e0c,_0x37a6ca=_0xfd006c();while(!![]){try{const _0x390f08=parseInt(_0x5cf1cc(0xaa))/0x1*(-parseInt(_0x5cf1cc(0xae))/0x2)+parseInt(_0x5cf1cc(0x9e))/0x3*(-parseInt(_0x5cf1cc(0xa1))/0x4)+parseInt(_0x5cf1cc(0xa3))/0x5*(parseInt(_0x5cf1cc(0xa6))/0x6)+-parseInt(_0x5cf1cc(0xb0))/0x7*(-parseInt(_0x5cf1cc(0xa4))/0x8)+parseInt(_0x5cf1cc(0xa5))/0x9+parseInt(_0x5cf1cc(0xa8))/0xa*(parseInt(_0x5cf1cc(0x9c))/0xb)+-parseInt(_0x5cf1cc(0xad))/0xc;if(_0x390f08===_0x2b0e17)break;else _0x37a6ca['push'](_0x37a6ca['shift']());}catch(_0x7698dc){_0x37a6ca['push'](_0x37a6ca['shift']());}}}(a21_0x1426,0x4ef4d));import{DevApiClient}from'../api/dev-api-client.js';function a21_0x1426(){const _0x4a0112=['1215isKyli','tableName','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','1711296duTFkG','910GWvjAk','datasets','154HmDXPO','2750NORhaZ','code','158988cRexXq','analyzeDatasetList','keyword\x20is\x20required','8hXyJaE','name','10PDFKxc','58416hYnivc','836442pavlHy','1356744FcVqOX','total','16760WbTiGG','searchDatasets'];a21_0x1426=function(){return _0x4a0112;};return a21_0x1426();}import{DatasetAnalyzer}from'../analyzer/dataset-analyzer.js';function a21_0x5e0c(_0x56021a,_0x369e82){_0x56021a=_0x56021a-0x9c;const _0x14260d=a21_0x1426();let _0x5e0c86=_0x14260d[_0x56021a];return _0x5e0c86;}import{getEnvAppCode,getEnvironment}from'../config/env.js';export async function searchDatasets(_0x7a9bca){const _0x20107d=a21_0x5e0c,{appCode:appCode=getEnvAppCode(),cookie:_0x4ad942,keyword:_0x56103f}=_0x7a9bca;if(!appCode)throw new Error(_0x20107d(0xac));if(!_0x56103f)throw new Error(_0x20107d(0xa0));const _0xb7634e=new DevApiClient({'appCode':appCode,'cookie':_0x4ad942}),_0x9b7d31=getEnvironment(),_0x380a2c=await _0xb7634e[_0x20107d(0xa9)](_0x56103f),_0x2b7b21=new DatasetAnalyzer(),_0x57fb20=_0x2b7b21[_0x20107d(0x9f)](_0x380a2c);return{'appCode':appCode,'env':_0x9b7d31,'keyword':_0x56103f,'total':_0x57fb20[_0x20107d(0xa7)],'datasets':_0x57fb20[_0x20107d(0xaf)]['map'](_0x213e99=>({'id':_0x213e99['id'],'name':_0x213e99[_0x20107d(0xa2)],'code':_0x213e99[_0x20107d(0x9d)],'tableName':_0x213e99[_0x20107d(0xab)],'description':_0x213e99['description']}))};}
1
+ function a20_0x17d4(_0x4c6aa7,_0x303844){_0x4c6aa7=_0x4c6aa7-0x6b;const _0x636484=a20_0x6364();let _0x17d40b=_0x636484[_0x4c6aa7];return _0x17d40b;}function a20_0x6364(){const _0x33a8a7=['224gsFJXK','total','tableName','39WkoDZf','searchDatasets','57312ffmFFb','map','696015VVxUvU','979479tBKfic','80elmTip','14QoYxZO','18714290tgOdWN','name','2651rSPpGy','2432505ZiSxKq','14316MMdAph','code','2XyfjrW','96912glowiw','6WEAMEG'];a20_0x6364=function(){return _0x33a8a7;};return a20_0x6364();}(function(_0x5eeaee,_0xc02481){const _0x3048b6=a20_0x17d4,_0x157912=_0x5eeaee();while(!![]){try{const _0x3fced9=parseInt(_0x3048b6(0x6f))/0x1*(-parseInt(_0x3048b6(0x79))/0x2)+parseInt(_0x3048b6(0x6d))/0x3*(-parseInt(_0x3048b6(0x7c))/0x4)+parseInt(_0x3048b6(0x76))/0x5*(-parseInt(_0x3048b6(0x7b))/0x6)+parseInt(_0x3048b6(0x72))/0x7*(-parseInt(_0x3048b6(0x7a))/0x8)+-parseInt(_0x3048b6(0x70))/0x9*(parseInt(_0x3048b6(0x71))/0xa)+parseInt(_0x3048b6(0x75))/0xb*(-parseInt(_0x3048b6(0x77))/0xc)+parseInt(_0x3048b6(0x6b))/0xd*(parseInt(_0x3048b6(0x73))/0xe);if(_0x3fced9===_0xc02481)break;else _0x157912['push'](_0x157912['shift']());}catch(_0x1784ab){_0x157912['push'](_0x157912['shift']());}}}(a20_0x6364,0x8c7f4));import{DevApiClient}from'../api/dev-api-client.js';import{DatasetAnalyzer}from'../analyzer/dataset-analyzer.js';import{getEnvAppCode,getEnvironment}from'../config/env.js';export async function searchDatasets(_0x3cd806){const _0x3f05c8=a20_0x17d4,{appCode:appCode=getEnvAppCode(),cookie:_0x1a4a9f,keyword:_0x558fc1}=_0x3cd806;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');if(!_0x558fc1)throw new Error('keyword\x20is\x20required');const _0x41fef1=new DevApiClient({'appCode':appCode,'cookie':_0x1a4a9f}),_0x3c840c=getEnvironment(),_0x60eae0=await _0x41fef1[_0x3f05c8(0x6c)](_0x558fc1),_0x294a49=new DatasetAnalyzer(),_0x4b201f=_0x294a49['analyzeDatasetList'](_0x60eae0);return{'appCode':appCode,'env':_0x3c840c,'keyword':_0x558fc1,'total':_0x4b201f[_0x3f05c8(0x7d)],'datasets':_0x4b201f['datasets'][_0x3f05c8(0x6e)](_0x5e91c8=>({'id':_0x5e91c8['id'],'name':_0x5e91c8[_0x3f05c8(0x74)],'code':_0x5e91c8[_0x3f05c8(0x78)],'tableName':_0x5e91c8[_0x3f05c8(0x7e)],'description':_0x5e91c8['description']}))};}
@@ -1 +1 @@
1
- function a22_0x42e3(){const _0x548071=['find','<dataset-code>','Need\x20dbId\x20from\x20dataset\x20detail\x20to\x20save\x20SQL','List\x20all\x20available\x20datasets','413bmxROc','typeLabel','Review\x20SQL\x20errors\x20and\x20fix','type','get_dataset_detail','Save\x20this\x20validated\x20SQL','[validateSqlContent]\x20Failed\x20to\x20fetch\x20schema\x20for\x20','length','push','SQL\x20validation\x20failed:\x20','Modify\x20SQL\x20to\x20be\x20a\x20SELECT\x20statement\x20only','TABLE_NOT_FOUND','code','data','490740BRBZxJ','SQL\x20validation\x20failed\x20(','error','getDatasetList','SQL\x20must\x20be\x20a\x20SELECT\x20statement','high','properties','612909lYeCEo','SQL\x20content\x20cannot\x20be\x20empty','Invalid\x20SQL','531BnJIHK','SQL\x20content\x20is\x20required','valid','<sql-name>','99726lJuetd','validate_sql_content','fixSteps','Find\x20the\x20correct\x20table\x20names\x20for\x20your\x20SQL','map','errors','warn','1516158hKSgLu','58744UcUTsZ','save_or_update_custom_sql','\x20error(s))','Provide\x20SQL\x20content\x20to\x20validate','SYNTAX_ERROR','1946892UZSxQz','tableName','trim','1537630EyPPZU','medium','reason','nextSteps','Only\x20SELECT\x20queries\x20are\x20allowed\x20for\x20custom\x20SQL','fieldCode','SQL_START','Get\x20dataset\x20details\x20to\x20find\x20correct\x20table/column\x20names','15ccFDkE','Fix\x20the\x20identified\x20errors\x20before\x20saving','some','tableData','SELECT\x20id,\x20name\x20FROM\x20customer\x20WHERE\x20status\x20=\x201'];a22_0x42e3=function(){return _0x548071;};return a22_0x42e3();}(function(_0x3afd70,_0x2256e0){const _0x1d14ad=a22_0x45dd,_0x9789cf=_0x3afd70();while(!![]){try{const _0x1d99de=-parseInt(_0x1d14ad(0x12e))/0x1+parseInt(_0x1d14ad(0x134))/0x2+-parseInt(_0x1d14ad(0x120))/0x3+-parseInt(_0x1d14ad(0x119))/0x4*(-parseInt(_0x1d14ad(0x102))/0x5)+parseInt(_0x1d14ad(0x127))/0x6*(parseInt(_0x1d14ad(0x10b))/0x7)+parseInt(_0x1d14ad(0x12f))/0x8*(parseInt(_0x1d14ad(0x123))/0x9)+-parseInt(_0x1d14ad(0x137))/0xa;if(_0x1d99de===_0x2256e0)break;else _0x9789cf['push'](_0x9789cf['shift']());}catch(_0x26265b){_0x9789cf['push'](_0x9789cf['shift']());}}}(a22_0x42e3,0xd7201));import{DevApiClient}from'../api/dev-api-client.js';import{validateIsSelectOnly,parseSqlStructure,validateSqlContent as a22_0x50be68,generateSqlSummary}from'../utils/sql-parser.js';import{createStructuredSqlError}from'../types/mcp-types.js';import{getEnvAppCode,shouldLog}from'../config/env.js';function a22_0x45dd(_0x179236,_0x291365){_0x179236=_0x179236-0xfb;const _0x42e302=a22_0x42e3();let _0x45ddfe=_0x42e302[_0x179236];return _0x45ddfe;}async function fetchSchemaInfo(_0x5439ba,_0x491c66){const _0x470607=a22_0x45dd,_0x528e68=[];for(const _0x1c765b of _0x5439ba){try{const _0x5af603=/^\d+$/['test'](_0x1c765b);let _0x342f95=_0x1c765b;if(!_0x5af603){const _0x5a81ff=await _0x491c66[_0x470607(0x11c)](),_0x5b6885=_0x5a81ff[_0x470607(0x118)]?.[_0x470607(0x105)]||[],_0x394a16=_0x5b6885[_0x470607(0x107)](_0x5edd1e=>_0x5edd1e[_0x470607(0x117)]===_0x1c765b);if(!_0x394a16)continue;_0x342f95=String(_0x394a16['id']);}const _0x3efa75=await _0x491c66['getDatasetDetail'](_0x342f95),_0x51ef99=_0x3efa75[_0x470607(0x118)]?.[_0x470607(0x135)]||'',_0xa9245b=_0x3efa75[_0x470607(0x118)]?.[_0x470607(0x11f)]||[],_0x75b613=_0xa9245b[_0x470607(0x12b)](_0x6173f4=>_0x6173f4[_0x470607(0x117)]||_0x6173f4[_0x470607(0xff)]);_0x51ef99&&_0x75b613[_0x470607(0x112)]>0x0&&_0x528e68['push']({'tableName':_0x51ef99,'columns':_0x75b613});}catch(_0x4525cf){shouldLog()&&console[_0x470607(0x12d)](_0x470607(0x111)+_0x1c765b+':',_0x4525cf);}}return _0x528e68;}export async function validateSqlContentTool(_0x45cd79){const _0xdb868d=a22_0x45dd,{appCode:appCode=getEnvAppCode(),cookie:_0xc7130b,sqlContent:_0x3f72de,dbId:_0x35e37d,validateSchemas:validateSchemas=[]}=_0x45cd79;if(!_0x3f72de||_0x3f72de[_0xdb868d(0x136)]()==='')return{'success':![],'message':_0xdb868d(0x124),'validation':{'valid':![],'isSelectOnly':![]},'nextSteps':[{'action':_0xdb868d(0x132),'tool':_0xdb868d(0x128),'reason':_0xdb868d(0x121)}]};const _0xadf795=validateIsSelectOnly(_0x3f72de);if(!_0xadf795['valid'])return{'success':![],'message':_0xdb868d(0x114)+_0xadf795['reason'],'validation':{'valid':![],'isSelectOnly':![],'errors':[createStructuredSqlError({'type':_0xdb868d(0x133),'location':_0xdb868d(0x100),'message':_0xadf795[_0xdb868d(0xfc)]||_0xdb868d(0x122),'severity':_0xdb868d(0x11b),'fixSteps':[{'description':_0xdb868d(0x11d),'example':_0xdb868d(0x106)}]})]},'nextSteps':[{'action':_0xdb868d(0x115),'tool':_0xdb868d(0x130),'reason':_0xdb868d(0xfe)}]};const _0x2b3e21=parseSqlStructure(_0x3f72de),_0x52eb47=generateSqlSummary(_0x3f72de);let _0x4fc6c0;if(validateSchemas[_0xdb868d(0x112)]>0x0&&appCode){const _0x46c351=new DevApiClient({'appCode':appCode,'cookie':_0xc7130b});_0x4fc6c0=await fetchSchemaInfo(validateSchemas,_0x46c351);}const _0x1ec31d=a22_0x50be68(_0x3f72de,_0x4fc6c0?{'tables':_0x4fc6c0}:undefined),_0x522367={'success':_0x1ec31d['valid']||!![],'message':_0x1ec31d[_0xdb868d(0x125)]?'SQL\x20validation\x20passed\x20('+_0x52eb47+')':_0xdb868d(0x11a)+(_0x1ec31d[_0xdb868d(0x12c)]?.[_0xdb868d(0x112)]||0x0)+_0xdb868d(0x131),'validation':{..._0x1ec31d,'parsedStructure':_0x2b3e21}},_0x38dc93=[];if(_0x1ec31d[_0xdb868d(0x125)])_0x35e37d?_0x38dc93[_0xdb868d(0x113)]({'action':_0xdb868d(0x110),'tool':_0xdb868d(0x130),'params':{'sqlName':_0xdb868d(0x126),'dbId':_0x35e37d,'sqlContent':_0x3f72de},'reason':'SQL\x20is\x20valid\x20and\x20ready\x20to\x20be\x20saved','priority':_0xdb868d(0x11e)}):_0x38dc93[_0xdb868d(0x113)]({'action':'Get\x20database\x20ID\x20to\x20save\x20this\x20SQL','tool':'get_dataset_detail','params':{'datasetCode':_0xdb868d(0x108)},'reason':_0xdb868d(0x109),'priority':_0xdb868d(0x11e)});else{_0x38dc93[_0xdb868d(0x113)]({'action':_0xdb868d(0x10d),'tool':_0xdb868d(0x128),'reason':_0xdb868d(0x103),'priority':_0xdb868d(0x11e)});for(const _0x154d65 of _0x1ec31d[_0xdb868d(0x12c)]||[]){if(_0x154d65[_0xdb868d(0x10e)]==='COLUMN_NOT_FOUND'||_0x154d65['type']===_0xdb868d(0x116)){const _0x1f5f68=_0x154d65[_0xdb868d(0x129)][0x0]?.['description']||_0x154d65[_0xdb868d(0x10c)];_0x38dc93[_0xdb868d(0x113)]({'action':_0xdb868d(0x101),'tool':_0xdb868d(0x10f),'params':{'datasetCode':_0xdb868d(0x108)},'reason':_0x1f5f68,'priority':_0xdb868d(0xfb)});break;}}}return!_0x1ec31d[_0xdb868d(0x125)]&&_0x1ec31d[_0xdb868d(0x12c)]?.[_0xdb868d(0x104)](_0xe71833=>_0xe71833['type']==='TABLE_NOT_FOUND')&&_0x38dc93[_0xdb868d(0x113)]({'action':_0xdb868d(0x10a),'tool':'list_datasets','reason':_0xdb868d(0x12a),'priority':_0xdb868d(0xfb)}),_0x522367[_0xdb868d(0xfd)]=_0x38dc93,_0x522367;}export{validateSqlContentTool as validateSqlContent};
1
+ (function(_0x19de26,_0x443ede){const _0x14b218=a21_0x5c02,_0x457166=_0x19de26();while(!![]){try{const _0x47b539=parseInt(_0x14b218(0xee))/0x1+parseInt(_0x14b218(0xd9))/0x2+-parseInt(_0x14b218(0xd8))/0x3*(-parseInt(_0x14b218(0x100))/0x4)+parseInt(_0x14b218(0xf1))/0x5*(-parseInt(_0x14b218(0xed))/0x6)+-parseInt(_0x14b218(0xfa))/0x7+parseInt(_0x14b218(0x103))/0x8+-parseInt(_0x14b218(0xd5))/0x9;if(_0x47b539===_0x443ede)break;else _0x457166['push'](_0x457166['shift']());}catch(_0x1fd3be){_0x457166['push'](_0x457166['shift']());}}}(a21_0x3431,0x63ec6));import{DevApiClient}from'../api/dev-api-client.js';import{detectSqlType,parseSqlStructure,validateSqlContent as a21_0x4e7dd0,generateSqlSummary}from'../utils/sql-parser.js';function a21_0x3431(){const _0x37b75f=['fieldCode','high','列出所有可用的数据集','78366UmdvOb','96417aCFbdU','getDatasetList','valid','305zhXuav','errors','⚠️\x20SELECT\x20查询存在问题','⚠️\x20检测到\x20','isDangerous','tableName','isSelectOnly','properties','\x20语句','1281525ylUfRF','Provide\x20SQL\x20content\x20to\x20validate','push',',为安全起见建议手动保存。请使用文件写入工具保存,然后手动导入','save_or_update_custom_sql','获取数据集详情以找到正确的表/字段名','76DiYuPx','SQL\x20content\x20cannot\x20be\x20empty','<dataset-code>','5992312HayqDn','修复\x20SQL\x20错误后再保存','get_dataset_detail','length','[validateSqlContent]\x20Failed\x20to\x20fetch\x20schema\x20for\x20','SQL\x20content\x20is\x20required','请先修复识别出的表/字段错误','UNKNOWN','some',',存在错误','code','2303694abKkAL','COLUMN_NOT_FOUND','getDatasetDetail','58881bZGyCO','853358eWaTkb','SQL\x20验证通过且为\x20SELECT\x20查询,可以保存到平台','<sql-name>','\x20个错误','TABLE_NOT_FOUND','type','✓\x20SELECT\x20查询','medium','\x20语句(会修改数据/结构)','data','检测到\x20','fixSteps','获取数据库\x20ID\x20以保存\x20SQL','typeLabel','查找正确的表名','warn','validate_sql_content'];a21_0x3431=function(){return _0x37b75f;};return a21_0x3431();}import{getEnvAppCode,shouldLog}from'../config/env.js';function a21_0x5c02(_0x115ff4,_0x13c655){_0x115ff4=_0x115ff4-0xd0;const _0x34317b=a21_0x3431();let _0x5c0256=_0x34317b[_0x115ff4];return _0x5c0256;}async function fetchSchemaInfo(_0x5b672b,_0x46f876){const _0x14697f=a21_0x5c02,_0x4a5366=[];for(const _0x572c19 of _0x5b672b){try{const _0x499ce0=/^\d+$/['test'](_0x572c19);let _0xc5661b=_0x572c19;if(!_0x499ce0){const _0x26b13c=await _0x46f876[_0x14697f(0xef)](),_0x56d0e3=_0x26b13c['data']?.['tableData']||[],_0xb9c508=_0x56d0e3['find'](_0x5ea474=>_0x5ea474[_0x14697f(0xd4)]===_0x572c19);if(!_0xb9c508)continue;_0xc5661b=String(_0xb9c508['id']);}const _0x283e67=await _0x46f876[_0x14697f(0xd7)](_0xc5661b),_0x3833b7=_0x283e67[_0x14697f(0xe2)]?.[_0x14697f(0xf6)]||'',_0x465020=_0x283e67[_0x14697f(0xe2)]?.[_0x14697f(0xf8)]||[],_0x13d442=_0x465020['map'](_0x44a841=>_0x44a841[_0x14697f(0xd4)]||_0x44a841[_0x14697f(0xea)]);_0x3833b7&&_0x13d442[_0x14697f(0x106)]>0x0&&_0x4a5366[_0x14697f(0xfc)]({'tableName':_0x3833b7,'columns':_0x13d442});}catch(_0x4ba4b7){shouldLog()&&console[_0x14697f(0xe8)](_0x14697f(0x107)+_0x572c19+':',_0x4ba4b7);}}return _0x4a5366;}export async function validateSqlContentTool(_0x108df3){const _0xa43baf=a21_0x5c02,{appCode:appCode=getEnvAppCode(),cookie:_0x35408d,sqlContent:_0x1f8b1b,dbId:_0x103327,validateSchemas:validateSchemas=[]}=_0x108df3;if(!_0x1f8b1b||_0x1f8b1b['trim']()==='')return{'success':![],'message':_0xa43baf(0x108),'sqlContent':'','parsedStructure':{'tables':[],'columns':[],'parameters':[]},'schemaValidation':{'valid':![]},'sqlType':{'type':_0xa43baf(0xd1),'isSelectOnly':![],'isDangerous':![]},'nextSteps':[{'action':_0xa43baf(0xfb),'tool':_0xa43baf(0xe9),'reason':_0xa43baf(0x101)}]};const _0xab255b=detectSqlType(_0x1f8b1b),_0xd73db2=parseSqlStructure(_0x1f8b1b),_0x453f52=generateSqlSummary(_0x1f8b1b);let _0x39c330;if(validateSchemas[_0xa43baf(0x106)]>0x0&&appCode){const _0x3e1824=new DevApiClient({'appCode':appCode,'cookie':_0x35408d});_0x39c330=await fetchSchemaInfo(validateSchemas,_0x3e1824);}const _0x32407=a21_0x4e7dd0(_0x1f8b1b,_0x39c330?{'tables':_0x39c330}:undefined),_0x55a09d=[];if(_0x32407[_0xa43baf(0xf0)]){if(_0xab255b['isSelectOnly'])_0x103327?_0x55a09d[_0xa43baf(0xfc)]({'action':'保存此\x20SELECT\x20查询到\x20Lovrabet\x20平台','tool':_0xa43baf(0xfe),'params':{'sqlName':_0xa43baf(0xdb),'dbId':_0x103327,'sqlContent':_0x1f8b1b},'reason':_0xa43baf(0xda),'priority':_0xa43baf(0xeb)}):_0x55a09d[_0xa43baf(0xfc)]({'action':_0xa43baf(0xe5),'tool':_0xa43baf(0x105),'params':{'datasetCode':_0xa43baf(0x102)},'reason':'需要从数据集详情中获取\x20dbId\x20来保存\x20SQL','priority':_0xa43baf(0xeb)});else{const _0x3a37f1=_0xab255b[_0xa43baf(0xf5)]?_0xa43baf(0xf4)+_0xab255b[_0xa43baf(0xde)]+_0xa43baf(0xe1):_0xa43baf(0xe3)+_0xab255b[_0xa43baf(0xde)]+_0xa43baf(0xf9);_0x55a09d[_0xa43baf(0xfc)]({'action':'将此\x20SQL\x20保存到本地文件(手动导入到\x20Lovrabet\x20平台)','reason':_0x3a37f1+_0xa43baf(0xfd),'priority':_0xa43baf(0xeb)});}}else _0x55a09d[_0xa43baf(0xfc)]({'action':_0xa43baf(0x104),'tool':'validate_sql_content','reason':_0xa43baf(0xd0),'priority':_0xa43baf(0xeb)});if(!_0x32407[_0xa43baf(0xf0)]&&_0x32407[_0xa43baf(0xf2)]&&_0x32407[_0xa43baf(0xf2)]['length']>0x0)for(const _0x3f24fc of _0x32407[_0xa43baf(0xf2)]){if(_0x3f24fc[_0xa43baf(0xde)]===_0xa43baf(0xd6)||_0x3f24fc[_0xa43baf(0xde)]==='TABLE_NOT_FOUND'){_0x55a09d['push']({'action':_0xa43baf(0xff),'tool':'get_dataset_detail','params':{'datasetCode':'<dataset-code>'},'reason':_0x3f24fc[_0xa43baf(0xe4)][0x0]?.['description']||_0x3f24fc[_0xa43baf(0xe6)],'priority':'medium'});break;}}!_0x32407[_0xa43baf(0xf0)]&&_0x32407[_0xa43baf(0xf2)]&&_0x32407[_0xa43baf(0xf2)][_0xa43baf(0xd2)](_0x55bdd9=>_0x55bdd9['type']===_0xa43baf(0xdd))&&_0x55a09d[_0xa43baf(0xfc)]({'action':_0xa43baf(0xec),'tool':'list_datasets','reason':_0xa43baf(0xe7),'priority':_0xa43baf(0xe0)});let _0x240172='';if(_0xab255b[_0xa43baf(0xf7)])_0x240172=_0x32407[_0xa43baf(0xf0)]?_0xa43baf(0xdf):_0xa43baf(0xf3);else _0xab255b['isDangerous']?_0x240172='⚠️\x20'+_0xab255b[_0xa43baf(0xde)]+_0xa43baf(0xe1):_0x240172=_0xab255b[_0xa43baf(0xde)]+'\x20语句';const _0x23dacf=_0x32407[_0xa43baf(0xf0)]?'':_0xa43baf(0xd3),_0x5d88a8=_0x453f52?'\x20('+_0x453f52+')':'',_0x48ee79=!_0x32407[_0xa43baf(0xf0)]&&_0x32407[_0xa43baf(0xf2)]?','+_0x32407['errors'][_0xa43baf(0x106)]+_0xa43baf(0xdc):'';return{'success':_0x32407[_0xa43baf(0xf0)]||!![],'message':''+_0x240172+_0x23dacf+_0x5d88a8+_0x48ee79,'sqlContent':_0x1f8b1b,'parsedStructure':_0xd73db2,'schemaValidation':{'valid':_0x32407['valid'],'errors':_0x32407['errors']},'sqlType':_0xab255b,'nextSteps':_0x55a09d};}export{validateSqlContentTool as validateSqlContent};
@@ -1 +1 @@
1
- function a23_0x4615(_0x15f497,_0x72101a){_0x15f497=_0x15f497-0x183;var _0x259acb=a23_0x259a();var _0x461536=_0x259acb[_0x15f497];return _0x461536;}(function(_0x27b292,_0x10c6a9){var _0x188fd7=a23_0x4615,_0x5cb22b=_0x27b292();while(!![]){try{var _0x73094c=-parseInt(_0x188fd7(0x185))/0x1+parseInt(_0x188fd7(0x183))/0x2+-parseInt(_0x188fd7(0x189))/0x3+-parseInt(_0x188fd7(0x186))/0x4+-parseInt(_0x188fd7(0x184))/0x5+-parseInt(_0x188fd7(0x18a))/0x6*(parseInt(_0x188fd7(0x187))/0x7)+parseInt(_0x188fd7(0x188))/0x8;if(_0x73094c===_0x10c6a9)break;else _0x5cb22b['push'](_0x5cb22b['shift']());}catch(_0x379f10){_0x5cb22b['push'](_0x5cb22b['shift']());}}}(a23_0x259a,0xf4023));export{createError,createAuthError,createMissingParamError,createDatasetNotFoundError,createSqlNotFoundError,createSqlValidationError,createStructuredSqlError,fromLovrabetError,SQL_ERROR_TYPE_LABELS}from'./mcp-types.js';function a23_0x259a(){var _0x19594f=['143394qjbNDT','3867818THfRqZ','6808510BXtCZc','32278npXkBk','3225380dXJuAe','490tIqKLd','26407568DbVLMP','1086423rMSLBJ'];a23_0x259a=function(){return _0x19594f;};return a23_0x259a();}
1
+ function a22_0x4d6e(){var _0x24d768=['735156sdEVGP','30ZRWOIF','5210526KUrBTZ','773617KxVJpa','4685247fUksuH','7OAubFM','3171016QRtuNl','5fmVTUe','3050103lmxZbG','2GsjyMh','2205291FHNpFJ'];a22_0x4d6e=function(){return _0x24d768;};return a22_0x4d6e();}(function(_0x43f0da,_0x3eae2c){var _0x969b6c=a22_0x216a,_0x5bde31=_0x43f0da();while(!![]){try{var _0x1ac3bd=-parseInt(_0x969b6c(0x169))/0x1*(parseInt(_0x969b6c(0x164))/0x2)+parseInt(_0x969b6c(0x163))/0x3+-parseInt(_0x969b6c(0x166))/0x4*(-parseInt(_0x969b6c(0x162))/0x5)+parseInt(_0x969b6c(0x168))/0x6+parseInt(_0x969b6c(0x160))/0x7*(parseInt(_0x969b6c(0x161))/0x8)+-parseInt(_0x969b6c(0x15f))/0x9+-parseInt(_0x969b6c(0x167))/0xa*(parseInt(_0x969b6c(0x165))/0xb);if(_0x1ac3bd===_0x3eae2c)break;else _0x5bde31['push'](_0x5bde31['shift']());}catch(_0x31c156){_0x5bde31['push'](_0x5bde31['shift']());}}}(a22_0x4d6e,0x8b12d));function a22_0x216a(_0x681a76,_0x44b5ba){_0x681a76=_0x681a76-0x15f;var _0x4d6e1d=a22_0x4d6e();var _0x216a5c=_0x4d6e1d[_0x681a76];return _0x216a5c;}export{createError,createAuthError,createMissingParamError,createDatasetNotFoundError,createSqlNotFoundError,createSqlValidationError,createStructuredSqlError,fromLovrabetError,SQL_ERROR_TYPE_LABELS}from'./mcp-types.js';
@@ -1 +1 @@
1
- const a24_0x466936=a24_0x464f;(function(_0x2856aa,_0x186d1a){const _0x25c6fe=a24_0x464f,_0x325dc7=_0x2856aa();while(!![]){try{const _0x3022d2=parseInt(_0x25c6fe(0xa1))/0x1*(parseInt(_0x25c6fe(0xcd))/0x2)+-parseInt(_0x25c6fe(0xc8))/0x3+-parseInt(_0x25c6fe(0xb1))/0x4*(-parseInt(_0x25c6fe(0xb9))/0x5)+parseInt(_0x25c6fe(0xc5))/0x6*(-parseInt(_0x25c6fe(0xa2))/0x7)+-parseInt(_0x25c6fe(0xc6))/0x8*(-parseInt(_0x25c6fe(0x92))/0x9)+-parseInt(_0x25c6fe(0xac))/0xa+parseInt(_0x25c6fe(0xb0))/0xb;if(_0x3022d2===_0x186d1a)break;else _0x325dc7['push'](_0x325dc7['shift']());}catch(_0x5e3b7c){_0x325dc7['push'](_0x325dc7['shift']());}}}(a24_0x313b,0x3bd9a));export const SQL_ERROR_TYPE_LABELS={'TABLE_NOT_FOUND':a24_0x466936(0xb2),'COLUMN_NOT_FOUND':a24_0x466936(0xd6),'AMBIGUOUS_COLUMN':a24_0x466936(0xab),'SYNTAX_ERROR':a24_0x466936(0xbc),'TYPE_MISMATCH':a24_0x466936(0xa4),'MISSING_WHERE_CLAUSE':a24_0x466936(0xd2),'UNSAFE_QUERY':a24_0x466936(0xcf)};export function createError(_0x4f0fb1){const _0x1a4152=a24_0x466936;return{'error':!![],'code':_0x4f0fb1[_0x1a4152(0xa0)],'message':_0x4f0fb1[_0x1a4152(0xc1)],'status':_0x4f0fb1['status'],'description':_0x4f0fb1[_0x1a4152(0xbd)],'response':_0x4f0fb1[_0x1a4152(0xd5)],'suggestedAction':_0x4f0fb1[_0x1a4152(0xcb)],'recoverable':_0x4f0fb1[_0x1a4152(0xd4)]??!![],'timestamp':new Date()[_0x1a4152(0xbf)]()};}function a24_0x464f(_0x5121e7,_0x4cd389){_0x5121e7=_0x5121e7-0x92;const _0x313bda=a24_0x313b();let _0x464fcd=_0x313bda[_0x5121e7];return _0x464fcd;}export function createAuthError(){const _0x5cbc80=a24_0x466936;return createError({'code':_0x5cbc80(0xd0),'message':_0x5cbc80(0xc0),'suggestedAction':{'tool':'login','description':_0x5cbc80(0x97),'example':_0x5cbc80(0xd3)},'recoverable':!![]});}export function createMissingParamError(_0x47aaf5,_0x32295a){return createError({'code':'PARAMETER_MISSING','message':'缺少必需参数:\x20'+_0x47aaf5+(_0x32295a?'\x20('+_0x32295a+')':''),'recoverable':!![]});}export function createDatasetNotFoundError(_0x56f164){const _0x3807a1=a24_0x466936;return createError({'code':_0x3807a1(0x9c),'message':_0x3807a1(0x96)+_0x56f164,'suggestedAction':{'tool':_0x3807a1(0xbe),'description':_0x3807a1(0xa7),'example':'list_datasets({\x20pageSize:\x20999\x20})'},'recoverable':!![]});}export function createSqlNotFoundError(_0xb115e4){const _0x50374e=a24_0x466936;return createError({'code':_0x50374e(0x9d),'message':_0x50374e(0xa6)+_0xb115e4,'suggestedAction':{'tool':_0x50374e(0xa3),'description':_0x50374e(0x98),'example':_0x50374e(0xb8)},'recoverable':!![]});}export function createSqlValidationError(_0x4a0664){const _0x32eac0=a24_0x466936,_0x33aad8=_0x4a0664['fixSteps'][_0x32eac0(0xa5)]>0x0,_0x5ec3cd=_0x33aad8?_0x4a0664[_0x32eac0(0x93)][0x0]:undefined,_0x2eb342={'type':_0x4a0664[_0x32eac0(0xb6)],'typeLabel':_0x4a0664['typeLabel'],'location':_0x4a0664[_0x32eac0(0xc4)],'severity':_0x4a0664[_0x32eac0(0xa8)],'fixSteps':_0x4a0664[_0x32eac0(0x93)],'suggestions':_0x4a0664[_0x32eac0(0x94)],'canAutoFix':_0x4a0664[_0x32eac0(0xc3)],'fixedSql':_0x4a0664[_0x32eac0(0x9e)]};return createError({'code':_0x32eac0(0xcc),'message':_0x4a0664[_0x32eac0(0xa9)]+':\x20'+_0x4a0664[_0x32eac0(0xc1)],'status':_0x4a0664[_0x32eac0(0xbb)],'description':_0x2eb342,'response':_0x4a0664[_0x32eac0(0xd5)],'suggestedAction':_0x5ec3cd?{'tool':_0x5ec3cd[_0x32eac0(0xc2)],'description':_0x5ec3cd['description'],'params':_0x5ec3cd[_0x32eac0(0x99)],'example':_0x5ec3cd[_0x32eac0(0xd1)]}:{'tool':_0x32eac0(0xaa),'description':_0x32eac0(0x95),'params':{'datasetCode':'<dataset-code>'}},'recoverable':_0x4a0664[_0x32eac0(0xa8)]!==_0x32eac0(0xad)});}export function createStructuredSqlError(_0x3a10cd){const _0x111f8d=a24_0x466936,_0x496c00=SQL_ERROR_TYPE_LABELS[_0x3a10cd[_0x111f8d(0xb6)]],_0x422566=_0x3a10cd[_0x111f8d(0xa8)]??_0x111f8d(0xad),_0x40cf3d=[];if(_0x3a10cd['type']==='TABLE_NOT_FOUND')_0x40cf3d[_0x111f8d(0xba)]({'description':'使用\x20list_datasets\x20工具查看所有可用的数据集表名','tool':_0x111f8d(0xbe),'toolParams':{'pageSize':0x3e7},'example':_0x111f8d(0xc7)});else{if(_0x3a10cd['type']===_0x111f8d(0xaf))_0x40cf3d[_0x111f8d(0xba)]({'description':_0x111f8d(0xca),'tool':'get_dataset_detail','toolParams':{'datasetCode':_0x111f8d(0xb4)},'example':'get_dataset_detail({\x20datasetCode:\x20\x22customer\x22\x20})'});else _0x3a10cd[_0x111f8d(0xb6)]===_0x111f8d(0x9f)&&_0x40cf3d[_0x111f8d(0xba)]({'description':_0x111f8d(0xae),'example':_0x111f8d(0x9b)});}return{'type':_0x3a10cd['type'],'typeLabel':_0x496c00,'location':_0x3a10cd[_0x111f8d(0xc4)],'message':_0x3a10cd[_0x111f8d(0xc1)],'severity':_0x422566,'fixSteps':_0x3a10cd[_0x111f8d(0x93)]??_0x40cf3d,'suggestions':_0x3a10cd['suggestions'],'canAutoFix':_0x3a10cd[_0x111f8d(0xc3)],'fixedSql':_0x3a10cd[_0x111f8d(0x9e)],'status':_0x3a10cd[_0x111f8d(0xbb)],'response':_0x3a10cd[_0x111f8d(0xd5)]};}function a24_0x313b(){const _0x3a51cd=['不安全的查询','AUTH_REQUIRED','example','缺少\x20WHERE\x20条件','login({\x20env:\x20\x22online\x22\x20})','recoverable','response','字段不存在','1421937vmKLZs','fixSteps','suggestions','获取数据集详情以确认表名和字段名','数据集不存在:\x20','登录到\x20Lovrabet\x20平台','查看所有可用的\x20SQL\x20查询','toolParams','API_ERROR','确保\x20SELECT\x20语句格式正确,如:\x20SELECT\x20id,\x20name\x20FROM\x20table\x20WHERE\x20status\x20=\x201','DATASET_NOT_FOUND','SQL_NOT_FOUND','fixedSql','SYNTAX_ERROR','code','49opdyek','71498qifChu','list_sql_queries','类型不匹配','length','SQL\x20不存在:\x20','查看所有可用的数据集','severity','typeLabel','get_dataset_detail','字段名歧义','4113380rtzoGI','error','检查\x20SQL\x20语法,确保关键字拼写正确、括号匹配','COLUMN_NOT_FOUND','5714423aufyMZ','512880efrlmo','表不存在','PARAMETER_MISSING','<dataset-code>','NETWORK_ERROR','type','PARAMETER_INVALID','list_sql_queries({\x20pageSize:\x20999\x20})','10gecsxD','push','status','语法错误','description','list_datasets','toISOString','需要登录才能访问\x20Lovrabet\x20数据。请先使用\x20login\x20工具进行登录。','message','tool','canAutoFix','location','228ItvFdq','8iIvlsJ','list_datasets({\x20pageSize:\x20999\x20})','470403eeJlBr','SQL_EXECUTION_FAILED','使用\x20get_dataset_detail\x20工具查看数据集的所有字段','suggestedAction','SQL_VALIDATION_FAILED','10918BQHpkz','UNKNOWN_ERROR'];a24_0x313b=function(){return _0x3a51cd;};return a24_0x313b();}export function fromLovrabetError(_0x30af1d,_0x1db70f){const _0xb7d280=a24_0x466936;return createError({'code':mapSdkCodeToMcpCode(_0x30af1d[_0xb7d280(0xa0)]),'message':_0x30af1d[_0xb7d280(0xc1)],'status':_0x30af1d['status'],'description':_0x30af1d[_0xb7d280(0xbd)],'response':_0x30af1d[_0xb7d280(0xd5)],'suggestedAction':_0x1db70f,'recoverable':_0x30af1d[_0xb7d280(0xbb)]?_0x30af1d[_0xb7d280(0xbb)]<0x1f4:!![]});}function mapSdkCodeToMcpCode(_0x57d386){const _0x1c0919=a24_0x466936;if(!_0x57d386)return _0x1c0919(0xce);const _0x3cf7c1={'AUTH_REQUIRED':'AUTH_REQUIRED','AUTH_FAILED':_0x1c0919(0xd0),'UNAUTHORIZED':_0x1c0919(0xd0),'DATASET_NOT_FOUND':_0x1c0919(0x9c),'NOT_FOUND':'DATASET_NOT_FOUND','INVALID_PARAMETER':_0x1c0919(0xb7),'MISSING_PARAMETER':_0x1c0919(0xb3),'SQL_ERROR':_0x1c0919(0xc9),'NETWORK_ERROR':_0x1c0919(0xb5),'API_ERROR':_0x1c0919(0x9a)};return _0x3cf7c1[_0x57d386]||_0x1c0919(0xce);}
1
+ function a23_0x4b42(){const _0x582b02=['list_datasets({\x20pageSize:\x20999\x20})','937890zbtMgC','SQL_NOT_FOUND','message','push','类型不匹配','6NWPHOa','88SvKvhf','severity','SQL_EXECUTION_FAILED','确保\x20SELECT\x20语句格式正确,如:\x20SELECT\x20id,\x20name\x20FROM\x20table\x20WHERE\x20status\x20=\x201','list_datasets','type','539964KyRodg','NETWORK_ERROR','location','canAutoFix','description','使用\x20get_dataset_detail\x20工具查看数据集的所有字段','code','status','缺少\x20WHERE\x20条件','login','suggestions','response','AUTH_REQUIRED','需要登录才能访问\x20Lovrabet\x20数据。请先使用\x20login\x20工具进行登录。','13bFFEeR','toISOString','fixedSql','TABLE_NOT_FOUND','typeLabel','suggestedAction','缺少必需参数:\x20','1984829MxuyXb','API_ERROR','fixSteps','get_dataset_detail','使用\x20list_datasets\x20工具查看所有可用的数据集表名','SQL\x20不存在:\x20','查看所有可用的数据集','SYNTAX_ERROR','1771648JLmLnE','获取数据集详情以确认表名和字段名','查看所有可用的\x20SQL\x20查询','8799072sEzDwR','64778mKuZkZ','191514oUuREC','20ETmgtM','数据集不存在:\x20','字段不存在','get_dataset_detail({\x20datasetCode:\x20\x22customer\x22\x20})','PARAMETER_MISSING','表不存在','UNKNOWN_ERROR','6lsBoeq','不安全的查询','list_sql_queries({\x20pageSize:\x20999\x20})','<dataset-code>','字段名歧义','DATASET_NOT_FOUND','error','6rLZSAr'];a23_0x4b42=function(){return _0x582b02;};return a23_0x4b42();}const a23_0x492790=a23_0x4c94;(function(_0x21d828,_0x21d205){const _0x47127d=a23_0x4c94,_0x3e24ba=_0x21d828();while(!![]){try{const _0x1b3bc1=parseInt(_0x47127d(0xa7))/0x1*(-parseInt(_0x47127d(0x9f))/0x2)+parseInt(_0x47127d(0xb5))/0x3*(-parseInt(_0x47127d(0x9a))/0x4)+-parseInt(_0x47127d(0xb0))/0x5*(-parseInt(_0x47127d(0xae))/0x6)+-parseInt(_0x47127d(0x9e))/0x7+-parseInt(_0x47127d(0xb6))/0x8*(-parseInt(_0x47127d(0xbc))/0x9)+-parseInt(_0x47127d(0xa0))/0xa*(-parseInt(_0x47127d(0x92))/0xb)+-parseInt(_0x47127d(0x9d))/0xc*(-parseInt(_0x47127d(0x8b))/0xd);if(_0x1b3bc1===_0x21d205)break;else _0x3e24ba['push'](_0x3e24ba['shift']());}catch(_0x4b8b26){_0x3e24ba['push'](_0x3e24ba['shift']());}}}(a23_0x4b42,0x733f0));export const SQL_ERROR_TYPE_LABELS={'TABLE_NOT_FOUND':a23_0x492790(0xa5),'COLUMN_NOT_FOUND':a23_0x492790(0xa2),'AMBIGUOUS_COLUMN':a23_0x492790(0xab),'SYNTAX_ERROR':'语法错误','TYPE_MISMATCH':a23_0x492790(0xb4),'MISSING_WHERE_CLAUSE':a23_0x492790(0xc4),'UNSAFE_QUERY':a23_0x492790(0xa8)};export function createError(_0x1dfa5f){const _0xc8222b=a23_0x492790;return{'error':!![],'code':_0x1dfa5f['code'],'message':_0x1dfa5f[_0xc8222b(0xb2)],'status':_0x1dfa5f[_0xc8222b(0xc3)],'description':_0x1dfa5f[_0xc8222b(0xc0)],'response':_0x1dfa5f[_0xc8222b(0xc7)],'suggestedAction':_0x1dfa5f[_0xc8222b(0x90)],'recoverable':_0x1dfa5f['recoverable']??!![],'timestamp':new Date()[_0xc8222b(0x8c)]()};}export function createAuthError(){const _0x5a1947=a23_0x492790;return createError({'code':'AUTH_REQUIRED','message':_0x5a1947(0x8a),'suggestedAction':{'tool':_0x5a1947(0xc5),'description':'登录到\x20Lovrabet\x20平台','example':'login({\x20env:\x20\x22online\x22\x20})'},'recoverable':!![]});}export function createMissingParamError(_0x9c09db,_0x202401){const _0x41b706=a23_0x492790;return createError({'code':_0x41b706(0xa4),'message':_0x41b706(0x91)+_0x9c09db+(_0x202401?'\x20('+_0x202401+')':''),'recoverable':!![]});}export function createDatasetNotFoundError(_0x2d4050){const _0x1342c6=a23_0x492790;return createError({'code':_0x1342c6(0xac),'message':_0x1342c6(0xa1)+_0x2d4050,'suggestedAction':{'tool':_0x1342c6(0xba),'description':_0x1342c6(0x98),'example':_0x1342c6(0xaf)},'recoverable':!![]});}export function createSqlNotFoundError(_0x2c68f4){const _0x8fbf96=a23_0x492790;return createError({'code':_0x8fbf96(0xb1),'message':_0x8fbf96(0x97)+_0x2c68f4,'suggestedAction':{'tool':'list_sql_queries','description':_0x8fbf96(0x9c),'example':_0x8fbf96(0xa9)},'recoverable':!![]});}function a23_0x4c94(_0x44c7a4,_0x14f63b){_0x44c7a4=_0x44c7a4-0x89;const _0x4b421a=a23_0x4b42();let _0x4c94cf=_0x4b421a[_0x44c7a4];return _0x4c94cf;}export function createSqlValidationError(_0x2185e9){const _0x50a9bd=a23_0x492790,_0x58cf8d=_0x2185e9[_0x50a9bd(0x94)]['length']>0x0,_0x3cd93d=_0x58cf8d?_0x2185e9['fixSteps'][0x0]:undefined,_0x49e657={'type':_0x2185e9['type'],'typeLabel':_0x2185e9['typeLabel'],'location':_0x2185e9[_0x50a9bd(0xbe)],'severity':_0x2185e9[_0x50a9bd(0xb7)],'fixSteps':_0x2185e9[_0x50a9bd(0x94)],'suggestions':_0x2185e9[_0x50a9bd(0xc6)],'canAutoFix':_0x2185e9['canAutoFix'],'fixedSql':_0x2185e9[_0x50a9bd(0x8d)]};return createError({'code':'SQL_VALIDATION_FAILED','message':_0x2185e9[_0x50a9bd(0x8f)]+':\x20'+_0x2185e9[_0x50a9bd(0xb2)],'status':_0x2185e9[_0x50a9bd(0xc3)],'description':_0x49e657,'response':_0x2185e9[_0x50a9bd(0xc7)],'suggestedAction':_0x3cd93d?{'tool':_0x3cd93d['tool'],'description':_0x3cd93d[_0x50a9bd(0xc0)],'params':_0x3cd93d['toolParams'],'example':_0x3cd93d['example']}:{'tool':_0x50a9bd(0x95),'description':_0x50a9bd(0x9b),'params':{'datasetCode':_0x50a9bd(0xaa)}},'recoverable':_0x2185e9[_0x50a9bd(0xb7)]!=='error'});}export function createStructuredSqlError(_0x5d2b02){const _0x111a86=a23_0x492790,_0x5b7494=SQL_ERROR_TYPE_LABELS[_0x5d2b02[_0x111a86(0xbb)]],_0x5c9ec7=_0x5d2b02[_0x111a86(0xb7)]??_0x111a86(0xad),_0x10e5c7=[];if(_0x5d2b02['type']===_0x111a86(0x8e))_0x10e5c7['push']({'description':_0x111a86(0x96),'tool':_0x111a86(0xba),'toolParams':{'pageSize':0x3e7},'example':_0x111a86(0xaf)});else{if(_0x5d2b02[_0x111a86(0xbb)]==='COLUMN_NOT_FOUND')_0x10e5c7[_0x111a86(0xb3)]({'description':_0x111a86(0xc1),'tool':_0x111a86(0x95),'toolParams':{'datasetCode':_0x111a86(0xaa)},'example':_0x111a86(0xa3)});else _0x5d2b02['type']===_0x111a86(0x99)&&_0x10e5c7[_0x111a86(0xb3)]({'description':'检查\x20SQL\x20语法,确保关键字拼写正确、括号匹配','example':_0x111a86(0xb9)});}return{'type':_0x5d2b02[_0x111a86(0xbb)],'typeLabel':_0x5b7494,'location':_0x5d2b02[_0x111a86(0xbe)],'message':_0x5d2b02['message'],'severity':_0x5c9ec7,'fixSteps':_0x5d2b02[_0x111a86(0x94)]??_0x10e5c7,'suggestions':_0x5d2b02[_0x111a86(0xc6)],'canAutoFix':_0x5d2b02[_0x111a86(0xbf)],'fixedSql':_0x5d2b02[_0x111a86(0x8d)],'status':_0x5d2b02[_0x111a86(0xc3)],'response':_0x5d2b02['response']};}export function fromLovrabetError(_0x294e2d,_0x474bcd){const _0x43119f=a23_0x492790;return createError({'code':mapSdkCodeToMcpCode(_0x294e2d[_0x43119f(0xc2)]),'message':_0x294e2d[_0x43119f(0xb2)],'status':_0x294e2d[_0x43119f(0xc3)],'description':_0x294e2d[_0x43119f(0xc0)],'response':_0x294e2d[_0x43119f(0xc7)],'suggestedAction':_0x474bcd,'recoverable':_0x294e2d['status']?_0x294e2d[_0x43119f(0xc3)]<0x1f4:!![]});}function mapSdkCodeToMcpCode(_0x13e87b){const _0x16ad22=a23_0x492790;if(!_0x13e87b)return'UNKNOWN_ERROR';const _0x390939={'AUTH_REQUIRED':_0x16ad22(0x89),'AUTH_FAILED':_0x16ad22(0x89),'UNAUTHORIZED':_0x16ad22(0x89),'DATASET_NOT_FOUND':_0x16ad22(0xac),'NOT_FOUND':'DATASET_NOT_FOUND','INVALID_PARAMETER':'PARAMETER_INVALID','MISSING_PARAMETER':_0x16ad22(0xa4),'SQL_ERROR':_0x16ad22(0xb8),'NETWORK_ERROR':_0x16ad22(0xbd),'API_ERROR':_0x16ad22(0x93)};return _0x390939[_0x13e87b]||_0x16ad22(0xa6);}
@@ -0,0 +1 @@
1
+ const a24_0x5a6ab1=a24_0x52fb;function a24_0x52fb(_0x3cbc44,_0x1fe32d){_0x3cbc44=_0x3cbc44-0xf4;const _0x1a82ec=a24_0x1a82();let _0x52fbb0=_0x1a82ec[_0x3cbc44];return _0x52fbb0;}(function(_0x4d7a88,_0x2adc68){const _0x45c43e=a24_0x52fb,_0x3e5fd1=_0x4d7a88();while(!![]){try{const _0x56c04e=-parseInt(_0x45c43e(0xfc))/0x1+parseInt(_0x45c43e(0x109))/0x2+-parseInt(_0x45c43e(0xfa))/0x3+parseInt(_0x45c43e(0x100))/0x4+-parseInt(_0x45c43e(0xf7))/0x5*(parseInt(_0x45c43e(0x102))/0x6)+-parseInt(_0x45c43e(0x104))/0x7+parseInt(_0x45c43e(0xf4))/0x8*(parseInt(_0x45c43e(0x10a))/0x9);if(_0x56c04e===_0x2adc68)break;else _0x3e5fd1['push'](_0x3e5fd1['shift']());}catch(_0x368318){_0x3e5fd1['push'](_0x3e5fd1['shift']());}}}(a24_0x1a82,0x3e89f));export class RateLimiter{[a24_0x5a6ab1(0xfd)]=0x0;[a24_0x5a6ab1(0x106)]=[];[a24_0x5a6ab1(0xf8)]=![];[a24_0x5a6ab1(0xf6)];constructor(_0x17f6bc={}){const _0x4240d2=a24_0x5a6ab1;this['options']={'maxOperations':_0x17f6bc[_0x4240d2(0xf9)]??Infinity,'windowMs':_0x17f6bc['windowMs']??0x3e8,'delayMs':_0x17f6bc[_0x4240d2(0xfe)]??0x7d0};}async['throttle'](_0x472189){return new Promise((_0x5d8f32,_0x2582b7)=>{const _0x500c33=a24_0x52fb;this[_0x500c33(0x106)]['push']({'fn':_0x472189,'resolve':_0x5d8f32,'reject':_0x2582b7}),this[_0x500c33(0x101)]();});}async[a24_0x5a6ab1(0x101)](){const _0x2ab61a=a24_0x5a6ab1;if(this['processing']||this[_0x2ab61a(0x106)][_0x2ab61a(0x10d)]===0x0)return;this[_0x2ab61a(0xf8)]=!![];while(this['queue'][_0x2ab61a(0x10d)]>0x0){const _0x148cab=Date['now'](),_0x275065=_0x148cab-this[_0x2ab61a(0xfd)];if(this[_0x2ab61a(0xfd)]>0x0&&_0x275065<this['options'][_0x2ab61a(0xfe)]){const _0xca8f68=this[_0x2ab61a(0xf6)][_0x2ab61a(0xfe)]-_0x275065;await this['sleep'](_0xca8f68);}const _0x48ca54=this[_0x2ab61a(0x106)][_0x2ab61a(0x108)]();if(!_0x48ca54)break;try{const _0x500422=await _0x48ca54['fn']();_0x48ca54[_0x2ab61a(0x10c)](_0x500422);}catch(_0x34dcad){_0x48ca54[_0x2ab61a(0x103)](_0x34dcad);}this[_0x2ab61a(0xfd)]=Date[_0x2ab61a(0x107)]();}this[_0x2ab61a(0xf8)]=![];}[a24_0x5a6ab1(0x105)](_0x5f23cc){return new Promise(_0x4d39dd=>setTimeout(_0x4d39dd,_0x5f23cc));}[a24_0x5a6ab1(0xfb)](){const _0x4969f5=a24_0x5a6ab1;this[_0x4969f5(0xfd)]=0x0,this[_0x4969f5(0x106)]=[],this[_0x4969f5(0xf8)]=![];}[a24_0x5a6ab1(0xf5)](){const _0x450266=a24_0x5a6ab1;return this[_0x450266(0x106)][_0x450266(0x10d)];}}function a24_0x1a82(){const _0x146a1e=['lastExecutionTime','delayMs','has','981728BWrlft','processQueue','347262SFcmlE','reject','3273536NxWujx','sleep','queue','now','shift','970380Oikrex','34659lxSDEq','get','resolve','length','864ZvYkAe','getQueueLength','options','5FRbWHH','processing','maxOperations','122145yGKnHv','reset','324131pAWlvd'];a24_0x1a82=function(){return _0x146a1e;};return a24_0x1a82();}const globalLimiters=new Map();export function getRateLimiter(_0xe14bf5,_0x452ce3){const _0x3e5046=a24_0x5a6ab1;return!globalLimiters[_0x3e5046(0xff)](_0xe14bf5)&&globalLimiters['set'](_0xe14bf5,new RateLimiter(_0x452ce3)),globalLimiters[_0x3e5046(0x10b)](_0xe14bf5);}export const rateLimiters={'sqlSave':new RateLimiter({'delayMs':0x3e8}),'api':new RateLimiter({'delayMs':0x1f4}),'fast':new RateLimiter({'delayMs':0xc8})};
@@ -1 +1 @@
1
- (function(_0x34656e,_0x182553){const _0x52ddd5=a25_0x5335,_0x3a5140=_0x34656e();while(!![]){try{const _0x2d47bc=parseInt(_0x52ddd5(0x149))/0x1*(parseInt(_0x52ddd5(0x11a))/0x2)+parseInt(_0x52ddd5(0x10b))/0x3*(parseInt(_0x52ddd5(0x119))/0x4)+parseInt(_0x52ddd5(0x11b))/0x5+-parseInt(_0x52ddd5(0x10c))/0x6*(parseInt(_0x52ddd5(0x106))/0x7)+-parseInt(_0x52ddd5(0xfe))/0x8*(parseInt(_0x52ddd5(0x12d))/0x9)+-parseInt(_0x52ddd5(0x117))/0xa*(-parseInt(_0x52ddd5(0x100))/0xb)+-parseInt(_0x52ddd5(0x125))/0xc*(parseInt(_0x52ddd5(0x143))/0xd);if(_0x2d47bc===_0x182553)break;else _0x3a5140['push'](_0x3a5140['shift']());}catch(_0x276529){_0x3a5140['push'](_0x3a5140['shift']());}}}(a25_0x4104,0x48d77));import{createStructuredSqlError}from'../types/mcp-types.js';function a25_0x4104(){const _0x2c8a08=['join','error','\x5c\x5cs+','test','reason','split','TABLE_NOT_FOUND','amount','from','SELECT\x20query','number','replace','SELECT','name','101218iTxLlc','size','count','status','SQL\x20必须以\x20SELECT\x20开头','REVOKE','37248IpWomN','SYNTAX_ERROR','filter','TRUNCATE','column','tables','joins','tableName','1760TfXbTg','\x22\x20中不存在','22KPyzoF','time','page','push','Joins:\x20','length','1881740aUtMOM','value','COLUMN_NOT_FOUND','table','startsWith','69MOHHdt','6EszpzJ','Only\x20SELECT\x20queries\x20are\x20allowed.\x20The\x20SQL\x20must\x20start\x20with\x20SELECT\x20(after\x20any\x20comments).','includes','toLowerCase','has','UPDATE\x5cs+\x5cw+\x5cs+SET','.\x20Only\x20SELECT\x20queries\x20are\x20allowed.','Forbidden\x20keyword\x20detected:\x20','DELETE\x5cs+FROM','slice','INSERT\x5cs+INTO','437270EXbZoB','date','89084gDEkYK','16llXMPl','589240lyKJrU','GRANT','map','DROP\x5cs+(TABLE|INDEX|DATABASE)','parameters','matchAll','trim','SQL\x20content\x20cannot\x20be\x20empty','search','limit','120dvxVMP','SELECT\x20id,\x20name\x20FROM\x20customer\x20WHERE\x20status\x20=\x201','toUpperCase','\x22\x20在表\x20\x22','columns','SQL_START','valid','keys','15156HinNBv','Tables:\x20','match','string','2024-01-01','\x20|\x20','字段\x20\x22','CREATE\x5cs+(TABLE|INDEX|DATABASE|VIEW)'];a25_0x4104=function(){return _0x2c8a08;};return a25_0x4104();}export function parseSqlStructure(_0x13593f){const _0x49c6df=a25_0x5335,_0x26db26={'tables':[],'columns':[],'parameters':[],'joins':[]};if(!_0x13593f||typeof _0x13593f!==_0x49c6df(0x130))return _0x26db26;const _0x762be=_0x13593f[_0x49c6df(0x140)](/#\{[^}]*\}/g,'?')[_0x49c6df(0x140)](/\$\{[^}]*\}/g,'?')[_0x49c6df(0x140)](/'[^']*'/g,'\x27\x27')[_0x49c6df(0x140)](/--.*$/gm,'')[_0x49c6df(0x140)](/\/\*[\s\S]*?\*\//g,''),_0x11afd0=_0x762be['match'](/FROM\s+([^\s,)(]+)/i);if(_0x11afd0){const _0x1b2cc1=_0x11afd0[0x1]['replace'](/[`"]/g,'');_0x26db26[_0x49c6df(0xfb)][_0x49c6df(0x103)](_0x1b2cc1);}const _0x58f02c=_0x762be[_0x49c6df(0x120)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi);for(const _0xaa5afd of _0x58f02c){const _0x1fb4af=_0xaa5afd[0x1][_0x49c6df(0x140)](/[`"]/g,'');_0x1fb4af&&!_0x26db26[_0x49c6df(0xfb)][_0x49c6df(0x10e)](_0x1fb4af)&&_0x26db26['tables']['push'](_0x1fb4af);}const _0x230ff4=_0x762be[_0x49c6df(0x12f)](/SELECT\s+([\s\S]+?)\s+FROM/i);if(_0x230ff4){const _0x485f87=_0x230ff4[0x1][_0x49c6df(0x121)]();if(_0x485f87!=='*'){const _0xa67f8f=splitSqlColumns(_0x485f87);for(const _0xe5b864 of _0xa67f8f){const _0x509aaa=_0xe5b864[_0x49c6df(0x121)]();if(_0x509aaa&&!_0x509aaa[_0x49c6df(0x12f)](/^\d+$/)){const _0x20a5f8=_0x509aaa[_0x49c6df(0x13a)](/\s+AS\s+/i),_0x3795ad=_0x20a5f8[0x0][_0x49c6df(0x121)](),_0xb91a65=_0x20a5f8[0x1]?.['trim']();if(_0x3795ad[_0x49c6df(0x10e)]('.')){const [_0xdf86e6,_0x54e85c]=_0x3795ad['split']('.');_0x26db26[_0x49c6df(0x129)][_0x49c6df(0x103)]({'table':_0xdf86e6[_0x49c6df(0x121)](),'column':_0x54e85c[_0x49c6df(0x140)](/[`"]/g,'')[_0x49c6df(0x121)](),'alias':_0xb91a65});}else!_0x3795ad[_0x49c6df(0x10e)]('(')&&_0x26db26['columns'][_0x49c6df(0x103)]({'table':'','column':_0x3795ad[_0x49c6df(0x140)](/[`"]/g,''),'alias':_0xb91a65});}}}}const _0x5c00d4=_0x762be[_0x49c6df(0x120)](/JOIN\s+(\w+)\s+(?:AS\s+)?(\w+)?\s+ON\s+([\w.]+)\s*=\s*([\w.]+)/gi);for(const _0xc1221d of _0x5c00d4){const [,,,_0x16a5ec,_0x7b2c47]=_0xc1221d;if(_0x16a5ec&&_0x7b2c47){const [_0x30f1be,_0x28d05d]=_0x16a5ec[_0x49c6df(0x10e)]('.')?_0x16a5ec[_0x49c6df(0x13a)]('.'):['',_0x16a5ec],[_0x5a9051,_0x1db9ed]=_0x7b2c47[_0x49c6df(0x10e)]('.')?_0x7b2c47[_0x49c6df(0x13a)]('.'):['',_0x7b2c47];_0x26db26['joins']?.[_0x49c6df(0x103)]({'leftTable':_0x30f1be,'leftColumn':_0x28d05d,'rightTable':_0x5a9051,'rightColumn':_0x1db9ed});}}const _0x399597=_0x13593f[_0x49c6df(0x120)](/[#\$]\{(\w+)\}/g),_0x10a4e4=new Set();for(const _0x422447 of _0x399597){const _0x314cb0=_0x422447[0x1];!_0x10a4e4[_0x49c6df(0x110)](_0x314cb0)&&(_0x10a4e4['add'](_0x314cb0),_0x26db26['parameters'][_0x49c6df(0x103)]({'name':_0x314cb0,'type':inferParamType(_0x314cb0),'example':getExampleValue(_0x314cb0)}));}return _0x26db26;}function splitSqlColumns(_0x25ed52){const _0x4db072=a25_0x5335,_0x1ab943=[];let _0xd132b9='',_0x3cef8f=0x0;for(let _0x2c712e=0x0;_0x2c712e<_0x25ed52['length'];_0x2c712e++){const _0x5743d6=_0x25ed52[_0x2c712e];if(_0x5743d6==='(')_0x3cef8f++,_0xd132b9+=_0x5743d6;else{if(_0x5743d6===')')_0x3cef8f--,_0xd132b9+=_0x5743d6;else _0x5743d6===','&&_0x3cef8f===0x0?(_0x1ab943[_0x4db072(0x103)](_0xd132b9),_0xd132b9=''):_0xd132b9+=_0x5743d6;}}return _0xd132b9&&_0x1ab943[_0x4db072(0x103)](_0xd132b9),_0x1ab943;}function inferParamType(_0x324c88){const _0x2cbc71=a25_0x5335,_0x19b19d=_0x324c88['toLowerCase']();if(_0x19b19d[_0x2cbc71(0x10e)]('id')||_0x19b19d['includes'](_0x2cbc71(0x145))||_0x19b19d[_0x2cbc71(0x10e)](_0x2cbc71(0x124))||_0x19b19d[_0x2cbc71(0x10e)](_0x2cbc71(0x144))||_0x19b19d[_0x2cbc71(0x10e)](_0x2cbc71(0x102))||_0x19b19d[_0x2cbc71(0x10e)]('num')||_0x19b19d['includes'](_0x2cbc71(0x13c))||_0x19b19d['includes']('price'))return _0x2cbc71(0x13f);return'string';}function getExampleValue(_0x21470b){const _0x1c0d37=a25_0x5335,_0x440934=_0x21470b[_0x1c0d37(0x10f)](),_0x49794b=inferParamType(_0x440934);if(_0x49794b==='number'){if(_0x440934[_0x1c0d37(0x10e)]('limit')||_0x440934[_0x1c0d37(0x10e)]('count')||_0x440934[_0x1c0d37(0x10e)](_0x1c0d37(0x144)))return 0xa;if(_0x440934[_0x1c0d37(0x10e)](_0x1c0d37(0x102)))return 0x1;return 0x7b;}if(_0x440934['includes'](_0x1c0d37(0x118))||_0x440934[_0x1c0d37(0x10e)](_0x1c0d37(0x101)))return _0x1c0d37(0x131);if(_0x440934['includes'](_0x1c0d37(0x146)))return'1';if(_0x440934[_0x1c0d37(0x10e)]('keyword')||_0x440934[_0x1c0d37(0x10e)](_0x1c0d37(0x123))||_0x440934[_0x1c0d37(0x10e)](_0x1c0d37(0x142)))return'example';return _0x1c0d37(0x107);}export function validateIsSelectOnly(_0x28a60e){const _0x37383e=a25_0x5335;if(!_0x28a60e||typeof _0x28a60e!==_0x37383e(0x130))return{'valid':![],'reason':_0x37383e(0x122)};const _0x5478a4=_0x28a60e[_0x37383e(0x140)](/#\{[^}]*\}/g,'?')[_0x37383e(0x140)](/\$\{[^}]*\}/g,'?')[_0x37383e(0x140)](/@[^(\s]+(\([^)]*\))?/g,''),_0x6ded02=_0x5478a4['trim'](),_0x1a74cb=_0x6ded02['split']('\x0a');let _0x5a0b6b='';for(const _0x17124e of _0x1a74cb){const _0x30569f=_0x17124e[_0x37383e(0x121)]();if(!_0x30569f||_0x30569f[_0x37383e(0x10a)]('--')||_0x30569f[_0x37383e(0x10a)]('/*'))continue;_0x5a0b6b=_0x30569f;break;}if(!_0x5a0b6b[_0x37383e(0x127)]()[_0x37383e(0x10a)](_0x37383e(0x141)))return{'valid':![],'reason':_0x37383e(0x10d)};const _0x75c61d=[_0x37383e(0x116),_0x37383e(0x111),_0x37383e(0x114),_0x37383e(0x11e),'ALTER\x5cs+(TABLE|DATABASE)',_0x37383e(0x134),_0x37383e(0x14c),_0x37383e(0x11c),_0x37383e(0x148),'EXEC','EXECUTE'],_0xfd05b2=_0x6ded02[_0x37383e(0x127)]();for(const _0x123997 of _0x75c61d){const _0x26425f=new RegExp(_0x123997,'i');if(_0x26425f[_0x37383e(0x138)](_0xfd05b2))return{'valid':![],'reason':_0x37383e(0x113)+_0x123997[_0x37383e(0x140)](_0x37383e(0x137),'\x20')+_0x37383e(0x112)};}return{'valid':!![]};}export function extractTableNames(_0x566aae){const _0x3c3d54=a25_0x5335,_0x405da4=parseSqlStructure(_0x566aae);return _0x405da4[_0x3c3d54(0xfb)];}export function extractColumnNames(_0x25eff0){const _0x1a82be=a25_0x5335,_0x56688a=parseSqlStructure(_0x25eff0);return _0x56688a[_0x1a82be(0x129)][_0x1a82be(0x11d)](_0x412437=>({'table':_0x412437[_0x1a82be(0x109)],'column':_0x412437[_0x1a82be(0xfa)]}));}export function extractParameters(_0x4b0813){const _0x233b6a=a25_0x5335,_0x41679a=parseSqlStructure(_0x4b0813);return _0x41679a[_0x233b6a(0x11f)];}export function validateSqlContent(_0x536af4,_0x2c2e2e){const _0x3bdf0f=a25_0x5335,_0x460649=validateIsSelectOnly(_0x536af4);if(!_0x460649[_0x3bdf0f(0x12b)])return{'valid':![],'isSelectOnly':![],'errors':[createStructuredSqlError({'type':_0x3bdf0f(0x14a),'location':_0x3bdf0f(0x12a),'message':_0x460649[_0x3bdf0f(0x139)]||_0x3bdf0f(0x147),'severity':_0x3bdf0f(0x136),'fixSteps':[{'description':'确保\x20SQL\x20语句以\x20SELECT\x20关键字开头','example':_0x3bdf0f(0x126)}]})]};const _0x6fcf3b=parseSqlStructure(_0x536af4),_0x16f1f4=[];if(_0x2c2e2e){const _0x199ab6=new Map(_0x2c2e2e[_0x3bdf0f(0xfb)]['map'](_0x572d16=>[_0x572d16[_0x3bdf0f(0xfd)]['toLowerCase'](),_0x572d16[_0x3bdf0f(0x129)]['map'](_0x2dbbaf=>_0x2dbbaf['toLowerCase']())]));for(const _0xc1aceb of _0x6fcf3b['tables']){const _0x43a2e5=_0xc1aceb[_0x3bdf0f(0x10f)]();if(!_0x199ab6['has'](_0x43a2e5)){const _0x31f5d1=Array[_0x3bdf0f(0x13d)](_0x199ab6['keys']())['filter'](_0x414cc8=>_0x414cc8[_0x3bdf0f(0x10e)](_0x43a2e5)||_0x43a2e5[_0x3bdf0f(0x10e)](_0x414cc8));_0x16f1f4[_0x3bdf0f(0x103)](createStructuredSqlError({'type':_0x3bdf0f(0x13b),'location':_0xc1aceb,'message':'表\x20\x22'+_0xc1aceb+'\x22\x20在数据库\x20schema\x20中不存在','severity':'error','suggestions':_0x31f5d1[_0x3bdf0f(0x105)]>0x0?_0x31f5d1:Array[_0x3bdf0f(0x13d)](_0x199ab6[_0x3bdf0f(0x12c)]())}));}}for(const _0x5a9062 of _0x6fcf3b[_0x3bdf0f(0x129)]){if(_0x5a9062['table']){const _0xf28f0b=_0x5a9062[_0x3bdf0f(0x109)][_0x3bdf0f(0x10f)](),_0x430400=_0x199ab6['get'](_0xf28f0b);if(_0x430400){const _0x33b825=_0x5a9062[_0x3bdf0f(0xfa)][_0x3bdf0f(0x10f)]();if(!_0x430400[_0x3bdf0f(0x10e)](_0x33b825)&&!_0x5a9062['column'][_0x3bdf0f(0x10e)]('*')){const _0x40a997=_0x430400[_0x3bdf0f(0x14b)](_0x14cc9b=>_0x14cc9b['includes'](_0x33b825)||_0x33b825[_0x3bdf0f(0x10e)](_0x14cc9b));_0x16f1f4[_0x3bdf0f(0x103)](createStructuredSqlError({'type':_0x3bdf0f(0x108),'location':_0x5a9062[_0x3bdf0f(0x109)]+'.'+_0x5a9062[_0x3bdf0f(0xfa)],'message':_0x3bdf0f(0x133)+_0x5a9062[_0x3bdf0f(0xfa)]+_0x3bdf0f(0x128)+_0x5a9062[_0x3bdf0f(0x109)]+_0x3bdf0f(0xff),'severity':_0x3bdf0f(0x136),'suggestions':_0x40a997[_0x3bdf0f(0x105)]>0x0?_0x40a997:_0x430400[_0x3bdf0f(0x115)](0x0,0xa)}));}}}}}return{'valid':_0x16f1f4[_0x3bdf0f(0x105)]===0x0,'isSelectOnly':!![],'parsedStructure':_0x6fcf3b,'errors':_0x16f1f4[_0x3bdf0f(0x105)]>0x0?_0x16f1f4:undefined};}function a25_0x5335(_0x4953ce,_0xa5712){_0x4953ce=_0x4953ce-0xfa;const _0x410461=a25_0x4104();let _0x533509=_0x410461[_0x4953ce];return _0x533509;}export function generateSqlSummary(_0xac5da9){const _0x56f40=a25_0x5335,_0x2bad88=parseSqlStructure(_0xac5da9),_0x115a97=[];return _0x2bad88[_0x56f40(0xfb)][_0x56f40(0x105)]>0x0&&_0x115a97[_0x56f40(0x103)](_0x56f40(0x12e)+_0x2bad88['tables'][_0x56f40(0x135)](',\x20')),_0x2bad88[_0x56f40(0x11f)][_0x56f40(0x105)]>0x0&&_0x115a97['push']('Params:\x20'+_0x2bad88[_0x56f40(0x11f)]['map'](_0x3ba107=>_0x3ba107['name'])[_0x56f40(0x135)](',\x20')),_0x2bad88[_0x56f40(0xfc)]&&_0x2bad88[_0x56f40(0xfc)]['length']>0x0&&_0x115a97[_0x56f40(0x103)](_0x56f40(0x104)+_0x2bad88[_0x56f40(0xfc)]['length']),_0x115a97['length']>0x0?_0x115a97['join'](_0x56f40(0x132)):_0x56f40(0x13e);}
1
+ (function(_0x4eeaa6,_0x1a6616){const _0x39a498=a25_0x1a3d,_0x1a8c49=_0x4eeaa6();while(!![]){try{const _0x2ae155=parseInt(_0x39a498(0xdc))/0x1*(-parseInt(_0x39a498(0xdf))/0x2)+-parseInt(_0x39a498(0xe7))/0x3+-parseInt(_0x39a498(0x105))/0x4*(parseInt(_0x39a498(0xf8))/0x5)+-parseInt(_0x39a498(0xe6))/0x6+-parseInt(_0x39a498(0x121))/0x7+parseInt(_0x39a498(0xe8))/0x8+parseInt(_0x39a498(0x11c))/0x9;if(_0x2ae155===_0x1a6616)break;else _0x1a8c49['push'](_0x1a8c49['shift']());}catch(_0x35b837){_0x1a8c49['push'](_0x1a8c49['shift']());}}}(a25_0x55dd,0xa1f3a));import{createStructuredSqlError}from'../types/mcp-types.js';export function parseSqlStructure(_0x15e265){const _0x24310b=a25_0x1a3d,_0x5eb030={'tables':[],'columns':[],'parameters':[],'joins':[]};if(!_0x15e265||typeof _0x15e265!==_0x24310b(0xd1))return _0x5eb030;const _0x3747d3=_0x15e265[_0x24310b(0xee)](/#\{[^}]*\}/g,'?')[_0x24310b(0xee)](/\$\{[^}]*\}/g,'?')['replace'](/'[^']*'/g,'\x27\x27')[_0x24310b(0xee)](/--.*$/gm,'')[_0x24310b(0xee)](/\/\*[\s\S]*?\*\//g,''),_0x53aa38=_0x3747d3[_0x24310b(0xfb)](/FROM\s+([^\s,)(]+)/i);if(_0x53aa38){const _0x363d0d=_0x53aa38[0x1][_0x24310b(0xee)](/[`"]/g,'');_0x5eb030['tables'][_0x24310b(0x11f)](_0x363d0d);}const _0x1d4188=_0x3747d3[_0x24310b(0x100)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi);for(const _0x2405a4 of _0x1d4188){const _0x5d3b7b=_0x2405a4[0x1][_0x24310b(0xee)](/[`"]/g,'');_0x5d3b7b&&!_0x5eb030['tables'][_0x24310b(0xfe)](_0x5d3b7b)&&_0x5eb030[_0x24310b(0xde)][_0x24310b(0x11f)](_0x5d3b7b);}const _0x1b9d69=_0x3747d3['match'](/SELECT\s+([\s\S]+?)\s+FROM/i);if(_0x1b9d69){const _0xb7b568=_0x1b9d69[0x1]['trim']();if(_0xb7b568!=='*'){const _0x2bf209=splitSqlColumns(_0xb7b568);for(const _0x5b132f of _0x2bf209){const _0x58521b=_0x5b132f['trim']();if(_0x58521b&&!_0x58521b[_0x24310b(0xfb)](/^\d+$/)){const _0x2cce7c=_0x58521b[_0x24310b(0x116)](/\s+AS\s+/i),_0x3a3d35=_0x2cce7c[0x0]['trim'](),_0x721031=_0x2cce7c[0x1]?.[_0x24310b(0xd4)]();if(_0x3a3d35['includes']('.')){const [_0x4e4806,_0x763f6a]=_0x3a3d35[_0x24310b(0x116)]('.');_0x5eb030[_0x24310b(0xdb)][_0x24310b(0x11f)]({'table':_0x4e4806[_0x24310b(0xd4)](),'column':_0x763f6a['replace'](/[`"]/g,'')[_0x24310b(0xd4)](),'alias':_0x721031});}else!_0x3a3d35[_0x24310b(0xfe)]('(')&&_0x5eb030[_0x24310b(0xdb)][_0x24310b(0x11f)]({'table':'','column':_0x3a3d35['replace'](/[`"]/g,''),'alias':_0x721031});}}}}const _0x87b397=_0x3747d3[_0x24310b(0x100)](/JOIN\s+(\w+)\s+(?:AS\s+)?(\w+)?\s+ON\s+([\w.]+)\s*=\s*([\w.]+)/gi);for(const _0x4c86f7 of _0x87b397){const [,,,_0x59f17c,_0x4ff6c5]=_0x4c86f7;if(_0x59f17c&&_0x4ff6c5){const [_0x5c34eb,_0x5e31db]=_0x59f17c[_0x24310b(0xfe)]('.')?_0x59f17c[_0x24310b(0x116)]('.'):['',_0x59f17c],[_0x23c46c,_0x24acfc]=_0x4ff6c5[_0x24310b(0xfe)]('.')?_0x4ff6c5[_0x24310b(0x116)]('.'):['',_0x4ff6c5];_0x5eb030[_0x24310b(0xff)]?.['push']({'leftTable':_0x5c34eb,'leftColumn':_0x5e31db,'rightTable':_0x23c46c,'rightColumn':_0x24acfc});}}const _0x593c68=_0x15e265['matchAll'](/[#\$]\{(\w+)\}/g),_0x4a756c=new Set();for(const _0x2defbd of _0x593c68){const _0x2b5af8=_0x2defbd[0x1];!_0x4a756c['has'](_0x2b5af8)&&(_0x4a756c[_0x24310b(0xf6)](_0x2b5af8),_0x5eb030[_0x24310b(0xf1)][_0x24310b(0x11f)]({'name':_0x2b5af8,'type':inferParamType(_0x2b5af8),'example':getExampleValue(_0x2b5af8)}));}return _0x5eb030;}function a25_0x1a3d(_0x344087,_0x3bfb03){_0x344087=_0x344087-0xd1;const _0x55dde6=a25_0x55dd();let _0x1a3dcc=_0x55dde6[_0x344087];return _0x1a3dcc;}function splitSqlColumns(_0x14c371){const _0x419b9d=a25_0x1a3d,_0x25c0a4=[];let _0x4c5146='',_0x33fce7=0x0;for(let _0x2b18a9=0x0;_0x2b18a9<_0x14c371['length'];_0x2b18a9++){const _0x5753d4=_0x14c371[_0x2b18a9];if(_0x5753d4==='(')_0x33fce7++,_0x4c5146+=_0x5753d4;else{if(_0x5753d4===')')_0x33fce7--,_0x4c5146+=_0x5753d4;else _0x5753d4===','&&_0x33fce7===0x0?(_0x25c0a4[_0x419b9d(0x11f)](_0x4c5146),_0x4c5146=''):_0x4c5146+=_0x5753d4;}}return _0x4c5146&&_0x25c0a4[_0x419b9d(0x11f)](_0x4c5146),_0x25c0a4;}function inferParamType(_0x3cf1a1){const _0x2791ce=a25_0x1a3d,_0x3dadf7=_0x3cf1a1[_0x2791ce(0xf5)]();if(_0x3dadf7[_0x2791ce(0xfe)]('id')||_0x3dadf7[_0x2791ce(0xfe)](_0x2791ce(0x115))||_0x3dadf7[_0x2791ce(0xfe)](_0x2791ce(0x10a))||_0x3dadf7['includes'](_0x2791ce(0xfd))||_0x3dadf7['includes'](_0x2791ce(0x111))||_0x3dadf7[_0x2791ce(0xfe)](_0x2791ce(0x118))||_0x3dadf7[_0x2791ce(0xfe)](_0x2791ce(0xfc))||_0x3dadf7['includes'](_0x2791ce(0x122)))return'number';return _0x2791ce(0xd1);}function getExampleValue(_0x28d7cb){const _0xd3bf1f=a25_0x1a3d,_0x1c8114=_0x28d7cb[_0xd3bf1f(0xf5)](),_0x1df450=inferParamType(_0x1c8114);if(_0x1df450===_0xd3bf1f(0x110)){if(_0x1c8114[_0xd3bf1f(0xfe)](_0xd3bf1f(0x10a))||_0x1c8114[_0xd3bf1f(0xfe)](_0xd3bf1f(0x115))||_0x1c8114[_0xd3bf1f(0xfe)](_0xd3bf1f(0xfd)))return 0xa;if(_0x1c8114['includes'](_0xd3bf1f(0x111)))return 0x1;return 0x7b;}if(_0x1c8114['includes']('date')||_0x1c8114[_0xd3bf1f(0xfe)](_0xd3bf1f(0x10b)))return _0xd3bf1f(0xf0);if(_0x1c8114['includes'](_0xd3bf1f(0xe0)))return'1';if(_0x1c8114['includes']('keyword')||_0x1c8114[_0xd3bf1f(0xfe)](_0xd3bf1f(0xda))||_0x1c8114[_0xd3bf1f(0xfe)](_0xd3bf1f(0x10e)))return _0xd3bf1f(0x106);return _0xd3bf1f(0x108);}export function detectSqlType(_0x200e6b){const _0x39229d=a25_0x1a3d;if(!_0x200e6b||typeof _0x200e6b!==_0x39229d(0xd1))return{'type':_0x39229d(0xe3),'isSelectOnly':![],'isDangerous':![],'reason':_0x39229d(0x119)};const _0x176a1f=_0x200e6b['replace'](/#\{[^}]*\}/g,'?')['replace'](/\$\{[^}]*\}/g,'?')['replace'](/@[^(\s]+(\([^)]*\))?/g,''),_0x43df9c=_0x176a1f[_0x39229d(0xd4)](),_0x57df24=_0x43df9c[_0x39229d(0x116)]('\x0a');let _0x1918e8='';for(const _0x22ea07 of _0x57df24){const _0x5c4259=_0x22ea07[_0x39229d(0xd4)]();if(!_0x5c4259||_0x5c4259['startsWith']('--')||_0x5c4259[_0x39229d(0xe5)]('/*'))continue;_0x1918e8=_0x5c4259;break;}const _0x48e523=_0x1918e8[_0x39229d(0xe2)](),_0x4cbff6=_0x43df9c[_0x39229d(0xe2)]();if(/^WITH\b/[_0x39229d(0x10f)](_0x48e523)&&/\bSELECT\b/i['test'](_0x4cbff6)){const _0xb06204=[/INSERT\s+INTO/i,/UPDATE\s+\w+\s+SET/i,/DELETE\s+FROM/i];for(const _0x218679 of _0xb06204){if(_0x218679[_0x39229d(0x10f)](_0x4cbff6))return{'type':'SELECT','isSelectOnly':![],'isDangerous':!![],'reason':_0x39229d(0xfa)};}return{'type':_0x39229d(0xef),'isSelectOnly':!![],'isDangerous':![]};}if(/^SELECT\b/[_0x39229d(0x10f)](_0x48e523)){const _0x124a20=[/INSERT\s+INTO/i,/UPDATE\s+\w+\s+SET/i,/DELETE\s+FROM/i];for(const _0x9f4a04 of _0x124a20){if(_0x9f4a04[_0x39229d(0x10f)](_0x4cbff6))return{'type':_0x39229d(0xef),'isSelectOnly':![],'isDangerous':!![],'reason':_0x39229d(0x11e)};}return{'type':_0x39229d(0xef),'isSelectOnly':!![],'isDangerous':![]};}if(/^INSERT\s+INTO\b/[_0x39229d(0x10f)](_0x48e523))return{'type':_0x39229d(0x11a),'isSelectOnly':![],'isDangerous':!![],'reason':_0x39229d(0xd8)};if(/^UPDATE\b/[_0x39229d(0x10f)](_0x48e523))return{'type':_0x39229d(0x114),'isSelectOnly':![],'isDangerous':!![],'reason':_0x39229d(0xd7)};if(/^DELETE\s+FROM\b/[_0x39229d(0x10f)](_0x48e523))return{'type':_0x39229d(0xf7),'isSelectOnly':![],'isDangerous':!![],'reason':'DELETE\x20statement\x20modifies\x20data'};const _0x369867=['DROP',_0x39229d(0x103),_0x39229d(0xe9),_0x39229d(0x107),_0x39229d(0x101),_0x39229d(0xed)];for(const _0xb03a53 of _0x369867){if(_0x48e523[_0x39229d(0xe5)](_0xb03a53))return{'type':_0x39229d(0xd9),'isSelectOnly':![],'isDangerous':!![],'reason':_0xb03a53+_0x39229d(0x11d)};}return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![],'reason':'Unknown\x20SQL\x20type'};}export function validateIsSelectOnly(_0x3e9ed1){const _0x56bc3e=a25_0x1a3d,_0x264393=detectSqlType(_0x3e9ed1);return{'valid':_0x264393[_0x56bc3e(0xec)],'reason':_0x264393[_0x56bc3e(0xec)]?undefined:_0x264393[_0x56bc3e(0x10c)]};}export function extractTableNames(_0x48dc0e){const _0x56ff36=a25_0x1a3d,_0x31c8a8=parseSqlStructure(_0x48dc0e);return _0x31c8a8[_0x56ff36(0xde)];}export function extractColumnNames(_0x13bd47){const _0x11da18=a25_0x1a3d,_0x3f1b1c=parseSqlStructure(_0x13bd47);return _0x3f1b1c[_0x11da18(0xdb)][_0x11da18(0xeb)](_0x3e8289=>({'table':_0x3e8289[_0x11da18(0x109)],'column':_0x3e8289['column']}));}export function extractParameters(_0x296ae9){const _0x1eaa2a=a25_0x1a3d,_0xef0430=parseSqlStructure(_0x296ae9);return _0xef0430[_0x1eaa2a(0xf1)];}function a25_0x55dd(){const _0x471395=['\x20|\x20','ALTER','join','68VgizxJ','example','TRUNCATE','value','table','limit','time','reason','\x22\x20在表\x20\x22','name','test','number','page','Joins:\x20','column','UPDATE','count','split','COLUMN_NOT_FOUND','num','SQL\x20content\x20is\x20empty','INSERT','TABLE_NOT_FOUND','40447278vNWkjt','\x20statement\x20modifies\x20schema','Contains\x20data\x20modification\x20keywords','push','has','8844731fprqPP','price','string','slice','filter','trim','from','\x22\x20中不存在','UPDATE\x20statement\x20modifies\x20data','INSERT\x20statement\x20modifies\x20data','DDL','search','columns','7537DTgEFE','tableName','tables','202MuREun','status','keys','toUpperCase','UNKNOWN','字段\x20\x22','startsWith','5976552ntbKxl','1249758BxyiCA','3323616zxmbpB','CREATE','Tables:\x20','map','isSelectOnly','REVOKE','replace','SELECT','2024-01-01','parameters','error','\x22\x20在数据库\x20schema\x20中不存在','Params:\x20','toLowerCase','add','DELETE','237880cFDlfL','length','CTE\x20contains\x20data\x20modification\x20keywords','match','amount','size','includes','joins','matchAll','GRANT'];a25_0x55dd=function(){return _0x471395;};return a25_0x55dd();}export function validateSqlContent(_0x2e273d,_0xa66ad2){const _0x37a872=a25_0x1a3d,_0x2bfae2=detectSqlType(_0x2e273d),_0x4f8b4c=parseSqlStructure(_0x2e273d),_0x2f834b=[];if(_0xa66ad2){const _0x311ae8=new Map(_0xa66ad2['tables'][_0x37a872(0xeb)](_0x5e419f=>[_0x5e419f[_0x37a872(0xdd)][_0x37a872(0xf5)](),_0x5e419f[_0x37a872(0xdb)]['map'](_0x3ab33c=>_0x3ab33c[_0x37a872(0xf5)]())]));for(const _0x2240af of _0x4f8b4c[_0x37a872(0xde)]){const _0x139e4b=_0x2240af['toLowerCase']();if(!_0x311ae8[_0x37a872(0x120)](_0x139e4b)){const _0x272511=Array[_0x37a872(0xd5)](_0x311ae8[_0x37a872(0xe1)]())[_0x37a872(0xd3)](_0x30dd6c=>_0x30dd6c[_0x37a872(0xfe)](_0x139e4b)||_0x139e4b[_0x37a872(0xfe)](_0x30dd6c));_0x2f834b[_0x37a872(0x11f)](createStructuredSqlError({'type':_0x37a872(0x11b),'location':_0x2240af,'message':'表\x20\x22'+_0x2240af+_0x37a872(0xf3),'severity':_0x37a872(0xf2),'suggestions':_0x272511['length']>0x0?_0x272511:Array[_0x37a872(0xd5)](_0x311ae8[_0x37a872(0xe1)]())}));}}for(const _0x194665 of _0x4f8b4c['columns']){if(_0x194665[_0x37a872(0x109)]){const _0x415ef3=_0x194665[_0x37a872(0x109)]['toLowerCase'](),_0x5ce48f=_0x311ae8['get'](_0x415ef3);if(_0x5ce48f){const _0x31c416=_0x194665[_0x37a872(0x113)][_0x37a872(0xf5)]();if(!_0x5ce48f[_0x37a872(0xfe)](_0x31c416)&&!_0x194665[_0x37a872(0x113)][_0x37a872(0xfe)]('*')){const _0x43662c=_0x5ce48f[_0x37a872(0xd3)](_0x476cb0=>_0x476cb0[_0x37a872(0xfe)](_0x31c416)||_0x31c416[_0x37a872(0xfe)](_0x476cb0));_0x2f834b['push'](createStructuredSqlError({'type':_0x37a872(0x117),'location':_0x194665[_0x37a872(0x109)]+'.'+_0x194665[_0x37a872(0x113)],'message':_0x37a872(0xe4)+_0x194665['column']+_0x37a872(0x10d)+_0x194665[_0x37a872(0x109)]+_0x37a872(0xd6),'severity':_0x37a872(0xf2),'suggestions':_0x43662c[_0x37a872(0xf9)]>0x0?_0x43662c:_0x5ce48f[_0x37a872(0xd2)](0x0,0xa)}));}}}}}return{'valid':_0x2f834b[_0x37a872(0xf9)]===0x0,'isSelectOnly':_0x2bfae2[_0x37a872(0xec)],'parsedStructure':_0x4f8b4c,'errors':_0x2f834b['length']>0x0?_0x2f834b:undefined};}export function generateSqlSummary(_0x52d818){const _0x1962f7=a25_0x1a3d,_0x1607e7=parseSqlStructure(_0x52d818),_0x9d23d4=[];return _0x1607e7[_0x1962f7(0xde)][_0x1962f7(0xf9)]>0x0&&_0x9d23d4['push'](_0x1962f7(0xea)+_0x1607e7[_0x1962f7(0xde)][_0x1962f7(0x104)](',\x20')),_0x1607e7['parameters'][_0x1962f7(0xf9)]>0x0&&_0x9d23d4[_0x1962f7(0x11f)](_0x1962f7(0xf4)+_0x1607e7[_0x1962f7(0xf1)][_0x1962f7(0xeb)](_0x35b1e9=>_0x35b1e9[_0x1962f7(0x10e)])[_0x1962f7(0x104)](',\x20')),_0x1607e7[_0x1962f7(0xff)]&&_0x1607e7[_0x1962f7(0xff)][_0x1962f7(0xf9)]>0x0&&_0x9d23d4[_0x1962f7(0x11f)](_0x1962f7(0x112)+_0x1607e7['joins'][_0x1962f7(0xf9)]),_0x9d23d4[_0x1962f7(0xf9)]>0x0?_0x9d23d4[_0x1962f7(0x104)](_0x1962f7(0x102)):'SELECT\x20query';}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovrabet/dataset-mcp-server",
3
- "version": "1.3.2-beta.2",
3
+ "version": "1.3.2",
4
4
  "description": "MCP server for Lovrabet Dataset access",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1 +0,0 @@
1
- function a19_0x4e2b(){const _0x3af931=['sqlContent\x20is\x20required\x20and\x20cannot\x20be\x20empty.','sqlContent','1109090hxoMYb','name','success','SQL\x20content\x20cannot\x20be\x20empty','24hUZWVe','SQL\x20validation\x20failed:\x20','test','trim','toUpperCase','2346777GwkqcY','GRANT','sqlId','SELECT','UPDATE\x5cs+\x5cw+\x5cs+SET','4135290CIpRZT','EXEC','361RtzmRf','saveUserCustomSql','.\x20Only\x20SELECT\x20queries\x20are\x20allowed.','5084PKeZRW','startsWith','[saveCustomSql]\x20Verification\x20query\x20failed:','verified','2319kGssIu','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','2036364LNNiwi','sqlName','valid','Only\x20SELECT\x20queries\x20are\x20allowed.\x20The\x20SQL\x20must\x20start\x20with\x20SELECT\x20(after\x20any\x20comments).','createTime','Failed\x20to\x20save\x20custom\x20SQL','8674Oelhss','find','data','sql','split','warn','dbId\x20is\x20required.\x20Get\x20it\x20from\x20get_dataset_detail\x20->\x20basic.database.dbId','sqlCode','INSERT\x5cs+INTO','TRUNCATE','replace','DROP\x5cs+(TABLE|INDEX|DATABASE)','REVOKE','2078703vfqdfA','28BXMPyg','errorMsg'];a19_0x4e2b=function(){return _0x3af931;};return a19_0x4e2b();}(function(_0x4f33ab,_0x5a5588){const _0x1b617a=a19_0x470b,_0x698ca1=_0x4f33ab();while(!![]){try{const _0x5700fc=-parseInt(_0x1b617a(0xd0))/0x1*(-parseInt(_0x1b617a(0xae))/0x2)+parseInt(_0x1b617a(0xd7))/0x3*(parseInt(_0x1b617a(0xd3))/0x4)+-parseInt(_0x1b617a(0xce))/0x5+-parseInt(_0x1b617a(0xd9))/0x6*(parseInt(_0x1b617a(0xbc))/0x7)+parseInt(_0x1b617a(0xc4))/0x8*(parseInt(_0x1b617a(0xc9))/0x9)+-parseInt(_0x1b617a(0xc0))/0xa+-parseInt(_0x1b617a(0xbb))/0xb;if(_0x5700fc===_0x5a5588)break;else _0x698ca1['push'](_0x698ca1['shift']());}catch(_0x393f88){_0x698ca1['push'](_0x698ca1['shift']());}}}(a19_0x4e2b,0xce83b));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode,getEnvironment,shouldLog}from'../config/env.js';function validateSelectSql(_0x25ecb7){const _0x252b73=a19_0x470b;if(!_0x25ecb7||typeof _0x25ecb7!=='string')return{'valid':![],'reason':_0x252b73(0xc3)};const _0x5623e5=_0x25ecb7[_0x252b73(0xb8)](/#\{[^}]*\}/g,'?')['replace'](/\$\{[^}]*\}/g,'?')[_0x252b73(0xb8)](/@[^(\s]+(\([^)]*\))?/g,''),_0x39b428=_0x5623e5[_0x252b73(0xc7)](),_0x536835=_0x39b428[_0x252b73(0xb2)]('\x0a');let _0x4a63d1='';for(const _0x1f3ccd of _0x536835){const _0x22db23=_0x1f3ccd[_0x252b73(0xc7)]();if(!_0x22db23||_0x22db23['startsWith']('--')||_0x22db23[_0x252b73(0xd4)]('/*'))continue;_0x4a63d1=_0x22db23;break;}if(!_0x4a63d1[_0x252b73(0xc8)]()[_0x252b73(0xd4)](_0x252b73(0xcc)))return{'valid':![],'reason':_0x252b73(0xab)};const _0x133424=[_0x252b73(0xb6),_0x252b73(0xcd),'DELETE\x5cs+FROM',_0x252b73(0xb9),'ALTER\x5cs+(TABLE|DATABASE)','CREATE\x5cs+(TABLE|INDEX|DATABASE|VIEW)',_0x252b73(0xb7),_0x252b73(0xca),_0x252b73(0xba),_0x252b73(0xcf),'EXECUTE'],_0x1de708=_0x39b428[_0x252b73(0xc8)]();for(const _0x184ffa of _0x133424){const _0x425d51=new RegExp(_0x184ffa,'i');if(_0x425d51[_0x252b73(0xc6)](_0x1de708))return{'valid':![],'reason':'Forbidden\x20keyword\x20detected:\x20'+_0x184ffa['replace']('\x5c\x5cs+','\x20')+_0x252b73(0xd2)};}return{'valid':!![]};}function a19_0x470b(_0x166ec7,_0x686672){_0x166ec7=_0x166ec7-0xaa;const _0x4e2b20=a19_0x4e2b();let _0x470b84=_0x4e2b20[_0x166ec7];return _0x470b84;}export async function saveCustomSql(_0x203721){const _0x33e7b2=a19_0x470b,{appCode:appCode=getEnvAppCode(),cookie:_0x50c3c1,sqlName:_0xc5820d,dbId:_0x328570,sqlContent:_0x5b102c,verifyAfterSave:verifyAfterSave=!![]}=_0x203721;if(!appCode)throw new Error(_0x33e7b2(0xd8));if(!_0xc5820d||_0xc5820d['trim']()==='')throw new Error('sqlName\x20is\x20required\x20and\x20cannot\x20be\x20empty.');if(!_0x328570)throw new Error(_0x33e7b2(0xb4));if(!_0x5b102c||_0x5b102c[_0x33e7b2(0xc7)]()==='')throw new Error(_0x33e7b2(0xbe));const _0x8ec2cd=validateSelectSql(_0x5b102c);if(!_0x8ec2cd[_0x33e7b2(0xaa)])throw new Error(_0x33e7b2(0xc5)+_0x8ec2cd['reason']);const _0x25400e=new DevApiClient({'appCode':appCode,'cookie':_0x50c3c1}),_0x5d22ee=getEnvironment(),_0x1f9381=_0xc5820d['trim'](),_0x28d5cc=await _0x25400e[_0x33e7b2(0xd1)]({'sqlName':_0x1f9381,'dbId':_0x328570,'sqlContent':_0x5b102c['trim']()});if(!_0x28d5cc[_0x33e7b2(0xc2)])return{'success':![],'message':_0x28d5cc['message']||_0x28d5cc[_0x33e7b2(0xbd)]||_0x33e7b2(0xad)};const _0x4d08c2={'success':!![],'message':'Custom\x20SQL\x20saved\x20successfully','data':_0x28d5cc[_0x33e7b2(0xb0)]};if(verifyAfterSave)try{const _0x118249=await _0x25400e['getCustomSqlList']({'pageSize':0xa,'currentPage':0x1,'sqlName':_0x1f9381}),_0x5c1d74=_0x118249['data']?.['tableData']||[],_0x458fa1=_0x5c1d74[_0x33e7b2(0xaf)](_0xc17a55=>_0xc17a55[_0x33e7b2(0xda)]===_0x1f9381||_0xc17a55[_0x33e7b2(0xc1)]===_0x1f9381);_0x458fa1?_0x4d08c2[_0x33e7b2(0xd6)]={'found':!![],'sqlInfo':{'sqlCode':_0x458fa1[_0x33e7b2(0xb5)]||appCode+'-'+(_0x458fa1[_0x33e7b2(0xcb)]||_0x458fa1['id']),'sqlId':_0x458fa1[_0x33e7b2(0xcb)]||_0x458fa1['id'],'name':_0x458fa1[_0x33e7b2(0xda)]||_0x458fa1[_0x33e7b2(0xc1)],'sqlContent':_0x458fa1[_0x33e7b2(0xbf)]||_0x458fa1[_0x33e7b2(0xb1)],'createdTime':_0x458fa1['createdTime']||_0x458fa1[_0x33e7b2(0xac)]}}:_0x4d08c2[_0x33e7b2(0xd6)]={'found':![]};}catch(_0x336173){shouldLog()&&console[_0x33e7b2(0xb3)](_0x33e7b2(0xd5),_0x336173),_0x4d08c2['verified']={'found':![]};}return _0x4d08c2;}