@lovrabet/dataset-mcp-server 1.3.10 → 1.4.1-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 CHANGED
@@ -1 +1 @@
1
- function a0_0x52f9(){const _0x398331=['get','now','defaultTTL','clear','data','keys','cache','178922bIZxKO','981088OqzomM','set','124740vRLwLu','1582705cxjsGz','size','2956314kULKJO','16002944ppblbF','getStats','4lqlUfX','delete','1644783khZMiE'];a0_0x52f9=function(){return _0x398331;};return a0_0x52f9();}function a0_0x54cf(_0x1df5c9,_0x34a492){_0x1df5c9=_0x1df5c9-0x157;const _0x52f98a=a0_0x52f9();let _0x54cf8f=_0x52f98a[_0x1df5c9];return _0x54cf8f;}const a0_0x48dd0f=a0_0x54cf;(function(_0x112f00,_0x3bb715){const _0x23affb=a0_0x54cf,_0x40cd56=_0x112f00();while(!![]){try{const _0x119cc3=parseInt(_0x23affb(0x159))/0x1+-parseInt(_0x23affb(0x15a))/0x2+-parseInt(_0x23affb(0x164))/0x3+parseInt(_0x23affb(0x162))/0x4*(-parseInt(_0x23affb(0x15d))/0x5)+-parseInt(_0x23affb(0x15f))/0x6+-parseInt(_0x23affb(0x15c))/0x7+parseInt(_0x23affb(0x160))/0x8;if(_0x119cc3===_0x3bb715)break;else _0x40cd56['push'](_0x40cd56['shift']());}catch(_0x93268a){_0x40cd56['push'](_0x40cd56['shift']());}}}(a0_0x52f9,0x4c83d));export class SimpleCache{[a0_0x48dd0f(0x158)]=new Map();[a0_0x48dd0f(0x167)];constructor(_0x37e649=0x5){this['defaultTTL']=_0x37e649*0x3c*0x3e8;}['get'](_0x40f78f){const _0x5511b7=a0_0x48dd0f,_0x24a0ec=this['cache'][_0x5511b7(0x165)](_0x40f78f);if(!_0x24a0ec)return null;const _0x34d4fc=Date[_0x5511b7(0x166)](),_0x1879f8=_0x34d4fc-_0x24a0ec['timestamp'];if(_0x1879f8>this[_0x5511b7(0x167)])return this['cache'][_0x5511b7(0x163)](_0x40f78f),null;const _0x36dbdd=Math['floor'](_0x1879f8/0x3e8);return _0x24a0ec[_0x5511b7(0x169)];}[a0_0x48dd0f(0x15b)](_0x1f8e84,_0x49ad37){const _0x592ed7=a0_0x48dd0f;this[_0x592ed7(0x158)][_0x592ed7(0x15b)](_0x1f8e84,{'data':_0x49ad37,'timestamp':Date['now']()});}[a0_0x48dd0f(0x168)](_0x3fd163){const _0x5dc787=a0_0x48dd0f;_0x3fd163?this[_0x5dc787(0x158)][_0x5dc787(0x163)](_0x3fd163):this[_0x5dc787(0x158)][_0x5dc787(0x168)]();}[a0_0x48dd0f(0x161)](){const _0x502389=a0_0x48dd0f;return{'size':this[_0x502389(0x158)][_0x502389(0x15e)],'ttlMinutes':this['defaultTTL']/0xea60,'entries':Array['from'](this[_0x502389(0x158)][_0x502389(0x157)]())};}}export const apiCache=new SimpleCache(0x5);
1
+ const a0_0x139a28=a0_0x232a;function a0_0x232a(_0x48e7c7,_0x1853ac){_0x48e7c7=_0x48e7c7-0x1b1;const _0x1757f6=a0_0x1757();let _0x232a6b=_0x1757f6[_0x48e7c7];return _0x232a6b;}(function(_0x4b353c,_0x612839){const _0x50ada9=a0_0x232a,_0x2a6888=_0x4b353c();while(!![]){try{const _0x44967c=parseInt(_0x50ada9(0x1b2))/0x1*(parseInt(_0x50ada9(0x1b5))/0x2)+parseInt(_0x50ada9(0x1c1))/0x3+parseInt(_0x50ada9(0x1b4))/0x4*(-parseInt(_0x50ada9(0x1be))/0x5)+-parseInt(_0x50ada9(0x1bd))/0x6+parseInt(_0x50ada9(0x1b7))/0x7*(-parseInt(_0x50ada9(0x1b6))/0x8)+-parseInt(_0x50ada9(0x1bb))/0x9+-parseInt(_0x50ada9(0x1c2))/0xa*(-parseInt(_0x50ada9(0x1c6))/0xb);if(_0x44967c===_0x612839)break;else _0x2a6888['push'](_0x2a6888['shift']());}catch(_0x445bac){_0x2a6888['push'](_0x2a6888['shift']());}}}(a0_0x1757,0x29def));export class SimpleCache{[a0_0x139a28(0x1bf)]=new Map();[a0_0x139a28(0x1b1)];constructor(_0x31cc61=0x5){const _0x2ce86d=a0_0x139a28;this[_0x2ce86d(0x1b1)]=_0x31cc61*0x3c*0x3e8;}[a0_0x139a28(0x1ba)](_0x26377d){const _0x5c2a8c=a0_0x139a28,_0xc1b702=this['cache'][_0x5c2a8c(0x1ba)](_0x26377d);if(!_0xc1b702)return null;const _0x5c2bed=Date[_0x5c2a8c(0x1b8)](),_0x567c3a=_0x5c2bed-_0xc1b702[_0x5c2a8c(0x1c3)];if(_0x567c3a>this[_0x5c2a8c(0x1b1)])return this[_0x5c2a8c(0x1bf)][_0x5c2a8c(0x1c8)](_0x26377d),null;const _0x362aa2=Math[_0x5c2a8c(0x1b9)](_0x567c3a/0x3e8);return _0xc1b702[_0x5c2a8c(0x1bc)];}['set'](_0x2735ce,_0x247942){const _0x17b162=a0_0x139a28;this['cache'][_0x17b162(0x1b3)](_0x2735ce,{'data':_0x247942,'timestamp':Date[_0x17b162(0x1b8)]()});}[a0_0x139a28(0x1c5)](_0x959042){const _0x4d5c33=a0_0x139a28;_0x959042?this[_0x4d5c33(0x1bf)]['delete'](_0x959042):this[_0x4d5c33(0x1bf)]['clear']();}[a0_0x139a28(0x1c7)](){const _0x4031de=a0_0x139a28;return{'size':this[_0x4031de(0x1bf)]['size'],'ttlMinutes':this[_0x4031de(0x1b1)]/0xea60,'entries':Array[_0x4031de(0x1c0)](this[_0x4031de(0x1bf)][_0x4031de(0x1c4)]())};}}function a0_0x1757(){const _0x327721=['916392VPsBNz','31070PNhvaP','8aHzKxz','1353142MZICYf','now','floor','get','2322315aJNdoF','data','254514AHMKrU','5qZQFel','cache','from','122112GlZkKe','10mqLbWl','timestamp','keys','clear','7168722FzXUyb','getStats','delete','defaultTTL','13lPyZJV','set'];a0_0x1757=function(){return _0x327721;};return a0_0x1757();}export const apiCache=new SimpleCache(0x5);
@@ -1 +1 @@
1
- function a1_0x51ca(_0x45b5e7,_0x4258e7){_0x45b5e7=_0x45b5e7-0x198;const _0xa327cf=a1_0xa327();let _0x51ca57=_0xa327cf[_0x45b5e7];return _0x51ca57;}const a1_0x3fa1cd=a1_0x51ca;(function(_0x5ef0d6,_0x49b3f4){const _0x1d5c33=a1_0x51ca,_0x4f7982=_0x5ef0d6();while(!![]){try{const _0x3ad5a5=parseInt(_0x1d5c33(0x1a0))/0x1+parseInt(_0x1d5c33(0x1d4))/0x2+parseInt(_0x1d5c33(0x199))/0x3+parseInt(_0x1d5c33(0x1c8))/0x4*(parseInt(_0x1d5c33(0x1aa))/0x5)+parseInt(_0x1d5c33(0x19c))/0x6+parseInt(_0x1d5c33(0x1d7))/0x7*(-parseInt(_0x1d5c33(0x1f5))/0x8)+-parseInt(_0x1d5c33(0x1c6))/0x9;if(_0x3ad5a5===_0x49b3f4)break;else _0x4f7982['push'](_0x4f7982['shift']());}catch(_0x381cdc){_0x4f7982['push'](_0x4f7982['shift']());}}}(a1_0xa327,0x929da));import{getCookie}from'../auth/cookie-manager.js';function a1_0xa327(){const _0x2cc141=['getDatasetRelations','sqlCode','appCode','pageSize','scriptType','getAllErConfigs','description','705LMsirN','/api/custom/executeSql','tableData','toDatasetName','currentPage','getCustomSqlList','runtimeBaseUrl','params','/api/management/script/cache/clear','success','DEFAULT_TIMEOUT','application/json','scriptContent','find','clearBffScriptCache','warn','getErConfig','set','status','API\x20error:\x20','API\x20request\x20failed:\x20HTTP\x20','dataset-detail:','online','apiDomain','relations','toDataset','getDatasetDetail','ms.\x20The\x20server\x20may\x20be\x20down\x20or\x20unreachable.\x0aURL:\x20','14290434KGeJPg','API\x20request\x20timeout\x20after\x20','11812xWMRCG','forceRefresh','searchDatasets','\x0aURL:\x20','isArray','includes','dataset-list:','sqlName','saveBffScript','getBffScriptList','modelCode','length','1490938CjArQb','datasetCode','/smartapi/dataset/get-driven-data?','3248DnBJVp','getUniqueDbIds','/smartapi/custom/updateUserCustomSql','with-relations','no-relations','GET','saveUserCustomSql','get','Network\x20error:\x20Unable\x20to\x20connect\x20to\x20the\x20server.\x20Please\x20check\x20your\x20network\x20connection\x20or\x20the\x20server\x20may\x20be\x20down.\x0aURL:\x20','updateUserCustomSql','Content-Type','process','_request','data','getDatasetList','signal','postRequest','/smartapi/dataset/get-dataset-list','dbtableConfig','apiBaseUrl','POST','/smartapi/custom/queryUserCustomSqlList','er-configs-all:','fromField','push','sqlContent','mcp:vibe','test','filter','Authentication\x20failed.\x20Please\x20login\x20again.','1864sGRqzi','name','datasetName','cookie','er-config:','dbId','message','doVersion','add','toLowerCase','/api/management/library/scripts/save','LOVRABET_ENV','/smartapi/question/er-config','object','Unknown\x20error','from','847128eFJlSo','env','datasets','357336ddZnul','meta','toField','runtimeDomain','792702yICtod','No\x20authentication\x20cookie\x20found.\x20Please\x20login\x20first.','/api/management/library/scripts/list?appCode='];a1_0xa327=function(){return _0x2cc141;};return a1_0xa327();}import{getEffectiveApiDomain,getEffectiveRuntimeDomain}from'../auth/constants.js';import{apiCache}from'./cache.js';export class DevApiClient{['appCode'];['env'];[a1_0x3fa1cd(0x1f8)];[a1_0x3fa1cd(0x1c1)];[a1_0x3fa1cd(0x19f)];constructor(_0x255f1e){const _0x481251=a1_0x3fa1cd;this[_0x481251(0x1a5)]=_0x255f1e[_0x481251(0x1a5)],this['env']=globalThis[_0x481251(0x1e2)]?.[_0x481251(0x19a)]?.[_0x481251(0x200)]||_0x481251(0x1c0),this[_0x481251(0x1f8)]=_0x255f1e['cookie']||getCookie(),this[_0x481251(0x1c1)]=_0x255f1e[_0x481251(0x1ea)]||getEffectiveApiDomain(),this[_0x481251(0x19f)]=_0x255f1e[_0x481251(0x1b0)]||getEffectiveRuntimeDomain();if(!this[_0x481251(0x1f8)])throw new Error(_0x481251(0x1a1));}static ['DEFAULT_TIMEOUT']=0x7530;async[a1_0x3fa1cd(0x1e3)](_0x6358f9,_0x53e181={},_0x150263=DevApiClient[a1_0x3fa1cd(0x1b4)]){const _0x519317=a1_0x3fa1cd,{method:method=_0x519317(0x1dc),body:_0x4a4236}=_0x53e181,_0x252960=new AbortController(),_0x520d86=setTimeout(()=>_0x252960['abort'](),_0x150263),_0x404f64={'Cookie':this[_0x519317(0x1f8)],'X-Invoke-Source':_0x519317(0x1f1)};method===_0x519317(0x1eb)&&(_0x404f64[_0x519317(0x1e1)]=_0x519317(0x1b5));try{const _0x2c2ed1=await fetch(_0x6358f9,{'method':method,'headers':_0x404f64,..._0x4a4236!==undefined&&{'body':JSON['stringify'](_0x4a4236)},'signal':_0x252960[_0x519317(0x1e6)]});clearTimeout(_0x520d86);if(!_0x2c2ed1['ok']){if(_0x2c2ed1[_0x519317(0x1bc)]===0x191)throw new Error(_0x519317(0x1f4));let _0x3fac66='';try{_0x3fac66=await _0x2c2ed1['text']();}catch{}throw new Error(_0x519317(0x1be)+_0x2c2ed1[_0x519317(0x1bc)]+_0x519317(0x1cb)+_0x6358f9+(_0x3fac66?'\x0a'+_0x3fac66:''));}const _0x237495=await _0x2c2ed1['json']();if(_0x237495&&typeof _0x237495===_0x519317(0x202)&&_0x519317(0x1b3)in _0x237495&&!_0x237495[_0x519317(0x1b3)]){const _0x5134e6=_0x237495;throw new Error(_0x519317(0x1bd)+(_0x5134e6[_0x519317(0x1fb)]||_0x5134e6['errorMsg']||_0x519317(0x203)));}return _0x237495;}catch(_0x1d79e5){if(_0x1d79e5 instanceof Error&&_0x1d79e5[_0x519317(0x1f6)]==='AbortError')throw new Error(_0x519317(0x1c7)+_0x150263+_0x519317(0x1c5)+_0x6358f9);if(_0x1d79e5 instanceof TypeError)throw new Error(_0x519317(0x1df)+_0x6358f9);throw _0x1d79e5;}}async['request'](_0x4d873f,_0x5c8b39){const _0x204bc2=a1_0x3fa1cd;return this[_0x204bc2(0x1e3)](_0x4d873f,{'method':_0x204bc2(0x1dc)},_0x5c8b39);}async[a1_0x3fa1cd(0x1e7)](_0x583f6b,_0x6c0e11,_0x15ea32){const _0x3fa6f0=a1_0x3fa1cd;return this[_0x3fa6f0(0x1e3)](_0x583f6b,{'method':_0x3fa6f0(0x1eb),'body':_0x6c0e11},_0x15ea32);}async[a1_0x3fa1cd(0x1e5)](_0x27bba2){const _0x5bf963=a1_0x3fa1cd,_0x3326b4=_0x27bba2?.[_0x5bf963(0x1c9)]||![],_0x1741b1=_0x5bf963(0x1ce)+this[_0x5bf963(0x1a5)]+':'+this['env'];if(!_0x3326b4){const _0x476af1=apiCache['get'](_0x1741b1);if(_0x476af1)return _0x476af1;}const _0x36f167=this[_0x5bf963(0x1c1)]+_0x5bf963(0x1e8),_0x38943a=await this[_0x5bf963(0x1e7)](_0x36f167,{'appCode':this['appCode']});return apiCache[_0x5bf963(0x1bb)](_0x1741b1,_0x38943a),_0x38943a;}async[a1_0x3fa1cd(0x1c4)](_0x153dc7,_0xa42c58=![],_0x2a07d1=![]){const _0x59b8a1=a1_0x3fa1cd,_0x9e295c=_0x59b8a1(0x1bf)+this[_0x59b8a1(0x1a5)]+':'+this[_0x59b8a1(0x19a)]+':'+_0x153dc7+':'+(_0x2a07d1?_0x59b8a1(0x1da):_0x59b8a1(0x1db));if(!_0xa42c58){const _0x6d4f66=apiCache[_0x59b8a1(0x1de)](_0x9e295c);if(_0x6d4f66)return _0x6d4f66;}const _0x3667ce=/^\d+$/[_0x59b8a1(0x1f2)](_0x153dc7),_0x54e68b=_0x3667ce?'id':'code',_0xe465a0=this[_0x59b8a1(0x1c1)]+_0x59b8a1(0x1d6)+_0x54e68b+'='+_0x153dc7,_0x455596=await this['request'](_0xe465a0);if(_0x2a07d1&&_0x455596[_0x59b8a1(0x1e4)]?.['modelCode']){const _0x30de24=_0x455596[_0x59b8a1(0x1e4)][_0x59b8a1(0x1fc)]==='v2',_0x5c0c79=Array[_0x59b8a1(0x1cc)](_0x455596[_0x59b8a1(0x1e4)][_0x59b8a1(0x1c2)]);if(!_0x30de24||!_0x5c0c79)try{const _0x53e231=await this[_0x59b8a1(0x1a3)](_0x455596[_0x59b8a1(0x1e4)][_0x59b8a1(0x1d2)],_0xa42c58);_0x455596[_0x59b8a1(0x1e4)]['relations']=_0x53e231;}catch(_0x385ff3){process[_0x59b8a1(0x19a)]['NODE_ENV']!==_0x59b8a1(0x1f2)&&console[_0x59b8a1(0x1b9)]('[getDatasetDetail]\x20Failed\x20to\x20fetch\x20relations\x20for\x20'+_0x153dc7+':',_0x385ff3);}}return apiCache[_0x59b8a1(0x1bb)](_0x9e295c,_0x455596),_0x455596;}async[a1_0x3fa1cd(0x1ca)](_0x2d823d){const _0x375dbb=a1_0x3fa1cd,_0x5073f4=await this[_0x375dbb(0x1e5)](),_0x18e789=Array[_0x375dbb(0x1cc)](_0x5073f4[_0x375dbb(0x1e4)])?_0x5073f4[_0x375dbb(0x1e4)]:_0x5073f4[_0x375dbb(0x1e4)]?.[_0x375dbb(0x1ac)]||[];if(!_0x5073f4['success'])return{'success':!![],'data':{'tableData':[]}};const _0x48f401=_0x18e789[_0x375dbb(0x1f3)](_0x18b054=>{const _0x17d2a4=_0x375dbb,_0x5c6975=_0x2d823d[_0x17d2a4(0x1fe)]();return _0x18b054[_0x17d2a4(0x1f6)]?.['toLowerCase']()[_0x17d2a4(0x1cd)](_0x5c6975)||_0x18b054['code']?.[_0x17d2a4(0x1fe)]()[_0x17d2a4(0x1cd)](_0x5c6975)||_0x18b054[_0x17d2a4(0x1e9)]?.['tableName']?.['toLowerCase']()[_0x17d2a4(0x1cd)](_0x5c6975)||_0x18b054[_0x17d2a4(0x1a9)]?.[_0x17d2a4(0x1fe)]()[_0x17d2a4(0x1cd)](_0x5c6975);});return{'success':!![],'data':{'tableData':_0x48f401,'paging':{'totalCount':_0x48f401['length'],'currentPage':0x1,'pageSize':_0x48f401[_0x375dbb(0x1d3)]}}};}async[a1_0x3fa1cd(0x1af)](_0xc75cc4){const _0x2bae81=a1_0x3fa1cd,_0xd2143e=_0xc75cc4?.[_0x2bae81(0x1ae)]||0x1,_0x13d57b=_0xc75cc4?.[_0x2bae81(0x1a6)]||0x3e7,_0x5ba8bc=this[_0x2bae81(0x1c1)]+_0x2bae81(0x1ec),_0x1eba42={'appCode':this[_0x2bae81(0x1a5)],'currentPage':_0xd2143e,'pageSize':_0x13d57b,..._0xc75cc4?.[_0x2bae81(0x1a4)]&&{'sqlCode':_0xc75cc4[_0x2bae81(0x1a4)]},..._0xc75cc4?.['sqlName']&&{'sqlName':_0xc75cc4[_0x2bae81(0x1cf)]}},_0x5109e6=await this[_0x2bae81(0x1e7)](_0x5ba8bc,_0x1eba42);return _0x5109e6;}async['executeSql'](_0x44e3f9){const _0x5c8f38=a1_0x3fa1cd,_0x43d8c2=this[_0x5c8f38(0x19f)]+_0x5c8f38(0x1ab),_0x55e6e2={'appCode':this[_0x5c8f38(0x1a5)],'sqlCode':_0x44e3f9[_0x5c8f38(0x1a4)],..._0x44e3f9[_0x5c8f38(0x1b1)]&&{'params':_0x44e3f9[_0x5c8f38(0x1b1)]}};return await this[_0x5c8f38(0x1e7)](_0x43d8c2,_0x55e6e2);}async[a1_0x3fa1cd(0x1dd)](_0x2195fe){const _0x1b3d19=a1_0x3fa1cd,_0x12f91b=this[_0x1b3d19(0x1c1)]+'/smartapi/custom/saveUserCustomSql',_0x5837ed={'sqlName':_0x2195fe['sqlName'],'dbId':_0x2195fe[_0x1b3d19(0x1fa)],'sqlContent':_0x2195fe[_0x1b3d19(0x1f0)],'appCode':this[_0x1b3d19(0x1a5)]};return await this[_0x1b3d19(0x1e7)](_0x12f91b,_0x5837ed);}async[a1_0x3fa1cd(0x1e0)](_0x4f5279){const _0x1692c4=a1_0x3fa1cd,_0x5520fe=this[_0x1692c4(0x1c1)]+_0x1692c4(0x1d9),_0x1d0c5a={'id':_0x4f5279['id'],'dbId':_0x4f5279[_0x1692c4(0x1fa)],'sqlName':_0x4f5279[_0x1692c4(0x1cf)],'appCode':this[_0x1692c4(0x1a5)],'sqlContent':_0x4f5279['sqlContent']};return await this[_0x1692c4(0x1e7)](_0x5520fe,_0x1d0c5a);}async[a1_0x3fa1cd(0x1ba)](_0x9eb3e9,_0x1ad934=![]){const _0x483d4d=a1_0x3fa1cd,_0x4c9672=_0x483d4d(0x1f9)+this[_0x483d4d(0x1a5)]+':'+this[_0x483d4d(0x19a)]+':'+_0x9eb3e9;if(!_0x1ad934){const _0x521a15=apiCache[_0x483d4d(0x1de)](_0x4c9672);if(_0x521a15)return _0x521a15;}const _0x6097ee=this[_0x483d4d(0x1c1)]+_0x483d4d(0x201),_0xd723b6=await this['postRequest'](_0x6097ee,{'dblinkId':_0x9eb3e9,'appCode':this['appCode']});if(!_0xd723b6[_0x483d4d(0x1b3)]||!_0xd723b6[_0x483d4d(0x1e4)])throw new Error('Failed\x20to\x20get\x20ER\x20config\x20for\x20dblinkId:\x20'+_0x9eb3e9);const _0x35ad9e={'meta':_0xd723b6[_0x483d4d(0x1e4)][_0x483d4d(0x19d)],'datasets':_0xd723b6[_0x483d4d(0x1e4)][_0x483d4d(0x19b)]};return apiCache[_0x483d4d(0x1bb)](_0x4c9672,_0x35ad9e),_0x35ad9e;}async[a1_0x3fa1cd(0x1d8)](_0x601365=![]){const _0x29e6b6=a1_0x3fa1cd,_0x569da6=await this[_0x29e6b6(0x1e5)]({'forceRefresh':_0x601365}),_0x10de56=Array[_0x29e6b6(0x1cc)](_0x569da6[_0x29e6b6(0x1e4)])?_0x569da6[_0x29e6b6(0x1e4)]:_0x569da6[_0x29e6b6(0x1e4)]?.[_0x29e6b6(0x1ac)]||[],_0x1b6fcb=new Set();for(const _0x3a8b41 of _0x10de56){_0x3a8b41[_0x29e6b6(0x1e9)]?.[_0x29e6b6(0x1fa)]&&_0x1b6fcb[_0x29e6b6(0x1fd)](_0x3a8b41['dbtableConfig'][_0x29e6b6(0x1fa)]);}return Array[_0x29e6b6(0x198)](_0x1b6fcb)['sort']((_0x1335a9,_0x1de15e)=>_0x1335a9-_0x1de15e);}async[a1_0x3fa1cd(0x1a8)](_0x5d64f3=![]){const _0xf36e16=a1_0x3fa1cd,_0x1643bb=_0xf36e16(0x1ed)+this[_0xf36e16(0x1a5)]+':'+this[_0xf36e16(0x19a)];if(!_0x5d64f3){const _0x336735=apiCache[_0xf36e16(0x1de)](_0x1643bb);if(_0x336735)return _0x336735;}const _0x315f91=await this[_0xf36e16(0x1d8)](_0x5d64f3),_0x3451a2=new Map();for(const _0xc33c6c of _0x315f91){try{const _0x2789b1=await this[_0xf36e16(0x1ba)](_0xc33c6c,_0x5d64f3);_0x3451a2[_0xf36e16(0x1bb)](_0xc33c6c,_0x2789b1);}catch(_0x610cd8){console[_0xf36e16(0x1b9)]('Failed\x20to\x20get\x20ER\x20config\x20for\x20dbId\x20'+_0xc33c6c+':',_0x610cd8);}}return apiCache[_0xf36e16(0x1bb)](_0x1643bb,_0x3451a2),_0x3451a2;}async[a1_0x3fa1cd(0x1a3)](_0x1b85ab,_0x39eb49=![]){const _0x1b05e7=a1_0x3fa1cd,_0x5eb75c=await this[_0x1b05e7(0x1a8)](_0x39eb49),_0x4b80ae=[],_0x33d673=[];for(const [,_0x2df8dd]of _0x5eb75c){const _0x4bf289=_0x2df8dd[_0x1b05e7(0x19b)][_0x1b05e7(0x1b7)](_0x57c776=>_0x57c776['datasetCode']===_0x1b85ab);if(_0x4bf289)for(const _0x172890 of _0x4bf289[_0x1b05e7(0x1c2)]||[]){_0x4b80ae['push']({'toDataset':_0x172890[_0x1b05e7(0x1c3)],'toDatasetName':_0x172890[_0x1b05e7(0x1ad)],'toField':_0x172890[_0x1b05e7(0x19e)],'fromField':_0x172890[_0x1b05e7(0x1ee)],'joinType':_0x172890['joinType']});}for(const _0x48400f of _0x2df8dd[_0x1b05e7(0x19b)]){if(_0x48400f[_0x1b05e7(0x1d5)]===_0x1b85ab)continue;for(const _0xa8517c of _0x48400f[_0x1b05e7(0x1c2)]||[]){_0xa8517c[_0x1b05e7(0x1c3)]===_0x1b85ab&&_0x33d673[_0x1b05e7(0x1ef)]({'fromDataset':_0x48400f[_0x1b05e7(0x1d5)],'fromDatasetName':_0x48400f[_0x1b05e7(0x1f7)],'fromField':_0xa8517c[_0x1b05e7(0x1ee)],'toField':_0xa8517c[_0x1b05e7(0x19e)],'joinType':_0xa8517c['joinType']});}}}return{'outgoing':_0x4b80ae,'incoming':_0x33d673};}async[a1_0x3fa1cd(0x1d1)](){const _0x5aec13=a1_0x3fa1cd,_0xdae18d=this[_0x5aec13(0x1c1)]+_0x5aec13(0x1a2)+encodeURIComponent(this[_0x5aec13(0x1a5)])+'&type=ENDPOINT';return await this['request'](_0xdae18d);}async['getBffScriptInfo'](_0x3cb809){const _0x41e81e=this['apiDomain']+'/api/management/library/scripts/info?id='+_0x3cb809;return await this['request'](_0x41e81e);}async[a1_0x3fa1cd(0x1d0)](_0x5a5f81){const _0x2514cb=a1_0x3fa1cd,_0x1a2649=this[_0x2514cb(0x1c1)]+_0x2514cb(0x1ff),_0x440641={'id':_0x5a5f81['id']??null,'appCode':_0x5a5f81['appCode'],'description':_0x5a5f81['description'],'scriptContent':_0x5a5f81[_0x2514cb(0x1b6)],'scriptType':_0x5a5f81[_0x2514cb(0x1a7)]};return await this[_0x2514cb(0x1e7)](_0x1a2649,_0x440641);}async[a1_0x3fa1cd(0x1b8)](){const _0x53e7cd=a1_0x3fa1cd,_0x2302a5=this[_0x53e7cd(0x19f)]+_0x53e7cd(0x1b2);return await this['postRequest'](_0x2302a5,{});}}
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 +1 @@
1
- (function(_0x38b3af,_0x373fff){var _0x5e2f38=a2_0xdca5,_0x53d9d6=_0x38b3af();while(!![]){try{var _0xffcf90=-parseInt(_0x5e2f38(0xfa))/0x1*(parseInt(_0x5e2f38(0xf8))/0x2)+parseInt(_0x5e2f38(0xfd))/0x3+-parseInt(_0x5e2f38(0xf4))/0x4*(parseInt(_0x5e2f38(0xf6))/0x5)+-parseInt(_0x5e2f38(0xfb))/0x6*(parseInt(_0x5e2f38(0xfc))/0x7)+parseInt(_0x5e2f38(0xf5))/0x8*(parseInt(_0x5e2f38(0xfe))/0x9)+parseInt(_0x5e2f38(0xf7))/0xa+parseInt(_0x5e2f38(0xf9))/0xb;if(_0xffcf90===_0x373fff)break;else _0x53d9d6['push'](_0x53d9d6['shift']());}catch(_0x1a8e1a){_0x53d9d6['push'](_0x53d9d6['shift']());}}}(a2_0x5d6c,0x80b18));function a2_0x5d6c(){var _0x34d84c=['420BILOvL','2324757UVbiTT','27FFyoWN','4bwCFbL','612176mfOdgC','4550245fXuUyV','2087590AzLJMP','1018saLvez','13783088tRbtuW','555aQdXzn','74658XuKwVZ'];a2_0x5d6c=function(){return _0x34d84c;};return a2_0x5d6c();}function a2_0xdca5(_0x16841d,_0x1cffd8){_0x16841d=_0x16841d-0xf4;var _0x5d6ced=a2_0x5d6c();var _0xdca56a=_0x5d6ced[_0x16841d];return _0xdca56a;}export{getEnvAppCode,getEnvironment,getEnvApiBaseUrl,getEnvRuntimeBaseUrl,getEnvUserBaseUrl,getEnvAuthCookie,configDir,cookieFile,defaultConfig,getEnvAppCodeWithFallback,getApiDomain,getUserDomain,getRuntimeDomain,getEffectiveApiDomain,getEffectiveRuntimeDomain,getEffectiveUserDomain}from'../config/env.js';
1
+ function a2_0xb4d9(_0x15ec53,_0x1169c5){_0x15ec53=_0x15ec53-0xde;var _0x244f34=a2_0x244f();var _0xb4d9b=_0x244f34[_0x15ec53];return _0xb4d9b;}(function(_0x5531fd,_0x461248){var _0x1ab50b=a2_0xb4d9,_0x2ff54a=_0x5531fd();while(!![]){try{var _0x177872=parseInt(_0x1ab50b(0xe0))/0x1+parseInt(_0x1ab50b(0xe4))/0x2+parseInt(_0x1ab50b(0xdf))/0x3+parseInt(_0x1ab50b(0xe5))/0x4*(-parseInt(_0x1ab50b(0xe6))/0x5)+-parseInt(_0x1ab50b(0xde))/0x6*(-parseInt(_0x1ab50b(0xe3))/0x7)+parseInt(_0x1ab50b(0xe8))/0x8*(parseInt(_0x1ab50b(0xe7))/0x9)+-parseInt(_0x1ab50b(0xe1))/0xa*(parseInt(_0x1ab50b(0xe2))/0xb);if(_0x177872===_0x461248)break;else _0x2ff54a['push'](_0x2ff54a['shift']());}catch(_0x33abd4){_0x2ff54a['push'](_0x2ff54a['shift']());}}}(a2_0x244f,0xaeb7c));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';function a2_0x244f(){var _0x4dc6fd=['5258090hUGpkf','33ibbLoL','14vkqnLR','1471362hJzYlU','904nNbyfA','20YfbQnl','18WkHfmC','2916592UFUcuH','940722PorEME','61026gtLxoL','495230jhDAPw'];a2_0x244f=function(){return _0x4dc6fd;};return a2_0x244f();}
@@ -1 +1 @@
1
- function a3_0x5b74(_0x59e1a6,_0x3259a3){_0x59e1a6=_0x59e1a6-0x1d4;const _0x398f2a=a3_0x398f();let _0x5b7444=_0x398f2a[_0x59e1a6];return _0x5b7444;}(function(_0x31b277,_0x343b98){const _0x2ede69=a3_0x5b74,_0x32244e=_0x31b277();while(!![]){try{const _0xf163d5=-parseInt(_0x2ede69(0x1e0))/0x1*(parseInt(_0x2ede69(0x1e1))/0x2)+parseInt(_0x2ede69(0x1d8))/0x3*(parseInt(_0x2ede69(0x1e2))/0x4)+-parseInt(_0x2ede69(0x1db))/0x5+parseInt(_0x2ede69(0x1d9))/0x6*(parseInt(_0x2ede69(0x1df))/0x7)+parseInt(_0x2ede69(0x1dd))/0x8*(-parseInt(_0x2ede69(0x1de))/0x9)+parseInt(_0x2ede69(0x1dc))/0xa*(parseInt(_0x2ede69(0x1d5))/0xb)+parseInt(_0x2ede69(0x1da))/0xc;if(_0xf163d5===_0x343b98)break;else _0x32244e['push'](_0x32244e['shift']());}catch(_0x132f3a){_0x32244e['push'](_0x32244e['shift']());}}}(a3_0x398f,0xe0a2d));import{readFileSync,writeFileSync}from'node:fs';import{getEnvAuthCookie,cookieFile}from'../config/env.js';export function getCookie(){const _0x4a7022=getEnvAuthCookie();if(_0x4a7022)return _0x4a7022;try{return readFileSync(cookieFile,'utf-8')['trim']();}catch{return'';}}function a3_0x398f(){const _0x40243a=['15301fiAkhK','message','utf-8','9vHgiEM','988740LREPAT','16854456jAxfaQ','1812835ZeSNAa','3430YOEwXT','16zsoEHE','6488649QseHaI','56jRpUDT','604kKZlax','4642NsvJXr','1235348vINBQp','Failed\x20to\x20save\x20cookie\x20to\x20'];a3_0x398f=function(){return _0x40243a;};return a3_0x398f();}export function saveCookie(_0x4c01f6){const _0x37d917=a3_0x5b74;try{writeFileSync(cookieFile,_0x4c01f6,_0x37d917(0x1d7));}catch(_0x2cb9db){throw new Error(_0x37d917(0x1d4)+cookieFile+':\x20'+_0x2cb9db[_0x37d917(0x1d6)]);}}export function hasCookie(){const _0x4e9cc9=getCookie();return _0x4e9cc9['length']>0x0;}export function clearCookie(){try{writeFileSync(cookieFile,'','utf-8');}catch{}}
1
+ function a3_0x1dd1(){const _0x299f0a=['5470752TsVeHl','3778285DoiEtp','136GqFZpM','2ozWDUj','message','1893882YlcsFK','length','utf-8','410680yFiHwM','119670zemStE','11544rTcIbL','Failed\x20to\x20save\x20cookie\x20to\x20','639SHDCiu','1271098tqtOEo'];a3_0x1dd1=function(){return _0x299f0a;};return a3_0x1dd1();}function a3_0x42ce(_0x5e129a,_0x56891a){_0x5e129a=_0x5e129a-0x127;const _0x1dd174=a3_0x1dd1();let _0x42cede=_0x1dd174[_0x5e129a];return _0x42cede;}(function(_0x21b02d,_0x1d77e3){const _0x473ca3=a3_0x42ce,_0x4c195d=_0x21b02d();while(!![]){try{const _0x36928c=parseInt(_0x473ca3(0x12a))/0x1*(-parseInt(_0x473ca3(0x134))/0x2)+parseInt(_0x473ca3(0x131))/0x3+parseInt(_0x473ca3(0x129))/0x4*(-parseInt(_0x473ca3(0x130))/0x5)+-parseInt(_0x473ca3(0x12c))/0x6+-parseInt(_0x473ca3(0x128))/0x7+parseInt(_0x473ca3(0x127))/0x8+-parseInt(_0x473ca3(0x133))/0x9*(-parseInt(_0x473ca3(0x12f))/0xa);if(_0x36928c===_0x1d77e3)break;else _0x4c195d['push'](_0x4c195d['shift']());}catch(_0x40ae74){_0x4c195d['push'](_0x4c195d['shift']());}}}(a3_0x1dd1,0xa1ee0));import{readFileSync,writeFileSync}from'node:fs';import{getEnvAuthCookie,cookieFile}from'../config/env.js';export function getCookie(){const _0x470b13=a3_0x42ce,_0x29fd64=getEnvAuthCookie();if(_0x29fd64)return _0x29fd64;try{return readFileSync(cookieFile,_0x470b13(0x12e))['trim']();}catch{return'';}}export function saveCookie(_0x32a147){const _0x10fba0=a3_0x42ce;try{writeFileSync(cookieFile,_0x32a147,_0x10fba0(0x12e));}catch(_0x40f8f3){throw new Error(_0x10fba0(0x132)+cookieFile+':\x20'+_0x40f8f3[_0x10fba0(0x12b)]);}}export function hasCookie(){const _0x4dc095=a3_0x42ce,_0x25dc49=getCookie();return _0x25dc49[_0x4dc095(0x12d)]>0x0;}export function clearCookie(){const _0xa11604=a3_0x42ce;try{writeFileSync(cookieFile,'',_0xa11604(0x12e));}catch{}}
@@ -1 +1 @@
1
- (function(_0x51bff1,_0x376fe4){const _0xab9599=a4_0x334a,_0x3551ca=_0x51bff1();while(!![]){try{const _0x4a6db8=parseInt(_0xab9599(0x167))/0x1*(-parseInt(_0xab9599(0x166))/0x2)+parseInt(_0xab9599(0x16d))/0x3*(-parseInt(_0xab9599(0x163))/0x4)+-parseInt(_0xab9599(0x164))/0x5*(parseInt(_0xab9599(0x168))/0x6)+-parseInt(_0xab9599(0x16c))/0x7+parseInt(_0xab9599(0x16f))/0x8*(parseInt(_0xab9599(0x165))/0x9)+parseInt(_0xab9599(0x16a))/0xa+parseInt(_0xab9599(0x16b))/0xb;if(_0x4a6db8===_0x376fe4)break;else _0x3551ca['push'](_0x3551ca['shift']());}catch(_0xe1af21){_0x3551ca['push'](_0x3551ca['shift']());}}}(a4_0xada0,0x2a713));import{getCookie}from'./cookie-manager.js';import{getUserDomain}from'../config/env.js';function a4_0xada0(){const _0x5f06f7=['157860mPRSCM','7921034zCxNZo','2393727SyWAIM','3bbdkSG','/api/auth/get-session','74032aTjmNu','837416DBKozJ','955wPgRDM','279okyLqu','54dvpDLS','3375oLeEkz','6486fIncwJ','user'];a4_0xada0=function(){return _0x5f06f7;};return a4_0xada0();}function a4_0x334a(_0x171fcf,_0x1b0517){_0x171fcf=_0x171fcf-0x163;const _0xada07f=a4_0xada0();let _0x334a7e=_0xada07f[_0x171fcf];return _0x334a7e;}export async function isSessionValid(){const _0x457415=a4_0x334a,_0x2a5205=getCookie();if(!_0x2a5205)return![];try{const _0x20d326=await fetch(getUserDomain()+_0x457415(0x16e),{'headers':{'cookie':_0x2a5205}});if(!_0x20d326['ok'])return![];const _0x4e5890=await _0x20d326['json']();return!!(_0x4e5890?.['session']&&_0x4e5890?.[_0x457415(0x169)]);}catch{return![];}}
1
+ function a4_0x1dd6(){const _0x5dfe2e=['118096TuGVuk','1760BikquI','90638iREvAz','290yZxmAw','891pTbNAq','json','13458NPJPcZ','91198qmkPTQ','/api/auth/get-session','396347ZrmSTT','user','192177YTjSgK'];a4_0x1dd6=function(){return _0x5dfe2e;};return a4_0x1dd6();}(function(_0x44cac5,_0x19e3ef){const _0x5adf44=a4_0x3160,_0x2bc914=_0x44cac5();while(!![]){try{const _0x1efdeb=-parseInt(_0x5adf44(0x9d))/0x1+parseInt(_0x5adf44(0xa4))/0x2+parseInt(_0x5adf44(0xa6))/0x3*(parseInt(_0x5adf44(0xa3))/0x4)+parseInt(_0x5adf44(0xa5))/0x5*(parseInt(_0x5adf44(0xa8))/0x6)+-parseInt(_0x5adf44(0x9f))/0x7+-parseInt(_0x5adf44(0xa2))/0x8+-parseInt(_0x5adf44(0xa1))/0x9;if(_0x1efdeb===_0x19e3ef)break;else _0x2bc914['push'](_0x2bc914['shift']());}catch(_0x4e3620){_0x2bc914['push'](_0x2bc914['shift']());}}}(a4_0x1dd6,0x1dd2f));import{getCookie}from'./cookie-manager.js';import{getUserDomain}from'../config/env.js';function a4_0x3160(_0x569943,_0x2021e6){_0x569943=_0x569943-0x9d;const _0x1dd6d0=a4_0x1dd6();let _0x316050=_0x1dd6d0[_0x569943];return _0x316050;}export async function isSessionValid(){const _0x270a89=a4_0x3160,_0xc57c79=getCookie();if(!_0xc57c79)return![];try{const _0x12acd4=await fetch(getUserDomain()+_0x270a89(0x9e),{'headers':{'cookie':_0xc57c79}});if(!_0x12acd4['ok'])return![];const _0x1b8b31=await _0x12acd4[_0x270a89(0xa7)]();return!!(_0x1b8b31?.['session']&&_0x1b8b31?.[_0x270a89(0xa0)]);}catch{return![];}}
@@ -0,0 +1 @@
1
+ (function(_0x23ecc5,_0x17d54b){const _0x164705=a5_0x327f,_0xbc5a9=_0x23ecc5();while(!![]){try{const _0x38fe1e=parseInt(_0x164705(0x8a))/0x1+parseInt(_0x164705(0x92))/0x2*(-parseInt(_0x164705(0x91))/0x3)+parseInt(_0x164705(0x8f))/0x4+parseInt(_0x164705(0x87))/0x5*(-parseInt(_0x164705(0x89))/0x6)+-parseInt(_0x164705(0x85))/0x7+parseInt(_0x164705(0x8e))/0x8*(-parseInt(_0x164705(0x95))/0x9)+-parseInt(_0x164705(0x94))/0xa*(-parseInt(_0x164705(0x93))/0xb);if(_0x38fe1e===_0x17d54b)break;else _0xbc5a9['push'](_0xbc5a9['shift']());}catch(_0x5446be){_0xbc5a9['push'](_0xbc5a9['shift']());}}}(a5_0x377a,0x1e595));import{getEnvToolboxBaseUrl,getEffectiveApiDomain}from'./env.js';function a5_0x327f(_0x1e4b1b,_0x1416a8){_0x1e4b1b=_0x1e4b1b-0x85;const _0x377a3f=a5_0x377a();let _0x327f44=_0x377a3f[_0x1e4b1b];return _0x327f44;}import{getConfigApiUrlOverrides}from'./lovrabet-config.js';let _envOverridesCache=null;function getEnvApiUrlOverrides(){const _0x1b6875=a5_0x327f;if(_envOverridesCache!==null)return _envOverridesCache;const _0x4f22e4=process[_0x1b6875(0x8b)][_0x1b6875(0x88)];if(!_0x4f22e4)return _envOverridesCache={},_envOverridesCache;try{_envOverridesCache=JSON[_0x1b6875(0x8c)](_0x4f22e4);}catch{process['env'][_0x1b6875(0x8d)]&&console[_0x1b6875(0x90)](_0x1b6875(0x86)),_envOverridesCache={};}return _envOverridesCache;}function a5_0x377a(){const _0x46cb2c=['117YcuBQf','428351KqddAd','[MCP]\x20LOVRABET_API_URL_OVERRIDES\x20is\x20not\x20valid\x20JSON,\x20ignoring','91045QIqRAV','LOVRABET_API_URL_OVERRIDES','6TlgfLy','179904HHuUHf','env','parse','MCP_DEBUG','121120uxIgzE','269944WMRQVD','warn','143658CoXipt','8vtffkK','252769jSRDsN','150nAXAzw'];a5_0x377a=function(){return _0x46cb2c;};return a5_0x377a();}export function resolveApiBaseUrl(_0x329041){const _0x22abf2=getEnvApiUrlOverrides();if(_0x22abf2[_0x329041])return _0x22abf2[_0x329041];const _0x159b25=getConfigApiUrlOverrides();if(_0x159b25[_0x329041])return _0x159b25[_0x329041];return getEnvToolboxBaseUrl()??getEffectiveApiDomain();}export function clearApiUrlOverridesCache(){_envOverridesCache=null;}
@@ -1 +1 @@
1
- const a5_0x184076=a5_0x40ae;(function(_0x240b76,_0x4d20b5){const _0x55ac6f=a5_0x40ae,_0x33cd2e=_0x240b76();while(!![]){try{const _0x53929f=-parseInt(_0x55ac6f(0x11a))/0x1*(-parseInt(_0x55ac6f(0x107))/0x2)+parseInt(_0x55ac6f(0x10a))/0x3*(parseInt(_0x55ac6f(0x118))/0x4)+parseInt(_0x55ac6f(0x121))/0x5*(-parseInt(_0x55ac6f(0x10b))/0x6)+parseInt(_0x55ac6f(0x119))/0x7*(parseInt(_0x55ac6f(0x117))/0x8)+parseInt(_0x55ac6f(0x10c))/0x9+-parseInt(_0x55ac6f(0x115))/0xa*(-parseInt(_0x55ac6f(0x120))/0xb)+parseInt(_0x55ac6f(0x11b))/0xc*(-parseInt(_0x55ac6f(0x110))/0xd);if(_0x53929f===_0x4d20b5)break;else _0x33cd2e['push'](_0x33cd2e['shift']());}catch(_0x478f3c){_0x33cd2e['push'](_0x33cd2e['shift']());}}}(a5_0x383f,0x8516a));function a5_0x383f(){const _0x37ec57=['1694650rMbsas','LOVRABET_API_BASEURL','344biLJTC','18572GMqlEz','86429FPSDqX','1tojySh','4284588mzzGGr','https://user-daily.lovrabet.com','LOVRABET_AUTH_COOKIE','development','\x20→\x20','55iskDGU','10BNTlty','https://user.lovrabet.com','production','[ENV]\x20Unknown\x20environment:\x20','https://runtime.lovrabet.com','/.lovrabet','test','daily','NODE_ENV','LOVRABET_APP_CODE','1018138JUEenK','env','LOVRABET_ENV','201WpGcgc','1922418XmINiF','6955065XempEI','https://daily-runtime.lovrabet.com','log','LOVRABET_USER_BASEURL','65RHfkMw','https://api.lovrabet.com','/cookie','trim','[ENV]\x20Environment\x20mapping:\x20'];a5_0x383f=function(){return _0x37ec57;};return a5_0x383f();}import{mkdirSync}from'node:fs';import{homedir}from'node:os';const ENVIRONMENT_MAPPING={'online':a5_0x184076(0x123),'production':a5_0x184076(0x123),'daily':a5_0x184076(0x128),'dev':'development','development':a5_0x184076(0x11e)};function normalizeEnvironment(_0xa83b45){const _0xc98b79=a5_0x184076;if(!_0xa83b45)return'production';const _0x3a6a17=_0xa83b45['toLowerCase'](),_0x347813=ENVIRONMENT_MAPPING[_0x3a6a17];if(!_0x347813)return console['warn'](_0xc98b79(0x124)+_0xa83b45+',\x20using\x20default\x20production'),_0xc98b79(0x123);return _0x347813!==_0x3a6a17&&_0x347813!==_0xa83b45&&console[_0xc98b79(0x10e)](_0xc98b79(0x114)+_0xa83b45+_0xc98b79(0x11f)+_0x347813),_0x347813;}export function getEnvAppCode(){const _0x32dee9=a5_0x184076;return process['env'][_0x32dee9(0x106)];}export function getEnvironment(){const _0x5425bf=a5_0x184076,_0x4212d9=process[_0x5425bf(0x108)][_0x5425bf(0x109)];return normalizeEnvironment(_0x4212d9);}export function getEnvApiBaseUrl(){const _0x5d1ad5=a5_0x184076;return process[_0x5d1ad5(0x108)][_0x5d1ad5(0x116)];}export function getEnvRuntimeBaseUrl(){return process['env']['LOVRABET_RUNTIME_BASEURL'];}export function getEnvUserBaseUrl(){const _0x538358=a5_0x184076;return process['env'][_0x538358(0x10f)];}export function getEnvAuthCookie(){const _0x299499=a5_0x184076;return process['env'][_0x299499(0x11d)]?.[_0x299499(0x113)]();}export function isTestEnv(){const _0x1692c5=a5_0x184076;return process['env'][_0x1692c5(0x105)]===_0x1692c5(0x127);}export function isProductionEnv(){const _0x151130=a5_0x184076;return process[_0x151130(0x108)][_0x151130(0x105)]==='production';}export function isDevelopmentEnv(){const _0x2068da=a5_0x184076;return process[_0x2068da(0x108)][_0x2068da(0x105)]===_0x2068da(0x11e);}function a5_0x40ae(_0xa25a96,_0x17d036){_0xa25a96=_0xa25a96-0x105;const _0x383f19=a5_0x383f();let _0x40aea4=_0x383f19[_0xa25a96];return _0x40aea4;}export function shouldLog(){const _0x2571cf=a5_0x184076,_0x9f9cb5=process['env'][_0x2571cf(0x105)];return _0x9f9cb5==='development'||_0x9f9cb5==='daily';}export const configDir=homedir()+a5_0x184076(0x126);export const cookieFile=configDir+a5_0x184076(0x112);mkdirSync(configDir,{'recursive':!![]});export const defaultConfig={'appCode':getEnvAppCode(),'env':getEnvironment()};export function getEnvAppCodeWithFallback(_0x115ecb){return getEnvAppCode()||_0x115ecb;}export function getApiDomain(){const _0x55cb42=a5_0x184076,_0x3432fd=getEnvironment(),_0x588c47={'production':_0x55cb42(0x111),'online':_0x55cb42(0x111),'daily':'https://daily-api.lovrabet.com','development':'https://dev.lovrabet.com'};return _0x588c47[_0x3432fd];}export function getUserDomain(){const _0x537293=a5_0x184076,_0x1ec186=getEnvironment(),_0x199021={'production':_0x537293(0x122),'online':_0x537293(0x122),'daily':_0x537293(0x11c),'development':'https://dev.lovrabet.com'};return _0x199021[_0x1ec186];}export function getRuntimeDomain(){const _0x544758=a5_0x184076,_0x55636c=getEnvironment(),_0x25817b={'production':'https://runtime.lovrabet.com','online':_0x544758(0x125),'daily':_0x544758(0x10d),'development':'https://dev.lovrabet.com'};return _0x25817b[_0x55636c];}export function getEffectiveApiDomain(){return getEnvApiBaseUrl()||getApiDomain();}export function getEffectiveRuntimeDomain(){return getEnvRuntimeBaseUrl()||getRuntimeDomain();}export function getEffectiveUserDomain(){return getEnvUserBaseUrl()||getUserDomain();}
1
+ const a6_0x4716d2=a6_0x2dd5;(function(_0x3ab7ed,_0x497716){const _0x2dc776=a6_0x2dd5,_0x5aecb1=_0x3ab7ed();while(!![]){try{const _0x13ba3b=-parseInt(_0x2dc776(0x119))/0x1*(parseInt(_0x2dc776(0x12e))/0x2)+-parseInt(_0x2dc776(0x11c))/0x3*(-parseInt(_0x2dc776(0x123))/0x4)+-parseInt(_0x2dc776(0x120))/0x5*(parseInt(_0x2dc776(0x121))/0x6)+-parseInt(_0x2dc776(0x122))/0x7+-parseInt(_0x2dc776(0x12d))/0x8*(-parseInt(_0x2dc776(0x12a))/0x9)+-parseInt(_0x2dc776(0x133))/0xa*(-parseInt(_0x2dc776(0x138))/0xb)+parseInt(_0x2dc776(0x139))/0xc*(parseInt(_0x2dc776(0x12c))/0xd);if(_0x13ba3b===_0x497716)break;else _0x5aecb1['push'](_0x5aecb1['shift']());}catch(_0x12a7bd){_0x5aecb1['push'](_0x5aecb1['shift']());}}}(a6_0x13ac,0xdc5e8));import{mkdirSync}from'node:fs';import{homedir}from'node:os';const ENVIRONMENT_MAPPING={'online':a6_0x4716d2(0x135),'production':a6_0x4716d2(0x135),'daily':a6_0x4716d2(0x134),'dev':a6_0x4716d2(0x116),'development':a6_0x4716d2(0x116)};function normalizeEnvironment(_0x290ed8){const _0x54e88d=a6_0x4716d2;if(!_0x290ed8)return'production';const _0x134d03=_0x290ed8[_0x54e88d(0x118)](),_0x84e30a=ENVIRONMENT_MAPPING[_0x134d03];if(!_0x84e30a)return console[_0x54e88d(0x117)](_0x54e88d(0x126)+_0x290ed8+_0x54e88d(0x11a)),'production';return _0x84e30a!==_0x134d03&&_0x84e30a!==_0x290ed8&&console[_0x54e88d(0x132)](_0x54e88d(0x11b)+_0x290ed8+_0x54e88d(0x136)+_0x84e30a),_0x84e30a;}export function getEnvAppCode(){const _0x313ce1=a6_0x4716d2;return process[_0x313ce1(0x12f)][_0x313ce1(0x13b)];}export function getEnvironment(){const _0x35798e=a6_0x4716d2,_0x13d51c=process[_0x35798e(0x12f)]['LOVRABET_ENV'];return normalizeEnvironment(_0x13d51c);}export function getEnvApiBaseUrl(){const _0x4dcb0b=a6_0x4716d2;return process[_0x4dcb0b(0x12f)][_0x4dcb0b(0x129)];}export function getEnvRuntimeBaseUrl(){const _0x3cf2ee=a6_0x4716d2;return process[_0x3cf2ee(0x12f)][_0x3cf2ee(0x125)];}export function getEnvUserBaseUrl(){const _0x4ee5c4=a6_0x4716d2;return process[_0x4ee5c4(0x12f)][_0x4ee5c4(0x137)];}export function getEnvAuthCookie(){const _0xbc9d9d=a6_0x4716d2;return process[_0xbc9d9d(0x12f)][_0xbc9d9d(0x128)]?.[_0xbc9d9d(0x131)]();}function a6_0x2dd5(_0x48fed1,_0x344d32){_0x48fed1=_0x48fed1-0x115;const _0x13ac0f=a6_0x13ac();let _0x2dd586=_0x13ac0f[_0x48fed1];return _0x2dd586;}export function isTestEnv(){const _0x3ad515=a6_0x4716d2;return process['env'][_0x3ad515(0x11d)]===_0x3ad515(0x115);}export function isProductionEnv(){const _0x4f12f6=a6_0x4716d2;return process['env'][_0x4f12f6(0x11d)]===_0x4f12f6(0x135);}export function isDevelopmentEnv(){const _0x2f3031=a6_0x4716d2;return process[_0x2f3031(0x12f)][_0x2f3031(0x11d)]===_0x2f3031(0x116);}export function shouldLog(){const _0x4cc9c7=a6_0x4716d2,_0x35b033=process[_0x4cc9c7(0x12f)][_0x4cc9c7(0x11d)];return _0x35b033===_0x4cc9c7(0x116)||_0x35b033===_0x4cc9c7(0x134);}export const configDir=homedir()+a6_0x4716d2(0x127);export const cookieFile=configDir+'/cookie';mkdirSync(configDir,{'recursive':!![]});export const defaultConfig={'appCode':getEnvAppCode(),'env':getEnvironment()};export function getEnvAppCodeWithFallback(_0xd61e31){return getEnvAppCode()||_0xd61e31;}export function getApiDomain(){const _0x2a666e=a6_0x4716d2,_0x2bae6a=getEnvironment(),_0x1a94dc={'production':_0x2a666e(0x130),'online':_0x2a666e(0x130),'daily':'https://daily-api.lovrabet.com','development':_0x2a666e(0x11e)};return _0x1a94dc[_0x2bae6a];}export function getUserDomain(){const _0x26cf43=a6_0x4716d2,_0x1431d5=getEnvironment(),_0x25c416={'production':_0x26cf43(0x13a),'online':'https://user.lovrabet.com','daily':_0x26cf43(0x124),'development':_0x26cf43(0x11e)};return _0x25c416[_0x1431d5];}export function getRuntimeDomain(){const _0x9bd059=a6_0x4716d2,_0x18ea01=getEnvironment(),_0x3ef892={'production':_0x9bd059(0x11f),'online':_0x9bd059(0x11f),'daily':'https://daily-runtime.lovrabet.com','development':'https://dev.lovrabet.com'};return _0x3ef892[_0x18ea01];}export function getEffectiveApiDomain(){return getEnvApiBaseUrl()||getApiDomain();}export function getEffectiveRuntimeDomain(){return getEnvRuntimeBaseUrl()||getRuntimeDomain();}export function getEffectiveUserDomain(){return getEnvUserBaseUrl()||getUserDomain();}export function getEnvToolboxBaseUrl(){const _0x2d95d3=a6_0x4716d2;return process[_0x2d95d3(0x12f)][_0x2d95d3(0x12b)];}export function getEffectiveToolboxDomain(){return getEnvToolboxBaseUrl()||getEffectiveApiDomain();}function a6_0x13ac(){const _0x52e2f7=['2252936KSEWmD','178252CBPOcq','https://user-daily.lovrabet.com','LOVRABET_RUNTIME_BASEURL','[ENV]\x20Unknown\x20environment:\x20','/.lovrabet','LOVRABET_AUTH_COOKIE','LOVRABET_API_BASEURL','35316RftIAO','LOVRABET_TOOLBOX_BASEURL','2850081EIlsLH','16khIcPA','1370132gQTyar','env','https://api.lovrabet.com','trim','log','8670wbWDjC','daily','production','\x20→\x20','LOVRABET_USER_BASEURL','3806mPxARm','180vjlYNi','https://user.lovrabet.com','LOVRABET_APP_CODE','test','development','warn','toLowerCase','2gixZNi',',\x20using\x20default\x20production','[ENV]\x20Environment\x20mapping:\x20','21QQrhXD','NODE_ENV','https://dev.lovrabet.com','https://runtime.lovrabet.com','10hNjRhL','3941142bbVcbq'];a6_0x13ac=function(){return _0x52e2f7;};return a6_0x13ac();}
@@ -0,0 +1 @@
1
+ (function(_0x57e4e0,_0x4cb818){const _0x5632a6=a7_0x2a4b,_0x592a66=_0x57e4e0();while(!![]){try{const _0x1351be=parseInt(_0x5632a6(0x11f))/0x1*(parseInt(_0x5632a6(0x11c))/0x2)+parseInt(_0x5632a6(0x11e))/0x3*(-parseInt(_0x5632a6(0x11a))/0x4)+parseInt(_0x5632a6(0x121))/0x5+parseInt(_0x5632a6(0x120))/0x6*(parseInt(_0x5632a6(0x11d))/0x7)+parseInt(_0x5632a6(0x124))/0x8+-parseInt(_0x5632a6(0x123))/0x9*(-parseInt(_0x5632a6(0x119))/0xa)+-parseInt(_0x5632a6(0x122))/0xb;if(_0x1351be===_0x4cb818)break;else _0x592a66['push'](_0x592a66['shift']());}catch(_0x354824){_0x592a66['push'](_0x592a66['shift']());}}}(a7_0x4222,0xef8d6));import{existsSync,readFileSync}from'node:fs';function a7_0x2a4b(_0x1de379,_0x45731d){_0x1de379=_0x1de379-0x114;const _0x4222ae=a7_0x4222();let _0x2a4b44=_0x4222ae[_0x1de379];return _0x2a4b44;}import{configDir}from'./env.js';let _cache=null;function a7_0x4222(){const _0xa6ff95=['2259tlICpJ','1598605uhMhyy','78JrburQ','1188255Hievfb','30754493SyGNys','99bqfWET','5120968jmzrsQ',',\x20using\x20empty\x20config','[MCP]\x20Failed\x20to\x20parse\x20','env','apiUrlOverrides','parse','/config.json','575170ANFlra','4056yZwghA','MCP_DEBUG','2XzYdZh','770833oLOTOu'];a7_0x4222=function(){return _0xa6ff95;};return a7_0x4222();}function readConfigFile(){const _0x14fb98=a7_0x2a4b;if(_cache!==null)return _cache;const _0x182512=configDir+_0x14fb98(0x118);if(!existsSync(_0x182512))return _cache={},_cache;try{_cache=JSON[_0x14fb98(0x117)](readFileSync(_0x182512,'utf-8'));}catch{process[_0x14fb98(0x115)][_0x14fb98(0x11b)]&&console['warn'](_0x14fb98(0x114)+_0x182512+_0x14fb98(0x125)),_cache={};}return _cache;}export function getConfigApiUrlOverrides(){const _0x31a10d=a7_0x2a4b;return readConfigFile()[_0x31a10d(0x116)]??{};}export function clearConfigCache(){_cache=null;}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a6_0x416f03=a6_0x2117;(function(_0x38acd1,_0x2622f1){const _0x3ae2ee=a6_0x2117,_0x41e5fb=_0x38acd1();while(!![]){try{const _0x181891=-parseInt(_0x3ae2ee(0x13c))/0x1+parseInt(_0x3ae2ee(0x14e))/0x2+parseInt(_0x3ae2ee(0x14c))/0x3*(-parseInt(_0x3ae2ee(0x13d))/0x4)+parseInt(_0x3ae2ee(0x141))/0x5+-parseInt(_0x3ae2ee(0x13b))/0x6+parseInt(_0x3ae2ee(0x14a))/0x7*(parseInt(_0x3ae2ee(0x145))/0x8)+parseInt(_0x3ae2ee(0x14b))/0x9;if(_0x181891===_0x2622f1)break;else _0x41e5fb['push'](_0x41e5fb['shift']());}catch(_0x4882bd){_0x41e5fb['push'](_0x41e5fb['shift']());}}}(a6_0x3713,0x6810f));import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createServer}from'./server.js';function a6_0x3713(){const _0x4ca002=['4003668FmUcJd','821553JzoXAL','1552164PoRMgP','SIGINT','argv','env','1128060oJsOFh','log','--dangerously-bff-save','Shutting\x20down\x20Lovrabet\x20Dataset\x20MCP\x20Server...','2784584iobKbI','catch','exit','connect','includes','7JzsAKO','15181794aaJQVJ','6lWUykX','Unhandled\x20error:','861234cfOdje','slice','logInfo','MCP_DEBUG'];a6_0x3713=function(){return _0x4ca002;};return a6_0x3713();}function parseArgs(){const _0x426494=a6_0x2117,_0x839f2b=process[_0x426494(0x13f)][_0x426494(0x14f)](0x2),_0x31f9a5=_0x839f2b[_0x426494(0x149)](_0x426494(0x143));return{'bffAutosave':_0x31f9a5};}function a6_0x2117(_0x35d93a,_0x38c58a){_0x35d93a=_0x35d93a-0x139;const _0x3713f5=a6_0x3713();let _0x211760=_0x3713f5[_0x35d93a];return _0x211760;}async function main(){const _0x4c3eca=a6_0x2117;try{const {bffAutosave:_0x5b9ecc}=parseArgs(),_0x199c45=createServer({'bffAutosave':_0x5b9ecc}),_0xbda4ab=new StdioServerTransport();_0x199c45[_0x4c3eca(0x139)](),await _0x199c45[_0x4c3eca(0x148)](_0xbda4ab),process['on'](_0x4c3eca(0x13e),async()=>{const _0x12f576=_0x4c3eca;process[_0x12f576(0x140)][_0x12f576(0x13a)]&&console[_0x12f576(0x142)](_0x12f576(0x144)),process[_0x12f576(0x147)](0x0);}),process['on']('SIGTERM',async()=>{const _0x44bfd4=_0x4c3eca;process[_0x44bfd4(0x140)][_0x44bfd4(0x13a)]&&console[_0x44bfd4(0x142)](_0x44bfd4(0x144)),process[_0x44bfd4(0x147)](0x0);});}catch(_0x3a34d8){console['error']('Failed\x20to\x20start\x20Lovrabet\x20Dataset\x20MCP\x20Server:',_0x3a34d8),process[_0x4c3eca(0x147)](0x1);}}main()[a6_0x416f03(0x146)](_0x4d9889=>{const _0x484316=a6_0x416f03;console['error'](_0x484316(0x14d),_0x4d9889),process['exit'](0x1);});
2
+ const a8_0x2d8dfc=a8_0x4689;function a8_0x25bf(){const _0x1d0205=['6hKqpTK','817696NfEUTr','Failed\x20to\x20start\x20Lovrabet\x20Dataset\x20MCP\x20Server:','SIGINT','19283530ngndYQ','Unhandled\x20error:','37784YKbaoA','Shutting\x20down\x20Lovrabet\x20Dataset\x20MCP\x20Server...','env','--enable-bff-save','585dNTTRg','argv','log','3119921jbQlIT','catch','connect','4ARLjQX','[MCP]\x20--dangerously-bff-save\x20is\x20deprecated;\x20use\x20--enable-bff-save\x20(same\x20behavior)','389918CjTjXW','--dangerously-bff-save','includes','2677870qsBBeR','403518cgnLjM','exit','logInfo','MCP_DEBUG','error'];a8_0x25bf=function(){return _0x1d0205;};return a8_0x25bf();}(function(_0x3b7a1b,_0x1cc428){const _0x218a26=a8_0x4689,_0x38695a=_0x3b7a1b();while(!![]){try{const _0x13da09=-parseInt(_0x218a26(0x1ff))/0x1+-parseInt(_0x218a26(0x1fd))/0x2*(-parseInt(_0x218a26(0x203))/0x3)+-parseInt(_0x218a26(0x209))/0x4+-parseInt(_0x218a26(0x202))/0x5+parseInt(_0x218a26(0x208))/0x6*(-parseInt(_0x218a26(0x1fa))/0x7)+-parseInt(_0x218a26(0x1f3))/0x8*(parseInt(_0x218a26(0x1f7))/0x9)+parseInt(_0x218a26(0x20c))/0xa;if(_0x13da09===_0x1cc428)break;else _0x38695a['push'](_0x38695a['shift']());}catch(_0x54e3d1){_0x38695a['push'](_0x38695a['shift']());}}}(a8_0x25bf,0x4cd7f));import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createServer}from'./server.js';function a8_0x4689(_0x5cd563,_0x30005a){_0x5cd563=_0x5cd563-0x1f2;const _0x25bff1=a8_0x25bf();let _0x46892d=_0x25bff1[_0x5cd563];return _0x46892d;}function parseArgs(){const _0x2d03c7=a8_0x4689,_0x3ac74b=process[_0x2d03c7(0x1f8)]['slice'](0x2),_0x3257df=_0x3ac74b[_0x2d03c7(0x201)](_0x2d03c7(0x1f6))||_0x3ac74b['includes']('--dangerously-bff-save');return process[_0x2d03c7(0x1f5)][_0x2d03c7(0x206)]&&_0x3ac74b['includes'](_0x2d03c7(0x200))&&!_0x3ac74b[_0x2d03c7(0x201)]('--enable-bff-save')&&console['warn'](_0x2d03c7(0x1fe)),{'bffSaveEnabled':_0x3257df};}async function main(){const _0x24e915=a8_0x4689;try{const {bffSaveEnabled:_0x22cf63}=parseArgs(),_0x4ac283=createServer({'bffSaveEnabled':_0x22cf63}),_0x94797b=new StdioServerTransport();_0x4ac283[_0x24e915(0x205)](),await _0x4ac283[_0x24e915(0x1fc)](_0x94797b),process['on'](_0x24e915(0x20b),async()=>{const _0x5c2959=_0x24e915;process['env'][_0x5c2959(0x206)]&&console[_0x5c2959(0x1f9)](_0x5c2959(0x1f4)),process[_0x5c2959(0x204)](0x0);}),process['on']('SIGTERM',async()=>{const _0x1e311c=_0x24e915;process['env'][_0x1e311c(0x206)]&&console[_0x1e311c(0x1f9)](_0x1e311c(0x1f4)),process[_0x1e311c(0x204)](0x0);});}catch(_0x1a59f5){console[_0x24e915(0x207)](_0x24e915(0x20a),_0x1a59f5),process[_0x24e915(0x204)](0x1);}}main()[a8_0x2d8dfc(0x1fb)](_0x356cc1=>{const _0x553efb=a8_0x2d8dfc;console[_0x553efb(0x207)](_0x553efb(0x1f2),_0x356cc1),process[_0x553efb(0x204)](0x1);});
package/dist/server.js CHANGED
@@ -1 +1 @@
1
- function a7_0x1cd1(){const _0x3dfdcf=['15815034ARIAuy','673oXFXym','search_datasets','Login\x20to\x20Lovrabet\x20to\x20authenticate\x20for\x20dataset\x20queries.','save_or_update_bff_script','8FHjkPa','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.','Bypass\x20cache\x20(default:\x20false)','registerAllTools','../package.json','Search\x20datasets\x20by\x20keyword\x20(searches\x20in\x20name,\x20table\x20name,\x20code,\x20and\x20description).','Client-side\x20filter\x20by\x20name/description/content','close','Include\x20bidirectional\x20relations,\x20summary,\x20and\x20usage\x20hints\x20(default:\x20true)','server','online','Include\x20table\x20relations\x20(default:\x20true)','Get\x20detailed\x20Backend\x20Function\x20script\x20including\x20full\x20source\x20code.','Function\x20description','number','list_sql_queries','optional','5090200djCKvz','3926913XjuPdX','Include\x20import\x20statements\x20(default:\x20true)','8235335bKsITy','message','Get\x20Operations','generate_sql_code','Environment\x20(optional,\x20uses\x20LOVRABET_ENV\x20or\x20defaults\x20to\x20online)','options','validate_sql_content','62euraAZ','record','6uiIigR','Generate\x20SQL\x20Code','connect','List\x20all\x20Backend\x20Function\x20(ENDPOINT\x20type)\x20scripts.','Authentication\x20cookie\x20(optional,\x20uses\x20stored\x20cookie\x20from\x20login\x20if\x20not\x20provided)','get_bff_script_info','save_or_update_custom_sql','boolean','Server-side\x20fuzzy\x20match\x20by\x20sqlCode','Page\x20number\x20(default:\x201)','Get\x20list\x20of\x20all\x20datasets\x20with\x20metadata\x20and\x20table\x20relations\x20(ER\x20Config).\x20Use\x20includeRelations:\x20false\x20for\x20faster\x20response.','min','union','Unknown\x20error\x20occurred','execute_custom_sql','bffAutosave','Validate\x20SQL\x20content\x20without\x20saving.\x20Detects\x20SQL\x20type\x20(SELECT/INSERT/UPDATE/DELETE/DDL)\x20and\x20validates\x20table/column\x20existence.\x20Supports\x20MyBatis\x20syntax.','Dataset\x20code/ID','4807411uGZUWU','Database\x20ID\x20from\x20get_dataset_detail','Get\x20Operation\x20Detail','MCP_DEBUG','generate_sdk_code','Backend\x20Function\x20ID\x20(for\x20updating)','string','describe','List\x20all\x20available\x20custom\x20SQL\x20queries\x20with\x20metadata\x20and\x20parameters.','List\x20Backend\x20Functions','mcpServer','Save\x20or\x20update\x20a\x20Backend\x20Function\x20script.\x20Provide\x20id\x20for\x20updates,\x20omit\x20for\x20new.\x20Runtime\x20cache\x20is\x20automatically\x20cleared\x20after\x20save.','list_bff_scripts','get_operation_detail','JavaScript/TypeScript\x20code\x20with\x20default\x20export','Get\x20Backend\x20Function\x20Info','stringify','SQL\x20parameters','Lovrabet\x20Dataset\x20MCP\x20Server','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`&lt;\x20&gt;\x20&amp;`\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-\x20generate_sql_code\x20supports\x20target=\x27sdk\x27\x20(default)\x20or\x20target=\x27bff\x27\x20for\x20context-appropriate\x20code','Client-side\x20filter\x20by\x20category','Application\x20code\x20(optional\x20if\x20LOVRABET_APP_CODE\x20env\x20var\x20is\x20set)','Execute\x20Custom\x20SQL','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).','SQL\x20name/label','SQL\x20SELECT\x20statement\x20(supports\x20MyBatis\x20syntax)','Save\x20or\x20update\x20a\x20custom\x20SQL\x20query.\x20Only\x20SELECT\x20queries\x20are\x20auto-saved;\x20non-SELECT\x20are\x20blocked\x20for\x20safety.\x20Supports\x20MyBatis\x20syntax.\x20Get\x20dbId\x20from\x20get_dataset_detail.','Version:\x20','get_dataset_operations','Search\x20keyword','Dataset\x20ID\x20(numeric)\x20or\x20code\x20(UUID)','Generate\x20TypeScript\x20SDK\x20code\x20for\x20a\x20dataset\x20operation,\x20including\x20field\x20metadata.\x20Check\x20user\x27s\x20@lovrabet/sdk\x20version\x20in\x20package.json\x20first.','text','array','Operation\x20name\x20(e.g.,\x20filter,\x20getOne,\x20create,\x20update)','login','Items\x20per\x20page\x20(default:\x20999)','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode.\x20Get\x20sqlCode\x20from\x20list_sql_queries\x20first.','Get\x20Dataset\x20Detail','Login','log','\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\x20and\x20automatically\x20clears\x20runtime\x20cache','enum','version','Generate\x20code\x20for\x20a\x20custom\x20SQL\x20query.\x20Validates\x20sqlCode\x20exists\x20first.\x20Use\x20target\x20to\x20switch\x20between\x20Frontend\x20SDK\x20and\x20Backend\x20Function\x20code\x20patterns.','Server\x20started\x20successfully','get_dataset_detail','16269130wyODlD','daily','env','Backend\x20Function\x20tools\x20enabled\x20(--dangerously-bff-save)','Save\x20or\x20Update\x20Custom\x20SQL','Example\x20parameter\x20values','Get\x20list\x20of\x20all\x20API\x20operations\x20for\x20a\x20dataset.\x20Prefer\x20\x22filter\x22\x20for\x20queries,\x20\x22getOne\x22\x20for\x20single\x20record\x20by\x20ID.','SQL\x20ID\x20(for\x20updating\x20existing\x20SQL)'];a7_0x1cd1=function(){return _0x3dfdcf;};return a7_0x1cd1();}const a7_0x4d5b7d=a7_0x5560;(function(_0x31881b,_0x24b771){const _0x14ff6e=a7_0x5560,_0x491049=_0x31881b();while(!![]){try{const _0x2cd684=parseInt(_0x14ff6e(0x219))/0x1*(parseInt(_0x14ff6e(0x238))/0x2)+parseInt(_0x14ff6e(0x22f))/0x3+-parseInt(_0x14ff6e(0x22e))/0x4+-parseInt(_0x14ff6e(0x231))/0x5*(-parseInt(_0x14ff6e(0x23a))/0x6)+parseInt(_0x14ff6e(0x1e1))/0x7*(-parseInt(_0x14ff6e(0x21d))/0x8)+-parseInt(_0x14ff6e(0x218))/0x9+parseInt(_0x14ff6e(0x210))/0xa;if(_0x2cd684===_0x24b771)break;else _0x491049['push'](_0x491049['shift']());}catch(_0x441d47){_0x491049['push'](_0x491049['shift']());}}}(a7_0x1cd1,0xd89e1));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(a7_0x4d5b7d(0x221)),authSchema={'appCode':z[a7_0x4d5b7d(0x1e7)]()[a7_0x4d5b7d(0x22d)]()['describe'](a7_0x4d5b7d(0x1f6)),'cookie':z[a7_0x4d5b7d(0x1e7)]()[a7_0x4d5b7d(0x22d)]()['describe'](a7_0x4d5b7d(0x23e))};function registerToolWithOptions(_0x3332f5,_0x251a42,_0x4629d5,_0x256d9e){_0x3332f5['registerTool'](_0x251a42,_0x4629d5,_0x256d9e);}function wrapHandler(_0x2c6c39){return async _0x649b59=>{const _0x195b77=a7_0x5560;try{const _0xf8c0ef=await _0x2c6c39(_0x649b59);return{'content':[{'type':_0x195b77(0x201),'text':JSON[_0x195b77(0x1f1)](_0xf8c0ef,null,0x2)}]};}catch(_0xad6e93){return{'content':[{'type':'text','text':JSON['stringify']({'error':!![],'message':_0xad6e93[_0x195b77(0x232)]||_0x195b77(0x247)},null,0x2)}],'isError':!![]};}};}export class LovrabetDatasetMCPServer{[a7_0x4d5b7d(0x1eb)];[a7_0x4d5b7d(0x236)];constructor(_0x4c05d7={}){const _0x15a052=a7_0x4d5b7d;this['options']=_0x4c05d7,this[_0x15a052(0x1eb)]=new McpServer({'name':'lovrabet-dataset-mcp','version':packageJson[_0x15a052(0x20c)]},{'capabilities':{'tools':{}},'instructions':buildInstructions(_0x4c05d7)}),this[_0x15a052(0x220)]();}[a7_0x4d5b7d(0x220)](){const _0x9de8cf=a7_0x4d5b7d;registerToolWithOptions(this['mcpServer'],_0x9de8cf(0x204),{'title':_0x9de8cf(0x208),'description':_0x9de8cf(0x21b),'inputSchema':{'env':z[_0x9de8cf(0x20b)]([_0x9de8cf(0x227),_0x9de8cf(0x211)])[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x235))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(login)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],'list_datasets',{'title':'List\x20Datasets','description':_0x9de8cf(0x244),'inputSchema':{...authSchema,'forceRefresh':z[_0x9de8cf(0x241)]()['optional']()[_0x9de8cf(0x1e8)](_0x9de8cf(0x21f)),'includeRelations':z['boolean']()[_0x9de8cf(0x22d)]()['describe'](_0x9de8cf(0x228))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listDatasets)),registerToolWithOptions(this['mcpServer'],_0x9de8cf(0x21a),{'title':'Search\x20Datasets','description':_0x9de8cf(0x222),'inputSchema':{...authSchema,'keyword':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x1fe))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(searchDatasets)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x20f),{'title':_0x9de8cf(0x207),'description':_0x9de8cf(0x1f8),'inputSchema':{...authSchema,'datasetCode':z['string']()[_0x9de8cf(0x1e8)](_0x9de8cf(0x1ff)),'forceRefresh':z[_0x9de8cf(0x241)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x21f)),'includeRelations':z[_0x9de8cf(0x241)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x225))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetDetail)),registerToolWithOptions(this['mcpServer'],_0x9de8cf(0x1fd),{'title':_0x9de8cf(0x233),'description':_0x9de8cf(0x216),'inputSchema':{...authSchema,'datasetCode':z['string']()[_0x9de8cf(0x1e8)](_0x9de8cf(0x1ff))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getDatasetOperations)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x1ee),{'title':_0x9de8cf(0x1e3),'description':'Get\x20detailed\x20operation\x20information\x20including\x20request/response\x20examples.','inputSchema':{...authSchema,'datasetCode':z[_0x9de8cf(0x1e7)]()['describe'](_0x9de8cf(0x24b)),'operationName':z['string']()[_0x9de8cf(0x1e8)](_0x9de8cf(0x203))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getOperationDetail)),registerToolWithOptions(this['mcpServer'],_0x9de8cf(0x1e5),{'title':'Generate\x20SDK\x20Code','description':_0x9de8cf(0x200),'inputSchema':{...authSchema,'datasetCode':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x24b)),'operationName':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x203)),'includeImports':z[_0x9de8cf(0x241)]()['optional']()[_0x9de8cf(0x1e8)](_0x9de8cf(0x230)),'useAlias':z['boolean']()['optional']()[_0x9de8cf(0x1e8)]('Use\x20camelCase\x20alias\x20instead\x20of\x20dataset_[code]\x20pattern\x20(default:\x20false)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSDKCode)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x22c),{'title':'List\x20SQL\x20Queries','description':_0x9de8cf(0x1e9),'inputSchema':{...authSchema,'keyword':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x223)),'category':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x1f5)),'sqlCode':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x22d)]()['describe'](_0x9de8cf(0x242)),'sqlName':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)]('Server-side\x20fuzzy\x20match\x20by\x20sqlName'),'pageSize':z[_0x9de8cf(0x22b)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x205)),'currentPage':z[_0x9de8cf(0x22b)]()['optional']()[_0x9de8cf(0x1e8)](_0x9de8cf(0x243))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listSqlQueries)),registerToolWithOptions(this['mcpServer'],_0x9de8cf(0x248),{'title':_0x9de8cf(0x1f7),'description':_0x9de8cf(0x206),'inputSchema':{...authSchema,'sqlCode':z['string']()[_0x9de8cf(0x245)](0x1)['describe']('SQL\x20code\x20from\x20list_sql_queries\x20->\x20sqlCode'),'params':z['record'](z[_0x9de8cf(0x246)]([z[_0x9de8cf(0x1e7)](),z[_0x9de8cf(0x22b)]()]))['optional']()[_0x9de8cf(0x1e8)](_0x9de8cf(0x1f2))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(executeCustomSql)),registerToolWithOptions(this['mcpServer'],_0x9de8cf(0x234),{'title':_0x9de8cf(0x23b),'description':_0x9de8cf(0x20d),'inputSchema':{...authSchema,'sqlCode':z[_0x9de8cf(0x1e7)]()['min'](0x1)[_0x9de8cf(0x1e8)]('SQL\x20code\x20from\x20list_sql_queries\x20(must\x20exist)'),'params':z[_0x9de8cf(0x239)](z[_0x9de8cf(0x246)]([z['string'](),z[_0x9de8cf(0x22b)]()]))[_0x9de8cf(0x22d)]()['describe'](_0x9de8cf(0x215)),'includeImports':z[_0x9de8cf(0x241)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x230)),'target':z[_0x9de8cf(0x20b)](['sdk','bff'])['optional']()['describe'](_0x9de8cf(0x21e))},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(generateSqlCode)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x237),{'title':'Validate\x20SQL\x20Content','description':_0x9de8cf(0x24a),'inputSchema':{...authSchema,'sqlContent':z['string']()[_0x9de8cf(0x245)](0x1)[_0x9de8cf(0x1e8)]('SQL\x20content\x20to\x20validate'),'dbId':z[_0x9de8cf(0x22b)]()['optional']()[_0x9de8cf(0x1e8)]('Database\x20ID\x20(optional)'),'validateSchemas':z[_0x9de8cf(0x202)](z[_0x9de8cf(0x1e7)]())[_0x9de8cf(0x22d)]()['describe']('Dataset\x20codes\x20to\x20validate\x20against')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(validateSqlContent)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x240),{'title':_0x9de8cf(0x214),'description':_0x9de8cf(0x1fb),'inputSchema':{...authSchema,'sqlName':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x245)](0x1)['describe'](_0x9de8cf(0x1f9)),'dbId':z[_0x9de8cf(0x22b)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x1e2)),'sqlContent':z[_0x9de8cf(0x1e7)]()[_0x9de8cf(0x245)](0x1)[_0x9de8cf(0x1e8)](_0x9de8cf(0x1fa)),'id':z['number']()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x217))},'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':![]}},wrapHandler(saveOrUpdateCustomSql)),this[_0x9de8cf(0x236)][_0x9de8cf(0x249)]&&(registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x1ed),{'title':_0x9de8cf(0x1ea),'description':_0x9de8cf(0x23d),'inputSchema':{...authSchema},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(listBffScripts)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x23f),{'title':_0x9de8cf(0x1f0),'description':_0x9de8cf(0x229),'inputSchema':{...authSchema,'id':z[_0x9de8cf(0x22b)]()[_0x9de8cf(0x1e8)]('Backend\x20Function\x20ID\x20(from\x20list_bff_scripts)')},'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![]}},wrapHandler(getBffScriptInfo)),registerToolWithOptions(this[_0x9de8cf(0x1eb)],_0x9de8cf(0x21c),{'title':'Save\x20or\x20Update\x20Backend\x20Function','description':_0x9de8cf(0x1ec),'inputSchema':{...authSchema,'id':z[_0x9de8cf(0x22b)]()[_0x9de8cf(0x22d)]()[_0x9de8cf(0x1e8)](_0x9de8cf(0x1e6)),'description':z[_0x9de8cf(0x1e7)]()['min'](0x1)['describe'](_0x9de8cf(0x22a)),'scriptContent':z['string']()[_0x9de8cf(0x245)](0x1)[_0x9de8cf(0x1e8)](_0x9de8cf(0x1ef))},'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![]}},wrapHandler(saveOrUpdateBffScript)));}get[a7_0x4d5b7d(0x226)](){const _0x5d94f6=a7_0x4d5b7d;return this[_0x5d94f6(0x1eb)];}async['connect'](_0x2c2d73){const _0x2e2a2a=a7_0x4d5b7d;await this[_0x2e2a2a(0x1eb)][_0x2e2a2a(0x23c)](_0x2c2d73);}async[a7_0x4d5b7d(0x224)](){const _0x3462d0=a7_0x4d5b7d;await this[_0x3462d0(0x1eb)][_0x3462d0(0x224)]();}['logInfo'](){const _0x11fd12=a7_0x4d5b7d;if(!process[_0x11fd12(0x212)][_0x11fd12(0x1e4)])return;console[_0x11fd12(0x209)](_0x11fd12(0x1f3)),console['log'](_0x11fd12(0x1fc)+packageJson['version']),console[_0x11fd12(0x209)](_0x11fd12(0x20e)),this[_0x11fd12(0x236)][_0x11fd12(0x249)]&&console['log'](_0x11fd12(0x213));}}function buildInstructions(_0x583168){const _0xd9de27=a7_0x4d5b7d,_0x25fdd1=_0x583168['bffAutosave']===!![],_0x39a588=_0x25fdd1?_0xd9de27(0x20a):'';return _0xd9de27(0x1f4)+_0x39a588+'\x0a';}function a7_0x5560(_0x2ed49f,_0x23ae2b){_0x2ed49f=_0x2ed49f-0x1e1;const _0x1cd1ea=a7_0x1cd1();let _0x556013=_0x1cd1ea[_0x2ed49f];return _0x556013;}export function createServer(_0xbc24a4){return new LovrabetDatasetMCPServer(_0xbc24a4);}
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`&lt;\x20&gt;\x20&amp;`\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 +1 @@
1
- (function(_0x5afe4e,_0x5a89fa){const _0x589bbe=a8_0x1844,_0x74822d=_0x5afe4e();while(!![]){try{const _0x4b7202=parseInt(_0x589bbe(0x172))/0x1+parseInt(_0x589bbe(0x174))/0x2+-parseInt(_0x589bbe(0x169))/0x3*(parseInt(_0x589bbe(0x17b))/0x4)+parseInt(_0x589bbe(0x179))/0x5*(parseInt(_0x589bbe(0x17d))/0x6)+parseInt(_0x589bbe(0x17f))/0x7+parseInt(_0x589bbe(0x16b))/0x8+-parseInt(_0x589bbe(0x170))/0x9;if(_0x4b7202===_0x5a89fa)break;else _0x74822d['push'](_0x74822d['shift']());}catch(_0x371681){_0x74822d['push'](_0x74822d['shift']());}}}(a8_0x5748,0xe3e39));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode}from'../config/env.js';function a8_0x1844(_0x40e73e,_0x218478){_0x40e73e=_0x40e73e-0x168;const _0x5748e6=a8_0x5748();let _0x184463=_0x5748e6[_0x40e73e];return _0x184463;}export async function executeCustomSql(_0x26049a){const _0x44c38c=a8_0x1844,_0x12aa13=Date[_0x44c38c(0x173)](),{appCode:appCode=getEnvAppCode(),cookie:_0xd4fb87,sqlCode:_0x5a2cd0,params:_0x17e506}=_0x26049a;if(!appCode)throw new Error(_0x44c38c(0x178));if(!_0x5a2cd0||_0x5a2cd0[_0x44c38c(0x17a)]()==='')throw new Error('sqlCode\x20is\x20required.\x20Get\x20it\x20from\x20list_sql_queries\x20->\x20sqlCode');const _0x5dba23=new DevApiClient({'appCode':appCode,'cookie':_0xd4fb87}),_0x178c24=_0x17e506&&Object[_0x44c38c(0x17e)](_0x17e506)['length']>0x0,_0x3f58ec=_0x178c24?Object[_0x44c38c(0x17e)](_0x17e506):[],_0x274a11={'sqlCode':_0x5a2cd0,'hasParams':_0x178c24||![],'paramNames':_0x3f58ec||[]};try{const _0x25693a=await _0x5dba23[_0x44c38c(0x16e)]({'sqlCode':_0x5a2cd0[_0x44c38c(0x17a)](),'params':_0x17e506}),_0x4ae99b=Date[_0x44c38c(0x173)]()-_0x12aa13,_0x473354=_0x25693a['success']??![],_0x1bbeb4=_0x25693a[_0x44c38c(0x16d)];if(!_0x473354){const _0x3249af=_0x25693a[_0x44c38c(0x185)]||_0x25693a[_0x44c38c(0x182)]||'Unknown\x20error';return{'success':![],'execSuccess':![],'execError':_0x3249af,'errorCode':_0x1bbeb4||_0x44c38c(0x16c),'message':_0x44c38c(0x177)+(_0x1bbeb4||'ERR')+_0x44c38c(0x180)+_0x3249af,'executionTime':_0x4ae99b,'sqlInfo':_0x274a11};}const _0x446b8e=_0x25693a[_0x44c38c(0x184)]||_0x25693a,_0x54cbfb=_0x446b8e['execSuccess']??_0x446b8e['success']??!![],_0x1d4b5f=_0x446b8e['execResult']||_0x446b8e[_0x44c38c(0x184)],_0xdfc551=_0x446b8e[_0x44c38c(0x186)]||_0x446b8e['errorMsg'];if(_0x54cbfb){const _0x2cdab9=Array[_0x44c38c(0x175)](_0x1d4b5f)?_0x1d4b5f[_0x44c38c(0x183)]:0x0;return{'success':!![],'execSuccess':!![],'execResult':_0x1d4b5f||[],'rowCount':_0x2cdab9,'message':_0x44c38c(0x181)+_0x2cdab9+_0x44c38c(0x16f),'executionTime':_0x4ae99b,'sqlInfo':_0x274a11};}return{'success':!![],'execSuccess':![],'execError':_0xdfc551||_0x44c38c(0x176),'message':_0x44c38c(0x168)+(_0xdfc551||_0x44c38c(0x17c)),'executionTime':_0x4ae99b,'sqlInfo':_0x274a11};}catch(_0x3e27cc){const _0x280703=Date[_0x44c38c(0x173)]()-_0x12aa13;return{'success':![],'execSuccess':![],'execError':_0x3e27cc[_0x44c38c(0x16a)]||_0x44c38c(0x17c),'message':_0x44c38c(0x171)+(_0x3e27cc['message']||'Unknown\x20error'),'executionTime':_0x280703,'sqlInfo':_0x274a11};}}function a8_0x5748(){const _0x4ee5b3=['\x20row(s).','48178062UxnrFs','API\x20call\x20failed:\x20','529508plklkz','now','2097896RJRNld','isArray','SQL\x20execution\x20failed\x20without\x20error\x20message','SQL\x20execution\x20failed\x20[','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','45WDdeet','trim','12rHONNc','Unknown\x20error','1022484ebxyxt','keys','10856076resqRb',']:\x20','SQL\x20executed\x20successfully.\x20Returned\x20','msg','length','data','errorMsg','execError','SQL\x20execution\x20failed:\x20','221355znzThw','message','14758848XhYNoA','UNKNOWN','errorCode','executeSql'];a8_0x5748=function(){return _0x4ee5b3;};return a8_0x5748();}
1
+ (function(_0x1a5a75,_0x348b77){const _0x66f32c=a10_0x104b,_0x4e7b53=_0x1a5a75();while(!![]){try{const _0x25c7e3=-parseInt(_0x66f32c(0x112))/0x1+parseInt(_0x66f32c(0x111))/0x2+parseInt(_0x66f32c(0x10b))/0x3+parseInt(_0x66f32c(0x122))/0x4*(-parseInt(_0x66f32c(0x124))/0x5)+-parseInt(_0x66f32c(0x118))/0x6+-parseInt(_0x66f32c(0x117))/0x7+-parseInt(_0x66f32c(0x11d))/0x8*(-parseInt(_0x66f32c(0x120))/0x9);if(_0x25c7e3===_0x348b77)break;else _0x4e7b53['push'](_0x4e7b53['shift']());}catch(_0x6cdfcb){_0x4e7b53['push'](_0x4e7b53['shift']());}}}(a10_0x344c,0x8c29c));import{DevApiClient}from'../api/dev-api-client.js';function a10_0x104b(_0xf2a1a6,_0x2631b3){_0xf2a1a6=_0xf2a1a6-0x106;const _0x344c88=a10_0x344c();let _0x104b05=_0x344c88[_0xf2a1a6];return _0x104b05;}function a10_0x344c(){const _0x5c7391=['SQL\x20executed\x20successfully.\x20Returned\x20','errorCode','success','8WlGyFU','errorMsg','data','15040881VpIVry','\x20row(s).','1677268DgmUfX','UNKNOWN','10GZUIld','message','SQL\x20execution\x20failed\x20without\x20error\x20message','API\x20call\x20failed:\x20','trim','ERR','1479558dzlPvr','sqlCode\x20is\x20required.\x20Get\x20it\x20from\x20list_sql_queries\x20->\x20sqlCode','now','keys','executeSql','SQL\x20execution\x20failed:\x20','1624984mwXZHo','764544UavBRs','isArray','Unknown\x20error','SQL\x20execution\x20failed\x20[','length','984438wUElto','3953802FwHvUk','execSuccess'];a10_0x344c=function(){return _0x5c7391;};return a10_0x344c();}import{getEnvAppCode}from'../config/env.js';export async function executeCustomSql(_0x12cd20){const _0x3bb196=a10_0x104b,_0x49f192=Date[_0x3bb196(0x10d)](),{appCode:appCode=getEnvAppCode(),cookie:_0x447671,sqlCode:_0x2c53fa,params:_0x3b890f}=_0x12cd20;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');if(!_0x2c53fa||_0x2c53fa[_0x3bb196(0x109)]()==='')throw new Error(_0x3bb196(0x10c));const _0x1ed13c=new DevApiClient({'appCode':appCode,'cookie':_0x447671}),_0x3f6a38=_0x3b890f&&Object[_0x3bb196(0x10e)](_0x3b890f)['length']>0x0,_0x5ef147=_0x3f6a38?Object[_0x3bb196(0x10e)](_0x3b890f):[],_0x2e93e3={'sqlCode':_0x2c53fa,'hasParams':_0x3f6a38||![],'paramNames':_0x5ef147||[]};try{const _0x216bfd=await _0x1ed13c[_0x3bb196(0x10f)]({'sqlCode':_0x2c53fa[_0x3bb196(0x109)](),'params':_0x3b890f}),_0x26d109=Date['now']()-_0x49f192,_0x10d2a4=_0x216bfd[_0x3bb196(0x11c)]??![],_0x11f364=_0x216bfd[_0x3bb196(0x11b)];if(!_0x10d2a4){const _0xc03e9c=_0x216bfd[_0x3bb196(0x11e)]||_0x216bfd['msg']||_0x3bb196(0x114);return{'success':![],'execSuccess':![],'execError':_0xc03e9c,'errorCode':_0x11f364||_0x3bb196(0x123),'message':_0x3bb196(0x115)+(_0x11f364||_0x3bb196(0x10a))+']:\x20'+_0xc03e9c,'executionTime':_0x26d109,'sqlInfo':_0x2e93e3};}const _0x169987=_0x216bfd[_0x3bb196(0x11f)]||_0x216bfd,_0x4a0bae=_0x169987[_0x3bb196(0x119)]??_0x169987[_0x3bb196(0x11c)]??!![],_0x3c6bc9=_0x169987['execResult']||_0x169987['data'],_0x25dbaa=_0x169987['execError']||_0x169987[_0x3bb196(0x11e)];if(_0x4a0bae){const _0x3bf101=Array[_0x3bb196(0x113)](_0x3c6bc9)?_0x3c6bc9[_0x3bb196(0x116)]:0x0;return{'success':!![],'execSuccess':!![],'execResult':_0x3c6bc9||[],'rowCount':_0x3bf101,'message':_0x3bb196(0x11a)+_0x3bf101+_0x3bb196(0x121),'executionTime':_0x26d109,'sqlInfo':_0x2e93e3};}return{'success':!![],'execSuccess':![],'execError':_0x25dbaa||_0x3bb196(0x107),'message':_0x3bb196(0x110)+(_0x25dbaa||_0x3bb196(0x114)),'executionTime':_0x26d109,'sqlInfo':_0x2e93e3};}catch(_0x46d938){const _0x93744e=Date[_0x3bb196(0x10d)]()-_0x49f192;return{'success':![],'execSuccess':![],'execError':_0x46d938[_0x3bb196(0x106)]||'Unknown\x20error','message':_0x3bb196(0x108)+(_0x46d938['message']||_0x3bb196(0x114)),'executionTime':_0x93744e,'sqlInfo':_0x2e93e3};}}
@@ -1 +1 @@
1
- (function(_0x28f37b,_0x355591){const _0x5d3f51=a9_0x4eb8,_0x4c8109=_0x28f37b();while(!![]){try{const _0x5504fd=parseInt(_0x5d3f51(0x19e))/0x1+-parseInt(_0x5d3f51(0x18f))/0x2+parseInt(_0x5d3f51(0x189))/0x3+parseInt(_0x5d3f51(0x19c))/0x4+parseInt(_0x5d3f51(0x198))/0x5*(parseInt(_0x5d3f51(0x18e))/0x6)+-parseInt(_0x5d3f51(0x1a3))/0x7*(parseInt(_0x5d3f51(0x1a5))/0x8)+-parseInt(_0x5d3f51(0x19b))/0x9;if(_0x5504fd===_0x355591)break;else _0x4c8109['push'](_0x4c8109['shift']());}catch(_0x35dcad){_0x4c8109['push'](_0x4c8109['shift']());}}}(a9_0x4447,0x5c4d3));function a9_0x4eb8(_0x4bc09f,_0xb88f3){_0x4bc09f=_0x4bc09f-0x188;const _0x4447f8=a9_0x4447();let _0x4eb8be=_0x4447f8[_0x4bc09f];return _0x4eb8be;}function a9_0x4447(){const _0x503a9d=['\x20|\x20数据表:\x20','getTableName','7ggqmfW','\x27\x20in\x20dataset\x20\x27','1762280ZAkBRy','getDatasetSDKKey','//\x20数据集:\x20','2200530XNDRxo','getModelAlias','generateFullSDKExample','replace','responseExample','180RVhUdg','1468476jVLDPE','typescript','getOperationDocMeta','operationName\x20is\x20required','name','getTableKey','getDatasetDetail','requestExample','code','121085eUTXNy','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','toJSON','10132641czyqvG','2795300Vsikbk','getOperationAnalysis','299594IverAi','generateSDKInitCode','Cannot\x20generate\x20SDK\x20code\x20for\x20operation\x20\x27'];a9_0x4447=function(){return _0x503a9d;};return a9_0x4447();}import{DevApiClient}from'../api/dev-api-client.js';import{DrivenDataDetailPlus}from'@lovrabet/dsparser';import{getEnvAppCode,getEnvironment}from'../config/env.js';import{buildFieldRelationsMap,enrichFieldsWithRelations}from'../utils/relations.js';export async function generateSDKCode(_0x5ec510){const _0x489161=a9_0x4eb8,{appCode:appCode=getEnvAppCode(),cookie:_0x1b38ca,datasetCode:_0x5ee8e7,operationName:_0x1da2dc,includeImports:includeImports=!![],useAlias:useAlias=![]}=_0x5ec510;if(!appCode)throw new Error(_0x489161(0x199));if(!_0x5ee8e7)throw new Error('datasetCode\x20is\x20required');if(!_0x1da2dc)throw new Error(_0x489161(0x192));const _0x39174c=new DevApiClient({'appCode':appCode,'cookie':_0x1b38ca}),_0x28d064=getEnvironment(),_0x48c487=await _0x39174c[_0x489161(0x195)](_0x5ee8e7),_0x33be18=_0x48c487['data']||_0x48c487,_0x2bcfc3=new DrivenDataDetailPlus(_0x33be18),_0x37c632=_0x2bcfc3[_0x489161(0x191)](_0x1da2dc);if(!_0x37c632)throw new Error(_0x489161(0x1a0)+_0x1da2dc+_0x489161(0x1a4)+_0x5ee8e7+'\x27');const _0x497ae4=_0x2bcfc3[_0x489161(0x1a6)](),_0x215acb=_0x2bcfc3[_0x489161(0x18a)](),_0x2bc91c=_0x2bcfc3[_0x489161(0x194)](),_0x4ffdd3=_0x2bcfc3[_0x489161(0x1a2)](),_0x1b3002=_0x2bcfc3[_0x489161(0x193)],_0x5781c0=_0x2bcfc3['getFieldList'](),_0x4bc344=_0x5781c0?.[_0x489161(0x19a)]?.()||[],_0x3da997=buildFieldRelationsMap(_0x48c487),_0x13b839=enrichFieldsWithRelations(_0x4bc344,_0x3da997),_0x44ed1d=_0x2bcfc3[_0x489161(0x18b)](_0x1da2dc,appCode),_0x383c3c=_0x2bcfc3[_0x489161(0x19d)](_0x1da2dc);let _0x4e7ef0=_0x37c632['sdkCall'][_0x489161(0x197)],_0xe40f0e=_0x44ed1d||undefined;useAlias&&(_0x4e7ef0=_0x4e7ef0[_0x489161(0x18c)](new RegExp(_0x497ae4,'g'),_0x215acb),_0xe40f0e&&(_0xe40f0e=_0xe40f0e['replace'](new RegExp(_0x497ae4,'g'),_0x215acb)));const _0x108fa8=_0x489161(0x188)+_0x1b3002+_0x489161(0x1a1)+_0x4ffdd3+'\x0a',_0x47e6a9=_0x108fa8+_0x4e7ef0,_0x4df9e5=_0xe40f0e?'//\x20数据集:\x20'+_0x1b3002+'\x20|\x20数据表:\x20'+_0x4ffdd3+'\x0a'+_0xe40f0e:undefined;return{'appCode':appCode,'env':_0x28d064,'datasetName':_0x1b3002,'language':_0x489161(0x190),'code':_0x47e6a9,'fullExample':includeImports?_0x4df9e5:undefined,'sdkCallInfo':{'modelName':_0x215acb,'tableName':_0x4ffdd3,'tableKey':_0x2bc91c,'datasetCode':_0x2bcfc3['datasetCode'],'operationName':_0x1da2dc},'fields':_0x13b839,'requestExample':_0x383c3c?.[_0x489161(0x196)],'responseExample':_0x383c3c?.[_0x489161(0x18d)],'sdkInitCode':_0x2bcfc3[_0x489161(0x19f)](_0x2bc91c),'usageExample':_0x37c632['usageExample'],'aliasExplanation':useAlias?_0x2bcfc3['generateAliasExplanation']():undefined,'aliasHint':{'defaultAlias':_0x215acb,'datasetSDKKey':_0x497ae4}};}
1
+ function a11_0x4f29(_0x473800,_0x15be2f){_0x473800=_0x473800-0x182;const _0x1618cf=a11_0x1618();let _0x4f293f=_0x1618cf[_0x473800];return _0x4f293f;}function a11_0x1618(){const _0x34f6fa=['replace','usageExample','2664485QULCFh','getOperationAnalysis','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','getOperationDocMeta','code','144pjAIGJ','getDatasetSDKKey','971687OLonco','datasetCode\x20is\x20required','15036HQgtQV','611217PTUhOo','29411630ALFAKg','operationName\x20is\x20required','generateSDKInitCode','1494592eLKCXo','getModelAlias','186vTycIG','responseExample','\x27\x20in\x20dataset\x20\x27','getFieldList','datasetCode','163786JwTfUW','//\x20数据集:\x20','getTableName','typescript','generateFullSDKExample','Cannot\x20generate\x20SDK\x20code\x20for\x20operation\x20\x27','toJSON','366RIkbuI','data'];a11_0x1618=function(){return _0x34f6fa;};return a11_0x1618();}(function(_0x24ac8d,_0xc65be2){const _0x1900b8=a11_0x4f29,_0x284f7a=_0x24ac8d();while(!![]){try{const _0x531e55=parseInt(_0x1900b8(0x189))/0x1+parseInt(_0x1900b8(0x190))/0x2+-parseInt(_0x1900b8(0x19e))/0x3*(parseInt(_0x1900b8(0x18b))/0x4)+parseInt(_0x1900b8(0x182))/0x5+parseInt(_0x1900b8(0x192))/0x6*(parseInt(_0x1900b8(0x197))/0x7)+parseInt(_0x1900b8(0x187))/0x8*(parseInt(_0x1900b8(0x18c))/0x9)+-parseInt(_0x1900b8(0x18d))/0xa;if(_0x531e55===_0xc65be2)break;else _0x284f7a['push'](_0x284f7a['shift']());}catch(_0x23e0d1){_0x284f7a['push'](_0x284f7a['shift']());}}}(a11_0x1618,0xc3493));import{DevApiClient}from'../api/dev-api-client.js';import{DrivenDataDetailPlus}from'@lovrabet/dsparser';import{getEnvAppCode,getEnvironment}from'../config/env.js';import{buildFieldRelationsMap,enrichFieldsWithRelations}from'../utils/relations.js';export async function generateSDKCode(_0x5a5c41){const _0x440d0d=a11_0x4f29,{appCode:appCode=getEnvAppCode(),cookie:_0x440e0c,datasetCode:_0x1f42d2,operationName:_0x4f87ee,includeImports:includeImports=!![],useAlias:useAlias=![]}=_0x5a5c41;if(!appCode)throw new Error(_0x440d0d(0x184));if(!_0x1f42d2)throw new Error(_0x440d0d(0x18a));if(!_0x4f87ee)throw new Error(_0x440d0d(0x18e));const _0x5394b8=new DevApiClient({'appCode':appCode,'cookie':_0x440e0c}),_0x5d44e7=getEnvironment(),_0x379515=await _0x5394b8['getDatasetDetail'](_0x1f42d2),_0x8fcc3f=_0x379515[_0x440d0d(0x19f)]||_0x379515,_0x338dc3=new DrivenDataDetailPlus(_0x8fcc3f),_0x2d4c5e=_0x338dc3[_0x440d0d(0x185)](_0x4f87ee);if(!_0x2d4c5e)throw new Error(_0x440d0d(0x19c)+_0x4f87ee+_0x440d0d(0x194)+_0x1f42d2+'\x27');const _0x57168a=_0x338dc3[_0x440d0d(0x188)](),_0x595029=_0x338dc3[_0x440d0d(0x191)](),_0x15a0e4=_0x338dc3['getTableKey'](),_0xd1e952=_0x338dc3[_0x440d0d(0x199)](),_0xe22956=_0x338dc3['name'],_0x27459d=_0x338dc3[_0x440d0d(0x195)](),_0x5a3b61=_0x27459d?.[_0x440d0d(0x19d)]?.()||[],_0xcb8c0d=buildFieldRelationsMap(_0x379515),_0x222c0b=enrichFieldsWithRelations(_0x5a3b61,_0xcb8c0d),_0x4edc29=_0x338dc3[_0x440d0d(0x19b)](_0x4f87ee,appCode),_0x1cc138=_0x338dc3[_0x440d0d(0x183)](_0x4f87ee);let _0x193998=_0x2d4c5e['sdkCall'][_0x440d0d(0x186)],_0x47e4cf=_0x4edc29||undefined;useAlias&&(_0x193998=_0x193998[_0x440d0d(0x1a0)](new RegExp(_0x57168a,'g'),_0x595029),_0x47e4cf&&(_0x47e4cf=_0x47e4cf[_0x440d0d(0x1a0)](new RegExp(_0x57168a,'g'),_0x595029)));const _0x533b77=_0x440d0d(0x198)+_0xe22956+'\x20|\x20数据表:\x20'+_0xd1e952+'\x0a',_0x5bfed6=_0x533b77+_0x193998,_0x5f28c3=_0x47e4cf?_0x440d0d(0x198)+_0xe22956+'\x20|\x20数据表:\x20'+_0xd1e952+'\x0a'+_0x47e4cf:undefined;return{'appCode':appCode,'env':_0x5d44e7,'datasetName':_0xe22956,'language':_0x440d0d(0x19a),'code':_0x5bfed6,'fullExample':includeImports?_0x5f28c3:undefined,'sdkCallInfo':{'modelName':_0x595029,'tableName':_0xd1e952,'tableKey':_0x15a0e4,'datasetCode':_0x338dc3[_0x440d0d(0x196)],'operationName':_0x4f87ee},'fields':_0x222c0b,'requestExample':_0x1cc138?.['requestExample'],'responseExample':_0x1cc138?.[_0x440d0d(0x193)],'sdkInitCode':_0x338dc3[_0x440d0d(0x18f)](_0x15a0e4),'usageExample':_0x2d4c5e[_0x440d0d(0x1a1)],'aliasExplanation':useAlias?_0x338dc3['generateAliasExplanation']():undefined,'aliasHint':{'defaultAlias':_0x595029,'datasetSDKKey':_0x57168a}};}
@@ -1 +1 @@
1
- (function(_0x5c99ea,_0x5dc98c){const _0x352ad7=a10_0x4c77,_0x50e9ac=_0x5c99ea();while(!![]){try{const _0x5bc518=-parseInt(_0x352ad7(0x11f))/0x1+parseInt(_0x352ad7(0x127))/0x2*(-parseInt(_0x352ad7(0x12b))/0x3)+-parseInt(_0x352ad7(0x12f))/0x4*(-parseInt(_0x352ad7(0x12a))/0x5)+-parseInt(_0x352ad7(0x12e))/0x6+-parseInt(_0x352ad7(0x121))/0x7+-parseInt(_0x352ad7(0x123))/0x8*(parseInt(_0x352ad7(0x115))/0x9)+-parseInt(_0x352ad7(0x11a))/0xa*(-parseInt(_0x352ad7(0x118))/0xb);if(_0x5bc518===_0x5dc98c)break;else _0x50e9ac['push'](_0x50e9ac['shift']());}catch(_0x7263fa){_0x50e9ac['push'](_0x50e9ac['shift']());}}}(a10_0x3404,0x35d3f));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode,getEnvironment}from'../config/env.js';export async function generateSqlCode(_0x1c1ae6){const _0x55b5fb=a10_0x4c77,{appCode:appCode=getEnvAppCode(),cookie:_0xe2b2b2,sqlCode:_0x449338,params:_0x298049,includeImports:includeImports=!![],target:target=_0x55b5fb(0xf6)}=_0x1c1ae6;if(!appCode)throw new Error(_0x55b5fb(0x109));if(!_0x449338||_0x449338[_0x55b5fb(0xfd)]()==='')return{'success':![],'sqlCode':'','sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[]},'error':_0x55b5fb(0xfc)};const _0x3cbc26=_0x449338['trim'](),_0x105db4=new DevApiClient({'appCode':appCode,'cookie':_0xe2b2b2}),_0x2fcd1a=getEnvironment();try{const _0x108b9d=await _0x105db4[_0x55b5fb(0x12d)]({'pageSize':0x3e7,'currentPage':0x1,'sqlCode':_0x3cbc26}),_0x334074=_0x108b9d['data']?.[_0x55b5fb(0x129)]||[],_0x28353c=_0x334074[_0x55b5fb(0x11d)](_0x4f2baf=>_0x4f2baf[_0x55b5fb(0x126)]===_0x3cbc26||_0x4f2baf[_0x55b5fb(0x126)]?.[_0x55b5fb(0x107)](_0x3cbc26)||_0x3cbc26[_0x55b5fb(0x107)](_0x4f2baf[_0x55b5fb(0x126)]));if(!_0x28353c)return{'success':![],'sqlCode':_0x3cbc26,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x55b5fb(0x10a)+_0x3cbc26+_0x55b5fb(0x114),_0x55b5fb(0x102),_0x55b5fb(0x119)]},'error':_0x55b5fb(0x10a)+_0x3cbc26+_0x55b5fb(0xf7)};const _0x3e1473=_0x28353c[_0x55b5fb(0x126)],_0x3faaf7=_0x28353c[_0x55b5fb(0x112)]||_0x28353c[_0x55b5fb(0x12c)]||_0x55b5fb(0x111)+(_0x28353c[_0x55b5fb(0x11b)]||_0x28353c['id']),_0x2900a8=_0x28353c[_0x55b5fb(0x130)]||_0x28353c[_0x55b5fb(0x105)]||'',_0x47dfe2=_0x2900a8['match'](/[:$]\{?(\w+)\}?/g);let _0x7d3302,_0x420815;if(_0x47dfe2){const _0x2f987d=Array[_0x55b5fb(0xed)](new Set(_0x47dfe2[_0x55b5fb(0x11e)](_0x25b608=>_0x25b608[_0x55b5fb(0x106)](/[:${}]/g,''))));_0x7d3302=_0x2f987d[_0x55b5fb(0x11e)](_0x298110=>{const _0x47853f=_0x298049?.[_0x298110]??getDefaultExample(_0x298110);return{'name':_0x298110,'example':_0x47853f};}),_0x420815=_0x7d3302['reduce']((_0x2f3589,_0x471e7b)=>({..._0x2f3589,[_0x471e7b[_0x55b5fb(0x12c)]]:_0x471e7b[_0x55b5fb(0x113)]}),{});}else _0x298049&&(_0x7d3302=Object[_0x55b5fb(0x124)](_0x298049)[_0x55b5fb(0x11e)](([_0x1779a6,_0x5315a5])=>({'name':_0x1779a6,'example':_0x5315a5})),_0x420815=_0x298049);const _0x10d145=_0x7d3302&&_0x7d3302['length']>0x0,_0x419ffb=_0x10d145?JSON[_0x55b5fb(0x10e)](_0x420815,null,0x2):'',_0x48c002=_0x10d145?'{\x0a\x20\x20sqlCode:\x20\x27'+_0x3e1473+'\x27,\x0a\x20\x20params:\x20'+_0x419ffb+_0x55b5fb(0xf8):_0x55b5fb(0x131)+_0x3e1473+_0x55b5fb(0x128);let _0x1e5df7;target===_0x55b5fb(0x10b)?_0x1e5df7=_0x55b5fb(0xfb)+_0x3faaf7+_0x55b5fb(0xee)+_0x48c002+');\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}':_0x1e5df7=(includeImports?_0x55b5fb(0x10f):'')+_0x55b5fb(0x122)+appCode+_0x55b5fb(0xf4)+_0x2fcd1a+'\x27,\x0a});\x0a\x0a//\x20Execute\x20SQL:\x20'+_0x3faaf7+_0x55b5fb(0x10d)+_0x48c002+');\x0a\x0a//\x20IMPORTANT:\x20SDK\x20returns\x20wrapper\x20—\x20check\x20execSuccess\x20before\x20using\x20results\x0aif\x20(!data.execSuccess)\x20{\x0a\x20\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);\x0a}\x0a\x0a//\x20Process\x20the\x20results\x0aconst\x20results\x20=\x20data.execResult\x20||\x20[];\x0aconsole.log(`Retrieved\x20${results.length}\x20rows`);\x0a\x0a//\x20Use\x20the\x20data\x0aresults.forEach((row:\x20any)\x20=>\x20{\x0a\x20\x20console.log(row);\x0a});';const _0xb57aa6=target===_0x55b5fb(0x10b);return{'success':!![],'sqlCode':_0x3e1473,'sqlName':_0x3faaf7,'sqlExists':!![],'code':_0x1e5df7,'parameters':_0x7d3302,'usage':{'description':_0x55b5fb(0xef)+(_0xb57aa6?_0x55b5fb(0x110):_0x55b5fb(0xf3))+'\x20code\x20for\x20SQL:\x20'+_0x3faaf7,'important':[_0x55b5fb(0x10a)+_0x3e1473+_0x55b5fb(0x101),_0xb57aa6?_0x55b5fb(0xff):_0x55b5fb(0x108),_0xb57aa6?_0x55b5fb(0xf9):_0x55b5fb(0x104),_0x10d145?_0x55b5fb(0xf1)+_0x7d3302['map'](_0x213fe1=>_0x213fe1[_0x55b5fb(0x12c)])['join'](',\x20'):_0x55b5fb(0xf0),_0x55b5fb(0x10c)]}};}catch(_0x34792b){return{'success':![],'sqlCode':_0x3cbc26,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':['Failed\x20to\x20verify\x20SQL\x20code:\x20'+_0x34792b['message'],_0x55b5fb(0x102)]},'error':_0x55b5fb(0x100)+_0x34792b[_0x55b5fb(0x11c)]};}}function a10_0x4c77(_0x4bfe8a,_0x1dcf7b){_0x4bfe8a=_0x4bfe8a-0xec;const _0x340484=a10_0x3404();let _0x4c77b0=_0x340484[_0x4bfe8a];return _0x4c77b0;}function a10_0x3404(){const _0x25e40e=['On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20—\x20use\x20try-catch','sql','replace','includes','SDK\x20client.sql.execute()\x20returns\x20{\x20execSuccess,\x20execResult\x20}\x20—\x20always\x20check\x20execSuccess','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','SQL\x20code\x20\x22','bff','Note:\x20client.api.executeSql()\x20is\x20deprecated.\x20Use\x20client.sql.execute()\x20instead.','\x0aconst\x20data\x20=\x20await\x20client.sql.execute(','stringify','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;\x0a\x0a','Backend\x20Function','SQL-','sqlName','example','\x22\x20not\x20found\x20in\x20the\x20application.','9BcDBbD','limit','status','660jFlNSt','Check\x20the\x20sqlCode\x20from\x20list_sql_queries\x20result\x20and\x20use\x20the\x20exact\x20value.','193440JHjHVE','sqlId','message','find','map','235584vhWXYA','page','1019662UdAhpV','//\x20Initialize\x20the\x20SDK\x20client\x0aconst\x20client\x20=\x20new\x20LovrabetClient({\x0a\x20\x20appCode:\x20\x27','3184968JhAvVx','entries','size','sqlCode','5442DGfIXv','\x27\x20}','tableData','181695uQnntv','369cwqpOg','name','getCustomSqlList','700914AEolzq','32pOPaNH','sqlContent','{\x20sqlCode:\x20\x27','count','from','\x22\x0aexport\x20default\x20async\x20function(params,\x20context)\x20{\x0a\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute(','Generated\x20','This\x20SQL\x20does\x20not\x20require\x20any\x20parameters','This\x20SQL\x20requires\x20parameters:\x20','time','Frontend\x20SDK','\x27,\x0a\x20\x20env:\x20\x27','toLowerCase','sdk','\x22\x20does\x20not\x20exist.\x20Use\x20list_sql_queries\x20to\x20find\x20valid\x20SQL\x20codes.',',\x0a}','Errors\x20throw\x20exceptions\x20—\x20use\x20try-catch','search','//\x20Backend\x20Function:\x20Execute\x20SQL\x20\x22','sqlCode\x20is\x20required','trim','2024-01-01','BFF\x20context.client.sql.execute()\x20returns\x20rows\x20T[]\x20directly\x20—\x20no\x20wrapper\x20object','Failed\x20to\x20verify\x20SQL\x20code:\x20','\x22\x20exists\x20and\x20is\x20valid.','Use\x20list_sql_queries\x20to\x20see\x20all\x20available\x20SQLs.','value'];a10_0x3404=function(){return _0x25e40e;};return a10_0x3404();}function getDefaultExample(_0x23bdf4){const _0x460721=a10_0x4c77,_0x9a16b9=_0x23bdf4[_0x460721(0xf5)]();if(_0x9a16b9[_0x460721(0x107)]('date')||_0x9a16b9[_0x460721(0x107)](_0x460721(0xf2)))return _0x460721(0xfe);if(_0x9a16b9['includes']('id'))return 0x7b;if(_0x9a16b9[_0x460721(0x107)](_0x460721(0x116))||_0x9a16b9[_0x460721(0x107)](_0x460721(0xec))||_0x9a16b9[_0x460721(0x107)](_0x460721(0x125)))return 0xa;if(_0x9a16b9[_0x460721(0x107)](_0x460721(0x120)))return 0x1;if(_0x9a16b9['includes']('keyword')||_0x9a16b9[_0x460721(0x107)](_0x460721(0xfa))||_0x9a16b9['includes'](_0x460721(0x12c)))return _0x460721(0x113);if(_0x9a16b9[_0x460721(0x107)](_0x460721(0x117)))return 0x1;return _0x460721(0x103);}
1
+ (function(_0x29e437,_0xf3b9db){const _0xd90667=a12_0x1845,_0x5be77d=_0x29e437();while(!![]){try{const _0x79dc9d=-parseInt(_0xd90667(0x20a))/0x1*(-parseInt(_0xd90667(0x1e0))/0x2)+-parseInt(_0xd90667(0x209))/0x3*(parseInt(_0xd90667(0x1e9))/0x4)+-parseInt(_0xd90667(0x1c9))/0x5+parseInt(_0xd90667(0x1f2))/0x6*(-parseInt(_0xd90667(0x1d3))/0x7)+-parseInt(_0xd90667(0x205))/0x8*(-parseInt(_0xd90667(0x1ff))/0x9)+-parseInt(_0xd90667(0x1f6))/0xa*(-parseInt(_0xd90667(0x206))/0xb)+parseInt(_0xd90667(0x1dd))/0xc*(parseInt(_0xd90667(0x1de))/0xd);if(_0x79dc9d===_0xf3b9db)break;else _0x5be77d['push'](_0x5be77d['shift']());}catch(_0x1b4283){_0x5be77d['push'](_0x5be77d['shift']());}}}(a12_0x1d23,0x297e9));import{DevApiClient}from'../api/dev-api-client.js';function a12_0x1845(_0x30dccd,_0x319a20){_0x30dccd=_0x30dccd-0x1c5;const _0x1d239d=a12_0x1d23();let _0x1845c4=_0x1d239d[_0x30dccd];return _0x1845c4;}import{getEnvAppCode,getEnvironment}from'../config/env.js';function a12_0x1d23(){const _0x4c8ad5=['sdk','sqlContent','BFF\x20context.client.sql.execute()\x20returns\x20rows\x20T[]\x20directly\x20—\x20no\x20wrapper\x20object','size','data','1560138MIGNuE','match','//\x20Initialize\x20the\x20SDK\x20client\x0aconst\x20client\x20=\x20new\x20LovrabetClient({\x0a\x20\x20appCode:\x20\x27','page','10TOPTUh','On\x20HTTP\x20error,\x20SDK\x20throws\x20LovrabetError\x20—\x20use\x20try-catch','sqlCode','SQL\x20code\x20\x22','join','date',');\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}',',\x0a}','sql','18VNbQIM','\x27,\x0a\x20\x20env:\x20\x27','time','sqlId','sqlName','count','1112816gVTUwX','484297gkFbtc','name','from','922926EVTEnK','950ACUijI','Frontend\x20SDK','Check\x20the\x20sqlCode\x20from\x20list_sql_queries\x20result\x20and\x20use\x20the\x20exact\x20value.','entries','tableData','1515375rlKxvI','This\x20SQL\x20does\x20not\x20require\x20any\x20parameters','toLowerCase','\x27,\x0a});\x0a\x0a//\x20Execute\x20SQL:\x20','map','Errors\x20throw\x20exceptions\x20—\x20use\x20try-catch','\x27\x20}','Use\x20list_sql_queries\x20to\x20see\x20all\x20available\x20SQLs.','//\x20Backend\x20Function:\x20Execute\x20SQL\x20\x22','status','7OKVamY','Backend\x20Function','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;\x0a\x0a','This\x20SQL\x20requires\x20parameters:\x20','\x22\x20does\x20not\x20exist.\x20Use\x20list_sql_queries\x20to\x20find\x20valid\x20SQL\x20codes.','example','Failed\x20to\x20verify\x20SQL\x20code:\x20','\x22\x20not\x20found\x20in\x20the\x20application.','stringify','getCustomSqlList','60lGnFaG','1381432CxtxeH','trim','394lRGtwZ','2024-01-01','reduce','message','includes','\x22\x20exists\x20and\x20is\x20valid.','bff',');\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});','\x27,\x0a\x20\x20params:\x20','4oJXYGu','length','Generated\x20','limit'];a12_0x1d23=function(){return _0x4c8ad5;};return a12_0x1d23();}export async function generateSqlCode(_0x3509d3){const _0x215a2b=a12_0x1845,{appCode:appCode=getEnvAppCode(),cookie:_0x5d44fa,sqlCode:_0x12ac28,params:_0x4788a5,includeImports:includeImports=!![],target:target=_0x215a2b(0x1ed)}=_0x3509d3;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');if(!_0x12ac28||_0x12ac28[_0x215a2b(0x1df)]()==='')return{'success':![],'sqlCode':'','sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[]},'error':'sqlCode\x20is\x20required'};const _0xbbac33=_0x12ac28[_0x215a2b(0x1df)](),_0x3db059=new DevApiClient({'appCode':appCode,'cookie':_0x5d44fa}),_0x494009=getEnvironment();try{const _0xc9d2f=await _0x3db059[_0x215a2b(0x1dc)]({'pageSize':0x3e7,'currentPage':0x1,'sqlCode':_0xbbac33}),_0x31570e=_0xc9d2f[_0x215a2b(0x1f1)]?.[_0x215a2b(0x1c8)]||[],_0x4fb090=_0x31570e['find'](_0x80b95d=>_0x80b95d['sqlCode']===_0xbbac33||_0x80b95d[_0x215a2b(0x1f8)]?.[_0x215a2b(0x1e4)](_0xbbac33)||_0xbbac33[_0x215a2b(0x1e4)](_0x80b95d[_0x215a2b(0x1f8)]));if(!_0x4fb090)return{'success':![],'sqlCode':_0xbbac33,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':['SQL\x20code\x20\x22'+_0xbbac33+_0x215a2b(0x1da),_0x215a2b(0x1d0),_0x215a2b(0x1c6)]},'error':'SQL\x20code\x20\x22'+_0xbbac33+_0x215a2b(0x1d7)};const _0x369e0a=_0x4fb090[_0x215a2b(0x1f8)],_0x592ba4=_0x4fb090[_0x215a2b(0x203)]||_0x4fb090[_0x215a2b(0x207)]||'SQL-'+(_0x4fb090[_0x215a2b(0x202)]||_0x4fb090['id']),_0x445402=_0x4fb090[_0x215a2b(0x1ee)]||_0x4fb090[_0x215a2b(0x1fe)]||'',_0x5a9d3f=_0x445402[_0x215a2b(0x1f3)](/[:$]\{?(\w+)\}?/g);let _0x1ee46d,_0x4dbfa6;if(_0x5a9d3f){const _0x15837e=Array[_0x215a2b(0x208)](new Set(_0x5a9d3f['map'](_0x9b1bca=>_0x9b1bca['replace'](/[:${}]/g,''))));_0x1ee46d=_0x15837e['map'](_0x52312e=>{const _0x3f7c87=_0x4788a5?.[_0x52312e]??getDefaultExample(_0x52312e);return{'name':_0x52312e,'example':_0x3f7c87};}),_0x4dbfa6=_0x1ee46d[_0x215a2b(0x1e2)]((_0x3b9a46,_0x5763fb)=>({..._0x3b9a46,[_0x5763fb[_0x215a2b(0x207)]]:_0x5763fb['example']}),{});}else _0x4788a5&&(_0x1ee46d=Object[_0x215a2b(0x1c7)](_0x4788a5)[_0x215a2b(0x1cd)](([_0x146201,_0xabc70])=>({'name':_0x146201,'example':_0xabc70})),_0x4dbfa6=_0x4788a5);const _0x50c097=_0x1ee46d&&_0x1ee46d[_0x215a2b(0x1ea)]>0x0,_0x5dde61=_0x50c097?JSON[_0x215a2b(0x1db)](_0x4dbfa6,null,0x2):'',_0x3754ff=_0x50c097?'{\x0a\x20\x20sqlCode:\x20\x27'+_0x369e0a+_0x215a2b(0x1e8)+_0x5dde61+_0x215a2b(0x1fd):'{\x20sqlCode:\x20\x27'+_0x369e0a+_0x215a2b(0x1cf);let _0x9e35bb;target===_0x215a2b(0x1e6)?_0x9e35bb=_0x215a2b(0x1d1)+_0x592ba4+'\x22\x0aexport\x20default\x20async\x20function(params,\x20context)\x20{\x0a\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute('+_0x3754ff+_0x215a2b(0x1fc):_0x9e35bb=(includeImports?_0x215a2b(0x1d5):'')+_0x215a2b(0x1f4)+appCode+_0x215a2b(0x200)+_0x494009+_0x215a2b(0x1cc)+_0x592ba4+'\x0aconst\x20data\x20=\x20await\x20client.sql.execute('+_0x3754ff+_0x215a2b(0x1e7);const _0xe4c58f=target===_0x215a2b(0x1e6);return{'success':!![],'sqlCode':_0x369e0a,'sqlName':_0x592ba4,'sqlExists':!![],'code':_0x9e35bb,'parameters':_0x1ee46d,'usage':{'description':_0x215a2b(0x1eb)+(_0xe4c58f?_0x215a2b(0x1d4):_0x215a2b(0x1c5))+'\x20code\x20for\x20SQL:\x20'+_0x592ba4,'important':[_0x215a2b(0x1f9)+_0x369e0a+_0x215a2b(0x1e5),_0xe4c58f?_0x215a2b(0x1ef):'SDK\x20client.sql.execute()\x20returns\x20{\x20execSuccess,\x20execResult\x20}\x20—\x20always\x20check\x20execSuccess',_0xe4c58f?_0x215a2b(0x1ce):_0x215a2b(0x1f7),_0x50c097?_0x215a2b(0x1d6)+_0x1ee46d[_0x215a2b(0x1cd)](_0x20f3dc=>_0x20f3dc['name'])[_0x215a2b(0x1fa)](',\x20'):_0x215a2b(0x1ca),'Note:\x20client.api.executeSql()\x20is\x20deprecated.\x20Use\x20client.sql.execute()\x20instead.']}};}catch(_0x4865a0){return{'success':![],'sqlCode':_0xbbac33,'sqlName':'','sqlExists':![],'code':'','usage':{'description':'','important':[_0x215a2b(0x1d9)+_0x4865a0[_0x215a2b(0x1e3)],_0x215a2b(0x1d0)]},'error':'Failed\x20to\x20verify\x20SQL\x20code:\x20'+_0x4865a0[_0x215a2b(0x1e3)]};}}function getDefaultExample(_0x3ff3d1){const _0x56676e=a12_0x1845,_0x2aafc2=_0x3ff3d1[_0x56676e(0x1cb)]();if(_0x2aafc2[_0x56676e(0x1e4)](_0x56676e(0x1fb))||_0x2aafc2[_0x56676e(0x1e4)](_0x56676e(0x201)))return _0x56676e(0x1e1);if(_0x2aafc2[_0x56676e(0x1e4)]('id'))return 0x7b;if(_0x2aafc2[_0x56676e(0x1e4)](_0x56676e(0x1ec))||_0x2aafc2['includes'](_0x56676e(0x204))||_0x2aafc2[_0x56676e(0x1e4)](_0x56676e(0x1f0)))return 0xa;if(_0x2aafc2['includes'](_0x56676e(0x1f5)))return 0x1;if(_0x2aafc2['includes']('keyword')||_0x2aafc2[_0x56676e(0x1e4)]('search')||_0x2aafc2[_0x56676e(0x1e4)](_0x56676e(0x207)))return _0x56676e(0x1d8);if(_0x2aafc2['includes'](_0x56676e(0x1d2)))return 0x1;return'value';}
@@ -1 +1 @@
1
- (function(_0x412732,_0x3f7296){const _0x5c1cdc=a11_0x2bdb,_0x2524fe=_0x412732();while(!![]){try{const _0x47c9f9=-parseInt(_0x5c1cdc(0x181))/0x1+-parseInt(_0x5c1cdc(0x174))/0x2+parseInt(_0x5c1cdc(0x17b))/0x3*(parseInt(_0x5c1cdc(0x179))/0x4)+parseInt(_0x5c1cdc(0x183))/0x5*(-parseInt(_0x5c1cdc(0x180))/0x6)+-parseInt(_0x5c1cdc(0x175))/0x7*(parseInt(_0x5c1cdc(0x182))/0x8)+-parseInt(_0x5c1cdc(0x176))/0x9+-parseInt(_0x5c1cdc(0x17a))/0xa*(-parseInt(_0x5c1cdc(0x177))/0xb);if(_0x47c9f9===_0x3f7296)break;else _0x2524fe['push'](_0x2524fe['shift']());}catch(_0x611603){_0x2524fe['push'](_0x2524fe['shift']());}}}(a11_0x591c,0xb6147));import{DevApiClient}from'../api/dev-api-client.js';function a11_0x591c(){const _0x1735e2=['365540sZLMqM','10tvhxWE','33beRVAi','getBffScriptInfo','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','Failed\x20to\x20fetch\x20Backend\x20Function\x20script\x20info\x20for\x20id:\x20','data','138igzqPF','594361XWAIxx','104FVgmQw','93750chDctF','1930492cvluFz','16471yabCZw','2751021JlnGOM','22744469ZaTYfH','id\x20is\x20required\x20and\x20must\x20be\x20a\x20positive\x20number.\x20Get\x20it\x20from\x20list_bff_scripts.'];a11_0x591c=function(){return _0x1735e2;};return a11_0x591c();}import{getEnvAppCode}from'../config/env.js';function a11_0x2bdb(_0xe9184f,_0x374d12){_0xe9184f=_0xe9184f-0x174;const _0x591cde=a11_0x591c();let _0x2bdbd2=_0x591cde[_0xe9184f];return _0x2bdbd2;}export async function getBffScriptInfo(_0x3b12a6){const _0x350ecd=a11_0x2bdb,{appCode:appCode=getEnvAppCode(),cookie:_0x3fc5b3,id:_0x4b78f2}=_0x3b12a6;if(!appCode)throw new Error(_0x350ecd(0x17d));if(!_0x4b78f2||_0x4b78f2<=0x0)throw new Error(_0x350ecd(0x178));const _0x4d924a=new DevApiClient({'appCode':appCode,'cookie':_0x3fc5b3}),_0x3c0e1b=await _0x4d924a[_0x350ecd(0x17c)](_0x4b78f2);if(!_0x3c0e1b['success']||!_0x3c0e1b[_0x350ecd(0x17f)])return{'success':![],'message':_0x350ecd(0x17e)+_0x4b78f2};return{'success':!![],'script':_0x3c0e1b[_0x350ecd(0x17f)]};}
1
+ function a13_0x398a(){const _0x21691c=['Failed\x20to\x20fetch\x20Backend\x20Function\x20script\x20info\x20for\x20id:\x20','getBffScriptInfo','4lcuxLx','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','data','10BSmbtH','1180300QHSSMD','success','6539544ArBKai','77ThCedb','117156ZucyzV','8643294HpkhjX','2238670cMERQd','4540113pwYbmt','9325428PjFUZz','id\x20is\x20required\x20and\x20must\x20be\x20a\x20positive\x20number.\x20Get\x20it\x20from\x20list_bff_scripts.','16OOZVBD'];a13_0x398a=function(){return _0x21691c;};return a13_0x398a();}function a13_0x50c4(_0x544a88,_0x19e2af){_0x544a88=_0x544a88-0x85;const _0x398a29=a13_0x398a();let _0x50c407=_0x398a29[_0x544a88];return _0x50c407;}(function(_0x1fba59,_0x3664a2){const _0x4e6edf=a13_0x50c4,_0x5c4527=_0x1fba59();while(!![]){try{const _0x5e2ddd=parseInt(_0x4e6edf(0x8b))/0x1*(-parseInt(_0x4e6edf(0x90))/0x2)+parseInt(_0x4e6edf(0x93))/0x3*(-parseInt(_0x4e6edf(0x88))/0x4)+parseInt(_0x4e6edf(0x8c))/0x5+parseInt(_0x4e6edf(0x91))/0x6+parseInt(_0x4e6edf(0x94))/0x7+-parseInt(_0x4e6edf(0x85))/0x8*(-parseInt(_0x4e6edf(0x8e))/0x9)+-parseInt(_0x4e6edf(0x92))/0xa*(parseInt(_0x4e6edf(0x8f))/0xb);if(_0x5e2ddd===_0x3664a2)break;else _0x5c4527['push'](_0x5c4527['shift']());}catch(_0x2b510c){_0x5c4527['push'](_0x5c4527['shift']());}}}(a13_0x398a,0xc24b1));import{DevApiClient}from'../api/dev-api-client.js';import{getEnvAppCode}from'../config/env.js';export async function getBffScriptInfo(_0x34a5a2){const _0x3bb84f=a13_0x50c4,{appCode:appCode=getEnvAppCode(),cookie:_0xea0627,id:_0x4c3c29}=_0x34a5a2;if(!appCode)throw new Error(_0x3bb84f(0x89));if(!_0x4c3c29||_0x4c3c29<=0x0)throw new Error(_0x3bb84f(0x95));const _0x568c5e=new DevApiClient({'appCode':appCode,'cookie':_0xea0627}),_0x4a3142=await _0x568c5e[_0x3bb84f(0x87)](_0x4c3c29);if(!_0x4a3142[_0x3bb84f(0x8d)]||!_0x4a3142['data'])return{'success':![],'message':_0x3bb84f(0x86)+_0x4c3c29};return{'success':!![],'script':_0x4a3142[_0x3bb84f(0x8a)]};}
@@ -1 +1 @@
1
- (function(_0x157a27,_0x4a7481){const _0x268967=a12_0xd6b8,_0x2eb273=_0x157a27();while(!![]){try{const _0x26cf2f=-parseInt(_0x268967(0x144))/0x1+-parseInt(_0x268967(0x160))/0x2+-parseInt(_0x268967(0x156))/0x3+parseInt(_0x268967(0x17b))/0x4*(-parseInt(_0x268967(0x15c))/0x5)+parseInt(_0x268967(0x148))/0x6*(-parseInt(_0x268967(0x15a))/0x7)+-parseInt(_0x268967(0x147))/0x8*(parseInt(_0x268967(0x17a))/0x9)+-parseInt(_0x268967(0x17d))/0xa*(-parseInt(_0x268967(0x162))/0xb);if(_0x26cf2f===_0x4a7481)break;else _0x2eb273['push'](_0x2eb273['shift']());}catch(_0x4c5c32){_0x2eb273['push'](_0x2eb273['shift']());}}}(a12_0x5766,0x75e6f));import{DevApiClient}from'../api/dev-api-client.js';import{DrivenDataDetailPlus}from'@lovrabet/dsparser';function a12_0xd6b8(_0x59018a,_0x97befe){_0x59018a=_0x59018a-0x143;const _0x57665a=a12_0x5766();let _0xd6b8c1=_0x57665a[_0x59018a];return _0xd6b8c1;}function a12_0x5766(){const _0x1c2ec7=['getEnabledOperationAnalyses','Indexes\x20available,\x20prefer\x20using\x20indexed\x20fields\x20for\x20high-frequency\x20filtering','\x20=\x20','getFieldCount','getDatasetDetail','References\x20','2025tgJLMm','284Dozzgj','Downstream\x20datasets:\x20','30zBmGaf','data','266838rwGuxI','This\x20dataset\x20is\x20a\x20master\x20entity/dimension\x20table,\x20referenced\x20by\x20multiple\x20downstream\x20datasets','fromTableName','17672shCYNE','2190RBosCx','MANY_TO_ONE','function',')\x20via\x20','filter','getDatasetRelations','incoming','This\x20dataset\x20is\x20in\x20the\x20middle\x20layer\x20of\x20the\x20relationship\x20network,\x20referencing\x20upstream\x20and\x20being\x20referenced\x20by\x20downstream','Referenced\x20by\x20','toField','getTableName','fromDatasetName','getIndexes','relations','141060jVGDZS','throttle','\x20→\x20','push','7581SKsqBc','outgoing','16965uXVUWF','\x20个下游数据集引用','引用\x20','fromField','1846872yWQPlP','toTableName','10462628paNcwg','name','join','ONE_TO_MANY','datasetCode\x20is\x20required','fromDataset','length','condition','toDatasetName','toDataset','This\x20dataset\x20is\x20a\x20detail/slave\x20table,\x20referencing\x20other\x20master\x20tables','map','\x20个上游数据集','toDatasetCode','fromDatasetCode','joinType','getOperationCount','hasRelations'];a12_0x5766=function(){return _0x1c2ec7;};return a12_0x5766();}import{getEnvAppCode,getEnvironment}from'../config/env.js';import{rateLimiters}from'../utils/rate-limiter.js';export async function getDatasetDetail(_0x3ef26a){const _0x5a6c27=a12_0xd6b8,{appCode:appCode=getEnvAppCode(),cookie:_0x50e6cb,datasetCode:_0xa0d1c0,forceRefresh:forceRefresh=![],includeRelations:includeRelations=!![]}=_0x3ef26a;if(!appCode)throw new Error('appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.');if(!_0xa0d1c0)throw new Error(_0x5a6c27(0x166));const _0x3dfdae=new DevApiClient({'appCode':appCode,'cookie':_0x50e6cb}),_0x52ec18=getEnvironment(),_0x1d8680=forceRefresh?await rateLimiters['api'][_0x5a6c27(0x157)](()=>_0x3dfdae[_0x5a6c27(0x178)](_0xa0d1c0,forceRefresh,![])):await _0x3dfdae[_0x5a6c27(0x178)](_0xa0d1c0,forceRefresh,![]),_0xb9862a=_0x1d8680[_0x5a6c27(0x143)]||_0x1d8680,_0x2ba5ac=new DrivenDataDetailPlus(_0xb9862a),_0x4e3c65=_0x2ba5ac[_0x5a6c27(0x152)](),_0x4565ec=Array['isArray'](_0xb9862a['relations'])?[..._0xb9862a[_0x5a6c27(0x155)]]:null,_0x453701={'fieldCount':_0x2ba5ac[_0x5a6c27(0x177)](),'operationCount':_0x2ba5ac[_0x5a6c27(0x172)](),'enabledOperationCount':_0x2ba5ac[_0x5a6c27(0x174)]()?.[_0x5a6c27(0x168)]||0x0,'hasRelations':![]};if(!includeRelations)return{'appCode':appCode,'env':_0x52ec18,'data':_0xb9862a,'_stats':_0x453701};let _0x5b0594=[],_0x115522=[];try{const _0x4a551f=await _0x3dfdae[_0x5a6c27(0x14d)](_0xa0d1c0,forceRefresh);_0x5b0594=_0x4a551f[_0x5a6c27(0x15b)]||[],_0x115522=_0x4a551f[_0x5a6c27(0x14e)]||[];}catch{}_0x4565ec&&_0x4565ec['length']>0x0&&_0x5b0594[_0x5a6c27(0x168)]===0x0&&(_0x5b0594=_0x4565ec[_0x5a6c27(0x16d)](_0x81bec8=>({'fromField':_0x81bec8['fromField'],'toDataset':_0x81bec8['toDatasetCode']||_0x81bec8[_0x5a6c27(0x16b)],'toDatasetName':_0x81bec8['toDatasetName'],'toField':_0x81bec8['toField'],'joinType':_0x81bec8[_0x5a6c27(0x171)]||_0x5a6c27(0x149),'toTableName':_0x81bec8['toTableName']})));const _0x28d0ef=_0x5b0594[_0x5a6c27(0x16d)](_0x522446=>({'fromField':_0x522446[_0x5a6c27(0x15f)],'toDatasetCode':_0x522446[_0x5a6c27(0x16b)]||_0x522446[_0x5a6c27(0x16f)],'toDatasetName':_0x522446['toDatasetName'],'toField':_0x522446[_0x5a6c27(0x151)],'toTableName':_0x522446[_0x5a6c27(0x161)],'joinType':_0x522446[_0x5a6c27(0x171)]||_0x5a6c27(0x149),'condition':_0x522446[_0x5a6c27(0x169)]??null})),_0x22d23d=_0x115522[_0x5a6c27(0x16d)](_0x3dbad3=>({'fromField':_0x3dbad3['fromField'],'fromDatasetCode':_0x3dbad3[_0x5a6c27(0x167)]||_0x3dbad3[_0x5a6c27(0x170)],'fromDatasetName':_0x3dbad3['fromDatasetName']||_0x3dbad3[_0x5a6c27(0x167)],'fromTableName':_0x3dbad3[_0x5a6c27(0x146)],'toDatasetCode':_0xa0d1c0,'toDatasetName':_0x2ba5ac[_0x5a6c27(0x163)],'toField':_0x3dbad3[_0x5a6c27(0x151)],'toTableName':_0x4e3c65,'joinType':_0x3dbad3['joinType']||_0x5a6c27(0x165),'condition':_0x3dbad3['condition']??null})),_0x2c5b39=_0x28d0ef['length']+_0x22d23d[_0x5a6c27(0x168)];_0x453701[_0x5a6c27(0x173)]=_0x2c5b39>0x0;const _0x515b07={'outgoing':_0x28d0ef,'incoming':_0x22d23d,'totalCount':_0x2c5b39};let _0x164223;if(_0x2c5b39>0x0){const _0x44a3aa=[];for(const _0x399d91 of _0x28d0ef){_0x44a3aa[_0x5a6c27(0x159)](_0x5a6c27(0x179)+_0x399d91[_0x5a6c27(0x16a)]+'('+_0x399d91[_0x5a6c27(0x171)]+_0x5a6c27(0x14b)+_0x4e3c65+'.'+_0x399d91[_0x5a6c27(0x15f)]+_0x5a6c27(0x176)+(_0x399d91[_0x5a6c27(0x161)]||'?')+'.'+_0x399d91[_0x5a6c27(0x151)]);}for(const _0x5bbd4b of _0x22d23d){_0x44a3aa[_0x5a6c27(0x159)](_0x5a6c27(0x150)+_0x5bbd4b[_0x5a6c27(0x153)]+'('+_0x5bbd4b[_0x5a6c27(0x171)]+_0x5a6c27(0x14b)+(_0x5bbd4b[_0x5a6c27(0x146)]||'?')+'.'+_0x5bbd4b[_0x5a6c27(0x15f)]+_0x5a6c27(0x176)+_0x4e3c65+'.'+_0x5bbd4b[_0x5a6c27(0x151)]);}const _0x945029=[];_0x28d0ef[_0x5a6c27(0x168)]>0x0&&_0x945029[_0x5a6c27(0x159)](_0x5a6c27(0x15e)+_0x28d0ef[_0x5a6c27(0x168)]+_0x5a6c27(0x16e)),_0x22d23d['length']>0x0&&_0x945029[_0x5a6c27(0x159)]('被\x20'+_0x22d23d[_0x5a6c27(0x168)]+_0x5a6c27(0x15d)),_0x164223=_0x945029[_0x5a6c27(0x164)](',')+'。'+_0x44a3aa['join'](';\x20');}const _0x1192bf=generateUsageHints(_0x28d0ef,_0x22d23d,_0x2ba5ac);return{'appCode':appCode,'env':_0x52ec18,'data':_0xb9862a,'_stats':_0x453701,'_relations':_0x515b07,'_relationsSummary':_0x164223,'_usageHints':_0x1192bf['length']>0x0?_0x1192bf:undefined};}function generateUsageHints(_0x3bb870,_0x1eca3b,_0x48ecf4){const _0x26a0b8=a12_0xd6b8,_0x3cb49b=[];if(_0x1eca3b[_0x26a0b8(0x168)]>=0x2&&_0x3bb870[_0x26a0b8(0x168)]===0x0)_0x3cb49b['push'](_0x26a0b8(0x145));else{if(_0x1eca3b['length']>=0x1&&_0x3bb870['length']>=0x1)_0x3cb49b[_0x26a0b8(0x159)](_0x26a0b8(0x14f));else _0x3bb870[_0x26a0b8(0x168)]>=0x1&&_0x1eca3b[_0x26a0b8(0x168)]===0x0&&_0x3cb49b['push'](_0x26a0b8(0x16c));}if(_0x1eca3b[_0x26a0b8(0x168)]>0x0){const _0x3bf207=_0x1eca3b[_0x26a0b8(0x16d)](_0x599944=>_0x599944[_0x26a0b8(0x153)])[_0x26a0b8(0x14c)](Boolean);_0x3bf207[_0x26a0b8(0x168)]>0x0&&_0x3cb49b['push'](_0x26a0b8(0x17c)+_0x3bf207[_0x26a0b8(0x164)](',\x20'));}if(_0x3bb870['length']>0x0){const _0x21228e=_0x3bb870[_0x26a0b8(0x16d)](_0x469dc1=>_0x469dc1[_0x26a0b8(0x15f)]+_0x26a0b8(0x158)+_0x469dc1[_0x26a0b8(0x16a)]+'.'+_0x469dc1[_0x26a0b8(0x151)]);_0x3cb49b[_0x26a0b8(0x159)]('Common\x20join\x20paths:\x20'+_0x21228e[_0x26a0b8(0x164)](';\x20'));}if(typeof _0x48ecf4[_0x26a0b8(0x154)]===_0x26a0b8(0x14a))try{const _0x5c7c1c=_0x48ecf4[_0x26a0b8(0x154)]();_0x5c7c1c&&_0x5c7c1c[_0x26a0b8(0x168)]>0x0&&_0x3cb49b['push'](_0x26a0b8(0x175));}catch{}return _0x3cb49b;}
1
+ (function(_0x3bb99b,_0x29a0ec){const _0x189969=a14_0x3f98,_0x3fa375=_0x3bb99b();while(!![]){try{const _0x4b5c2a=-parseInt(_0x189969(0x1a8))/0x1+parseInt(_0x189969(0x1c9))/0x2*(parseInt(_0x189969(0x1a2))/0x3)+-parseInt(_0x189969(0x1c6))/0x4+parseInt(_0x189969(0x19a))/0x5*(-parseInt(_0x189969(0x1b4))/0x6)+-parseInt(_0x189969(0x19f))/0x7+parseInt(_0x189969(0x1c3))/0x8+parseInt(_0x189969(0x1c5))/0x9;if(_0x4b5c2a===_0x29a0ec)break;else _0x3fa375['push'](_0x3fa375['shift']());}catch(_0x4fb916){_0x3fa375['push'](_0x3fa375['shift']());}}}(a14_0x2f42,0xeecee));function a14_0x2f42(){const _0x49ca4c=['fromDataset','datasetCode\x20is\x20required','joinType','relations','\x20=\x20','toDataset','4733320qrgdwE','filter','42995799FIueKs','6819224PqqcFj','fromDatasetCode','push','1386172cWoFHt','toTableName','Referenced\x20by\x20','996010tJQCsI','Downstream\x20datasets:\x20','MANY_TO_ONE','This\x20dataset\x20is\x20a\x20detail/slave\x20table,\x20referencing\x20other\x20master\x20tables','map','10796184jRQtbZ','fromTableName','function','3TyjsKu','fromDatasetName','toDatasetName','getFieldCount','isArray','getDatasetRelations','243170cJHLSH','getEnabledOperationAnalyses','data','toDatasetCode','api','\x20→\x20','引用\x20','condition','\x20个下游数据集引用','length','getIndexes','References\x20','48KEzbOy','join','ONE_TO_MANY','hasRelations','appCode\x20is\x20required.\x20Provide\x20it\x20as\x20parameter\x20or\x20set\x20LOVRABET_APP_CODE\x20environment\x20variable.','name','throttle','toField','getDatasetDetail'];a14_0x2f42=function(){return _0x49ca4c;};return a14_0x2f42();}import{DevApiClient}from'../api/dev-api-client.js';import{DrivenDataDetailPlus}from'@lovrabet/dsparser';function a14_0x3f98(_0x9621bc,_0x4f596d){_0x9621bc=_0x9621bc-0x19a;const _0x2f4212=a14_0x2f42();let _0x3f9842=_0x2f4212[_0x9621bc];return _0x3f9842;}import{getEnvAppCode,getEnvironment}from'../config/env.js';import{rateLimiters}from'../utils/rate-limiter.js';export async function getDatasetDetail(_0x4bf4d3){const _0xd4ab30=a14_0x3f98,{appCode:appCode=getEnvAppCode(),cookie:_0x4c8cbd,datasetCode:_0x1469f3,forceRefresh:forceRefresh=![],includeRelations:includeRelations=!![]}=_0x4bf4d3;if(!appCode)throw new Error(_0xd4ab30(0x1b8));if(!_0x1469f3)throw new Error(_0xd4ab30(0x1be));const _0x27fa35=new DevApiClient({'appCode':appCode,'cookie':_0x4c8cbd}),_0x2b4c80=getEnvironment(),_0x20ba23=forceRefresh?await rateLimiters[_0xd4ab30(0x1ac)][_0xd4ab30(0x1ba)](()=>_0x27fa35[_0xd4ab30(0x1bc)](_0x1469f3,forceRefresh,![])):await _0x27fa35['getDatasetDetail'](_0x1469f3,forceRefresh,![]),_0x3b144b=_0x20ba23[_0xd4ab30(0x1aa)]||_0x20ba23,_0x1c3b94=new DrivenDataDetailPlus(_0x3b144b),_0x28a660=_0x1c3b94['getTableName'](),_0x1867ab=Array[_0xd4ab30(0x1a6)](_0x3b144b[_0xd4ab30(0x1c0)])?[..._0x3b144b['relations']]:null,_0x17f389={'fieldCount':_0x1c3b94[_0xd4ab30(0x1a5)](),'operationCount':_0x1c3b94['getOperationCount'](),'enabledOperationCount':_0x1c3b94[_0xd4ab30(0x1a9)]()?.['length']||0x0,'hasRelations':![]};if(!includeRelations)return{'appCode':appCode,'env':_0x2b4c80,'data':_0x3b144b,'_stats':_0x17f389};let _0x386e2d=[],_0x107d61=[];try{const _0x396647=await _0x27fa35[_0xd4ab30(0x1a7)](_0x1469f3,forceRefresh);_0x386e2d=_0x396647['outgoing']||[],_0x107d61=_0x396647['incoming']||[];}catch{}_0x1867ab&&_0x1867ab['length']>0x0&&_0x386e2d[_0xd4ab30(0x1b1)]===0x0&&(_0x386e2d=_0x1867ab[_0xd4ab30(0x19e)](_0x3998b5=>({'fromField':_0x3998b5['fromField'],'toDataset':_0x3998b5[_0xd4ab30(0x1ab)]||_0x3998b5['toDataset'],'toDatasetName':_0x3998b5[_0xd4ab30(0x1a4)],'toField':_0x3998b5[_0xd4ab30(0x1bb)],'joinType':_0x3998b5['joinType']||_0xd4ab30(0x19c),'toTableName':_0x3998b5[_0xd4ab30(0x1ca)]})));const _0x2dc5da=_0x386e2d['map'](_0x336267=>({'fromField':_0x336267['fromField'],'toDatasetCode':_0x336267[_0xd4ab30(0x1c2)]||_0x336267[_0xd4ab30(0x1ab)],'toDatasetName':_0x336267['toDatasetName'],'toField':_0x336267[_0xd4ab30(0x1bb)],'toTableName':_0x336267[_0xd4ab30(0x1ca)],'joinType':_0x336267['joinType']||_0xd4ab30(0x19c),'condition':_0x336267[_0xd4ab30(0x1af)]??null})),_0x218ac6=_0x107d61['map'](_0x2c4826=>({'fromField':_0x2c4826['fromField'],'fromDatasetCode':_0x2c4826[_0xd4ab30(0x1bd)]||_0x2c4826[_0xd4ab30(0x1c7)],'fromDatasetName':_0x2c4826['fromDatasetName']||_0x2c4826[_0xd4ab30(0x1bd)],'fromTableName':_0x2c4826[_0xd4ab30(0x1a0)],'toDatasetCode':_0x1469f3,'toDatasetName':_0x1c3b94[_0xd4ab30(0x1b9)],'toField':_0x2c4826[_0xd4ab30(0x1bb)],'toTableName':_0x28a660,'joinType':_0x2c4826[_0xd4ab30(0x1bf)]||_0xd4ab30(0x1b6),'condition':_0x2c4826[_0xd4ab30(0x1af)]??null})),_0x54bf93=_0x2dc5da[_0xd4ab30(0x1b1)]+_0x218ac6['length'];_0x17f389[_0xd4ab30(0x1b7)]=_0x54bf93>0x0;const _0x2e2e7e={'outgoing':_0x2dc5da,'incoming':_0x218ac6,'totalCount':_0x54bf93};let _0x193904;if(_0x54bf93>0x0){const _0xefbc27=[];for(const _0x50ca74 of _0x2dc5da){_0xefbc27[_0xd4ab30(0x1c8)](_0xd4ab30(0x1b3)+_0x50ca74[_0xd4ab30(0x1a4)]+'('+_0x50ca74[_0xd4ab30(0x1bf)]+')\x20via\x20'+_0x28a660+'.'+_0x50ca74['fromField']+_0xd4ab30(0x1c1)+(_0x50ca74['toTableName']||'?')+'.'+_0x50ca74[_0xd4ab30(0x1bb)]);}for(const _0x521711 of _0x218ac6){_0xefbc27['push'](_0xd4ab30(0x1cb)+_0x521711[_0xd4ab30(0x1a3)]+'('+_0x521711[_0xd4ab30(0x1bf)]+')\x20via\x20'+(_0x521711['fromTableName']||'?')+'.'+_0x521711['fromField']+_0xd4ab30(0x1c1)+_0x28a660+'.'+_0x521711['toField']);}const _0x511c3e=[];_0x2dc5da[_0xd4ab30(0x1b1)]>0x0&&_0x511c3e[_0xd4ab30(0x1c8)](_0xd4ab30(0x1ae)+_0x2dc5da['length']+'\x20个上游数据集'),_0x218ac6[_0xd4ab30(0x1b1)]>0x0&&_0x511c3e[_0xd4ab30(0x1c8)]('被\x20'+_0x218ac6[_0xd4ab30(0x1b1)]+_0xd4ab30(0x1b0)),_0x193904=_0x511c3e[_0xd4ab30(0x1b5)](',')+'。'+_0xefbc27[_0xd4ab30(0x1b5)](';\x20');}const _0x336460=generateUsageHints(_0x2dc5da,_0x218ac6,_0x1c3b94);return{'appCode':appCode,'env':_0x2b4c80,'data':_0x3b144b,'_stats':_0x17f389,'_relations':_0x2e2e7e,'_relationsSummary':_0x193904,'_usageHints':_0x336460[_0xd4ab30(0x1b1)]>0x0?_0x336460:undefined};}function generateUsageHints(_0x105cc1,_0x1454fc,_0xe90c3c){const _0x525761=a14_0x3f98,_0x4b111c=[];if(_0x1454fc[_0x525761(0x1b1)]>=0x2&&_0x105cc1['length']===0x0)_0x4b111c['push']('This\x20dataset\x20is\x20a\x20master\x20entity/dimension\x20table,\x20referenced\x20by\x20multiple\x20downstream\x20datasets');else{if(_0x1454fc['length']>=0x1&&_0x105cc1[_0x525761(0x1b1)]>=0x1)_0x4b111c[_0x525761(0x1c8)]('This\x20dataset\x20is\x20in\x20the\x20middle\x20layer\x20of\x20the\x20relationship\x20network,\x20referencing\x20upstream\x20and\x20being\x20referenced\x20by\x20downstream');else _0x105cc1[_0x525761(0x1b1)]>=0x1&&_0x1454fc[_0x525761(0x1b1)]===0x0&&_0x4b111c[_0x525761(0x1c8)](_0x525761(0x19d));}if(_0x1454fc[_0x525761(0x1b1)]>0x0){const _0x485fe6=_0x1454fc[_0x525761(0x19e)](_0x2b2357=>_0x2b2357[_0x525761(0x1a3)])[_0x525761(0x1c4)](Boolean);_0x485fe6[_0x525761(0x1b1)]>0x0&&_0x4b111c['push'](_0x525761(0x19b)+_0x485fe6[_0x525761(0x1b5)](',\x20'));}if(_0x105cc1[_0x525761(0x1b1)]>0x0){const _0x4beae2=_0x105cc1[_0x525761(0x19e)](_0x40fedc=>_0x40fedc['fromField']+_0x525761(0x1ad)+_0x40fedc[_0x525761(0x1a4)]+'.'+_0x40fedc[_0x525761(0x1bb)]);_0x4b111c['push']('Common\x20join\x20paths:\x20'+_0x4beae2[_0x525761(0x1b5)](';\x20'));}if(typeof _0xe90c3c['getIndexes']===_0x525761(0x1a1))try{const _0x54908b=_0xe90c3c[_0x525761(0x1b2)]();_0x54908b&&_0x54908b[_0x525761(0x1b1)]>0x0&&_0x4b111c[_0x525761(0x1c8)]('Indexes\x20available,\x20prefer\x20using\x20indexed\x20fields\x20for\x20high-frequency\x20filtering');}catch{}return _0x4b111c;}