@lovrabet/dataset-mcp-server 1.4.1-beta.0 → 1.4.1
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/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/config/api-url-resolver.js +1 -1
- package/dist/config/env.js +1 -1
- package/dist/config/lovrabet-config.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-bff-script-info.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-bff-scripts.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-or-update-bff-script.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/rate-limiter.js +1 -1
- package/dist/utils/relations.js +1 -1
- package/dist/utils/sql-meta.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/package.json +1 -1
package/dist/api/cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x735b46=a0_0x3813;(function(_0x5753ec,_0x290fca){const _0x708665=a0_0x3813,_0x11ea47=_0x5753ec();while(!![]){try{const _0x5cad62=-parseInt(_0x708665(0x153))/0x1*(parseInt(_0x708665(0x150))/0x2)+-parseInt(_0x708665(0x151))/0x3+-parseInt(_0x708665(0x15e))/0x4*(-parseInt(_0x708665(0x161))/0x5)+-parseInt(_0x708665(0x156))/0x6*(-parseInt(_0x708665(0x157))/0x7)+-parseInt(_0x708665(0x154))/0x8+parseInt(_0x708665(0x158))/0x9*(parseInt(_0x708665(0x164))/0xa)+parseInt(_0x708665(0x152))/0xb*(-parseInt(_0x708665(0x15d))/0xc);if(_0x5cad62===_0x290fca)break;else _0x11ea47['push'](_0x11ea47['shift']());}catch(_0x210ba2){_0x11ea47['push'](_0x11ea47['shift']());}}}(a0_0x8d8e,0xa03d4));export class SimpleCache{[a0_0x735b46(0x15f)]=new Map();['defaultTTL'];constructor(_0x43b5f6=0x5){const _0x15cda6=a0_0x735b46;this[_0x15cda6(0x165)]=_0x43b5f6*0x3c*0x3e8;}[a0_0x735b46(0x15b)](_0x30e7e7){const _0x568cca=a0_0x735b46,_0x5373e1=this[_0x568cca(0x15f)][_0x568cca(0x15b)](_0x30e7e7);if(!_0x5373e1)return null;const _0x38274c=Date['now'](),_0x34d0fa=_0x38274c-_0x5373e1[_0x568cca(0x160)];if(_0x34d0fa>this[_0x568cca(0x165)])return this[_0x568cca(0x15f)][_0x568cca(0x14f)](_0x30e7e7),null;const _0x5665e3=Math[_0x568cca(0x159)](_0x34d0fa/0x3e8);return _0x5373e1['data'];}['set'](_0x3a3783,_0x395f8b){const _0x3df055=a0_0x735b46;this[_0x3df055(0x15f)][_0x3df055(0x163)](_0x3a3783,{'data':_0x395f8b,'timestamp':Date[_0x3df055(0x162)]()});}[a0_0x735b46(0x15c)](_0x33fb28){const _0x3f21b1=a0_0x735b46;_0x33fb28?this['cache'][_0x3f21b1(0x14f)](_0x33fb28):this['cache']['clear']();}[a0_0x735b46(0x155)](){const _0x5af561=a0_0x735b46;return{'size':this[_0x5af561(0x15f)]['size'],'ttlMinutes':this[_0x5af561(0x165)]/0xea60,'entries':Array[_0x5af561(0x15a)](this[_0x5af561(0x15f)]['keys']())};}}function a0_0x3813(_0x30df39,_0x12dc21){_0x30df39=_0x30df39-0x14f;const _0x8d8eaf=a0_0x8d8e();let _0x381322=_0x8d8eaf[_0x30df39];return _0x381322;}function a0_0x8d8e(){const _0x26bc04=['clear','2964JdwpGa','1364RjpUZp','cache','timestamp','16935QIfodd','now','set','1350BlvCxT','defaultTTL','delete','4706YGjhCF','1395429njugIi','23441iwVylu','57FKxCNI','9947776qkhWbM','getStats','877362SCiblP','56aslBJS','46710cnvDUX','floor','from','get'];a0_0x8d8e=function(){return _0x26bc04;};return a0_0x8d8e();}export const apiCache=new SimpleCache(0x5);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a1_0x2b1c(_0x3dc167,_0x44095c){_0x3dc167=_0x3dc167-0x1a2;const _0x588f8d=a1_0x588f();let _0x2b1cb6=_0x588f8d[_0x3dc167];return _0x2b1cb6;}const a1_0x170ea4=a1_0x2b1c;function a1_0x588f(){const _0x99b707=['/api/custom/executeSql','datasetCode','getBffScriptInfo','No\x20authentication\x20cookie\x20found.\x20Please\x20login\x20first.','LOVRABET_ENV','status','er-config:','no-relations','with-relations','stringify','filter','currentPage','save-sql','application/json','datasets','Content-Type','/api/node-toolbox/bff/save','API\x20request\x20timeout\x20after\x20','/api/management/library/scripts/save','getCustomSqlList','[getDatasetDetail]\x20Failed\x20to\x20fetch\x20relations\x20for\x20','object','fromField','doVersion','postRequest','length','online','&type=ENDPOINT','Authentication\x20failed.\x20Please\x20login\x20again.','getDatasetRelations','tableData','relations','params','getUniqueDbIds','\x0aURL:\x20','set','add','request','pathname','getAllErConfigs','/smartapi/dataset/get-dataset-list','Failed\x20to\x20get\x20ER\x20config\x20for\x20dblinkId:\x20','runtimeDomain','scriptContent','message','/smartapi/custom/updateUserCustomSql','clearBffScriptCache','find','text','/smartapi/dataset/get-driven-data?','API\x20error:\x20','AbortError','321066oChHcj','toDatasetName','meta','sort','getDatasetList','appCode','sqlCode','toolboxBaseUrl','updateUserCustomSql','searchDatasets','saveCustomSqlViaToolbox','datasetName','saveBffScript','/api/management/library/scripts/list?appCode=','warn','38339wyeiWe','data','runtimeBaseUrl','POST','isArray','env','apiBaseUrl','forceRefresh','dataset-detail:','1607268XblrwS','getErConfig','_request','121fWwSCX','toDataset','Failed\x20to\x20get\x20ER\x20config\x20for\x20dbId\x20','DEFAULT_TIMEOUT','json','/api/management/script/cache/clear','toLowerCase','mcp:vibe','description','executeSql','dbId','errorMsg','apiDomain','code','joinType','1wqhjiO','956571UbqzXF','toolboxBaseUrlOverride','name','push','success','saveUserCustomSql','GET','/smartapi/custom/queryUserCustomSqlList','1081786WTPtEY','dbtableConfig','8tHPXpN','test','sqlContent','toField','includes','tableName','get','/smartapi/custom/saveUserCustomSql','12kHvTNi','495725rfxeSi','scriptType','sqlName','resolveToolboxUrl','process','from','signal','22450IceGqZ','cookie'];a1_0x588f=function(){return _0x99b707;};return a1_0x588f();}(function(_0x4672b0,_0xed27de){const _0x52e8da=a1_0x2b1c,_0x534b47=_0x4672b0();while(!![]){try{const _0x4e046a=parseInt(_0x52e8da(0x216))/0x1*(-parseInt(_0x52e8da(0x1a4))/0x2)+parseInt(_0x52e8da(0x217))/0x3+parseInt(_0x52e8da(0x204))/0x4+parseInt(_0x52e8da(0x1af))/0x5+parseInt(_0x52e8da(0x1ae))/0x6*(-parseInt(_0x52e8da(0x1fb))/0x7)+-parseInt(_0x52e8da(0x1a6))/0x8*(-parseInt(_0x52e8da(0x1ec))/0x9)+parseInt(_0x52e8da(0x1b6))/0xa*(parseInt(_0x52e8da(0x207))/0xb);if(_0x4e046a===_0xed27de)break;else _0x534b47['push'](_0x534b47['shift']());}catch(_0x497dfa){_0x534b47['push'](_0x534b47['shift']());}}}(a1_0x588f,0x50295));import{getCookie}from'../auth/cookie-manager.js';import{getEffectiveApiDomain,getEffectiveRuntimeDomain,resolveApiBaseUrl}from'../auth/constants.js';import{apiCache}from'./cache.js';export class DevApiClient{[a1_0x170ea4(0x1f1)];[a1_0x170ea4(0x200)];[a1_0x170ea4(0x1b7)];[a1_0x170ea4(0x213)];[a1_0x170ea4(0x1e2)];[a1_0x170ea4(0x218)];constructor(_0x3051cc){const _0x4c574c=a1_0x170ea4;this[_0x4c574c(0x1f1)]=_0x3051cc[_0x4c574c(0x1f1)],this[_0x4c574c(0x200)]=globalThis[_0x4c574c(0x1b3)]?.[_0x4c574c(0x200)]?.[_0x4c574c(0x1bc)]||_0x4c574c(0x1d2),this['cookie']=_0x3051cc[_0x4c574c(0x1b7)]||getCookie(),this[_0x4c574c(0x213)]=_0x3051cc[_0x4c574c(0x201)]||getEffectiveApiDomain(),this[_0x4c574c(0x1e2)]=_0x3051cc[_0x4c574c(0x1fd)]||getEffectiveRuntimeDomain(),this[_0x4c574c(0x218)]=_0x3051cc[_0x4c574c(0x1f3)];if(!this[_0x4c574c(0x1b7)])throw new Error(_0x4c574c(0x1bb));}[a1_0x170ea4(0x1b2)](_0x15e574,_0x324133){const _0x21f671=a1_0x170ea4,_0x316c07=resolveApiBaseUrl(_0x15e574),_0x45b149=this['toolboxBaseUrlOverride']&&_0x316c07===getEffectiveApiDomain()?this['toolboxBaseUrlOverride']:_0x316c07;try{const _0x4b6469=new URL(_0x45b149);if(_0x4b6469[_0x21f671(0x1de)]!=='/')return _0x45b149;}catch{}return''+_0x45b149+_0x324133;}static [a1_0x170ea4(0x20a)]=0x7530;async[a1_0x170ea4(0x206)](_0x54983a,_0x1df586={},_0x5c8c5a=DevApiClient[a1_0x170ea4(0x20a)]){const _0x3d23ca=a1_0x170ea4,{method:method=_0x3d23ca(0x1a2),body:_0x51d20e,extraHeaders:_0x33de59}=_0x1df586,_0x4cab36=new AbortController(),_0xa764cf=setTimeout(()=>_0x4cab36['abort'](),_0x5c8c5a),_0x191dde={'Cookie':this[_0x3d23ca(0x1b7)],'X-Invoke-Source':_0x3d23ca(0x20e),..._0x33de59};method===_0x3d23ca(0x1fe)&&(_0x191dde[_0x3d23ca(0x1c7)]=_0x3d23ca(0x1c5));try{const _0x219f06=await fetch(_0x54983a,{'method':method,'headers':_0x191dde,..._0x51d20e!==undefined&&{'body':JSON[_0x3d23ca(0x1c1)](_0x51d20e)},'signal':_0x4cab36[_0x3d23ca(0x1b5)]});clearTimeout(_0xa764cf);if(!_0x219f06['ok']){if(_0x219f06['status']===0x191)throw new Error(_0x3d23ca(0x1d4));let _0x5d4e91='';try{_0x5d4e91=await _0x219f06[_0x3d23ca(0x1e8)]();}catch{}throw new Error('API\x20request\x20failed:\x20HTTP\x20'+_0x219f06[_0x3d23ca(0x1bd)]+_0x3d23ca(0x1da)+_0x54983a+(_0x5d4e91?'\x0a'+_0x5d4e91:''));}const _0x382ca2=await _0x219f06[_0x3d23ca(0x20b)]();if(_0x382ca2&&typeof _0x382ca2===_0x3d23ca(0x1cd)&&_0x3d23ca(0x21b)in _0x382ca2&&!_0x382ca2[_0x3d23ca(0x21b)]){const _0x1214f1=_0x382ca2;throw new Error(_0x3d23ca(0x1ea)+(_0x1214f1[_0x3d23ca(0x1e4)]||_0x1214f1[_0x3d23ca(0x212)]||'Unknown\x20error'));}return _0x382ca2;}catch(_0x22cb02){if(_0x22cb02 instanceof Error&&_0x22cb02[_0x3d23ca(0x219)]===_0x3d23ca(0x1eb))throw new Error(_0x3d23ca(0x1c9)+_0x5c8c5a+'ms.\x20The\x20server\x20may\x20be\x20down\x20or\x20unreachable.\x0aURL:\x20'+_0x54983a);if(_0x22cb02 instanceof TypeError)throw new Error('Network\x20error:\x20Unable\x20to\x20connect\x20to\x20the\x20server.\x20Please\x20check\x20your\x20network\x20connection\x20or\x20the\x20server\x20may\x20be\x20down.\x0aURL:\x20'+_0x54983a);throw _0x22cb02;}}async[a1_0x170ea4(0x1dd)](_0x4bd668,_0x892a7a){const _0x324fc7=a1_0x170ea4;return this[_0x324fc7(0x206)](_0x4bd668,{'method':_0x324fc7(0x1a2)},_0x892a7a);}async[a1_0x170ea4(0x1d0)](_0x3444f7,_0x39d5da,_0x576e5f,_0x389fe8){const _0x5621e7=a1_0x170ea4;return this[_0x5621e7(0x206)](_0x3444f7,{'method':_0x5621e7(0x1fe),'body':_0x39d5da,'extraHeaders':_0x389fe8},_0x576e5f);}async['getDatasetList'](_0x5130e6){const _0x2f4f53=a1_0x170ea4,_0x53d3c0=_0x5130e6?.[_0x2f4f53(0x202)]||![],_0x8913d3='dataset-list:'+this[_0x2f4f53(0x1f1)]+':'+this[_0x2f4f53(0x200)];if(!_0x53d3c0){const _0x1ee50f=apiCache[_0x2f4f53(0x1ac)](_0x8913d3);if(_0x1ee50f)return _0x1ee50f;}const _0x5de378=this[_0x2f4f53(0x213)]+_0x2f4f53(0x1e0),_0x1ff20e=await this[_0x2f4f53(0x1d0)](_0x5de378,{'appCode':this['appCode']});return apiCache[_0x2f4f53(0x1db)](_0x8913d3,_0x1ff20e),_0x1ff20e;}async['getDatasetDetail'](_0x38732d,_0x401fde=![],_0x13f8a6=![]){const _0x387cf0=a1_0x170ea4,_0x1a1ace=_0x387cf0(0x203)+this['appCode']+':'+this[_0x387cf0(0x200)]+':'+_0x38732d+':'+(_0x13f8a6?_0x387cf0(0x1c0):_0x387cf0(0x1bf));if(!_0x401fde){const _0x75ea7a=apiCache[_0x387cf0(0x1ac)](_0x1a1ace);if(_0x75ea7a)return _0x75ea7a;}const _0x50b771=/^\d+$/[_0x387cf0(0x1a7)](_0x38732d),_0x398dd7=_0x50b771?'id':'code',_0x21f937=this[_0x387cf0(0x213)]+_0x387cf0(0x1e9)+_0x398dd7+'='+_0x38732d,_0x396712=await this[_0x387cf0(0x1dd)](_0x21f937);if(_0x13f8a6&&_0x396712['data']?.['modelCode']){const _0xc3c06e=_0x396712[_0x387cf0(0x1fc)][_0x387cf0(0x1cf)]==='v2',_0x345bac=Array['isArray'](_0x396712[_0x387cf0(0x1fc)][_0x387cf0(0x1d7)]);if(!_0xc3c06e||!_0x345bac)try{const _0x55dbf4=await this[_0x387cf0(0x1d5)](_0x396712[_0x387cf0(0x1fc)]['modelCode'],_0x401fde);_0x396712['data'][_0x387cf0(0x1d7)]=_0x55dbf4;}catch(_0x297c5f){process[_0x387cf0(0x200)]['NODE_ENV']!==_0x387cf0(0x1a7)&&console[_0x387cf0(0x1fa)](_0x387cf0(0x1cc)+_0x38732d+':',_0x297c5f);}}return apiCache[_0x387cf0(0x1db)](_0x1a1ace,_0x396712),_0x396712;}async[a1_0x170ea4(0x1f5)](_0x2c14bc){const _0x2b4dd2=a1_0x170ea4,_0x4d4f9f=await this[_0x2b4dd2(0x1f0)](),_0x5c0bda=Array[_0x2b4dd2(0x1ff)](_0x4d4f9f[_0x2b4dd2(0x1fc)])?_0x4d4f9f[_0x2b4dd2(0x1fc)]:_0x4d4f9f[_0x2b4dd2(0x1fc)]?.[_0x2b4dd2(0x1d6)]||[];if(!_0x4d4f9f[_0x2b4dd2(0x21b)])return{'success':!![],'data':{'tableData':[]}};const _0x52e2ec=_0x5c0bda[_0x2b4dd2(0x1c2)](_0x2dba20=>{const _0x303cf8=_0x2b4dd2,_0x24b04b=_0x2c14bc[_0x303cf8(0x20d)]();return _0x2dba20[_0x303cf8(0x219)]?.[_0x303cf8(0x20d)]()[_0x303cf8(0x1aa)](_0x24b04b)||_0x2dba20[_0x303cf8(0x214)]?.[_0x303cf8(0x20d)]()[_0x303cf8(0x1aa)](_0x24b04b)||_0x2dba20[_0x303cf8(0x1a5)]?.[_0x303cf8(0x1ab)]?.['toLowerCase']()[_0x303cf8(0x1aa)](_0x24b04b)||_0x2dba20[_0x303cf8(0x20f)]?.[_0x303cf8(0x20d)]()['includes'](_0x24b04b);});return{'success':!![],'data':{'tableData':_0x52e2ec,'paging':{'totalCount':_0x52e2ec['length'],'currentPage':0x1,'pageSize':_0x52e2ec[_0x2b4dd2(0x1d1)]}}};}async[a1_0x170ea4(0x1cb)](_0xcafd2e){const _0x4b100c=a1_0x170ea4,_0x43eafc=_0xcafd2e?.[_0x4b100c(0x1c3)]||0x1,_0x289a4d=_0xcafd2e?.['pageSize']||0x3e7,_0x53fb0a=this[_0x4b100c(0x213)]+_0x4b100c(0x1a3),_0x2d32cd={'appCode':this['appCode'],'currentPage':_0x43eafc,'pageSize':_0x289a4d,..._0xcafd2e?.['sqlCode']&&{'sqlCode':_0xcafd2e[_0x4b100c(0x1f2)]},..._0xcafd2e?.[_0x4b100c(0x1b1)]&&{'sqlName':_0xcafd2e[_0x4b100c(0x1b1)]}},_0x2fdc72=await this['postRequest'](_0x53fb0a,_0x2d32cd);return _0x2fdc72;}async[a1_0x170ea4(0x210)](_0x53001f){const _0x4360e4=a1_0x170ea4,_0x43b057=this[_0x4360e4(0x1e2)]+_0x4360e4(0x1b8),_0x3ee77c={'appCode':this[_0x4360e4(0x1f1)],'sqlCode':_0x53001f[_0x4360e4(0x1f2)],..._0x53001f[_0x4360e4(0x1d8)]&&{'params':_0x53001f[_0x4360e4(0x1d8)]}};return await this[_0x4360e4(0x1d0)](_0x43b057,_0x3ee77c);}async[a1_0x170ea4(0x21c)](_0x194258){const _0xd6ad06=a1_0x170ea4,_0x1aabfa=this['apiDomain']+_0xd6ad06(0x1ad),_0x451026={'sqlName':_0x194258[_0xd6ad06(0x1b1)],'dbId':_0x194258[_0xd6ad06(0x211)],'sqlContent':_0x194258[_0xd6ad06(0x1a8)],'appCode':this[_0xd6ad06(0x1f1)]};return await this[_0xd6ad06(0x1d0)](_0x1aabfa,_0x451026);}async[a1_0x170ea4(0x1f4)](_0x29d047){const _0x2d8847=a1_0x170ea4,_0x5e92d1=this[_0x2d8847(0x213)]+_0x2d8847(0x1e5),_0x549477={'id':_0x29d047['id'],'dbId':_0x29d047[_0x2d8847(0x211)],'sqlName':_0x29d047[_0x2d8847(0x1b1)],'appCode':this[_0x2d8847(0x1f1)],'sqlContent':_0x29d047[_0x2d8847(0x1a8)]};return await this['postRequest'](_0x5e92d1,_0x549477);}async[a1_0x170ea4(0x205)](_0x4f06b7,_0xb926c0=![]){const _0x2284ea=a1_0x170ea4,_0x3329bc=_0x2284ea(0x1be)+this[_0x2284ea(0x1f1)]+':'+this[_0x2284ea(0x200)]+':'+_0x4f06b7;if(!_0xb926c0){const _0x30c302=apiCache[_0x2284ea(0x1ac)](_0x3329bc);if(_0x30c302)return _0x30c302;}const _0x2ed618=this[_0x2284ea(0x213)]+'/smartapi/question/er-config',_0x290749=await this[_0x2284ea(0x1d0)](_0x2ed618,{'dblinkId':_0x4f06b7,'appCode':this[_0x2284ea(0x1f1)]});if(!_0x290749[_0x2284ea(0x21b)]||!_0x290749[_0x2284ea(0x1fc)])throw new Error(_0x2284ea(0x1e1)+_0x4f06b7);const _0x355a93={'meta':_0x290749[_0x2284ea(0x1fc)][_0x2284ea(0x1ee)],'datasets':_0x290749['data'][_0x2284ea(0x1c6)]};return apiCache[_0x2284ea(0x1db)](_0x3329bc,_0x355a93),_0x355a93;}async['getUniqueDbIds'](_0x4852fa=![]){const _0x4dd0c8=a1_0x170ea4,_0x46fb51=await this[_0x4dd0c8(0x1f0)]({'forceRefresh':_0x4852fa}),_0x182d3e=Array[_0x4dd0c8(0x1ff)](_0x46fb51[_0x4dd0c8(0x1fc)])?_0x46fb51[_0x4dd0c8(0x1fc)]:_0x46fb51['data']?.[_0x4dd0c8(0x1d6)]||[],_0x50e47b=new Set();for(const _0x5cd114 of _0x182d3e){_0x5cd114[_0x4dd0c8(0x1a5)]?.[_0x4dd0c8(0x211)]&&_0x50e47b[_0x4dd0c8(0x1dc)](_0x5cd114[_0x4dd0c8(0x1a5)]['dbId']);}return Array[_0x4dd0c8(0x1b4)](_0x50e47b)[_0x4dd0c8(0x1ef)]((_0x228028,_0x2399b2)=>_0x228028-_0x2399b2);}async[a1_0x170ea4(0x1df)](_0x4ce9bb=![]){const _0x115936=a1_0x170ea4,_0x51aeec='er-configs-all:'+this[_0x115936(0x1f1)]+':'+this[_0x115936(0x200)];if(!_0x4ce9bb){const _0x398c98=apiCache[_0x115936(0x1ac)](_0x51aeec);if(_0x398c98)return _0x398c98;}const _0x2e1fbe=await this[_0x115936(0x1d9)](_0x4ce9bb),_0x4951e1=new Map();for(const _0x313d11 of _0x2e1fbe){try{const _0x2705cd=await this[_0x115936(0x205)](_0x313d11,_0x4ce9bb);_0x4951e1[_0x115936(0x1db)](_0x313d11,_0x2705cd);}catch(_0x43f05a){console[_0x115936(0x1fa)](_0x115936(0x209)+_0x313d11+':',_0x43f05a);}}return apiCache[_0x115936(0x1db)](_0x51aeec,_0x4951e1),_0x4951e1;}async[a1_0x170ea4(0x1d5)](_0x2eb470,_0x19e476=![]){const _0x178502=a1_0x170ea4,_0x4c9566=await this[_0x178502(0x1df)](_0x19e476),_0xea0871=[],_0x1922b5=[];for(const [,_0xab302]of _0x4c9566){const _0x39e7cf=_0xab302[_0x178502(0x1c6)][_0x178502(0x1e7)](_0xa57d21=>_0xa57d21[_0x178502(0x1b9)]===_0x2eb470);if(_0x39e7cf)for(const _0x39b020 of _0x39e7cf[_0x178502(0x1d7)]||[]){_0xea0871[_0x178502(0x21a)]({'toDataset':_0x39b020[_0x178502(0x208)],'toDatasetName':_0x39b020[_0x178502(0x1ed)],'toField':_0x39b020[_0x178502(0x1a9)],'fromField':_0x39b020[_0x178502(0x1ce)],'joinType':_0x39b020[_0x178502(0x215)]});}for(const _0x44bb84 of _0xab302[_0x178502(0x1c6)]){if(_0x44bb84[_0x178502(0x1b9)]===_0x2eb470)continue;for(const _0x1f7688 of _0x44bb84[_0x178502(0x1d7)]||[]){_0x1f7688[_0x178502(0x208)]===_0x2eb470&&_0x1922b5[_0x178502(0x21a)]({'fromDataset':_0x44bb84[_0x178502(0x1b9)],'fromDatasetName':_0x44bb84[_0x178502(0x1f7)],'fromField':_0x1f7688[_0x178502(0x1ce)],'toField':_0x1f7688[_0x178502(0x1a9)],'joinType':_0x1f7688['joinType']});}}}return{'outgoing':_0xea0871,'incoming':_0x1922b5};}async['getBffScriptList'](){const _0x355a08=a1_0x170ea4,_0x4f0919=this[_0x355a08(0x213)]+_0x355a08(0x1f9)+encodeURIComponent(this[_0x355a08(0x1f1)])+_0x355a08(0x1d3);return await this[_0x355a08(0x1dd)](_0x4f0919);}async[a1_0x170ea4(0x1ba)](_0x3a89b9){const _0x4dc475=a1_0x170ea4,_0x398422=this[_0x4dc475(0x213)]+'/api/management/library/scripts/info?id='+_0x3a89b9;return await this[_0x4dc475(0x1dd)](_0x398422);}async[a1_0x170ea4(0x1f8)](_0x4d09ca){const _0x53e93d=a1_0x170ea4,_0x44bac3=this[_0x53e93d(0x213)]+_0x53e93d(0x1ca),_0x2048c5={'id':_0x4d09ca['id']??null,'appCode':_0x4d09ca['appCode'],'description':_0x4d09ca[_0x53e93d(0x20f)],'scriptContent':_0x4d09ca[_0x53e93d(0x1e3)],'scriptType':_0x4d09ca[_0x53e93d(0x1b0)]};return await this[_0x53e93d(0x1d0)](_0x44bac3,_0x2048c5);}async[a1_0x170ea4(0x1e6)](){const _0x2f1ef8=a1_0x170ea4,_0xbcaa31=this[_0x2f1ef8(0x1e2)]+_0x2f1ef8(0x20c);return await this[_0x2f1ef8(0x1d0)](_0xbcaa31,{});}async[a1_0x170ea4(0x1f6)](_0x53ec5a){const _0x1922ec=a1_0x170ea4,_0x18ed2e=this[_0x1922ec(0x1b2)](_0x1922ec(0x1c4),'/api/node-toolbox/sql/save'),_0x2d47bc=await this['postRequest'](_0x18ed2e,_0x53ec5a);return _0x2d47bc['data'];}async['saveBffScriptViaToolbox'](_0x286230){const _0x4c9c93=a1_0x170ea4,_0x5e80aa=this[_0x4c9c93(0x1b2)]('save-bff',_0x4c9c93(0x1c8)),_0x350012=await this[_0x4c9c93(0x1d0)](_0x5e80aa,_0x286230);return _0x350012[_0x4c9c93(0x1fc)];}}
|
|
1
|
+
const a1_0x35b167=a1_0x16cb;(function(_0xce2897,_0x40b635){const _0x5d52df=a1_0x16cb,_0xa3c2fe=_0xce2897();while(!![]){try{const _0xfb6bf8=parseInt(_0x5d52df(0x110))/0x1*(parseInt(_0x5d52df(0xc3))/0x2)+parseInt(_0x5d52df(0xd0))/0x3*(-parseInt(_0x5d52df(0xd3))/0x4)+-parseInt(_0x5d52df(0x124))/0x5*(-parseInt(_0x5d52df(0xde))/0x6)+parseInt(_0x5d52df(0x121))/0x7+parseInt(_0x5d52df(0xd2))/0x8*(-parseInt(_0x5d52df(0xf3))/0x9)+-parseInt(_0x5d52df(0x122))/0xa*(parseInt(_0x5d52df(0x11f))/0xb)+parseInt(_0x5d52df(0xe4))/0xc*(parseInt(_0x5d52df(0x129))/0xd);if(_0xfb6bf8===_0x40b635)break;else _0xa3c2fe['push'](_0xa3c2fe['shift']());}catch(_0x28f254){_0xa3c2fe['push'](_0xa3c2fe['shift']());}}}(a1_0x9e2c,0x1cdbf));import{getCookie}from'../auth/cookie-manager.js';import{getEffectiveApiDomain,getEffectiveRuntimeDomain,resolveApiBaseUrl}from'../auth/constants.js';function a1_0x16cb(_0x472f78,_0x556763){_0x472f78=_0x472f78-0xc1;const _0x9e2c90=a1_0x9e2c();let _0x16cbb9=_0x9e2c90[_0x472f78];return _0x16cbb9;}import{apiCache}from'./cache.js';export class DevApiClient{[a1_0x35b167(0x116)];[a1_0x35b167(0xe9)];['cookie'];[a1_0x35b167(0x125)];[a1_0x35b167(0x105)];[a1_0x35b167(0x12c)];constructor(_0x85c9b1){const _0x2efd0b=a1_0x35b167;this[_0x2efd0b(0x116)]=_0x85c9b1[_0x2efd0b(0x116)],this[_0x2efd0b(0xe9)]=globalThis[_0x2efd0b(0xcc)]?.[_0x2efd0b(0xe9)]?.['LOVRABET_ENV']||_0x2efd0b(0x102),this[_0x2efd0b(0x10b)]=_0x85c9b1[_0x2efd0b(0x10b)]||getCookie(),this[_0x2efd0b(0x125)]=_0x85c9b1[_0x2efd0b(0xeb)]||getEffectiveApiDomain(),this[_0x2efd0b(0x105)]=_0x85c9b1[_0x2efd0b(0x135)]||getEffectiveRuntimeDomain(),this[_0x2efd0b(0x12c)]=_0x85c9b1[_0x2efd0b(0x103)];if(!this[_0x2efd0b(0x10b)])throw new Error('No\x20authentication\x20cookie\x20found.\x20Please\x20login\x20first.');}[a1_0x35b167(0x12d)](_0x5cd58b,_0x372898){const _0x3216ad=a1_0x35b167,_0x2fbd7=resolveApiBaseUrl(_0x5cd58b),_0x5ab9a1=this['toolboxBaseUrlOverride']&&_0x2fbd7===getEffectiveApiDomain()?this[_0x3216ad(0x12c)]:_0x2fbd7;try{const _0x447bad=new URL(_0x5ab9a1);if(_0x447bad['pathname']!=='/')return _0x5ab9a1;}catch{}return''+_0x5ab9a1+_0x372898;}static ['DEFAULT_TIMEOUT']=0x7530;async[a1_0x35b167(0x11a)](_0x20f7e6,_0x20a644={},_0x2c9a9f=DevApiClient[a1_0x35b167(0xe6)]){const _0x230625=a1_0x35b167,{method:method=_0x230625(0xdf),body:_0x12ff7b,extraHeaders:_0x392f91}=_0x20a644,_0x4e210c=new AbortController(),_0x12ccd0=setTimeout(()=>_0x4e210c['abort'](),_0x2c9a9f),_0x5e51c1={'Cookie':this[_0x230625(0x10b)],'X-Invoke-Source':_0x230625(0x131),..._0x392f91};method===_0x230625(0xe8)&&(_0x5e51c1['Content-Type']='application/json');try{const _0x203a11=await fetch(_0x20f7e6,{'method':method,'headers':_0x5e51c1,..._0x12ff7b!==undefined&&{'body':JSON['stringify'](_0x12ff7b)},'signal':_0x4e210c['signal']});clearTimeout(_0x12ccd0);if(!_0x203a11['ok']){if(_0x203a11[_0x230625(0xe3)]===0x191)throw new Error(_0x230625(0x120));let _0x22a9f6='';try{_0x22a9f6=await _0x203a11[_0x230625(0xf7)]();}catch{}throw new Error(_0x230625(0x119)+_0x203a11[_0x230625(0xe3)]+_0x230625(0xc4)+_0x20f7e6+(_0x22a9f6?'\x0a'+_0x22a9f6:''));}const _0x4f672f=await _0x203a11['json']();if(_0x4f672f&&typeof _0x4f672f===_0x230625(0x132)&&_0x230625(0x12e)in _0x4f672f&&!_0x4f672f[_0x230625(0x12e)]){const _0x38b91a=_0x4f672f;throw new Error(_0x230625(0x100)+(_0x38b91a[_0x230625(0x133)]||_0x38b91a[_0x230625(0x107)]||'Unknown\x20error'));}return _0x4f672f;}catch(_0x560c83){if(_0x560c83 instanceof Error&&_0x560c83['name']===_0x230625(0xd7))throw new Error(_0x230625(0xec)+_0x2c9a9f+_0x230625(0x104)+_0x20f7e6);if(_0x560c83 instanceof TypeError)throw new Error(_0x230625(0xc8)+_0x20f7e6);throw _0x560c83;}}async[a1_0x35b167(0x118)](_0x2ee8de,_0x180ee7){return this['_request'](_0x2ee8de,{'method':'GET'},_0x180ee7);}async[a1_0x35b167(0xc7)](_0x1a7481,_0x6ce5a0,_0x4630d1,_0x337d7){const _0x3a6ad1=a1_0x35b167;return this[_0x3a6ad1(0x11a)](_0x1a7481,{'method':_0x3a6ad1(0xe8),'body':_0x6ce5a0,'extraHeaders':_0x337d7},_0x4630d1);}async['getDatasetList'](_0x49197b){const _0x54e169=a1_0x35b167,_0xe0cbe6=_0x49197b?.[_0x54e169(0xfc)]||![],_0x866667=_0x54e169(0x10e)+this['appCode']+':'+this[_0x54e169(0xe9)];if(!_0xe0cbe6){const _0x9cccfb=apiCache[_0x54e169(0xd6)](_0x866667);if(_0x9cccfb)return _0x9cccfb;}const _0x376bb1=this['apiDomain']+_0x54e169(0xca),_0x3b67f4=await this['postRequest'](_0x376bb1,{'appCode':this['appCode']});return apiCache['set'](_0x866667,_0x3b67f4),_0x3b67f4;}async[a1_0x35b167(0x111)](_0x107df1,_0x298482=![],_0xec4d=![]){const _0x260deb=a1_0x35b167,_0x48ef5b=_0x260deb(0x109)+this['appCode']+':'+this[_0x260deb(0xe9)]+':'+_0x107df1+':'+(_0xec4d?_0x260deb(0x10f):_0x260deb(0x108));if(!_0x298482){const _0x3c7157=apiCache[_0x260deb(0xd6)](_0x48ef5b);if(_0x3c7157)return _0x3c7157;}const _0x50e8dc=/^\d+$/[_0x260deb(0xd9)](_0x107df1),_0x1c6050=_0x50e8dc?'id':_0x260deb(0x117),_0xc65bac=this[_0x260deb(0x125)]+_0x260deb(0x106)+_0x1c6050+'='+_0x107df1,_0x48ff28=await this[_0x260deb(0x118)](_0xc65bac);if(_0xec4d&&_0x48ff28[_0x260deb(0xc9)]?.[_0x260deb(0xfd)]){const _0x25c6e7=_0x48ff28[_0x260deb(0xc9)][_0x260deb(0x11b)]==='v2',_0x4c7715=Array[_0x260deb(0xc1)](_0x48ff28[_0x260deb(0xc9)][_0x260deb(0xf9)]);if(!_0x25c6e7||!_0x4c7715)try{const _0x256a43=await this['getDatasetRelations'](_0x48ff28['data']['modelCode'],_0x298482);_0x48ff28[_0x260deb(0xc9)][_0x260deb(0xf9)]=_0x256a43;}catch(_0x2a86b1){process['env']['NODE_ENV']!==_0x260deb(0xd9)&&console[_0x260deb(0x126)](_0x260deb(0x12f)+_0x107df1+':',_0x2a86b1);}}return apiCache['set'](_0x48ef5b,_0x48ff28),_0x48ff28;}async[a1_0x35b167(0xc6)](_0x4ebace){const _0x157d36=a1_0x35b167,_0x466a40=await this['getDatasetList'](),_0x360dda=Array['isArray'](_0x466a40[_0x157d36(0xc9)])?_0x466a40[_0x157d36(0xc9)]:_0x466a40['data']?.['tableData']||[];if(!_0x466a40['success'])return{'success':!![],'data':{'tableData':[]}};const _0x349819=_0x360dda['filter'](_0x4915cf=>{const _0x3d764d=_0x157d36,_0x5be8cd=_0x4ebace[_0x3d764d(0xe5)]();return _0x4915cf[_0x3d764d(0xdc)]?.['toLowerCase']()['includes'](_0x5be8cd)||_0x4915cf[_0x3d764d(0x117)]?.[_0x3d764d(0xe5)]()[_0x3d764d(0x130)](_0x5be8cd)||_0x4915cf[_0x3d764d(0xea)]?.[_0x3d764d(0xf5)]?.[_0x3d764d(0xe5)]()['includes'](_0x5be8cd)||_0x4915cf[_0x3d764d(0x101)]?.['toLowerCase']()['includes'](_0x5be8cd);});return{'success':!![],'data':{'tableData':_0x349819,'paging':{'totalCount':_0x349819[_0x157d36(0xce)],'currentPage':0x1,'pageSize':_0x349819[_0x157d36(0xce)]}}};}async[a1_0x35b167(0x10d)](_0x183f6b){const _0x4c76c4=a1_0x35b167,_0x3174af=_0x183f6b?.[_0x4c76c4(0xf8)]||0x1,_0x174abd=_0x183f6b?.[_0x4c76c4(0xcb)]||0x3e7,_0x3066a=this['apiDomain']+'/smartapi/custom/queryUserCustomSqlList',_0x5ea574={'appCode':this[_0x4c76c4(0x116)],'currentPage':_0x3174af,'pageSize':_0x174abd,..._0x183f6b?.[_0x4c76c4(0x11e)]&&{'sqlCode':_0x183f6b[_0x4c76c4(0x11e)]},..._0x183f6b?.[_0x4c76c4(0xf1)]&&{'sqlName':_0x183f6b[_0x4c76c4(0xf1)]}},_0x553d9a=await this[_0x4c76c4(0xc7)](_0x3066a,_0x5ea574);return _0x553d9a;}async['executeSql'](_0x128590){const _0x2988e7=a1_0x35b167,_0xe8af02=this[_0x2988e7(0x105)]+_0x2988e7(0xe0),_0x4685ed={'appCode':this[_0x2988e7(0x116)],'sqlCode':_0x128590['sqlCode'],..._0x128590['params']&&{'params':_0x128590[_0x2988e7(0xcf)]}};return await this['postRequest'](_0xe8af02,_0x4685ed);}async[a1_0x35b167(0xc2)](_0x4bc959){const _0x582e30=a1_0x35b167,_0x2cf909=this['apiDomain']+_0x582e30(0xef),_0x4ab686={'sqlName':_0x4bc959[_0x582e30(0xf1)],'dbId':_0x4bc959[_0x582e30(0xda)],'sqlContent':_0x4bc959[_0x582e30(0xff)],'appCode':this[_0x582e30(0x116)]};return await this['postRequest'](_0x2cf909,_0x4ab686);}async[a1_0x35b167(0xf0)](_0x291670){const _0x4fb88a=a1_0x35b167,_0xa6114f=this[_0x4fb88a(0x125)]+_0x4fb88a(0xed),_0x1314b6={'id':_0x291670['id'],'dbId':_0x291670[_0x4fb88a(0xda)],'sqlName':_0x291670[_0x4fb88a(0xf1)],'appCode':this['appCode'],'sqlContent':_0x291670['sqlContent']};return await this[_0x4fb88a(0xc7)](_0xa6114f,_0x1314b6);}async[a1_0x35b167(0xfb)](_0x371e08,_0x3b57b5=![]){const _0xf42d23=a1_0x35b167,_0x4f4eab='er-config:'+this[_0xf42d23(0x116)]+':'+this[_0xf42d23(0xe9)]+':'+_0x371e08;if(!_0x3b57b5){const _0x11eebf=apiCache['get'](_0x4f4eab);if(_0x11eebf)return _0x11eebf;}const _0x3d03d4=this[_0xf42d23(0x125)]+_0xf42d23(0xf2),_0xa79b2e=await this[_0xf42d23(0xc7)](_0x3d03d4,{'dblinkId':_0x371e08,'appCode':this[_0xf42d23(0x116)]});if(!_0xa79b2e[_0xf42d23(0x12e)]||!_0xa79b2e[_0xf42d23(0xc9)])throw new Error('Failed\x20to\x20get\x20ER\x20config\x20for\x20dblinkId:\x20'+_0x371e08);const _0xf9a7e9={'meta':_0xa79b2e['data']['meta'],'datasets':_0xa79b2e[_0xf42d23(0xc9)]['datasets']};return apiCache[_0xf42d23(0x10c)](_0x4f4eab,_0xf9a7e9),_0xf9a7e9;}async[a1_0x35b167(0x11d)](_0x466ba4=![]){const _0x59f19d=a1_0x35b167,_0x3f962d=await this['getDatasetList']({'forceRefresh':_0x466ba4}),_0x29b7fa=Array['isArray'](_0x3f962d[_0x59f19d(0xc9)])?_0x3f962d[_0x59f19d(0xc9)]:_0x3f962d[_0x59f19d(0xc9)]?.[_0x59f19d(0x12b)]||[],_0x8a9f07=new Set();for(const _0x3e523b of _0x29b7fa){_0x3e523b['dbtableConfig']?.[_0x59f19d(0xda)]&&_0x8a9f07[_0x59f19d(0xe7)](_0x3e523b['dbtableConfig'][_0x59f19d(0xda)]);}return Array[_0x59f19d(0xd4)](_0x8a9f07)['sort']((_0x542406,_0x34f6f6)=>_0x542406-_0x34f6f6);}async[a1_0x35b167(0xdd)](_0x3ddec6=![]){const _0x55957d=a1_0x35b167,_0x484451=_0x55957d(0x115)+this['appCode']+':'+this[_0x55957d(0xe9)];if(!_0x3ddec6){const _0x336191=apiCache[_0x55957d(0xd6)](_0x484451);if(_0x336191)return _0x336191;}const _0x277474=await this[_0x55957d(0x11d)](_0x3ddec6),_0x356147=new Map();for(const _0x2238b6 of _0x277474){try{const _0x415fb9=await this[_0x55957d(0xfb)](_0x2238b6,_0x3ddec6);_0x356147[_0x55957d(0x10c)](_0x2238b6,_0x415fb9);}catch(_0x230296){console['warn'](_0x55957d(0x134)+_0x2238b6+':',_0x230296);}}return apiCache['set'](_0x484451,_0x356147),_0x356147;}async[a1_0x35b167(0x114)](_0x520fa7,_0x120add=![]){const _0x36546f=a1_0x35b167,_0x307003=await this[_0x36546f(0xdd)](_0x120add),_0x441078=[],_0x3add57=[];for(const [,_0x57b3ad]of _0x307003){const _0x30755b=_0x57b3ad[_0x36546f(0x112)][_0x36546f(0x10a)](_0x86acb4=>_0x86acb4['datasetCode']===_0x520fa7);if(_0x30755b)for(const _0x3551ba of _0x30755b['relations']||[]){_0x441078['push']({'toDataset':_0x3551ba[_0x36546f(0xe2)],'toDatasetName':_0x3551ba[_0x36546f(0x136)],'toField':_0x3551ba[_0x36546f(0x113)],'fromField':_0x3551ba['fromField'],'joinType':_0x3551ba[_0x36546f(0xdb)]});}for(const _0x167167 of _0x57b3ad['datasets']){if(_0x167167[_0x36546f(0xd1)]===_0x520fa7)continue;for(const _0x1abcc0 of _0x167167['relations']||[]){_0x1abcc0[_0x36546f(0xe2)]===_0x520fa7&&_0x3add57[_0x36546f(0x12a)]({'fromDataset':_0x167167[_0x36546f(0xd1)],'fromDatasetName':_0x167167[_0x36546f(0xe1)],'fromField':_0x1abcc0[_0x36546f(0x11c)],'toField':_0x1abcc0['toField'],'joinType':_0x1abcc0[_0x36546f(0xdb)]});}}}return{'outgoing':_0x441078,'incoming':_0x3add57};}async[a1_0x35b167(0xc5)](){const _0xfd188b=a1_0x35b167,_0x1b613c=this[_0xfd188b(0x125)]+'/api/management/library/scripts/list?appCode='+encodeURIComponent(this[_0xfd188b(0x116)])+_0xfd188b(0xf4);return await this['request'](_0x1b613c);}async[a1_0x35b167(0xf6)](_0x31c722){const _0x51121d=a1_0x35b167,_0x28f375=this[_0x51121d(0x125)]+_0x51121d(0xd8)+_0x31c722;return await this[_0x51121d(0x118)](_0x28f375);}async[a1_0x35b167(0xfa)](_0x4b5bad){const _0x3f7d73=a1_0x35b167,_0x478c78=this[_0x3f7d73(0x125)]+_0x3f7d73(0xd5),_0x5f22d9={'id':_0x4b5bad['id']??null,'appCode':_0x4b5bad[_0x3f7d73(0x116)],'description':_0x4b5bad[_0x3f7d73(0x101)],'scriptContent':_0x4b5bad[_0x3f7d73(0x128)],'scriptType':_0x4b5bad[_0x3f7d73(0xfe)]};return await this[_0x3f7d73(0xc7)](_0x478c78,_0x5f22d9);}async[a1_0x35b167(0xcd)](){const _0x299dac=a1_0x35b167,_0x1f03cd=this[_0x299dac(0x105)]+_0x299dac(0x123);return await this[_0x299dac(0xc7)](_0x1f03cd,{});}async['saveCustomSqlViaToolbox'](_0x32b9c8){const _0x8de18f=a1_0x35b167,_0x12a2e2=this['resolveToolboxUrl'](_0x8de18f(0xee),_0x8de18f(0x127)),_0x1f4ae7=await this[_0x8de18f(0xc7)](_0x12a2e2,_0x32b9c8);return _0x1f4ae7[_0x8de18f(0xc9)];}async['saveBffScriptViaToolbox'](_0x23ab6c){const _0x44fb0d=a1_0x35b167,_0x5367b5=this[_0x44fb0d(0x12d)]('save-bff','/api/node-toolbox/bff/save'),_0x2e92ce=await this['postRequest'](_0x5367b5,_0x23ab6c);return _0x2e92ce['data'];}}function a1_0x9e2c(){const _0x277a5e=['saveBffScript','getErConfig','forceRefresh','modelCode','scriptType','sqlContent','API\x20error:\x20','description','online','toolboxBaseUrl','ms.\x20The\x20server\x20may\x20be\x20down\x20or\x20unreachable.\x0aURL:\x20','runtimeDomain','/smartapi/dataset/get-driven-data?','errorMsg','no-relations','dataset-detail:','find','cookie','set','getCustomSqlList','dataset-list:','with-relations','2966Srzlnx','getDatasetDetail','datasets','toField','getDatasetRelations','er-configs-all:','appCode','code','request','API\x20request\x20failed:\x20HTTP\x20','_request','doVersion','fromField','getUniqueDbIds','sqlCode','24849qfFXvl','Authentication\x20failed.\x20Please\x20login\x20again.','930391jpbPLH','850GmaRfk','/api/management/script/cache/clear','1019680FgkInS','apiDomain','warn','/api/node-toolbox/sql/save','scriptContent','2558348unpXZe','push','tableData','toolboxBaseUrlOverride','resolveToolboxUrl','success','[getDatasetDetail]\x20Failed\x20to\x20fetch\x20relations\x20for\x20','includes','mcp:vibe','object','message','Failed\x20to\x20get\x20ER\x20config\x20for\x20dbId\x20','runtimeBaseUrl','toDatasetName','isArray','saveUserCustomSql','50IaQkUO','\x0aURL:\x20','getBffScriptList','searchDatasets','postRequest','Network\x20error:\x20Unable\x20to\x20connect\x20to\x20the\x20server.\x20Please\x20check\x20your\x20network\x20connection\x20or\x20the\x20server\x20may\x20be\x20down.\x0aURL:\x20','data','/smartapi/dataset/get-dataset-list','pageSize','process','clearBffScriptCache','length','params','87705ednSPh','datasetCode','839472fgugLi','12ZlElRS','from','/api/management/library/scripts/save','get','AbortError','/api/management/library/scripts/info?id=','test','dbId','joinType','name','getAllErConfigs','6eaiYAJ','GET','/api/custom/executeSql','datasetName','toDataset','status','12TKdbPZ','toLowerCase','DEFAULT_TIMEOUT','add','POST','env','dbtableConfig','apiBaseUrl','API\x20request\x20timeout\x20after\x20','/smartapi/custom/updateUserCustomSql','save-sql','/smartapi/custom/saveUserCustomSql','updateUserCustomSql','sqlName','/smartapi/question/er-config','18UNpdKA','&type=ENDPOINT','tableName','getBffScriptInfo','text','currentPage','relations'];a1_0x9e2c=function(){return _0x277a5e;};return a1_0x9e2c();}
|
package/dist/auth/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1258b0,_0x43c246){var _0xb03c1a=a2_0x2548,_0x13018f=_0x1258b0();while(!![]){try{var _0x213129=-parseInt(_0xb03c1a(0x1b6))/0x1+-parseInt(_0xb03c1a(0x1b8))/0x2*(-parseInt(_0xb03c1a(0x1b5))/0x3)+parseInt(_0xb03c1a(0x1b9))/0x4*(parseInt(_0xb03c1a(0x1b4))/0x5)+-parseInt(_0xb03c1a(0x1ba))/0x6*(-parseInt(_0xb03c1a(0x1b7))/0x7)+-parseInt(_0xb03c1a(0x1b1))/0x8+-parseInt(_0xb03c1a(0x1b3))/0x9+-parseInt(_0xb03c1a(0x1b2))/0xa;if(_0x213129===_0x43c246)break;else _0x13018f['push'](_0x13018f['shift']());}catch(_0x407aab){_0x13018f['push'](_0x13018f['shift']());}}}(a2_0x4371,0xda8f7));function a2_0x2548(_0x4a55ba,_0x3f7839){_0x4a55ba=_0x4a55ba-0x1b1;var _0x4371ad=a2_0x4371();var _0x2548bc=_0x4371ad[_0x4a55ba];return _0x2548bc;}export{getEnvAppCode,getEnvironment,getEnvApiBaseUrl,getEnvRuntimeBaseUrl,getEnvUserBaseUrl,getEnvAuthCookie,configDir,cookieFile,defaultConfig,getEnvAppCodeWithFallback,getApiDomain,getUserDomain,getRuntimeDomain,getEffectiveApiDomain,getEffectiveRuntimeDomain,getEffectiveUserDomain,getEnvToolboxBaseUrl,getEffectiveToolboxDomain}from'../config/env.js';function a2_0x4371(){var _0x59d7c0=['1266645jwLMIW','4762302YQBGyd','214343wMSsLX','7YGPRQG','2ERnfyb','8FUDfwc','6645624CysdgC','979304EWFuqF','13905880NrYehn','5212161PcymbW'];a2_0x4371=function(){return _0x59d7c0;};return a2_0x4371();}export{resolveApiBaseUrl}from'../config/api-url-resolver.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a3_0x39f6(_0x16adf8,_0x10c707){_0x16adf8=_0x16adf8-0x9a;const _0x3f575b=a3_0x3f57();let _0x39f623=_0x3f575b[_0x16adf8];return _0x39f623;}(function(_0x1bf88e,_0x5c9fb6){const _0x398fad=a3_0x39f6,_0x48117c=_0x1bf88e();while(!![]){try{const _0x24f7cd=-parseInt(_0x398fad(0xa2))/0x1+-parseInt(_0x398fad(0xa0))/0x2*(parseInt(_0x398fad(0xa5))/0x3)+-parseInt(_0x398fad(0x9f))/0x4*(parseInt(_0x398fad(0x9d))/0x5)+parseInt(_0x398fad(0x9a))/0x6+parseInt(_0x398fad(0xa1))/0x7*(parseInt(_0x398fad(0xa4))/0x8)+-parseInt(_0x398fad(0x9e))/0x9+parseInt(_0x398fad(0xa3))/0xa*(parseInt(_0x398fad(0xa6))/0xb);if(_0x24f7cd===_0x5c9fb6)break;else _0x48117c['push'](_0x48117c['shift']());}catch(_0x4ed639){_0x48117c['push'](_0x48117c['shift']());}}}(a3_0x3f57,0x26912));function a3_0x3f57(){const _0x25df24=['136pLKUPm','644709TvJFrE','7666879zpRVmJ','739422OXCCnq','length','utf-8','225580Laqydf','1909377tlrqcc','4hQMqin','2yrQDwN','21497vajUXH','242291FDoSuh','10ykXdHP'];a3_0x3f57=function(){return _0x25df24;};return a3_0x3f57();}import{readFileSync,writeFileSync}from'node:fs';import{getEnvAuthCookie,cookieFile}from'../config/env.js';export function getCookie(){const _0x551b70=a3_0x39f6,_0x3ce611=getEnvAuthCookie();if(_0x3ce611)return _0x3ce611;try{return readFileSync(cookieFile,_0x551b70(0x9c))['trim']();}catch{return'';}}export function saveCookie(_0x53d1ff){const _0x3ccf1f=a3_0x39f6;try{writeFileSync(cookieFile,_0x53d1ff,_0x3ccf1f(0x9c));}catch(_0xa546e7){throw new Error('Failed\x20to\x20save\x20cookie\x20to\x20'+cookieFile+':\x20'+_0xa546e7['message']);}}export function hasCookie(){const _0xa6d552=a3_0x39f6,_0x2fe0d9=getCookie();return _0x2fe0d9[_0xa6d552(0x9b)]>0x0;}export function clearCookie(){const _0x2f111b=a3_0x39f6;try{writeFileSync(cookieFile,'',_0x2f111b(0x9c));}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x46f393,_0x10c1b5){const _0x4be0d8=a4_0x5e16,_0x286960=_0x46f393();while(!![]){try{const _0x44d43f=parseInt(_0x4be0d8(0xbf))/0x1*(parseInt(_0x4be0d8(0xc3))/0x2)+parseInt(_0x4be0d8(0xc1))/0x3+-parseInt(_0x4be0d8(0xc7))/0x4+parseInt(_0x4be0d8(0xc6))/0x5*(-parseInt(_0x4be0d8(0xc5))/0x6)+-parseInt(_0x4be0d8(0xc8))/0x7*(parseInt(_0x4be0d8(0xbc))/0x8)+parseInt(_0x4be0d8(0xbd))/0x9+parseInt(_0x4be0d8(0xc4))/0xa;if(_0x44d43f===_0x10c1b5)break;else _0x286960['push'](_0x286960['shift']());}catch(_0x52b328){_0x286960['push'](_0x286960['shift']());}}}(a4_0x2321,0xa68f5));import{getCookie}from'./cookie-manager.js';function a4_0x5e16(_0x280974,_0x5a29b2){_0x280974=_0x280974-0xbc;const _0x232101=a4_0x2321();let _0x5e16e7=_0x232101[_0x280974];return _0x5e16e7;}import{getUserDomain}from'../config/env.js';function a4_0x2321(){const _0x5ebca1=['217846ULtkfu','25015810aqWEWR','78IYQqDt','500730WpPDUK','3043476IchcCm','7EJBmqA','5927176gNHhhL','5494473wfSpWp','json','1cHeDYX','/api/auth/get-session','794676jeiEPD','user'];a4_0x2321=function(){return _0x5ebca1;};return a4_0x2321();}export async function isSessionValid(){const _0x4638e4=a4_0x5e16,_0x137c11=getCookie();if(!_0x137c11)return![];try{const _0x23a480=await fetch(getUserDomain()+_0x4638e4(0xc0),{'headers':{'cookie':_0x137c11}});if(!_0x23a480['ok'])return![];const _0x3d4245=await _0x23a480[_0x4638e4(0xbe)]();return!!(_0x3d4245?.['session']&&_0x3d4245?.[_0x4638e4(0xc2)]);}catch{return![];}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x28a440,_0x9e1fa2){const _0x5c7ef9=a5_0x2794,_0x3e8810=_0x28a440();while(!![]){try{const _0x8983cc=parseInt(_0x5c7ef9(0x98))/0x1+parseInt(_0x5c7ef9(0x93))/0x2+parseInt(_0x5c7ef9(0x94))/0x3*(-parseInt(_0x5c7ef9(0x91))/0x4)+parseInt(_0x5c7ef9(0x97))/0x5+parseInt(_0x5c7ef9(0x95))/0x6*(-parseInt(_0x5c7ef9(0x8e))/0x7)+-parseInt(_0x5c7ef9(0x8f))/0x8+parseInt(_0x5c7ef9(0x96))/0x9;if(_0x8983cc===_0x9e1fa2)break;else _0x3e8810['push'](_0x3e8810['shift']());}catch(_0x5e2817){_0x3e8810['push'](_0x3e8810['shift']());}}}(a5_0x3076,0xcb445));import{getEnvToolboxBaseUrl,getEffectiveApiDomain}from'./env.js';function a5_0x3076(){const _0x1a0640=['env','1128GQKQRC','LOVRABET_API_URL_OVERRIDES','2121064egVTwJ','6753XOvaBs','3146790ufLmFz','5667480ZjPcYV','5913120KxOfPd','299319AcWEEi','[MCP]\x20LOVRABET_API_URL_OVERRIDES\x20is\x20not\x20valid\x20JSON,\x20ignoring','21AfMuru','1051496VtxlYO'];a5_0x3076=function(){return _0x1a0640;};return a5_0x3076();}import{getConfigApiUrlOverrides}from'./lovrabet-config.js';function a5_0x2794(_0x48658c,_0x5260d0){_0x48658c=_0x48658c-0x8d;const _0x3076e4=a5_0x3076();let _0x27949b=_0x3076e4[_0x48658c];return _0x27949b;}let _envOverridesCache=null;function getEnvApiUrlOverrides(){const _0x22d848=a5_0x2794;if(_envOverridesCache!==null)return _envOverridesCache;const _0x106028=process[_0x22d848(0x90)][_0x22d848(0x92)];if(!_0x106028)return _envOverridesCache={},_envOverridesCache;try{_envOverridesCache=JSON['parse'](_0x106028);}catch{process[_0x22d848(0x90)]['MCP_DEBUG']&&console['warn'](_0x22d848(0x8d)),_envOverridesCache={};}return _envOverridesCache;}export function resolveApiBaseUrl(_0x4bff6e){const _0x2c42bd=getEnvApiUrlOverrides();if(_0x2c42bd[_0x4bff6e])return _0x2c42bd[_0x4bff6e];const _0x2eb5de=getConfigApiUrlOverrides();if(_0x2eb5de[_0x4bff6e])return _0x2eb5de[_0x4bff6e];return getEnvToolboxBaseUrl()??getEffectiveApiDomain();}export function clearApiUrlOverridesCache(){_envOverridesCache=null;}
|
package/dist/config/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x58f277=a6_0x2915;(function(_0xaaf08,_0x3f1729){const _0x51fa1d=a6_0x2915,_0x5abfce=_0xaaf08();while(!![]){try{const _0xcce8e6=parseInt(_0x51fa1d(0x150))/0x1*(parseInt(_0x51fa1d(0x142))/0x2)+parseInt(_0x51fa1d(0x138))/0x3+parseInt(_0x51fa1d(0x14d))/0x4*(parseInt(_0x51fa1d(0x13e))/0x5)+parseInt(_0x51fa1d(0x13b))/0x6+-parseInt(_0x51fa1d(0x145))/0x7*(parseInt(_0x51fa1d(0x143))/0x8)+parseInt(_0x51fa1d(0x13a))/0x9+-parseInt(_0x51fa1d(0x139))/0xa;if(_0xcce8e6===_0x3f1729)break;else _0x5abfce['push'](_0x5abfce['shift']());}catch(_0x198adf){_0x5abfce['push'](_0x5abfce['shift']());}}}(a6_0x2198,0x1babb));import{mkdirSync}from'node:fs';import{homedir}from'node:os';const ENVIRONMENT_MAPPING={'online':'production','production':a6_0x58f277(0x14e),'daily':a6_0x58f277(0x131),'dev':a6_0x58f277(0x13d),'development':a6_0x58f277(0x13d)};function normalizeEnvironment(_0x22b937){const _0x3f26fa=a6_0x58f277;if(!_0x22b937)return'production';const _0x14da20=_0x22b937[_0x3f26fa(0x151)](),_0x5827c6=ENVIRONMENT_MAPPING[_0x14da20];if(!_0x5827c6)return console[_0x3f26fa(0x136)](_0x3f26fa(0x13f)+_0x22b937+_0x3f26fa(0x149)),_0x3f26fa(0x14e);return _0x5827c6!==_0x14da20&&_0x5827c6!==_0x22b937&&console[_0x3f26fa(0x148)](_0x3f26fa(0x134)+_0x22b937+_0x3f26fa(0x14f)+_0x5827c6),_0x5827c6;}export function getEnvAppCode(){const _0x22e28f=a6_0x58f277;return process[_0x22e28f(0x13c)]['LOVRABET_APP_CODE'];}export function getEnvironment(){const _0x57ccef=a6_0x58f277,_0x8fde2d=process[_0x57ccef(0x13c)]['LOVRABET_ENV'];return normalizeEnvironment(_0x8fde2d);}export function getEnvApiBaseUrl(){const _0x51a9bf=a6_0x58f277;return process[_0x51a9bf(0x13c)]['LOVRABET_API_BASEURL'];}export function getEnvRuntimeBaseUrl(){const _0x31c4ba=a6_0x58f277;return process['env'][_0x31c4ba(0x140)];}export function getEnvUserBaseUrl(){const _0x427778=a6_0x58f277;return process[_0x427778(0x13c)]['LOVRABET_USER_BASEURL'];}export function getEnvAuthCookie(){const _0x143717=a6_0x58f277;return process['env'][_0x143717(0x14a)]?.['trim']();}export function isTestEnv(){const _0x14abab=a6_0x58f277;return process[_0x14abab(0x13c)][_0x14abab(0x141)]===_0x14abab(0x133);}export function isProductionEnv(){const _0x1e7e58=a6_0x58f277;return process[_0x1e7e58(0x13c)]['NODE_ENV']===_0x1e7e58(0x14e);}export function isDevelopmentEnv(){const _0x69cccf=a6_0x58f277;return process[_0x69cccf(0x13c)][_0x69cccf(0x141)]===_0x69cccf(0x13d);}export function shouldLog(){const _0x43b5a9=a6_0x58f277,_0x1cc324=process[_0x43b5a9(0x13c)]['NODE_ENV'];return _0x1cc324===_0x43b5a9(0x13d)||_0x1cc324===_0x43b5a9(0x131);}export const configDir=homedir()+a6_0x58f277(0x137);function a6_0x2198(){const _0x482d39=['test','[ENV]\x20Environment\x20mapping:\x20','LOVRABET_TOOLBOX_BASEURL','warn','/.lovrabet','347760SoyEci','4296820meVVrT','538254VYJwdg','1201986mIwxiI','env','development','49345gaDUcK','[ENV]\x20Unknown\x20environment:\x20','LOVRABET_RUNTIME_BASEURL','NODE_ENV','35124ZwKTDr','1270936WVVUUU','https://daily-api.lovrabet.com','7RRKXaY','https://api.lovrabet.com','https://user-daily.lovrabet.com','log',',\x20using\x20default\x20production','LOVRABET_AUTH_COOKIE','/cookie','https://runtime.lovrabet.com','68IZwWqp','production','\x20→\x20','9iTNsQS','toLowerCase','https://dev.lovrabet.com','daily','https://user.lovrabet.com'];a6_0x2198=function(){return _0x482d39;};return a6_0x2198();}export const cookieFile=configDir+a6_0x58f277(0x14b);mkdirSync(configDir,{'recursive':!![]});export const defaultConfig={'appCode':getEnvAppCode(),'env':getEnvironment()};export function getEnvAppCodeWithFallback(_0x38748b){return getEnvAppCode()||_0x38748b;}export function getApiDomain(){const _0x1e84ee=a6_0x58f277,_0x24f97a=getEnvironment(),_0xbed4b9={'production':_0x1e84ee(0x146),'online':_0x1e84ee(0x146),'daily':_0x1e84ee(0x144),'development':_0x1e84ee(0x152)};return _0xbed4b9[_0x24f97a];}function a6_0x2915(_0x38b313,_0x1d3edb){_0x38b313=_0x38b313-0x131;const _0x2198e8=a6_0x2198();let _0x2915c7=_0x2198e8[_0x38b313];return _0x2915c7;}export function getUserDomain(){const _0x2b96a3=a6_0x58f277,_0x4d0b19=getEnvironment(),_0x297f43={'production':_0x2b96a3(0x132),'online':_0x2b96a3(0x132),'daily':_0x2b96a3(0x147),'development':_0x2b96a3(0x152)};return _0x297f43[_0x4d0b19];}export function getRuntimeDomain(){const _0x3bdc2f=a6_0x58f277,_0x3c2dba=getEnvironment(),_0x4127dd={'production':_0x3bdc2f(0x14c),'online':_0x3bdc2f(0x14c),'daily':'https://daily-runtime.lovrabet.com','development':'https://dev.lovrabet.com'};return _0x4127dd[_0x3c2dba];}export function getEffectiveApiDomain(){return getEnvApiBaseUrl()||getApiDomain();}export function getEffectiveRuntimeDomain(){return getEnvRuntimeBaseUrl()||getRuntimeDomain();}export function getEffectiveUserDomain(){return getEnvUserBaseUrl()||getUserDomain();}export function getEnvToolboxBaseUrl(){const _0x15542c=a6_0x58f277;return process[_0x15542c(0x13c)][_0x15542c(0x135)];}export function getEffectiveToolboxDomain(){return getEnvToolboxBaseUrl()||getEffectiveApiDomain();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x40cfe7,_0x122ab5){const _0x1509b7=a7_0x4c0b,_0x3b1973=_0x40cfe7();while(!![]){try{const _0x4b7e8b=parseInt(_0x1509b7(0xf2))/0x1+-parseInt(_0x1509b7(0xfb))/0x2+-parseInt(_0x1509b7(0xf3))/0x3*(parseInt(_0x1509b7(0xf1))/0x4)+-parseInt(_0x1509b7(0xfe))/0x5+-parseInt(_0x1509b7(0xf4))/0x6*(parseInt(_0x1509b7(0xfd))/0x7)+-parseInt(_0x1509b7(0xf9))/0x8+parseInt(_0x1509b7(0xf8))/0x9;if(_0x4b7e8b===_0x122ab5)break;else _0x3b1973['push'](_0x3b1973['shift']());}catch(_0x11ec29){_0x3b1973['push'](_0x3b1973['shift']());}}}(a7_0x9a51,0x7a91d));import{existsSync,readFileSync}from'node:fs';import{configDir}from'./env.js';let _cache=null;function a7_0x4c0b(_0x3e208c,_0x19aa92){_0x3e208c=_0x3e208c-0xf0;const _0x9a51a9=a7_0x9a51();let _0x4c0b57=_0x9a51a9[_0x3e208c];return _0x4c0b57;}function readConfigFile(){const _0x2f43bc=a7_0x4c0b;if(_cache!==null)return _cache;const _0x4d4c2b=configDir+'/config.json';if(!existsSync(_0x4d4c2b))return _cache={},_cache;try{_cache=JSON[_0x2f43bc(0xf6)](readFileSync(_0x4d4c2b,_0x2f43bc(0xf0)));}catch{process[_0x2f43bc(0xfc)][_0x2f43bc(0xff)]&&console[_0x2f43bc(0xf5)]('[MCP]\x20Failed\x20to\x20parse\x20'+_0x4d4c2b+_0x2f43bc(0xfa)),_cache={};}return _cache;}function a7_0x9a51(){const _0x1124b8=['parse','apiUrlOverrides','22460238saDSfF','4785000DNtvgP',',\x20using\x20empty\x20config','520982QfDxlZ','env','7tSvmDv','224540YOMSic','MCP_DEBUG','utf-8','1854032dahASj','840471MJPghQ','6qhwzwL','6020808woufdF','warn'];a7_0x9a51=function(){return _0x1124b8;};return a7_0x9a51();}export function getConfigApiUrlOverrides(){const _0x5e26d4=a7_0x4c0b;return readConfigFile()[_0x5e26d4(0xf7)]??{};}export function clearConfigCache(){_cache=null;}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const a8_0x34defc=a8_0x24cf;(function(_0x1cf459,_0x5daab9){const _0x39b270=a8_0x24cf,_0x464c1c=_0x1cf459();while(!![]){try{const _0x2133ce=-parseInt(_0x39b270(0x1be))/0x1*(-parseInt(_0x39b270(0x1b1))/0x2)+-parseInt(_0x39b270(0x1b4))/0x3*(-parseInt(_0x39b270(0x1b7))/0x4)+parseInt(_0x39b270(0x1c7))/0x5*(parseInt(_0x39b270(0x1bd))/0x6)+-parseInt(_0x39b270(0x1ac))/0x7*(-parseInt(_0x39b270(0x1c9))/0x8)+parseInt(_0x39b270(0x1b9))/0x9*(parseInt(_0x39b270(0x1bf))/0xa)+parseInt(_0x39b270(0x1c8))/0xb*(parseInt(_0x39b270(0x1af))/0xc)+parseInt(_0x39b270(0x1c1))/0xd*(-parseInt(_0x39b270(0x1c0))/0xe);if(_0x2133ce===_0x5daab9)break;else _0x464c1c['push'](_0x464c1c['shift']());}catch(_0x1f5f46){_0x464c1c['push'](_0x464c1c['shift']());}}}(a8_0x1967,0xb0aac));import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createServer}from'./server.js';function parseArgs(){const _0x2a7b09=a8_0x24cf,_0x245f0d=process['argv'][_0x2a7b09(0x1ae)](0x2),_0x98a803=_0x245f0d[_0x2a7b09(0x1b2)](_0x2a7b09(0x1ad))||_0x245f0d[_0x2a7b09(0x1b2)](_0x2a7b09(0x1b5));return process[_0x2a7b09(0x1bb)][_0x2a7b09(0x1ab)]&&_0x245f0d[_0x2a7b09(0x1b2)](_0x2a7b09(0x1b5))&&!_0x245f0d[_0x2a7b09(0x1b2)](_0x2a7b09(0x1ad))&&console[_0x2a7b09(0x1c6)]('[MCP]\x20--dangerously-bff-save\x20is\x20deprecated;\x20use\x20--enable-bff-save\x20(same\x20behavior)'),{'bffSaveEnabled':_0x98a803};}async function main(){const _0xc3a5a5=a8_0x24cf;try{const {bffSaveEnabled:_0x3d4a44}=parseArgs(),_0x43a0e5=createServer({'bffSaveEnabled':_0x3d4a44}),_0x47d497=new StdioServerTransport();_0x43a0e5[_0xc3a5a5(0x1ba)](),await _0x43a0e5[_0xc3a5a5(0x1b3)](_0x47d497),process['on']('SIGINT',async()=>{const _0x37eed5=_0xc3a5a5;process[_0x37eed5(0x1bb)][_0x37eed5(0x1ab)]&&console[_0x37eed5(0x1c5)](_0x37eed5(0x1c3)),process[_0x37eed5(0x1c2)](0x0);}),process['on'](_0xc3a5a5(0x1c4),async()=>{const _0x1e9d7a=_0xc3a5a5;process[_0x1e9d7a(0x1bb)][_0x1e9d7a(0x1ab)]&&console[_0x1e9d7a(0x1c5)](_0x1e9d7a(0x1c3)),process['exit'](0x0);});}catch(_0x2b7f09){console['error'](_0xc3a5a5(0x1b8),_0x2b7f09),process[_0xc3a5a5(0x1c2)](0x1);}}function a8_0x24cf(_0x59531e,_0x222b98){_0x59531e=_0x59531e-0x1ab;const _0x1967aa=a8_0x1967();let _0x24cff6=_0x1967aa[_0x59531e];return _0x24cff6;}function a8_0x1967(){const _0x545900=['MCP_DEBUG','7lTMVcs','--enable-bff-save','slice','726960gpOihK','catch','1673886vzewSm','includes','connect','843YygMju','--dangerously-bff-save','Unhandled\x20error:','13556kcxewI','Failed\x20to\x20start\x20Lovrabet\x20Dataset\x20MCP\x20Server:','45405LufGWU','logInfo','env','error','615798ZeVNNF','1ZbeGNW','410gTRlhp','14182AxDRON','39221TPBbXS','exit','Shutting\x20down\x20Lovrabet\x20Dataset\x20MCP\x20Server...','SIGTERM','log','warn','60qtsXxp','77sHhHFP','1024768vwVzWl'];a8_0x1967=function(){return _0x545900;};return a8_0x1967();}main()[a8_0x34defc(0x1b0)](_0x4406a1=>{const _0x3d11bb=a8_0x34defc;console[_0x3d11bb(0x1bc)](_0x3d11bb(0x1b6),_0x4406a1),process[_0x3d11bb(0x1c2)](0x1);});
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a9_0x8cb998=a9_0x1a5c;(function(_0x3a2fc1,_0x4dc7dd){const _0x2db19c=a9_0x1a5c,_0x4ad5e2=_0x3a2fc1();while(!![]){try{const _0x3a5cc8=parseInt(_0x2db19c(0xc9))/0x1*(parseInt(_0x2db19c(0xeb))/0x2)+-parseInt(_0x2db19c(0xe5))/0x3*(-parseInt(_0x2db19c(0x109))/0x4)+parseInt(_0x2db19c(0x11a))/0x5*(parseInt(_0x2db19c(0xfb))/0x6)+parseInt(_0x2db19c(0xe9))/0x7*(-parseInt(_0x2db19c(0xed))/0x8)+parseInt(_0x2db19c(0xb3))/0x9+parseInt(_0x2db19c(0xf0))/0xa+-parseInt(_0x2db19c(0xce))/0xb;if(_0x3a5cc8===_0x4dc7dd)break;else _0x4ad5e2['push'](_0x4ad5e2['shift']());}catch(_0x46f0eb){_0x4ad5e2['push'](_0x4ad5e2['shift']());}}}(a9_0x5510,0x64745));function a9_0x1a5c(_0x8137e3,_0x5d79b0){_0x8137e3=_0x8137e3-0xb2;const _0x55103c=a9_0x5510();let _0x1a5cbd=_0x55103c[_0x8137e3];return _0x1a5cbd;}import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod';import{createRequire}from'module';import{login,listDatasets,getDatasetDetail,getDatasetOperations,getOperationDetail,generateSDKCode,searchDatasets,listSqlQueries,saveOrUpdateCustomSql,executeCustomSql,generateSqlCode,validateSqlContent,listBffScripts,getBffScriptInfo,saveOrUpdateBffScript}from'./tools/index.js';const require=createRequire(import.meta.url),packageJson=require('../package.json'),authSchema={'appCode':z['string']()['optional']()[a9_0x8cb998(0xd7)](a9_0x8cb998(0xc1)),'cookie':z['string']()[a9_0x8cb998(0xfe)]()['describe'](a9_0x8cb998(0xcc))};function registerToolWithOptions(_0x3a2126,_0x1288a0,_0x137da0,_0x14aa87){const _0x53a469=a9_0x8cb998;_0x3a2126[_0x53a469(0xd6)](_0x1288a0,_0x137da0,_0x14aa87);}function wrapHandler(_0x583322){return async _0x3eca15=>{const _0x2e7b3b=a9_0x1a5c;try{const _0x20e7c0=await _0x583322(_0x3eca15);return{'content':[{'type':'text','text':JSON['stringify'](_0x20e7c0,null,0x2)}]};}catch(_0x5aed49){return{'content':[{'type':_0x2e7b3b(0x119),'text':JSON[_0x2e7b3b(0xea)]({'error':!![],'message':_0x5aed49['message']||'Unknown\x20error\x20occurred'},null,0x2)}],'isError':!![]};}};}function a9_0x5510(){const _0x566a76=['log','Generate\x20TypeScript\x20SDK\x20code\x20for\x20a\x20dataset\x20operation,\x20including\x20field\x20metadata.\x20Check\x20user\x27s\x20@lovrabet/sdk\x20version\x20in\x20package.json\x20first.','Include\x20bidirectional\x20relations,\x20summary,\x20and\x20usage\x20hints\x20(default:\x20true)','58953qWZhEv','Get\x20detailed\x20dataset\x20information\x20including\x20fields,\x20operations,\x20and\x20bidirectional\x20relations\x20(outgoing\x20+\x20incoming).\x20Returns\x20_relations\x20(structured\x20graph\x20edges),\x20_relationsSummary\x20(natural\x20language\x20overview),\x20and\x20_usageHints\x20(actionable\x20advice\x20based\x20on\x20the\x20dataset\x27s\x20position\x20in\x20the\x20relation\x20graph).','MCP_DEBUG','mcpServer','4772579MDHQpN','stringify','10646HLNumq','get_operation_detail','8eCusWS','Execute\x20Custom\x20SQL','login','6090060jJJMEZ','save_or_update_bff_script','Generate\x20SDK\x20Code','number','Search\x20keyword','Operation\x20name\x20(e.g.,\x20filter,\x20getOne,\x20create,\x20update)','boolean','env','Get\x20Dataset\x20Detail','bff','search_datasets','12dxUFPY','array','JavaScript/TypeScript\x20code\x20with\x20default\x20export','optional','registerAllTools','generate_sdk_code','SQL\x20content\x20(SELECT/INSERT/UPDATE/WITH\x20auto-saved;\x20DELETE/DDL\x20blocked).\x20Supports\x20MyBatis\x20syntax.','Items\x20per\x20page\x20(default:\x20999)','union','Get\x20list\x20of\x20all\x20API\x20operations\x20for\x20a\x20dataset.\x20Prefer\x20\x22filter\x22\x20for\x20queries,\x20\x22getOne\x22\x20for\x20single\x20record\x20by\x20ID.','get_dataset_detail','execute_custom_sql','Generate\x20SQL\x20Code','list_sql_queries','164uxptXw','connect','Login','Get\x20Backend\x20Function\x20Info','bffSaveEnabled','Environment\x20(optional,\x20uses\x20LOVRABET_ENV\x20or\x20defaults\x20to\x20online)','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode.\x20Get\x20sqlCode\x20from\x20list_sql_queries\x20first.','Database\x20ID\x20(optional)','Backend\x20Function\x20write\x20tools\x20enabled\x20(--enable-bff-save)','Get\x20Operation\x20Detail','min','SQL\x20parameters','Get\x20detailed\x20operation\x20information\x20including\x20request/response\x20examples.','options','Dataset\x20code/ID','sdk','text','285020cVPZfz','Search\x20Datasets','save_or_update_custom_sql','daily','Dataset\x20ID\x20(numeric)\x20or\x20code\x20(UUID)','1128222pSaQeM','get_bff_script_info','string','version','Save\x20or\x20update\x20a\x20custom\x20SQL\x20query\x20via\x20toolbox.\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20WITH\x20are\x20auto-saved;\x20DELETE\x20and\x20DDL\x20are\x20blocked\x20for\x20safety.\x20If\x20the\x20last\x20submitter\x20was\x20someone\x20else,\x20returns\x20blocked=true\x20—\x20tell\x20the\x20user\x20to\x20operate\x20manually,\x20do\x20NOT\x20retry.\x20Supports\x20MyBatis\x20syntax.\x20Get\x20dbId\x20from\x20get_dataset_detail.','validate_sql_content','SQL\x20code\x20from\x20list_sql_queries\x20->\x20sqlCode','You\x20are\x20an\x20AI\x20assistant\x20helping\x20developers\x20work\x20with\x20the\x20Lovrabet\x20data\x20platform.\x0a\x0a##\x20Two\x20Runtime\x20Contexts:\x20Frontend\x20SDK\x20vs\x20Backend\x20Function\x20(BFF)\x0a\x0aLovrabet\x20has\x20two\x20code\x20execution\x20contexts\x20with\x20**identical\x20calling\x20methods\x20but\x20different\x20return\x20structures**:\x0a\x0a###\x20Frontend\x20TypeScript\x20SDK\x20(`@lovrabet/sdk`)\x0a-\x20Runs\x20in\x20browser/Node.js,\x20imported\x20via\x20`import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27`\x0a-\x20Model\x20operations\x20return\x20unwrapped\x20data\x20on\x20success,\x20throw\x20LovrabetError\x20on\x20error\x0a-\x20SQL\x20execution\x20returns\x20wrapper:\x20`{\x20execSuccess,\x20execResult\x20}`\x0a\x0a###\x20Backend\x20Function\x20(BFF)\x0a-\x20Runs\x20on\x20Lovrabet\x20server,\x20function\x20signature:\x20`export\x20default\x20async\x20function(params,\x20context)\x20{\x20...\x20}`\x0a-\x20Use\x20`context.client`\x20to\x20access\x20the\x20same\x20SDK\x20methods\x0a-\x20Model\x20operations\x20behave\x20the\x20same\x20as\x20SDK\x0a-\x20**SQL\x20execution\x20returns\x20direct\x20array**\x20`T[]`,\x20errors\x20throw\x20exceptions\x20(no\x20wrapper)\x0a\x0a>\x20**CRITICAL**:\x20Always\x20ask\x20or\x20determine\x20which\x20context\x20the\x20user\x20is\x20working\x20in\x20before\x20generating\x20code.\x0a\x0a##\x20SDK\x20Usage\x20Patterns\x0a\x0a###\x20Model\x20Access\x20(SDK\x20>=\x201.2.0)\x0a-\x20Default:\x20`client.models.dataset_[code].filter()`\x0a-\x20Alias:\x20`client.models.[alias].filter()`\x20(check\x20user\x27s\x20createClient/registerModels\x20config\x20for\x20actual\x20alias)\x0a-\x20For\x20SDK\x20<\x201.2.0:\x20only\x20`client.models.[key]`\x20where\x20key\x20is\x20defined\x20in\x20createClient/registerModels\x0a\x0a###\x20SDK\x20Return\x20Value\x20Behavior\x0a-\x20**On\x20Success**:\x20Returns\x20ONLY\x20the\x20\x27data\x27\x20field\x20content\x20(e.g.,\x20`{\x20id:\x20123,\x20name:\x20\x22...\x22\x20}`)\x0a-\x20**On\x20Error**:\x20Throws\x20LovrabetError\x20with\x20`{\x20message,\x20status,\x20code,\x20data\x20}`\x0a-\x20**Always\x20use\x20try-catch**\x20when\x20calling\x20SDK\x20methods\x0a\x0a###\x20Data\x20Query\x20Best\x20Practices\x0a-\x20**filter**:\x20Most\x20flexible,\x20supports\x20complex\x20WHERE\x20conditions,\x20pagination,\x20sorting\x20—\x20use\x20this\x20for\x20queries\x0a-\x20**getOne**:\x20Single\x20record\x20by\x20primary\x20key\x20ID\x20only\x0a-\x20**getList**:\x20Simple\x20unfiltered\x20listing\x20(rarely\x20needed)\x0a\x0a##\x20Custom\x20SQL\x20Execution\x0a\x0a###\x20Frontend\x20SDK\x0a```typescript\x0aconst\x20data\x20=\x20await\x20client.sql.execute({\x20sqlCode:\x20\x27xxx\x27,\x20params:\x20{\x20key:\x20\x27value\x27\x20}\x20});\x0aif\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);\x0aconst\x20results\x20=\x20data.execResult\x20||\x20[];\x0a```\x0a\x0a###\x20Backend\x20Function\x20(BFF)\x0a```javascript\x0a//\x20context.client.sql.execute\x20returns\x20rows\x20directly\x20—\x20NO\x20wrapper\x20object\x0aconst\x20rows\x20=\x20await\x20context.client.sql.execute({\x20sqlCode:\x20\x27xxx\x27,\x20params:\x20{\x20key:\x20\x27value\x27\x20}\x20});\x0a//\x20rows\x20is\x20T[]\x20directly,\x20errors\x20throw\x20exceptions\x0a```\x0a\x0a>\x20Note:\x20`client.api.executeSql()`\x20is\x20deprecated.\x20Use\x20`client.sql.execute()`.\x0a\x0a##\x20MyBatis\x20Dynamic\x20SQL\x0aSQL\x20content\x20supports\x20MyBatis\x20syntax:\x20`#{param}`,\x20`<if\x20test=\x22\x22>`,\x20`<where>`,\x20`<foreach>`.\x0aUse\x20`<\x20>\x20&`\x20for\x20<\x20>\x20&\x20in\x20SQL\x20content\x20(not\x20in\x20`<if\x20test=\x22\x22>`\x20attributes).\x0a\x0a##\x20Workflow\x20Tips\x0a-\x20Use\x20list_datasets\x20to\x20discover\x20available\x20datasets\x0a-\x20Use\x20get_dataset_detail\x20to\x20see\x20fields,\x20operations,\x20and\x20database\x20info\x20(dbId)\x0a-\x20Use\x20generate_sdk_code\x20to\x20get\x20ready-to-use\x20TypeScript\x20code\x0a-\x20Use\x20list_sql_queries\x20to\x20find\x20existing\x20custom\x20SQLs\x20before\x20creating\x20new\x20ones\x0a-\x20validate_sql_content\x20before\x20save_or_update_custom_sql\x0a-\x20save_or_update_custom_sql\x20routes\x20through\x20toolbox;\x20DELETE/DDL\x20are\x20blocked;\x20if\x20blocked=true\x20(last\x20submitter\x20conflict)\x20tell\x20the\x20user\x20to\x20operate\x20manually\x20—\x20do\x20NOT\x20retry\x0a-\x20generate_sql_code\x20supports\x20target=\x27sdk\x27\x20(default)\x20or\x20target=\x27bff\x27\x20for\x20context-appropriate\x20code','Save\x20or\x20Update\x20Backend\x20Function','Backend\x20Function\x20ID\x20(for\x20updating)','Example\x20parameter\x20values','List\x20all\x20available\x20custom\x20SQL\x20queries\x20with\x20metadata\x20and\x20parameters.','List\x20Backend\x20Functions','Get\x20Operations','Application\x20code\x20(optional\x20if\x20LOVRABET_APP_CODE\x20env\x20var\x20is\x20set)','Client-side\x20filter\x20by\x20category','Target\x20context:\x20\x22sdk\x22\x20(Frontend\x20SDK,\x20default)\x20or\x20\x22bff\x22\x20(Backend\x20Function).\x20SDK\x20returns\x20{execSuccess,\x20execResult}\x20wrapper;\x20BFF\x20returns\x20rows\x20directly.','close','enum','Lovrabet\x20Dataset\x20MCP\x20Server','record','Backend\x20Function\x20ID\x20(from\x20list_bff_scripts)','149Fzirth','SQL\x20code\x20from\x20list_sql_queries\x20(must\x20exist)','server','Authentication\x20cookie\x20(optional,\x20uses\x20stored\x20cookie\x20from\x20login\x20if\x20not\x20provided)','Include\x20table\x20relations\x20(default:\x20true)','14893252MeEAuC','Save\x20or\x20update\x20a\x20Backend\x20Function\x20script\x20via\x20toolbox\x20(server-side\x20submitter\x20check\x20+\x20automatic\x20cache\x20clearing).\x20If\x20blocked=true\x20is\x20returned,\x20the\x20last\x20submitter\x20was\x20someone\x20else\x20—\x20tell\x20the\x20user\x20to\x20operate\x20manually,\x20do\x20NOT\x20retry.','Database\x20ID\x20from\x20get_dataset_detail\x20—\x20required\x20when\x20creating\x20new\x20SQL,\x20optional\x20when\x20updating','SQL\x20ID\x20(kept\x20for\x20backward\x20compatibility,\x20not\x20used\x20by\x20toolbox)','list_datasets','List\x20Datasets','List\x20all\x20Backend\x20Function\x20(ENDPOINT\x20type)\x20scripts.','Function\x20description','registerTool','describe','Save\x20or\x20Update\x20Custom\x20SQL','Get\x20detailed\x20Backend\x20Function\x20script\x20including\x20full\x20source\x20code.','Conflict\x20detection\x20is\x20handled\x20server-side\x20by\x20toolbox','Server\x20started\x20successfully','list_bff_scripts','Client-side\x20filter\x20by\x20name/description/content','Search\x20datasets\x20by\x20keyword\x20(searches\x20in\x20name,\x20table\x20name,\x20code,\x20and\x20description).','Include\x20import\x20statements\x20(default:\x20true)','Bypass\x20cache\x20(default:\x20false)','logInfo'];a9_0x5510=function(){return _0x566a76;};return a9_0x5510();}export class LovrabetDatasetMCPServer{[a9_0x8cb998(0xe8)];[a9_0x8cb998(0x116)];constructor(_0x14863f={}){const _0x2ef10d=a9_0x8cb998;this[_0x2ef10d(0x116)]=_0x14863f,this['mcpServer']=new McpServer({'name':'lovrabet-dataset-mcp','version':packageJson[_0x2ef10d(0xb6)]},{'capabilities':{'tools':{}},'instructions':buildInstructions(_0x14863f)}),this[_0x2ef10d(0xff)]();}[a9_0x8cb998(0xff)](){const _0x22b954=a9_0x8cb998;registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0xef),{'title':_0x22b954(0x10b),'description':'Login\x20to\x20Lovrabet\x20to\x20authenticate\x20for\x20dataset\x20queries.','inputSchema':{'env':z[_0x22b954(0xc5)](['online',_0x22b954(0x11d)])[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0x10e))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(login)),registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0xd2),{'title':_0x22b954(0xd3),'description':'Get\x20list\x20of\x20all\x20datasets\x20with\x20metadata\x20and\x20table\x20relations\x20(ER\x20Config).\x20Use\x20includeRelations:\x20false\x20for\x20faster\x20response.','inputSchema':{...authSchema,'forceRefresh':z[_0x22b954(0xf6)]()[_0x22b954(0xfe)]()['describe'](_0x22b954(0xe0)),'includeRelations':z[_0x22b954(0xf6)]()[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0xcd))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listDatasets)),registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0xfa),{'title':_0x22b954(0x11b),'description':_0x22b954(0xde),'inputSchema':{...authSchema,'keyword':z[_0x22b954(0xb5)]()['describe'](_0x22b954(0xf4))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(searchDatasets)),registerToolWithOptions(this['mcpServer'],_0x22b954(0x105),{'title':_0x22b954(0xf8),'description':_0x22b954(0xe6),'inputSchema':{...authSchema,'datasetCode':z[_0x22b954(0xb5)]()[_0x22b954(0xd7)](_0x22b954(0xb2)),'forceRefresh':z[_0x22b954(0xf6)]()[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0xe0)),'includeRelations':z[_0x22b954(0xf6)]()[_0x22b954(0xfe)]()['describe'](_0x22b954(0xe4))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetDetail)),registerToolWithOptions(this[_0x22b954(0xe8)],'get_dataset_operations',{'title':_0x22b954(0xc0),'description':_0x22b954(0x104),'inputSchema':{...authSchema,'datasetCode':z[_0x22b954(0xb5)]()[_0x22b954(0xd7)](_0x22b954(0xb2))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetOperations)),registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0xec),{'title':_0x22b954(0x112),'description':_0x22b954(0x115),'inputSchema':{...authSchema,'datasetCode':z[_0x22b954(0xb5)]()[_0x22b954(0xd7)](_0x22b954(0x117)),'operationName':z[_0x22b954(0xb5)]()[_0x22b954(0xd7)](_0x22b954(0xf5))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getOperationDetail)),registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0x100),{'title':_0x22b954(0xf2),'description':_0x22b954(0xe3),'inputSchema':{...authSchema,'datasetCode':z['string']()[_0x22b954(0xd7)](_0x22b954(0x117)),'operationName':z[_0x22b954(0xb5)]()['describe']('Operation\x20name\x20(e.g.,\x20filter,\x20getOne,\x20create,\x20update)'),'includeImports':z['boolean']()[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0xdf)),'useAlias':z[_0x22b954(0xf6)]()[_0x22b954(0xfe)]()[_0x22b954(0xd7)]('Use\x20camelCase\x20alias\x20instead\x20of\x20dataset_[code]\x20pattern\x20(default:\x20false)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSDKCode)),registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0x108),{'title':'List\x20SQL\x20Queries','description':_0x22b954(0xbe),'inputSchema':{...authSchema,'keyword':z['string']()['optional']()['describe'](_0x22b954(0xdd)),'category':z['string']()[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0xc2)),'sqlCode':z[_0x22b954(0xb5)]()[_0x22b954(0xfe)]()[_0x22b954(0xd7)]('Server-side\x20fuzzy\x20match\x20by\x20sqlCode'),'sqlName':z[_0x22b954(0xb5)]()['optional']()['describe']('Server-side\x20fuzzy\x20match\x20by\x20sqlName'),'pageSize':z[_0x22b954(0xf3)]()['optional']()[_0x22b954(0xd7)](_0x22b954(0x102)),'currentPage':z[_0x22b954(0xf3)]()['optional']()[_0x22b954(0xd7)]('Page\x20number\x20(default:\x201)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listSqlQueries)),registerToolWithOptions(this['mcpServer'],_0x22b954(0x106),{'title':_0x22b954(0xee),'description':_0x22b954(0x10f),'inputSchema':{...authSchema,'sqlCode':z[_0x22b954(0xb5)]()['min'](0x1)[_0x22b954(0xd7)](_0x22b954(0xb9)),'params':z['record'](z[_0x22b954(0x103)]([z[_0x22b954(0xb5)](),z[_0x22b954(0xf3)]()]))[_0x22b954(0xfe)]()['describe'](_0x22b954(0x114))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(executeCustomSql)),registerToolWithOptions(this[_0x22b954(0xe8)],'generate_sql_code',{'title':_0x22b954(0x107),'description':'Generate\x20code\x20for\x20a\x20custom\x20SQL\x20query.\x20Validates\x20sqlCode\x20exists\x20first.\x20Use\x20target\x20to\x20switch\x20between\x20Frontend\x20SDK\x20and\x20Backend\x20Function\x20code\x20patterns.','inputSchema':{...authSchema,'sqlCode':z[_0x22b954(0xb5)]()[_0x22b954(0x113)](0x1)[_0x22b954(0xd7)](_0x22b954(0xca)),'params':z[_0x22b954(0xc7)](z[_0x22b954(0x103)]([z[_0x22b954(0xb5)](),z[_0x22b954(0xf3)]()]))[_0x22b954(0xfe)]()['describe'](_0x22b954(0xbd)),'includeImports':z[_0x22b954(0xf6)]()[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0xdf)),'target':z[_0x22b954(0xc5)]([_0x22b954(0x118),_0x22b954(0xf9)])[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0xc3))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSqlCode)),registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0xb8),{'title':'Validate\x20SQL\x20Content','description':'Validate\x20SQL\x20content\x20without\x20saving.\x20Detects\x20SQL\x20type\x20(SELECT/INSERT/UPDATE/DELETE/DDL)\x20and\x20validates\x20table/column\x20existence.\x20Supports\x20MyBatis\x20syntax.','inputSchema':{...authSchema,'sqlContent':z[_0x22b954(0xb5)]()['min'](0x1)[_0x22b954(0xd7)]('SQL\x20content\x20to\x20validate'),'dbId':z[_0x22b954(0xf3)]()[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0x110)),'validateSchemas':z[_0x22b954(0xfc)](z['string']())[_0x22b954(0xfe)]()[_0x22b954(0xd7)]('Dataset\x20codes\x20to\x20validate\x20against')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(validateSqlContent)),registerToolWithOptions(this['mcpServer'],_0x22b954(0x11c),{'title':_0x22b954(0xd8),'description':_0x22b954(0xb7),'inputSchema':{...authSchema,'sqlName':z['string']()[_0x22b954(0xfe)]()['describe']('SQL\x20name/label\x20(optional;\x20MCP\x20auto-extracts\x20from\x20@lovrabet.sqlName\x20comment,\x20or\x20toolbox\x20generates\x20fallback)'),'sqlCode':z[_0x22b954(0xb5)]()['optional']()[_0x22b954(0xd7)]('Known\x20sqlCode\x20—\x20use\x20to\x20directly\x20target\x20the\x20record\x20for\x20update,\x20skipping\x20name\x20lookup'),'dbId':z['number']()['optional']()[_0x22b954(0xd7)](_0x22b954(0xd0)),'sqlContent':z[_0x22b954(0xb5)]()[_0x22b954(0x113)](0x1)[_0x22b954(0xd7)](_0x22b954(0x101)),'id':z['number']()[_0x22b954(0xfe)]()[_0x22b954(0xd7)](_0x22b954(0xd1))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':![]}},wrapHandler(saveOrUpdateCustomSql)),this['options']['bffSaveEnabled']&&(registerToolWithOptions(this['mcpServer'],_0x22b954(0xdc),{'title':_0x22b954(0xbf),'description':_0x22b954(0xd4),'inputSchema':{...authSchema},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listBffScripts)),registerToolWithOptions(this[_0x22b954(0xe8)],_0x22b954(0xb4),{'title':_0x22b954(0x10c),'description':_0x22b954(0xd9),'inputSchema':{...authSchema,'id':z[_0x22b954(0xf3)]()[_0x22b954(0xd7)](_0x22b954(0xc8))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getBffScriptInfo)),registerToolWithOptions(this['mcpServer'],_0x22b954(0xf1),{'title':_0x22b954(0xbb),'description':_0x22b954(0xcf),'inputSchema':{...authSchema,'id':z['number']()['optional']()[_0x22b954(0xd7)](_0x22b954(0xbc)),'description':z[_0x22b954(0xb5)]()[_0x22b954(0x113)](0x1)['describe'](_0x22b954(0xd5)),'scriptContent':z[_0x22b954(0xb5)]()[_0x22b954(0x113)](0x1)[_0x22b954(0xd7)](_0x22b954(0xfd))},'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![]}},wrapHandler(saveOrUpdateBffScript)));}get[a9_0x8cb998(0xcb)](){const _0x4a4898=a9_0x8cb998;return this[_0x4a4898(0xe8)];}async['connect'](_0x5a564f){const _0x2d1a03=a9_0x8cb998;await this[_0x2d1a03(0xe8)][_0x2d1a03(0x10a)](_0x5a564f);}async[a9_0x8cb998(0xc4)](){const _0x27ab35=a9_0x8cb998;await this['mcpServer'][_0x27ab35(0xc4)]();}[a9_0x8cb998(0xe1)](){const _0x53b200=a9_0x8cb998;if(!process[_0x53b200(0xf7)][_0x53b200(0xe7)])return;console[_0x53b200(0xe2)](_0x53b200(0xc6)),console[_0x53b200(0xe2)]('Version:\x20'+packageJson[_0x53b200(0xb6)]),console[_0x53b200(0xe2)](_0x53b200(0xdb)),this[_0x53b200(0x116)]['bffSaveEnabled']&&(console['log'](_0x53b200(0x111)),console[_0x53b200(0xe2)](_0x53b200(0xda)));}}function buildInstructions(_0x79c47b){const _0x2f0335=a9_0x8cb998,_0x1694dc=_0x79c47b[_0x2f0335(0x10d)]===!![],_0x394bfd=_0x1694dc?'\x0a-\x20Use\x20list_bff_scripts\x20/\x20get_bff_script_info\x20to\x20browse\x20and\x20read\x20Backend\x20Function\x20scripts\x0a-\x20save_or_update_bff_script\x20saves\x20script\x20via\x20toolbox\x20(server-side\x20submitter\x20check\x20+\x20automatic\x20cache\x20clearing)\x0a-\x20If\x20save\x20returns\x20blocked:\x20true,\x20tell\x20the\x20user\x20to\x20operate\x20manually\x20on\x20the\x20platform,\x20do\x20NOT\x20retry':'';return _0x2f0335(0xba)+_0x394bfd+'\x0a';}export function createServer(_0x5e31db){return new LovrabetDatasetMCPServer(_0x5e31db);}
|
|
1
|
+
const a9_0x2abb8e=a9_0x4c60;(function(_0x3c78e6,_0x2010c1){const _0x3a1170=a9_0x4c60,_0xc082b3=_0x3c78e6();while(!![]){try{const _0x4d4dbe=parseInt(_0x3a1170(0x17a))/0x1*(parseInt(_0x3a1170(0x186))/0x2)+-parseInt(_0x3a1170(0x1bd))/0x3*(-parseInt(_0x3a1170(0x17b))/0x4)+-parseInt(_0x3a1170(0x18e))/0x5+parseInt(_0x3a1170(0x19b))/0x6*(-parseInt(_0x3a1170(0x1d3))/0x7)+-parseInt(_0x3a1170(0x170))/0x8*(-parseInt(_0x3a1170(0x17f))/0x9)+-parseInt(_0x3a1170(0x178))/0xa*(parseInt(_0x3a1170(0x177))/0xb)+-parseInt(_0x3a1170(0x1c5))/0xc*(-parseInt(_0x3a1170(0x1a4))/0xd);if(_0x4d4dbe===_0x2010c1)break;else _0xc082b3['push'](_0xc082b3['shift']());}catch(_0x2552da){_0xc082b3['push'](_0xc082b3['shift']());}}}(a9_0x5b28,0xa0fa7));function a9_0x5b28(){const _0x472748=['Save\x20or\x20update\x20a\x20custom\x20SQL\x20query\x20via\x20toolbox.\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20WITH\x20are\x20auto-saved;\x20DELETE\x20and\x20DDL\x20are\x20blocked\x20for\x20safety.\x20If\x20the\x20last\x20submitter\x20was\x20someone\x20else,\x20returns\x20blocked=true\x20—\x20tell\x20the\x20user\x20to\x20operate\x20manually,\x20do\x20NOT\x20retry.\x20Supports\x20MyBatis\x20syntax.\x20Get\x20dbId\x20from\x20get_dataset_detail.','SQL\x20parameters','Client-side\x20filter\x20by\x20name/description/content','Dataset\x20codes\x20to\x20validate\x20against','bff','list_datasets','Lovrabet\x20Dataset\x20MCP\x20Server','log','Execute\x20Custom\x20SQL','Generate\x20SDK\x20Code','SQL\x20name/label\x20(optional;\x20MCP\x20auto-extracts\x20from\x20@lovrabet.sqlName\x20comment,\x20or\x20toolbox\x20generates\x20fallback)','Validate\x20SQL\x20content\x20without\x20saving.\x20Detects\x20SQL\x20type\x20(SELECT/INSERT/UPDATE/DELETE/DDL)\x20and\x20validates\x20table/column\x20existence.\x20Supports\x20MyBatis\x20syntax.','generate_sdk_code','MCP_DEBUG','3smEwJI','Server\x20started\x20successfully','SQL\x20content\x20(SELECT/INSERT/UPDATE/WITH\x20auto-saved;\x20DELETE/DDL\x20blocked).\x20Supports\x20MyBatis\x20syntax.','mcpServer','SQL\x20content\x20to\x20validate','Save\x20or\x20Update\x20Custom\x20SQL','Known\x20sqlCode\x20—\x20use\x20to\x20directly\x20target\x20the\x20record\x20for\x20update,\x20skipping\x20name\x20lookup','Login\x20to\x20Lovrabet\x20to\x20authenticate\x20for\x20dataset\x20queries.','12998712fFYGRn','get_dataset_operations','Get\x20list\x20of\x20all\x20API\x20operations\x20for\x20a\x20dataset.\x20Prefer\x20\x22filter\x22\x20for\x20queries,\x20\x22getOne\x22\x20for\x20single\x20record\x20by\x20ID.','Include\x20table\x20relations\x20(default:\x20true)','Get\x20Operation\x20Detail','generate_sql_code','daily','You\x20are\x20an\x20AI\x20assistant\x20helping\x20developers\x20work\x20with\x20the\x20Lovrabet\x20data\x20platform.\x0a\x0a##\x20Two\x20Runtime\x20Contexts:\x20Frontend\x20SDK\x20vs\x20Backend\x20Function\x20(BFF)\x0a\x0aLovrabet\x20has\x20two\x20code\x20execution\x20contexts\x20with\x20**identical\x20calling\x20methods\x20but\x20different\x20return\x20structures**:\x0a\x0a###\x20Frontend\x20TypeScript\x20SDK\x20(`@lovrabet/sdk`)\x0a-\x20Runs\x20in\x20browser/Node.js,\x20imported\x20via\x20`import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27`\x0a-\x20Model\x20operations\x20return\x20unwrapped\x20data\x20on\x20success,\x20throw\x20LovrabetError\x20on\x20error\x0a-\x20SQL\x20execution\x20returns\x20wrapper:\x20`{\x20execSuccess,\x20execResult\x20}`\x0a\x0a###\x20Backend\x20Function\x20(BFF)\x0a-\x20Runs\x20on\x20Lovrabet\x20server,\x20function\x20signature:\x20`export\x20default\x20async\x20function(params,\x20context)\x20{\x20...\x20}`\x0a-\x20Use\x20`context.client`\x20to\x20access\x20the\x20same\x20SDK\x20methods\x0a-\x20Model\x20operations\x20behave\x20the\x20same\x20as\x20SDK\x0a-\x20**SQL\x20execution\x20returns\x20direct\x20array**\x20`T[]`,\x20errors\x20throw\x20exceptions\x20(no\x20wrapper)\x0a\x0a>\x20**CRITICAL**:\x20Always\x20ask\x20or\x20determine\x20which\x20context\x20the\x20user\x20is\x20working\x20in\x20before\x20generating\x20code.\x0a\x0a##\x20SDK\x20Usage\x20Patterns\x0a\x0a###\x20Model\x20Access\x20(SDK\x20>=\x201.2.0)\x0a-\x20Default:\x20`client.models.dataset_[code].filter()`\x0a-\x20Alias:\x20`client.models.[alias].filter()`\x20(check\x20user\x27s\x20createClient/registerModels\x20config\x20for\x20actual\x20alias)\x0a-\x20For\x20SDK\x20<\x201.2.0:\x20only\x20`client.models.[key]`\x20where\x20key\x20is\x20defined\x20in\x20createClient/registerModels\x0a\x0a###\x20SDK\x20Return\x20Value\x20Behavior\x0a-\x20**On\x20Success**:\x20Returns\x20ONLY\x20the\x20\x27data\x27\x20field\x20content\x20(e.g.,\x20`{\x20id:\x20123,\x20name:\x20\x22...\x22\x20}`)\x0a-\x20**On\x20Error**:\x20Throws\x20LovrabetError\x20with\x20`{\x20message,\x20status,\x20code,\x20data\x20}`\x0a-\x20**Always\x20use\x20try-catch**\x20when\x20calling\x20SDK\x20methods\x0a\x0a###\x20Data\x20Query\x20Best\x20Practices\x0a-\x20**filter**:\x20Most\x20flexible,\x20supports\x20complex\x20WHERE\x20conditions,\x20pagination,\x20sorting\x20—\x20use\x20this\x20for\x20queries\x0a-\x20**getOne**:\x20Single\x20record\x20by\x20primary\x20key\x20ID\x20only\x0a-\x20**getList**:\x20Simple\x20unfiltered\x20listing\x20(rarely\x20needed)\x0a\x0a##\x20Custom\x20SQL\x20Execution\x0a\x0a###\x20Frontend\x20SDK\x0a```typescript\x0aconst\x20data\x20=\x20await\x20client.sql.execute({\x20sqlCode:\x20\x27xxx\x27,\x20params:\x20{\x20key:\x20\x27value\x27\x20}\x20});\x0aif\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);\x0aconst\x20results\x20=\x20data.execResult\x20||\x20[];\x0a```\x0a\x0a###\x20Backend\x20Function\x20(BFF)\x0a```javascript\x0a//\x20context.client.sql.execute\x20returns\x20rows\x20directly\x20—\x20NO\x20wrapper\x20object\x0aconst\x20rows\x20=\x20await\x20context.client.sql.execute({\x20sqlCode:\x20\x27xxx\x27,\x20params:\x20{\x20key:\x20\x27value\x27\x20}\x20});\x0a//\x20rows\x20is\x20T[]\x20directly,\x20errors\x20throw\x20exceptions\x0a```\x0a\x0a>\x20Note:\x20`client.api.executeSql()`\x20is\x20deprecated.\x20Use\x20`client.sql.execute()`.\x0a\x0a##\x20MyBatis\x20Dynamic\x20SQL\x0aSQL\x20content\x20supports\x20MyBatis\x20syntax:\x20`#{param}`,\x20`<if\x20test=\x22\x22>`,\x20`<where>`,\x20`<foreach>`.\x0aUse\x20`<\x20>\x20&`\x20for\x20<\x20>\x20&\x20in\x20SQL\x20content\x20(not\x20in\x20`<if\x20test=\x22\x22>`\x20attributes).\x0a\x0a##\x20Workflow\x20Tips\x0a-\x20Use\x20list_datasets\x20to\x20discover\x20available\x20datasets\x0a-\x20Use\x20get_dataset_detail\x20to\x20see\x20fields,\x20operations,\x20and\x20database\x20info\x20(dbId)\x0a-\x20Use\x20generate_sdk_code\x20to\x20get\x20ready-to-use\x20TypeScript\x20code\x0a-\x20Use\x20list_sql_queries\x20to\x20find\x20existing\x20custom\x20SQLs\x20before\x20creating\x20new\x20ones\x0a-\x20validate_sql_content\x20before\x20save_or_update_custom_sql\x0a-\x20save_or_update_custom_sql\x20routes\x20through\x20toolbox;\x20DELETE/DDL\x20are\x20blocked;\x20if\x20blocked=true\x20(last\x20submitter\x20conflict)\x20tell\x20the\x20user\x20to\x20operate\x20manually\x20—\x20do\x20NOT\x20retry\x0a-\x20generate_sql_code\x20supports\x20target=\x27sdk\x27\x20(default)\x20or\x20target=\x27bff\x27\x20for\x20context-appropriate\x20code','JavaScript/TypeScript\x20code\x20with\x20default\x20export','Conflict\x20detection\x20is\x20handled\x20server-side\x20by\x20toolbox','registerAllTools','Search\x20keyword','list_bff_scripts','Server-side\x20fuzzy\x20match\x20by\x20sqlName','28aAyqvO','stringify','Generate\x20SQL\x20Code','List\x20Backend\x20Functions','List\x20SQL\x20Queries','Authentication\x20cookie\x20(optional,\x20uses\x20stored\x20cookie\x20from\x20login\x20if\x20not\x20provided)','Operation\x20name\x20(e.g.,\x20filter,\x20getOne,\x20create,\x20update)','8rkYGaY','string','List\x20all\x20available\x20custom\x20SQL\x20queries\x20with\x20metadata\x20and\x20parameters.','Target\x20context:\x20\x22sdk\x22\x20(Frontend\x20SDK,\x20default)\x20or\x20\x22bff\x22\x20(Backend\x20Function).\x20SDK\x20returns\x20{execSuccess,\x20execResult}\x20wrapper;\x20BFF\x20returns\x20rows\x20directly.','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode.\x20Get\x20sqlCode\x20from\x20list_sql_queries\x20first.','connect','Environment\x20(optional,\x20uses\x20LOVRABET_ENV\x20or\x20defaults\x20to\x20online)','4453262LTVPCR','10XDfYuX','get_dataset_detail','1ssRpoF','2902620adaFHE','Generate\x20code\x20for\x20a\x20custom\x20SQL\x20query.\x20Validates\x20sqlCode\x20exists\x20first.\x20Use\x20target\x20to\x20switch\x20between\x20Frontend\x20SDK\x20and\x20Backend\x20Function\x20code\x20patterns.','Database\x20ID\x20(optional)','get_bff_script_info','7222086NbfUyQ','Use\x20camelCase\x20alias\x20instead\x20of\x20dataset_[code]\x20pattern\x20(default:\x20false)','array','Example\x20parameter\x20values','Get\x20detailed\x20operation\x20information\x20including\x20request/response\x20examples.','record','logInfo','455458XSUFAp','optional','Include\x20import\x20statements\x20(default:\x20true)','list_sql_queries','options','Backend\x20Function\x20ID\x20(from\x20list_bff_scripts)','login','get_operation_detail','2417835DbENGi','close','Dataset\x20code/ID','enum','Unknown\x20error\x20occurred','SQL\x20code\x20from\x20list_sql_queries\x20(must\x20exist)','Application\x20code\x20(optional\x20if\x20LOVRABET_APP_CODE\x20env\x20var\x20is\x20set)','min','sdk','../package.json','Get\x20Dataset\x20Detail','Items\x20per\x20page\x20(default:\x20999)','message','1936932CedEfB','Version:\x20','Get\x20Backend\x20Function\x20Info','Get\x20Operations','bffSaveEnabled','Server-side\x20fuzzy\x20match\x20by\x20sqlCode','search_datasets','version','save_or_update_custom_sql','13jFsBqx','SQL\x20ID\x20(kept\x20for\x20backward\x20compatibility,\x20not\x20used\x20by\x20toolbox)','union','Save\x20or\x20update\x20a\x20Backend\x20Function\x20script\x20via\x20toolbox\x20(server-side\x20submitter\x20check\x20+\x20automatic\x20cache\x20clearing).\x20If\x20blocked=true\x20is\x20returned,\x20the\x20last\x20submitter\x20was\x20someone\x20else\x20—\x20tell\x20the\x20user\x20to\x20operate\x20manually,\x20do\x20NOT\x20retry.','Validate\x20SQL\x20Content','save_or_update_bff_script','Client-side\x20filter\x20by\x20category','env','boolean','number','describe'];a9_0x5b28=function(){return _0x472748;};return a9_0x5b28();}import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod';import{createRequire}from'module';import{login,listDatasets,getDatasetDetail,getDatasetOperations,getOperationDetail,generateSDKCode,searchDatasets,listSqlQueries,saveOrUpdateCustomSql,executeCustomSql,generateSqlCode,validateSqlContent,listBffScripts,getBffScriptInfo,saveOrUpdateBffScript}from'./tools/index.js';const require=createRequire(import.meta.url),packageJson=require(a9_0x2abb8e(0x197)),authSchema={'appCode':z[a9_0x2abb8e(0x171)]()[a9_0x2abb8e(0x187)]()[a9_0x2abb8e(0x1ae)](a9_0x2abb8e(0x194)),'cookie':z[a9_0x2abb8e(0x171)]()['optional']()[a9_0x2abb8e(0x1ae)](a9_0x2abb8e(0x16e))};function registerToolWithOptions(_0x1f2dea,_0x10e0fc,_0x1dad6a,_0xe7eb4a){_0x1f2dea['registerTool'](_0x10e0fc,_0x1dad6a,_0xe7eb4a);}function wrapHandler(_0x47ac1d){return async _0x52b8fd=>{const _0x242d73=a9_0x4c60;try{const _0x52cde4=await _0x47ac1d(_0x52b8fd);return{'content':[{'type':'text','text':JSON['stringify'](_0x52cde4,null,0x2)}]};}catch(_0x1bbcb9){return{'content':[{'type':'text','text':JSON[_0x242d73(0x16a)]({'error':!![],'message':_0x1bbcb9[_0x242d73(0x19a)]||_0x242d73(0x192)},null,0x2)}],'isError':!![]};}};}export class LovrabetDatasetMCPServer{[a9_0x2abb8e(0x1c0)];['options'];constructor(_0x2d8b85={}){const _0x58abb9=a9_0x2abb8e;this[_0x58abb9(0x18a)]=_0x2d8b85,this[_0x58abb9(0x1c0)]=new McpServer({'name':'lovrabet-dataset-mcp','version':packageJson['version']},{'capabilities':{'tools':{}},'instructions':buildInstructions(_0x2d8b85)}),this[_0x58abb9(0x1cf)]();}[a9_0x2abb8e(0x1cf)](){const _0x4ae62e=a9_0x2abb8e;registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x18c),{'title':'Login','description':_0x4ae62e(0x1c4),'inputSchema':{'env':z[_0x4ae62e(0x191)](['online',_0x4ae62e(0x1cb)])[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x176))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(login)),registerToolWithOptions(this['mcpServer'],_0x4ae62e(0x1b4),{'title':'List\x20Datasets','description':'Get\x20list\x20of\x20all\x20datasets\x20with\x20metadata\x20and\x20table\x20relations\x20(ER\x20Config).\x20Use\x20includeRelations:\x20false\x20for\x20faster\x20response.','inputSchema':{...authSchema,'forceRefresh':z[_0x4ae62e(0x1ac)]()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)]('Bypass\x20cache\x20(default:\x20false)'),'includeRelations':z[_0x4ae62e(0x1ac)]()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1c8))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listDatasets)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x1a1),{'title':'Search\x20Datasets','description':'Search\x20datasets\x20by\x20keyword\x20(searches\x20in\x20name,\x20table\x20name,\x20code,\x20and\x20description).','inputSchema':{...authSchema,'keyword':z['string']()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1d0))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(searchDatasets)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x179),{'title':_0x4ae62e(0x198),'description':'Get\x20detailed\x20dataset\x20information\x20including\x20fields,\x20operations,\x20and\x20bidirectional\x20relations\x20(outgoing\x20+\x20incoming).\x20Returns\x20_relations\x20(structured\x20graph\x20edges),\x20_relationsSummary\x20(natural\x20language\x20overview),\x20and\x20_usageHints\x20(actionable\x20advice\x20based\x20on\x20the\x20dataset\x27s\x20position\x20in\x20the\x20relation\x20graph).','inputSchema':{...authSchema,'datasetCode':z['string']()['describe']('Dataset\x20ID\x20(numeric)\x20or\x20code\x20(UUID)'),'forceRefresh':z['boolean']()[_0x4ae62e(0x187)]()['describe']('Bypass\x20cache\x20(default:\x20false)'),'includeRelations':z['boolean']()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)]('Include\x20bidirectional\x20relations,\x20summary,\x20and\x20usage\x20hints\x20(default:\x20true)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetDetail)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x1c6),{'title':_0x4ae62e(0x19e),'description':_0x4ae62e(0x1c7),'inputSchema':{...authSchema,'datasetCode':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x1ae)]('Dataset\x20ID\x20(numeric)\x20or\x20code\x20(UUID)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetOperations)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x18d),{'title':_0x4ae62e(0x1c9),'description':_0x4ae62e(0x183),'inputSchema':{...authSchema,'datasetCode':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x190)),'operationName':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x16f))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getOperationDetail)),registerToolWithOptions(this['mcpServer'],_0x4ae62e(0x1bb),{'title':_0x4ae62e(0x1b8),'description':'Generate\x20TypeScript\x20SDK\x20code\x20for\x20a\x20dataset\x20operation,\x20including\x20field\x20metadata.\x20Check\x20user\x27s\x20@lovrabet/sdk\x20version\x20in\x20package.json\x20first.','inputSchema':{...authSchema,'datasetCode':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x190)),'operationName':z[_0x4ae62e(0x171)]()['describe']('Operation\x20name\x20(e.g.,\x20filter,\x20getOne,\x20create,\x20update)'),'includeImports':z[_0x4ae62e(0x1ac)]()['optional']()[_0x4ae62e(0x1ae)](_0x4ae62e(0x188)),'useAlias':z[_0x4ae62e(0x1ac)]()['optional']()[_0x4ae62e(0x1ae)](_0x4ae62e(0x180))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSDKCode)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x189),{'title':_0x4ae62e(0x16d),'description':_0x4ae62e(0x172),'inputSchema':{...authSchema,'keyword':z['string']()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1b1)),'category':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1aa)),'sqlCode':z['string']()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1a0)),'sqlName':z['string']()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1d2)),'pageSize':z[_0x4ae62e(0x1ad)]()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x199)),'currentPage':z[_0x4ae62e(0x1ad)]()['optional']()[_0x4ae62e(0x1ae)]('Page\x20number\x20(default:\x201)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listSqlQueries)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],'execute_custom_sql',{'title':_0x4ae62e(0x1b7),'description':_0x4ae62e(0x174),'inputSchema':{...authSchema,'sqlCode':z[_0x4ae62e(0x171)]()['min'](0x1)[_0x4ae62e(0x1ae)]('SQL\x20code\x20from\x20list_sql_queries\x20->\x20sqlCode'),'params':z[_0x4ae62e(0x184)](z[_0x4ae62e(0x1a6)]([z[_0x4ae62e(0x171)](),z[_0x4ae62e(0x1ad)]()]))['optional']()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1b0))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(executeCustomSql)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x1ca),{'title':_0x4ae62e(0x16b),'description':_0x4ae62e(0x17c),'inputSchema':{...authSchema,'sqlCode':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x195)](0x1)[_0x4ae62e(0x1ae)](_0x4ae62e(0x193)),'params':z[_0x4ae62e(0x184)](z[_0x4ae62e(0x1a6)]([z['string'](),z[_0x4ae62e(0x1ad)]()]))[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x182)),'includeImports':z[_0x4ae62e(0x1ac)]()['optional']()[_0x4ae62e(0x1ae)](_0x4ae62e(0x188)),'target':z[_0x4ae62e(0x191)]([_0x4ae62e(0x196),_0x4ae62e(0x1b3)])[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x173))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSqlCode)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],'validate_sql_content',{'title':_0x4ae62e(0x1a8),'description':_0x4ae62e(0x1ba),'inputSchema':{...authSchema,'sqlContent':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x195)](0x1)[_0x4ae62e(0x1ae)](_0x4ae62e(0x1c1)),'dbId':z[_0x4ae62e(0x1ad)]()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x17d)),'validateSchemas':z[_0x4ae62e(0x181)](z[_0x4ae62e(0x171)]())[_0x4ae62e(0x187)]()['describe'](_0x4ae62e(0x1b2))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(validateSqlContent)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x1a3),{'title':_0x4ae62e(0x1c2),'description':_0x4ae62e(0x1af),'inputSchema':{...authSchema,'sqlName':z['string']()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1b9)),'sqlCode':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x187)]()['describe'](_0x4ae62e(0x1c3)),'dbId':z[_0x4ae62e(0x1ad)]()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)]('Database\x20ID\x20from\x20get_dataset_detail\x20—\x20required\x20when\x20creating\x20new\x20SQL,\x20optional\x20when\x20updating'),'sqlContent':z[_0x4ae62e(0x171)]()[_0x4ae62e(0x195)](0x1)[_0x4ae62e(0x1ae)](_0x4ae62e(0x1bf)),'id':z['number']()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x1a5))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':![]}},wrapHandler(saveOrUpdateCustomSql)),this['options']['bffSaveEnabled']&&(registerToolWithOptions(this['mcpServer'],_0x4ae62e(0x1d1),{'title':_0x4ae62e(0x16c),'description':'List\x20all\x20Backend\x20Function\x20(ENDPOINT\x20type)\x20scripts.','inputSchema':{...authSchema},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listBffScripts)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x17e),{'title':_0x4ae62e(0x19d),'description':'Get\x20detailed\x20Backend\x20Function\x20script\x20including\x20full\x20source\x20code.','inputSchema':{...authSchema,'id':z[_0x4ae62e(0x1ad)]()[_0x4ae62e(0x1ae)](_0x4ae62e(0x18b))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getBffScriptInfo)),registerToolWithOptions(this[_0x4ae62e(0x1c0)],_0x4ae62e(0x1a9),{'title':'Save\x20or\x20Update\x20Backend\x20Function','description':_0x4ae62e(0x1a7),'inputSchema':{...authSchema,'id':z['number']()[_0x4ae62e(0x187)]()[_0x4ae62e(0x1ae)]('Backend\x20Function\x20ID\x20(for\x20updating)'),'description':z['string']()[_0x4ae62e(0x195)](0x1)['describe']('Function\x20description'),'scriptContent':z['string']()[_0x4ae62e(0x195)](0x1)[_0x4ae62e(0x1ae)](_0x4ae62e(0x1cd))},'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![]}},wrapHandler(saveOrUpdateBffScript)));}get['server'](){const _0x26f3bc=a9_0x2abb8e;return this[_0x26f3bc(0x1c0)];}async[a9_0x2abb8e(0x175)](_0x5119b0){await this['mcpServer']['connect'](_0x5119b0);}async[a9_0x2abb8e(0x18f)](){const _0xf11363=a9_0x2abb8e;await this[_0xf11363(0x1c0)][_0xf11363(0x18f)]();}[a9_0x2abb8e(0x185)](){const _0x458346=a9_0x2abb8e;if(!process[_0x458346(0x1ab)][_0x458346(0x1bc)])return;console[_0x458346(0x1b6)](_0x458346(0x1b5)),console[_0x458346(0x1b6)](_0x458346(0x19c)+packageJson[_0x458346(0x1a2)]),console[_0x458346(0x1b6)](_0x458346(0x1be)),this[_0x458346(0x18a)][_0x458346(0x19f)]&&(console[_0x458346(0x1b6)]('Backend\x20Function\x20write\x20tools\x20enabled\x20(--enable-bff-save)'),console['log'](_0x458346(0x1ce)));}}function a9_0x4c60(_0x391261,_0x2806e6){_0x391261=_0x391261-0x16a;const _0x5b28ad=a9_0x5b28();let _0x4c60e5=_0x5b28ad[_0x391261];return _0x4c60e5;}function buildInstructions(_0x58608d){const _0x469122=a9_0x2abb8e,_0x1f802c=_0x58608d[_0x469122(0x19f)]===!![],_0xf9a88d=_0x1f802c?'\x0a-\x20Use\x20list_bff_scripts\x20/\x20get_bff_script_info\x20to\x20browse\x20and\x20read\x20Backend\x20Function\x20scripts\x0a-\x20save_or_update_bff_script\x20saves\x20script\x20via\x20toolbox\x20(server-side\x20submitter\x20check\x20+\x20automatic\x20cache\x20clearing)\x0a-\x20If\x20save\x20returns\x20blocked:\x20true,\x20tell\x20the\x20user\x20to\x20operate\x20manually\x20on\x20the\x20platform,\x20do\x20NOT\x20retry':'';return _0x469122(0x1cc)+_0xf9a88d+'\x0a';}export function createServer(_0x289350){return new LovrabetDatasetMCPServer(_0x289350);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x13e9ad,_0x36bd50){const _0x202184=a10_0x240d,_0x20bb85=_0x13e9ad();while(!![]){try{const _0x7f18e4=parseInt(_0x202184(0x1e9))/0x1*(parseInt(_0x202184(0x1f0))/0x2)+-parseInt(_0x202184(0x1df))/0x3+parseInt(_0x202184(0x1f3))/0x4*(-parseInt(_0x202184(0x1f8))/0x5)+parseInt(_0x202184(0x1fb))/0x6*(parseInt(_0x202184(0x1ed))/0x7)+-parseInt(_0x202184(0x1e2))/0x8+-parseInt(_0x202184(0x1ea))/0x9+-parseInt(_0x202184(0x1e5))/0xa*(-parseInt(_0x202184(0x1e8))/0xb);if(_0x7f18e4===_0x36bd50)break;else _0x20bb85['push'](_0x20bb85['shift']());}catch(_0x1c2374){_0x20bb85['push'](_0x20bb85['shift']());}}}(a10_0x2cfc,0x7c66d));function a10_0x2cfc(){const _0x7a8d04=['appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','31285WkPgac','message','SQL\x20executed\x20successfully.\x20Returned\x20','14226QRoGBr','keys','now','success','UNKNOWN','1622934SiDziQ','sqlCode\x20is\x20required.\x20Get\x20it\x20from\x20list_sql_queries\x20->\x20sqlCode','Unknown\x20error','4016208YwpPLu','msg',']:\x20','15415450jCiGab','length','\x20row(s).','11QDyeBo','8ReNIfM','811998dtrBsJ','ERR','errorMsg','413xNDWNs','API\x20call\x20failed:\x20','SQL\x20execution\x20failed:\x20','20056vTAbrU','executeSql','SQL\x20execution\x20failed\x20[','76gKMtGX','execError','errorCode','isArray'];a10_0x2cfc=function(){return _0x7a8d04;};return a10_0x2cfc();}import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode}from'../config/env.js';function a10_0x240d(_0x1309df,_0x33f428){_0x1309df=_0x1309df-0x1dc;const _0x2cfc5c=a10_0x2cfc();let _0x240dac=_0x2cfc5c[_0x1309df];return _0x240dac;}export async function executeCustomSql(_0x4ac3b1){const _0x2a78f1=a10_0x240d,_0x5b08b6=Date['now'](),{appCode:appCode=getEnvAppCode(),cookie:_0x372ea0,sqlCode:_0x230752,params:_0x2d68b1}=_0x4ac3b1;if(!appCode)throw new Error(_0x2a78f1(0x1f7));if(!_0x230752||_0x230752['trim']()==='')throw new Error(_0x2a78f1(0x1e0));const _0x46caf6=new DevApiClient({'appCode':appCode,'cookie':_0x372ea0}),_0x121f06=_0x2d68b1&&Object['keys'](_0x2d68b1)['length']>0x0,_0x20105a=_0x121f06?Object[_0x2a78f1(0x1fc)](_0x2d68b1):[],_0x4ba377={'sqlCode':_0x230752,'hasParams':_0x121f06||![],'paramNames':_0x20105a||[]};try{const _0x4ba786=await _0x46caf6[_0x2a78f1(0x1f1)]({'sqlCode':_0x230752['trim'](),'params':_0x2d68b1}),_0x57ccee=Date['now']()-_0x5b08b6,_0x223b45=_0x4ba786[_0x2a78f1(0x1dd)]??![],_0x10a055=_0x4ba786[_0x2a78f1(0x1f5)];if(!_0x223b45){const _0x115c09=_0x4ba786[_0x2a78f1(0x1ec)]||_0x4ba786[_0x2a78f1(0x1e3)]||_0x2a78f1(0x1e1);return{'success':![],'execSuccess':![],'execError':_0x115c09,'errorCode':_0x10a055||_0x2a78f1(0x1de),'message':_0x2a78f1(0x1f2)+(_0x10a055||_0x2a78f1(0x1eb))+_0x2a78f1(0x1e4)+_0x115c09,'executionTime':_0x57ccee,'sqlInfo':_0x4ba377};}const _0x15b819=_0x4ba786['data']||_0x4ba786,_0x519fa1=_0x15b819['execSuccess']??_0x15b819[_0x2a78f1(0x1dd)]??!![],_0x3c38f0=_0x15b819['execResult']||_0x15b819['data'],_0x45b387=_0x15b819[_0x2a78f1(0x1f4)]||_0x15b819[_0x2a78f1(0x1ec)];if(_0x519fa1){const _0x3a764e=Array[_0x2a78f1(0x1f6)](_0x3c38f0)?_0x3c38f0[_0x2a78f1(0x1e6)]:0x0;return{'success':!![],'execSuccess':!![],'execResult':_0x3c38f0||[],'rowCount':_0x3a764e,'message':_0x2a78f1(0x1fa)+_0x3a764e+_0x2a78f1(0x1e7),'executionTime':_0x57ccee,'sqlInfo':_0x4ba377};}return{'success':!![],'execSuccess':![],'execError':_0x45b387||'SQL\x20execution\x20failed\x20without\x20error\x20message','message':_0x2a78f1(0x1ef)+(_0x45b387||_0x2a78f1(0x1e1)),'executionTime':_0x57ccee,'sqlInfo':_0x4ba377};}catch(_0x5a37da){const _0xcf78bc=Date[_0x2a78f1(0x1dc)]()-_0x5b08b6;return{'success':![],'execSuccess':![],'execError':_0x5a37da[_0x2a78f1(0x1f9)]||_0x2a78f1(0x1e1),'message':_0x2a78f1(0x1ee)+(_0x5a37da[_0x2a78f1(0x1f9)]||'Unknown\x20error'),'executionTime':_0xcf78bc,'sqlInfo':_0x4ba377};}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0x40edc6,_0x302dc1){const _0x36c5ae=a11_0x20f0,_0x24ce32=_0x40edc6();while(!![]){try{const _0x1376bc=parseInt(_0x36c5ae(0x1a7))/0x1*(-parseInt(_0x36c5ae(0x1a4))/0x2)+-parseInt(_0x36c5ae(0x1a3))/0x3+parseInt(_0x36c5ae(0x198))/0x4*(parseInt(_0x36c5ae(0x19b))/0x5)+-parseInt(_0x36c5ae(0x1a0))/0x6+parseInt(_0x36c5ae(0x1a6))/0x7*(-parseInt(_0x36c5ae(0x1b3))/0x8)+parseInt(_0x36c5ae(0x19e))/0x9+parseInt(_0x36c5ae(0x1aa))/0xa*(parseInt(_0x36c5ae(0x1a1))/0xb);if(_0x1376bc===_0x302dc1)break;else _0x24ce32['push'](_0x24ce32['shift']());}catch(_0x407064){_0x24ce32['push'](_0x24ce32['shift']());}}}(a11_0x3c60,0xd5dc1));function a11_0x20f0(_0x5e8942,_0x43f2da){_0x5e8942=_0x5e8942-0x196;const _0x3c609b=a11_0x3c60();let _0x20f099=_0x3c609b[_0x5e8942];return _0x20f099;}function a11_0x3c60(){const _0x1007f2=['appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','//\x20数据集:\x20','getModelAlias','replace','4274488NyHBcm','operationName\x20is\x20required','code','1435216lcSrvn','getTableName','datasetCode\x20is\x20required','5XSIAmz','typescript','getDatasetSDKKey','15186204gcnteG','Cannot\x20generate\x20SDK\x20code\x20for\x20operation\x20\x27','7122822wiSVJn','33297sswHSc','\x27\x20in\x20dataset\x20\x27','3401253yWsTip','2fPPcOx','getTableKey','7RvBPXP','67625CHjTqC','getFieldList','data','5790heEoKT','name','getOperationDocMeta','generateAliasExplanation','\x20|\x20数据表:\x20'];a11_0x3c60=function(){return _0x1007f2;};return a11_0x3c60();}import{DevApiClient}from'../api/dev-api-client.js';import{DrivenDataDetailPlus}from'@lovrabet/dsparser';import{getEnvAppCode,getEnvironment}from'../config/env.js';import{buildFieldRelationsMap,enrichFieldsWithRelations}from'../utils/relations.js';export async function generateSDKCode(_0x36220f){const _0x1bf72e=a11_0x20f0,{appCode:appCode=getEnvAppCode(),cookie:_0x9c4b11,datasetCode:_0x3f0af6,operationName:_0x2ed055,includeImports:includeImports=!![],useAlias:useAlias=![]}=_0x36220f;if(!appCode)throw new Error(_0x1bf72e(0x1af));if(!_0x3f0af6)throw new Error(_0x1bf72e(0x19a));if(!_0x2ed055)throw new Error(_0x1bf72e(0x196));const _0x5bb17d=new DevApiClient({'appCode':appCode,'cookie':_0x9c4b11}),_0x3a91ac=getEnvironment(),_0x51ae3c=await _0x5bb17d['getDatasetDetail'](_0x3f0af6),_0x5f2c39=_0x51ae3c[_0x1bf72e(0x1a9)]||_0x51ae3c,_0x3e9636=new DrivenDataDetailPlus(_0x5f2c39),_0x472d6b=_0x3e9636[_0x1bf72e(0x1ac)](_0x2ed055);if(!_0x472d6b)throw new Error(_0x1bf72e(0x19f)+_0x2ed055+_0x1bf72e(0x1a2)+_0x3f0af6+'\x27');const _0x543a9e=_0x3e9636[_0x1bf72e(0x19d)](),_0x35f440=_0x3e9636[_0x1bf72e(0x1b1)](),_0x552364=_0x3e9636[_0x1bf72e(0x1a5)](),_0x3932cd=_0x3e9636[_0x1bf72e(0x199)](),_0x34a500=_0x3e9636[_0x1bf72e(0x1ab)],_0x2e30ab=_0x3e9636[_0x1bf72e(0x1a8)](),_0x50a94f=_0x2e30ab?.['toJSON']?.()||[],_0x16d3cd=buildFieldRelationsMap(_0x51ae3c),_0x372098=enrichFieldsWithRelations(_0x50a94f,_0x16d3cd),_0x16f051=_0x3e9636['generateFullSDKExample'](_0x2ed055,appCode),_0x3340a1=_0x3e9636['getOperationAnalysis'](_0x2ed055);let _0x5c1fec=_0x472d6b['sdkCall'][_0x1bf72e(0x197)],_0x4cf6e4=_0x16f051||undefined;useAlias&&(_0x5c1fec=_0x5c1fec[_0x1bf72e(0x1b2)](new RegExp(_0x543a9e,'g'),_0x35f440),_0x4cf6e4&&(_0x4cf6e4=_0x4cf6e4[_0x1bf72e(0x1b2)](new RegExp(_0x543a9e,'g'),_0x35f440)));const _0x20de2b=_0x1bf72e(0x1b0)+_0x34a500+_0x1bf72e(0x1ae)+_0x3932cd+'\x0a',_0x31153e=_0x20de2b+_0x5c1fec,_0x246f4e=_0x4cf6e4?_0x1bf72e(0x1b0)+_0x34a500+'\x20|\x20数据表:\x20'+_0x3932cd+'\x0a'+_0x4cf6e4:undefined;return{'appCode':appCode,'env':_0x3a91ac,'datasetName':_0x34a500,'language':_0x1bf72e(0x19c),'code':_0x31153e,'fullExample':includeImports?_0x246f4e:undefined,'sdkCallInfo':{'modelName':_0x35f440,'tableName':_0x3932cd,'tableKey':_0x552364,'datasetCode':_0x3e9636['datasetCode'],'operationName':_0x2ed055},'fields':_0x372098,'requestExample':_0x3340a1?.['requestExample'],'responseExample':_0x3340a1?.['responseExample'],'sdkInitCode':_0x3e9636['generateSDKInitCode'](_0x552364),'usageExample':_0x472d6b['usageExample'],'aliasExplanation':useAlias?_0x3e9636[_0x1bf72e(0x1ad)]():undefined,'aliasHint':{'defaultAlias':_0x35f440,'datasetSDKKey':_0x543a9e}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x45ad2e,_0x274e8f){const _0xbf6cca=a12_0x2848,_0x3da52b=_0x45ad2e();while(!![]){try{const _0xab8946=-parseInt(_0xbf6cca(0x9c))/0x1*(-parseInt(_0xbf6cca(0xb0))/0x2)+parseInt(_0xbf6cca(0xbd))/0x3*(-parseInt(_0xbf6cca(0x98))/0x4)+parseInt(_0xbf6cca(0xb3))/0x5*(parseInt(_0xbf6cca(0xc8))/0x6)+-parseInt(_0xbf6cca(0xd0))/0x7*(parseInt(_0xbf6cca(0xab))/0x8)+-parseInt(_0xbf6cca(0x9d))/0x9*(-parseInt(_0xbf6cca(0xa0))/0xa)+parseInt(_0xbf6cca(0xaa))/0xb+-parseInt(_0xbf6cca(0x9b))/0xc;if(_0xab8946===_0x274e8f)break;else _0x3da52b['push'](_0x3da52b['shift']());}catch(_0x2c89b5){_0x3da52b['push'](_0x3da52b['shift']());}}}(a12_0x215b,0xd0724));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode,getEnvironment}from'../config/env.js';function a12_0x2848(_0x42e400,_0x1882ba){_0x42e400=_0x42e400-0x8f;const _0x215b58=a12_0x215b();let _0x2848c5=_0x215b58[_0x42e400];return _0x2848c5;}function a12_0x215b(){const _0x552cef=['Check\x20the\x20sqlCode\x20from\x20list_sql_queries\x20result\x20and\x20use\x20the\x20exact\x20value.','bff','20084wRGEry','toLowerCase','sql','32137860hSmDAs','242332njixyG','909tonCHD','\x22\x20does\x20not\x20exist.\x20Use\x20list_sql_queries\x20to\x20find\x20valid\x20SQL\x20codes.','This\x20SQL\x20requires\x20parameters:\x20','43090DIOksE','sqlCode','SDK\x20client.sql.execute()\x20returns\x20{\x20execSuccess,\x20execResult\x20}\x20—\x20always\x20check\x20execSuccess','message','sqlId','sqlCode\x20is\x20required','map','Backend\x20Function','Failed\x20to\x20verify\x20SQL\x20code:\x20','On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20—\x20use\x20try-catch','14141402bXHORY','5400GJOSRh','join','page','\x27\x20}','//\x20Backend\x20Function:\x20Execute\x20SQL\x20\x22','14lOCOwW','getCustomSqlList','date','10ugvooy','Errors\x20throw\x20exceptions\x20—\x20use\x20try-catch','length','name','\x22\x20not\x20found\x20in\x20the\x20application.','trim','{\x20sqlCode:\x20\x27','{\x0a\x20\x20sqlCode:\x20\x27','stringify','keyword','39SCDNZZ','match','find','BFF\x20context.client.sql.execute()\x20returns\x20rows\x20T[]\x20directly\x20—\x20no\x20wrapper\x20object','\x27,\x0a\x20\x20params:\x20','value','reduce','//\x20Initialize\x20the\x20SDK\x20client\x0aconst\x20client\x20=\x20new\x20LovrabetClient({\x0a\x20\x20appCode:\x20\x27','from','SQL-','Use\x20list_sql_queries\x20to\x20see\x20all\x20available\x20SQLs.','4997352kYAwnq','SQL\x20code\x20\x22','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','count','\x20code\x20for\x20SQL:\x20','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;\x0a\x0a','example','replace','15407WWcrge','time',',\x0a}','Generated\x20','includes','\x0aconst\x20data\x20=\x20await\x20client.sql.execute(','\x27,\x0a});\x0a\x0a//\x20Execute\x20SQL:\x20','This\x20SQL\x20does\x20not\x20require\x20any\x20parameters'];a12_0x215b=function(){return _0x552cef;};return a12_0x215b();}export async function generateSqlCode(_0x155411){const _0x5395f1=a12_0x2848,{appCode:appCode=getEnvAppCode(),cookie:_0x19b944,sqlCode:_0x1a9b74,params:_0x3a87f5,includeImports:includeImports=!![],target:target='sdk'}=_0x155411;if(!appCode)throw new Error(_0x5395f1(0xca));if(!_0x1a9b74||_0x1a9b74[_0x5395f1(0xb8)]()==='')return{'success':![],'sqlCode':'','sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[]},'error':_0x5395f1(0xa5)};const _0x579fa2=_0x1a9b74[_0x5395f1(0xb8)](),_0x8d8df4=new DevApiClient({'appCode':appCode,'cookie':_0x19b944}),_0x43046c=getEnvironment();try{const _0x5e6ebe=await _0x8d8df4[_0x5395f1(0xb1)]({'pageSize':0x3e7,'currentPage':0x1,'sqlCode':_0x579fa2}),_0x18dabd=_0x5e6ebe['data']?.['tableData']||[],_0x3c948d=_0x18dabd[_0x5395f1(0xbf)](_0x15f833=>_0x15f833['sqlCode']===_0x579fa2||_0x15f833[_0x5395f1(0xa1)]?.['includes'](_0x579fa2)||_0x579fa2[_0x5395f1(0x92)](_0x15f833[_0x5395f1(0xa1)]));if(!_0x3c948d)return{'success':![],'sqlCode':_0x579fa2,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x5395f1(0xc9)+_0x579fa2+_0x5395f1(0xb7),'Use\x20list_sql_queries\x20to\x20see\x20all\x20available\x20SQLs.',_0x5395f1(0x96)]},'error':_0x5395f1(0xc9)+_0x579fa2+_0x5395f1(0x9e)};const _0x5287c6=_0x3c948d[_0x5395f1(0xa1)],_0x384918=_0x3c948d['sqlName']||_0x3c948d[_0x5395f1(0xb6)]||_0x5395f1(0xc6)+(_0x3c948d[_0x5395f1(0xa4)]||_0x3c948d['id']),_0x55ec69=_0x3c948d['sqlContent']||_0x3c948d[_0x5395f1(0x9a)]||'',_0x59b6fc=_0x55ec69[_0x5395f1(0xbe)](/[:$]\{?(\w+)\}?/g);let _0x591a7a,_0x3718fd;if(_0x59b6fc){const _0x303737=Array[_0x5395f1(0xc5)](new Set(_0x59b6fc['map'](_0x5aeb5=>_0x5aeb5[_0x5395f1(0xcf)](/[:${}]/g,''))));_0x591a7a=_0x303737[_0x5395f1(0xa6)](_0x37d8b9=>{const _0x3f378f=_0x3a87f5?.[_0x37d8b9]??getDefaultExample(_0x37d8b9);return{'name':_0x37d8b9,'example':_0x3f378f};}),_0x3718fd=_0x591a7a[_0x5395f1(0xc3)]((_0xa5a7cf,_0x696af6)=>({..._0xa5a7cf,[_0x696af6['name']]:_0x696af6[_0x5395f1(0xce)]}),{});}else _0x3a87f5&&(_0x591a7a=Object['entries'](_0x3a87f5)[_0x5395f1(0xa6)](([_0x47ba61,_0x15653e])=>({'name':_0x47ba61,'example':_0x15653e})),_0x3718fd=_0x3a87f5);const _0x3886b3=_0x591a7a&&_0x591a7a[_0x5395f1(0xb5)]>0x0,_0x8e0467=_0x3886b3?JSON[_0x5395f1(0xbb)](_0x3718fd,null,0x2):'',_0x2d9528=_0x3886b3?_0x5395f1(0xba)+_0x5287c6+_0x5395f1(0xc1)+_0x8e0467+_0x5395f1(0x90):_0x5395f1(0xb9)+_0x5287c6+_0x5395f1(0xae);let _0x5f3d6f;target==='bff'?_0x5f3d6f=_0x5395f1(0xaf)+_0x384918+'\x22\x0aexport\x20default\x20async\x20function(params,\x20context)\x20{\x0a\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute('+_0x2d9528+');\x0a\x0a\x20\x20//\x20rows\x20is\x20T[]\x20directly\x20—\x20no\x20wrapper,\x20errors\x20throw\x20exceptions\x0a\x20\x20console.log(`Retrieved\x20${rows.length}\x20rows`);\x0a\x0a\x20\x20return\x20{\x20data:\x20rows\x20};\x0a}':_0x5f3d6f=(includeImports?_0x5395f1(0xcd):'')+_0x5395f1(0xc4)+appCode+'\x27,\x0a\x20\x20env:\x20\x27'+_0x43046c+_0x5395f1(0x94)+_0x384918+_0x5395f1(0x93)+_0x2d9528+');\x0a\x0a//\x20IMPORTANT:\x20SDK\x20returns\x20wrapper\x20—\x20check\x20execSuccess\x20before\x20using\x20results\x0aif\x20(!data.execSuccess)\x20{\x0a\x20\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\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});';const _0x5c63d5=target===_0x5395f1(0x97);return{'success':!![],'sqlCode':_0x5287c6,'sqlName':_0x384918,'sqlExists':!![],'code':_0x5f3d6f,'parameters':_0x591a7a,'usage':{'description':_0x5395f1(0x91)+(_0x5c63d5?_0x5395f1(0xa7):'Frontend\x20SDK')+_0x5395f1(0xcc)+_0x384918,'important':[_0x5395f1(0xc9)+_0x5287c6+'\x22\x20exists\x20and\x20is\x20valid.',_0x5c63d5?_0x5395f1(0xc0):_0x5395f1(0xa2),_0x5c63d5?_0x5395f1(0xb4):_0x5395f1(0xa9),_0x3886b3?_0x5395f1(0x9f)+_0x591a7a[_0x5395f1(0xa6)](_0x5ec488=>_0x5ec488[_0x5395f1(0xb6)])[_0x5395f1(0xac)](',\x20'):_0x5395f1(0x95),'Note:\x20client.api.executeSql()\x20is\x20deprecated.\x20Use\x20client.sql.execute()\x20instead.']}};}catch(_0x38c772){return{'success':![],'sqlCode':_0x579fa2,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x5395f1(0xa8)+_0x38c772['message'],_0x5395f1(0xc7)]},'error':_0x5395f1(0xa8)+_0x38c772[_0x5395f1(0xa3)]};}}function getDefaultExample(_0x2b1bb8){const _0x332698=a12_0x2848,_0x268585=_0x2b1bb8[_0x332698(0x99)]();if(_0x268585['includes'](_0x332698(0xb2))||_0x268585['includes'](_0x332698(0x8f)))return'2024-01-01';if(_0x268585[_0x332698(0x92)]('id'))return 0x7b;if(_0x268585[_0x332698(0x92)]('limit')||_0x268585['includes'](_0x332698(0xcb))||_0x268585[_0x332698(0x92)]('size'))return 0xa;if(_0x268585[_0x332698(0x92)](_0x332698(0xad)))return 0x1;if(_0x268585['includes'](_0x332698(0xbc))||_0x268585[_0x332698(0x92)]('search')||_0x268585[_0x332698(0x92)](_0x332698(0xb6)))return _0x332698(0xce);if(_0x268585[_0x332698(0x92)]('status'))return 0x1;return _0x332698(0xc2);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2c39c2,_0x1b9b34){const _0x2f3a6e=a13_0xebfc,_0x27d4a9=_0x2c39c2();while(!![]){try{const _0x399f3d=-parseInt(_0x2f3a6e(0x1a1))/0x1+parseInt(_0x2f3a6e(0x1a8))/0x2*(parseInt(_0x2f3a6e(0x1a6))/0x3)+parseInt(_0x2f3a6e(0x1ac))/0x4*(-parseInt(_0x2f3a6e(0x1a9))/0x5)+parseInt(_0x2f3a6e(0x1ab))/0x6*(-parseInt(_0x2f3a6e(0x1a5))/0x7)+-parseInt(_0x2f3a6e(0x1a3))/0x8+-parseInt(_0x2f3a6e(0x1ad))/0x9*(parseInt(_0x2f3a6e(0x1a4))/0xa)+parseInt(_0x2f3a6e(0x1aa))/0xb;if(_0x399f3d===_0x1b9b34)break;else _0x27d4a9['push'](_0x27d4a9['shift']());}catch(_0x3d5a5e){_0x27d4a9['push'](_0x27d4a9['shift']());}}}(a13_0x30a1,0x985b4));function a13_0x30a1(){const _0x51ce4d=['Failed\x20to\x20fetch\x20Backend\x20Function\x20script\x20info\x20for\x20id:\x20','387529dWhjGo','id\x20is\x20required\x20and\x20must\x20be\x20a\x20positive\x20number.\x20Get\x20it\x20from\x20list_bff_scripts.','116936CbPkxU','3519500xdrVdL','35413zEPgEy','3QAEoDU','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','1690546qkCmzv','5djEtiy','23706705OgWabS','894EURhDW','3473956RNpFPe','9NTBPwk','data'];a13_0x30a1=function(){return _0x51ce4d;};return a13_0x30a1();}import{DevApiClient}from'../api/dev-api-client.js';function a13_0xebfc(_0x2f1f15,_0x32c758){_0x2f1f15=_0x2f1f15-0x1a1;const _0x30a14a=a13_0x30a1();let _0xebfc60=_0x30a14a[_0x2f1f15];return _0xebfc60;}import{getEnvAppCode}from'../config/env.js';export async function getBffScriptInfo(_0x311766){const _0x12dfb3=a13_0xebfc,{appCode:appCode=getEnvAppCode(),cookie:_0x172548,id:_0x57903e}=_0x311766;if(!appCode)throw new Error(_0x12dfb3(0x1a7));if(!_0x57903e||_0x57903e<=0x0)throw new Error(_0x12dfb3(0x1a2));const _0x436afd=new DevApiClient({'appCode':appCode,'cookie':_0x172548}),_0x5ebb9e=await _0x436afd['getBffScriptInfo'](_0x57903e);if(!_0x5ebb9e['success']||!_0x5ebb9e[_0x12dfb3(0x1ae)])return{'success':![],'message':_0x12dfb3(0x1af)+_0x57903e};return{'success':!![],'script':_0x5ebb9e[_0x12dfb3(0x1ae)]};}
|