@lovrabet/dataset-mcp-server 1.3.1-beta.1 → 1.3.1-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.
- package/README.md +12 -0
- package/dist/analyzer/dataset-analyzer.js +1 -1
- package/dist/api/cache.js +1 -1
- package/dist/api/dev-api-client.js +1 -1
- package/dist/auth/constants.js +1 -1
- package/dist/auth/cookie-manager.js +1 -1
- package/dist/auth/session-validator.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/dist/tools/execute-custom-sql.js +1 -1
- package/dist/tools/generate-sdk-code.js +1 -1
- package/dist/tools/generate-sql-code.js +1 -1
- package/dist/tools/get-dataset-detail.js +1 -1
- package/dist/tools/get-operation-detail.js +1 -1
- package/dist/tools/get-operations.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/list-datasets.js +1 -1
- package/dist/tools/list-sql-queries.js +1 -1
- package/dist/tools/login.js +1 -1
- package/dist/tools/save-custom-sql.js +1 -1
- package/dist/tools/save-or-update-custom-sql.js +1 -1
- package/dist/tools/search-datasets.js +1 -1
- package/dist/tools/validate-sql-content.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/mcp-types.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a10_0x8020(){const _0x3e67a3=['2nAUXVx','This\x20SQL\x20requires\x20parameters:\x20','entries','SQL\x20code\x20\x22','\x0aconst\x20data\x20=\x20await\x20client.api.executeSql(\x27','This\x20SQL\x20does\x20not\x20require\x20any\x20parameters','4956xkNXea','sqlCode\x20is\x20required','replace','\x22\x20exists\x20and\x20is\x20valid.','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;\x0a\x0a','name','limit','On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20exception\x20-\x20use\x20try-catch','sqlCode','Failed\x20to\x20verify\x20SQL\x20code:\x20','sql','online','message','reduce','55SpzEyz','size','data','from','env','join','2024-01-01','tableData','//\x20Initialize\x20the\x20SDK\x20client\x0aconst\x20client\x20=\x20new\x20LovrabetClient({\x0a\x20\x20appCode:\x20\x27','toLowerCase','keyword','9079DhCpuA','3981027SYjoha','204895wlKKXQ','SQL-','LOVRABET_APP_CODE','search','stringify','value','\x27,\x0a\x20\x20env:\x20\x27','date','1940609XwBXBD','sqlId','Check\x20the\x20sqlCode\x20from\x20list_sql_queries\x20result\x20and\x20use\x20the\x20exact\x20value.','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','length','count','23368hhUGrl','trim',');\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:\x20any)\x20=>\x20{\x0a\x20\x20console.log(row);\x0a});','page','sqlName','example','Always\x20check\x20execSuccess\x20before\x20using\x20execResult','455764RxHQCZ','23729484LbbswU','LOVRABET_ENV','time','\x22\x20not\x20found\x20in\x20the\x20application.','getCustomSqlList','Use\x20list_sql_queries\x20to\x20see\x20all\x20available\x20SQLs.','includes','20uxWrrR','1746cQuorX'];a10_0x8020=function(){return _0x3e67a3;};return a10_0x8020();}(function(_0x108583,_0x24e1a2){const _0x3fb829=a10_0xe193,_0x1806db=_0x108583();while(!![]){try{const _0x27883c=parseInt(_0x3fb829(0x166))/0x1+-parseInt(_0x3fb829(0x185))/0x2*(parseInt(_0x3fb829(0x165))/0x3)+parseInt(_0x3fb829(0x17b))/0x4*(-parseInt(_0x3fb829(0x199))/0x5)+parseInt(_0x3fb829(0x18b))/0x6*(parseInt(_0x3fb829(0x164))/0x7)+parseInt(_0x3fb829(0x174))/0x8*(parseInt(_0x3fb829(0x184))/0x9)+-parseInt(_0x3fb829(0x183))/0xa*(parseInt(_0x3fb829(0x16e))/0xb)+parseInt(_0x3fb829(0x17c))/0xc;if(_0x27883c===_0x24e1a2)break;else _0x1806db['push'](_0x1806db['shift']());}catch(_0x3c6d06){_0x1806db['push'](_0x1806db['shift']());}}}(a10_0x8020,0xd896e));import{DevApiClient}from'../api/dev-api-client.js';export async function generateSqlCode(_0x597519){const _0x24cb80=a10_0xe193,{appCode:appCode=process[_0x24cb80(0x19d)][_0x24cb80(0x168)],cookie:_0x3050de,env:env=process[_0x24cb80(0x19d)][_0x24cb80(0x17d)]||_0x24cb80(0x196),sqlCode:_0x9c87f,params:_0x1a6796,includeImports:includeImports=!![]}=_0x597519;if(!appCode)throw new Error(_0x24cb80(0x171));if(!_0x9c87f||_0x9c87f['trim']()==='')return{'success':![],'sqlCode':'','sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[]},'error':_0x24cb80(0x18c)};const _0xff0c4a=_0x9c87f[_0x24cb80(0x175)](),_0x35639d=new DevApiClient({'appCode':appCode,'cookie':_0x3050de,'env':env});try{const _0x11d2ee=await _0x35639d[_0x24cb80(0x180)]({'pageSize':0x3e7,'currentPage':0x1,'sqlCode':_0xff0c4a}),_0x7b8023=_0x11d2ee[_0x24cb80(0x19b)]?.[_0x24cb80(0x160)]||[],_0x5c83fc=_0x7b8023['find'](_0x683c4c=>_0x683c4c['sqlCode']===_0xff0c4a||_0x683c4c[_0x24cb80(0x193)]?.['includes'](_0xff0c4a)||_0xff0c4a['includes'](_0x683c4c[_0x24cb80(0x193)]));if(!_0x5c83fc)return{'success':![],'sqlCode':_0xff0c4a,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x24cb80(0x188)+_0xff0c4a+_0x24cb80(0x17f),_0x24cb80(0x181),_0x24cb80(0x170)]},'error':'SQL\x20code\x20\x22'+_0xff0c4a+'\x22\x20does\x20not\x20exist.\x20Use\x20list_sql_queries\x20to\x20find\x20valid\x20SQL\x20codes.'};const _0x25a0c3=_0x5c83fc['sqlCode'],_0x4f2af7=_0x5c83fc[_0x24cb80(0x178)]||_0x5c83fc[_0x24cb80(0x190)]||_0x24cb80(0x167)+(_0x5c83fc[_0x24cb80(0x16f)]||_0x5c83fc['id']),_0x356ae4=_0x5c83fc['sqlContent']||_0x5c83fc[_0x24cb80(0x195)]||'',_0x30775b=_0x356ae4['match'](/[:$]\{?(\w+)\}?/g);let _0x3a6034,_0x5cfc26;if(_0x30775b){const _0x1805ad=Array[_0x24cb80(0x19c)](new Set(_0x30775b['map'](_0x252f60=>_0x252f60[_0x24cb80(0x18d)](/[:${}]/g,''))));_0x3a6034=_0x1805ad['map'](_0xe45d8f=>{const _0x51b61c=_0x1a6796?.[_0xe45d8f]??getDefaultExample(_0xe45d8f);return{'name':_0xe45d8f,'example':_0x51b61c};}),_0x5cfc26=_0x3a6034[_0x24cb80(0x198)]((_0x1424da,_0x566191)=>({..._0x1424da,[_0x566191[_0x24cb80(0x190)]]:_0x566191[_0x24cb80(0x179)]}),{});}else _0x1a6796&&(_0x3a6034=Object[_0x24cb80(0x187)](_0x1a6796)['map'](([_0x11e6f3,_0x315e72])=>({'name':_0x11e6f3,'example':_0x315e72})),_0x5cfc26=_0x1a6796);const _0x546383=_0x3a6034&&_0x3a6034[_0x24cb80(0x172)]>0x0,_0x130f4f=_0x546383?JSON[_0x24cb80(0x16a)](_0x5cfc26,null,0x2):'',_0x33100c=(includeImports?_0x24cb80(0x18f):'')+_0x24cb80(0x161)+appCode+_0x24cb80(0x16c)+env+'\x27,\x0a});\x0a\x0a//\x20Execute\x20SQL:\x20'+_0x4f2af7+_0x24cb80(0x189)+_0x25a0c3+'\x27'+(_0x546383?',\x20'+_0x130f4f:'')+_0x24cb80(0x176);return{'success':!![],'sqlCode':_0x25a0c3,'sqlName':_0x4f2af7,'sqlExists':!![],'code':_0x33100c,'parameters':_0x3a6034,'usage':{'description':'Generated\x20code\x20for\x20executing\x20custom\x20SQL:\x20'+_0x4f2af7,'important':[_0x24cb80(0x188)+_0x25a0c3+_0x24cb80(0x18e),'SDK\x20returns\x20{\x20execSuccess:\x20boolean,\x20execResult?:\x20any[],\x20execError?:\x20string\x20}',_0x24cb80(0x17a),_0x546383?_0x24cb80(0x186)+_0x3a6034['map'](_0x469be2=>_0x469be2[_0x24cb80(0x190)])[_0x24cb80(0x15e)](',\x20'):_0x24cb80(0x18a),_0x24cb80(0x192)]}};}catch(_0x4fcf82){return{'success':![],'sqlCode':_0xff0c4a,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x24cb80(0x194)+_0x4fcf82['message'],_0x24cb80(0x181)]},'error':_0x24cb80(0x194)+_0x4fcf82[_0x24cb80(0x197)]};}}function a10_0xe193(_0x1158fc,_0x3c054c){_0x1158fc=_0x1158fc-0x15e;const _0x8020f=a10_0x8020();let _0xe193f2=_0x8020f[_0x1158fc];return _0xe193f2;}function getDefaultExample(_0x3e8c66){const _0x1767d9=a10_0xe193,_0x3b1766=_0x3e8c66[_0x1767d9(0x162)]();if(_0x3b1766[_0x1767d9(0x182)](_0x1767d9(0x16d))||_0x3b1766['includes'](_0x1767d9(0x17e)))return _0x1767d9(0x15f);if(_0x3b1766[_0x1767d9(0x182)]('id'))return 0x7b;if(_0x3b1766[_0x1767d9(0x182)](_0x1767d9(0x191))||_0x3b1766['includes'](_0x1767d9(0x173))||_0x3b1766[_0x1767d9(0x182)](_0x1767d9(0x19a)))return 0xa;if(_0x3b1766[_0x1767d9(0x182)](_0x1767d9(0x177)))return 0x1;if(_0x3b1766[_0x1767d9(0x182)](_0x1767d9(0x163))||_0x3b1766[_0x1767d9(0x182)](_0x1767d9(0x169))||_0x3b1766[_0x1767d9(0x182)](_0x1767d9(0x190)))return _0x1767d9(0x179);if(_0x3b1766['includes']('status'))return 0x1;return _0x1767d9(0x16b);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5c6324,_0x636e2d){const _0x1c45c9=a11_0x289f,_0x3c5223=_0x5c6324();while(!![]){try{const _0x2cdef5=parseInt(_0x1c45c9(0x17e))/0x1+-parseInt(_0x1c45c9(0x174))/0x2+-parseInt(_0x1c45c9(0x17a))/0x3+-parseInt(_0x1c45c9(0x169))/0x4+-parseInt(_0x1c45c9(0x15d))/0x5+-parseInt(_0x1c45c9(0x15e))/0x6*(parseInt(_0x1c45c9(0x157))/0x7)+parseInt(_0x1c45c9(0x165))/0x8;if(_0x2cdef5===_0x636e2d)break;else _0x3c5223['push'](_0x3c5223['shift']());}catch(_0x170448){_0x3c5223['push'](_0x3c5223['shift']());}}}(a11_0x2015,0x30753));function a11_0x289f(_0x3cc375,_0xbd9b0f){_0x3cc375=_0x3cc375-0x154;const _0x20153b=a11_0x2015();let _0x289fda=_0x20153b[_0x3cc375];return _0x289fda;}import{DevApiClient}from'../api/dev-api-client.js';function a11_0x2015(){const _0x3ca66e=['Generate\x20SDK\x20code\x20for\x20querying\x20this\x20dataset','find','LOVRABET_ENV','471079eVVACZ','getDatasetList','primaryKey','replace','includes','Validate\x20and\x20prepare\x20custom\x20SQL\x20for\x20this\x20dataset','164600SdQsGM','6uXHYno','some','deleted','type','operationCount','enabledOperationCount','visible','8628800pImXKb','medium','code','basic','1054868pBBeri','category','dbId','now','env','list_datasets','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','push','getDatasetDetail','fieldCount','toLowerCase','466620Woxfpk','database','fields','data','filter','name','1040343hbBjDv','tableData','endsWith','Get\x20ready-to-use\x20TypeScript\x20code\x20for\x20querying\x20this\x20dataset','63908EGhoRX','test','_id','active','status','tableName','Browse\x20related\x20datasets','operations','supportsCRUD','level','generate_sdk_code','archived','priority','Find\x20other\x20datasets\x20that\x20might\x20be\x20related\x20for\x20JOIN\x20operations','validate_sql_content','high','map','required','enumValues','state'];a11_0x2015=function(){return _0x3ca66e;};return a11_0x2015();}import{DatasetAnalyzer}from'../analyzer/dataset-analyzer.js';export async function getDatasetDetail(_0x2ada8c){const _0x12b485=a11_0x289f,_0x8ba239=Date[_0x12b485(0x16c)](),{appCode:appCode=process[_0x12b485(0x16d)]['LOVRABET_APP_CODE'],cookie:_0x4aedb6,env:env=process[_0x12b485(0x16d)][_0x12b485(0x156)]||'online',datasetCode:_0xa9dd8,forceRefresh:forceRefresh=![]}=_0x2ada8c;if(!appCode)throw new Error(_0x12b485(0x16f));if(!_0xa9dd8)throw new Error('datasetCode\x20is\x20required');const _0x369fc5=new DevApiClient({'appCode':appCode,'cookie':_0x4aedb6,'env':env}),_0x5cb1f5=/^\d+$/[_0x12b485(0x17f)](_0xa9dd8);let _0x550dab;if(_0x5cb1f5)_0x550dab=_0xa9dd8;else{const _0xb2b4f1=await _0x369fc5[_0x12b485(0x158)]({'pageSize':0x3e7,'forceRefresh':forceRefresh}),_0x532d75=_0xb2b4f1[_0x12b485(0x177)]?.[_0x12b485(0x17b)]||[],_0x430d17=_0x532d75['find'](_0x1a623e=>_0x1a623e[_0x12b485(0x167)]===_0xa9dd8);if(!_0x430d17)throw new Error('Dataset\x20not\x20found\x20with\x20code:\x20'+_0xa9dd8);_0x550dab=String(_0x430d17['id']);}const _0x13b9e1=await _0x369fc5[_0x12b485(0x171)](_0x550dab,forceRefresh),_0x251748=new DatasetAnalyzer(),_0x1a9211=_0x251748['analyzeDatasetDetail'](_0x13b9e1),_0x49491b=_0x1a9211[_0x12b485(0x176)][_0x12b485(0x178)](_0x174e66=>_0x174e66[_0x12b485(0x159)])[_0x12b485(0x18e)](_0x400e68=>_0x400e68[_0x12b485(0x179)]),_0xdef2df=_0x1a9211['fields']['filter'](_0x1545ca=>_0x1545ca[_0x12b485(0x18f)])['map'](_0x4d0f62=>_0x4d0f62[_0x12b485(0x179)]),_0x513487=[_0x12b485(0x182),_0x12b485(0x191),_0x12b485(0x161),_0x12b485(0x16a),_0x12b485(0x187),_0x12b485(0x18a),_0x12b485(0x181),'enabled',_0x12b485(0x164),_0x12b485(0x160),_0x12b485(0x189)],_0x17dc30=_0x1a9211['fields']['filter'](_0x382ec7=>{const _0x4ce99c=_0x12b485,_0x4d98c8=_0x382ec7[_0x4ce99c(0x179)][_0x4ce99c(0x173)]();return _0x513487[_0x4ce99c(0x15f)](_0x555f78=>_0x4d98c8[_0x4ce99c(0x15b)](_0x555f78)||_0x4d98c8===_0x555f78);})['map'](_0x5d6c7c=>_0x5d6c7c[_0x12b485(0x179)]),_0x18c806=_0x1a9211[_0x12b485(0x176)][_0x12b485(0x178)](_0x1b5e67=>{const _0x1671fc=_0x12b485,_0x37694d=_0x1b5e67[_0x1671fc(0x179)][_0x1671fc(0x173)]();return _0x37694d[_0x1671fc(0x17c)](_0x1671fc(0x180))||_0x37694d['endsWith']('id');})[_0x12b485(0x178)](_0x58fd8d=>!_0x58fd8d[_0x12b485(0x159)])['map'](_0x1599d7=>{const _0x5cbcaf=_0x12b485,_0x3f7aad=_0x1599d7[_0x5cbcaf(0x179)]['replace'](/_id$/,'')[_0x5cbcaf(0x15a)](/Id$/,'');return{'field':_0x1599d7[_0x5cbcaf(0x179)],'suggestsForeignKeyTo':_0x3f7aad};}),_0x2d54bd=_0x1a9211[_0x12b485(0x176)][_0x12b485(0x178)](_0x3d2f30=>_0x3d2f30[_0x12b485(0x190)]&&_0x3d2f30[_0x12b485(0x190)]['length']>0x0)['map'](_0x15750f=>({'field':_0x15750f['name'],'options':(_0x15750f['enumValues']||[])[_0x12b485(0x18e)](_0x2c40d1=>({'label':String(_0x2c40d1),'value':_0x2c40d1}))})),_0x3874f0={'primaryKeys':_0x49491b,'filterableFields':_0x17dc30,'joinableFields':_0x18c806,'requiredFields':_0xdef2df,'enumFields':_0x2d54bd},_0x5bcee4=[],_0x553329=_0x1a9211['operations'][_0x12b485(0x155)](_0x104682=>_0x104682[_0x12b485(0x161)]==='filter');_0x553329&&_0x5bcee4[_0x12b485(0x170)]({'action':_0x12b485(0x154),'tool':_0x12b485(0x188),'params':{'datasetCode':_0xa9dd8,'operationName':_0x12b485(0x178)},'reason':_0x12b485(0x17d),'priority':_0x12b485(0x18d)});_0x1a9211[_0x12b485(0x168)][_0x12b485(0x175)]?.['dbId']&&_0x5bcee4['push']({'action':'Create\x20custom\x20SQL\x20for\x20this\x20dataset','tool':_0x12b485(0x18c),'params':{'sqlContent':'SELECT\x20*\x20FROM\x20'+_0x1a9211[_0x12b485(0x168)][_0x12b485(0x183)],'dbId':_0x1a9211[_0x12b485(0x168)][_0x12b485(0x175)][_0x12b485(0x16b)]},'reason':_0x12b485(0x15c),'priority':_0x12b485(0x166)});_0x5bcee4['push']({'action':_0x12b485(0x184),'tool':_0x12b485(0x16e),'reason':_0x12b485(0x18b),'priority':'low'});const _0x37cd22=Date['now']()-_0x8ba239;return{'appCode':appCode,'env':env,'basic':_0x1a9211['basic'],'fields':_0x1a9211[_0x12b485(0x176)],'operations':_0x1a9211[_0x12b485(0x185)],'stats':{'fieldCount':_0x1a9211[_0x12b485(0x172)],'operationCount':_0x1a9211[_0x12b485(0x162)],'enabledOperationCount':_0x1a9211[_0x12b485(0x163)],'supportsCRUD':_0x1a9211[_0x12b485(0x186)]},'sqlValidationHints':_0x3874f0,'nextSteps':_0x5bcee4};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x12be19,_0x309956){const _0x4a5f99=a12_0x3f07,_0x417466=_0x12be19();while(!![]){try{const _0x4eeffd=parseInt(_0x4a5f99(0x159))/0x1*(parseInt(_0x4a5f99(0x16c))/0x2)+-parseInt(_0x4a5f99(0x15d))/0x3+parseInt(_0x4a5f99(0x157))/0x4*(-parseInt(_0x4a5f99(0x168))/0x5)+-parseInt(_0x4a5f99(0x166))/0x6+-parseInt(_0x4a5f99(0x16f))/0x7*(-parseInt(_0x4a5f99(0x172))/0x8)+parseInt(_0x4a5f99(0x15a))/0x9*(parseInt(_0x4a5f99(0x173))/0xa)+parseInt(_0x4a5f99(0x158))/0xb*(-parseInt(_0x4a5f99(0x167))/0xc);if(_0x4eeffd===_0x309956)break;else _0x417466['push'](_0x417466['shift']());}catch(_0x2778f6){_0x417466['push'](_0x417466['shift']());}}}(a12_0x27d9,0x508b2));import{DevApiClient}from'../api/dev-api-client.js';import{DatasetAnalyzer}from'../analyzer/dataset-analyzer.js';function a12_0x3f07(_0x21151b,_0x1d2412){_0x21151b=_0x21151b-0x156;const _0x27d905=a12_0x27d9();let _0x3f073f=_0x27d905[_0x21151b];return _0x3f073f;}export async function getOperationDetail(_0x1b374f){const _0x420811=a12_0x3f07,{appCode:appCode=process[_0x420811(0x16e)][_0x420811(0x15e)],cookie:_0x2abc99,env:env=process[_0x420811(0x16e)][_0x420811(0x162)]||'online',datasetCode:_0xfdce13,operationName:_0x28b6cf}=_0x1b374f;if(!appCode)throw new Error(_0x420811(0x163));if(!_0xfdce13)throw new Error(_0x420811(0x160));if(!_0x28b6cf)throw new Error(_0x420811(0x161));const _0x476282=new DevApiClient({'appCode':appCode,'cookie':_0x2abc99,'env':env}),_0x2619df=/^\d+$/[_0x420811(0x156)](_0xfdce13);let _0x5dac50;if(_0x2619df)_0x5dac50=_0xfdce13;else{const _0x36f546=await _0x476282[_0x420811(0x171)]({'pageSize':0x3e7}),_0x3d64bc=_0x36f546['data']?.[_0x420811(0x164)]||[],_0x4cd1cb=_0x3d64bc[_0x420811(0x170)](_0x1a6eab=>_0x1a6eab['code']===_0xfdce13);if(!_0x4cd1cb)throw new Error('Dataset\x20not\x20found\x20with\x20code:\x20'+_0xfdce13);_0x5dac50=String(_0x4cd1cb['id']);}const _0x55b031=await _0x476282['getDatasetDetail'](_0x5dac50),_0x51dc99=new DatasetAnalyzer(),_0x247a47=_0x51dc99[_0x420811(0x169)](_0x55b031,_0x28b6cf);if(!_0x247a47)throw new Error(_0x420811(0x15b)+_0x28b6cf+_0x420811(0x15c)+_0xfdce13+'\x27');const _0x77f77f=_0x51dc99[_0x420811(0x16a)](_0x55b031);return{'appCode':appCode,'env':env,'datasetName':_0x77f77f[_0x420811(0x16d)][_0x420811(0x165)],'operation':_0x247a47,'sdkReturnValueBehavior':{'onSuccess':'Returns\x20ONLY\x20the\x20\x27data\x27\x20field\x20content.\x20Full\x20API\x20response\x20is\x20{\x20success:\x20true,\x20data:\x20{...},\x20msg:\x20\x22\x22,\x20errorMsg:\x20\x22\x22,\x20errorCode:\x20\x220000\x22\x20},\x20but\x20SDK\x20returns\x20just\x20the\x20{...}\x20part\x20from\x20\x27data\x27.','onError':_0x420811(0x15f),'note':_0x420811(0x16b)}};}function a12_0x27d9(){const _0x8d9cd9=['operationName\x20is\x20required','LOVRABET_ENV','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','tableData','name','650610PoqIot','207456wCMxFl','97915SIxoXP','getOperationDetail','analyzeDatasetDetail','CRITICAL:\x20Always\x20use\x20try-catch\x20when\x20calling\x20SDK\x20methods.\x20Success\x20case\x20returns\x20data\x20directly\x20(e.g.,\x20{\x20id:\x20123,\x20name:\x20\x22...\x22\x20}),\x20but\x20failure\x20case\x20throws\x20exception\x20instead\x20of\x20returning\x20error\x20info.','58UOBbgD','basic','env','110537ZsRyUN','find','getDatasetList','328McNNqi','937760rYEQOz','test','68kebwcB','297fFKbmB','10253GJwUlL','63MoDKXt','Operation\x20\x27','\x27\x20not\x20found\x20in\x20dataset\x20\x27','1089516syrVpI','LOVRABET_APP_CODE','Throws\x20LovrabetError\x20exception\x20with\x20full\x20response.\x20The\x20error\x20object\x20contains:\x20{\x20message:\x20string,\x20status?:\x20number\x20(HTTP\x20code),\x20code?:\x20string\x20(business\x20error\x20code),\x20data?:\x20any\x20(full\x20error\x20response)\x20}','datasetCode\x20is\x20required'];a12_0x27d9=function(){return _0x8d9cd9;};return a12_0x27d9();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xe713b2,_0x210a26){const _0x575119=a13_0x3d6e,_0x5610b6=_0xe713b2();while(!![]){try{const _0x17e6ec=-parseInt(_0x575119(0xd4))/0x1*(parseInt(_0x575119(0xd2))/0x2)+-parseInt(_0x575119(0xe5))/0x3*(parseInt(_0x575119(0xd1))/0x4)+-parseInt(_0x575119(0xe8))/0x5*(parseInt(_0x575119(0xe9))/0x6)+parseInt(_0x575119(0xda))/0x7+parseInt(_0x575119(0xde))/0x8*(-parseInt(_0x575119(0xe6))/0x9)+-parseInt(_0x575119(0xd3))/0xa*(-parseInt(_0x575119(0xe3))/0xb)+parseInt(_0x575119(0xed))/0xc;if(_0x17e6ec===_0x210a26)break;else _0x5610b6['push'](_0x5610b6['shift']());}catch(_0x4bfccc){_0x5610b6['push'](_0x5610b6['shift']());}}}(a13_0x3365,0x77ec0));import{DevApiClient}from'../api/dev-api-client.js';function a13_0x3d6e(_0x2aaee5,_0x59d9a3){_0x2aaee5=_0x2aaee5-0xcf;const _0x3365c6=a13_0x3365();let _0x3d6ed8=_0x3365c6[_0x2aaee5];return _0x3d6ed8;}import{DatasetAnalyzer}from'../analyzer/dataset-analyzer.js';function a13_0x3365(){const _0x39c714=['supportsCRUD','13193016icaSnX','method','name','4uvDJbC','6428CTxeTR','5392370zEesaE','137ZGjNHi','type','tableData','path','basic','code','2330692MDKgPY','displayName','test','operationCount','536cMvkfY','enabled','data','Dataset\x20not\x20found\x20with\x20code:\x20','LOVRABET_ENV','11WTmsYA','map','376671MMjjEx','121203pZSjaH','operations','5JuAhOq','73482bmRUFf','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','env'];a13_0x3365=function(){return _0x39c714;};return a13_0x3365();}export async function getDatasetOperations(_0x5a9d1d){const _0x50e28d=a13_0x3d6e,{appCode:appCode=process[_0x50e28d(0xeb)]['LOVRABET_APP_CODE'],cookie:_0x27e768,env:env=process[_0x50e28d(0xeb)][_0x50e28d(0xe2)]||'online',datasetCode:_0x102065}=_0x5a9d1d;if(!appCode)throw new Error(_0x50e28d(0xea));if(!_0x102065)throw new Error('datasetCode\x20is\x20required');const _0x2b8e54=new DevApiClient({'appCode':appCode,'cookie':_0x27e768,'env':env}),_0x568026=/^\d+$/[_0x50e28d(0xdc)](_0x102065);let _0xda9d6;if(_0x568026)_0xda9d6=_0x102065;else{const _0x40afa0=await _0x2b8e54['getDatasetList']({'pageSize':0x3e7}),_0x2018e0=_0x40afa0[_0x50e28d(0xe0)]?.[_0x50e28d(0xd6)]||[],_0x44131b=_0x2018e0['find'](_0x44d495=>_0x44d495[_0x50e28d(0xd9)]===_0x102065);if(!_0x44131b)throw new Error(_0x50e28d(0xe1)+_0x102065);_0xda9d6=String(_0x44131b['id']);}const _0x24b938=await _0x2b8e54['getDatasetDetail'](_0xda9d6),_0xe5c84c=new DatasetAnalyzer(),_0x1f34bb=_0xe5c84c['analyzeDatasetDetail'](_0x24b938);return{'appCode':appCode,'env':env,'datasetName':_0x1f34bb[_0x50e28d(0xd8)][_0x50e28d(0xd0)],'tableName':_0x1f34bb[_0x50e28d(0xd8)]['tableName'],'operations':_0x1f34bb[_0x50e28d(0xe7)][_0x50e28d(0xe4)](_0x15f4f4=>({'name':_0x15f4f4['name'],'displayName':_0x15f4f4[_0x50e28d(0xdb)],'type':_0x15f4f4[_0x50e28d(0xd5)],'method':_0x15f4f4[_0x50e28d(0xcf)],'path':_0x15f4f4[_0x50e28d(0xd7)],'requestFieldsCount':_0x15f4f4['requestFieldsCount'],'enabled':_0x15f4f4[_0x50e28d(0xdf)]})),'stats':{'total':_0x1f34bb[_0x50e28d(0xdd)],'enabled':_0x1f34bb['enabledOperationCount'],'supportsCRUD':_0x1f34bb[_0x50e28d(0xec)]}};}
|
package/dist/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x24aeb9,_0x573c0e){var _0x285af1=a14_0x5e2f,_0x3f4d69=_0x24aeb9();while(!![]){try{var _0x2b5acd=parseInt(_0x285af1(0x1f9))/0x1+parseInt(_0x285af1(0x1f3))/0x2*(-parseInt(_0x285af1(0x1f7))/0x3)+parseInt(_0x285af1(0x1f2))/0x4+-parseInt(_0x285af1(0x1f6))/0x5*(-parseInt(_0x285af1(0x1f4))/0x6)+parseInt(_0x285af1(0x1fa))/0x7*(parseInt(_0x285af1(0x1fc))/0x8)+parseInt(_0x285af1(0x1fb))/0x9*(-parseInt(_0x285af1(0x1f5))/0xa)+parseInt(_0x285af1(0x1f8))/0xb;if(_0x2b5acd===_0x573c0e)break;else _0x3f4d69['push'](_0x3f4d69['shift']());}catch(_0xa03f31){_0x3f4d69['push'](_0x3f4d69['shift']());}}}(a14_0x5876,0x5a590));export{login}from'./login.js';function a14_0x5e2f(_0x10fb44,_0x11715e){_0x10fb44=_0x10fb44-0x1f2;var _0x5876bc=a14_0x5876();var _0x5e2f0b=_0x5876bc[_0x10fb44];return _0x5e2f0b;}export{listDatasets}from'./list-datasets.js';export{getDatasetDetail}from'./get-dataset-detail.js';export{getDatasetOperations}from'./get-operations.js';export{getOperationDetail}from'./get-operation-detail.js';export{generateSDKCode}from'./generate-sdk-code.js';export{searchDatasets}from'./search-datasets.js';export{listSqlQueries}from'./list-sql-queries.js';export{saveOrUpdateCustomSql}from'./save-or-update-custom-sql.js';export{executeCustomSql}from'./execute-custom-sql.js';export{generateSqlCode}from'./generate-sql-code.js';export{validateSqlContent}from'./validate-sql-content.js';function a14_0x5876(){var _0x53f839=['102mrlCcd','5700UtvuZX','95385ttiiqT','74043yYMQKo','1881748NEivsD','64809eSjmIn','7PMFQan','7083bFstwi','2016920KPWZTx','2592236DeLQwH','52BGangg'];a14_0x5876=function(){return _0x53f839;};return a14_0x5876();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a15_0x2602(_0x3bf31b,_0x17b38f){_0x3bf31b=_0x3bf31b-0x18b;const _0x41f7a6=a15_0x41f7();let _0x260246=_0x41f7a6[_0x3bf31b];return _0x260246;}(function(_0x105d1a,_0x26c481){const _0x4300c5=a15_0x2602,_0x45577b=_0x105d1a();while(!![]){try{const _0x313a51=-parseInt(_0x4300c5(0x190))/0x1*(-parseInt(_0x4300c5(0x19c))/0x2)+parseInt(_0x4300c5(0x199))/0x3*(parseInt(_0x4300c5(0x191))/0x4)+parseInt(_0x4300c5(0x18e))/0x5*(parseInt(_0x4300c5(0x192))/0x6)+-parseInt(_0x4300c5(0x18d))/0x7+parseInt(_0x4300c5(0x194))/0x8*(-parseInt(_0x4300c5(0x195))/0x9)+parseInt(_0x4300c5(0x198))/0xa*(parseInt(_0x4300c5(0x18c))/0xb)+-parseInt(_0x4300c5(0x18b))/0xc;if(_0x313a51===_0x26c481)break;else _0x45577b['push'](_0x45577b['shift']());}catch(_0x311ac5){_0x45577b['push'](_0x45577b['shift']());}}}(a15_0x41f7,0x99d2b));import{DevApiClient}from'../api/dev-api-client.js';import{DatasetAnalyzer}from'../analyzer/dataset-analyzer.js';function a15_0x41f7(){const _0x21f3d3=['online','71TZMBNF','1700jydvOP','6pwsLvw','LOVRABET_ENV','14616DGgFtK','2691ggFPHI','env','analyzeDatasetList','10FKhVBE','6999oNIxrl','total','LOVRABET_APP_CODE','8074HgmEbt','1985964dBTauz','4213913hXbCli','6545553UGAEzB','3078365Svhmkv'];a15_0x41f7=function(){return _0x21f3d3;};return a15_0x41f7();}export async function listDatasets(_0x5e1f1b={}){const _0x2eeb70=a15_0x2602,{appCode:appCode=process['env'][_0x2eeb70(0x19b)],env:env=process[_0x2eeb70(0x196)][_0x2eeb70(0x193)]||_0x2eeb70(0x18f),cookie:_0x24859,pageSize:pageSize=0x3e7,currentPage:currentPage=0x1,forceRefresh:forceRefresh=![]}=_0x5e1f1b;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');const _0x3bf54a=new DevApiClient({'appCode':appCode,'env':env,'cookie':_0x24859}),_0x5477cf=await _0x3bf54a['getDatasetList']({'pageSize':pageSize,'currentPage':currentPage,'forceRefresh':forceRefresh}),_0x519eee=new DatasetAnalyzer(),_0x5a140b=_0x519eee[_0x2eeb70(0x197)](_0x5477cf);return{'appCode':appCode,'env':env,'total':_0x5a140b[_0x2eeb70(0x19a)],'datasets':_0x5a140b['datasets']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a16_0x175b(_0x3de681,_0x4f5db8){_0x3de681=_0x3de681-0x16c;const _0x24db2d=a16_0x24db();let _0x175b0f=_0x24db2d[_0x3de681];return _0x175b0f;}(function(_0x386e89,_0x2bce6a){const _0x211e88=a16_0x175b,_0x4cdb48=_0x386e89();while(!![]){try{const _0x59dd20=parseInt(_0x211e88(0x188))/0x1+-parseInt(_0x211e88(0x19e))/0x2+parseInt(_0x211e88(0x1aa))/0x3*(-parseInt(_0x211e88(0x1ae))/0x4)+-parseInt(_0x211e88(0x1b1))/0x5+parseInt(_0x211e88(0x17f))/0x6+-parseInt(_0x211e88(0x18c))/0x7*(-parseInt(_0x211e88(0x19a))/0x8)+-parseInt(_0x211e88(0x16e))/0x9*(-parseInt(_0x211e88(0x1a2))/0xa);if(_0x59dd20===_0x2bce6a)break;else _0x4cdb48['push'](_0x4cdb48['shift']());}catch(_0x2c66ae){_0x4cdb48['push'](_0x4cdb48['shift']());}}}(a16_0x24db,0xa6e72));import{DevApiClient}from'../api/dev-api-client.js';export async function listSqlQueries(_0x2cc93e={}){const _0x202ef4=a16_0x175b,{appCode:appCode=process[_0x202ef4(0x16c)][_0x202ef4(0x19c)],cookie:_0x587696,env:env=process[_0x202ef4(0x16c)][_0x202ef4(0x187)]||'online',keyword:_0x2c7836,category:_0x43e027,sqlCode:_0x4538e8,sqlName:_0x14a60d,pageSize:pageSize=0x3e7,currentPage:currentPage=0x1}=_0x2cc93e;if(!appCode)throw new Error(_0x202ef4(0x19b));const _0x3de749=new DevApiClient({'appCode':appCode,'cookie':_0x587696,'env':env});try{const _0x3b3bc4=await _0x3de749['getCustomSqlList']({'pageSize':pageSize,'currentPage':currentPage,'sqlCode':_0x4538e8,'sqlName':_0x14a60d}),_0x1d1731=_0x3b3bc4[_0x202ef4(0x199)]||_0x3b3bc4,_0xef7c31=_0x1d1731['tableData']||[],_0x212896=_0x1d1731['total']||_0xef7c31['length'];let _0x2cd52a=_0xef7c31['map'](_0x11fa83=>{const _0x58d740=_0x202ef4,_0x540c12=_0x11fa83[_0x58d740(0x1a1)]||appCode+'-'+(_0x11fa83['sqlId']||_0x11fa83['id']),_0x25e9ba=_0x11fa83['sqlId']||_0x11fa83['id'];let _0x1a3a1c;if(_0x11fa83[_0x58d740(0x1b0)]||_0x11fa83['sql']){const _0x2a6576=_0x11fa83[_0x58d740(0x1b0)]||_0x11fa83[_0x58d740(0x186)],_0x280385=_0x2a6576[_0x58d740(0x19f)](/[:$]\{?(\w+)\}?/g);if(_0x280385){const _0x3d18bf=Array[_0x58d740(0x185)](new Set(_0x280385[_0x58d740(0x19d)](_0x41e503=>_0x41e503[_0x58d740(0x192)](/[:${}]/g,''))));_0x1a3a1c=_0x3d18bf[_0x58d740(0x19d)](_0x30bd7c=>{const _0xbd61f5=_0x58d740;let _0x594f6f=_0xbd61f5(0x173);if(_0x30bd7c[_0xbd61f5(0x172)]()['includes'](_0xbd61f5(0x176))||_0x30bd7c[_0xbd61f5(0x172)]()['includes']('time'))_0x594f6f=_0xbd61f5(0x1a6);else{if(_0x30bd7c[_0xbd61f5(0x172)]()[_0xbd61f5(0x196)]('id'))_0x594f6f=0x7b;else(_0x30bd7c[_0xbd61f5(0x172)]()[_0xbd61f5(0x196)]('limit')||_0x30bd7c[_0xbd61f5(0x172)]()[_0xbd61f5(0x196)]('count'))&&(_0x594f6f=0xa);}return{'name':_0x30bd7c,'type':_0xbd61f5(0x1a4),'required':!![],'description':'Parameter:\x20'+_0x30bd7c,'example':_0x594f6f};});}}const _0x217958=_0x1a3a1c&&_0x1a3a1c[_0x58d740(0x178)]>0x0,_0x278e15=_0x217958?_0x1a3a1c[_0x58d740(0x183)]((_0x465401,_0x305dcc)=>({..._0x465401,[_0x305dcc['name']]:_0x305dcc[_0x58d740(0x184)]}),{}):undefined,_0x123ed1={'typescript':_0x58d740(0x1af)+appCode+_0x58d740(0x17a)+(env||_0x58d740(0x1ac))+_0x58d740(0x17c)+(_0x11fa83[_0x58d740(0x189)]||_0x11fa83[_0x58d740(0x1a9)]||_0x58d740(0x1a5))+_0x58d740(0x18b)+_0x540c12+'\x27'+(_0x217958?',\x20'+JSON[_0x58d740(0x17d)](_0x278e15,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'+(_0x11fa83['sqlName']||_0x11fa83['name']||_0x58d740(0x177)),'important':[_0x58d740(0x194),_0x58d740(0x16f),_0x217958?'This\x20SQL\x20requires\x20parameters:\x20'+_0x1a3a1c[_0x58d740(0x19d)](_0x2fbbf5=>_0x2fbbf5['name']+'\x20('+_0x2fbbf5['type']+')')[_0x58d740(0x193)](',\x20'):_0x58d740(0x1a0),_0x58d740(0x174),_0x58d740(0x18e)]},_0x323703={'sqlCode':_0x540c12,'sqlId':_0x25e9ba,'name':_0x11fa83['sqlName']||_0x11fa83[_0x58d740(0x1a9)]||_0x58d740(0x1a8)+_0x25e9ba,'description':_0x11fa83[_0x58d740(0x175)]||_0x11fa83['description'],'category':_0x11fa83[_0x58d740(0x198)]||_0x11fa83['sqlType']||'other','sqlContent':_0x11fa83[_0x58d740(0x1b0)]||_0x11fa83['sql'],'parameters':_0x1a3a1c,'createdTime':_0x11fa83[_0x58d740(0x195)]||_0x11fa83[_0x58d740(0x197)],'updatedTime':_0x11fa83[_0x58d740(0x1ab)]||_0x11fa83[_0x58d740(0x17b)],'codeExample':_0x123ed1};return _0x323703;});if(_0x2c7836){const _0x443108=_0x2c7836['toLowerCase']();_0x2cd52a=_0x2cd52a[_0x202ef4(0x18f)](_0x42eda4=>_0x42eda4['name'][_0x202ef4(0x172)]()[_0x202ef4(0x196)](_0x443108)||_0x42eda4[_0x202ef4(0x182)]&&_0x42eda4['description']['toLowerCase']()[_0x202ef4(0x196)](_0x443108)||_0x42eda4[_0x202ef4(0x1a1)][_0x202ef4(0x172)]()[_0x202ef4(0x196)](_0x443108)||_0x42eda4[_0x202ef4(0x1b0)]&&_0x42eda4['sqlContent']['toLowerCase']()['includes'](_0x443108));}_0x43e027&&_0x43e027!==_0x202ef4(0x180)&&(_0x2cd52a=_0x2cd52a[_0x202ef4(0x18f)](_0xaa6255=>_0xaa6255[_0x202ef4(0x198)]&&_0xaa6255[_0x202ef4(0x198)][_0x202ef4(0x172)]()===_0x43e027[_0x202ef4(0x172)]()));const _0x28979d=Math['ceil'](_0x2cd52a[_0x202ef4(0x178)]/pageSize),_0x227c51=_0x2cd52a[_0x202ef4(0x16d)]((currentPage-0x1)*pageSize,currentPage*pageSize),_0x3c1cfd=_0x227c51['length']>0x0?_0x227c51[0x0]:null,_0x35b6b6=_0x3c1cfd?_0x202ef4(0x1a3)+_0x3c1cfd[_0x202ef4(0x1a9)]+_0x202ef4(0x17e)+_0x3c1cfd[_0x202ef4(0x1a1)]+'\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':'sql_list','total':_0x2cd52a[_0x202ef4(0x178)],'sqls':_0x227c51,'pagination':{'currentPage':currentPage,'pageSize':pageSize,'totalPages':_0x28979d},'usage':{'description':_0x202ef4(0x1ad)+_0x2cd52a[_0x202ef4(0x178)]+_0x202ef4(0x179)+appCode+'.\x20Each\x20SQL\x20includes\x20a\x20complete\x20code\x20example\x20showing\x20how\x20to\x20execute\x20it\x20using\x20the\x20SDK.','important':[_0x202ef4(0x171),_0x202ef4(0x191),_0x202ef4(0x1a7),'IMPORTANT:\x20Use\x20try-catch\x20to\x20handle\x20HTTP\x20errors\x20(network\x20issues,\x20auth\x20failures)',_0x202ef4(0x170),'Each\x20SQL\x20query\x20above\x20includes\x20a\x20codeExample\x20field\x20with\x20complete\x20TypeScript\x20code\x20ready\x20to\x20use',_0x202ef4(0x181)],'example':_0x35b6b6||_0x202ef4(0x190)}};}catch(_0x367825){throw new Error(_0x202ef4(0x18a)+_0x367825[_0x202ef4(0x18d)]);}}function a16_0x24db(){const _0x213dbd=['10SIIdto','\x0a//\x20Example:\x20Using\x20SQL\x20\x22','string','SQL\x20Query','2024-01-01','IMPORTANT:\x20The\x20SDK\x20returns\x20{\x20execSuccess:\x20boolean,\x20execResult?:\x20any[],\x20execError?:\x20string\x20}','SQL-','name','75UIoEBs','updatedTime','online','Found\x20','126268WRMfxI','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','sqlContent','5684255QmKtMp','env','slice','6236829FfvfUE','The\x20executeSql\x20method\x20accepts\x20two\x20parameters:\x20sqlCode\x20(string)\x20and\x20optional\x20params\x20(object)','IMPORTANT:\x20Business\x20logic\x20errors\x20(SQL\x20failures)\x20are\x20returned\x20in\x20data.execError,\x20not\x20thrown','IMPORTANT:\x20All\x20SQL\x20queries\x20use\x20the\x20same\x20execution\x20pattern\x20-\x20client.api.executeSql(sqlCode,\x20params)','toLowerCase','value','On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20exception\x20-\x20use\x20try-catch\x20for\x20error\x20handling','sqlDesc','date','Custom\x20SQL','length','\x20SQL\x20queries\x20for\x20application\x20','\x27,\x0a\x20\x20env:\x20\x27','updateTime','\x27,\x0a});\x0a\x0a//\x20Execute\x20the\x20SQL\x20query:\x20','stringify','\x22\x0aconst\x20data\x20=\x20await\x20client.api.executeSql(\x27','6784992NeMmwv','all','For\x20more\x20customization,\x20use\x20generate_sql_code\x20tool\x20to\x20get\x20code\x20with\x20type\x20inference','description','reduce','example','from','sql','LOVRABET_ENV','150707NZsJXZ','sqlName','Failed\x20to\x20list\x20SQL\x20queries:\x20','\x0aconst\x20data\x20=\x20await\x20client.api.executeSql(\x27','1164072WLIUlR','message','The\x20execResult\x20contains\x20an\x20array\x20of\x20row\x20objects\x20matching\x20your\x20SQL\x20query\x20structure','filter','No\x20SQL\x20queries\x20found.\x20Check\x20your\x20appCode\x20and\x20authentication.','IMPORTANT:\x20Always\x20check\x20data.execSuccess\x20before\x20using\x20data.execResult','replace','join','SDK\x20returns\x20{\x20execSuccess:\x20boolean,\x20execResult?:\x20any[]\x20}\x20-\x20Always\x20check\x20execSuccess\x20before\x20using\x20execResult','createdTime','includes','createTime','category','data','64KXbqdZ','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','LOVRABET_APP_CODE','map','1390456pnzKMs','match','This\x20SQL\x20does\x20not\x20require\x20any\x20parameters','sqlCode'];a16_0x24db=function(){return _0x213dbd;};return a16_0x24db();}
|
package/dist/tools/login.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x387c74,_0x3d2586){const _0xb0facf=a17_0x85eb,_0x196a46=_0x387c74();while(!![]){try{const _0x4d375d=-parseInt(_0xb0facf(0x1cb))/0x1*(parseInt(_0xb0facf(0x1d1))/0x2)+parseInt(_0xb0facf(0x1d9))/0x3*(-parseInt(_0xb0facf(0x1df))/0x4)+parseInt(_0xb0facf(0x1d5))/0x5*(parseInt(_0xb0facf(0x1cf))/0x6)+-parseInt(_0xb0facf(0x1e7))/0x7+-parseInt(_0xb0facf(0x1e5))/0x8+-parseInt(_0xb0facf(0x1dd))/0x9+parseInt(_0xb0facf(0x1dc))/0xa;if(_0x4d375d===_0x3d2586)break;else _0x196a46['push'](_0x196a46['shift']());}catch(_0x42caea){_0x196a46['push'](_0x196a46['shift']());}}}(a17_0x4817,0x7c5a9));function a17_0x85eb(_0x14a8f5,_0x58a45b){_0x14a8f5=_0x14a8f5-0x1c3;const _0x48176a=a17_0x4817();let _0x85eb8a=_0x48176a[_0x14a8f5];return _0x85eb8a;}import*as a17_0x22c24b from'node:https';function a17_0x4817(){const _0x15337b=['writeHead','message','Login\x20server\x20error','Failed\x20to\x20fetch\x20SSL\x20certificates\x20for\x20login\x20server','Login\x20successful\x20but\x20failed\x20to\x20save\x20cookie:\x20','end','\x20environment','headers','error','Already\x20logged\x20in\x20to\x20','26fTPlgN','/api/auth/get-session','</p>\x0a\x20\x20\x20\x20<p>Please\x20check\x20file\x20permissions\x20for\x20~/.lovrabet/cookie</p>\x0a\x20\x20</div>\x0a</body>\x0a</html>','https://g.yuntooai.com/cert/lovrabet-dev.json','139146rmEImK','https://dev.lovrabet.com:','3042yBVHcy','json','session','127.0.0.1','120PkgoNa','text/html;\x20charset=utf-8','listen','address','819pdVqWE','online','user','9150330XDdjAq','4392009HvyLjY','createServer','2708TGtukN','<!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','env','object','Internal\x20server\x20error','close','21864FapVSb','Please\x20open\x20this\x20URL\x20in\x20your\x20browser\x20to\x20login:\x20','1730141cdskKd'];a17_0x4817=function(){return _0x15337b;};return a17_0x4817();}import{saveCookie}from'../auth/cookie-manager.js';import{isSessionValid}from'../auth/session-validator.js';import{getUserDomain}from'../auth/constants.js';export async function login(_0x52e3de={}){const _0x87dc3e=a17_0x85eb,_0x5d471c=_0x52e3de[_0x87dc3e(0x1e1)]||_0x87dc3e(0x1da);if(await isSessionValid(_0x5d471c))return{'success':!![],'message':_0x87dc3e(0x1ca)+_0x5d471c+_0x87dc3e(0x1c7),'env':_0x5d471c};let _0x494216;try{const _0x1cf28a=await fetch(_0x87dc3e(0x1ce));_0x494216=await _0x1cf28a[_0x87dc3e(0x1d2)]();}catch(_0x41c287){return{'success':![],'message':_0x87dc3e(0x1c4),'env':_0x5d471c};}return new Promise(_0x515142=>{const _0x300918=_0x87dc3e;let _0x4d79b7=0x0;const _0x141c3f=a17_0x22c24b[_0x300918(0x1de)](_0x494216,async(_0x1cbca6,_0x100668)=>{const _0xedbf83=_0x300918,_0x22d407=getUserDomain(_0x5d471c),_0x4b8b0d=_0x1cbca6[_0xedbf83(0x1c8)]['cookie']||'';try{const _0x2cfa95=await fetch(_0x22d407+_0xedbf83(0x1cc),{'headers':{'cookie':_0x4b8b0d}}),_0x42cf9f=await _0x2cfa95[_0xedbf83(0x1d2)](),_0x4ef6e8=_0x42cf9f&&_0x42cf9f[_0xedbf83(0x1d3)]&&_0x42cf9f[_0xedbf83(0x1db)];if(_0x4ef6e8){try{saveCookie(_0x4b8b0d);}catch(_0xb317f9){const _0x5be9a4=_0xedbf83(0x1e0)+_0xb317f9[_0xedbf83(0x1e9)]+_0xedbf83(0x1cd);_0x100668['writeHead'](0x1f4,{'Content-Type':_0xedbf83(0x1d6)}),_0x100668['end'](_0x5be9a4),_0x141c3f[_0xedbf83(0x1e4)](),_0x515142({'success':![],'message':_0xedbf83(0x1c5)+_0xb317f9['message'],'env':_0x5d471c});return;}const _0x44d1b5='<!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>';_0x100668[_0xedbf83(0x1e8)](0xc8,{'Content-Type':_0xedbf83(0x1d6)}),_0x100668[_0xedbf83(0x1c6)](_0x44d1b5),_0x141c3f[_0xedbf83(0x1e4)](),_0x515142({'success':!![],'message':'Successfully\x20logged\x20in\x20to\x20'+_0x5d471c+_0xedbf83(0x1c7),'env':_0x5d471c});}else{const _0x4ff2f3=encodeURIComponent(_0xedbf83(0x1d0)+_0x4d79b7);_0x100668[_0xedbf83(0x1e8)](0x12e,{'location':_0x22d407+'/sign-in?redirect='+_0x4ff2f3}),_0x100668['end']();}}catch(_0x1cfb76){_0x100668[_0xedbf83(0x1e8)](0x1f4,{'Content-Type':'text/plain'}),_0x100668[_0xedbf83(0x1c6)](_0xedbf83(0x1e3)),_0x141c3f[_0xedbf83(0x1e4)](),_0x515142({'success':![],'message':_0xedbf83(0x1c3),'env':_0x5d471c});}});_0x141c3f[_0x300918(0x1d7)](0x0,_0x300918(0x1d4),()=>{const _0x595d96=_0x300918,_0xe78a3a=_0x141c3f[_0x595d96(0x1d8)]();_0x4d79b7=typeof _0xe78a3a===_0x595d96(0x1e2)&&_0xe78a3a?_0xe78a3a['port']:0x0;const _0x396cbf=_0x595d96(0x1d0)+_0x4d79b7;_0x515142({'success':![],'message':_0x595d96(0x1e6)+_0x396cbf,'loginUrl':_0x396cbf,'env':_0x5d471c});}),_0x141c3f['on'](_0x300918(0x1c9),_0x3cada5=>{_0x515142({'success':![],'message':'Login\x20server\x20error:\x20'+_0x3cada5['message'],'env':_0x5d471c});}),setTimeout(()=>{_0x141c3f['close'](),_0x515142({'success':![],'message':'Login\x20timeout\x20-\x20no\x20response\x20received\x20within\x205\x20minutes','env':_0x5d471c});},0x5*0x3c*0x3e8);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4d0059,_0x4d47b9){const _0x3d9b3e=a18_0x367d,_0x3e5c8b=_0x4d0059();while(!![]){try{const _0x2e765f=-parseInt(_0x3d9b3e(0x19d))/0x1*(parseInt(_0x3d9b3e(0x19b))/0x2)+-parseInt(_0x3d9b3e(0x17a))/0x3*(parseInt(_0x3d9b3e(0x1a3))/0x4)+parseInt(_0x3d9b3e(0x18a))/0x5+parseInt(_0x3d9b3e(0x19f))/0x6*(parseInt(_0x3d9b3e(0x18c))/0x7)+parseInt(_0x3d9b3e(0x199))/0x8+-parseInt(_0x3d9b3e(0x1a9))/0x9+parseInt(_0x3d9b3e(0x1a8))/0xa;if(_0x2e765f===_0x4d47b9)break;else _0x3e5c8b['push'](_0x3e5c8b['shift']());}catch(_0x347900){_0x3e5c8b['push'](_0x3e5c8b['shift']());}}}(a18_0x191b,0xc187e));function a18_0x367d(_0x4c41ce,_0x2586c5){_0x4c41ce=_0x4c41ce-0x176;const _0x191be3=a18_0x191b();let _0x367d91=_0x191be3[_0x4c41ce];return _0x367d91;}function a18_0x191b(){const _0x35cccc=['sqlCode','ALTER\x5cs+(TABLE|DATABASE)','split','.\x20Only\x20SELECT\x20queries\x20are\x20allowed.','createdTime','EXEC','tableData','CREATE\x5cs+(TABLE|INDEX|DATABASE|VIEW)','GRANT','SELECT','REVOKE','env','data','toUpperCase','\x5c\x5cs+','7175685MtETiv','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','27356bhdUXY','Only\x20SELECT\x20queries\x20are\x20allowed.\x20The\x20SQL\x20must\x20start\x20with\x20SELECT\x20(after\x20any\x20comments).','UPDATE\x5cs+\x5cw+\x5cs+SET','Forbidden\x20keyword\x20detected:\x20','Failed\x20to\x20save\x20custom\x20SQL','TRUNCATE','SQL\x20validation\x20failed:\x20','sqlName','EXECUTE','name','trim','saveUserCustomSql','sqlContent\x20is\x20required\x20and\x20cannot\x20be\x20empty.','12030312opcJAh','errorMsg','14ayfiFC','Custom\x20SQL\x20saved\x20successfully','203937hesjvB','online','1050ouxIon','startsWith','replace','valid','124TzkUcC','verified','sql','dbId\x20is\x20required.\x20Get\x20it\x20from\x20get_dataset_detail\x20->\x20basic.database.dbId','createTime','12179370JGTygQ','12940947KqxzXZ','sqlContent','sqlName\x20is\x20required\x20and\x20cannot\x20be\x20empty.','string','success','find','DROP\x5cs+(TABLE|INDEX|DATABASE)','sqlId','message','SQL\x20content\x20cannot\x20be\x20empty','LOVRABET_APP_CODE','114447NucYZN'];a18_0x191b=function(){return _0x35cccc;};return a18_0x191b();}import{DevApiClient}from'../api/dev-api-client.js';function validateSelectSql(_0x19410b){const _0x2f230e=a18_0x367d;if(!_0x19410b||typeof _0x19410b!==_0x2f230e(0x1ac))return{'valid':![],'reason':_0x2f230e(0x178)};const _0x152933=_0x19410b['replace'](/#\{[^}]*\}/g,'?')[_0x2f230e(0x1a1)](/\$\{[^}]*\}/g,'?')['replace'](/@[^(\s]+(\([^)]*\))?/g,''),_0x3196f7=_0x152933[_0x2f230e(0x196)](),_0x25d20f=_0x3196f7[_0x2f230e(0x17d)]('\x0a');let _0x5887d3='';for(const _0x213b7e of _0x25d20f){const _0x45739f=_0x213b7e['trim']();if(!_0x45739f||_0x45739f[_0x2f230e(0x1a0)]('--')||_0x45739f[_0x2f230e(0x1a0)]('/*'))continue;_0x5887d3=_0x45739f;break;}if(!_0x5887d3[_0x2f230e(0x188)]()[_0x2f230e(0x1a0)](_0x2f230e(0x184)))return{'valid':![],'reason':_0x2f230e(0x18d)};const _0x4893e3=['INSERT\x5cs+INTO',_0x2f230e(0x18e),'DELETE\x5cs+FROM',_0x2f230e(0x1af),_0x2f230e(0x17c),_0x2f230e(0x182),_0x2f230e(0x191),_0x2f230e(0x183),_0x2f230e(0x185),_0x2f230e(0x180),_0x2f230e(0x194)],_0x3cfa30=_0x3196f7[_0x2f230e(0x188)]();for(const _0x52ab38 of _0x4893e3){const _0x55683b=new RegExp(_0x52ab38,'i');if(_0x55683b['test'](_0x3cfa30))return{'valid':![],'reason':_0x2f230e(0x18f)+_0x52ab38[_0x2f230e(0x1a1)](_0x2f230e(0x189),'\x20')+_0x2f230e(0x17e)};}return{'valid':!![]};}export async function saveCustomSql(_0x54b0c2){const _0x13440a=a18_0x367d,{appCode:appCode=process['env'][_0x13440a(0x179)],cookie:_0x3f7742,env:env=process[_0x13440a(0x186)]['LOVRABET_ENV']||_0x13440a(0x19e),sqlName:_0x4e0095,dbId:_0x37f6e4,sqlContent:_0x2f2b1e,verifyAfterSave:verifyAfterSave=!![]}=_0x54b0c2;if(!appCode)throw new Error(_0x13440a(0x18b));if(!_0x4e0095||_0x4e0095['trim']()==='')throw new Error(_0x13440a(0x1ab));if(!_0x37f6e4)throw new Error(_0x13440a(0x1a6));if(!_0x2f2b1e||_0x2f2b1e['trim']()==='')throw new Error(_0x13440a(0x198));const _0x46fe82=validateSelectSql(_0x2f2b1e);if(!_0x46fe82[_0x13440a(0x1a2)])throw new Error(_0x13440a(0x192)+_0x46fe82['reason']);const _0x135b57=new DevApiClient({'appCode':appCode,'cookie':_0x3f7742,'env':env}),_0x10ebe0=_0x4e0095[_0x13440a(0x196)](),_0x543250=await _0x135b57[_0x13440a(0x197)]({'sqlName':_0x10ebe0,'dbId':_0x37f6e4,'sqlContent':_0x2f2b1e['trim']()});if(!_0x543250[_0x13440a(0x1ad)])return{'success':![],'message':_0x543250[_0x13440a(0x177)]||_0x543250[_0x13440a(0x19a)]||_0x13440a(0x190)};const _0x15bd52={'success':!![],'message':_0x13440a(0x19c),'data':_0x543250[_0x13440a(0x187)]};if(verifyAfterSave)try{const _0x5a476b=await _0x135b57['getCustomSqlList']({'pageSize':0xa,'currentPage':0x1,'sqlName':_0x10ebe0}),_0x48f869=_0x5a476b['data']?.[_0x13440a(0x181)]||[],_0x92cb10=_0x48f869[_0x13440a(0x1ae)](_0x49d70c=>_0x49d70c[_0x13440a(0x193)]===_0x10ebe0||_0x49d70c[_0x13440a(0x195)]===_0x10ebe0);_0x92cb10?_0x15bd52[_0x13440a(0x1a4)]={'found':!![],'sqlInfo':{'sqlCode':_0x92cb10[_0x13440a(0x17b)]||appCode+'-'+(_0x92cb10[_0x13440a(0x176)]||_0x92cb10['id']),'sqlId':_0x92cb10[_0x13440a(0x176)]||_0x92cb10['id'],'name':_0x92cb10[_0x13440a(0x193)]||_0x92cb10[_0x13440a(0x195)],'sqlContent':_0x92cb10[_0x13440a(0x1aa)]||_0x92cb10[_0x13440a(0x1a5)],'createdTime':_0x92cb10[_0x13440a(0x17f)]||_0x92cb10[_0x13440a(0x1a7)]}}:_0x15bd52['verified']={'found':![]};}catch(_0x815fc8){process['env']['NODE_ENV']!=='test'&&console['warn']('[saveCustomSql]\x20Verification\x20query\x20failed:',_0x815fc8),_0x15bd52[_0x13440a(0x1a4)]={'found':![]};}return _0x15bd52;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a19_0x5a4d(_0x5bd316,_0x5cc51a){_0x5bd316=_0x5bd316-0x118;const _0x5eec2d=a19_0x5eec();let _0x5a4da1=_0x5eec2d[_0x5bd316];return _0x5a4da1;}(function(_0x46d319,_0x138156){const _0x29e64c=a19_0x5a4d,_0x418839=_0x46d319();while(!![]){try{const _0x92cc6=parseInt(_0x29e64c(0x137))/0x1+parseInt(_0x29e64c(0x141))/0x2*(parseInt(_0x29e64c(0x12b))/0x3)+-parseInt(_0x29e64c(0x136))/0x4+parseInt(_0x29e64c(0x12d))/0x5*(parseInt(_0x29e64c(0x11e))/0x6)+parseInt(_0x29e64c(0x15b))/0x7*(-parseInt(_0x29e64c(0x14a))/0x8)+parseInt(_0x29e64c(0x138))/0x9*(parseInt(_0x29e64c(0x156))/0xa)+-parseInt(_0x29e64c(0x151))/0xb*(parseInt(_0x29e64c(0x124))/0xc);if(_0x92cc6===_0x138156)break;else _0x418839['push'](_0x418839['shift']());}catch(_0x85fd5e){_0x418839['push'](_0x418839['shift']());}}}(a19_0x5eec,0x2cfca));import{DevApiClient}from'../api/dev-api-client.js';import{validateIsSelectOnly,parseSqlStructure,generateSqlSummary}from'../utils/sql-parser.js';export async function saveOrUpdateCustomSql(_0x4f80db){const _0x2241a3=a19_0x5a4d,_0x53b2ce=Date['now'](),{appCode:appCode=process['env'][_0x2241a3(0x11b)],cookie:_0x318bb5,env:env=process['env'][_0x2241a3(0x143)]||'online',sqlName:_0x3305d5,dbId:_0x3b9c8d,sqlContent:_0x344484,id:_0x5381cc,sqlCode:_0x46a86d,verifyAfterSave:verifyAfterSave=!![],validateSchema:validateSchema=![]}=_0x4f80db;if(!appCode)throw new Error(_0x2241a3(0x130));if(!_0x3305d5||_0x3305d5[_0x2241a3(0x12a)]()==='')throw new Error(_0x2241a3(0x139));if(!_0x3b9c8d)throw new Error(_0x2241a3(0x119));if(!_0x344484||_0x344484['trim']()==='')throw new Error(_0x2241a3(0x159));const _0x2f09c6=_0x5381cc!==undefined&&_0x5381cc>0x0||_0x46a86d!==undefined&&_0x46a86d[_0x2241a3(0x12a)]()!=='';if(_0x2f09c6){if(!_0x5381cc)throw new Error(_0x2241a3(0x118));if(!_0x46a86d)throw new Error(_0x2241a3(0x157));}const _0x1331e2=validateIsSelectOnly(_0x344484);if(!_0x1331e2[_0x2241a3(0x142)])throw new Error(_0x2241a3(0x145)+_0x1331e2['reason']);const _0x278dfa=parseSqlStructure(_0x344484),_0x9e44e3=generateSqlSummary(_0x344484),_0xc7958d=new DevApiClient({'appCode':appCode,'cookie':_0x318bb5,'env':env}),_0x2d40c0=_0x3305d5[_0x2241a3(0x12a)]();let _0x2b5731;_0x2f09c6?_0x2b5731=await _0xc7958d[_0x2241a3(0x12e)]({'id':_0x5381cc,'sqlCode':_0x46a86d[_0x2241a3(0x12a)](),'sqlName':_0x2d40c0,'dbId':_0x3b9c8d,'sqlContent':_0x344484[_0x2241a3(0x12a)]()}):_0x2b5731=await _0xc7958d[_0x2241a3(0x126)]({'sqlName':_0x2d40c0,'dbId':_0x3b9c8d,'sqlContent':_0x344484[_0x2241a3(0x12a)]()});const _0x1e08ed=Date['now']()-_0x53b2ce;if(!_0x2b5731[_0x2241a3(0x132)])return{'success':![],'action':_0x2f09c6?'updated':_0x2241a3(0x12f),'message':_0x2b5731[_0x2241a3(0x14b)]||_0x2b5731[_0x2241a3(0x13b)]||_0x2241a3(0x128)+(_0x2f09c6?_0x2241a3(0x155):_0x2241a3(0x149))+_0x2241a3(0x121),'nextSteps':[{'action':_0x2241a3(0x135),'tool':'login','reason':_0x2241a3(0x13a)},{'action':_0x2241a3(0x147),'tool':_0x2241a3(0x14c),'params':{'datasetCode':'<dataset-code>'},'reason':_0x2241a3(0x133)}]};const _0x29d194=_0x2b5731[_0x2241a3(0x13f)]?.[_0x2241a3(0x14f)]||_0x2b5731[_0x2241a3(0x13f)]?.[_0x2241a3(0x129)],_0xa819b7=_0x2b5731[_0x2241a3(0x13f)]?.[_0x2241a3(0x146)]||_0x2b5731[_0x2241a3(0x13f)]?.['id'],_0xa0b8f0=[{'action':_0x2241a3(0x11d),'tool':_0x2241a3(0x152),'params':{'sqlCode':_0x29d194||''},'reason':_0x2241a3(0x11c),'priority':_0x2241a3(0x15c)},{'action':_0x2241a3(0x122),'tool':_0x2241a3(0x158),'params':{'sqlCode':_0x29d194||''},'reason':_0x2241a3(0x144),'priority':_0x2241a3(0x13c)}],_0x57c66a={'success':!![],'action':_0x2f09c6?_0x2241a3(0x120):'created','message':_0x2f09c6?_0x2241a3(0x15e)+_0x2d40c0+_0x2241a3(0x14e)+_0x9e44e3+')':_0x2241a3(0x15e)+_0x2d40c0+_0x2241a3(0x11a)+_0x9e44e3+')','nextSteps':_0xa0b8f0,'parsedStructure':{'tables':_0x278dfa['tables'],'columns':_0x278dfa[_0x2241a3(0x11f)]['length'],'parameters':_0x278dfa['parameters'],'summary':_0x9e44e3},'data':_0x2b5731[_0x2241a3(0x13f)]};if(verifyAfterSave)try{const _0x47644f=await _0xc7958d['getCustomSqlList']({'pageSize':0xa,'currentPage':0x1,'sqlName':_0x2d40c0}),_0x286b5d=_0x47644f[_0x2241a3(0x13f)]?.['tableData']||[],_0x119c48=_0x286b5d[_0x2241a3(0x12c)](_0x1cb5da=>_0x1cb5da[_0x2241a3(0x125)]===_0x2d40c0||_0x1cb5da[_0x2241a3(0x131)]===_0x2d40c0);_0x119c48?(_0x57c66a[_0x2241a3(0x127)]={'found':!![],'sqlInfo':{'sqlCode':_0x119c48['sqlCode']||appCode+'-'+(_0x119c48['sqlId']||_0x119c48['id']),'sqlId':_0x119c48['sqlId']||_0x119c48['id'],'id':_0x119c48['id'],'name':_0x119c48['sqlName']||_0x119c48[_0x2241a3(0x131)],'sqlContent':_0x119c48[_0x2241a3(0x153)]||_0x119c48['sql'],'createdTime':_0x119c48[_0x2241a3(0x15a)]||_0x119c48[_0x2241a3(0x150)],'updatedTime':_0x119c48[_0x2241a3(0x140)]||_0x119c48[_0x2241a3(0x13d)]}},_0x57c66a['verified'][_0x2241a3(0x123)]?.[_0x2241a3(0x14f)]&&(_0xa0b8f0[0x0][_0x2241a3(0x13e)]={'sqlCode':_0x57c66a[_0x2241a3(0x127)][_0x2241a3(0x123)][_0x2241a3(0x14f)]},_0xa0b8f0[0x1][_0x2241a3(0x13e)]={'sqlCode':_0x57c66a[_0x2241a3(0x127)][_0x2241a3(0x123)][_0x2241a3(0x14f)]})):_0x57c66a[_0x2241a3(0x127)]={'found':![]};}catch(_0x1e2b23){process[_0x2241a3(0x154)][_0x2241a3(0x14d)]!==_0x2241a3(0x15d)&&console[_0x2241a3(0x134)](_0x2241a3(0x148),_0x1e2b23),_0x57c66a[_0x2241a3(0x127)]={'found':![]};}return _0x57c66a;}function a19_0x5eec(){const _0x150e82=['sqlContent\x20is\x20required\x20and\x20cannot\x20be\x20empty.','createdTime','203vGMFss','high','test','Custom\x20SQL\x20\x22','id\x20is\x20required\x20for\x20updating\x20existing\x20SQL.','dbId\x20is\x20required.\x20Get\x20it\x20from\x20get_dataset_detail\x20->\x20basic.database.dbId','\x22\x20saved\x20successfully\x20(','LOVRABET_APP_CODE','Execute\x20the\x20SQL\x20to\x20check\x20for\x20runtime\x20errors','Test\x20the\x20SQL\x20to\x20verify\x20it\x20works\x20correctly','36vANkoq','columns','updated','\x20custom\x20SQL','Generate\x20SDK\x20code\x20for\x20this\x20SQL','sqlInfo','240KGJBdr','sqlName','saveUserCustomSql','verified','Failed\x20to\x20','code','trim','651lHQAwj','find','154640GKIAAI','updateUserCustomSql','created','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','name','success','Confirm\x20the\x20dbId\x20matches\x20the\x20database\x20you\x20want\x20to\x20use','warn','Check\x20database\x20connection\x20and\x20permissions','1262368bNYSGB','220368KijPso','1738611fxCdSX','sqlName\x20is\x20required\x20and\x20cannot\x20be\x20empty.','Ensure\x20you\x20are\x20logged\x20in\x20with\x20proper\x20permissions','errorMsg','medium','updateTime','params','data','updatedTime','2870cybBMD','valid','LOVRABET_ENV','Get\x20ready-to-use\x20TypeScript\x20code\x20for\x20your\x20application','SQL\x20validation\x20failed:\x20','sqlId','Verify\x20database\x20ID\x20is\x20correct','[saveOrUpdateCustomSql]\x20Verification\x20query\x20failed:','save','75904mabcri','message','get_dataset_detail','NODE_ENV','\x22\x20updated\x20successfully\x20(','sqlCode','createTime','74525iuoFiu','execute_custom_sql','sqlContent','env','update','10TUBBhw','sqlCode\x20is\x20required\x20for\x20updating\x20existing\x20SQL.','generate_sql_code'];a19_0x5eec=function(){return _0x150e82;};return a19_0x5eec();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a20_0x2684(){const _0x594526=['378ejgKOx','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','2631948HBgqqc','name','env','code','37012UiVrvG','datasets','35YOocmu','map','570498PlTOny','364337YwLenV','tableName','description','2507046OblzDl','total','keyword\x20is\x20required','4120HLbUfu','219DERtth','321460tPKCaV','18802GBiNvm'];a20_0x2684=function(){return _0x594526;};return a20_0x2684();}(function(_0x3eff68,_0x16cc66){const _0x27515f=a20_0x1341,_0x3646aa=_0x3eff68();while(!![]){try{const _0x27c0e1=-parseInt(_0x27515f(0x18d))/0x1+parseInt(_0x27515f(0x17b))/0x2+-parseInt(_0x27515f(0x17f))/0x3*(-parseInt(_0x27515f(0x188))/0x4)+-parseInt(_0x27515f(0x18a))/0x5*(parseInt(_0x27515f(0x18c))/0x6)+-parseInt(_0x27515f(0x181))/0x7*(-parseInt(_0x27515f(0x17e))/0x8)+-parseInt(_0x27515f(0x182))/0x9*(parseInt(_0x27515f(0x180))/0xa)+-parseInt(_0x27515f(0x184))/0xb;if(_0x27c0e1===_0x16cc66)break;else _0x3646aa['push'](_0x3646aa['shift']());}catch(_0x1f92b6){_0x3646aa['push'](_0x3646aa['shift']());}}}(a20_0x2684,0xa92e4));import{DevApiClient}from'../api/dev-api-client.js';import{DatasetAnalyzer}from'../analyzer/dataset-analyzer.js';function a20_0x1341(_0x387690,_0x2ad664){_0x387690=_0x387690-0x17a;const _0x26844d=a20_0x2684();let _0x1341e6=_0x26844d[_0x387690];return _0x1341e6;}export async function searchDatasets(_0x225ac8){const _0x26e4ad=a20_0x1341,{appCode:appCode=process[_0x26e4ad(0x186)]['LOVRABET_APP_CODE'],cookie:_0x39d12b,env:env=process['env']['LOVRABET_ENV']||'online',keyword:_0x7bd6ae}=_0x225ac8;if(!appCode)throw new Error(_0x26e4ad(0x183));if(!_0x7bd6ae)throw new Error(_0x26e4ad(0x17d));const _0x2ff551=new DevApiClient({'appCode':appCode,'cookie':_0x39d12b,'env':env}),_0x36765e=await _0x2ff551['searchDatasets'](_0x7bd6ae),_0x4d8206=new DatasetAnalyzer(),_0x2441e2=_0x4d8206['analyzeDatasetList'](_0x36765e);return{'appCode':appCode,'env':env,'keyword':_0x7bd6ae,'total':_0x2441e2[_0x26e4ad(0x17c)],'datasets':_0x2441e2[_0x26e4ad(0x189)][_0x26e4ad(0x18b)](_0x33e007=>({'id':_0x33e007['id'],'name':_0x33e007[_0x26e4ad(0x185)],'code':_0x33e007[_0x26e4ad(0x187)],'tableName':_0x33e007[_0x26e4ad(0x18e)],'description':_0x33e007[_0x26e4ad(0x17a)]}))};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x41d4ea,_0x1c21b5){const _0x516933=a21_0xcf3b,_0x10b1eb=_0x41d4ea();while(!![]){try{const _0x5325cd=-parseInt(_0x516933(0xea))/0x1+parseInt(_0x516933(0x119))/0x2*(parseInt(_0x516933(0x118))/0x3)+-parseInt(_0x516933(0x123))/0x4*(parseInt(_0x516933(0x106))/0x5)+parseInt(_0x516933(0x121))/0x6+-parseInt(_0x516933(0x10c))/0x7+parseInt(_0x516933(0x102))/0x8*(parseInt(_0x516933(0x10e))/0x9)+parseInt(_0x516933(0xf2))/0xa*(parseInt(_0x516933(0x10a))/0xb);if(_0x5325cd===_0x1c21b5)break;else _0x10b1eb['push'](_0x10b1eb['shift']());}catch(_0x59714c){_0x10b1eb['push'](_0x10b1eb['shift']());}}}(a21_0x5449,0x2ff90));import{DevApiClient}from'../api/dev-api-client.js';import{validateIsSelectOnly,parseSqlStructure,validateSqlContent as a21_0x39e896,generateSqlSummary}from'../utils/sql-parser.js';import{createStructuredSqlError}from'../types/mcp-types.js';function a21_0x5449(){const _0x3e6765=['SQL_START','data','push','20CKxjbF','Only\x20SELECT\x20queries\x20are\x20allowed\x20for\x20custom\x20SQL','properties','TABLE_NOT_FOUND','6974dZJvOH','Get\x20database\x20ID\x20to\x20save\x20this\x20SQL','217000fblQXR','test','81wOIJvm','valid','typeLabel','find','COLUMN_NOT_FOUND','Review\x20SQL\x20errors\x20and\x20fix','<dataset-code>','type','SQL\x20validation\x20failed:\x20','fieldCode','11799gSQcEU','50WHuGYx','env','list_datasets','medium','getDatasetList','Need\x20dbId\x20from\x20dataset\x20detail\x20to\x20save\x20SQL','high','warn','993216EmwFTS','length','55012wNoOMV','95050yGjKyA','tableName','nextSteps','List\x20all\x20available\x20datasets','Modify\x20SQL\x20to\x20be\x20a\x20SELECT\x20statement\x20only','Fix\x20the\x20identified\x20errors\x20before\x20saving','SQL\x20must\x20be\x20a\x20SELECT\x20statement','Get\x20dataset\x20details\x20to\x20find\x20correct\x20table/column\x20names','1170vZibIg','\x20error(s))','LOVRABET_ENV','SQL\x20validation\x20passed\x20(','errors','save_or_update_custom_sql','NODE_ENV','Save\x20this\x20validated\x20SQL','get_dataset_detail','trim','reason','description','validate_sql_content','code','SQL\x20content\x20cannot\x20be\x20empty','SQL\x20validation\x20failed\x20(','35128cgNEeR'];a21_0x5449=function(){return _0x3e6765;};return a21_0x5449();}async function fetchSchemaInfo(_0x217d89,_0x39df2b){const _0x204249=a21_0xcf3b,_0x10d1d4=[];for(const _0x268b22 of _0x217d89){try{const _0x3ecfc9=/^\d+$/[_0x204249(0x10d)](_0x268b22);let _0x3ccc51=_0x268b22;if(!_0x3ecfc9){const _0x426f7c=await _0x39df2b[_0x204249(0x11d)]({'pageSize':0x3e7}),_0x514dac=_0x426f7c[_0x204249(0x104)]?.['tableData']||[],_0x2f5d1e=_0x514dac[_0x204249(0x111)](_0x114e80=>_0x114e80[_0x204249(0xff)]===_0x268b22);if(!_0x2f5d1e)continue;_0x3ccc51=String(_0x2f5d1e['id']);}const _0x724db8=await _0x39df2b['getDatasetDetail'](_0x3ccc51),_0x133620=_0x724db8[_0x204249(0x104)]?.[_0x204249(0xeb)]||'',_0x27a8cc=_0x724db8[_0x204249(0x104)]?.[_0x204249(0x108)]||[],_0x41a66d=_0x27a8cc['map'](_0x1b536=>_0x1b536[_0x204249(0xff)]||_0x1b536[_0x204249(0x117)]);_0x133620&&_0x41a66d['length']>0x0&&_0x10d1d4[_0x204249(0x105)]({'tableName':_0x133620,'columns':_0x41a66d});}catch(_0x36e269){process[_0x204249(0x11a)][_0x204249(0xf8)]!==_0x204249(0x10d)&&console[_0x204249(0x120)]('[validateSqlContent]\x20Failed\x20to\x20fetch\x20schema\x20for\x20'+_0x268b22+':',_0x36e269);}}return _0x10d1d4;}export async function validateSqlContentTool(_0xd96657){const _0xebdd3a=a21_0xcf3b,{appCode:appCode=process[_0xebdd3a(0x11a)]['LOVRABET_APP_CODE'],cookie:_0x14eeff,env:env=process[_0xebdd3a(0x11a)][_0xebdd3a(0xf4)]||'online',sqlContent:_0x1bc651,dbId:_0x1c840b,validateSchemas:validateSchemas=[]}=_0xd96657;if(!_0x1bc651||_0x1bc651[_0xebdd3a(0xfb)]()==='')return{'success':![],'message':'SQL\x20content\x20is\x20required','validation':{'valid':![],'isSelectOnly':![]},'nextSteps':[{'action':'Provide\x20SQL\x20content\x20to\x20validate','tool':_0xebdd3a(0xfe),'reason':_0xebdd3a(0x100)}]};const _0x596030=validateIsSelectOnly(_0x1bc651);if(!_0x596030['valid'])return{'success':![],'message':_0xebdd3a(0x116)+_0x596030[_0xebdd3a(0xfc)],'validation':{'valid':![],'isSelectOnly':![],'errors':[createStructuredSqlError({'type':'SYNTAX_ERROR','location':_0xebdd3a(0x103),'message':_0x596030[_0xebdd3a(0xfc)]||'Invalid\x20SQL','severity':'error','fixSteps':[{'description':_0xebdd3a(0xf0),'example':'SELECT\x20id,\x20name\x20FROM\x20customer\x20WHERE\x20status\x20=\x201'}]})]},'nextSteps':[{'action':_0xebdd3a(0xee),'tool':_0xebdd3a(0xf7),'reason':_0xebdd3a(0x107)}]};const _0x3a94de=parseSqlStructure(_0x1bc651),_0x1fbe04=generateSqlSummary(_0x1bc651);let _0x4fba16;if(validateSchemas[_0xebdd3a(0x122)]>0x0&&appCode){const _0x1aea9b=new DevApiClient({'appCode':appCode,'cookie':_0x14eeff,'env':env});_0x4fba16=await fetchSchemaInfo(validateSchemas,_0x1aea9b);}const _0x5c0a93=a21_0x39e896(_0x1bc651,_0x4fba16?{'tables':_0x4fba16}:undefined),_0x58ad94={'success':_0x5c0a93[_0xebdd3a(0x10f)]||!![],'message':_0x5c0a93[_0xebdd3a(0x10f)]?_0xebdd3a(0xf5)+_0x1fbe04+')':_0xebdd3a(0x101)+(_0x5c0a93[_0xebdd3a(0xf6)]?.[_0xebdd3a(0x122)]||0x0)+_0xebdd3a(0xf3),'validation':{..._0x5c0a93,'parsedStructure':_0x3a94de}},_0x5316fd=[];if(_0x5c0a93[_0xebdd3a(0x10f)])_0x1c840b?_0x5316fd[_0xebdd3a(0x105)]({'action':_0xebdd3a(0xf9),'tool':_0xebdd3a(0xf7),'params':{'sqlName':'<sql-name>','dbId':_0x1c840b,'sqlContent':_0x1bc651},'reason':'SQL\x20is\x20valid\x20and\x20ready\x20to\x20be\x20saved','priority':_0xebdd3a(0x11f)}):_0x5316fd[_0xebdd3a(0x105)]({'action':_0xebdd3a(0x10b),'tool':_0xebdd3a(0xfa),'params':{'datasetCode':'<dataset-code>'},'reason':_0xebdd3a(0x11e),'priority':_0xebdd3a(0x11f)});else{_0x5316fd[_0xebdd3a(0x105)]({'action':_0xebdd3a(0x113),'tool':'validate_sql_content','reason':_0xebdd3a(0xef),'priority':'high'});for(const _0x139182 of _0x5c0a93[_0xebdd3a(0xf6)]||[]){if(_0x139182[_0xebdd3a(0x115)]===_0xebdd3a(0x112)||_0x139182[_0xebdd3a(0x115)]===_0xebdd3a(0x109)){const _0x34888e=_0x139182['fixSteps'][0x0]?.[_0xebdd3a(0xfd)]||_0x139182[_0xebdd3a(0x110)];_0x5316fd['push']({'action':_0xebdd3a(0xf1),'tool':_0xebdd3a(0xfa),'params':{'datasetCode':_0xebdd3a(0x114)},'reason':_0x34888e,'priority':'medium'});break;}}}return!_0x5c0a93['valid']&&_0x5c0a93[_0xebdd3a(0xf6)]?.['some'](_0x3f27c0=>_0x3f27c0[_0xebdd3a(0x115)]===_0xebdd3a(0x109))&&_0x5316fd[_0xebdd3a(0x105)]({'action':_0xebdd3a(0xed),'tool':_0xebdd3a(0x11b),'reason':'Find\x20the\x20correct\x20table\x20names\x20for\x20your\x20SQL','priority':_0xebdd3a(0x11c)}),_0x58ad94[_0xebdd3a(0xec)]=_0x5316fd,_0x58ad94;}function a21_0xcf3b(_0x2c140a,_0x3f5a6){_0x2c140a=_0x2c140a-0xea;const _0x5449d4=a21_0x5449();let _0xcf3b0e=_0x5449d4[_0x2c140a];return _0xcf3b0e;}export{validateSqlContentTool as validateSqlContent};
|
package/dist/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
(function(_0x1740f5,_0x31363c){var _0x27d892=a22_0x3eda,_0x2ba542=_0x1740f5();while(!![]){try{var _0x5de49e=parseInt(_0x27d892(0xe7))/0x1*(-parseInt(_0x27d892(0xe3))/0x2)+-parseInt(_0x27d892(0xe2))/0x3+-parseInt(_0x27d892(0xe5))/0x4+parseInt(_0x27d892(0xe4))/0x5+-parseInt(_0x27d892(0xe0))/0x6*(parseInt(_0x27d892(0xdf))/0x7)+-parseInt(_0x27d892(0xe1))/0x8+parseInt(_0x27d892(0xe6))/0x9;if(_0x5de49e===_0x31363c)break;else _0x2ba542['push'](_0x2ba542['shift']());}catch(_0x27d74d){_0x2ba542['push'](_0x2ba542['shift']());}}}(a22_0x248d,0x313ea));export{createError,createAuthError,createMissingParamError,createDatasetNotFoundError,createSqlNotFoundError,createSqlValidationError,createStructuredSqlError,fromLovrabetError,SQL_ERROR_TYPE_LABELS}from'./mcp-types.js';function a22_0x3eda(_0x56be1b,_0x125d5b){_0x56be1b=_0x56be1b-0xdf;var _0x248d47=a22_0x248d();var _0x3edab4=_0x248d47[_0x56be1b];return _0x3edab4;}function a22_0x248d(){var _0x2350cf=['1120110SUPXsR','1570628Uqsufi','11151855iWukwa','103324zmpeAN','437353QXjjbq','30fHELtb','875400zktIVg','1030830TWuoUi','2ZVHSlh'];a22_0x248d=function(){return _0x2350cf;};return a22_0x248d();}
|
package/dist/types/mcp-types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a23_0x16119f=a23_0x564e;(function(_0x44dbfc,_0x105768){const _0x31b16b=a23_0x564e,_0x1339a0=_0x44dbfc();while(!![]){try{const _0xa849ac=parseInt(_0x31b16b(0x86))/0x1*(parseInt(_0x31b16b(0x9b))/0x2)+-parseInt(_0x31b16b(0x97))/0x3+parseInt(_0x31b16b(0x74))/0x4+parseInt(_0x31b16b(0xa0))/0x5*(parseInt(_0x31b16b(0x7a))/0x6)+-parseInt(_0x31b16b(0x85))/0x7+parseInt(_0x31b16b(0x78))/0x8*(-parseInt(_0x31b16b(0x7b))/0x9)+parseInt(_0x31b16b(0x76))/0xa;if(_0xa849ac===_0x105768)break;else _0x1339a0['push'](_0x1339a0['shift']());}catch(_0x26ffc4){_0x1339a0['push'](_0x1339a0['shift']());}}}(a23_0x4483,0x47631));export const SQL_ERROR_TYPE_LABELS={'TABLE_NOT_FOUND':a23_0x16119f(0xb0),'COLUMN_NOT_FOUND':a23_0x16119f(0xab),'AMBIGUOUS_COLUMN':'字段名歧义','SYNTAX_ERROR':a23_0x16119f(0xa9),'TYPE_MISMATCH':'类型不匹配','MISSING_WHERE_CLAUSE':'缺少\x20WHERE\x20条件','UNSAFE_QUERY':a23_0x16119f(0x81)};function a23_0x564e(_0x3b9762,_0x17fb76){_0x3b9762=_0x3b9762-0x72;const _0x44832d=a23_0x4483();let _0x564e24=_0x44832d[_0x3b9762];return _0x564e24;}export function createError(_0xeeb8f){const _0x3d589a=a23_0x16119f;return{'error':!![],'code':_0xeeb8f[_0x3d589a(0x88)],'message':_0xeeb8f[_0x3d589a(0x98)],'status':_0xeeb8f[_0x3d589a(0x72)],'description':_0xeeb8f[_0x3d589a(0x94)],'response':_0xeeb8f[_0x3d589a(0x83)],'suggestedAction':_0xeeb8f[_0x3d589a(0x92)],'recoverable':_0xeeb8f['recoverable']??!![],'timestamp':new Date()[_0x3d589a(0x91)]()};}export function createAuthError(){const _0x4c251a=a23_0x16119f;return createError({'code':_0x4c251a(0xaa),'message':_0x4c251a(0x7f),'suggestedAction':{'tool':'login','description':_0x4c251a(0x9f),'example':_0x4c251a(0x8b)},'recoverable':!![]});}export function createMissingParamError(_0x502385,_0xc7f8cb){const _0x5490f8=a23_0x16119f;return createError({'code':_0x5490f8(0x75),'message':_0x5490f8(0xa6)+_0x502385+(_0xc7f8cb?'\x20('+_0xc7f8cb+')':''),'recoverable':!![]});}export function createDatasetNotFoundError(_0x46f043){const _0x3f604a=a23_0x16119f;return createError({'code':_0x3f604a(0x87),'message':_0x3f604a(0x7d)+_0x46f043,'suggestedAction':{'tool':_0x3f604a(0x82),'description':_0x3f604a(0xad),'example':_0x3f604a(0x8a)},'recoverable':!![]});}export function createSqlNotFoundError(_0x157195){const _0x3170f2=a23_0x16119f;return createError({'code':_0x3170f2(0x93),'message':_0x3170f2(0x99)+_0x157195,'suggestedAction':{'tool':_0x3170f2(0xa4),'description':_0x3170f2(0x9d),'example':_0x3170f2(0xa1)},'recoverable':!![]});}export function createSqlValidationError(_0x4f35f5){const _0x158876=a23_0x16119f,_0x4c72b1=_0x4f35f5[_0x158876(0x77)][_0x158876(0xaf)]>0x0,_0x5e0642=_0x4c72b1?_0x4f35f5[_0x158876(0x77)][0x0]:undefined,_0x2ad8a2={'type':_0x4f35f5[_0x158876(0x90)],'typeLabel':_0x4f35f5['typeLabel'],'location':_0x4f35f5[_0x158876(0xa2)],'severity':_0x4f35f5[_0x158876(0xae)],'fixSteps':_0x4f35f5['fixSteps'],'suggestions':_0x4f35f5[_0x158876(0xac)],'canAutoFix':_0x4f35f5['canAutoFix'],'fixedSql':_0x4f35f5[_0x158876(0x96)]};return createError({'code':'SQL_VALIDATION_FAILED','message':_0x4f35f5[_0x158876(0xa5)]+':\x20'+_0x4f35f5[_0x158876(0x98)],'status':_0x4f35f5[_0x158876(0x72)],'description':_0x2ad8a2,'response':_0x4f35f5['response'],'suggestedAction':_0x5e0642?{'tool':_0x5e0642[_0x158876(0x84)],'description':_0x5e0642[_0x158876(0x94)],'params':_0x5e0642[_0x158876(0x89)],'example':_0x5e0642[_0x158876(0x7c)]}:{'tool':_0x158876(0x80),'description':'获取数据集详情以确认表名和字段名','params':{'datasetCode':_0x158876(0x95)}},'recoverable':_0x4f35f5[_0x158876(0xae)]!=='error'});}export function createStructuredSqlError(_0x3de6a5){const _0x4e1037=a23_0x16119f,_0x167238=SQL_ERROR_TYPE_LABELS[_0x3de6a5[_0x4e1037(0x90)]],_0x5d310b=_0x3de6a5[_0x4e1037(0xae)]??_0x4e1037(0x7e),_0x2f6ae5=[];if(_0x3de6a5[_0x4e1037(0x90)]===_0x4e1037(0x8d))_0x2f6ae5[_0x4e1037(0x9c)]({'description':_0x4e1037(0x9a),'tool':'list_datasets','toolParams':{'pageSize':0x3e7},'example':_0x4e1037(0x8a)});else{if(_0x3de6a5[_0x4e1037(0x90)]==='COLUMN_NOT_FOUND')_0x2f6ae5[_0x4e1037(0x9c)]({'description':_0x4e1037(0xa3),'tool':_0x4e1037(0x80),'toolParams':{'datasetCode':_0x4e1037(0x95)},'example':'get_dataset_detail({\x20datasetCode:\x20\x22customer\x22\x20})'});else _0x3de6a5[_0x4e1037(0x90)]===_0x4e1037(0x9e)&&_0x2f6ae5[_0x4e1037(0x9c)]({'description':_0x4e1037(0x8c),'example':_0x4e1037(0xa8)});}return{'type':_0x3de6a5[_0x4e1037(0x90)],'typeLabel':_0x167238,'location':_0x3de6a5[_0x4e1037(0xa2)],'message':_0x3de6a5[_0x4e1037(0x98)],'severity':_0x5d310b,'fixSteps':_0x3de6a5['fixSteps']??_0x2f6ae5,'suggestions':_0x3de6a5['suggestions'],'canAutoFix':_0x3de6a5[_0x4e1037(0x73)],'fixedSql':_0x3de6a5[_0x4e1037(0x96)],'status':_0x3de6a5[_0x4e1037(0x72)],'response':_0x3de6a5[_0x4e1037(0x83)]};}export function fromLovrabetError(_0xc5182b,_0x55fa59){const _0x17fa5a=a23_0x16119f;return createError({'code':mapSdkCodeToMcpCode(_0xc5182b[_0x17fa5a(0x88)]),'message':_0xc5182b['message'],'status':_0xc5182b[_0x17fa5a(0x72)],'description':_0xc5182b[_0x17fa5a(0x94)],'response':_0xc5182b[_0x17fa5a(0x83)],'suggestedAction':_0x55fa59,'recoverable':_0xc5182b[_0x17fa5a(0x72)]?_0xc5182b['status']<0x1f4:!![]});}function mapSdkCodeToMcpCode(_0x1830aa){const _0x53e4e6=a23_0x16119f;if(!_0x1830aa)return'UNKNOWN_ERROR';const _0x54d91b={'AUTH_REQUIRED':'AUTH_REQUIRED','AUTH_FAILED':_0x53e4e6(0xaa),'UNAUTHORIZED':_0x53e4e6(0xaa),'DATASET_NOT_FOUND':'DATASET_NOT_FOUND','NOT_FOUND':'DATASET_NOT_FOUND','INVALID_PARAMETER':_0x53e4e6(0x8e),'MISSING_PARAMETER':_0x53e4e6(0x75),'SQL_ERROR':_0x53e4e6(0xa7),'NETWORK_ERROR':'NETWORK_ERROR','API_ERROR':_0x53e4e6(0x8f)};return _0x54d91b[_0x1830aa]||_0x53e4e6(0x79);}function a23_0x4483(){const _0x502796=['1667988bOjfYe','PARAMETER_MISSING','3332170UaElAg','fixSteps','48HycHwt','UNKNOWN_ERROR','6eQhHFE','627111rPGPYs','example','数据集不存在:\x20','error','需要登录才能访问\x20Lovrabet\x20数据。请先使用\x20login\x20工具进行登录。','get_dataset_detail','不安全的查询','list_datasets','response','tool','306145ppzQKf','542GtJvrZ','DATASET_NOT_FOUND','code','toolParams','list_datasets({\x20pageSize:\x20999\x20})','login({\x20env:\x20\x22online\x22\x20})','检查\x20SQL\x20语法,确保关键字拼写正确、括号匹配','TABLE_NOT_FOUND','PARAMETER_INVALID','API_ERROR','type','toISOString','suggestedAction','SQL_NOT_FOUND','description','<dataset-code>','fixedSql','553803FYabHQ','message','SQL\x20不存在:\x20','使用\x20list_datasets\x20工具查看所有可用的数据集表名','526lNJhly','push','查看所有可用的\x20SQL\x20查询','SYNTAX_ERROR','登录到\x20Lovrabet\x20平台','230255aPSwDw','list_sql_queries({\x20pageSize:\x20999\x20})','location','使用\x20get_dataset_detail\x20工具查看数据集的所有字段','list_sql_queries','typeLabel','缺少必需参数:\x20','SQL_EXECUTION_FAILED','确保\x20SELECT\x20语句格式正确,如:\x20SELECT\x20id,\x20name\x20FROM\x20table\x20WHERE\x20status\x20=\x201','语法错误','AUTH_REQUIRED','字段不存在','suggestions','查看所有可用的数据集','severity','length','表不存在','status','canAutoFix'];a23_0x4483=function(){return _0x502796;};return a23_0x4483();}
|