@lovrabet/dataset-mcp-server 1.4.1-beta.0 → 1.4.2-beta.0
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
|
+
function a0_0x4bda(){const _0x32abf9=['5428276GWZUxH','1303231vEuvyZ','731784fRKHcP','from','105thxRPf','defaultTTL','9aeYgMh','floor','keys','1077016HYFjOo','10RTtElu','clear','get','delete','9463832EspNUe','cache','1521003vUBmix','getStats','data','now','83976AiccuB','size','3DqabqT','set'];a0_0x4bda=function(){return _0x32abf9;};return a0_0x4bda();}const a0_0x5b5677=a0_0x22d3;(function(_0x581847,_0xfc240a){const _0x43c590=a0_0x22d3,_0x435a1b=_0x581847();while(!![]){try{const _0x1cb9b9=parseInt(_0x43c590(0x141))/0x1+-parseInt(_0x43c590(0x149))/0x2*(parseInt(_0x43c590(0x13e))/0x3)+parseInt(_0x43c590(0x142))/0x4+parseInt(_0x43c590(0x144))/0x5*(parseInt(_0x43c590(0x13c))/0x6)+parseInt(_0x43c590(0x140))/0x7+parseInt(_0x43c590(0x136))/0x8*(-parseInt(_0x43c590(0x146))/0x9)+parseInt(_0x43c590(0x14a))/0xa*(-parseInt(_0x43c590(0x138))/0xb);if(_0x1cb9b9===_0xfc240a)break;else _0x435a1b['push'](_0x435a1b['shift']());}catch(_0x5a87ad){_0x435a1b['push'](_0x435a1b['shift']());}}}(a0_0x4bda,0xa9df9));export class SimpleCache{['cache']=new Map();[a0_0x5b5677(0x145)];constructor(_0x2c6c00=0x5){this['defaultTTL']=_0x2c6c00*0x3c*0x3e8;}[a0_0x5b5677(0x14c)](_0x3d11aa){const _0x27a40a=a0_0x5b5677,_0xd73db5=this[_0x27a40a(0x137)][_0x27a40a(0x14c)](_0x3d11aa);if(!_0xd73db5)return null;const _0x1e6394=Date[_0x27a40a(0x13b)](),_0x560cc6=_0x1e6394-_0xd73db5['timestamp'];if(_0x560cc6>this[_0x27a40a(0x145)])return this['cache'][_0x27a40a(0x135)](_0x3d11aa),null;const _0xacb97c=Math[_0x27a40a(0x147)](_0x560cc6/0x3e8);return _0xd73db5[_0x27a40a(0x13a)];}['set'](_0x533a6f,_0x1c42ef){const _0xf638fe=a0_0x5b5677;this[_0xf638fe(0x137)][_0xf638fe(0x13f)](_0x533a6f,{'data':_0x1c42ef,'timestamp':Date[_0xf638fe(0x13b)]()});}[a0_0x5b5677(0x14b)](_0x3f0ec9){const _0x28cb8e=a0_0x5b5677;_0x3f0ec9?this[_0x28cb8e(0x137)][_0x28cb8e(0x135)](_0x3f0ec9):this['cache'][_0x28cb8e(0x14b)]();}[a0_0x5b5677(0x139)](){const _0x2b0a3a=a0_0x5b5677;return{'size':this[_0x2b0a3a(0x137)][_0x2b0a3a(0x13d)],'ttlMinutes':this[_0x2b0a3a(0x145)]/0xea60,'entries':Array[_0x2b0a3a(0x143)](this[_0x2b0a3a(0x137)][_0x2b0a3a(0x148)]())};}}function a0_0x22d3(_0x95de43,_0x356a1f){_0x95de43=_0x95de43-0x135;const _0x4bdaa6=a0_0x4bda();let _0x22d3a3=_0x4bdaa6[_0x95de43];return _0x22d3a3;}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
|
+
function a1_0x5100(_0x439486,_0x2ec0ca){_0x439486=_0x439486-0x1e4;const _0x48b602=a1_0x48b6();let _0x510083=_0x48b602[_0x439486];return _0x510083;}const a1_0x1cbc9e=a1_0x5100;(function(_0x1c874b,_0x42ebb9){const _0x8ffff9=a1_0x5100,_0x139d4c=_0x1c874b();while(!![]){try{const _0x2b6519=-parseInt(_0x8ffff9(0x24a))/0x1*(-parseInt(_0x8ffff9(0x25a))/0x2)+parseInt(_0x8ffff9(0x246))/0x3*(parseInt(_0x8ffff9(0x221))/0x4)+-parseInt(_0x8ffff9(0x229))/0x5+parseInt(_0x8ffff9(0x232))/0x6+parseInt(_0x8ffff9(0x20d))/0x7*(-parseInt(_0x8ffff9(0x254))/0x8)+-parseInt(_0x8ffff9(0x216))/0x9*(-parseInt(_0x8ffff9(0x1fe))/0xa)+-parseInt(_0x8ffff9(0x248))/0xb;if(_0x2b6519===_0x42ebb9)break;else _0x139d4c['push'](_0x139d4c['shift']());}catch(_0x33e7ce){_0x139d4c['push'](_0x139d4c['shift']());}}}(a1_0x48b6,0x9d5ad));function a1_0x48b6(){const _0x524509=['doVersion','process','env','apiBaseUrl','sqlName','[getDatasetDetail]\x20Failed\x20to\x20fetch\x20relations\x20for\x20','appCode','forceRefresh','dbtableConfig','length','set','find','from','getDatasetDetail','pathname','warn','API\x20error:\x20','2193KPsciC','postRequest','13855710KMmdNj','clearBffScriptCache','7ztbmwt','name','joinType','test','Failed\x20to\x20get\x20ER\x20config\x20for\x20dblinkId:\x20','updateUserCustomSql','save-bff','POST','includes','/smartapi/custom/updateUserCustomSql','4089632AHzMIC','meta','add','/smartapi/dataset/get-dataset-list','API\x20request\x20timeout\x20after\x20','getDatasetRelations','138838vNXPCJ','no-relations','runtimeDomain','/smartapi/custom/saveUserCustomSql','cookie','&type=ENDPOINT','get','toolboxBaseUrl','data','mcp:vibe','datasets','toDataset','object','getUniqueDbIds','success','toLowerCase','LOVRABET_ENV','with-relations','description','isArray','getCustomSqlList','code','tableName','er-config:','message','sort','Failed\x20to\x20get\x20ER\x20config\x20for\x20dbId\x20','70Tzmqod','/api/custom/executeSql','dataset-list:','GET','getBffScriptInfo','text','apiDomain','errorMsg','signal','\x0aURL:\x20','AbortError','request','Content-Type','NODE_ENV','Unknown\x20error','7FbmjcV','/api/management/library/scripts/info?id=','fromField','relations','Network\x20error:\x20Unable\x20to\x20connect\x20to\x20the\x20server.\x20Please\x20check\x20your\x20network\x20connection\x20or\x20the\x20server\x20may\x20be\x20down.\x0aURL:\x20','getAllErConfigs','modelCode','executeSql','application/json','893115CYVGdJ','abort','datasetCode','/smartapi/custom/queryUserCustomSqlList','currentPage','params','/smartapi/dataset/get-driven-data?','dbId','/api/management/library/scripts/list?appCode=','/api/node-toolbox/bff/save','status','1388ZiqXqz','DEFAULT_TIMEOUT','sqlContent','toField','datasetName','runtimeBaseUrl','API\x20request\x20failed:\x20HTTP\x20','scriptContent','428150AgYmQW','push','tableData','toolboxBaseUrlOverride','sqlCode','resolveToolboxUrl','saveUserCustomSql','filter','stringify','6400404AkklNu','getDatasetList','_request'];a1_0x48b6=function(){return _0x524509;};return a1_0x48b6();}import{getCookie}from'../auth/cookie-manager.js';import{getEffectiveApiDomain,getEffectiveRuntimeDomain,resolveApiBaseUrl}from'../auth/constants.js';import{apiCache}from'./cache.js';export class DevApiClient{[a1_0x1cbc9e(0x23b)];[a1_0x1cbc9e(0x237)];['cookie'];['apiDomain'];[a1_0x1cbc9e(0x1e5)];[a1_0x1cbc9e(0x22c)];constructor(_0x3fdb1c){const _0x5c8569=a1_0x1cbc9e;this[_0x5c8569(0x23b)]=_0x3fdb1c[_0x5c8569(0x23b)],this['env']=globalThis[_0x5c8569(0x236)]?.[_0x5c8569(0x237)]?.[_0x5c8569(0x1f3)]||'online',this['cookie']=_0x3fdb1c[_0x5c8569(0x1e7)]||getCookie(),this[_0x5c8569(0x204)]=_0x3fdb1c[_0x5c8569(0x238)]||getEffectiveApiDomain(),this['runtimeDomain']=_0x3fdb1c[_0x5c8569(0x226)]||getEffectiveRuntimeDomain(),this[_0x5c8569(0x22c)]=_0x3fdb1c[_0x5c8569(0x1ea)];if(!this['cookie'])throw new Error('No\x20authentication\x20cookie\x20found.\x20Please\x20login\x20first.');}['resolveToolboxUrl'](_0x1c3f47,_0x4da2d3){const _0x2c8907=a1_0x1cbc9e,_0x46ef41=resolveApiBaseUrl(_0x1c3f47),_0x353c63=this[_0x2c8907(0x22c)]&&_0x46ef41===getEffectiveApiDomain()?this[_0x2c8907(0x22c)]:_0x46ef41;try{const _0x4c2faf=new URL(_0x353c63);if(_0x4c2faf[_0x2c8907(0x243)]!=='/')return _0x353c63;}catch{}return''+_0x353c63+_0x4da2d3;}static [a1_0x1cbc9e(0x222)]=0x7530;async[a1_0x1cbc9e(0x234)](_0x46ab17,_0xcec151={},_0x579a1a=DevApiClient[a1_0x1cbc9e(0x222)]){const _0x4787c5=a1_0x1cbc9e,{method:method=_0x4787c5(0x201),body:_0x195afb,extraHeaders:_0x4443a7}=_0xcec151,_0x47b285=new AbortController(),_0x4fcb37=setTimeout(()=>_0x47b285[_0x4787c5(0x217)](),_0x579a1a),_0x184af9={'Cookie':this[_0x4787c5(0x1e7)],'X-Invoke-Source':_0x4787c5(0x1ec),..._0x4443a7};method===_0x4787c5(0x251)&&(_0x184af9[_0x4787c5(0x20a)]=_0x4787c5(0x215));try{const _0x19a731=await fetch(_0x46ab17,{'method':method,'headers':_0x184af9,..._0x195afb!==undefined&&{'body':JSON[_0x4787c5(0x231)](_0x195afb)},'signal':_0x47b285[_0x4787c5(0x206)]});clearTimeout(_0x4fcb37);if(!_0x19a731['ok']){if(_0x19a731[_0x4787c5(0x220)]===0x191)throw new Error('Authentication\x20failed.\x20Please\x20login\x20again.');let _0x1ba070='';try{_0x1ba070=await _0x19a731[_0x4787c5(0x203)]();}catch{}throw new Error(_0x4787c5(0x227)+_0x19a731[_0x4787c5(0x220)]+_0x4787c5(0x207)+_0x46ab17+(_0x1ba070?'\x0a'+_0x1ba070:''));}const _0x189d27=await _0x19a731['json']();if(_0x189d27&&typeof _0x189d27===_0x4787c5(0x1ef)&&_0x4787c5(0x1f1)in _0x189d27&&!_0x189d27[_0x4787c5(0x1f1)]){const _0x42cb00=_0x189d27;throw new Error(_0x4787c5(0x245)+(_0x42cb00[_0x4787c5(0x1fb)]||_0x42cb00[_0x4787c5(0x205)]||_0x4787c5(0x20c)));}return _0x189d27;}catch(_0x5000a1){if(_0x5000a1 instanceof Error&&_0x5000a1[_0x4787c5(0x24b)]===_0x4787c5(0x208))throw new Error(_0x4787c5(0x258)+_0x579a1a+'ms.\x20The\x20server\x20may\x20be\x20down\x20or\x20unreachable.\x0aURL:\x20'+_0x46ab17);if(_0x5000a1 instanceof TypeError)throw new Error(_0x4787c5(0x211)+_0x46ab17);throw _0x5000a1;}}async[a1_0x1cbc9e(0x209)](_0x5bb3f4,_0x2d5736){const _0x494775=a1_0x1cbc9e;return this[_0x494775(0x234)](_0x5bb3f4,{'method':_0x494775(0x201)},_0x2d5736);}async[a1_0x1cbc9e(0x247)](_0x5902cf,_0x117dca,_0x5cdca6,_0x5996d3){const _0x4d24ad=a1_0x1cbc9e;return this['_request'](_0x5902cf,{'method':_0x4d24ad(0x251),'body':_0x117dca,'extraHeaders':_0x5996d3},_0x5cdca6);}async[a1_0x1cbc9e(0x233)](_0x16aa0d){const _0x355128=a1_0x1cbc9e,_0x5f43cd=_0x16aa0d?.[_0x355128(0x23c)]||![],_0x12514f=_0x355128(0x200)+this[_0x355128(0x23b)]+':'+this[_0x355128(0x237)];if(!_0x5f43cd){const _0x535382=apiCache['get'](_0x12514f);if(_0x535382)return _0x535382;}const _0x52dc7e=this[_0x355128(0x204)]+_0x355128(0x257),_0x34fb9a=await this[_0x355128(0x247)](_0x52dc7e,{'appCode':this[_0x355128(0x23b)]});return apiCache[_0x355128(0x23f)](_0x12514f,_0x34fb9a),_0x34fb9a;}async[a1_0x1cbc9e(0x242)](_0x3c0c97,_0x560c12=![],_0x33d44c=![]){const _0x5acf3b=a1_0x1cbc9e,_0x575429='dataset-detail:'+this['appCode']+':'+this['env']+':'+_0x3c0c97+':'+(_0x33d44c?_0x5acf3b(0x1f4):_0x5acf3b(0x1e4));if(!_0x560c12){const _0x5c9dd2=apiCache[_0x5acf3b(0x1e9)](_0x575429);if(_0x5c9dd2)return _0x5c9dd2;}const _0x18532a=/^\d+$/[_0x5acf3b(0x24d)](_0x3c0c97),_0x244c73=_0x18532a?'id':_0x5acf3b(0x1f8),_0x5f204c=this[_0x5acf3b(0x204)]+_0x5acf3b(0x21c)+_0x244c73+'='+_0x3c0c97,_0x64233e=await this[_0x5acf3b(0x209)](_0x5f204c);if(_0x33d44c&&_0x64233e[_0x5acf3b(0x1eb)]?.[_0x5acf3b(0x213)]){const _0x597431=_0x64233e[_0x5acf3b(0x1eb)][_0x5acf3b(0x235)]==='v2',_0x4548c3=Array[_0x5acf3b(0x1f6)](_0x64233e[_0x5acf3b(0x1eb)][_0x5acf3b(0x210)]);if(!_0x597431||!_0x4548c3)try{const _0x3ca84c=await this[_0x5acf3b(0x259)](_0x64233e['data'][_0x5acf3b(0x213)],_0x560c12);_0x64233e[_0x5acf3b(0x1eb)]['relations']=_0x3ca84c;}catch(_0x412099){process['env'][_0x5acf3b(0x20b)]!==_0x5acf3b(0x24d)&&console['warn'](_0x5acf3b(0x23a)+_0x3c0c97+':',_0x412099);}}return apiCache[_0x5acf3b(0x23f)](_0x575429,_0x64233e),_0x64233e;}async['searchDatasets'](_0x33b4d9){const _0x1d9e54=a1_0x1cbc9e,_0x51aae0=await this[_0x1d9e54(0x233)](),_0x3c9aea=Array[_0x1d9e54(0x1f6)](_0x51aae0[_0x1d9e54(0x1eb)])?_0x51aae0[_0x1d9e54(0x1eb)]:_0x51aae0[_0x1d9e54(0x1eb)]?.['tableData']||[];if(!_0x51aae0[_0x1d9e54(0x1f1)])return{'success':!![],'data':{'tableData':[]}};const _0x256b47=_0x3c9aea[_0x1d9e54(0x230)](_0x19cbf0=>{const _0x30de4f=_0x1d9e54,_0x1f4039=_0x33b4d9[_0x30de4f(0x1f2)]();return _0x19cbf0['name']?.[_0x30de4f(0x1f2)]()[_0x30de4f(0x252)](_0x1f4039)||_0x19cbf0[_0x30de4f(0x1f8)]?.[_0x30de4f(0x1f2)]()[_0x30de4f(0x252)](_0x1f4039)||_0x19cbf0['dbtableConfig']?.[_0x30de4f(0x1f9)]?.[_0x30de4f(0x1f2)]()[_0x30de4f(0x252)](_0x1f4039)||_0x19cbf0[_0x30de4f(0x1f5)]?.[_0x30de4f(0x1f2)]()[_0x30de4f(0x252)](_0x1f4039);});return{'success':!![],'data':{'tableData':_0x256b47,'paging':{'totalCount':_0x256b47[_0x1d9e54(0x23e)],'currentPage':0x1,'pageSize':_0x256b47[_0x1d9e54(0x23e)]}}};}async[a1_0x1cbc9e(0x1f7)](_0x5627b1){const _0xd49b8a=a1_0x1cbc9e,_0x59e99c=_0x5627b1?.[_0xd49b8a(0x21a)]||0x1,_0x5c1519=_0x5627b1?.['pageSize']||0x3e7,_0x240e9d=this[_0xd49b8a(0x204)]+_0xd49b8a(0x219),_0x4e64d4={'appCode':this[_0xd49b8a(0x23b)],'currentPage':_0x59e99c,'pageSize':_0x5c1519,..._0x5627b1?.['sqlCode']&&{'sqlCode':_0x5627b1[_0xd49b8a(0x22d)]},..._0x5627b1?.[_0xd49b8a(0x239)]&&{'sqlName':_0x5627b1[_0xd49b8a(0x239)]}},_0x1522c2=await this[_0xd49b8a(0x247)](_0x240e9d,_0x4e64d4);return _0x1522c2;}async[a1_0x1cbc9e(0x214)](_0x2c8a24){const _0x15696e=a1_0x1cbc9e,_0x313326=this[_0x15696e(0x1e5)]+_0x15696e(0x1ff),_0x3013e0={'appCode':this[_0x15696e(0x23b)],'sqlCode':_0x2c8a24['sqlCode'],..._0x2c8a24[_0x15696e(0x21b)]&&{'params':_0x2c8a24[_0x15696e(0x21b)]}};return await this[_0x15696e(0x247)](_0x313326,_0x3013e0);}async[a1_0x1cbc9e(0x22f)](_0x54bc11){const _0x51c047=a1_0x1cbc9e,_0x501e47=this['apiDomain']+_0x51c047(0x1e6),_0x5eacbb={'sqlName':_0x54bc11[_0x51c047(0x239)],'dbId':_0x54bc11[_0x51c047(0x21d)],'sqlContent':_0x54bc11[_0x51c047(0x223)],'appCode':this[_0x51c047(0x23b)]};return await this['postRequest'](_0x501e47,_0x5eacbb);}async[a1_0x1cbc9e(0x24f)](_0x13bb4d){const _0x53b419=a1_0x1cbc9e,_0xdd6566=this[_0x53b419(0x204)]+_0x53b419(0x253),_0xb90732={'id':_0x13bb4d['id'],'dbId':_0x13bb4d[_0x53b419(0x21d)],'sqlName':_0x13bb4d[_0x53b419(0x239)],'appCode':this[_0x53b419(0x23b)],'sqlContent':_0x13bb4d[_0x53b419(0x223)]};return await this[_0x53b419(0x247)](_0xdd6566,_0xb90732);}async['getErConfig'](_0xfafac9,_0x24768c=![]){const _0x51cabb=a1_0x1cbc9e,_0x327115=_0x51cabb(0x1fa)+this[_0x51cabb(0x23b)]+':'+this[_0x51cabb(0x237)]+':'+_0xfafac9;if(!_0x24768c){const _0x3e619a=apiCache[_0x51cabb(0x1e9)](_0x327115);if(_0x3e619a)return _0x3e619a;}const _0x2246e8=this[_0x51cabb(0x204)]+'/smartapi/question/er-config',_0x1531f3=await this['postRequest'](_0x2246e8,{'dblinkId':_0xfafac9,'appCode':this[_0x51cabb(0x23b)]});if(!_0x1531f3['success']||!_0x1531f3['data'])throw new Error(_0x51cabb(0x24e)+_0xfafac9);const _0x1bf5a9={'meta':_0x1531f3['data'][_0x51cabb(0x255)],'datasets':_0x1531f3['data'][_0x51cabb(0x1ed)]};return apiCache[_0x51cabb(0x23f)](_0x327115,_0x1bf5a9),_0x1bf5a9;}async[a1_0x1cbc9e(0x1f0)](_0x3bee20=![]){const _0x2b0fe6=a1_0x1cbc9e,_0x545058=await this[_0x2b0fe6(0x233)]({'forceRefresh':_0x3bee20}),_0x530ef6=Array[_0x2b0fe6(0x1f6)](_0x545058[_0x2b0fe6(0x1eb)])?_0x545058[_0x2b0fe6(0x1eb)]:_0x545058['data']?.[_0x2b0fe6(0x22b)]||[],_0x168d79=new Set();for(const _0x242c90 of _0x530ef6){_0x242c90[_0x2b0fe6(0x23d)]?.['dbId']&&_0x168d79[_0x2b0fe6(0x256)](_0x242c90[_0x2b0fe6(0x23d)][_0x2b0fe6(0x21d)]);}return Array[_0x2b0fe6(0x241)](_0x168d79)[_0x2b0fe6(0x1fc)]((_0x290235,_0x135fb5)=>_0x290235-_0x135fb5);}async[a1_0x1cbc9e(0x212)](_0x2d04d2=![]){const _0x2db7c1=a1_0x1cbc9e,_0x3c3d54='er-configs-all:'+this['appCode']+':'+this[_0x2db7c1(0x237)];if(!_0x2d04d2){const _0x55631b=apiCache[_0x2db7c1(0x1e9)](_0x3c3d54);if(_0x55631b)return _0x55631b;}const _0x82fc8e=await this['getUniqueDbIds'](_0x2d04d2),_0x1e1d84=new Map();for(const _0x2a6b43 of _0x82fc8e){try{const _0x23fd3b=await this['getErConfig'](_0x2a6b43,_0x2d04d2);_0x1e1d84[_0x2db7c1(0x23f)](_0x2a6b43,_0x23fd3b);}catch(_0x446554){console[_0x2db7c1(0x244)](_0x2db7c1(0x1fd)+_0x2a6b43+':',_0x446554);}}return apiCache[_0x2db7c1(0x23f)](_0x3c3d54,_0x1e1d84),_0x1e1d84;}async[a1_0x1cbc9e(0x259)](_0x7db775,_0x1a9dae=![]){const _0x2d2df3=a1_0x1cbc9e,_0x5e6626=await this[_0x2d2df3(0x212)](_0x1a9dae),_0x2dcf90=[],_0x320832=[];for(const [,_0x534970]of _0x5e6626){const _0xea9007=_0x534970['datasets'][_0x2d2df3(0x240)](_0x35d6cd=>_0x35d6cd['datasetCode']===_0x7db775);if(_0xea9007)for(const _0x3dfc12 of _0xea9007[_0x2d2df3(0x210)]||[]){_0x2dcf90['push']({'toDataset':_0x3dfc12['toDataset'],'toDatasetName':_0x3dfc12['toDatasetName'],'toField':_0x3dfc12[_0x2d2df3(0x224)],'fromField':_0x3dfc12[_0x2d2df3(0x20f)],'joinType':_0x3dfc12['joinType']});}for(const _0x4ff223 of _0x534970['datasets']){if(_0x4ff223[_0x2d2df3(0x218)]===_0x7db775)continue;for(const _0x5ac720 of _0x4ff223[_0x2d2df3(0x210)]||[]){_0x5ac720[_0x2d2df3(0x1ee)]===_0x7db775&&_0x320832[_0x2d2df3(0x22a)]({'fromDataset':_0x4ff223['datasetCode'],'fromDatasetName':_0x4ff223[_0x2d2df3(0x225)],'fromField':_0x5ac720[_0x2d2df3(0x20f)],'toField':_0x5ac720['toField'],'joinType':_0x5ac720[_0x2d2df3(0x24c)]});}}}return{'outgoing':_0x2dcf90,'incoming':_0x320832};}async['getBffScriptList'](){const _0x473bd=a1_0x1cbc9e,_0x5eabd=this[_0x473bd(0x204)]+_0x473bd(0x21e)+encodeURIComponent(this[_0x473bd(0x23b)])+_0x473bd(0x1e8);return await this[_0x473bd(0x209)](_0x5eabd);}async[a1_0x1cbc9e(0x202)](_0x59e697){const _0x22d3c7=a1_0x1cbc9e,_0x2b2b2f=this[_0x22d3c7(0x204)]+_0x22d3c7(0x20e)+_0x59e697;return await this[_0x22d3c7(0x209)](_0x2b2b2f);}async['saveBffScript'](_0x334795){const _0x2a7392=a1_0x1cbc9e,_0x4f10dc=this[_0x2a7392(0x204)]+'/api/management/library/scripts/save',_0x2b809a={'id':_0x334795['id']??null,'appCode':_0x334795[_0x2a7392(0x23b)],'description':_0x334795['description'],'scriptContent':_0x334795[_0x2a7392(0x228)],'scriptType':_0x334795['scriptType']};return await this[_0x2a7392(0x247)](_0x4f10dc,_0x2b809a);}async[a1_0x1cbc9e(0x249)](){const _0x248132=a1_0x1cbc9e,_0x58f625=this[_0x248132(0x1e5)]+'/api/management/script/cache/clear';return await this[_0x248132(0x247)](_0x58f625,{});}async['saveCustomSqlViaToolbox'](_0x4d280a){const _0x2980f2=a1_0x1cbc9e,_0x24bc45=this[_0x2980f2(0x22e)]('save-sql','/api/node-toolbox/sql/save'),_0x6c51b4=await this[_0x2980f2(0x247)](_0x24bc45,_0x4d280a);return _0x6c51b4[_0x2980f2(0x1eb)];}async['saveBffScriptViaToolbox'](_0x470d38){const _0x5c101e=a1_0x1cbc9e,_0x575529=this[_0x5c101e(0x22e)](_0x5c101e(0x250),_0x5c101e(0x21f)),_0x2ea15f=await this['postRequest'](_0x575529,_0x470d38);return _0x2ea15f[_0x5c101e(0x1eb)];}}
|
package/dist/auth/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a2_0x4965(){var _0x49d189=['24EIholJ','4878769shJYjI','678yxkKBq','17885120kddUga','162063YyUpjL','424392KWarMm','45424LTWRUS','805869GnemWV','14teaTrJ','46310ERlqCa'];a2_0x4965=function(){return _0x49d189;};return a2_0x4965();}function a2_0x5b7a(_0x55efcb,_0x37dd34){_0x55efcb=_0x55efcb-0x87;var _0x4965da=a2_0x4965();var _0x5b7ae6=_0x4965da[_0x55efcb];return _0x5b7ae6;}(function(_0x1fe67a,_0x557a41){var _0x5639df=a2_0x5b7a,_0x25b812=_0x1fe67a();while(!![]){try{var _0x2c6377=parseInt(_0x5639df(0x88))/0x1+parseInt(_0x5639df(0x8a))/0x2*(parseInt(_0x5639df(0x90))/0x3)+-parseInt(_0x5639df(0x87))/0x4+parseInt(_0x5639df(0x8b))/0x5*(parseInt(_0x5639df(0x8e))/0x6)+parseInt(_0x5639df(0x8d))/0x7+parseInt(_0x5639df(0x8c))/0x8*(parseInt(_0x5639df(0x89))/0x9)+-parseInt(_0x5639df(0x8f))/0xa;if(_0x2c6377===_0x557a41)break;else _0x25b812['push'](_0x25b812['shift']());}catch(_0x17bba8){_0x25b812['push'](_0x25b812['shift']());}}}(a2_0x4965,0x841e5));export{getEnvAppCode,getEnvironment,getEnvApiBaseUrl,getEnvRuntimeBaseUrl,getEnvUserBaseUrl,getEnvAuthCookie,configDir,cookieFile,defaultConfig,getEnvAppCodeWithFallback,getApiDomain,getUserDomain,getRuntimeDomain,getEffectiveApiDomain,getEffectiveRuntimeDomain,getEffectiveUserDomain,getEnvToolboxBaseUrl,getEffectiveToolboxDomain}from'../config/env.js';export{resolveApiBaseUrl}from'../config/api-url-resolver.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4fc7cd,_0x28d1e8){const _0x3ced3c=a3_0x3ef7,_0x24968a=_0x4fc7cd();while(!![]){try{const _0x31ac92=parseInt(_0x3ced3c(0x10d))/0x1+-parseInt(_0x3ced3c(0x112))/0x2*(-parseInt(_0x3ced3c(0x106))/0x3)+-parseInt(_0x3ced3c(0x109))/0x4*(parseInt(_0x3ced3c(0x108))/0x5)+parseInt(_0x3ced3c(0x110))/0x6*(-parseInt(_0x3ced3c(0x10b))/0x7)+-parseInt(_0x3ced3c(0x10c))/0x8+-parseInt(_0x3ced3c(0x107))/0x9*(parseInt(_0x3ced3c(0x111))/0xa)+parseInt(_0x3ced3c(0x103))/0xb*(parseInt(_0x3ced3c(0x10e))/0xc);if(_0x31ac92===_0x28d1e8)break;else _0x24968a['push'](_0x24968a['shift']());}catch(_0x272c4f){_0x24968a['push'](_0x24968a['shift']());}}}(a3_0x566f,0x7bce1));import{readFileSync,writeFileSync}from'node:fs';import{getEnvAuthCookie,cookieFile}from'../config/env.js';export function getCookie(){const _0x28a9ad=a3_0x3ef7,_0x2d9f82=getEnvAuthCookie();if(_0x2d9f82)return _0x2d9f82;try{return readFileSync(cookieFile,'utf-8')[_0x28a9ad(0x10f)]();}catch{return'';}}export function saveCookie(_0x2de467){const _0x430eb1=a3_0x3ef7;try{writeFileSync(cookieFile,_0x2de467,_0x430eb1(0x10a));}catch(_0x2d8c76){throw new Error('Failed\x20to\x20save\x20cookie\x20to\x20'+cookieFile+':\x20'+_0x2d8c76[_0x430eb1(0x104)]);}}function a3_0x3ef7(_0x5604f6,_0x441a28){_0x5604f6=_0x5604f6-0x103;const _0x566fbf=a3_0x566f();let _0x3ef7d1=_0x566fbf[_0x5604f6];return _0x3ef7d1;}export function hasCookie(){const _0x111078=a3_0x3ef7,_0x5a0133=getCookie();return _0x5a0133[_0x111078(0x105)]>0x0;}export function clearCookie(){const _0x359886=a3_0x3ef7;try{writeFileSync(cookieFile,'',_0x359886(0x10a));}catch{}}function a3_0x566f(){const _0x144cb1=['utf-8','25501XmstpK','3867784IkBCJb','847206WgmDUe','12fxPcTf','trim','1308aYsfAr','3029230KNYEsb','76KNiewj','13633598GKOVyC','message','length','12417iKtcCx','9rkrzyT','781155fuphJQ','4RNIiBo'];a3_0x566f=function(){return _0x144cb1;};return a3_0x566f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a4_0x4b0e(_0x327a98,_0x3d8f55){_0x327a98=_0x327a98-0x1ad;const _0x42aa2b=a4_0x42aa();let _0x4b0e61=_0x42aa2b[_0x327a98];return _0x4b0e61;}(function(_0x23375c,_0xaeb51a){const _0x4806f4=a4_0x4b0e,_0x5c3b9e=_0x23375c();while(!![]){try{const _0x7f86f1=parseInt(_0x4806f4(0x1b8))/0x1*(parseInt(_0x4806f4(0x1b6))/0x2)+-parseInt(_0x4806f4(0x1af))/0x3+parseInt(_0x4806f4(0x1b5))/0x4*(parseInt(_0x4806f4(0x1ad))/0x5)+parseInt(_0x4806f4(0x1ae))/0x6+-parseInt(_0x4806f4(0x1b3))/0x7*(-parseInt(_0x4806f4(0x1b4))/0x8)+-parseInt(_0x4806f4(0x1bb))/0x9*(-parseInt(_0x4806f4(0x1b1))/0xa)+parseInt(_0x4806f4(0x1b7))/0xb*(-parseInt(_0x4806f4(0x1b2))/0xc);if(_0x7f86f1===_0xaeb51a)break;else _0x5c3b9e['push'](_0x5c3b9e['shift']());}catch(_0x1297c5){_0x5c3b9e['push'](_0x5c3b9e['shift']());}}}(a4_0x42aa,0x6c969));import{getCookie}from'./cookie-manager.js';import{getUserDomain}from'../config/env.js';export async function isSessionValid(){const _0x4347f9=a4_0x4b0e,_0x1d5d9d=getCookie();if(!_0x1d5d9d)return![];try{const _0x5ab9de=await fetch(getUserDomain()+_0x4347f9(0x1b9),{'headers':{'cookie':_0x1d5d9d}});if(!_0x5ab9de['ok'])return![];const _0x24dc18=await _0x5ab9de[_0x4347f9(0x1ba)]();return!!(_0x24dc18?.['session']&&_0x24dc18?.[_0x4347f9(0x1b0)]);}catch{return![];}}function a4_0x42aa(){const _0x2f0627=['4632VGgFvc','2OwZWUy','11CZMgBs','604411xSXthE','/api/auth/get-session','json','1206mQXGji','2375xtApZG','4369638tkcoIT','1044219WbpQLw','user','16810qyFPLi','21569448VBpKUa','1125404oIVclk','24ysAsVC'];a4_0x42aa=function(){return _0x2f0627;};return a4_0x42aa();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x19f81e,_0x342bfe){const _0x38e4b4=a5_0x5164,_0x1aed37=_0x19f81e();while(!![]){try{const _0x588407=parseInt(_0x38e4b4(0xd1))/0x1*(-parseInt(_0x38e4b4(0xd2))/0x2)+parseInt(_0x38e4b4(0xce))/0x3+parseInt(_0x38e4b4(0xcd))/0x4*(-parseInt(_0x38e4b4(0xd3))/0x5)+parseInt(_0x38e4b4(0xd5))/0x6+parseInt(_0x38e4b4(0xd0))/0x7+-parseInt(_0x38e4b4(0xcc))/0x8*(-parseInt(_0x38e4b4(0xd6))/0x9)+-parseInt(_0x38e4b4(0xcf))/0xa;if(_0x588407===_0x342bfe)break;else _0x1aed37['push'](_0x1aed37['shift']());}catch(_0x557f9c){_0x1aed37['push'](_0x1aed37['shift']());}}}(a5_0x40c1,0x20bed));import{getEnvToolboxBaseUrl,getEffectiveApiDomain}from'./env.js';import{getConfigApiUrlOverrides}from'./lovrabet-config.js';let _envOverridesCache=null;function getEnvApiUrlOverrides(){const _0x3d3652=a5_0x5164;if(_envOverridesCache!==null)return _envOverridesCache;const _0x429671=process[_0x3d3652(0xd8)][_0x3d3652(0xcb)];if(!_0x429671)return _envOverridesCache={},_envOverridesCache;try{_envOverridesCache=JSON[_0x3d3652(0xd7)](_0x429671);}catch{process[_0x3d3652(0xd8)][_0x3d3652(0xd4)]&&console[_0x3d3652(0xd9)]('[MCP]\x20LOVRABET_API_URL_OVERRIDES\x20is\x20not\x20valid\x20JSON,\x20ignoring'),_envOverridesCache={};}return _envOverridesCache;}function a5_0x5164(_0x44d785,_0x51f657){_0x44d785=_0x44d785-0xcb;const _0x40c1c6=a5_0x40c1();let _0x51641b=_0x40c1c6[_0x44d785];return _0x51641b;}export function resolveApiBaseUrl(_0x5edada){const _0x497a77=getEnvApiUrlOverrides();if(_0x497a77[_0x5edada])return _0x497a77[_0x5edada];const _0xe3b01a=getConfigApiUrlOverrides();if(_0xe3b01a[_0x5edada])return _0xe3b01a[_0x5edada];return getEnvToolboxBaseUrl()??getEffectiveApiDomain();}export function clearApiUrlOverridesCache(){_envOverridesCache=null;}function a5_0x40c1(){const _0x3f50f1=['warn','LOVRABET_API_URL_OVERRIDES','8AvUykM','115616FvbwqP','798303QHXzip','1095570OFcQoh','1070391RJehOG','13eQOrhr','21874ODDeIS','40rkDqJS','MCP_DEBUG','1056624fBHDxm','197793jiqUCD','parse','env'];a5_0x40c1=function(){return _0x3f50f1;};return a5_0x40c1();}
|
package/dist/config/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x47f46e=a6_0x112e;(function(_0x5b0ea7,_0x4a4b95){const _0x3295de=a6_0x112e,_0x5845b8=_0x5b0ea7();while(!![]){try{const _0x3a529a=-parseInt(_0x3295de(0xcd))/0x1*(-parseInt(_0x3295de(0xdb))/0x2)+-parseInt(_0x3295de(0xce))/0x3*(-parseInt(_0x3295de(0xdc))/0x4)+parseInt(_0x3295de(0xe7))/0x5*(-parseInt(_0x3295de(0xed))/0x6)+-parseInt(_0x3295de(0xe6))/0x7+parseInt(_0x3295de(0xe0))/0x8*(-parseInt(_0x3295de(0xda))/0x9)+-parseInt(_0x3295de(0xe8))/0xa*(-parseInt(_0x3295de(0xea))/0xb)+parseInt(_0x3295de(0xd2))/0xc*(parseInt(_0x3295de(0xde))/0xd);if(_0x3a529a===_0x4a4b95)break;else _0x5845b8['push'](_0x5845b8['shift']());}catch(_0x377e49){_0x5845b8['push'](_0x5845b8['shift']());}}}(a6_0x4afa,0x1dca4));import{mkdirSync}from'node:fs';import{homedir}from'node:os';const ENVIRONMENT_MAPPING={'online':a6_0x47f46e(0xe5),'production':a6_0x47f46e(0xe5),'daily':'daily','dev':a6_0x47f46e(0xd7),'development':a6_0x47f46e(0xd7)};function normalizeEnvironment(_0x3011f7){const _0x38d841=a6_0x47f46e;if(!_0x3011f7)return _0x38d841(0xe5);const _0x36c81b=_0x3011f7[_0x38d841(0xeb)](),_0x4681e1=ENVIRONMENT_MAPPING[_0x36c81b];if(!_0x4681e1)return console[_0x38d841(0xdd)](_0x38d841(0xd4)+_0x3011f7+',\x20using\x20default\x20production'),_0x38d841(0xe5);return _0x4681e1!==_0x36c81b&&_0x4681e1!==_0x3011f7&&console[_0x38d841(0xe4)](_0x38d841(0xd5)+_0x3011f7+_0x38d841(0xe9)+_0x4681e1),_0x4681e1;}export function getEnvAppCode(){const _0x384b65=a6_0x47f46e;return process[_0x384b65(0xe2)][_0x384b65(0xd1)];}export function getEnvironment(){const _0x4e0852=a6_0x47f46e,_0x22c6d8=process[_0x4e0852(0xe2)]['LOVRABET_ENV'];return normalizeEnvironment(_0x22c6d8);}export function getEnvApiBaseUrl(){const _0xd8afc6=a6_0x47f46e;return process[_0xd8afc6(0xe2)]['LOVRABET_API_BASEURL'];}export function getEnvRuntimeBaseUrl(){const _0x1a03b9=a6_0x47f46e;return process[_0x1a03b9(0xe2)][_0x1a03b9(0xd3)];}export function getEnvUserBaseUrl(){return process['env']['LOVRABET_USER_BASEURL'];}export function getEnvAuthCookie(){const _0x1e5560=a6_0x47f46e;return process[_0x1e5560(0xe2)]['LOVRABET_AUTH_COOKIE']?.[_0x1e5560(0xcb)]();}export function isTestEnv(){const _0x2de6a0=a6_0x47f46e;return process[_0x2de6a0(0xe2)][_0x2de6a0(0xd0)]==='test';}export function isProductionEnv(){const _0x1d9911=a6_0x47f46e;return process['env'][_0x1d9911(0xd0)]===_0x1d9911(0xe5);}export function isDevelopmentEnv(){const _0x50dc25=a6_0x47f46e;return process[_0x50dc25(0xe2)]['NODE_ENV']===_0x50dc25(0xd7);}export function shouldLog(){const _0x24998e=a6_0x47f46e,_0x2a186c=process[_0x24998e(0xe2)][_0x24998e(0xd0)];return _0x2a186c===_0x24998e(0xd7)||_0x2a186c===_0x24998e(0xe3);}export const configDir=homedir()+a6_0x47f46e(0xe1);export const cookieFile=configDir+a6_0x47f46e(0xd9);function a6_0x112e(_0x20401d,_0x1f4e3d){_0x20401d=_0x20401d-0xca;const _0x4afa27=a6_0x4afa();let _0x112e01=_0x4afa27[_0x20401d];return _0x112e01;}mkdirSync(configDir,{'recursive':!![]});export const defaultConfig={'appCode':getEnvAppCode(),'env':getEnvironment()};function a6_0x4afa(){const _0x25f36e=['40fEMpMk','20aABNEh','\x20→\x20','1259203auofvp','toLowerCase','https://runtime.lovrabet.com','54732ZIlgGA','https://dev.lovrabet.com','trim','LOVRABET_TOOLBOX_BASEURL','24878XAJUnu','9wPZQTl','https://user.lovrabet.com','NODE_ENV','LOVRABET_APP_CODE','1147308fSwjtF','LOVRABET_RUNTIME_BASEURL','[ENV]\x20Unknown\x20environment:\x20','[ENV]\x20Environment\x20mapping:\x20','https://api.lovrabet.com','development','https://daily-api.lovrabet.com','/cookie','81936QpmbbZ','4oeHdGJ','52312NtgfEy','warn','39QXCEyL','https://user-daily.lovrabet.com','200BdcQul','/.lovrabet','env','daily','log','production','1275169SkDRdG'];a6_0x4afa=function(){return _0x25f36e;};return a6_0x4afa();}export function getEnvAppCodeWithFallback(_0xfc45ad){return getEnvAppCode()||_0xfc45ad;}export function getApiDomain(){const _0x2e942a=a6_0x47f46e,_0x200012=getEnvironment(),_0x4db229={'production':_0x2e942a(0xd6),'online':_0x2e942a(0xd6),'daily':_0x2e942a(0xd8),'development':'https://dev.lovrabet.com'};return _0x4db229[_0x200012];}export function getUserDomain(){const _0x13244d=a6_0x47f46e,_0x469ef9=getEnvironment(),_0x14473e={'production':_0x13244d(0xcf),'online':'https://user.lovrabet.com','daily':_0x13244d(0xdf),'development':_0x13244d(0xca)};return _0x14473e[_0x469ef9];}export function getRuntimeDomain(){const _0x1c4bd5=a6_0x47f46e,_0x4c40b8=getEnvironment(),_0x421e93={'production':_0x1c4bd5(0xec),'online':'https://runtime.lovrabet.com','daily':'https://daily-runtime.lovrabet.com','development':'https://dev.lovrabet.com'};return _0x421e93[_0x4c40b8];}export function getEffectiveApiDomain(){return getEnvApiBaseUrl()||getApiDomain();}export function getEffectiveRuntimeDomain(){return getEnvRuntimeBaseUrl()||getRuntimeDomain();}export function getEffectiveUserDomain(){return getEnvUserBaseUrl()||getUserDomain();}export function getEnvToolboxBaseUrl(){const _0x1d0ede=a6_0x47f46e;return process[_0x1d0ede(0xe2)][_0x1d0ede(0xcc)];}export function getEffectiveToolboxDomain(){return getEnvToolboxBaseUrl()||getEffectiveApiDomain();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x164116,_0x2cbb16){const _0x5527d2=a7_0x20ff,_0x17496f=_0x164116();while(!![]){try{const _0x4a3b06=-parseInt(_0x5527d2(0x18a))/0x1+parseInt(_0x5527d2(0x180))/0x2+parseInt(_0x5527d2(0x184))/0x3*(-parseInt(_0x5527d2(0x18d))/0x4)+-parseInt(_0x5527d2(0x182))/0x5+parseInt(_0x5527d2(0x189))/0x6+parseInt(_0x5527d2(0x18e))/0x7+parseInt(_0x5527d2(0x187))/0x8*(parseInt(_0x5527d2(0x181))/0x9);if(_0x4a3b06===_0x2cbb16)break;else _0x17496f['push'](_0x17496f['shift']());}catch(_0x198704){_0x17496f['push'](_0x17496f['shift']());}}}(a7_0x150b,0x1a963));function a7_0x150b(){const _0x3cf487=['9beZQLq','151200ooRPuL','MCP_DEBUG','365889bXEvNo',',\x20using\x20empty\x20config','env','537256TYrUNO','apiUrlOverrides','588636ZhXnWS','37262thbhmU','/config.json','utf-8','4FeLSrG','549087OmHBnt','109320cdRKua'];a7_0x150b=function(){return _0x3cf487;};return a7_0x150b();}import{existsSync,readFileSync}from'node:fs';import{configDir}from'./env.js';let _cache=null;function readConfigFile(){const _0x32687c=a7_0x20ff;if(_cache!==null)return _cache;const _0x555d7a=configDir+_0x32687c(0x18b);if(!existsSync(_0x555d7a))return _cache={},_cache;try{_cache=JSON['parse'](readFileSync(_0x555d7a,_0x32687c(0x18c)));}catch{process[_0x32687c(0x186)][_0x32687c(0x183)]&&console['warn']('[MCP]\x20Failed\x20to\x20parse\x20'+_0x555d7a+_0x32687c(0x185)),_cache={};}return _cache;}function a7_0x20ff(_0x4cc92c,_0x399ef2){_0x4cc92c=_0x4cc92c-0x180;const _0x150be9=a7_0x150b();let _0x20ff90=_0x150be9[_0x4cc92c];return _0x20ff90;}export function getConfigApiUrlOverrides(){const _0x1ae2ad=a7_0x20ff;return readConfigFile()[_0x1ae2ad(0x188)]??{};}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_0x172da3=a8_0x4b6f;(function(_0x33f390,_0x410fcb){const _0x2efed6=a8_0x4b6f,_0x19c91d=_0x33f390();while(!![]){try{const _0x31973e=parseInt(_0x2efed6(0xd8))/0x1*(parseInt(_0x2efed6(0xd4))/0x2)+-parseInt(_0x2efed6(0xda))/0x3*(parseInt(_0x2efed6(0xc3))/0x4)+-parseInt(_0x2efed6(0xca))/0x5*(-parseInt(_0x2efed6(0xc2))/0x6)+parseInt(_0x2efed6(0xdb))/0x7+parseInt(_0x2efed6(0xd2))/0x8*(parseInt(_0x2efed6(0xbe))/0x9)+-parseInt(_0x2efed6(0xd1))/0xa+parseInt(_0x2efed6(0xd7))/0xb*(-parseInt(_0x2efed6(0xcb))/0xc);if(_0x31973e===_0x410fcb)break;else _0x19c91d['push'](_0x19c91d['shift']());}catch(_0xcc3b5d){_0x19c91d['push'](_0x19c91d['shift']());}}}(a8_0x49e8,0xa87b9));import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createServer}from'./server.js';function a8_0x4b6f(_0x297e7c,_0x2bf9c7){_0x297e7c=_0x297e7c-0xbe;const _0x49e8e0=a8_0x49e8();let _0x4b6fd5=_0x49e8e0[_0x297e7c];return _0x4b6fd5;}function parseArgs(){const _0x4b1970=a8_0x4b6f,_0x36809c=process[_0x4b1970(0xcf)][_0x4b1970(0xd3)](0x2),_0x33438f=_0x36809c[_0x4b1970(0xd0)]('--enable-bff-save')||_0x36809c[_0x4b1970(0xd0)]('--dangerously-bff-save');return process['env'][_0x4b1970(0xd5)]&&_0x36809c[_0x4b1970(0xd0)](_0x4b1970(0xbf))&&!_0x36809c[_0x4b1970(0xd0)](_0x4b1970(0xc6))&&console[_0x4b1970(0xc1)](_0x4b1970(0xcc)),{'bffSaveEnabled':_0x33438f};}async function main(){const _0x2571a2=a8_0x4b6f;try{const {bffSaveEnabled:_0x44548e}=parseArgs(),_0x33160d=createServer({'bffSaveEnabled':_0x44548e}),_0x28ddce=new StdioServerTransport();_0x33160d[_0x2571a2(0xc9)](),await _0x33160d[_0x2571a2(0xc5)](_0x28ddce),process['on'](_0x2571a2(0xdc),async()=>{const _0x423ea4=_0x2571a2;process['env'][_0x423ea4(0xd5)]&&console[_0x423ea4(0xc8)](_0x423ea4(0xce)),process[_0x423ea4(0xcd)](0x0);}),process['on'](_0x2571a2(0xc7),async()=>{const _0x4c2d30=_0x2571a2;process[_0x4c2d30(0xc0)][_0x4c2d30(0xd5)]&&console[_0x4c2d30(0xc8)](_0x4c2d30(0xce)),process[_0x4c2d30(0xcd)](0x0);});}catch(_0x2d3171){console[_0x2571a2(0xd6)](_0x2571a2(0xc4),_0x2d3171),process[_0x2571a2(0xcd)](0x1);}}function a8_0x49e8(){const _0x342d69=['Shutting\x20down\x20Lovrabet\x20Dataset\x20MCP\x20Server...','argv','includes','7429160WnoQmv','23208iYOjLM','slice','156664LIbkUZ','MCP_DEBUG','error','310277bvPWxr','13sFHWkx','catch','15JXaXnH','9155734oDYkIt','SIGINT','3699HUVDrq','--dangerously-bff-save','env','warn','805506kzecUv','940928WkQRZp','Failed\x20to\x20start\x20Lovrabet\x20Dataset\x20MCP\x20Server:','connect','--enable-bff-save','SIGTERM','log','logInfo','5tcSyUT','444liVHIT','[MCP]\x20--dangerously-bff-save\x20is\x20deprecated;\x20use\x20--enable-bff-save\x20(same\x20behavior)','exit'];a8_0x49e8=function(){return _0x342d69;};return a8_0x49e8();}main()[a8_0x172da3(0xd9)](_0x133c71=>{const _0x244174=a8_0x172da3;console['error']('Unhandled\x20error:',_0x133c71),process[_0x244174(0xcd)](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_0x3471f1=a9_0x3faa;function a9_0x3faa(_0x28acab,_0x36e1ab){_0x28acab=_0x28acab-0x8a;const _0x18baf4=a9_0x18ba();let _0x3faa0a=_0x18baf4[_0x28acab];return _0x3faa0a;}(function(_0x21315a,_0x2dc446){const _0x24f40f=a9_0x3faa,_0x53af70=_0x21315a();while(!![]){try{const _0x2fc251=parseInt(_0x24f40f(0xae))/0x1+-parseInt(_0x24f40f(0xe6))/0x2+-parseInt(_0x24f40f(0xa0))/0x3*(parseInt(_0x24f40f(0xc8))/0x4)+parseInt(_0x24f40f(0xb7))/0x5+-parseInt(_0x24f40f(0xab))/0x6*(-parseInt(_0x24f40f(0xed))/0x7)+parseInt(_0x24f40f(0x8f))/0x8*(-parseInt(_0x24f40f(0xbb))/0x9)+-parseInt(_0x24f40f(0xee))/0xa*(-parseInt(_0x24f40f(0xca))/0xb);if(_0x2fc251===_0x2dc446)break;else _0x53af70['push'](_0x53af70['shift']());}catch(_0x20dcf6){_0x53af70['push'](_0x53af70['shift']());}}}(a9_0x18ba,0xd976a));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_0x3471f1(0xef)),authSchema={'appCode':z[a9_0x3471f1(0xac)]()[a9_0x3471f1(0xf0)]()[a9_0x3471f1(0xcf)](a9_0x3471f1(0xa3)),'cookie':z[a9_0x3471f1(0xac)]()[a9_0x3471f1(0xf0)]()[a9_0x3471f1(0xcf)]('Authentication\x20cookie\x20(optional,\x20uses\x20stored\x20cookie\x20from\x20login\x20if\x20not\x20provided)')};function registerToolWithOptions(_0x42a0e9,_0x2561e7,_0x1fe935,_0x316389){_0x42a0e9['registerTool'](_0x2561e7,_0x1fe935,_0x316389);}function wrapHandler(_0x9a117e){return async _0x12c713=>{const _0x527254=a9_0x3faa;try{const _0x391521=await _0x9a117e(_0x12c713);return{'content':[{'type':_0x527254(0xa7),'text':JSON[_0x527254(0xb2)](_0x391521,null,0x2)}]};}catch(_0xc6f9b){return{'content':[{'type':_0x527254(0xa7),'text':JSON['stringify']({'error':!![],'message':_0xc6f9b[_0x527254(0xbe)]||_0x527254(0xc4)},null,0x2)}],'isError':!![]};}};}export class LovrabetDatasetMCPServer{[a9_0x3471f1(0xb5)];[a9_0x3471f1(0x97)];constructor(_0x4f312c={}){const _0x38b1f3=a9_0x3471f1;this['options']=_0x4f312c,this['mcpServer']=new McpServer({'name':'lovrabet-dataset-mcp','version':packageJson[_0x38b1f3(0xbf)]},{'capabilities':{'tools':{}},'instructions':buildInstructions(_0x4f312c)}),this['registerAllTools']();}[a9_0x3471f1(0xcb)](){const _0x35836f=a9_0x3471f1;registerToolWithOptions(this['mcpServer'],_0x35836f(0x8d),{'title':_0x35836f(0xa9),'description':_0x35836f(0xcd),'inputSchema':{'env':z['enum']([_0x35836f(0xad),_0x35836f(0x8a)])[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xb3))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(login)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xa2),{'title':_0x35836f(0x9c),'description':_0x35836f(0xf1),'inputSchema':{...authSchema,'forceRefresh':z[_0x35836f(0xd9)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xd4)),'includeRelations':z[_0x35836f(0xd9)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xba))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listDatasets)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xec),{'title':_0x35836f(0xd7),'description':_0x35836f(0xa6),'inputSchema':{...authSchema,'keyword':z[_0x35836f(0xac)]()['describe'](_0x35836f(0xc3))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(searchDatasets)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0x8b),{'title':'Get\x20Dataset\x20Detail','description':_0x35836f(0x92),'inputSchema':{...authSchema,'datasetCode':z[_0x35836f(0xac)]()['describe'](_0x35836f(0xe7)),'forceRefresh':z[_0x35836f(0xd9)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)]('Bypass\x20cache\x20(default:\x20false)'),'includeRelations':z[_0x35836f(0xd9)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)]('Include\x20bidirectional\x20relations,\x20summary,\x20and\x20usage\x20hints\x20(default:\x20true)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetDetail)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xc2),{'title':_0x35836f(0xc7),'description':_0x35836f(0xc0),'inputSchema':{...authSchema,'datasetCode':z[_0x35836f(0xac)]()['describe'](_0x35836f(0xe7))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetOperations)),registerToolWithOptions(this['mcpServer'],_0x35836f(0xbd),{'title':_0x35836f(0xaf),'description':'Get\x20detailed\x20operation\x20information\x20including\x20request/response\x20examples.','inputSchema':{...authSchema,'datasetCode':z['string']()[_0x35836f(0xcf)](_0x35836f(0x9f)),'operationName':z[_0x35836f(0xac)]()['describe'](_0x35836f(0x8c))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getOperationDetail)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xb1),{'title':'Generate\x20SDK\x20Code','description':_0x35836f(0xcc),'inputSchema':{...authSchema,'datasetCode':z[_0x35836f(0xac)]()['describe'](_0x35836f(0x9f)),'operationName':z[_0x35836f(0xac)]()[_0x35836f(0xcf)](_0x35836f(0x8c)),'includeImports':z[_0x35836f(0xd9)]()['optional']()[_0x35836f(0xcf)](_0x35836f(0x98)),'useAlias':z[_0x35836f(0xd9)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0x91))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSDKCode)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xe4),{'title':_0x35836f(0xd3),'description':_0x35836f(0xb9),'inputSchema':{...authSchema,'keyword':z[_0x35836f(0xac)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)]('Client-side\x20filter\x20by\x20name/description/content'),'category':z[_0x35836f(0xac)]()['optional']()[_0x35836f(0xcf)]('Client-side\x20filter\x20by\x20category'),'sqlCode':z['string']()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xd2)),'sqlName':z['string']()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0x94)),'pageSize':z[_0x35836f(0xa5)]()[_0x35836f(0xf0)]()['describe'](_0x35836f(0x9d)),'currentPage':z[_0x35836f(0xa5)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xdb))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listSqlQueries)),registerToolWithOptions(this[_0x35836f(0xb5)],'execute_custom_sql',{'title':'Execute\x20Custom\x20SQL','description':_0x35836f(0xdc),'inputSchema':{...authSchema,'sqlCode':z['string']()[_0x35836f(0xc9)](0x1)['describe'](_0x35836f(0xc5)),'params':z[_0x35836f(0xde)](z[_0x35836f(0xb0)]([z[_0x35836f(0xac)](),z[_0x35836f(0xa5)]()]))[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xd8))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(executeCustomSql)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xaa),{'title':_0x35836f(0x95),'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[_0x35836f(0xac)]()[_0x35836f(0xc9)](0x1)[_0x35836f(0xcf)]('SQL\x20code\x20from\x20list_sql_queries\x20(must\x20exist)'),'params':z[_0x35836f(0xde)](z['union']([z[_0x35836f(0xac)](),z['number']()]))[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xd6)),'includeImports':z[_0x35836f(0xd9)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0x98)),'target':z[_0x35836f(0xdd)](['sdk',_0x35836f(0xe3)])[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xd0))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSqlCode)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xdf),{'title':_0x35836f(0xc6),'description':_0x35836f(0x9b),'inputSchema':{...authSchema,'sqlContent':z[_0x35836f(0xac)]()['min'](0x1)['describe'](_0x35836f(0xe5)),'dbId':z[_0x35836f(0xa5)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)]('Database\x20ID\x20(optional)'),'validateSchemas':z[_0x35836f(0xda)](z[_0x35836f(0xac)]())[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0x90))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(validateSqlContent)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0x8e),{'title':_0x35836f(0x99),'description':_0x35836f(0x9a),'inputSchema':{...authSchema,'sqlName':z[_0x35836f(0xac)]()['optional']()[_0x35836f(0xcf)]('SQL\x20name/label\x20(optional;\x20MCP\x20auto-extracts\x20from\x20@lovrabet.sqlName\x20comment,\x20or\x20toolbox\x20generates\x20fallback)'),'sqlCode':z[_0x35836f(0xac)]()[_0x35836f(0xf0)]()['describe'](_0x35836f(0xa4)),'dbId':z[_0x35836f(0xa5)]()['optional']()['describe'](_0x35836f(0xe0)),'sqlContent':z[_0x35836f(0xac)]()['min'](0x1)[_0x35836f(0xcf)](_0x35836f(0xea)),'id':z[_0x35836f(0xa5)]()[_0x35836f(0xf0)]()[_0x35836f(0xcf)](_0x35836f(0xf2))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':![]}},wrapHandler(saveOrUpdateCustomSql)),this[_0x35836f(0x97)]['bffSaveEnabled']&&(registerToolWithOptions(this['mcpServer'],_0x35836f(0xa1),{'title':'List\x20Backend\x20Functions','description':'List\x20all\x20Backend\x20Function\x20(ENDPOINT\x20type)\x20scripts.','inputSchema':{...authSchema},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listBffScripts)),registerToolWithOptions(this[_0x35836f(0xb5)],_0x35836f(0xa8),{'title':_0x35836f(0x96),'description':_0x35836f(0xc1),'inputSchema':{...authSchema,'id':z[_0x35836f(0xa5)]()[_0x35836f(0xcf)](_0x35836f(0xd1))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getBffScriptInfo)),registerToolWithOptions(this['mcpServer'],'save_or_update_bff_script',{'title':'Save\x20or\x20Update\x20Backend\x20Function','description':'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.\x20IMPORTANT:\x20Pass\x20scriptContent\x20as\x20a\x20plain\x20string\x20parameter\x20with\x20the\x20full\x20file\x20content.\x20Do\x20NOT\x20write\x20temp\x20files,\x20do\x20NOT\x20JSON-escape\x20manually,\x20do\x20NOT\x20use\x20shell\x20commands\x20to\x20invoke\x20this\x20tool.','inputSchema':{...authSchema,'id':z['number']()[_0x35836f(0xf0)]()[_0x35836f(0xcf)]('Backend\x20Function\x20ID\x20(for\x20updating)'),'description':z[_0x35836f(0xac)]()[_0x35836f(0xc9)](0x1)[_0x35836f(0xcf)]('Function\x20description'),'scriptContent':z[_0x35836f(0xac)]()[_0x35836f(0xc9)](0x1)[_0x35836f(0xcf)](_0x35836f(0xeb))},'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![]}},wrapHandler(saveOrUpdateBffScript)));}get[a9_0x3471f1(0xe1)](){return this['mcpServer'];}async[a9_0x3471f1(0xce)](_0x58d6db){await this['mcpServer']['connect'](_0x58d6db);}async[a9_0x3471f1(0xb8)](){const _0x4155f4=a9_0x3471f1;await this[_0x4155f4(0xb5)][_0x4155f4(0xb8)]();}['logInfo'](){const _0x320d21=a9_0x3471f1;if(!process[_0x320d21(0xd5)][_0x320d21(0xe8)])return;console['log'](_0x320d21(0x93)),console[_0x320d21(0xbc)]('Version:\x20'+packageJson[_0x320d21(0xbf)]),console['log'](_0x320d21(0xb6)),this[_0x320d21(0x97)][_0x320d21(0xe9)]&&(console['log']('Backend\x20Function\x20write\x20tools\x20enabled\x20(--enable-bff-save)'),console['log'](_0x320d21(0xe2)));}}function a9_0x18ba(){const _0x52bb88=['boolean','array','Page\x20number\x20(default:\x201)','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode.\x20Get\x20sqlCode\x20from\x20list_sql_queries\x20first.','enum','record','validate_sql_content','Database\x20ID\x20from\x20get_dataset_detail\x20—\x20required\x20when\x20creating\x20new\x20SQL,\x20optional\x20when\x20updating','server','Conflict\x20detection\x20is\x20handled\x20server-side\x20by\x20toolbox','bff','list_sql_queries','SQL\x20content\x20to\x20validate','3350258LPgXgZ','Dataset\x20ID\x20(numeric)\x20or\x20code\x20(UUID)','MCP_DEBUG','bffSaveEnabled','SQL\x20content\x20(SELECT/INSERT/UPDATE/WITH\x20auto-saved;\x20DELETE/DDL\x20blocked).\x20Supports\x20MyBatis\x20syntax.','Full\x20JavaScript/TypeScript\x20source\x20code.\x20Pass\x20the\x20complete\x20file\x20content\x20directly\x20as\x20a\x20string\x20—\x20any\x20length\x20is\x20supported.','search_datasets','5433631RvRzsF','8815960gxQqAu','../package.json','optional','Get\x20list\x20of\x20all\x20datasets\x20with\x20metadata\x20and\x20table\x20relations\x20(ER\x20Config).\x20Use\x20includeRelations:\x20false\x20for\x20faster\x20response.','SQL\x20ID\x20(kept\x20for\x20backward\x20compatibility,\x20not\x20used\x20by\x20toolbox)','daily','get_dataset_detail','Operation\x20name\x20(e.g.,\x20filter,\x20getOne,\x20create,\x20update)','login','save_or_update_custom_sql','8hbkvwV','Dataset\x20codes\x20to\x20validate\x20against','Use\x20camelCase\x20alias\x20instead\x20of\x20dataset_[code]\x20pattern\x20(default:\x20false)','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).','Lovrabet\x20Dataset\x20MCP\x20Server','Server-side\x20fuzzy\x20match\x20by\x20sqlName','Generate\x20SQL\x20Code','Get\x20Backend\x20Function\x20Info','options','Include\x20import\x20statements\x20(default:\x20true)','Save\x20or\x20Update\x20Custom\x20SQL','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\x20SQL\x20content\x20without\x20saving.\x20Detects\x20SQL\x20type\x20(SELECT/INSERT/UPDATE/DELETE/DDL)\x20and\x20validates\x20table/column\x20existence.\x20Supports\x20MyBatis\x20syntax.','List\x20Datasets','Items\x20per\x20page\x20(default:\x20999)','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','Dataset\x20code/ID','1179744MKRgeD','list_bff_scripts','list_datasets','Application\x20code\x20(optional\x20if\x20LOVRABET_APP_CODE\x20env\x20var\x20is\x20set)','Known\x20sqlCode\x20—\x20use\x20to\x20directly\x20target\x20the\x20record\x20for\x20update,\x20skipping\x20name\x20lookup','number','Search\x20datasets\x20by\x20keyword\x20(searches\x20in\x20name,\x20table\x20name,\x20code,\x20and\x20description).','text','get_bff_script_info','Login','generate_sql_code','12rlSktq','string','online','1018183ZAdeVQ','Get\x20Operation\x20Detail','union','generate_sdk_code','stringify','Environment\x20(optional,\x20uses\x20LOVRABET_ENV\x20or\x20defaults\x20to\x20online)','\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','mcpServer','Server\x20started\x20successfully','4720715VcIafR','close','List\x20all\x20available\x20custom\x20SQL\x20queries\x20with\x20metadata\x20and\x20parameters.','Include\x20table\x20relations\x20(default:\x20true)','10252197BAHhsD','log','get_operation_detail','message','version','Get\x20list\x20of\x20all\x20API\x20operations\x20for\x20a\x20dataset.\x20Prefer\x20\x22filter\x22\x20for\x20queries,\x20\x22getOne\x22\x20for\x20single\x20record\x20by\x20ID.','Get\x20detailed\x20Backend\x20Function\x20script\x20including\x20full\x20source\x20code.','get_dataset_operations','Search\x20keyword','Unknown\x20error\x20occurred','SQL\x20code\x20from\x20list_sql_queries\x20->\x20sqlCode','Validate\x20SQL\x20Content','Get\x20Operations','16GUqhCB','min','22ZmdagM','registerAllTools','Generate\x20TypeScript\x20SDK\x20code\x20for\x20a\x20dataset\x20operation,\x20including\x20field\x20metadata.\x20Check\x20user\x27s\x20@lovrabet/sdk\x20version\x20in\x20package.json\x20first.','Login\x20to\x20Lovrabet\x20to\x20authenticate\x20for\x20dataset\x20queries.','connect','describe','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.','Backend\x20Function\x20ID\x20(from\x20list_bff_scripts)','Server-side\x20fuzzy\x20match\x20by\x20sqlCode','List\x20SQL\x20Queries','Bypass\x20cache\x20(default:\x20false)','env','Example\x20parameter\x20values','Search\x20Datasets','SQL\x20parameters'];a9_0x18ba=function(){return _0x52bb88;};return a9_0x18ba();}function buildInstructions(_0x3d8dea){const _0x4503a2=a9_0x3471f1,_0x2a0c86=_0x3d8dea['bffSaveEnabled']===!![],_0x46cceb=_0x2a0c86?_0x4503a2(0xb4):'';return _0x4503a2(0x9e)+_0x46cceb+'\x0a';}export function createServer(_0x36078e){return new LovrabetDatasetMCPServer(_0x36078e);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x30068b,_0x4d6fb3){const _0x2306cd=a10_0x32ca,_0x553a01=_0x30068b();while(!![]){try{const _0x2568ec=parseInt(_0x2306cd(0x8e))/0x1*(-parseInt(_0x2306cd(0x90))/0x2)+parseInt(_0x2306cd(0x8b))/0x3+-parseInt(_0x2306cd(0x9d))/0x4+-parseInt(_0x2306cd(0x98))/0x5*(parseInt(_0x2306cd(0xa0))/0x6)+parseInt(_0x2306cd(0x96))/0x7*(parseInt(_0x2306cd(0x81))/0x8)+parseInt(_0x2306cd(0x9b))/0x9*(parseInt(_0x2306cd(0x8f))/0xa)+parseInt(_0x2306cd(0x93))/0xb*(parseInt(_0x2306cd(0x85))/0xc);if(_0x2568ec===_0x4d6fb3)break;else _0x553a01['push'](_0x553a01['shift']());}catch(_0x14a3f4){_0x553a01['push'](_0x553a01['shift']());}}}(a10_0x739c,0x51831));function a10_0x32ca(_0x16ac9e,_0x6385f7){_0x16ac9e=_0x16ac9e-0x80;const _0x739c25=a10_0x739c();let _0x32caa3=_0x739c25[_0x16ac9e];return _0x32caa3;}function a10_0x739c(){const _0x5da2a1=['keys','message','1157970xNZMEi','SQL\x20execution\x20failed:\x20','success','8204AISNns','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','145lAsxRa',']:\x20','errorMsg','1077183MVbOQC','data','1053612qSGgia','isArray','SQL\x20execution\x20failed\x20without\x20error\x20message','40674QzcPfJ','errorCode','2824yuVkgC','now','execResult','UNKNOWN','48FjeOCB','SQL\x20execution\x20failed\x20[','\x20row(s).','execError','API\x20call\x20failed:\x20','msg','201480AuopPm','length','Unknown\x20error','227776wzVuRj','10DloUqB','2pzTCSu'];a10_0x739c=function(){return _0x5da2a1;};return a10_0x739c();}import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode}from'../config/env.js';export async function executeCustomSql(_0x3ff96e){const _0x445d3f=a10_0x32ca,_0x490d27=Date[_0x445d3f(0x82)](),{appCode:appCode=getEnvAppCode(),cookie:_0x19a1dc,sqlCode:_0x178441,params:_0x477cc6}=_0x3ff96e;if(!appCode)throw new Error(_0x445d3f(0x97));if(!_0x178441||_0x178441['trim']()==='')throw new Error('sqlCode\x20is\x20required.\x20Get\x20it\x20from\x20list_sql_queries\x20->\x20sqlCode');const _0x7376b0=new DevApiClient({'appCode':appCode,'cookie':_0x19a1dc}),_0x4c7f02=_0x477cc6&&Object[_0x445d3f(0x91)](_0x477cc6)[_0x445d3f(0x8c)]>0x0,_0x42d59a=_0x4c7f02?Object[_0x445d3f(0x91)](_0x477cc6):[],_0x5c0df7={'sqlCode':_0x178441,'hasParams':_0x4c7f02||![],'paramNames':_0x42d59a||[]};try{const _0x8b5bb=await _0x7376b0['executeSql']({'sqlCode':_0x178441['trim'](),'params':_0x477cc6}),_0x27b3ff=Date[_0x445d3f(0x82)]()-_0x490d27,_0x433792=_0x8b5bb[_0x445d3f(0x95)]??![],_0x3e7677=_0x8b5bb[_0x445d3f(0x80)];if(!_0x433792){const _0x2f2923=_0x8b5bb['errorMsg']||_0x8b5bb[_0x445d3f(0x8a)]||_0x445d3f(0x8d);return{'success':![],'execSuccess':![],'execError':_0x2f2923,'errorCode':_0x3e7677||_0x445d3f(0x84),'message':_0x445d3f(0x86)+(_0x3e7677||'ERR')+_0x445d3f(0x99)+_0x2f2923,'executionTime':_0x27b3ff,'sqlInfo':_0x5c0df7};}const _0x4b00ed=_0x8b5bb[_0x445d3f(0x9c)]||_0x8b5bb,_0x5e4052=_0x4b00ed['execSuccess']??_0x4b00ed[_0x445d3f(0x95)]??!![],_0x34ae3f=_0x4b00ed[_0x445d3f(0x83)]||_0x4b00ed[_0x445d3f(0x9c)],_0x5b8472=_0x4b00ed[_0x445d3f(0x88)]||_0x4b00ed[_0x445d3f(0x9a)];if(_0x5e4052){const _0x255e05=Array[_0x445d3f(0x9e)](_0x34ae3f)?_0x34ae3f[_0x445d3f(0x8c)]:0x0;return{'success':!![],'execSuccess':!![],'execResult':_0x34ae3f||[],'rowCount':_0x255e05,'message':'SQL\x20executed\x20successfully.\x20Returned\x20'+_0x255e05+_0x445d3f(0x87),'executionTime':_0x27b3ff,'sqlInfo':_0x5c0df7};}return{'success':!![],'execSuccess':![],'execError':_0x5b8472||_0x445d3f(0x9f),'message':_0x445d3f(0x94)+(_0x5b8472||_0x445d3f(0x8d)),'executionTime':_0x27b3ff,'sqlInfo':_0x5c0df7};}catch(_0x254abb){const _0x41fc5d=Date[_0x445d3f(0x82)]()-_0x490d27;return{'success':![],'execSuccess':![],'execError':_0x254abb[_0x445d3f(0x92)]||'Unknown\x20error','message':_0x445d3f(0x89)+(_0x254abb[_0x445d3f(0x92)]||_0x445d3f(0x8d)),'executionTime':_0x41fc5d,'sqlInfo':_0x5c0df7};}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x227df8,_0x2ec37e){const _0x3f3519=a11_0x9055,_0x48aa4f=_0x227df8();while(!![]){try{const _0x13b71b=-parseInt(_0x3f3519(0x1bc))/0x1+-parseInt(_0x3f3519(0x1ad))/0x2+parseInt(_0x3f3519(0x1ba))/0x3*(parseInt(_0x3f3519(0x1a6))/0x4)+-parseInt(_0x3f3519(0x1b8))/0x5+-parseInt(_0x3f3519(0x1a7))/0x6+parseInt(_0x3f3519(0x1aa))/0x7+parseInt(_0x3f3519(0x1bb))/0x8;if(_0x13b71b===_0x2ec37e)break;else _0x48aa4f['push'](_0x48aa4f['shift']());}catch(_0x4dc2f2){_0x48aa4f['push'](_0x48aa4f['shift']());}}}(a11_0x5af2,0x1f57e));import{DevApiClient}from'../api/dev-api-client.js';function a11_0x9055(_0x3f4942,_0x2b768e){_0x3f4942=_0x3f4942-0x1a6;const _0x5af2f7=a11_0x5af2();let _0x905587=_0x5af2f7[_0x3f4942];return _0x905587;}import{DrivenDataDetailPlus}from'@lovrabet/dsparser';import{getEnvAppCode,getEnvironment}from'../config/env.js';function a11_0x5af2(){const _0x2c4985=['typescript','sdkCall','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','getTableKey','requestExample','responseExample','getOperationDocMeta','toJSON','replace','369265rqRBVU','data','24VrhpXH','3132632YjqFhM','64898jASILm','\x20|\x20数据表:\x20','generateSDKInitCode','datasetCode\x20is\x20required','datasetCode','usageExample','47332YgaYHn','569538MuSuxA','Cannot\x20generate\x20SDK\x20code\x20for\x20operation\x20\x27','\x27\x20in\x20dataset\x20\x27','372421oUnGdP','operationName\x20is\x20required','getModelAlias','354780PPFWHU','generateAliasExplanation'];a11_0x5af2=function(){return _0x2c4985;};return a11_0x5af2();}import{buildFieldRelationsMap,enrichFieldsWithRelations}from'../utils/relations.js';export async function generateSDKCode(_0xa1281d){const _0x4fedd0=a11_0x9055,{appCode:appCode=getEnvAppCode(),cookie:_0x8fb5bc,datasetCode:_0x4ad6b1,operationName:_0x3030c7,includeImports:includeImports=!![],useAlias:useAlias=![]}=_0xa1281d;if(!appCode)throw new Error(_0x4fedd0(0x1b1));if(!_0x4ad6b1)throw new Error(_0x4fedd0(0x1bf));if(!_0x3030c7)throw new Error(_0x4fedd0(0x1ab));const _0x1ac8ec=new DevApiClient({'appCode':appCode,'cookie':_0x8fb5bc}),_0x4ee64a=getEnvironment(),_0x22c625=await _0x1ac8ec['getDatasetDetail'](_0x4ad6b1),_0x4829e4=_0x22c625[_0x4fedd0(0x1b9)]||_0x22c625,_0x320f2d=new DrivenDataDetailPlus(_0x4829e4),_0x22f352=_0x320f2d[_0x4fedd0(0x1b5)](_0x3030c7);if(!_0x22f352)throw new Error(_0x4fedd0(0x1a8)+_0x3030c7+_0x4fedd0(0x1a9)+_0x4ad6b1+'\x27');const _0x91ebe7=_0x320f2d['getDatasetSDKKey'](),_0x3f1e85=_0x320f2d[_0x4fedd0(0x1ac)](),_0x3351dc=_0x320f2d[_0x4fedd0(0x1b2)](),_0x493fe6=_0x320f2d['getTableName'](),_0x3af40b=_0x320f2d['name'],_0x55aaa5=_0x320f2d['getFieldList'](),_0x58a8c6=_0x55aaa5?.[_0x4fedd0(0x1b6)]?.()||[],_0x1e5d4b=buildFieldRelationsMap(_0x22c625),_0x204d3f=enrichFieldsWithRelations(_0x58a8c6,_0x1e5d4b),_0x383662=_0x320f2d['generateFullSDKExample'](_0x3030c7,appCode),_0x186f91=_0x320f2d['getOperationAnalysis'](_0x3030c7);let _0x2fabf7=_0x22f352[_0x4fedd0(0x1b0)]['code'],_0x1b98be=_0x383662||undefined;useAlias&&(_0x2fabf7=_0x2fabf7[_0x4fedd0(0x1b7)](new RegExp(_0x91ebe7,'g'),_0x3f1e85),_0x1b98be&&(_0x1b98be=_0x1b98be['replace'](new RegExp(_0x91ebe7,'g'),_0x3f1e85)));const _0x4f171c='//\x20数据集:\x20'+_0x3af40b+'\x20|\x20数据表:\x20'+_0x493fe6+'\x0a',_0x4ee0d9=_0x4f171c+_0x2fabf7,_0x4273a8=_0x1b98be?'//\x20数据集:\x20'+_0x3af40b+_0x4fedd0(0x1bd)+_0x493fe6+'\x0a'+_0x1b98be:undefined;return{'appCode':appCode,'env':_0x4ee64a,'datasetName':_0x3af40b,'language':_0x4fedd0(0x1af),'code':_0x4ee0d9,'fullExample':includeImports?_0x4273a8:undefined,'sdkCallInfo':{'modelName':_0x3f1e85,'tableName':_0x493fe6,'tableKey':_0x3351dc,'datasetCode':_0x320f2d[_0x4fedd0(0x1c0)],'operationName':_0x3030c7},'fields':_0x204d3f,'requestExample':_0x186f91?.[_0x4fedd0(0x1b3)],'responseExample':_0x186f91?.[_0x4fedd0(0x1b4)],'sdkInitCode':_0x320f2d[_0x4fedd0(0x1be)](_0x3351dc),'usageExample':_0x22f352[_0x4fedd0(0x1c1)],'aliasExplanation':useAlias?_0x320f2d[_0x4fedd0(0x1ae)]():undefined,'aliasHint':{'defaultAlias':_0x3f1e85,'datasetSDKKey':_0x91ebe7}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a12_0x3998(){const _0x47ce6b=['This\x20SQL\x20requires\x20parameters:\x20','66504QZHGWn','2024-01-01','Use\x20list_sql_queries\x20to\x20see\x20all\x20available\x20SQLs.','4022832LxQQlo','SDK\x20client.sql.execute()\x20returns\x20{\x20execSuccess,\x20execResult\x20}\x20—\x20always\x20check\x20execSuccess','from','replace','toLowerCase','search','32705YydYNr','bff','trim','sqlContent','sqlCode','example',');\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});',');\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}','This\x20SQL\x20does\x20not\x20require\x20any\x20parameters','length','//\x20Initialize\x20the\x20SDK\x20client\x0aconst\x20client\x20=\x20new\x20LovrabetClient({\x0a\x20\x20appCode:\x20\x27','name','Backend\x20Function','991200FUwVbh','Check\x20the\x20sqlCode\x20from\x20list_sql_queries\x20result\x20and\x20use\x20the\x20exact\x20value.','SQL\x20code\x20\x22','6fqmdTY',',\x0a}','\x27,\x0a\x20\x20params:\x20','map','time','sqlId','//\x20Backend\x20Function:\x20Execute\x20SQL\x20\x22','entries','sqlName','includes','size','page','\x27,\x0a\x20\x20env:\x20\x27','2046320XQZSuc','find','\x20code\x20for\x20SQL:\x20','join','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;\x0a\x0a','\x22\x20does\x20not\x20exist.\x20Use\x20list_sql_queries\x20to\x20find\x20valid\x20SQL\x20codes.','sdk','value','count','Note:\x20client.api.executeSql()\x20is\x20deprecated.\x20Use\x20client.sql.execute()\x20instead.','\x0aconst\x20data\x20=\x20await\x20client.sql.execute(','sql','reduce','1568912wfvQWC','sqlCode\x20is\x20required','message','{\x20sqlCode:\x20\x27','data','\x27,\x0a});\x0a\x0a//\x20Execute\x20SQL:\x20','getCustomSqlList','Failed\x20to\x20verify\x20SQL\x20code:\x20','status','Frontend\x20SDK','5737767aDyWSa','{\x0a\x20\x20sqlCode:\x20\x27','Errors\x20throw\x20exceptions\x20—\x20use\x20try-catch','\x22\x0aexport\x20default\x20async\x20function(params,\x20context)\x20{\x0a\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute('];a12_0x3998=function(){return _0x47ce6b;};return a12_0x3998();}(function(_0x3b689b,_0x34f55b){const _0x4f1c29=a12_0x2edf,_0x3297e5=_0x3b689b();while(!![]){try{const _0x3afdd5=-parseInt(_0x4f1c29(0xf5))/0x1+-parseInt(_0x4f1c29(0x102))/0x2+parseInt(_0x4f1c29(0x105))/0x3*(parseInt(_0x4f1c29(0xdd))/0x4)+parseInt(_0x4f1c29(0x112))/0x5+parseInt(_0x4f1c29(0xef))/0x6+-parseInt(_0x4f1c29(0xe7))/0x7+-parseInt(_0x4f1c29(0xec))/0x8;if(_0x3afdd5===_0x34f55b)break;else _0x3297e5['push'](_0x3297e5['shift']());}catch(_0x4ea8ff){_0x3297e5['push'](_0x3297e5['shift']());}}}(a12_0x3998,0x7bff5));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode,getEnvironment}from'../config/env.js';function a12_0x2edf(_0x45a791,_0x57e9fe){_0x45a791=_0x45a791-0xd6;const _0x399888=a12_0x3998();let _0x2edf19=_0x399888[_0x45a791];return _0x2edf19;}export async function generateSqlCode(_0x4fc715){const _0x4c294e=a12_0x2edf,{appCode:appCode=getEnvAppCode(),cookie:_0x2c8167,sqlCode:_0x7878f0,params:_0x26efe1,includeImports:includeImports=!![],target:target=_0x4c294e(0xd6)}=_0x4fc715;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');if(!_0x7878f0||_0x7878f0[_0x4c294e(0xf7)]()==='')return{'success':![],'sqlCode':'','sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[]},'error':_0x4c294e(0xde)};const _0x474a4c=_0x7878f0[_0x4c294e(0xf7)](),_0x2c69e4=new DevApiClient({'appCode':appCode,'cookie':_0x2c8167}),_0x7898b5=getEnvironment();try{const _0x220deb=await _0x2c69e4[_0x4c294e(0xe3)]({'pageSize':0x3e7,'currentPage':0x1,'sqlCode':_0x474a4c}),_0x2f190b=_0x220deb[_0x4c294e(0xe1)]?.['tableData']||[],_0x42560b=_0x2f190b[_0x4c294e(0x113)](_0x321539=>_0x321539[_0x4c294e(0xf9)]===_0x474a4c||_0x321539[_0x4c294e(0xf9)]?.[_0x4c294e(0x10e)](_0x474a4c)||_0x474a4c[_0x4c294e(0x10e)](_0x321539['sqlCode']));if(!_0x42560b)return{'success':![],'sqlCode':_0x474a4c,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x4c294e(0x104)+_0x474a4c+'\x22\x20not\x20found\x20in\x20the\x20application.',_0x4c294e(0xee),_0x4c294e(0x103)]},'error':_0x4c294e(0x104)+_0x474a4c+_0x4c294e(0x117)};const _0x18be1b=_0x42560b[_0x4c294e(0xf9)],_0x21fee7=_0x42560b[_0x4c294e(0x10d)]||_0x42560b[_0x4c294e(0x100)]||'SQL-'+(_0x42560b[_0x4c294e(0x10a)]||_0x42560b['id']),_0x469a6f=_0x42560b[_0x4c294e(0xf8)]||_0x42560b[_0x4c294e(0xdb)]||'',_0x4ecb86=_0x469a6f['match'](/[:$]\{?(\w+)\}?/g);let _0x24439b,_0x4c552f;if(_0x4ecb86){const _0x50fba4=Array[_0x4c294e(0xf1)](new Set(_0x4ecb86['map'](_0x2ec0c3=>_0x2ec0c3[_0x4c294e(0xf2)](/[:${}]/g,''))));_0x24439b=_0x50fba4[_0x4c294e(0x108)](_0x44022d=>{const _0x5969f2=_0x26efe1?.[_0x44022d]??getDefaultExample(_0x44022d);return{'name':_0x44022d,'example':_0x5969f2};}),_0x4c552f=_0x24439b[_0x4c294e(0xdc)]((_0x5a6171,_0x3d6734)=>({..._0x5a6171,[_0x3d6734[_0x4c294e(0x100)]]:_0x3d6734[_0x4c294e(0xfa)]}),{});}else _0x26efe1&&(_0x24439b=Object[_0x4c294e(0x10c)](_0x26efe1)[_0x4c294e(0x108)](([_0x3a37f2,_0x551b7c])=>({'name':_0x3a37f2,'example':_0x551b7c})),_0x4c552f=_0x26efe1);const _0x595408=_0x24439b&&_0x24439b[_0x4c294e(0xfe)]>0x0,_0x327fd8=_0x595408?JSON['stringify'](_0x4c552f,null,0x2):'',_0x181e37=_0x595408?_0x4c294e(0xe8)+_0x18be1b+_0x4c294e(0x107)+_0x327fd8+_0x4c294e(0x106):_0x4c294e(0xe0)+_0x18be1b+'\x27\x20}';let _0x495e11;target===_0x4c294e(0xf6)?_0x495e11=_0x4c294e(0x10b)+_0x21fee7+_0x4c294e(0xea)+_0x181e37+_0x4c294e(0xfc):_0x495e11=(includeImports?_0x4c294e(0x116):'')+_0x4c294e(0xff)+appCode+_0x4c294e(0x111)+_0x7898b5+_0x4c294e(0xe2)+_0x21fee7+_0x4c294e(0xda)+_0x181e37+_0x4c294e(0xfb);const _0x199896=target==='bff';return{'success':!![],'sqlCode':_0x18be1b,'sqlName':_0x21fee7,'sqlExists':!![],'code':_0x495e11,'parameters':_0x24439b,'usage':{'description':'Generated\x20'+(_0x199896?_0x4c294e(0x101):_0x4c294e(0xe6))+_0x4c294e(0x114)+_0x21fee7,'important':[_0x4c294e(0x104)+_0x18be1b+'\x22\x20exists\x20and\x20is\x20valid.',_0x199896?'BFF\x20context.client.sql.execute()\x20returns\x20rows\x20T[]\x20directly\x20—\x20no\x20wrapper\x20object':_0x4c294e(0xf0),_0x199896?_0x4c294e(0xe9):'On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20—\x20use\x20try-catch',_0x595408?_0x4c294e(0xeb)+_0x24439b[_0x4c294e(0x108)](_0x4aa648=>_0x4aa648[_0x4c294e(0x100)])[_0x4c294e(0x115)](',\x20'):_0x4c294e(0xfd),_0x4c294e(0xd9)]}};}catch(_0x2c1b16){return{'success':![],'sqlCode':_0x474a4c,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x4c294e(0xe4)+_0x2c1b16[_0x4c294e(0xdf)],_0x4c294e(0xee)]},'error':_0x4c294e(0xe4)+_0x2c1b16['message']};}}function getDefaultExample(_0x3849de){const _0x24a17e=a12_0x2edf,_0x168e27=_0x3849de[_0x24a17e(0xf3)]();if(_0x168e27[_0x24a17e(0x10e)]('date')||_0x168e27[_0x24a17e(0x10e)](_0x24a17e(0x109)))return _0x24a17e(0xed);if(_0x168e27[_0x24a17e(0x10e)]('id'))return 0x7b;if(_0x168e27[_0x24a17e(0x10e)]('limit')||_0x168e27['includes'](_0x24a17e(0xd8))||_0x168e27[_0x24a17e(0x10e)](_0x24a17e(0x10f)))return 0xa;if(_0x168e27['includes'](_0x24a17e(0x110)))return 0x1;if(_0x168e27[_0x24a17e(0x10e)]('keyword')||_0x168e27[_0x24a17e(0x10e)](_0x24a17e(0xf4))||_0x168e27[_0x24a17e(0x10e)](_0x24a17e(0x100)))return _0x24a17e(0xfa);if(_0x168e27[_0x24a17e(0x10e)](_0x24a17e(0xe5)))return 0x1;return _0x24a17e(0xd7);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a13_0x55b4(){const _0x5f37af=['16971138hWcbbf','4VyuCMn','1929795fboJoS','Failed\x20to\x20fetch\x20Backend\x20Function\x20script\x20info\x20for\x20id:\x20','1745024mtzEar','490299SxMajj','2611842onGpIm','getBffScriptInfo','success','7KxlvDt','336459OidSDL','1425852nMlTkM','10Qyzpag','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','data'];a13_0x55b4=function(){return _0x5f37af;};return a13_0x55b4();}(function(_0x58cb75,_0x41fcd0){const _0x62fc8b=a13_0x327b,_0x2fd6f1=_0x58cb75();while(!![]){try{const _0x428c4e=-parseInt(_0x62fc8b(0xaf))/0x1+-parseInt(_0x62fc8b(0xa6))/0x2*(parseInt(_0x62fc8b(0xaa))/0x3)+-parseInt(_0x62fc8b(0xb0))/0x4+-parseInt(_0x62fc8b(0xa7))/0x5+-parseInt(_0x62fc8b(0xab))/0x6*(parseInt(_0x62fc8b(0xae))/0x7)+parseInt(_0x62fc8b(0xa9))/0x8+parseInt(_0x62fc8b(0xb4))/0x9*(parseInt(_0x62fc8b(0xb1))/0xa);if(_0x428c4e===_0x41fcd0)break;else _0x2fd6f1['push'](_0x2fd6f1['shift']());}catch(_0x12a2f4){_0x2fd6f1['push'](_0x2fd6f1['shift']());}}}(a13_0x55b4,0x40264));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode}from'../config/env.js';function a13_0x327b(_0x27ba90,_0x16af8b){_0x27ba90=_0x27ba90-0xa6;const _0x55b423=a13_0x55b4();let _0x327b2a=_0x55b423[_0x27ba90];return _0x327b2a;}export async function getBffScriptInfo(_0x4488a2){const _0x4232b4=a13_0x327b,{appCode:appCode=getEnvAppCode(),cookie:_0x5eff13,id:_0x32ae36}=_0x4488a2;if(!appCode)throw new Error(_0x4232b4(0xb2));if(!_0x32ae36||_0x32ae36<=0x0)throw new Error('id\x20is\x20required\x20and\x20must\x20be\x20a\x20positive\x20number.\x20Get\x20it\x20from\x20list_bff_scripts.');const _0x3da38a=new DevApiClient({'appCode':appCode,'cookie':_0x5eff13}),_0x53c33d=await _0x3da38a[_0x4232b4(0xac)](_0x32ae36);if(!_0x53c33d[_0x4232b4(0xad)]||!_0x53c33d[_0x4232b4(0xb3)])return{'success':![],'message':_0x4232b4(0xa8)+_0x32ae36};return{'success':!![],'script':_0x53c33d[_0x4232b4(0xb3)]};}
|