@lovrabet/dataset-mcp-server 1.3.2-beta.1 → 1.3.2-beta.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(_0xb4e0c2,_0x27ed43){const _0x4130a9=a21_0x3988,_0xb6ab4a=_0xb4e0c2();while(!![]){try{const _0xcdb263=-parseInt(_0x4130a9(0x1b7))/0x1+-parseInt(_0x4130a9(0x1dc))/0x2*(-parseInt(_0x4130a9(0x1ae))/0x3)+-parseInt(_0x4130a9(0x1d0))/0x4+parseInt(_0x4130a9(0x1d5))/0x5+parseInt(_0x4130a9(0x1bb))/0x6*(-parseInt(_0x4130a9(0x1df))/0x7)+-parseInt(_0x4130a9(0x1d7))/0x8*(-parseInt(_0x4130a9(0x1ba))/0x9)+parseInt(_0x4130a9(0x1af))/0xa;if(_0xcdb263===_0x27ed43)break;else _0xb6ab4a['push'](_0xb6ab4a['shift']());}catch(_0x504ca7){_0xb6ab4a['push'](_0xb6ab4a['shift']());}}}(a21_0x447a,0x69ba3));import{DevApiClient}from'../api/dev-api-client.js';function a21_0x3988(_0x5c4dc5,_0x3c60f3){_0x5c4dc5=_0x5c4dc5-0x1a9;const _0x447a30=a21_0x447a();let _0x39884d=_0x447a30[_0x5c4dc5];return _0x39884d;}import{validateIsSelectOnly,parseSqlStructure,validateSqlContent as a21_0x1a8e5f,generateSqlSummary}from'../utils/sql-parser.js';import{createStructuredSqlError}from'../types/mcp-types.js';async function fetchSchemaInfo(_0x2d0246,_0x501318){const _0xdbd999=a21_0x3988,_0xb6755b=[];for(const _0x478bba of _0x2d0246){try{const _0x20bf5d=/^\d+$/[_0xdbd999(0x1d3)](_0x478bba);let _0x4fe46d=_0x478bba;if(!_0x20bf5d){const _0x51a6ba=await _0x501318[_0xdbd999(0x1e2)]({'pageSize':0x3e7}),_0x4a596a=_0x51a6ba[_0xdbd999(0x1aa)]?.[_0xdbd999(0x1ab)]||[],_0x189a7f=_0x4a596a['find'](_0x4e07fb=>_0x4e07fb[_0xdbd999(0x1b6)]===_0x478bba);if(!_0x189a7f)continue;_0x4fe46d=String(_0x189a7f['id']);}const _0x2c8d95=await _0x501318[_0xdbd999(0x1de)](_0x4fe46d),_0x5722af=_0x2c8d95[_0xdbd999(0x1aa)]?.[_0xdbd999(0x1d1)]||'',_0xf4a607=_0x2c8d95[_0xdbd999(0x1aa)]?.[_0xdbd999(0x1cb)]||[],_0xb922b7=_0xf4a607[_0xdbd999(0x1a9)](_0x3b860e=>_0x3b860e[_0xdbd999(0x1b6)]||_0x3b860e[_0xdbd999(0x1c2)]);_0x5722af&&_0xb922b7[_0xdbd999(0x1da)]>0x0&&_0xb6755b['push']({'tableName':_0x5722af,'columns':_0xb922b7});}catch(_0x3e3481){process['env']['NODE_ENV']!==_0xdbd999(0x1d3)&&console['warn'](_0xdbd999(0x1b4)+_0x478bba+':',_0x3e3481);}}return _0xb6755b;}export async function validateSqlContentTool(_0x52e4fb){const _0x359b27=a21_0x3988,{appCode:appCode=process[_0x359b27(0x1b5)]['LOVRABET_APP_CODE'],cookie:_0x119692,env:env=process[_0x359b27(0x1b5)]['LOVRABET_ENV']||'online',sqlContent:_0x5b8f45,dbId:_0x10912c,validateSchemas:validateSchemas=[]}=_0x52e4fb;if(!_0x5b8f45||_0x5b8f45[_0x359b27(0x1c5)]()==='')return{'success':![],'message':_0x359b27(0x1cf),'validation':{'valid':![],'isSelectOnly':![]},'nextSteps':[{'action':'Provide\x20SQL\x20content\x20to\x20validate','tool':_0x359b27(0x1be),'reason':'SQL\x20content\x20cannot\x20be\x20empty'}]};const _0x3027bd=validateIsSelectOnly(_0x5b8f45);if(!_0x3027bd[_0x359b27(0x1b2)])return{'success':![],'message':_0x359b27(0x1e1)+_0x3027bd[_0x359b27(0x1ac)],'validation':{'valid':![],'isSelectOnly':![],'errors':[createStructuredSqlError({'type':_0x359b27(0x1c9),'location':_0x359b27(0x1bf),'message':_0x3027bd['reason']||_0x359b27(0x1cc),'severity':_0x359b27(0x1b3),'fixSteps':[{'description':'SQL\x20must\x20be\x20a\x20SELECT\x20statement','example':'SELECT\x20id,\x20name\x20FROM\x20customer\x20WHERE\x20status\x20=\x201'}]})]},'nextSteps':[{'action':_0x359b27(0x1c7),'tool':_0x359b27(0x1ca),'reason':'Only\x20SELECT\x20queries\x20are\x20allowed\x20for\x20custom\x20SQL'}]};const _0x145d91=parseSqlStructure(_0x5b8f45),_0x449a5f=generateSqlSummary(_0x5b8f45);let _0x12de63;if(validateSchemas[_0x359b27(0x1da)]>0x0&&appCode){const _0xace46e=new DevApiClient({'appCode':appCode,'cookie':_0x119692,'env':env});_0x12de63=await fetchSchemaInfo(validateSchemas,_0xace46e);}const _0x4af7a1=a21_0x1a8e5f(_0x5b8f45,_0x12de63?{'tables':_0x12de63}:undefined),_0x12f90f={'success':_0x4af7a1[_0x359b27(0x1b2)]||!![],'message':_0x4af7a1[_0x359b27(0x1b2)]?_0x359b27(0x1c1)+_0x449a5f+')':_0x359b27(0x1db)+(_0x4af7a1['errors']?.[_0x359b27(0x1da)]||0x0)+_0x359b27(0x1d8),'validation':{..._0x4af7a1,'parsedStructure':_0x145d91}},_0xae82fb=[];if(_0x4af7a1[_0x359b27(0x1b2)])_0x10912c?_0xae82fb[_0x359b27(0x1b8)]({'action':_0x359b27(0x1ad),'tool':_0x359b27(0x1ca),'params':{'sqlName':'<sql-name>','dbId':_0x10912c,'sqlContent':_0x5b8f45},'reason':'SQL\x20is\x20valid\x20and\x20ready\x20to\x20be\x20saved','priority':'high'}):_0xae82fb[_0x359b27(0x1b8)]({'action':_0x359b27(0x1d4),'tool':_0x359b27(0x1b9),'params':{'datasetCode':'<dataset-code>'},'reason':_0x359b27(0x1ce),'priority':_0x359b27(0x1d9)});else{_0xae82fb[_0x359b27(0x1b8)]({'action':_0x359b27(0x1dd),'tool':_0x359b27(0x1be),'reason':_0x359b27(0x1c4),'priority':_0x359b27(0x1d9)});for(const _0x5b308c of _0x4af7a1[_0x359b27(0x1c3)]||[]){if(_0x5b308c['type']===_0x359b27(0x1d6)||_0x5b308c['type']==='TABLE_NOT_FOUND'){const _0x148a34=_0x5b308c[_0x359b27(0x1b0)][0x0]?.[_0x359b27(0x1cd)]||_0x5b308c['typeLabel'];_0xae82fb[_0x359b27(0x1b8)]({'action':_0x359b27(0x1c0),'tool':'get_dataset_detail','params':{'datasetCode':_0x359b27(0x1d2)},'reason':_0x148a34,'priority':'medium'});break;}}}return!_0x4af7a1['valid']&&_0x4af7a1['errors']?.[_0x359b27(0x1b1)](_0x3df3d7=>_0x3df3d7[_0x359b27(0x1c6)]===_0x359b27(0x1bd))&&_0xae82fb[_0x359b27(0x1b8)]({'action':_0x359b27(0x1e0),'tool':_0x359b27(0x1bc),'reason':'Find\x20the\x20correct\x20table\x20names\x20for\x20your\x20SQL','priority':_0x359b27(0x1c8)}),_0x12f90f['nextSteps']=_0xae82fb,_0x12f90f;}function a21_0x447a(){const _0xffb1c0=['type','Modify\x20SQL\x20to\x20be\x20a\x20SELECT\x20statement\x20only','medium','SYNTAX_ERROR','save_or_update_custom_sql','properties','Invalid\x20SQL','description','Need\x20dbId\x20from\x20dataset\x20detail\x20to\x20save\x20SQL','SQL\x20content\x20is\x20required','3011728iUlTEQ','tableName','<dataset-code>','test','Get\x20database\x20ID\x20to\x20save\x20this\x20SQL','276025xOwQKl','COLUMN_NOT_FOUND','16AXCtda','\x20error(s))','high','length','SQL\x20validation\x20failed\x20(','282554YrHayC','Review\x20SQL\x20errors\x20and\x20fix','getDatasetDetail','3563315zyBEve','List\x20all\x20available\x20datasets','SQL\x20validation\x20failed:\x20','getDatasetList','map','data','tableData','reason','Save\x20this\x20validated\x20SQL','6seFLhe','11734340VMYBuG','fixSteps','some','valid','error','[validateSqlContent]\x20Failed\x20to\x20fetch\x20schema\x20for\x20','env','code','656411tDHfRW','push','get_dataset_detail','3781143WKOzjp','6lbBozm','list_datasets','TABLE_NOT_FOUND','validate_sql_content','SQL_START','Get\x20dataset\x20details\x20to\x20find\x20correct\x20table/column\x20names','SQL\x20validation\x20passed\x20(','fieldCode','errors','Fix\x20the\x20identified\x20errors\x20before\x20saving','trim'];a21_0x447a=function(){return _0xffb1c0;};return a21_0x447a();}export{validateSqlContentTool as validateSqlContent};
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 +1 @@
1
- function a22_0x478f(_0x5da4be,_0x265949){_0x5da4be=_0x5da4be-0x1cd;var _0xc2cf37=a22_0xc2cf();var _0x478fc3=_0xc2cf37[_0x5da4be];return _0x478fc3;}(function(_0x25f81d,_0x2a7151){var _0x40a95b=a22_0x478f,_0x14579f=_0x25f81d();while(!![]){try{var _0x10db52=-parseInt(_0x40a95b(0x1d8))/0x1*(parseInt(_0x40a95b(0x1d5))/0x2)+parseInt(_0x40a95b(0x1d4))/0x3*(parseInt(_0x40a95b(0x1d9))/0x4)+parseInt(_0x40a95b(0x1d2))/0x5*(-parseInt(_0x40a95b(0x1d1))/0x6)+parseInt(_0x40a95b(0x1cf))/0x7*(parseInt(_0x40a95b(0x1d6))/0x8)+parseInt(_0x40a95b(0x1d7))/0x9*(parseInt(_0x40a95b(0x1d3))/0xa)+parseInt(_0x40a95b(0x1d0))/0xb+parseInt(_0x40a95b(0x1cd))/0xc*(-parseInt(_0x40a95b(0x1ce))/0xd);if(_0x10db52===_0x2a7151)break;else _0x14579f['push'](_0x14579f['shift']());}catch(_0x4daa01){_0x14579f['push'](_0x14579f['shift']());}}}(a22_0xc2cf,0xe9523));function a22_0xc2cf(){var _0x252951=['13gzHpgi','98OSMDff','19645439eQRrxK','1134402lQfsim','25maUfmk','4363250JdDZmg','3eOVMQK','1603698KNtixW','904072xRCtqu','9ppfkJj','2izFaiC','5893836MkfLxB','21277716ANkSbM'];a22_0xc2cf=function(){return _0x252951;};return a22_0xc2cf();}export{createError,createAuthError,createMissingParamError,createDatasetNotFoundError,createSqlNotFoundError,createSqlValidationError,createStructuredSqlError,fromLovrabetError,SQL_ERROR_TYPE_LABELS}from'./mcp-types.js';
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 +1 @@
1
- const a23_0x2c68f9=a23_0x25d4;function a23_0x59a5(){const _0x5cf3ad=['44WgQNTW','NETWORK_ERROR','get_dataset_detail','push','SQL_EXECUTION_FAILED','9224UnXrzz','API_ERROR','语法错误','fixedSql','error','检查\x20SQL\x20语法,确保关键字拼写正确、括号匹配','SQL_NOT_FOUND','SQL_VALIDATION_FAILED','3271910IPZSLr','length','SQL\x20不存在:\x20','使用\x20get_dataset_detail\x20工具查看数据集的所有字段','list_datasets','确保\x20SELECT\x20语句格式正确,如:\x20SELECT\x20id,\x20name\x20FROM\x20table\x20WHERE\x20status\x20=\x201','432162Ttyztj','135276cymzZb','canAutoFix','7bqyojY','4PXSJWo','response','数据集不存在:\x20','login({\x20env:\x20\x22online\x22\x20})','get_dataset_detail({\x20datasetCode:\x20\x22customer\x22\x20})','查看所有可用的数据集','suggestions','5499456oMcDhs','类型不匹配','需要登录才能访问\x20Lovrabet\x20数据。请先使用\x20login\x20工具进行登录。','status','登录到\x20Lovrabet\x20平台','PARAMETER_MISSING','查看所有可用的\x20SQL\x20查询','<dataset-code>','缺少\x20WHERE\x20条件','TABLE_NOT_FOUND','PARAMETER_INVALID','recoverable','fixSteps','1062000SqLEte','AUTH_REQUIRED','description','type','list_sql_queries','code','字段不存在','location','缺少必需参数:\x20','使用\x20list_datasets\x20工具查看所有可用的数据集表名','DATASET_NOT_FOUND','list_sql_queries({\x20pageSize:\x20999\x20})','typeLabel','1570UNgLcx','UNKNOWN_ERROR','suggestedAction','表不存在','tool','toISOString','message','example','7443hqfNVf','124rGRpRr','不安全的查询','list_datasets({\x20pageSize:\x20999\x20})','severity'];a23_0x59a5=function(){return _0x5cf3ad;};return a23_0x59a5();}(function(_0x3ddfa7,_0xa021a2){const _0x18c2b0=a23_0x25d4,_0x5334dc=_0x3ddfa7();while(!![]){try{const _0x5dfcf2=parseInt(_0x18c2b0(0x14b))/0x1*(parseInt(_0x18c2b0(0x142))/0x2)+parseInt(_0x18c2b0(0x159))/0x3+-parseInt(_0x18c2b0(0x15d))/0x4*(parseInt(_0x18c2b0(0x153))/0x5)+parseInt(_0x18c2b0(0x171))/0x6*(-parseInt(_0x18c2b0(0x15c))/0x7)+parseInt(_0x18c2b0(0x164))/0x8+-parseInt(_0x18c2b0(0x186))/0x9*(parseInt(_0x18c2b0(0x17e))/0xa)+-parseInt(_0x18c2b0(0x146))/0xb*(parseInt(_0x18c2b0(0x15a))/0xc);if(_0x5dfcf2===_0xa021a2)break;else _0x5334dc['push'](_0x5334dc['shift']());}catch(_0x587225){_0x5334dc['push'](_0x5334dc['shift']());}}}(a23_0x59a5,0x60f05));function a23_0x25d4(_0x2b4af8,_0x4aa69b){_0x2b4af8=_0x2b4af8-0x142;const _0x59a582=a23_0x59a5();let _0x25d472=_0x59a582[_0x2b4af8];return _0x25d472;}export const SQL_ERROR_TYPE_LABELS={'TABLE_NOT_FOUND':a23_0x2c68f9(0x181),'COLUMN_NOT_FOUND':a23_0x2c68f9(0x177),'AMBIGUOUS_COLUMN':'字段名歧义','SYNTAX_ERROR':a23_0x2c68f9(0x14d),'TYPE_MISMATCH':a23_0x2c68f9(0x165),'MISSING_WHERE_CLAUSE':a23_0x2c68f9(0x16c),'UNSAFE_QUERY':a23_0x2c68f9(0x143)};export function createError(_0x3c358a){const _0x13cf44=a23_0x2c68f9;return{'error':!![],'code':_0x3c358a['code'],'message':_0x3c358a[_0x13cf44(0x184)],'status':_0x3c358a[_0x13cf44(0x167)],'description':_0x3c358a['description'],'response':_0x3c358a['response'],'suggestedAction':_0x3c358a[_0x13cf44(0x180)],'recoverable':_0x3c358a[_0x13cf44(0x16f)]??!![],'timestamp':new Date()[_0x13cf44(0x183)]()};}export function createAuthError(){const _0x4a3e8a=a23_0x2c68f9;return createError({'code':'AUTH_REQUIRED','message':_0x4a3e8a(0x166),'suggestedAction':{'tool':'login','description':_0x4a3e8a(0x168),'example':_0x4a3e8a(0x160)},'recoverable':!![]});}export function createMissingParamError(_0x5e2b0f,_0x9cc8d9){const _0x3c5278=a23_0x2c68f9;return createError({'code':_0x3c5278(0x169),'message':_0x3c5278(0x179)+_0x5e2b0f+(_0x9cc8d9?'\x20('+_0x9cc8d9+')':''),'recoverable':!![]});}export function createDatasetNotFoundError(_0x568919){const _0x45cdda=a23_0x2c68f9;return createError({'code':_0x45cdda(0x17b),'message':_0x45cdda(0x15f)+_0x568919,'suggestedAction':{'tool':_0x45cdda(0x157),'description':_0x45cdda(0x162),'example':'list_datasets({\x20pageSize:\x20999\x20})'},'recoverable':!![]});}export function createSqlNotFoundError(_0x163294){const _0x329207=a23_0x2c68f9;return createError({'code':_0x329207(0x151),'message':_0x329207(0x155)+_0x163294,'suggestedAction':{'tool':_0x329207(0x175),'description':_0x329207(0x16a),'example':_0x329207(0x17c)},'recoverable':!![]});}export function createSqlValidationError(_0x553481){const _0x922754=a23_0x2c68f9,_0x77de25=_0x553481[_0x922754(0x170)][_0x922754(0x154)]>0x0,_0xe9785f=_0x77de25?_0x553481[_0x922754(0x170)][0x0]:undefined,_0x56681a={'type':_0x553481[_0x922754(0x174)],'typeLabel':_0x553481[_0x922754(0x17d)],'location':_0x553481[_0x922754(0x178)],'severity':_0x553481[_0x922754(0x145)],'fixSteps':_0x553481[_0x922754(0x170)],'suggestions':_0x553481[_0x922754(0x163)],'canAutoFix':_0x553481[_0x922754(0x15b)],'fixedSql':_0x553481[_0x922754(0x14e)]};return createError({'code':_0x922754(0x152),'message':_0x553481[_0x922754(0x17d)]+':\x20'+_0x553481[_0x922754(0x184)],'status':_0x553481[_0x922754(0x167)],'description':_0x56681a,'response':_0x553481[_0x922754(0x15e)],'suggestedAction':_0xe9785f?{'tool':_0xe9785f[_0x922754(0x182)],'description':_0xe9785f[_0x922754(0x173)],'params':_0xe9785f['toolParams'],'example':_0xe9785f[_0x922754(0x185)]}:{'tool':_0x922754(0x148),'description':'获取数据集详情以确认表名和字段名','params':{'datasetCode':_0x922754(0x16b)}},'recoverable':_0x553481[_0x922754(0x145)]!==_0x922754(0x14f)});}export function createStructuredSqlError(_0x431bcc){const _0x45dcfb=a23_0x2c68f9,_0x2b9cde=SQL_ERROR_TYPE_LABELS[_0x431bcc['type']],_0x5f4b87=_0x431bcc['severity']??_0x45dcfb(0x14f),_0x51aa15=[];if(_0x431bcc['type']===_0x45dcfb(0x16d))_0x51aa15[_0x45dcfb(0x149)]({'description':_0x45dcfb(0x17a),'tool':_0x45dcfb(0x157),'toolParams':{'pageSize':0x3e7},'example':_0x45dcfb(0x144)});else{if(_0x431bcc[_0x45dcfb(0x174)]==='COLUMN_NOT_FOUND')_0x51aa15['push']({'description':_0x45dcfb(0x156),'tool':_0x45dcfb(0x148),'toolParams':{'datasetCode':'<dataset-code>'},'example':_0x45dcfb(0x161)});else _0x431bcc[_0x45dcfb(0x174)]==='SYNTAX_ERROR'&&_0x51aa15[_0x45dcfb(0x149)]({'description':_0x45dcfb(0x150),'example':_0x45dcfb(0x158)});}return{'type':_0x431bcc['type'],'typeLabel':_0x2b9cde,'location':_0x431bcc[_0x45dcfb(0x178)],'message':_0x431bcc[_0x45dcfb(0x184)],'severity':_0x5f4b87,'fixSteps':_0x431bcc[_0x45dcfb(0x170)]??_0x51aa15,'suggestions':_0x431bcc[_0x45dcfb(0x163)],'canAutoFix':_0x431bcc[_0x45dcfb(0x15b)],'fixedSql':_0x431bcc[_0x45dcfb(0x14e)],'status':_0x431bcc[_0x45dcfb(0x167)],'response':_0x431bcc[_0x45dcfb(0x15e)]};}export function fromLovrabetError(_0x46ea5f,_0x344c6d){const _0x2bc913=a23_0x2c68f9;return createError({'code':mapSdkCodeToMcpCode(_0x46ea5f[_0x2bc913(0x176)]),'message':_0x46ea5f['message'],'status':_0x46ea5f['status'],'description':_0x46ea5f['description'],'response':_0x46ea5f['response'],'suggestedAction':_0x344c6d,'recoverable':_0x46ea5f[_0x2bc913(0x167)]?_0x46ea5f['status']<0x1f4:!![]});}function mapSdkCodeToMcpCode(_0x1a76d0){const _0x487115=a23_0x2c68f9;if(!_0x1a76d0)return'UNKNOWN_ERROR';const _0x40cbed={'AUTH_REQUIRED':_0x487115(0x172),'AUTH_FAILED':_0x487115(0x172),'UNAUTHORIZED':_0x487115(0x172),'DATASET_NOT_FOUND':_0x487115(0x17b),'NOT_FOUND':_0x487115(0x17b),'INVALID_PARAMETER':_0x487115(0x16e),'MISSING_PARAMETER':'PARAMETER_MISSING','SQL_ERROR':_0x487115(0x14a),'NETWORK_ERROR':_0x487115(0x147),'API_ERROR':_0x487115(0x14c)};return _0x40cbed[_0x1a76d0]||_0x487115(0x17f);}
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 +1 @@
1
- (function(_0xef3225,_0x11e057){const _0x3bba3e=a24_0x4b77,_0x112d64=_0xef3225();while(!![]){try{const _0x402a0a=parseInt(_0x3bba3e(0x1b8))/0x1+parseInt(_0x3bba3e(0x19c))/0x2*(parseInt(_0x3bba3e(0x1cd))/0x3)+-parseInt(_0x3bba3e(0x1a1))/0x4*(parseInt(_0x3bba3e(0x1a5))/0x5)+parseInt(_0x3bba3e(0x1a9))/0x6*(parseInt(_0x3bba3e(0x1d7))/0x7)+parseInt(_0x3bba3e(0x19d))/0x8+-parseInt(_0x3bba3e(0x1df))/0x9*(parseInt(_0x3bba3e(0x1de))/0xa)+parseInt(_0x3bba3e(0x1d3))/0xb*(-parseInt(_0x3bba3e(0x1bc))/0xc);if(_0x402a0a===_0x11e057)break;else _0x112d64['push'](_0x112d64['shift']());}catch(_0x3c91be){_0x112d64['push'](_0x112d64['shift']());}}}(a24_0x5a38,0x5e397));import{createStructuredSqlError}from'../types/mcp-types.js';export function parseSqlStructure(_0x4f5836){const _0x33e21a=a24_0x4b77,_0x9fa466={'tables':[],'columns':[],'parameters':[],'joins':[]};if(!_0x4f5836||typeof _0x4f5836!=='string')return _0x9fa466;const _0xee26e3=_0x4f5836[_0x33e21a(0x1c3)](/#\{[^}]*\}/g,'?')[_0x33e21a(0x1c3)](/\$\{[^}]*\}/g,'?')[_0x33e21a(0x1c3)](/'[^']*'/g,'\x27\x27')['replace'](/--.*$/gm,'')[_0x33e21a(0x1c3)](/\/\*[\s\S]*?\*\//g,''),_0x29a079=_0xee26e3[_0x33e21a(0x1db)](/FROM\s+([^\s,)(]+)/i);if(_0x29a079){const _0x431e76=_0x29a079[0x1][_0x33e21a(0x1c3)](/[`"]/g,'');_0x9fa466[_0x33e21a(0x1b5)][_0x33e21a(0x1a3)](_0x431e76);}const _0x13e9ca=_0xee26e3[_0x33e21a(0x1d4)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi);for(const _0x15b1d7 of _0x13e9ca){const _0x3accdc=_0x15b1d7[0x1]['replace'](/[`"]/g,'');_0x3accdc&&!_0x9fa466[_0x33e21a(0x1b5)]['includes'](_0x3accdc)&&_0x9fa466['tables']['push'](_0x3accdc);}const _0x2edb4e=_0xee26e3[_0x33e21a(0x1db)](/SELECT\s+([\s\S]+?)\s+FROM/i);if(_0x2edb4e){const _0x421ab5=_0x2edb4e[0x1]['trim']();if(_0x421ab5!=='*'){const _0x3cd1be=splitSqlColumns(_0x421ab5);for(const _0x5970ff of _0x3cd1be){const _0x5a59d9=_0x5970ff['trim']();if(_0x5a59d9&&!_0x5a59d9['match'](/^\d+$/)){const _0x4fb743=_0x5a59d9[_0x33e21a(0x1a2)](/\s+AS\s+/i),_0x546705=_0x4fb743[0x0][_0x33e21a(0x1aa)](),_0xd483ee=_0x4fb743[0x1]?.[_0x33e21a(0x1aa)]();if(_0x546705[_0x33e21a(0x1c7)]('.')){const [_0x524954,_0x335218]=_0x546705['split']('.');_0x9fa466[_0x33e21a(0x1d9)]['push']({'table':_0x524954[_0x33e21a(0x1aa)](),'column':_0x335218[_0x33e21a(0x1c3)](/[`"]/g,'')[_0x33e21a(0x1aa)](),'alias':_0xd483ee});}else!_0x546705['includes']('(')&&_0x9fa466[_0x33e21a(0x1d9)]['push']({'table':'','column':_0x546705[_0x33e21a(0x1c3)](/[`"]/g,''),'alias':_0xd483ee});}}}}const _0x59047d=_0xee26e3[_0x33e21a(0x1d4)](/JOIN\s+(\w+)\s+(?:AS\s+)?(\w+)?\s+ON\s+([\w.]+)\s*=\s*([\w.]+)/gi);for(const _0x1024e3 of _0x59047d){const [,,,_0x3e076f,_0x16427c]=_0x1024e3;if(_0x3e076f&&_0x16427c){const [_0x47027e,_0x8d9c30]=_0x3e076f[_0x33e21a(0x1c7)]('.')?_0x3e076f[_0x33e21a(0x1a2)]('.'):['',_0x3e076f],[_0x4d8ec0,_0x19d3fb]=_0x16427c[_0x33e21a(0x1c7)]('.')?_0x16427c[_0x33e21a(0x1a2)]('.'):['',_0x16427c];_0x9fa466[_0x33e21a(0x1c9)]?.[_0x33e21a(0x1a3)]({'leftTable':_0x47027e,'leftColumn':_0x8d9c30,'rightTable':_0x4d8ec0,'rightColumn':_0x19d3fb});}}const _0x2c2363=_0x4f5836[_0x33e21a(0x1d4)](/[#\$]\{(\w+)\}/g),_0x52e44d=new Set();for(const _0xa9f955 of _0x2c2363){const _0x35d1b8=_0xa9f955[0x1];!_0x52e44d[_0x33e21a(0x1c5)](_0x35d1b8)&&(_0x52e44d[_0x33e21a(0x1b7)](_0x35d1b8),_0x9fa466[_0x33e21a(0x1ca)][_0x33e21a(0x1a3)]({'name':_0x35d1b8,'type':inferParamType(_0x35d1b8),'example':getExampleValue(_0x35d1b8)}));}return _0x9fa466;}function splitSqlColumns(_0x33f6ac){const _0x4eb49a=a24_0x4b77,_0x4bfe83=[];let _0x4dce7a='',_0x423703=0x0;for(let _0x4e45b0=0x0;_0x4e45b0<_0x33f6ac['length'];_0x4e45b0++){const _0x337116=_0x33f6ac[_0x4e45b0];if(_0x337116==='(')_0x423703++,_0x4dce7a+=_0x337116;else{if(_0x337116===')')_0x423703--,_0x4dce7a+=_0x337116;else _0x337116===','&&_0x423703===0x0?(_0x4bfe83[_0x4eb49a(0x1a3)](_0x4dce7a),_0x4dce7a=''):_0x4dce7a+=_0x337116;}}return _0x4dce7a&&_0x4bfe83['push'](_0x4dce7a),_0x4bfe83;}function a24_0x4b77(_0x15a056,_0x46c3df){_0x15a056=_0x15a056-0x19a;const _0x5a3870=a24_0x5a38();let _0x4b773e=_0x5a3870[_0x15a056];return _0x4b773e;}function inferParamType(_0xdaabf1){const _0x8892f4=a24_0x4b77,_0x18ab43=_0xdaabf1[_0x8892f4(0x1e8)]();if(_0x18ab43[_0x8892f4(0x1c7)]('id')||_0x18ab43['includes'](_0x8892f4(0x1d8))||_0x18ab43[_0x8892f4(0x1c7)](_0x8892f4(0x1c6))||_0x18ab43['includes'](_0x8892f4(0x1b6))||_0x18ab43[_0x8892f4(0x1c7)](_0x8892f4(0x1e4))||_0x18ab43[_0x8892f4(0x1c7)](_0x8892f4(0x1ce))||_0x18ab43[_0x8892f4(0x1c7)](_0x8892f4(0x1e1))||_0x18ab43['includes'](_0x8892f4(0x19f)))return _0x8892f4(0x1ad);return _0x8892f4(0x1e3);}function getExampleValue(_0x4204b8){const _0x98df27=a24_0x4b77,_0x10eabf=_0x4204b8[_0x98df27(0x1e8)](),_0x5ae7a2=inferParamType(_0x10eabf);if(_0x5ae7a2===_0x98df27(0x1ad)){if(_0x10eabf[_0x98df27(0x1c7)](_0x98df27(0x1c6))||_0x10eabf[_0x98df27(0x1c7)](_0x98df27(0x1d8))||_0x10eabf['includes'](_0x98df27(0x1b6)))return 0xa;if(_0x10eabf[_0x98df27(0x1c7)](_0x98df27(0x1e4)))return 0x1;return 0x7b;}if(_0x10eabf['includes'](_0x98df27(0x1d2))||_0x10eabf[_0x98df27(0x1c7)](_0x98df27(0x1ab)))return _0x98df27(0x1c0);if(_0x10eabf[_0x98df27(0x1c7)](_0x98df27(0x1b2)))return'1';if(_0x10eabf[_0x98df27(0x1c7)](_0x98df27(0x1d6))||_0x10eabf[_0x98df27(0x1c7)](_0x98df27(0x1bb))||_0x10eabf['includes'](_0x98df27(0x1c4)))return'example';return _0x98df27(0x1da);}export function validateIsSelectOnly(_0xe4592b){const _0x26e713=a24_0x4b77;if(!_0xe4592b||typeof _0xe4592b!==_0x26e713(0x1e3))return{'valid':![],'reason':'SQL\x20content\x20cannot\x20be\x20empty'};const _0x3b98f1=_0xe4592b[_0x26e713(0x1c3)](/#\{[^}]*\}/g,'?')[_0x26e713(0x1c3)](/\$\{[^}]*\}/g,'?')[_0x26e713(0x1c3)](/@[^(\s]+(\([^)]*\))?/g,''),_0x348b69=_0x3b98f1[_0x26e713(0x1aa)](),_0x18166c=_0x348b69[_0x26e713(0x1a2)]('\x0a');let _0x595eee='';for(const _0x1e7bf4 of _0x18166c){const _0x27f920=_0x1e7bf4[_0x26e713(0x1aa)]();if(!_0x27f920||_0x27f920[_0x26e713(0x1a4)]('--')||_0x27f920[_0x26e713(0x1a4)]('/*'))continue;_0x595eee=_0x27f920;break;}if(!_0x595eee[_0x26e713(0x1c1)]()[_0x26e713(0x1a4)]('SELECT'))return{'valid':![],'reason':_0x26e713(0x1ac)};const _0x405755=['INSERT\x5cs+INTO',_0x26e713(0x1d1),'DELETE\x5cs+FROM','DROP\x5cs+(TABLE|INDEX|DATABASE)','ALTER\x5cs+(TABLE|DATABASE)',_0x26e713(0x1d0),'TRUNCATE',_0x26e713(0x1a8),_0x26e713(0x1e2),_0x26e713(0x1e9),_0x26e713(0x1cc)],_0x1b21ce=_0x348b69['toUpperCase']();for(const _0x25f2ab of _0x405755){const _0x172954=new RegExp(_0x25f2ab,'i');if(_0x172954[_0x26e713(0x1bf)](_0x1b21ce))return{'valid':![],'reason':_0x26e713(0x1be)+_0x25f2ab[_0x26e713(0x1c3)](_0x26e713(0x1dd),'\x20')+_0x26e713(0x1bd)};}return{'valid':!![]};}function a24_0x5a38(){const _0x3f36db=['2024-01-01','toUpperCase','valid','replace','name','has','limit','includes','字段\x20\x22','joins','parameters','确保\x20SQL\x20语句以\x20SELECT\x20关键字开头','EXECUTE','75trNdmj','num','表\x20\x22','CREATE\x5cs+(TABLE|INDEX|DATABASE|VIEW)','UPDATE\x5cs+\x5cw+\x5cs+SET','date','1075547FCRfEg','matchAll','column','keyword','57547oAFggM','count','columns','value','match','TABLE_NOT_FOUND','\x5c\x5cs+','223180VuEPOF','117XvyxVn','SELECT\x20id,\x20name\x20FROM\x20customer\x20WHERE\x20status\x20=\x201','amount','REVOKE','string','page','Tables:\x20','length','SQL_START','toLowerCase','EXEC','Joins:\x20','Params:\x20','slice','40232KeahCY','2154560UnJRTw','SQL\x20必须以\x20SELECT\x20开头','price','\x22\x20在表\x20\x22','24bPNHmZ','split','push','startsWith','502965uABCnf','\x22\x20中不存在','get','GRANT','414EtisgT','trim','time','Only\x20SELECT\x20queries\x20are\x20allowed.\x20The\x20SQL\x20must\x20start\x20with\x20SELECT\x20(after\x20any\x20comments).','number','filter','tableName','map','join','status','COLUMN_NOT_FOUND','from','tables','size','add','233497llQdZE','table','error','search','36zQssLh','.\x20Only\x20SELECT\x20queries\x20are\x20allowed.','Forbidden\x20keyword\x20detected:\x20','test'];a24_0x5a38=function(){return _0x3f36db;};return a24_0x5a38();}export function extractTableNames(_0x3e9033){const _0x5e1f4f=a24_0x4b77,_0x5bb698=parseSqlStructure(_0x3e9033);return _0x5bb698[_0x5e1f4f(0x1b5)];}export function extractColumnNames(_0x54e8e4){const _0x328005=a24_0x4b77,_0x381600=parseSqlStructure(_0x54e8e4);return _0x381600[_0x328005(0x1d9)][_0x328005(0x1b0)](_0x52a18c=>({'table':_0x52a18c[_0x328005(0x1b9)],'column':_0x52a18c[_0x328005(0x1d5)]}));}export function extractParameters(_0x2adf86){const _0x1087ac=a24_0x4b77,_0x10a7c8=parseSqlStructure(_0x2adf86);return _0x10a7c8[_0x1087ac(0x1ca)];}export function validateSqlContent(_0x42dcba,_0x31a66f){const _0x4162c9=a24_0x4b77,_0x4fbe54=validateIsSelectOnly(_0x42dcba);if(!_0x4fbe54[_0x4162c9(0x1c2)])return{'valid':![],'isSelectOnly':![],'errors':[createStructuredSqlError({'type':'SYNTAX_ERROR','location':_0x4162c9(0x1e7),'message':_0x4fbe54['reason']||_0x4162c9(0x19e),'severity':_0x4162c9(0x1ba),'fixSteps':[{'description':_0x4162c9(0x1cb),'example':_0x4162c9(0x1e0)}]})]};const _0x3209c1=parseSqlStructure(_0x42dcba),_0x3642ff=[];if(_0x31a66f){const _0x30edac=new Map(_0x31a66f['tables']['map'](_0x29926d=>[_0x29926d[_0x4162c9(0x1af)][_0x4162c9(0x1e8)](),_0x29926d[_0x4162c9(0x1d9)]['map'](_0x5b442a=>_0x5b442a[_0x4162c9(0x1e8)]())]));for(const _0x538cb5 of _0x3209c1['tables']){const _0x82d1b8=_0x538cb5['toLowerCase']();if(!_0x30edac['has'](_0x82d1b8)){const _0xa19687=Array['from'](_0x30edac['keys']())[_0x4162c9(0x1ae)](_0xbf6819=>_0xbf6819[_0x4162c9(0x1c7)](_0x82d1b8)||_0x82d1b8['includes'](_0xbf6819));_0x3642ff[_0x4162c9(0x1a3)](createStructuredSqlError({'type':_0x4162c9(0x1dc),'location':_0x538cb5,'message':_0x4162c9(0x1cf)+_0x538cb5+'\x22\x20在数据库\x20schema\x20中不存在','severity':_0x4162c9(0x1ba),'suggestions':_0xa19687[_0x4162c9(0x1e6)]>0x0?_0xa19687:Array[_0x4162c9(0x1b4)](_0x30edac['keys']())}));}}for(const _0x44003b of _0x3209c1[_0x4162c9(0x1d9)]){if(_0x44003b[_0x4162c9(0x1b9)]){const _0x558d21=_0x44003b[_0x4162c9(0x1b9)][_0x4162c9(0x1e8)](),_0x5d1edc=_0x30edac[_0x4162c9(0x1a7)](_0x558d21);if(_0x5d1edc){const _0x30f6f2=_0x44003b[_0x4162c9(0x1d5)][_0x4162c9(0x1e8)]();if(!_0x5d1edc[_0x4162c9(0x1c7)](_0x30f6f2)&&!_0x44003b[_0x4162c9(0x1d5)][_0x4162c9(0x1c7)]('*')){const _0x1ff442=_0x5d1edc[_0x4162c9(0x1ae)](_0x20302b=>_0x20302b[_0x4162c9(0x1c7)](_0x30f6f2)||_0x30f6f2['includes'](_0x20302b));_0x3642ff['push'](createStructuredSqlError({'type':_0x4162c9(0x1b3),'location':_0x44003b[_0x4162c9(0x1b9)]+'.'+_0x44003b[_0x4162c9(0x1d5)],'message':_0x4162c9(0x1c8)+_0x44003b[_0x4162c9(0x1d5)]+_0x4162c9(0x1a0)+_0x44003b[_0x4162c9(0x1b9)]+_0x4162c9(0x1a6),'severity':_0x4162c9(0x1ba),'suggestions':_0x1ff442[_0x4162c9(0x1e6)]>0x0?_0x1ff442:_0x5d1edc[_0x4162c9(0x19b)](0x0,0xa)}));}}}}}return{'valid':_0x3642ff[_0x4162c9(0x1e6)]===0x0,'isSelectOnly':!![],'parsedStructure':_0x3209c1,'errors':_0x3642ff[_0x4162c9(0x1e6)]>0x0?_0x3642ff:undefined};}export function generateSqlSummary(_0x224c28){const _0x3f4ac0=a24_0x4b77,_0x11a443=parseSqlStructure(_0x224c28),_0x272973=[];return _0x11a443[_0x3f4ac0(0x1b5)][_0x3f4ac0(0x1e6)]>0x0&&_0x272973[_0x3f4ac0(0x1a3)](_0x3f4ac0(0x1e5)+_0x11a443['tables'][_0x3f4ac0(0x1b1)](',\x20')),_0x11a443[_0x3f4ac0(0x1ca)][_0x3f4ac0(0x1e6)]>0x0&&_0x272973[_0x3f4ac0(0x1a3)](_0x3f4ac0(0x19a)+_0x11a443[_0x3f4ac0(0x1ca)][_0x3f4ac0(0x1b0)](_0xcee58e=>_0xcee58e[_0x3f4ac0(0x1c4)])[_0x3f4ac0(0x1b1)](',\x20')),_0x11a443[_0x3f4ac0(0x1c9)]&&_0x11a443[_0x3f4ac0(0x1c9)][_0x3f4ac0(0x1e6)]>0x0&&_0x272973[_0x3f4ac0(0x1a3)](_0x3f4ac0(0x1ea)+_0x11a443[_0x3f4ac0(0x1c9)][_0x3f4ac0(0x1e6)]),_0x272973[_0x3f4ac0(0x1e6)]>0x0?_0x272973['join']('\x20|\x20'):'SELECT\x20query';}
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);}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovrabet/dataset-mcp-server",
3
- "version": "1.3.2-beta.1",
3
+ "version": "1.3.2-beta.2",
4
4
  "description": "MCP server for Lovrabet Dataset access",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "examples": "npm run example:basic && npm run example:sdk && npm run example:compare"
31
31
  },
32
32
  "dependencies": {
33
- "@lovrabet/dsparser": "^1.2.4",
33
+ "@lovrabet/dsparser": "latest",
34
34
  "@modelcontextprotocol/sdk": "^1.25.1",
35
35
  "axios": "^1.6.2",
36
36
  "dotenv": "^16.3.1",