@lovrabet/lovrabet-cli 2.1.0-beta.1 → 2.1.0-beta.3
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/lib/cli.js +1 -1
- package/lib/commands/api-doc/index.js +1 -1
- package/lib/commands/app/cache.js +1 -1
- package/lib/commands/app/definitions.js +1 -1
- package/lib/commands/app/eligibility.js +1 -1
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/artifact/index.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/auth/prompt.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/common/config-policy.js +1 -1
- package/lib/commands/common/constraints.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/config/definitions.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/personal-bff/index.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.js +1 -1
- package/lib/commands/service/index.js +1 -1
- package/lib/commands/service/registry.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/templates.js +1 -1
- package/lib/commands/skill/validate.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/sdk-client.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.js +1 -1
- package/lib/framework/runner-error.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
package/lib/commands/kb/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a27_0x3b93ed=a27_0x26ca;(function(_0x36c19e,_0x5f3fd0){const _0x459f2f=a27_0x26ca,_0x33b57c=_0x36c19e();while(!![]){try{const _0x1108e7=-parseInt(_0x459f2f(0xda))/0x1+-parseInt(_0x459f2f(0xd1))/0x2*(parseInt(_0x459f2f(0xd0))/0x3)+-parseInt(_0x459f2f(0xf5))/0x4+-parseInt(_0x459f2f(0xcd))/0x5*(-parseInt(_0x459f2f(0xfb))/0x6)+parseInt(_0x459f2f(0xeb))/0x7*(-parseInt(_0x459f2f(0xe7))/0x8)+-parseInt(_0x459f2f(0xf6))/0x9*(parseInt(_0x459f2f(0xdb))/0xa)+parseInt(_0x459f2f(0xe8))/0xb;if(_0x1108e7===_0x5f3fd0)break;else _0x33b57c['push'](_0x33b57c['shift']());}catch(_0x32ff0a){_0x33b57c['push'](_0x33b57c['shift']());}}}(a27_0x2bf0,0x32930));import{existsSync,readFileSync,statSync}from'node:fs';import{createPersonalKnowledgeBaseItem,getPersonalKnowledgeBaseItem,listPersonalKnowledgeBaseItems,searchKnowledgeBase,updatePersonalKnowledgeBaseItem}from'../../core/api-client.js';import{ID_FLAG,VERBOSE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';function a27_0x26ca(_0x39043a,_0x24a2d6){_0x39043a=_0x39043a-0xc0;const _0x2bf049=a27_0x2bf0();let _0x26caa1=_0x2bf049[_0x39043a];return _0x26caa1;}import{dryRun}from'../../framework/dryrun.js';const TITLE_FLAG={'name':a27_0x3b93ed(0xfe),'type':a27_0x3b93ed(0xc4),'required':!![],'description':a27_0x3b93ed(0xe1)},FILE_FLAG={'name':'file','type':a27_0x3b93ed(0xc4),'required':!![],'description':a27_0x3b93ed(0xc5)},QUERY_FLAG={'name':'query','type':a27_0x3b93ed(0xc4),'required':!![],'description':'Search\x20query\x20for\x20visible\x20company\x20and\x20personal\x20knowledge'},TOPK_FLAG={'name':a27_0x3b93ed(0xf8),'type':a27_0x3b93ed(0xef),'description':a27_0x3b93ed(0xf2)};function readKnowledgeFile(_0x2063a0){const _0x2a862c=a27_0x3b93ed;if(!_0x2063a0)throw CliErrors[_0x2a862c(0xee)](_0x2a862c(0xd5));if(!existsSync(_0x2063a0))throw CliErrors['validation'](_0x2a862c(0xc7)+_0x2063a0);if(!statSync(_0x2063a0)[_0x2a862c(0xd8)]())throw CliErrors[_0x2a862c(0xee)]('File\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x2063a0);return readFileSync(_0x2063a0,_0x2a862c(0xc1));}function summarizePersonalItem(_0x7401d5){const _0x198cb6=a27_0x3b93ed;return{'id':_0x7401d5['id'],'title':_0x7401d5[_0x198cb6(0xfe)],'version':_0x7401d5['version'],'ragStatus':_0x7401d5[_0x198cb6(0xe9)],'ragErrorMessage':_0x7401d5[_0x198cb6(0xca)],'updateTime':_0x7401d5['updateTime']};}function detailPersonalItem(_0x513161){const _0x147018=a27_0x3b93ed;return{'id':_0x513161['id'],'appCode':_0x513161['appCode'],'scope':_0x513161[_0x147018(0x101)],'userId':_0x513161[_0x147018(0xc3)],'title':_0x513161['title'],'content':_0x513161[_0x147018(0xd4)]??'','version':_0x513161['version'],'ragStatus':_0x513161[_0x147018(0xe9)],'ragErrorMessage':_0x513161[_0x147018(0xca)],'createTime':_0x513161[_0x147018(0xc0)],'updateTime':_0x513161['updateTime']};}function summarizeSearchHit(_0x395afd){const _0x30e72f=a27_0x3b93ed;return{'scope':_0x395afd[_0x30e72f(0x101)],'docId':_0x395afd[_0x30e72f(0xcf)],'score':_0x395afd[_0x30e72f(0xe2)],'weightedScore':_0x395afd['weightedScore'],'content':_0x395afd['content'],'metadata':_0x395afd['metadata']};}function readTopK(_0x2ecbd2){const _0x2f2fe7=a27_0x3b93ed,_0x32e47a=_0x2ecbd2[_0x2f2fe7(0xdf)]('topk');if(_0x32e47a===undefined||_0x32e47a===null||_0x32e47a==='')return undefined;const _0x2b5e02=_0x2ecbd2[_0x2f2fe7(0xc9)]('topk');if(!Number[_0x2f2fe7(0xdc)](_0x2b5e02)||_0x2b5e02<0x1)throw CliErrors['validation'](_0x2f2fe7(0xff));return _0x2b5e02;}const kbList={'service':'kb','command':a27_0x3b93ed(0xfa),'description':a27_0x3b93ed(0x103),'risk':a27_0x3b93ed(0xd6),'flags':[VERBOSE_FLAG],async 'execute'(_0x1abf8f){const _0x26d93b=a27_0x3b93ed,_0x1485eb=await listPersonalKnowledgeBaseItems(_0x1abf8f[_0x26d93b(0x100)]);if(_0x1abf8f['bool'](_0x26d93b(0xcb)))return{'ok':!![],'data':{'total':_0x1485eb[_0x26d93b(0xe6)],'items':_0x1485eb}};return{'ok':!![],'data':{'total':_0x1485eb[_0x26d93b(0xe6)],'items':_0x1485eb[_0x26d93b(0xd9)](summarizePersonalItem)}};}},kbDetail={'service':'kb','command':a27_0x3b93ed(0xd3),'description':a27_0x3b93ed(0xd7),'risk':'read','flags':[{...ID_FLAG,'description':a27_0x3b93ed(0xdd)}],async 'execute'(_0x25a605){const _0x3774eb=a27_0x3b93ed,_0x135c3a=await getPersonalKnowledgeBaseItem(_0x25a605[_0x3774eb(0xc9)]('id'),_0x25a605['appCode']);return{'ok':!![],'data':detailPersonalItem(_0x135c3a)};}},kbCreate={'service':'kb','command':a27_0x3b93ed(0xf0),'description':a27_0x3b93ed(0xf4),'risk':a27_0x3b93ed(0xd2),'flags':[TITLE_FLAG,FILE_FLAG],async 'execute'(_0x53d1c5){const _0x376097=a27_0x3b93ed,_0x458d11=_0x53d1c5[_0x376097(0xf1)](_0x376097(0xfe)),_0x2872ad=readKnowledgeFile(_0x53d1c5[_0x376097(0xf1)](_0x376097(0xe0))),_0x20f3b3=await createPersonalKnowledgeBaseItem(_0x53d1c5[_0x376097(0x100)],{'title':_0x458d11,'content':_0x2872ad});return{'ok':!![],'data':summarizePersonalItem(_0x20f3b3),'message':_0x376097(0xc2)+_0x20f3b3['id']+'\x20('+_0x20f3b3[_0x376097(0xfe)]+')'};},async 'dryRun'(_0x343423){const _0x15515c=a27_0x3b93ed,_0x376c6e=_0x343423[_0x15515c(0xf1)]('title'),_0x28aa06=readKnowledgeFile(_0x343423[_0x15515c(0xf1)](_0x15515c(0xe0)));return dryRun(_0x15515c(0xf7),_0x15515c(0xf9))['body']({'appCode':_0x343423['appCode'],'title':_0x376c6e,'content':_0x28aa06})[_0x15515c(0xc8)](_0x15515c(0xde)+_0x376c6e+'\x22')[_0x15515c(0xf3)]();}},kbUpdate={'service':'kb','command':a27_0x3b93ed(0xea),'description':a27_0x3b93ed(0xec),'risk':a27_0x3b93ed(0xd2),'flags':[{...ID_FLAG,'description':a27_0x3b93ed(0xdd)},{...TITLE_FLAG,'required':![],'description':a27_0x3b93ed(0xfd)},FILE_FLAG],async 'execute'(_0x56f68d){const _0x3cb614=a27_0x3b93ed,_0x37db15=_0x56f68d[_0x3cb614(0xc9)]('id'),_0xf6ca5e=readKnowledgeFile(_0x56f68d[_0x3cb614(0xf1)](_0x3cb614(0xe0))),_0x38faef=_0x56f68d['str'](_0x3cb614(0xfe))||(await getPersonalKnowledgeBaseItem(_0x37db15,_0x56f68d[_0x3cb614(0x100)]))[_0x3cb614(0xfe)],_0x3bf9e7=await updatePersonalKnowledgeBaseItem(_0x37db15,_0x56f68d[_0x3cb614(0x100)],{'title':_0x38faef,'content':_0xf6ca5e});return{'ok':!![],'data':summarizePersonalItem(_0x3bf9e7),'message':_0x3cb614(0xcc)+_0x3bf9e7['id']+'\x20('+_0x3bf9e7[_0x3cb614(0xfe)]+')'};},async 'dryRun'(_0x3716ae){const _0x55cf6b=a27_0x3b93ed,_0x734b41=_0x3716ae['num']('id'),_0x1886b5=readKnowledgeFile(_0x3716ae[_0x55cf6b(0xf1)]('file')),_0x55685f=_0x3716ae[_0x55cf6b(0xf1)]('title')||(await getPersonalKnowledgeBaseItem(_0x734b41,_0x3716ae['appCode']))[_0x55cf6b(0xfe)];return dryRun(_0x55cf6b(0xf7),_0x55cf6b(0xce)+_0x734b41+_0x55cf6b(0xe4))[_0x55cf6b(0x102)]({'appCode':_0x3716ae[_0x55cf6b(0x100)],'title':_0x55685f,'content':_0x1886b5})['description']('Preview:\x20update\x20personal\x20knowledge-base\x20entry\x20'+_0x734b41)['build']();}},kbSearch={'service':'kb','command':a27_0x3b93ed(0xe3),'description':a27_0x3b93ed(0xed),'risk':a27_0x3b93ed(0xd6),'flags':[QUERY_FLAG,TOPK_FLAG],async 'validate'(_0x54c1b6){const _0x14e565=a27_0x3b93ed;if(!_0x54c1b6[_0x14e565(0xf1)]('query')[_0x14e565(0xfc)]())throw CliErrors[_0x14e565(0xee)](_0x14e565(0xe5));readTopK(_0x54c1b6);},async 'execute'(_0x55243f){const _0x35e626=a27_0x3b93ed,_0xa9fe8=_0x55243f[_0x35e626(0xf1)](_0x35e626(0xc6))[_0x35e626(0xfc)](),_0x296341=readTopK(_0x55243f),_0x185e43=await searchKnowledgeBase(_0x55243f['appCode'],{'query':_0xa9fe8,'topK':_0x296341});return{'ok':!![],'data':{'total':_0x185e43['length'],'hits':_0x185e43[_0x35e626(0xd9)](summarizeSearchHit)}};}};function a27_0x2bf0(){const _0x481a38=['validation','number','create','str','Maximum\x20number\x20of\x20search\x20hits\x20to\x20return','build','Create\x20a\x20personal\x20knowledge-base\x20entry\x20from\x20a\x20local\x20file','497028zzpIDx','9JoHWtv','POST','topk','/client/knowledge-base/personal/create','list','942342gLzYHv','trim','Override\x20the\x20existing\x20entry\x20title','title','--topk\x20must\x20be\x20a\x20positive\x20number.','appCode','scope','body','List\x20personal\x20knowledge-base\x20entries\x20for\x20the\x20current\x20app','createTime','utf8','Created\x20KB\x20entry\x20','userId','string','Path\x20to\x20a\x20local\x20UTF-8\x20text\x20or\x20Markdown\x20file','query','File\x20not\x20found:\x20','description','num','ragErrorMessage','verbose','Updated\x20KB\x20entry\x20','5lEgIwo','/client/knowledge-base/personal/','docId','6DGlswJ','389744NGthtF','write','detail','content','File\x20path\x20is\x20required.','read','Show\x20one\x20personal\x20knowledge-base\x20entry\x20by\x20id','isFile','map','14099tErDQz','4104310WdKRzG','isFinite','Personal\x20knowledge-base\x20entry\x20ID','Preview:\x20create\x20personal\x20knowledge-base\x20entry\x20\x22','flag','file','Personal\x20knowledge-base\x20entry\x20title','score','search','/update','Search\x20query\x20is\x20required.','length','8QuPMSi','13836185nbaiPv','ragStatus','update','1884463JUyNdb','Update\x20a\x20personal\x20knowledge-base\x20entry\x20from\x20a\x20local\x20file','Search\x20visible\x20company\x20and\x20personal\x20knowledge\x20base\x20content'];a27_0x2bf0=function(){return _0x481a38;};return a27_0x2bf0();}export const kbDefinitions=[kbList,kbDetail,kbCreate,kbUpdate,kbSearch];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x17fef4=a28_0x2cba;function a28_0x5acf(){const _0x456bcc=['\x20\x20\x20Time:\x20','Clear\x20command\x20history\x20logs','duration','details','10Hsoyrg','\x20\x20\x20Details:\x20','\x20logs:\x0a','\x20\x20\x20Duration:\x20','clear','605vlXyKB','clearLogs','log','stringify','26382SGzuIB','5603653DvbdsZ','timestamp','warn','View\x20command\x20history\x20logs','*\x20Logs\x20cleared','error','toLocaleString','logs','2474120wHImLp','76rYEnde','success','level','en-US','readLogs','4241237AzMpYP','forEach','83819CujqrR','write','20310CFzLpa','9KptpGb','1209512KYmaKP','read','command'];a28_0x5acf=function(){return _0x456bcc;};return a28_0x5acf();}(function(_0x1a9656,_0x1cb756){const _0x244450=a28_0x2cba,_0x417a74=_0x1a9656();while(!![]){try{const _0x29c42f=-parseInt(_0x244450(0x1f5))/0x1+-parseInt(_0x244450(0x1f9))/0x2+parseInt(_0x244450(0x1f7))/0x3*(parseInt(_0x244450(0x1ee))/0x4)+-parseInt(_0x244450(0x1e0))/0x5*(parseInt(_0x244450(0x1e4))/0x6)+parseInt(_0x244450(0x1f3))/0x7+-parseInt(_0x244450(0x1ed))/0x8*(-parseInt(_0x244450(0x1f8))/0x9)+-parseInt(_0x244450(0x200))/0xa*(-parseInt(_0x244450(0x1e5))/0xb);if(_0x29c42f===_0x1cb756)break;else _0x417a74['push'](_0x417a74['shift']());}catch(_0x20d318){_0x417a74['push'](_0x417a74['shift']());}}}(a28_0x5acf,0x51335));import{logger}from'../../utils/logger.js';import{CLI_DISPLAY_NAME}from'../../constant/cli.js';function printLogs(_0x1455c7){const _0x4898ff=a28_0x2cba;if(_0x1455c7['length']===0x0){console[_0x4898ff(0x1e2)]('*\x20No\x20logs\x20found');return;}console['log']('*\x20'+CLI_DISPLAY_NAME+_0x4898ff(0x202)),_0x1455c7[_0x4898ff(0x1f4)]((_0xbcce3a,_0x4293f2)=>{const _0x11586b=_0x4898ff,_0x395e73=new Date(_0xbcce3a[_0x11586b(0x1e6)])[_0x11586b(0x1eb)](_0x11586b(0x1f1)),_0xd83c1c=_0xbcce3a[_0x11586b(0x1f0)]===_0x11586b(0x1ef)?'√':_0xbcce3a['level']===_0x11586b(0x1ea)?'×':_0xbcce3a[_0x11586b(0x1f0)]===_0x11586b(0x1e7)?'!':'i';console['log'](_0x4293f2+0x1+'.\x20'+_0xd83c1c+'\x20['+_0xbcce3a[_0x11586b(0x1fb)]+']\x20'+_0xbcce3a['message']),console[_0x11586b(0x1e2)](_0x11586b(0x1fc)+_0x395e73),_0xbcce3a[_0x11586b(0x1fe)]&&console[_0x11586b(0x1e2)](_0x11586b(0x1de)+_0xbcce3a['duration']+'ms'),_0xbcce3a['details']&&Object['keys'](_0xbcce3a[_0x11586b(0x1ff)])['length']>0x0&&console[_0x11586b(0x1e2)](_0x11586b(0x201)+JSON[_0x11586b(0x1e3)](_0xbcce3a[_0x11586b(0x1ff)],null,0x2)),console['log']('');});}function a28_0x2cba(_0x4d90b5,_0x314722){_0x4d90b5=_0x4d90b5-0x1de;const _0x5acfd8=a28_0x5acf();let _0x2cbadd=_0x5acfd8[_0x4d90b5];return _0x2cbadd;}export const logsDefinitions=[{'service':a28_0x17fef4(0x1ec),'command':'show','description':a28_0x17fef4(0x1e8),'risk':a28_0x17fef4(0x1fa),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x2061c9){const _0x1aa863=a28_0x17fef4;return printLogs(logger[_0x1aa863(0x1f2)]()),{'ok':!![]};}},{'service':a28_0x17fef4(0x1ec),'command':a28_0x17fef4(0x1df),'description':a28_0x17fef4(0x1fd),'risk':a28_0x17fef4(0x1f6),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0xc6e321){const _0x14a9c6=a28_0x17fef4;return logger[_0x14a9c6(0x1e1)](),console['log'](_0x14a9c6(0x1e9)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a29_0x17af8f=a29_0x2cdb;function a29_0x5c26(){const _0x2e292b=['80IzRiZS','5711651CBOBwy','Path\x20to\x20a\x20local\x20UTF-8\x20JavaScript\x20or\x20TypeScript\x20file','verbose','source-session-id','create','trim','scriptContent','isArray','personal-bff\x20update\x20requires\x20at\x20least\x20one\x20of\x20--name,\x20--description,\x20--file,\x20or\x20--source-session-id.','functionName','name','list','personal-bff','params','Personal\x20BFF\x20functionName,\x20for\x20example\x20loadOrders','flag','read','updateTime','Show\x20one\x20personal\x20BFF\x20by\x20id','detail','gmtCreate','version','utf8','POST','6777joFMTb','gmtModified','Personal\x20BFF\x20script\x20ID','2376qKdVSS','13990aWzbkc','List\x20current\x20user\x27s\x20personal\x20BFF\x20scripts\x20for\x20the\x20current\x20app','Preview:\x20create\x20personal\x20BFF\x20','File\x20path\x20is\x20required.','6145362fYKVqd','698HnQJAn','test','isFile','Executed\x20personal\x20BFF\x20','body','validation','update','Preview:\x20update\x20personal\x20BFF\x20','--name\x20must\x20be\x20a\x20valid\x20JavaScript\x20identifier,\x20for\x20example\x20loadOrders.','high-risk-write','Personal\x20BFF\x20description','createTime','73770TmdHfv','file','appCode','File\x20is\x20not\x20a\x20regular\x20file:\x20','createUserId','num','/update','12aanYRf','77651tpqGQM','description','sourceSessionId','length','str','map','Create\x20a\x20personal\x20BFF\x20from\x20a\x20local\x20script\x20file','string','84573FJMjBg','100LpTURU','build','write'];a29_0x5c26=function(){return _0x2e292b;};return a29_0x5c26();}(function(_0xf03291,_0x11e9c6){const _0x20d9a0=a29_0x2cdb,_0x462d95=_0xf03291();while(!![]){try{const _0x30cb6f=-parseInt(_0x20d9a0(0x181))/0x1*(-parseInt(_0x20d9a0(0x187))/0x2)+-parseInt(_0x20d9a0(0x161))/0x3*(parseInt(_0x20d9a0(0x162))/0x4)+-parseInt(_0x20d9a0(0x193))/0x5+-parseInt(_0x20d9a0(0x186))/0x6+-parseInt(_0x20d9a0(0x19b))/0x7*(parseInt(_0x20d9a0(0x165))/0x8)+parseInt(_0x20d9a0(0x17e))/0x9*(parseInt(_0x20d9a0(0x182))/0xa)+parseInt(_0x20d9a0(0x166))/0xb*(parseInt(_0x20d9a0(0x19a))/0xc);if(_0x30cb6f===_0x11e9c6)break;else _0x462d95['push'](_0x462d95['shift']());}catch(_0x949458){_0x462d95['push'](_0x462d95['shift']());}}}(a29_0x5c26,0x8599a));import{existsSync,readFileSync,statSync}from'node:fs';import{createPersonalBff,executePersonalBff,getPersonalBff,listPersonalBffs,updatePersonalBff}from'../../core/api-client.js';import{ID_FLAG,PARAMS_FLAG,VERBOSE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';import{dryRun}from'../../framework/dryrun.js';import{parseJsonParams}from'../../utils/params.js';const FUNCTION_NAME_PATTERN=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,FILE_FLAG={'name':a29_0x17af8f(0x194),'type':a29_0x17af8f(0x1a2),'description':a29_0x17af8f(0x167)},FUNCTION_NAME_FLAG={'name':a29_0x17af8f(0x170),'type':a29_0x17af8f(0x1a2),'required':!![],'description':a29_0x17af8f(0x174)},DESCRIPTION_FLAG={'name':'description','type':'string','description':a29_0x17af8f(0x191)},SOURCE_SESSION_FLAG={'name':'source-session-id','type':'string','description':'Optional\x20source\x20RuntimeAgent\x20session\x20id'};function normalizeFunctionName(_0x55d425){const _0xc6a73f=a29_0x17af8f,_0x4da07f=String(_0x55d425||'')[_0xc6a73f(0x16b)]();if(!_0x4da07f||!FUNCTION_NAME_PATTERN[_0xc6a73f(0x188)](_0x4da07f))throw CliErrors[_0xc6a73f(0x18c)](_0xc6a73f(0x18f));return _0x4da07f;}function readScriptFile(_0x23f60d){const _0x140617=a29_0x17af8f;if(!_0x23f60d)throw CliErrors['validation'](_0x140617(0x185));if(!existsSync(_0x23f60d))throw CliErrors[_0x140617(0x18c)]('File\x20not\x20found:\x20'+_0x23f60d);if(!statSync(_0x23f60d)[_0x140617(0x189)]())throw CliErrors[_0x140617(0x18c)](_0x140617(0x196)+_0x23f60d);const _0x58fc4b=readFileSync(_0x23f60d,_0x140617(0x17c));if(!_0x58fc4b['trim']())throw CliErrors[_0x140617(0x18c)]('Personal\x20BFF\x20script\x20file\x20is\x20blank.');return _0x58fc4b;}function a29_0x2cdb(_0x5635bc,_0x509450){_0x5635bc=_0x5635bc-0x161;const _0x5c268c=a29_0x5c26();let _0x2cdbf=_0x5c268c[_0x5635bc];return _0x2cdbf;}function optionalTrimmed(_0x262da5){const _0x39edf6=String(_0x262da5||'')['trim']();return _0x39edf6||undefined;}function summarizeBff(_0x2695ed){const _0x384567=a29_0x17af8f;return{'id':_0x2695ed['id'],'appCode':_0x2695ed[_0x384567(0x195)],'functionName':_0x2695ed[_0x384567(0x16f)],'description':_0x2695ed[_0x384567(0x19c)],'scriptType':_0x2695ed['scriptType'],'version':_0x2695ed[_0x384567(0x17b)],'gmtModified':_0x2695ed[_0x384567(0x17f)],'updateTime':_0x2695ed[_0x384567(0x177)]};}function detailBff(_0x1026bd){const _0x3e60c7=a29_0x17af8f;return{'id':_0x1026bd['id'],'appCode':_0x1026bd[_0x3e60c7(0x195)],'functionName':_0x1026bd['functionName'],'description':_0x1026bd[_0x3e60c7(0x19c)],'scriptType':_0x1026bd['scriptType'],'scriptContent':_0x1026bd[_0x3e60c7(0x16c)]??'','config':_0x1026bd['config'],'version':_0x1026bd[_0x3e60c7(0x17b)],'createUserId':_0x1026bd[_0x3e60c7(0x197)],'gmtCreate':_0x1026bd[_0x3e60c7(0x17a)],'gmtModified':_0x1026bd['gmtModified'],'createTime':_0x1026bd[_0x3e60c7(0x192)],'updateTime':_0x1026bd[_0x3e60c7(0x177)]};}function buildCreateInput(_0x51a4d4){const _0x16769=a29_0x17af8f;return{'functionName':normalizeFunctionName(_0x51a4d4[_0x16769(0x19f)](_0x16769(0x170))),...optionalTrimmed(_0x51a4d4[_0x16769(0x19f)](_0x16769(0x19c)))?{'description':optionalTrimmed(_0x51a4d4['str']('description'))}:{},'scriptContent':readScriptFile(_0x51a4d4[_0x16769(0x19f)]('file')),...optionalTrimmed(_0x51a4d4[_0x16769(0x19f)](_0x16769(0x169)))?{'sourceSessionId':optionalTrimmed(_0x51a4d4['str']('source-session-id'))}:{}};}function buildUpdateInput(_0x106220){const _0x1cd89e=a29_0x17af8f,_0x3cf0a9={};optionalTrimmed(_0x106220[_0x1cd89e(0x19f)](_0x1cd89e(0x170)))&&(_0x3cf0a9[_0x1cd89e(0x16f)]=normalizeFunctionName(_0x106220[_0x1cd89e(0x19f)](_0x1cd89e(0x170))));_0x106220[_0x1cd89e(0x175)](_0x1cd89e(0x19c))!==undefined&&(_0x3cf0a9[_0x1cd89e(0x19c)]=_0x106220[_0x1cd89e(0x19f)](_0x1cd89e(0x19c)));optionalTrimmed(_0x106220[_0x1cd89e(0x19f)](_0x1cd89e(0x194)))&&(_0x3cf0a9[_0x1cd89e(0x16c)]=readScriptFile(_0x106220[_0x1cd89e(0x19f)](_0x1cd89e(0x194))));_0x106220['flag']('source-session-id')!==undefined&&(_0x3cf0a9[_0x1cd89e(0x19d)]=_0x106220[_0x1cd89e(0x19f)](_0x1cd89e(0x169)));if(Object['keys'](_0x3cf0a9)[_0x1cd89e(0x19e)]===0x0)throw CliErrors[_0x1cd89e(0x18c)](_0x1cd89e(0x16e));return _0x3cf0a9;}function parseExecParams(_0x550670){const _0x385936=a29_0x17af8f,_0x4764aa=parseJsonParams(_0x550670)??{};if(Array[_0x385936(0x16d)](_0x4764aa))throw CliErrors['validation']('--params\x20must\x20be\x20a\x20JSON\x20object.');return _0x4764aa;}const personalBffList={'service':a29_0x17af8f(0x172),'command':a29_0x17af8f(0x171),'description':a29_0x17af8f(0x183),'risk':a29_0x17af8f(0x176),'flags':[VERBOSE_FLAG],async 'execute'(_0x216d7a){const _0x32de7e=a29_0x17af8f,_0x1f46c2=await listPersonalBffs(_0x216d7a[_0x32de7e(0x195)]);return{'ok':!![],'data':{'total':_0x1f46c2[_0x32de7e(0x19e)],'items':_0x216d7a['bool'](_0x32de7e(0x168))?_0x1f46c2:_0x1f46c2[_0x32de7e(0x1a0)](summarizeBff)}};}},personalBffDetail={'service':a29_0x17af8f(0x172),'command':a29_0x17af8f(0x179),'description':a29_0x17af8f(0x178),'risk':a29_0x17af8f(0x176),'flags':[{...ID_FLAG,'description':a29_0x17af8f(0x180)}],async 'execute'(_0x2b8224){const _0x12f2e=a29_0x17af8f,_0x5d7485=await getPersonalBff(_0x2b8224['num']('id'),_0x2b8224[_0x12f2e(0x195)]);return{'ok':!![],'data':detailBff(_0x5d7485)};}},personalBffCreate={'service':a29_0x17af8f(0x172),'command':a29_0x17af8f(0x16a),'description':a29_0x17af8f(0x1a1),'risk':'write','flags':[FUNCTION_NAME_FLAG,{...FILE_FLAG,'required':!![]},DESCRIPTION_FLAG,SOURCE_SESSION_FLAG],async 'execute'(_0x652e8d){const _0x371b4f=a29_0x17af8f,_0x392e06=buildCreateInput(_0x652e8d),_0x38ad1f=await createPersonalBff(_0x652e8d[_0x371b4f(0x195)],_0x392e06);return{'ok':!![],'data':detailBff(_0x38ad1f),'message':'Created\x20personal\x20BFF\x20'+_0x38ad1f['id']+(_0x38ad1f[_0x371b4f(0x16f)]?'\x20('+_0x38ad1f['functionName']+')':'')};},async 'dryRun'(_0x5d58c5){const _0x290b0a=a29_0x17af8f,_0x4d362f=buildCreateInput(_0x5d58c5);return dryRun(_0x290b0a(0x17d),'/client/runtime-bff/personal/create')[_0x290b0a(0x18b)]({'appCode':_0x5d58c5[_0x290b0a(0x195)],..._0x4d362f})['description'](_0x290b0a(0x184)+_0x4d362f[_0x290b0a(0x16f)])['build']();}},personalBffUpdate={'service':a29_0x17af8f(0x172),'command':a29_0x17af8f(0x18d),'description':'Update\x20a\x20personal\x20BFF\x20by\x20id','risk':a29_0x17af8f(0x164),'flags':[{...ID_FLAG,'description':a29_0x17af8f(0x180)},{...FUNCTION_NAME_FLAG,'required':![]},FILE_FLAG,DESCRIPTION_FLAG,SOURCE_SESSION_FLAG],async 'execute'(_0xccac89){const _0x51be4d=a29_0x17af8f,_0x3fffcb=_0xccac89[_0x51be4d(0x198)]('id'),_0x31aa15=buildUpdateInput(_0xccac89),_0x4e4975=await updatePersonalBff(_0x3fffcb,_0xccac89[_0x51be4d(0x195)],_0x31aa15);return{'ok':!![],'data':detailBff(_0x4e4975),'message':'Updated\x20personal\x20BFF\x20'+_0x4e4975['id']+(_0x4e4975[_0x51be4d(0x16f)]?'\x20('+_0x4e4975['functionName']+')':'')};},async 'dryRun'(_0x57e039){const _0x116069=a29_0x17af8f,_0x3ad20a=_0x57e039[_0x116069(0x198)]('id'),_0x207b8f=buildUpdateInput(_0x57e039);return dryRun(_0x116069(0x17d),'/client/runtime-bff/personal/'+_0x3ad20a+_0x116069(0x199))['body']({'appCode':_0x57e039[_0x116069(0x195)],..._0x207b8f})[_0x116069(0x19c)](_0x116069(0x18e)+_0x3ad20a)[_0x116069(0x163)]();}},personalBffExec={'service':a29_0x17af8f(0x172),'command':'exec','description':'Execute\x20a\x20personal\x20BFF\x20by\x20id\x20with\x20optional\x20JSON\x20params','risk':a29_0x17af8f(0x190),'flags':[{...ID_FLAG,'description':a29_0x17af8f(0x180)},{...PARAMS_FLAG,'description':'JSON\x20object\x20passed\x20to\x20the\x20personal\x20BFF\x20execution'}],async 'validate'(_0x58e5c6){const _0x1325c2=a29_0x17af8f;parseExecParams(_0x58e5c6[_0x1325c2(0x19f)](_0x1325c2(0x173)));},async 'execute'(_0x4e1c52){const _0x43b5d6=a29_0x17af8f,_0x83fdd3=_0x4e1c52[_0x43b5d6(0x198)]('id'),_0x35aa54=parseExecParams(_0x4e1c52['str'](_0x43b5d6(0x173))),_0x2d5719=await executePersonalBff(_0x83fdd3,_0x4e1c52['appCode'],_0x35aa54);return{'ok':!![],'data':{'result':_0x2d5719},'message':_0x43b5d6(0x18a)+_0x83fdd3};}};export const personalBffDefinitions=[personalBffList,personalBffDetail,personalBffCreate,personalBffUpdate,personalBffExec];
|
|
1
|
+
const a29_0x53a6f5=a29_0x597d;(function(_0x19cf33,_0x335f8d){const _0x5b31ec=a29_0x597d,_0xa375f9=_0x19cf33();while(!![]){try{const _0x18657c=-parseInt(_0x5b31ec(0x9d))/0x1+parseInt(_0x5b31ec(0x91))/0x2+-parseInt(_0x5b31ec(0xa6))/0x3+-parseInt(_0x5b31ec(0xa2))/0x4+-parseInt(_0x5b31ec(0x96))/0x5+parseInt(_0x5b31ec(0x71))/0x6*(-parseInt(_0x5b31ec(0xa0))/0x7)+parseInt(_0x5b31ec(0xa4))/0x8;if(_0x18657c===_0x335f8d)break;else _0xa375f9['push'](_0xa375f9['shift']());}catch(_0x10c895){_0xa375f9['push'](_0xa375f9['shift']());}}}(a29_0x35ee,0x6c571));import{existsSync,readFileSync,statSync}from'node:fs';import{createPersonalBff,executePersonalBff,getPersonalBff,listPersonalBffs,updatePersonalBff}from'../../core/api-client.js';import{ID_FLAG,PARAMS_FLAG,VERBOSE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';import{dryRun}from'../../framework/dryrun.js';import{parseJsonParams}from'../../utils/params.js';function a29_0x597d(_0x56002b,_0x9972bc){_0x56002b=_0x56002b-0x70;const _0x35ee52=a29_0x35ee();let _0x597dfd=_0x35ee52[_0x56002b];return _0x597dfd;}const FUNCTION_NAME_PATTERN=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,FILE_FLAG={'name':a29_0x53a6f5(0xa1),'type':'string','description':a29_0x53a6f5(0x70)},FUNCTION_NAME_FLAG={'name':a29_0x53a6f5(0x87),'type':a29_0x53a6f5(0x79),'required':!![],'description':'Personal\x20BFF\x20functionName,\x20for\x20example\x20loadOrders'},DESCRIPTION_FLAG={'name':a29_0x53a6f5(0x90),'type':a29_0x53a6f5(0x79),'description':a29_0x53a6f5(0x8d)},SOURCE_SESSION_FLAG={'name':a29_0x53a6f5(0x76),'type':a29_0x53a6f5(0x79),'description':a29_0x53a6f5(0x81)};function normalizeFunctionName(_0x219f35){const _0x30c27f=a29_0x53a6f5,_0x144857=String(_0x219f35||'')[_0x30c27f(0xac)]();if(!_0x144857||!FUNCTION_NAME_PATTERN[_0x30c27f(0x94)](_0x144857))throw CliErrors[_0x30c27f(0x83)](_0x30c27f(0x80));return _0x144857;}function readScriptFile(_0x1a7e09){const _0xe49661=a29_0x53a6f5;if(!_0x1a7e09)throw CliErrors[_0xe49661(0x83)](_0xe49661(0x8b));if(!existsSync(_0x1a7e09))throw CliErrors['validation'](_0xe49661(0xaa)+_0x1a7e09);if(!statSync(_0x1a7e09)[_0xe49661(0x86)]())throw CliErrors[_0xe49661(0x83)](_0xe49661(0xad)+_0x1a7e09);const _0xa0c52c=readFileSync(_0x1a7e09,_0xe49661(0xa9));if(!_0xa0c52c[_0xe49661(0xac)]())throw CliErrors['validation']('Personal\x20BFF\x20script\x20file\x20is\x20blank.');return _0xa0c52c;}function optionalTrimmed(_0xa8e21a){const _0x29eb2b=a29_0x53a6f5,_0x840863=String(_0xa8e21a||'')[_0x29eb2b(0xac)]();return _0x840863||undefined;}function summarizeBff(_0x315d7d){const _0x4afdd6=a29_0x53a6f5;return{'id':_0x315d7d['id'],'appCode':_0x315d7d[_0x4afdd6(0x93)],'functionName':_0x315d7d[_0x4afdd6(0x7d)],'description':_0x315d7d[_0x4afdd6(0x90)],'scriptType':_0x315d7d[_0x4afdd6(0x99)],'version':_0x315d7d[_0x4afdd6(0x84)],'gmtModified':_0x315d7d[_0x4afdd6(0xa5)],'updateTime':_0x315d7d[_0x4afdd6(0x9a)]};}function detailBff(_0x3c2a7c){const _0x382688=a29_0x53a6f5;return{'id':_0x3c2a7c['id'],'appCode':_0x3c2a7c[_0x382688(0x93)],'functionName':_0x3c2a7c[_0x382688(0x7d)],'description':_0x3c2a7c[_0x382688(0x90)],'scriptType':_0x3c2a7c['scriptType'],'scriptContent':_0x3c2a7c[_0x382688(0x82)]??'','config':_0x3c2a7c[_0x382688(0x85)],'version':_0x3c2a7c['version'],'createUserId':_0x3c2a7c[_0x382688(0x95)],'gmtCreate':_0x3c2a7c[_0x382688(0xa8)],'gmtModified':_0x3c2a7c['gmtModified'],'createTime':_0x3c2a7c[_0x382688(0x77)],'updateTime':_0x3c2a7c[_0x382688(0x9a)]};}function buildCreateInput(_0x21d3fc){const _0x2b20d2=a29_0x53a6f5;return{'functionName':normalizeFunctionName(_0x21d3fc[_0x2b20d2(0x92)](_0x2b20d2(0x87))),...optionalTrimmed(_0x21d3fc[_0x2b20d2(0x92)](_0x2b20d2(0x90)))?{'description':optionalTrimmed(_0x21d3fc[_0x2b20d2(0x92)](_0x2b20d2(0x90)))}:{},'scriptContent':readScriptFile(_0x21d3fc[_0x2b20d2(0x92)](_0x2b20d2(0xa1))),...optionalTrimmed(_0x21d3fc[_0x2b20d2(0x92)](_0x2b20d2(0x76)))?{'sourceSessionId':optionalTrimmed(_0x21d3fc[_0x2b20d2(0x92)]('source-session-id'))}:{}};}function a29_0x35ee(){const _0x5bfdd6=['bool','JSON\x20object\x20passed\x20to\x20the\x20personal\x20BFF\x20execution','build','source-session-id','createTime','Created\x20personal\x20BFF\x20','string','Execute\x20a\x20personal\x20BFF\x20by\x20id\x20with\x20optional\x20JSON\x20params','Update\x20a\x20personal\x20BFF\x20by\x20id','write','functionName','list','Preview:\x20create\x20personal\x20BFF\x20','--name\x20must\x20be\x20a\x20valid\x20JavaScript\x20identifier,\x20for\x20example\x20loadOrders.','Optional\x20source\x20RuntimeAgent\x20session\x20id','scriptContent','validation','version','config','isFile','name','detail','POST','update','File\x20path\x20is\x20required.','num','Personal\x20BFF\x20description','keys','length','description','1361360AWxlZo','str','appCode','test','createUserId','3166475qGBXdN','personal-bff','read','scriptType','updateTime','create','/client/runtime-bff/personal/create','508782lxgywG','Create\x20a\x20personal\x20BFF\x20from\x20a\x20local\x20script\x20file','verbose','7bprbaN','file','1459368xXkReb','flag','13999312kBlqWY','gmtModified','926259dXgNlq','isArray','gmtCreate','utf8','File\x20not\x20found:\x20','/update','trim','File\x20is\x20not\x20a\x20regular\x20file:\x20','--params\x20must\x20be\x20a\x20JSON\x20object.','body','params','Personal\x20BFF\x20script\x20ID','Path\x20to\x20a\x20local\x20UTF-8\x20JavaScript\x20or\x20TypeScript\x20file','1026966hTtrio','high-risk-write'];a29_0x35ee=function(){return _0x5bfdd6;};return a29_0x35ee();}function buildUpdateInput(_0x333ba1){const _0x1f6d90=a29_0x53a6f5,_0xb2ed63={};optionalTrimmed(_0x333ba1[_0x1f6d90(0x92)](_0x1f6d90(0x87)))&&(_0xb2ed63['functionName']=normalizeFunctionName(_0x333ba1[_0x1f6d90(0x92)](_0x1f6d90(0x87))));_0x333ba1[_0x1f6d90(0xa3)](_0x1f6d90(0x90))!==undefined&&(_0xb2ed63[_0x1f6d90(0x90)]=_0x333ba1[_0x1f6d90(0x92)](_0x1f6d90(0x90)));optionalTrimmed(_0x333ba1[_0x1f6d90(0x92)](_0x1f6d90(0xa1)))&&(_0xb2ed63['scriptContent']=readScriptFile(_0x333ba1[_0x1f6d90(0x92)](_0x1f6d90(0xa1))));_0x333ba1[_0x1f6d90(0xa3)](_0x1f6d90(0x76))!==undefined&&(_0xb2ed63['sourceSessionId']=_0x333ba1['str'](_0x1f6d90(0x76)));if(Object[_0x1f6d90(0x8e)](_0xb2ed63)[_0x1f6d90(0x8f)]===0x0)throw CliErrors[_0x1f6d90(0x83)]('personal-bff\x20update\x20requires\x20at\x20least\x20one\x20of\x20--name,\x20--description,\x20--file,\x20or\x20--source-session-id.');return _0xb2ed63;}function parseExecParams(_0xd7e1c2){const _0x5021ff=a29_0x53a6f5,_0x4d72c7=parseJsonParams(_0xd7e1c2)??{};if(Array[_0x5021ff(0xa7)](_0x4d72c7))throw CliErrors[_0x5021ff(0x83)](_0x5021ff(0xae));return _0x4d72c7;}const personalBffList={'service':a29_0x53a6f5(0x97),'command':a29_0x53a6f5(0x7e),'description':'List\x20current\x20user\x27s\x20personal\x20BFF\x20scripts\x20for\x20the\x20current\x20app','risk':'read','flags':[VERBOSE_FLAG],async 'execute'(_0x53eb15){const _0x89c93b=a29_0x53a6f5,_0x57ad33=await listPersonalBffs(_0x53eb15[_0x89c93b(0x93)]);return{'ok':!![],'data':{'total':_0x57ad33[_0x89c93b(0x8f)],'items':_0x53eb15[_0x89c93b(0x73)](_0x89c93b(0x9f))?_0x57ad33:_0x57ad33['map'](summarizeBff)}};}},personalBffDetail={'service':'personal-bff','command':a29_0x53a6f5(0x88),'description':'Show\x20one\x20personal\x20BFF\x20by\x20id','risk':a29_0x53a6f5(0x98),'flags':[{...ID_FLAG,'description':a29_0x53a6f5(0xb1)}],async 'execute'(_0xdbcc5b){const _0x429d5e=a29_0x53a6f5,_0x268aed=await getPersonalBff(_0xdbcc5b[_0x429d5e(0x8c)]('id'),_0xdbcc5b[_0x429d5e(0x93)]);return{'ok':!![],'data':detailBff(_0x268aed)};}},personalBffCreate={'service':'personal-bff','command':a29_0x53a6f5(0x9b),'description':a29_0x53a6f5(0x9e),'risk':a29_0x53a6f5(0x7c),'flags':[FUNCTION_NAME_FLAG,{...FILE_FLAG,'required':!![]},DESCRIPTION_FLAG,SOURCE_SESSION_FLAG],async 'execute'(_0x261cd0){const _0x2d6e72=a29_0x53a6f5,_0x4d817c=buildCreateInput(_0x261cd0),_0x53c21b=await createPersonalBff(_0x261cd0['appCode'],_0x4d817c);return{'ok':!![],'data':detailBff(_0x53c21b),'message':_0x2d6e72(0x78)+_0x53c21b['id']+(_0x53c21b['functionName']?'\x20('+_0x53c21b['functionName']+')':'')};},async 'dryRun'(_0x2feeac){const _0x5e8831=a29_0x53a6f5,_0x5757bc=buildCreateInput(_0x2feeac);return dryRun(_0x5e8831(0x89),_0x5e8831(0x9c))[_0x5e8831(0xaf)]({'appCode':_0x2feeac['appCode'],..._0x5757bc})['description'](_0x5e8831(0x7f)+_0x5757bc[_0x5e8831(0x7d)])[_0x5e8831(0x75)]();}},personalBffUpdate={'service':a29_0x53a6f5(0x97),'command':a29_0x53a6f5(0x8a),'description':a29_0x53a6f5(0x7b),'risk':'write','flags':[{...ID_FLAG,'description':a29_0x53a6f5(0xb1)},{...FUNCTION_NAME_FLAG,'required':![]},FILE_FLAG,DESCRIPTION_FLAG,SOURCE_SESSION_FLAG],async 'execute'(_0x146631){const _0x269f5e=a29_0x53a6f5,_0x47ec8d=_0x146631[_0x269f5e(0x8c)]('id'),_0x4f8a18=buildUpdateInput(_0x146631),_0x231531=await updatePersonalBff(_0x47ec8d,_0x146631[_0x269f5e(0x93)],_0x4f8a18);return{'ok':!![],'data':detailBff(_0x231531),'message':'Updated\x20personal\x20BFF\x20'+_0x231531['id']+(_0x231531[_0x269f5e(0x7d)]?'\x20('+_0x231531[_0x269f5e(0x7d)]+')':'')};},async 'dryRun'(_0x4d1ca1){const _0x44260b=a29_0x53a6f5,_0x59c723=_0x4d1ca1[_0x44260b(0x8c)]('id'),_0x4dc19f=buildUpdateInput(_0x4d1ca1);return dryRun(_0x44260b(0x89),'/client/runtime-bff/personal/'+_0x59c723+_0x44260b(0xab))[_0x44260b(0xaf)]({'appCode':_0x4d1ca1[_0x44260b(0x93)],..._0x4dc19f})[_0x44260b(0x90)]('Preview:\x20update\x20personal\x20BFF\x20'+_0x59c723)['build']();}},personalBffExec={'service':a29_0x53a6f5(0x97),'command':'exec','description':a29_0x53a6f5(0x7a),'risk':a29_0x53a6f5(0x72),'flags':[{...ID_FLAG,'description':a29_0x53a6f5(0xb1)},{...PARAMS_FLAG,'description':a29_0x53a6f5(0x74)}],async 'validate'(_0x1fa77b){const _0x1811a0=a29_0x53a6f5;parseExecParams(_0x1fa77b[_0x1811a0(0x92)]('params'));},async 'execute'(_0x3c5247){const _0x440c46=a29_0x53a6f5,_0x5958a8=_0x3c5247[_0x440c46(0x8c)]('id'),_0x27c7bf=parseExecParams(_0x3c5247[_0x440c46(0x92)](_0x440c46(0xb0))),_0x411ffe=await executePersonalBff(_0x5958a8,_0x3c5247[_0x440c46(0x93)],_0x27c7bf);return{'ok':!![],'data':{'result':_0x411ffe},'message':'Executed\x20personal\x20BFF\x20'+_0x5958a8};}};export const personalBffDefinitions=[personalBffList,personalBffDetail,personalBffCreate,personalBffUpdate,personalBffExec];
|
package/lib/commands/registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x3801dd=a30_0x502e;(function(_0x24bc5c,_0x61fcd5){const _0x3ffee6=a30_0x502e,_0x3e1208=_0x24bc5c();while(!![]){try{const _0x41a4b4=parseInt(_0x3ffee6(0x110))/0x1+parseInt(_0x3ffee6(0x109))/0x2*(-parseInt(_0x3ffee6(0x124))/0x3)+-parseInt(_0x3ffee6(0x116))/0x4+parseInt(_0x3ffee6(0x11e))/0x5*(-parseInt(_0x3ffee6(0x103))/0x6)+parseInt(_0x3ffee6(0x106))/0x7+-parseInt(_0x3ffee6(0x11f))/0x8+-parseInt(_0x3ffee6(0x121))/0x9*(-parseInt(_0x3ffee6(0x108))/0xa);if(_0x41a4b4===_0x61fcd5)break;else _0x3e1208['push'](_0x3e1208['shift']());}catch(_0x15fa25){_0x3e1208['push'](_0x3e1208['shift']());}}}(a30_0x1dff,0xe4115));import{authDefinitions}from'../commands/auth/index.js';import{logsDefinitions}from'../commands/logs/index.js';import{skillDefinitions}from'../commands/skill/index.js';import{cliSkillDefinitions}from'../commands/cli-skill/index.js';function a30_0x1dff(){const _0x213e0b=['154973DCDVVU','BFF\x20Scripts','10zoZUqh','202YMuyeB','isSingleCommand','API\x20Documentation','\x20\x20[write]','set','CLI\x20Built-in\x20Skill','service','1182209hjgGKC','command','login','\x20\x20[high-risk-write]','defaultCommand','Datasets','3533784JrOIGQ','Authentication','Instant\x20API','list','install','get','description','read','4116155ZUIALh','862712kjFJhh','Self\x20Update','29051118HiGLbi','Diagnostics','push','50007oGFxoz','risk','Personal\x20BFF','Knowledge\x20Base','from','map','App\x20Management','Artifacts','6HGRKse','Schema','Configuration'];a30_0x1dff=function(){return _0x213e0b;};return a30_0x1dff();}import{serviceDefinitions}from'../commands/service/index.js';import{updateDefinition}from'../commands/update.js';import{doctorDefinition}from'../commands/doctor.js';import{schemaDefinition}from'../commands/schema.js';import{appDefinitions}from'../commands/app/definitions.js';import{workspaceDefinitions}from'../commands/workspace/index.js';import{configDefinitions}from'../commands/config/definitions.js';import{bffDefinitions}from'../commands/bff/index.js';import{sqlDefinitions}from'../commands/sql/index.js';import{datasetDefinitions}from'../commands/dataset/index.js';import{dataDefinitions}from'../commands/data/index.js';import{kbDefinitions}from'../commands/kb/index.js';import{artifactDefinitions}from'../commands/artifact/index.js';import{personalBffDefinitions}from'../commands/personal-bff/index.js';function a30_0x502e(_0x564f43,_0x43a5db){_0x564f43=_0x564f43-0xfd;const _0x1dff66=a30_0x1dff();let _0x502ec7=_0x1dff66[_0x564f43];return _0x502ec7;}import{apiDocDefinitions}from'../commands/api-doc/index.js';export const serviceRegistry=[];const serviceByName=new Map();export const definitions=new Map();export const serviceGroups=new Map();function registerDefinitions(_0x1d123d){const _0x1a3782=a30_0x502e;for(const _0x27d683 of _0x1d123d){definitions[_0x1a3782(0x10d)](_0x27d683[_0x1a3782(0x10f)]+':'+_0x27d683['command'],_0x27d683);let _0x26d6da=serviceGroups[_0x1a3782(0x11b)](_0x27d683['service']);!_0x26d6da&&(_0x26d6da=[],serviceGroups[_0x1a3782(0x10d)](_0x27d683[_0x1a3782(0x10f)],_0x26d6da)),_0x26d6da['push'](_0x27d683);}}function registerService(_0x1314b8,_0x26f37d,_0xecd8d0){const _0x5ee196=a30_0x502e;registerDefinitions(_0x26f37d);const _0x54b199=_0x829e20=>_0x829e20===_0x5ee196(0x11d)?'':_0x829e20==='write'?_0x5ee196(0x10c):_0x5ee196(0x113),_0x525209={'service':_0x26f37d[0x0]['service'],'label':_0x1314b8,'commands':_0x26f37d[_0x5ee196(0x100)](_0x1ac46d=>({'command':_0x1ac46d[_0x5ee196(0x111)],'description':_0x1ac46d[_0x5ee196(0x11c)],'tag':_0x54b199(_0x1ac46d[_0x5ee196(0x125)])})),'defaultCommand':_0xecd8d0?.[_0x5ee196(0x114)]??(_0xecd8d0?.[_0x5ee196(0x10a)]?_0x26f37d[0x0]['command']:undefined),'isSingleCommand':_0xecd8d0?.['isSingleCommand']};serviceRegistry[_0x5ee196(0x123)](_0x525209),serviceByName[_0x5ee196(0x10d)](_0x525209[_0x5ee196(0x10f)],_0x525209);}registerService(a30_0x3801dd(0x117),authDefinitions,{'defaultCommand':a30_0x3801dd(0x112)}),registerService(a30_0x3801dd(0x10b),apiDocDefinitions),registerService(a30_0x3801dd(0x115),datasetDefinitions),registerService(a30_0x3801dd(0x118),dataDefinitions),registerService('SQL\x20Queries',sqlDefinitions),registerService(a30_0x3801dd(0x107),bffDefinitions),registerService(a30_0x3801dd(0xfd),personalBffDefinitions),registerService(a30_0x3801dd(0x102),artifactDefinitions),registerService(a30_0x3801dd(0xfe),kbDefinitions),registerService(a30_0x3801dd(0x101),appDefinitions,{'defaultCommand':a30_0x3801dd(0x119)}),registerService('Workspace',workspaceDefinitions),registerService(a30_0x3801dd(0x105),configDefinitions,{'defaultCommand':a30_0x3801dd(0x119)}),registerService('Service\x20Tree',serviceDefinitions,{'defaultCommand':'list'}),registerService('Skills',skillDefinitions,{'defaultCommand':a30_0x3801dd(0x11a)}),registerService(a30_0x3801dd(0x10e),cliSkillDefinitions,{'defaultCommand':'install'}),registerService(a30_0x3801dd(0x120),[updateDefinition],{'defaultCommand':'run','isSingleCommand':!![]}),registerService(a30_0x3801dd(0x122),[doctorDefinition],{'isSingleCommand':!![]}),registerService(a30_0x3801dd(0x104),[schemaDefinition],{'isSingleCommand':!![]}),registerService('Logs',logsDefinitions,{'defaultCommand':'show'});export function findDefinition(_0x3ab506,_0x24322e){const _0x48ef78=a30_0x3801dd;return definitions[_0x48ef78(0x11b)](_0x3ab506+':'+_0x24322e);}export function isKnownService(_0x24d7e9){return serviceByName['has'](_0x24d7e9);}export function getServiceEntry(_0x245bc6){const _0x367856=a30_0x3801dd;return serviceByName[_0x367856(0x11b)](_0x245bc6);}export function getAllDefinitions(){const _0x20908d=a30_0x3801dd;return Array[_0x20908d(0xff)](definitions['values']());}
|
package/lib/commands/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x59a1b7=a31_0x4982;function a31_0x4982(_0x80cdda,_0x49c817){_0x80cdda=_0x80cdda-0x1ce;const _0x2bb9a5=a31_0x2bb9();let _0x4982b2=_0x2bb9a5[_0x80cdda];return _0x4982b2;}(function(_0x148b82,_0x4b3ee8){const _0x16d204=a31_0x4982,_0x2c989c=_0x148b82();while(!![]){try{const _0xd9a23e=-parseInt(_0x16d204(0x1d3))/0x1*(-parseInt(_0x16d204(0x1ce))/0x2)+-parseInt(_0x16d204(0x1d9))/0x3*(parseInt(_0x16d204(0x1db))/0x4)+-parseInt(_0x16d204(0x1dc))/0x5+parseInt(_0x16d204(0x1cf))/0x6+parseInt(_0x16d204(0x1d6))/0x7*(-parseInt(_0x16d204(0x1d4))/0x8)+parseInt(_0x16d204(0x1d1))/0x9*(parseInt(_0x16d204(0x1d0))/0xa)+parseInt(_0x16d204(0x1d5))/0xb*(-parseInt(_0x16d204(0x1d2))/0xc);if(_0xd9a23e===_0x4b3ee8)break;else _0x2c989c['push'](_0x2c989c['shift']());}catch(_0x47a54){_0x2c989c['push'](_0x2c989c['shift']());}}}(a31_0x2bb9,0x4f492));function a31_0x2bb9(){const _0x3b9590=['595012PtAHRd','2079900fGlRMv','2662210vSrejS','9qyUlrT','444rHGETk','1zcTefF','32yXJcaQ','19756HGVbCo','69916rGaKMw','schema','export','6RjeKAK','Export\x20machine-readable\x20command\x20schema\x20(JSON)','121080wDkLcW','2093395PKxrrS'];a31_0x2bb9=function(){return _0x3b9590;};return a31_0x2bb9();}import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x27ae4b){const _0x1c06e7=await buildSchemaPayload();return{'ok':!![],'data':_0x1c06e7};}export const schemaDefinition={'service':a31_0x59a1b7(0x1d7),'command':a31_0x59a1b7(0x1d8),'description':a31_0x59a1b7(0x1da),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2df406,_0x39aae8){const _0x13c365=a32_0x1743,_0x144251=_0x2df406();while(!![]){try{const _0x2044c4=-parseInt(_0x13c365(0x132))/0x1*(-parseInt(_0x13c365(0x152))/0x2)+-parseInt(_0x13c365(0x130))/0x3*(-parseInt(_0x13c365(0x110))/0x4)+-parseInt(_0x13c365(0x109))/0x5*(parseInt(_0x13c365(0x106))/0x6)+-parseInt(_0x13c365(0x13b))/0x7+-parseInt(_0x13c365(0x154))/0x8+parseInt(_0x13c365(0x122))/0x9*(parseInt(_0x13c365(0x118))/0xa)+parseInt(_0x13c365(0x144))/0xb;if(_0x2044c4===_0x39aae8)break;else _0x144251['push'](_0x144251['shift']());}catch(_0x4f56bd){_0x144251['push'](_0x144251['shift']());}}}(a32_0x5095,0xc647e));import{compileServiceTreeCommand,matchServiceTreeCommand}from'@lovrabet/cli-framework';import{getLoginUserInfo,listDatasets}from'../../core/api-client.js';import{executeData,executeSdkBff,executeSdkSql}from'../../core/sdk-client.js';function a32_0x1743(_0x535cc5,_0x2da008){_0x535cc5=_0x535cc5-0x101;const _0x5095ad=a32_0x5095();let _0x1743de=_0x5095ad[_0x535cc5];return _0x1743de;}import{CliErrors}from'../../errors.js';import{listLocalServices,listLocalServiceTrees}from'../../commands/service/registry.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export function resolveDynamicServiceCommand(_0x42c134,_0x465aab){const _0x2d9669=a32_0x1743,_0x594942=listLocalServiceTrees();let _0x5cf479;for(const _0x231315 of _0x594942){const _0x66b7eb=matchServiceTreeCommand(_0x231315,_0x42c134);if(!_0x66b7eb)continue;(!_0x5cf479||_0x66b7eb[_0x2d9669(0x158)][_0x2d9669(0x11a)]['length']>_0x5cf479['command'][_0x2d9669(0x11a)][_0x2d9669(0x13f)])&&(_0x5cf479={'tree':_0x231315,'command':_0x66b7eb[_0x2d9669(0x158)],'remainingArgs':_0x66b7eb[_0x2d9669(0x12e)]});}if(!_0x5cf479)return undefined;const _0x559340={..._0x465aab};return applyAppBinding(_0x5cf479[_0x2d9669(0x11b)],_0x5cf479[_0x2d9669(0x158)],_0x559340),{'definition':buildDynamicCommandDefinition(_0x5cf479[_0x2d9669(0x11b)],_0x5cf479['command']),'args':_0x5cf479[_0x2d9669(0x12e)],'flags':_0x559340,'tree':_0x5cf479[_0x2d9669(0x11b)],'command':_0x5cf479[_0x2d9669(0x158)]};}export function generateDynamicServiceHelp(_0x284399){const _0x1895b1=a32_0x1743,_0x2b115f=listLocalServiceTrees()[_0x1895b1(0x168)](_0x5625ae=>_0x5625ae[_0x1895b1(0x162)]['code']===_0x284399);if(!_0x2b115f)return undefined;const _0x54e90a=[CLI_BIN_NAME+'\x20'+_0x284399+_0x1895b1(0x13c),'',_0x2b115f[_0x1895b1(0x162)][_0x1895b1(0x156)]||_0x284399,_0x2b115f[_0x1895b1(0x162)][_0x1895b1(0x153)]?'\x20\x20'+_0x2b115f[_0x1895b1(0x162)]['description']:'','',_0x1895b1(0x10d),..._0x2b115f[_0x1895b1(0x14d)][_0x1895b1(0x141)](_0x55d904=>{const _0x33f3f5=_0x1895b1,_0x54c873=_0x55d904[_0x33f3f5(0x11a)][_0x33f3f5(0x113)](0x1)[_0x33f3f5(0x167)]('\x20'),_0x466ad4=_0x55d904[_0x33f3f5(0x15a)]===_0x33f3f5(0x136)?'':'\x20['+_0x55d904[_0x33f3f5(0x15a)]+']';return'\x20\x20'+_0x54c873[_0x33f3f5(0x101)](0x18)+'\x20'+(_0x55d904[_0x33f3f5(0x153)]||'')+_0x466ad4;}),'',_0x1895b1(0x11f)+CLI_BIN_NAME+_0x1895b1(0x119)+_0x284399+'`\x20to\x20inspect\x20the\x20manifest.'][_0x1895b1(0x149)](Boolean);return _0x54e90a[_0x1895b1(0x167)]('\x0a');}export function listDynamicServiceEntries(){const _0x53f2c4=a32_0x1743;return listLocalServices()[_0x53f2c4(0x141)](_0x462717=>{const _0x517c0d=_0x53f2c4,_0x44989b=_0x462717[_0x517c0d(0x13e)];return{'service':_0x44989b[_0x517c0d(0x162)]['code'],'label':_0x44989b['service'][_0x517c0d(0x156)]||_0x44989b[_0x517c0d(0x162)][_0x517c0d(0x124)],'commands':_0x44989b[_0x517c0d(0x14d)][_0x517c0d(0x141)](_0x53b6fc=>({'command':dynamicCommandName(_0x53b6fc),'description':_0x53b6fc[_0x517c0d(0x153)]||_0x517c0d(0x105)+_0x53b6fc['cliPath'],'tag':riskTag(_0x53b6fc[_0x517c0d(0x15a)])}))};});}export function getDynamicServiceEntry(_0xf840d1){const _0x147393=a32_0x1743;return listDynamicServiceEntries()[_0x147393(0x168)](_0x447eec=>_0x447eec[_0x147393(0x162)]===_0xf840d1);}export function listDynamicServiceDefinitions(_0x39f22d){const _0x35dbef=a32_0x1743;return listLocalServiceTrees()['filter'](_0x47c254=>!_0x39f22d||_0x47c254[_0x35dbef(0x162)][_0x35dbef(0x124)]===_0x39f22d)[_0x35dbef(0x129)](_0x31cddb=>_0x31cddb[_0x35dbef(0x14d)][_0x35dbef(0x141)](_0x143a1d=>buildDynamicCommandDefinition(_0x31cddb,_0x143a1d)));}export function getDynamicServiceDefinitions(_0x5b7041){const _0x5313ad=a32_0x1743,_0x5d566d=listDynamicServiceDefinitions(_0x5b7041);return _0x5d566d[_0x5313ad(0x13f)]>0x0?_0x5d566d:undefined;}export function findDynamicServiceDefinition(_0x18db55,_0xd4ec8d){const _0x131f20=a32_0x1743;return listDynamicServiceDefinitions(_0x18db55)[_0x131f20(0x168)](_0xe5e47=>_0xe5e47['command']===_0xd4ec8d);}export function buildDynamicCommandDefinition(_0x51609c,_0x5a87ef){const _0x403c08=a32_0x1743;return{'service':_0x51609c['service']['code'],'command':dynamicCommandName(_0x5a87ef),'description':_0x5a87ef[_0x403c08(0x153)]||_0x403c08(0x105)+_0x5a87ef[_0x403c08(0x13d)],'risk':_0x5a87ef['risk'],'requiresAuth':!![],'requiresAppCode':!![],'args':_0x5a87ef[_0x403c08(0x159)]['map'](_0x31aa25=>({'name':_0x31aa25[_0x403c08(0x156)],'description':_0x31aa25[_0x403c08(0x153)]||_0x31aa25[_0x403c08(0x156)],'required':_0x31aa25['required']})),'flags':_0x5a87ef[_0x403c08(0x148)][_0x403c08(0x141)](flagToCommandFlag),'helpExtra':()=>renderDynamicCommandHelp(_0x5a87ef),async 'dryRun'(_0x1dd4ac){const _0x975c04=_0x403c08,_0x5d763c=await compilePlan(_0x5a87ef,_0x1dd4ac);return{'method':_0x975c04(0x10a),'url':_0x5a87ef[_0x975c04(0x13d)],'body':{'target':targetPreview(_0x5d763c),'params':_0x5d763c[_0x975c04(0x139)]},'description':'Preview\x20dynamic\x20service\x20command:\x20'+_0x5a87ef[_0x975c04(0x13d)]};},async 'execute'(_0x4ca064){const _0xc59e40=_0x403c08,_0x5e5d25=await compilePlan(_0x5a87ef,_0x4ca064),_0x26ecdb=Date['now'](),_0x4f4827=await executePlan(_0x5e5d25,_0x5a87ef,_0x4ca064),_0x2d3ecc=Date[_0xc59e40(0x147)]()-_0x26ecdb;return{'ok':!![],'data':{'service':_0x51609c[_0xc59e40(0x162)],'command':_0x5a87ef[_0xc59e40(0x13d)],'target':targetPreview(_0x5e5d25),'result':_0x4f4827,'elapsed':_0x2d3ecc},'message':_0xc59e40(0x11d)+_0x5a87ef[_0xc59e40(0x13d)]+_0xc59e40(0x163)+_0x2d3ecc+'ms'};}};}function dynamicCommandName(_0x34db86){const _0x23afdc=a32_0x1743;return _0x34db86[_0x23afdc(0x11a)][_0x23afdc(0x113)](0x1)[_0x23afdc(0x167)]('\x20');}function riskTag(_0x35a6f5){const _0x59b787=a32_0x1743;return _0x35a6f5===_0x59b787(0x136)?'':_0x59b787(0x135)+_0x35a6f5+']';}function flagToCommandFlag(_0x165283){const _0x527519=a32_0x1743;return{'name':_0x165283[_0x527519(0x12c)],'type':_0x165283['type']===_0x527519(0x102)?_0x527519(0x15c):_0x165283[_0x527519(0x131)],'description':_0x165283[_0x527519(0x153)]||_0x165283[_0x527519(0x156)],'required':_0x165283[_0x527519(0x120)],'default':isPrimitiveFlagDefault(_0x165283[_0x527519(0x126)])?_0x165283[_0x527519(0x126)]:undefined,'enum':_0x165283[_0x527519(0x123)]};}async function compilePlan(_0x23a995,_0x1e548c){const _0x4414a3=a32_0x1743;return compileServiceTreeCommand(_0x23a995,{'flags':_0x1e548c[_0x4414a3(0x112)],'args':_0x1e548c[_0x4414a3(0x159)],'context':await buildServiceContext(_0x23a995,_0x1e548c)});}async function buildServiceContext(_0x5e2375,_0x336fc9){const _0x557958=a32_0x1743,_0x5e9644={'appCode':_0x336fc9[_0x557958(0x15d)],'env':_0x336fc9[_0x557958(0x12d)],'envName':_0x336fc9[_0x557958(0x12d)]};if(!usesRuntimeContext(_0x5e2375))return _0x5e9644;const _0x30effa=await getLoginUserInfo(),_0x153c8f=pickFirst(_0x30effa[_0x557958(0x121)],_0x30effa['id']);return{..._0x5e9644,'user':_0x30effa,'userId':_0x153c8f,'id':_0x30effa['id'],'username':pickFirst(_0x30effa['username'],_0x30effa[_0x557958(0x125)],_0x30effa['loginName']),'userName':_0x30effa[_0x557958(0x125)],'nickname':pickFirst(_0x30effa['nickname'],_0x30effa[_0x557958(0x11c)]),'nickName':_0x30effa['nickName'],'tenantCode':_0x30effa[_0x557958(0x116)],'employeeId':_0x30effa['employeeId']};}function usesRuntimeContext(_0x1a9bb4){const _0x25e2bc=a32_0x1743;return _0x1a9bb4[_0x25e2bc(0x111)][_0x25e2bc(0x15e)](_0x3c71d5=>typeof _0x3c71d5[_0x25e2bc(0x133)]===_0x25e2bc(0x15c)&&(_0x3c71d5[_0x25e2bc(0x133)][_0x25e2bc(0x127)](_0x25e2bc(0x10c))||_0x3c71d5[_0x25e2bc(0x133)][_0x25e2bc(0x127)](_0x25e2bc(0x146))));}function pickFirst(..._0x118cda){const _0x53c7c6=a32_0x1743;return _0x118cda[_0x53c7c6(0x168)](_0x591f34=>_0x591f34!==undefined&&_0x591f34!==null);}async function executePlan(_0x2c96a7,_0x3e0a3f,_0x20788d){const _0x46d8a0=a32_0x1743;if(_0x2c96a7[_0x46d8a0(0x134)]==='data'){const _0x3ce38b=await resolveDatasetCode(_0x2c96a7,_0x3e0a3f,_0x20788d);return executeData(_0x3ce38b,_0x2c96a7[_0x46d8a0(0x158)],_0x2c96a7['params']);}if(_0x2c96a7['kind']==='sql'){if(!_0x2c96a7['sqlCode'])throw CliErrors[_0x46d8a0(0x143)](_0x46d8a0(0x11d)+_0x3e0a3f[_0x46d8a0(0x13d)]+_0x46d8a0(0x160));return executeSdkSql(_0x2c96a7['sqlCode'],normalizeScalarParams(_0x2c96a7[_0x46d8a0(0x139)]));}if(_0x2c96a7[_0x46d8a0(0x134)]===_0x46d8a0(0x117)){const _0x22d6b2=_0x2c96a7['scriptName']||_0x2c96a7['bffCode']||(_0x2c96a7[_0x46d8a0(0x165)]==null?'':String(_0x2c96a7['bffId']));if(!_0x22d6b2)throw CliErrors[_0x46d8a0(0x143)](_0x46d8a0(0x11d)+_0x3e0a3f[_0x46d8a0(0x13d)]+_0x46d8a0(0x128));return executeSdkBff(_0x22d6b2,_0x2c96a7[_0x46d8a0(0x139)]);}throw CliErrors[_0x46d8a0(0x143)](_0x46d8a0(0x12f)+_0x2c96a7[_0x46d8a0(0x134)]);}async function resolveDatasetCode(_0x47374b,_0x1a6828,_0x150521){const _0x38c7d8=a32_0x1743;if(_0x47374b[_0x38c7d8(0x169)])return _0x47374b[_0x38c7d8(0x169)];if(!_0x47374b[_0x38c7d8(0x166)])throw CliErrors[_0x38c7d8(0x143)](_0x38c7d8(0x11d)+_0x1a6828[_0x38c7d8(0x13d)]+'\x20requires\x20target.datasetCode\x20or\x20target.datatable.');const _0x7fef21=await listDatasets(_0x150521[_0x38c7d8(0x15d)]),_0x354f27=_0x7fef21[_0x38c7d8(0x168)](_0x357c73=>_0x357c73[_0x38c7d8(0x10e)]?.[_0x38c7d8(0x12a)]===_0x47374b[_0x38c7d8(0x166)]);if(!_0x354f27?.[_0x38c7d8(0x124)])throw CliErrors[_0x38c7d8(0x143)](_0x38c7d8(0x142)+_0x47374b[_0x38c7d8(0x166)]+'\x22\x20to\x20a\x20datasetCode\x20in\x20app\x20'+_0x150521[_0x38c7d8(0x15d)]+'.',_0x38c7d8(0x164));return _0x354f27['code'];}function applyAppBinding(_0x22a067,_0x52a63f,_0x3742b4){const _0x17015f=a32_0x1743,_0x3bc3d2=_0x52a63f[_0x17015f(0x14a)][_0x17015f(0x11e)];if(!_0x3bc3d2)return;const _0x5b4c54=_0x22a067[_0x17015f(0x104)][_0x3bc3d2];if(!_0x5b4c54)throw CliErrors[_0x17015f(0x143)](_0x17015f(0x155)+_0x3bc3d2+_0x17015f(0x14e)+_0x52a63f[_0x17015f(0x13d)]+'.',_0x17015f(0x145));const _0x390121=_0x5b4c54['appcode']||_0x5b4c54[_0x17015f(0x15d)];_0x390121&&!hasText(_0x3742b4[_0x17015f(0x15f)])&&(_0x3742b4[_0x17015f(0x15f)]=_0x390121),_0x5b4c54[_0x17015f(0x138)]&&!hasText(_0x3742b4[_0x17015f(0x138)])&&!hasText(_0x3742b4['appcode'])&&(_0x3742b4[_0x17015f(0x138)]=_0x5b4c54[_0x17015f(0x138)]),_0x5b4c54[_0x17015f(0x137)]&&!hasText(_0x3742b4['env'])&&(_0x3742b4['env']=_0x5b4c54[_0x17015f(0x137)]);}function renderDynamicCommandHelp(_0xdbbb2c){const _0x94df04=a32_0x1743,_0x16b39b=[_0x94df04(0x10f),_0x94df04(0x15b)+_0xdbbb2c[_0x94df04(0x14a)]['kind'],'\x20\x20\x20\x20command:\x20'+_0xdbbb2c[_0x94df04(0x14a)][_0x94df04(0x158)]];if(_0xdbbb2c[_0x94df04(0x14a)][_0x94df04(0x169)])_0x16b39b[_0x94df04(0x157)]('\x20\x20\x20\x20datasetCode:\x20'+_0xdbbb2c[_0x94df04(0x14a)][_0x94df04(0x169)]);if(_0xdbbb2c[_0x94df04(0x14a)][_0x94df04(0x166)])_0x16b39b['push'](_0x94df04(0x108)+_0xdbbb2c['target'][_0x94df04(0x166)]);if(_0xdbbb2c[_0x94df04(0x14a)]['sqlCode'])_0x16b39b[_0x94df04(0x157)](_0x94df04(0x14c)+_0xdbbb2c['target']['sqlCode']);if(_0xdbbb2c[_0x94df04(0x14a)][_0x94df04(0x151)])_0x16b39b[_0x94df04(0x157)](_0x94df04(0x13a)+_0xdbbb2c[_0x94df04(0x14a)][_0x94df04(0x151)]);if(_0xdbbb2c[_0x94df04(0x111)][_0x94df04(0x13f)]>0x0){_0x16b39b[_0x94df04(0x157)]('',_0x94df04(0x140));for(const _0xfc0acd of _0xdbbb2c['mapTo']){_0x16b39b['push'](_0x94df04(0x103)+(_0xfc0acd['source']||_0x94df04(0x14f))+'\x20->\x20'+_0xfc0acd[_0x94df04(0x14a)]+(_0xfc0acd['operator']?'.'+_0xfc0acd[_0x94df04(0x114)]:''));}}return _0x16b39b[_0x94df04(0x167)]('\x0a');}function a32_0x5095(){const _0x86419c=['code','userName','default','startsWith','\x20requires\x20target.scriptName.','flatMap','tableName','boolean','cliName','envName','remainingArgs','Unsupported\x20service\x20target\x20kind:\x20','3XNTMGj','type','41DtvlvL','source','kind','\x20\x20[','read','env','app','params','\x20\x20\x20\x20scriptName:\x20','9088758MNhVAe','\x20<command>\x20[flags]','cliPath','normalizedManifest','length','\x20\x20MAP\x20TO','map','Cannot\x20resolve\x20datatable\x20\x22','validation','8413064BDaSiH','Define\x20the\x20appRef\x20under\x20appBindings\x20or\x20remove\x20target.appRef.','ctx.','now','flags','filter','target','sqlCode','\x20\x20\x20\x20sqlCode:\x20','commands','\x22\x20in\x20service\x20command\x20','const','entries','scriptName','33634gRjkBe','description','3105912iBxJXK','Unknown\x20appRef\x20\x22','name','push','command','args','risk','\x20\x20\x20\x20kind:\x20\x20\x20\x20','string','appCode','some','appcode','\x20requires\x20target.sqlCode.','bffCode','service','\x20completed\x20in\x20','Use\x20lovrabet\x20dataset\x20list\x20to\x20confirm\x20the\x20physical\x20table\x20name\x20or\x20add\x20target.datasetCode\x20to\x20the\x20manifest.','bffId','datatable','join','find','datasetCode','padEnd','json','\x20\x20\x20\x20','appBindings','Run\x20service\x20command\x20','124572XjCkSM','trim','\x20\x20\x20\x20datatable:\x20','210iMrVHh','SERVICE_TREE','number','context.','Commands:','dbtableConfig','\x20\x20SERVICE\x20TREE\x20TARGET','6167716qnYsPt','mapTo','rawFlags','slice','operator','fromEntries','tenantCode','bff','50zcnZvG','\x20service\x20detail\x20--service\x20','fullPath','tree','nickName','Service\x20command\x20','appRef','Use\x20`','required','userId','674181KwoXCa','enum'];a32_0x5095=function(){return _0x86419c;};return a32_0x5095();}function targetPreview(_0x14cdec){const _0xe44551=a32_0x1743;return{'kind':_0x14cdec[_0xe44551(0x134)],'command':_0x14cdec[_0xe44551(0x158)],'appRef':_0x14cdec['appRef'],'datasetCode':_0x14cdec[_0xe44551(0x169)],'datatable':_0x14cdec[_0xe44551(0x166)],'sqlCode':_0x14cdec[_0xe44551(0x14b)],'bffCode':_0x14cdec[_0xe44551(0x161)],'bffId':_0x14cdec[_0xe44551(0x165)],'scriptName':_0x14cdec[_0xe44551(0x151)]};}function normalizeScalarParams(_0x2104ee){const _0x4361ce=a32_0x1743;return Object[_0x4361ce(0x115)](Object[_0x4361ce(0x150)](_0x2104ee)[_0x4361ce(0x149)](([,_0x27791f])=>typeof _0x27791f===_0x4361ce(0x15c)||typeof _0x27791f===_0x4361ce(0x10b)));}function hasText(_0xb14de2){const _0xc9a31d=a32_0x1743;return typeof _0xb14de2===_0xc9a31d(0x15c)&&_0xb14de2[_0xc9a31d(0x107)]()[_0xc9a31d(0x13f)]>0x0;}function isPrimitiveFlagDefault(_0x54e13b){const _0x485ddb=a32_0x1743;return _0x54e13b===undefined||typeof _0x54e13b==='string'||typeof _0x54e13b==='number'||typeof _0x54e13b===_0x485ddb(0x12b);}
|
|
1
|
+
(function(_0x5a9148,_0x56bcab){const _0x5cffcc=a32_0x44b2,_0x2fdd27=_0x5a9148();while(!![]){try{const _0x4428b7=-parseInt(_0x5cffcc(0x154))/0x1+parseInt(_0x5cffcc(0x184))/0x2*(parseInt(_0x5cffcc(0x15a))/0x3)+parseInt(_0x5cffcc(0x182))/0x4+-parseInt(_0x5cffcc(0x14e))/0x5*(parseInt(_0x5cffcc(0x121))/0x6)+-parseInt(_0x5cffcc(0x12e))/0x7*(-parseInt(_0x5cffcc(0x132))/0x8)+parseInt(_0x5cffcc(0x169))/0x9*(-parseInt(_0x5cffcc(0x18a))/0xa)+parseInt(_0x5cffcc(0x15d))/0xb;if(_0x4428b7===_0x56bcab)break;else _0x2fdd27['push'](_0x2fdd27['shift']());}catch(_0x4dccc9){_0x2fdd27['push'](_0x2fdd27['shift']());}}}(a32_0xccc1,0x2d684));import{compileServiceTreeCommand,matchServiceTreeCommand}from'@lovrabet/cli-framework';import{getLoginUserInfo,listDatasets}from'../../core/api-client.js';import{executeData,executeSdkBff,executeSdkSql}from'../../core/sdk-client.js';import{CliErrors}from'../../errors.js';import{listLocalServices,listLocalServiceTrees}from'../../commands/service/registry.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export function resolveDynamicServiceCommand(_0x3525ee,_0x443dfb){const _0xe51f14=a32_0x44b2,_0x34a2b4=listLocalServiceTrees();let _0x8d1bec;for(const _0x29614b of _0x34a2b4){const _0x378907=matchServiceTreeCommand(_0x29614b,_0x3525ee);if(!_0x378907)continue;(!_0x8d1bec||_0x378907[_0xe51f14(0x165)][_0xe51f14(0x172)][_0xe51f14(0x185)]>_0x8d1bec[_0xe51f14(0x165)]['fullPath'][_0xe51f14(0x185)])&&(_0x8d1bec={'tree':_0x29614b,'command':_0x378907[_0xe51f14(0x165)],'remainingArgs':_0x378907[_0xe51f14(0x12c)]});}if(!_0x8d1bec)return undefined;const _0xb1be01={..._0x443dfb};return applyAppBinding(_0x8d1bec['tree'],_0x8d1bec[_0xe51f14(0x165)],_0xb1be01),{'definition':buildDynamicCommandDefinition(_0x8d1bec['tree'],_0x8d1bec[_0xe51f14(0x165)]),'args':_0x8d1bec[_0xe51f14(0x12c)],'flags':_0xb1be01,'tree':_0x8d1bec[_0xe51f14(0x148)],'command':_0x8d1bec[_0xe51f14(0x165)]};}export function generateDynamicServiceHelp(_0x2e541b){const _0x53dd81=a32_0x44b2,_0x619f97=listLocalServiceTrees()[_0x53dd81(0x14c)](_0x4a4824=>_0x4a4824[_0x53dd81(0x152)]['code']===_0x2e541b);if(!_0x619f97)return undefined;const _0x43e3fe=[CLI_BIN_NAME+'\x20'+_0x2e541b+_0x53dd81(0x13d),'',_0x619f97[_0x53dd81(0x152)][_0x53dd81(0x168)]||_0x2e541b,_0x619f97[_0x53dd81(0x152)][_0x53dd81(0x183)]?'\x20\x20'+_0x619f97['service'][_0x53dd81(0x183)]:'','',_0x53dd81(0x123),..._0x619f97[_0x53dd81(0x175)][_0x53dd81(0x141)](_0x346be3=>{const _0x50569c=_0x53dd81,_0x4cde81=_0x346be3[_0x50569c(0x172)][_0x50569c(0x173)](0x1)[_0x50569c(0x155)]('\x20'),_0x2a2c58=_0x346be3[_0x50569c(0x143)]==='read'?'':'\x20['+_0x346be3[_0x50569c(0x143)]+']';return'\x20\x20'+_0x4cde81[_0x50569c(0x170)](0x18)+'\x20'+(_0x346be3[_0x50569c(0x183)]||'')+_0x2a2c58;}),'',_0x53dd81(0x136)+CLI_BIN_NAME+_0x53dd81(0x167)+_0x2e541b+_0x53dd81(0x124)][_0x53dd81(0x12b)](Boolean);return _0x43e3fe[_0x53dd81(0x155)]('\x0a');}export function listDynamicServiceEntries(){return listLocalServices()['map'](_0x59adfc=>{const _0x3d27d0=a32_0x44b2,_0x5e0a8c=_0x59adfc[_0x3d27d0(0x176)];return{'service':_0x5e0a8c['service'][_0x3d27d0(0x127)],'label':_0x5e0a8c[_0x3d27d0(0x152)][_0x3d27d0(0x168)]||_0x5e0a8c['service']['code'],'commands':_0x5e0a8c[_0x3d27d0(0x175)][_0x3d27d0(0x141)](_0x622103=>({'command':dynamicCommandName(_0x622103),'description':_0x622103['description']||_0x3d27d0(0x162)+_0x622103[_0x3d27d0(0x163)],'tag':riskTag(_0x622103[_0x3d27d0(0x143)])}))};});}export function getDynamicServiceEntry(_0x5d014f){const _0x215d78=a32_0x44b2;return listDynamicServiceEntries()[_0x215d78(0x14c)](_0x28e982=>_0x28e982[_0x215d78(0x152)]===_0x5d014f);}function a32_0xccc1(){const _0x5872ea=['description','4vJasbD','length','boolean','fromEntries','app','appBindings','296790rKQzUB','1617642CMfBsN','string','Commands:','`\x20to\x20inspect\x20the\x20manifest.','\x20\x20\x20\x20command:\x20','bffId','code','type','data','validation','filter','remainingArgs','appRef','7cITykc','source','\x20requires\x20target.sqlCode.','read','1601224JHEbqN','Use\x20lovrabet\x20dataset\x20list\x20to\x20confirm\x20the\x20physical\x20table\x20name\x20or\x20add\x20target.datasetCode\x20to\x20the\x20manifest.','datatable','\x20\x20\x20\x20kind:\x20\x20\x20\x20','Use\x20`','\x20->\x20','args','now','cliName','Unsupported\x20service\x20target\x20kind:\x20','entries','\x20<command>\x20[flags]','appcode','flatMap','\x20\x20\x20\x20datasetCode:\x20','map','scriptName','risk','target','context.','\x20requires\x20target.datasetCode\x20or\x20target.datatable.','default','tree','ctx.','tableName','employeeId','find','nickname','5NIkivA','Unknown\x20appRef\x20\x22','mapTo','push','service','\x22\x20to\x20a\x20datasetCode\x20in\x20app\x20','12409LxgifC','join','\x22\x20in\x20service\x20command\x20','nickName','Preview\x20dynamic\x20service\x20command:\x20','\x20\x20[','23808SwwVpd','\x20requires\x20target.scriptName.','\x20\x20\x20\x20datatable:\x20','2929311wucyZX','sql','\x20\x20MAP\x20TO','bffCode','kind','Run\x20service\x20command\x20','cliPath','required','command','dbtableConfig','\x20service\x20detail\x20--service\x20','name','27kazNXG','startsWith','userName','appCode','params','\x20\x20\x20\x20sqlCode:\x20','Service\x20command\x20','padEnd','loginName','fullPath','slice','operator','commands','normalizedManifest','sqlCode','SERVICE_TREE','env','Define\x20the\x20appRef\x20under\x20appBindings\x20or\x20remove\x20target.appRef.','enum','trim','Cannot\x20resolve\x20datatable\x20\x22','flags','userId','datasetCode','\x20completed\x20in\x20','298860GzEgkE'];a32_0xccc1=function(){return _0x5872ea;};return a32_0xccc1();}export function listDynamicServiceDefinitions(_0x48919c){const _0x231c71=a32_0x44b2;return listLocalServiceTrees()[_0x231c71(0x12b)](_0x1377ae=>!_0x48919c||_0x1377ae[_0x231c71(0x152)][_0x231c71(0x127)]===_0x48919c)[_0x231c71(0x13f)](_0x220e73=>_0x220e73['commands']['map'](_0x33be4b=>buildDynamicCommandDefinition(_0x220e73,_0x33be4b)));}export function getDynamicServiceDefinitions(_0x536a1f){const _0x471612=listDynamicServiceDefinitions(_0x536a1f);return _0x471612['length']>0x0?_0x471612:undefined;}export function findDynamicServiceDefinition(_0x32e12b,_0x4c948c){const _0x1abb31=a32_0x44b2;return listDynamicServiceDefinitions(_0x32e12b)[_0x1abb31(0x14c)](_0x458643=>_0x458643['command']===_0x4c948c);}export function buildDynamicCommandDefinition(_0x2f94fe,_0x90ea51){const _0x48b772=a32_0x44b2;return{'service':_0x2f94fe[_0x48b772(0x152)][_0x48b772(0x127)],'command':dynamicCommandName(_0x90ea51),'description':_0x90ea51[_0x48b772(0x183)]||_0x48b772(0x162)+_0x90ea51[_0x48b772(0x163)],'risk':_0x90ea51[_0x48b772(0x143)],'requiresAuth':!![],'requiresAppCode':!![],'args':_0x90ea51[_0x48b772(0x138)][_0x48b772(0x141)](_0x5cc778=>({'name':_0x5cc778[_0x48b772(0x168)],'description':_0x5cc778['description']||_0x5cc778['name'],'required':_0x5cc778[_0x48b772(0x164)]})),'flags':_0x90ea51[_0x48b772(0x17e)][_0x48b772(0x141)](flagToCommandFlag),'helpExtra':()=>renderDynamicCommandHelp(_0x90ea51),async 'dryRun'(_0x172ac6){const _0x546862=_0x48b772,_0x5ea0ec=await compilePlan(_0x90ea51,_0x172ac6);return{'method':_0x546862(0x178),'url':_0x90ea51[_0x546862(0x163)],'body':{'target':targetPreview(_0x5ea0ec),'params':_0x5ea0ec['params']},'description':_0x546862(0x158)+_0x90ea51[_0x546862(0x163)]};},async 'execute'(_0x3473f0){const _0x520c9b=_0x48b772,_0x8aa14e=await compilePlan(_0x90ea51,_0x3473f0),_0x49ed2e=Date[_0x520c9b(0x139)](),_0x7f7f63=await executePlan(_0x8aa14e,_0x90ea51,_0x3473f0),_0x64a637=Date[_0x520c9b(0x139)]()-_0x49ed2e;return{'ok':!![],'data':{'service':_0x2f94fe['service'],'command':_0x90ea51['cliPath'],'target':targetPreview(_0x8aa14e),'result':_0x7f7f63,'elapsed':_0x64a637},'message':_0x520c9b(0x16f)+_0x90ea51[_0x520c9b(0x163)]+_0x520c9b(0x181)+_0x64a637+'ms'};}};}function dynamicCommandName(_0x3cca56){const _0x3ef498=a32_0x44b2;return _0x3cca56[_0x3ef498(0x172)][_0x3ef498(0x173)](0x1)[_0x3ef498(0x155)]('\x20');}function riskTag(_0x345288){const _0x4019ba=a32_0x44b2;return _0x345288===_0x4019ba(0x131)?'':_0x4019ba(0x159)+_0x345288+']';}function flagToCommandFlag(_0x3c22d3){const _0x5877b8=a32_0x44b2;return{'name':_0x3c22d3[_0x5877b8(0x13a)],'type':_0x3c22d3[_0x5877b8(0x128)]==='json'?_0x5877b8(0x122):_0x3c22d3[_0x5877b8(0x128)],'description':_0x3c22d3[_0x5877b8(0x183)]||_0x3c22d3[_0x5877b8(0x168)],'required':_0x3c22d3[_0x5877b8(0x164)],'default':isPrimitiveFlagDefault(_0x3c22d3[_0x5877b8(0x147)])?_0x3c22d3[_0x5877b8(0x147)]:undefined,'enum':_0x3c22d3[_0x5877b8(0x17b)]};}async function compilePlan(_0xc65808,_0x27c8c0){const _0x200b33=a32_0x44b2;return compileServiceTreeCommand(_0xc65808,{'flags':_0x27c8c0['rawFlags'],'args':_0x27c8c0[_0x200b33(0x138)],'context':await buildServiceContext(_0xc65808,_0x27c8c0)});}async function buildServiceContext(_0x3a97e2,_0x311fe4){const _0x326fea=a32_0x44b2,_0x1f4241={'appCode':_0x311fe4[_0x326fea(0x16c)],'env':_0x311fe4['envName'],'envName':_0x311fe4['envName']};if(!usesRuntimeContext(_0x3a97e2))return _0x1f4241;const _0x3a7e96=await getLoginUserInfo(),_0x31a61f=pickFirst(_0x3a7e96[_0x326fea(0x17f)],_0x3a7e96['id']);return{..._0x1f4241,'user':_0x3a7e96,'userId':_0x31a61f,'id':_0x3a7e96['id'],'username':pickFirst(_0x3a7e96['username'],_0x3a7e96[_0x326fea(0x16b)],_0x3a7e96[_0x326fea(0x171)]),'userName':_0x3a7e96['userName'],'nickname':pickFirst(_0x3a7e96[_0x326fea(0x14d)],_0x3a7e96[_0x326fea(0x157)]),'nickName':_0x3a7e96[_0x326fea(0x157)],'tenantCode':_0x3a7e96['tenantCode'],'employeeId':_0x3a7e96[_0x326fea(0x14b)]};}function usesRuntimeContext(_0x4c7bd3){const _0x5a738a=a32_0x44b2;return _0x4c7bd3[_0x5a738a(0x150)]['some'](_0x199252=>typeof _0x199252[_0x5a738a(0x12f)]==='string'&&(_0x199252[_0x5a738a(0x12f)]['startsWith'](_0x5a738a(0x145))||_0x199252[_0x5a738a(0x12f)][_0x5a738a(0x16a)](_0x5a738a(0x149))));}function a32_0x44b2(_0x237d9e,_0x430bbb){_0x237d9e=_0x237d9e-0x121;const _0xccc152=a32_0xccc1();let _0x44b297=_0xccc152[_0x237d9e];return _0x44b297;}function pickFirst(..._0x16623c){const _0x1dc9bf=a32_0x44b2;return _0x16623c[_0x1dc9bf(0x14c)](_0xa9ce5a=>_0xa9ce5a!==undefined&&_0xa9ce5a!==null);}async function executePlan(_0x3d5abf,_0x551959,_0x4c2c8b){const _0xa5847a=a32_0x44b2;if(_0x3d5abf[_0xa5847a(0x161)]===_0xa5847a(0x129)){const _0xc9703f=await resolveDatasetCode(_0x3d5abf,_0x551959,_0x4c2c8b);return executeData(_0xc9703f,_0x3d5abf[_0xa5847a(0x165)],_0x3d5abf[_0xa5847a(0x16d)]);}if(_0x3d5abf[_0xa5847a(0x161)]===_0xa5847a(0x15e)){if(!_0x3d5abf['sqlCode'])throw CliErrors[_0xa5847a(0x12a)](_0xa5847a(0x16f)+_0x551959[_0xa5847a(0x163)]+_0xa5847a(0x130));return executeSdkSql(_0x3d5abf[_0xa5847a(0x177)],normalizeScalarParams(_0x3d5abf[_0xa5847a(0x16d)]));}if(_0x3d5abf[_0xa5847a(0x161)]==='bff'){const _0x50f77f=_0x3d5abf['scriptName']||_0x3d5abf['bffCode']||(_0x3d5abf[_0xa5847a(0x126)]==null?'':String(_0x3d5abf[_0xa5847a(0x126)]));if(!_0x50f77f)throw CliErrors[_0xa5847a(0x12a)](_0xa5847a(0x16f)+_0x551959[_0xa5847a(0x163)]+_0xa5847a(0x15b));return executeSdkBff(_0x50f77f,_0x3d5abf[_0xa5847a(0x16d)]);}throw CliErrors[_0xa5847a(0x12a)](_0xa5847a(0x13b)+_0x3d5abf[_0xa5847a(0x161)]);}async function resolveDatasetCode(_0xcdda93,_0x4dd73b,_0x13a82e){const _0x5d9b50=a32_0x44b2;if(_0xcdda93[_0x5d9b50(0x180)])return _0xcdda93[_0x5d9b50(0x180)];if(!_0xcdda93[_0x5d9b50(0x134)])throw CliErrors['validation'](_0x5d9b50(0x16f)+_0x4dd73b[_0x5d9b50(0x163)]+_0x5d9b50(0x146));const _0x5631bd=await listDatasets(_0x13a82e[_0x5d9b50(0x16c)]),_0x1ac98e=_0x5631bd[_0x5d9b50(0x14c)](_0x1c874c=>_0x1c874c[_0x5d9b50(0x166)]?.[_0x5d9b50(0x14a)]===_0xcdda93['datatable']);if(!_0x1ac98e?.[_0x5d9b50(0x127)])throw CliErrors[_0x5d9b50(0x12a)](_0x5d9b50(0x17d)+_0xcdda93['datatable']+_0x5d9b50(0x153)+_0x13a82e['appCode']+'.',_0x5d9b50(0x133));return _0x1ac98e[_0x5d9b50(0x127)];}function applyAppBinding(_0x271f3f,_0x2c2938,_0x371b4c){const _0x136dc1=a32_0x44b2,_0x495a7e=_0x2c2938['target'][_0x136dc1(0x12d)];if(!_0x495a7e)return;const _0x1778ef=_0x271f3f[_0x136dc1(0x189)][_0x495a7e];if(!_0x1778ef)throw CliErrors[_0x136dc1(0x12a)](_0x136dc1(0x14f)+_0x495a7e+_0x136dc1(0x156)+_0x2c2938[_0x136dc1(0x163)]+'.',_0x136dc1(0x17a));const _0x184f49=_0x1778ef[_0x136dc1(0x13e)]||_0x1778ef[_0x136dc1(0x16c)];_0x184f49&&!hasText(_0x371b4c['appcode'])&&(_0x371b4c[_0x136dc1(0x13e)]=_0x184f49),_0x1778ef['app']&&!hasText(_0x371b4c[_0x136dc1(0x188)])&&!hasText(_0x371b4c[_0x136dc1(0x13e)])&&(_0x371b4c[_0x136dc1(0x188)]=_0x1778ef['app']),_0x1778ef['env']&&!hasText(_0x371b4c[_0x136dc1(0x179)])&&(_0x371b4c['env']=_0x1778ef[_0x136dc1(0x179)]);}function renderDynamicCommandHelp(_0x3e315b){const _0x3eca15=a32_0x44b2,_0x4a15b7=['\x20\x20SERVICE\x20TREE\x20TARGET',_0x3eca15(0x135)+_0x3e315b[_0x3eca15(0x144)][_0x3eca15(0x161)],_0x3eca15(0x125)+_0x3e315b[_0x3eca15(0x144)][_0x3eca15(0x165)]];if(_0x3e315b[_0x3eca15(0x144)][_0x3eca15(0x180)])_0x4a15b7[_0x3eca15(0x151)](_0x3eca15(0x140)+_0x3e315b[_0x3eca15(0x144)]['datasetCode']);if(_0x3e315b[_0x3eca15(0x144)][_0x3eca15(0x134)])_0x4a15b7['push'](_0x3eca15(0x15c)+_0x3e315b['target'][_0x3eca15(0x134)]);if(_0x3e315b[_0x3eca15(0x144)]['sqlCode'])_0x4a15b7['push'](_0x3eca15(0x16e)+_0x3e315b[_0x3eca15(0x144)][_0x3eca15(0x177)]);if(_0x3e315b[_0x3eca15(0x144)][_0x3eca15(0x142)])_0x4a15b7[_0x3eca15(0x151)]('\x20\x20\x20\x20scriptName:\x20'+_0x3e315b[_0x3eca15(0x144)][_0x3eca15(0x142)]);if(_0x3e315b[_0x3eca15(0x150)][_0x3eca15(0x185)]>0x0){_0x4a15b7[_0x3eca15(0x151)]('',_0x3eca15(0x15f));for(const _0x1bae74 of _0x3e315b[_0x3eca15(0x150)]){_0x4a15b7[_0x3eca15(0x151)]('\x20\x20\x20\x20'+(_0x1bae74[_0x3eca15(0x12f)]||'const')+_0x3eca15(0x137)+_0x1bae74[_0x3eca15(0x144)]+(_0x1bae74[_0x3eca15(0x174)]?'.'+_0x1bae74['operator']:''));}}return _0x4a15b7[_0x3eca15(0x155)]('\x0a');}function targetPreview(_0x46bc96){const _0x1d5730=a32_0x44b2;return{'kind':_0x46bc96[_0x1d5730(0x161)],'command':_0x46bc96['command'],'appRef':_0x46bc96[_0x1d5730(0x12d)],'datasetCode':_0x46bc96[_0x1d5730(0x180)],'datatable':_0x46bc96[_0x1d5730(0x134)],'sqlCode':_0x46bc96[_0x1d5730(0x177)],'bffCode':_0x46bc96[_0x1d5730(0x160)],'bffId':_0x46bc96['bffId'],'scriptName':_0x46bc96[_0x1d5730(0x142)]};}function normalizeScalarParams(_0x47e997){const _0x37b7cf=a32_0x44b2;return Object[_0x37b7cf(0x187)](Object[_0x37b7cf(0x13c)](_0x47e997)[_0x37b7cf(0x12b)](([,_0x46ecbf])=>typeof _0x46ecbf===_0x37b7cf(0x122)||typeof _0x46ecbf==='number'));}function hasText(_0x4252f7){const _0x12dcbf=a32_0x44b2;return typeof _0x4252f7==='string'&&_0x4252f7[_0x12dcbf(0x17c)]()[_0x12dcbf(0x185)]>0x0;}function isPrimitiveFlagDefault(_0x4d7b0b){const _0x181ab7=a32_0x44b2;return _0x4d7b0b===undefined||typeof _0x4d7b0b===_0x181ab7(0x122)||typeof _0x4d7b0b==='number'||typeof _0x4d7b0b===_0x181ab7(0x186);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x365f49=a33_0x2b49;(function(_0x48441a,_0x3340bb){const _0xd77712=a33_0x2b49,_0x113255=_0x48441a();while(!![]){try{const _0x4ac3df=-parseInt(_0xd77712(0x84))/0x1+-parseInt(_0xd77712(0x8b))/0x2*(parseInt(_0xd77712(0xad))/0x3)+-parseInt(_0xd77712(0xaa))/0x4*(-parseInt(_0xd77712(0x82))/0x5)+parseInt(_0xd77712(0x80))/0x6*(parseInt(_0xd77712(0x7b))/0x7)+-parseInt(_0xd77712(0x90))/0x8*(-parseInt(_0xd77712(0xb1))/0x9)+-parseInt(_0xd77712(0x9d))/0xa*(parseInt(_0xd77712(0x9f))/0xb)+-parseInt(_0xd77712(0x71))/0xc*(parseInt(_0xd77712(0xab))/0xd);if(_0x4ac3df===_0x3340bb)break;else _0x113255['push'](_0x113255['shift']());}catch(_0x1e7fc5){_0x113255['push'](_0x113255['shift']());}}}(a33_0x4abf,0x27ca4));function a33_0x2b49(_0x198a23,_0x316b7a){_0x198a23=_0x198a23-0x6e;const _0x4abf0e=a33_0x4abf();let _0x2b49bf=_0x4abf0e[_0x198a23];return _0x2b49bf;}function a33_0x4abf(){const _0x1154e1=['risk','239617XFuJUr','Service\x20manifest\x20validation\x20passed.','export','Imported\x20','import','6frvsdT','list','1096730vvvQLn','manifest','156341SQPRVw','Preview\x20Service\x20Tree\x20import\x20into\x20~/.lovrabet/service.json','file','write','Service\x20Tree\x20manifest\x20file\x20path','remove','Show\x20a\x20locally\x20imported\x20Service\x20Tree\x20manifest','143084tUzAEg','\x20service\x20','Remove\x20a\x20local\x20Service\x20Tree\x20manifest\x20from\x20the\x20runtime\x20registry','kind','serviceCode','399272WqdmHu','registryPath','type','Updated','Removed\x20service\x20','manifests','Local\x20service\x20not\x20found:\x20','Exported\x20service\x20','commands','read','description','hash','entry','17360QKqmVf','normalizedManifest','44OXwImD','report','Import\x20a\x20Service\x20Tree\x20manifest\x20into\x20the\x20local\x20runtime\x20registry','Service\x20registry\x20validation\x20passed.','flags','entries','map','Local\x20service\x20code,\x20for\x20example\x20crm','warnings','errors','reduce','4NVltuY','360139qQoMme','updated','3zLxlVI','length','\x20service(s),\x20updated\x20','cliPath','36NppTYx','registryServiceCode','Export\x20a\x20local\x20Service\x20Tree\x20manifest\x20to\x20a\x20JSON\x20file','filePath','List\x20locally\x20imported\x20Service\x20Tree\x20manifests','cliName','str','version','service','detail','serviceCount','24FXaJwR','string','source','name','replaced','target','WRITE','imported','validate'];a33_0x4abf=function(){return _0x1154e1;};return a33_0x4abf();}import{exportServiceManifest,formatValidationFailure,getLocalServiceEntry,getServiceRegistryPath,importServiceManifest,listLocalServices,loadServiceManifestFromFile,removeServiceManifest}from'../../commands/service/registry.js';const FILE_FLAG={'name':a33_0x365f49(0x86),'type':a33_0x365f49(0x72),'required':!![],'description':a33_0x365f49(0x88)},SERVICE_FLAG={'name':a33_0x365f49(0x6e),'type':a33_0x365f49(0x72),'required':!![],'description':a33_0x365f49(0xa6),'pattern':{'regex':/^[a-z][a-z0-9-]*$/,'description':'lower\x20kebab-case\x20service\x20code'}};function summarizeService(_0x53e0ba){const _0x410b3f=a33_0x365f49;return{'serviceCode':_0x53e0ba[_0x410b3f(0x8f)],'name':_0x53e0ba[_0x410b3f(0x9e)][_0x410b3f(0x6e)][_0x410b3f(0x74)],'version':_0x53e0ba[_0x410b3f(0xb8)],'importedAt':_0x53e0ba['importedAt'],'source':_0x53e0ba[_0x410b3f(0x73)],'commandCount':_0x53e0ba[_0x410b3f(0x9e)]['commands'][_0x410b3f(0xae)],'commands':_0x53e0ba[_0x410b3f(0x9e)][_0x410b3f(0x98)]['map'](_0x31e59e=>({'path':_0x31e59e[_0x410b3f(0xb0)],'description':_0x31e59e[_0x410b3f(0x9a)],'risk':_0x31e59e[_0x410b3f(0x7a)],'target':_0x31e59e[_0x410b3f(0x76)],'flags':_0x31e59e[_0x410b3f(0xa3)][_0x410b3f(0xa5)](_0x1101a6=>({'name':_0x1101a6[_0x410b3f(0x74)],'cliName':_0x1101a6[_0x410b3f(0xb6)],'type':_0x1101a6[_0x410b3f(0x92)],'required':_0x1101a6['required']===!![]}))}))};}function summarizeLoadedManifest(_0x58273e){const _0x3001fd=a33_0x365f49;return{'service':_0x58273e[_0x3001fd(0x9e)]?.[_0x3001fd(0x6e)],'version':_0x58273e['normalizedManifest']?.[_0x3001fd(0xb8)],'commandCount':_0x58273e[_0x3001fd(0x9e)]?.['commands'][_0x3001fd(0xae)]??0x0,'commands':_0x58273e[_0x3001fd(0x9e)]?.[_0x3001fd(0x98)][_0x3001fd(0xa5)](_0x301cb9=>({'path':_0x301cb9[_0x3001fd(0xb0)],'risk':_0x301cb9['risk'],'target':_0x301cb9[_0x3001fd(0x76)]}))??[],'registryIndex':_0x58273e['registryIndex'],'registryServiceCode':_0x58273e[_0x3001fd(0xb2)],'errors':_0x58273e['report'][_0x3001fd(0xa8)],'warnings':_0x58273e['report'][_0x3001fd(0xa7)]};}export const serviceDefinitions=[{'service':a33_0x365f49(0x6e),'command':a33_0x365f49(0x79),'description':'Validate\x20a\x20Service\x20Tree\x20JSON\x20manifest','risk':a33_0x365f49(0x99),'requiresAuth':![],'requiresAppCode':![],'flags':[FILE_FLAG],async 'execute'(_0x134c6b){const _0x11c86c=a33_0x365f49,_0xcb2290=loadServiceManifestFromFile(_0x134c6b['str']('file'));if(!_0xcb2290[_0x11c86c(0xa0)]['ok'])return{'ok':![],'data':{'file':_0xcb2290[_0x11c86c(0xb4)],'hash':_0xcb2290['hash'],'kind':_0xcb2290[_0x11c86c(0x8e)],'serviceCount':_0xcb2290[_0x11c86c(0x95)][_0x11c86c(0xae)],'services':_0xcb2290[_0x11c86c(0x95)]['map'](summarizeLoadedManifest),'errors':_0xcb2290[_0x11c86c(0xa0)][_0x11c86c(0xa8)],'warnings':_0xcb2290[_0x11c86c(0xa0)]['warnings']},'message':formatValidationFailure(_0xcb2290[_0x11c86c(0xa0)])};if(_0xcb2290['kind']==='registry'||_0xcb2290['manifests'][_0x11c86c(0xae)]!==0x1)return{'ok':!![],'data':{'file':_0xcb2290[_0x11c86c(0xb4)],'hash':_0xcb2290['hash'],'kind':_0xcb2290[_0x11c86c(0x8e)],'serviceCount':_0xcb2290[_0x11c86c(0x95)][_0x11c86c(0xae)],'commandCount':_0xcb2290[_0x11c86c(0x95)][_0x11c86c(0xa9)]((_0x18e43a,_0xaf9ecf)=>_0x18e43a+(_0xaf9ecf[_0x11c86c(0x9e)]?.[_0x11c86c(0x98)]['length']??0x0),0x0),'services':_0xcb2290[_0x11c86c(0x95)][_0x11c86c(0xa5)](summarizeLoadedManifest),'warnings':_0xcb2290[_0x11c86c(0xa0)][_0x11c86c(0xa7)]},'message':_0x11c86c(0xa2)};return{'ok':!![],'data':{'file':_0xcb2290[_0x11c86c(0xb4)],'hash':_0xcb2290[_0x11c86c(0x9b)],'kind':_0xcb2290[_0x11c86c(0x8e)],'service':_0xcb2290[_0x11c86c(0x9e)]?.[_0x11c86c(0x6e)],'version':_0xcb2290['normalizedManifest']?.[_0x11c86c(0xb8)],'commandCount':_0xcb2290[_0x11c86c(0x9e)]?.[_0x11c86c(0x98)]['length']??0x0,'commands':_0xcb2290[_0x11c86c(0x9e)]?.[_0x11c86c(0x98)][_0x11c86c(0xa5)](_0x10d9cd=>({'path':_0x10d9cd[_0x11c86c(0xb0)],'risk':_0x10d9cd[_0x11c86c(0x7a)],'target':_0x10d9cd[_0x11c86c(0x76)]})),'warnings':_0xcb2290[_0x11c86c(0xa0)]['warnings']},'message':_0x11c86c(0x7c)};}},{'service':'service','command':a33_0x365f49(0x7f),'description':a33_0x365f49(0xa1),'risk':a33_0x365f49(0x87),'requiresAuth':![],'requiresAppCode':![],'flags':[FILE_FLAG],async 'dryRun'(_0x25bcbe){const _0x5d39bc=a33_0x365f49,_0x254a1a=loadServiceManifestFromFile(_0x25bcbe[_0x5d39bc(0xb7)](_0x5d39bc(0x86)));return{'method':'WRITE','url':getServiceRegistryPath(),'body':{'file':_0x254a1a[_0x5d39bc(0xb4)],'hash':_0x254a1a[_0x5d39bc(0x9b)],'kind':_0x254a1a[_0x5d39bc(0x8e)],'ok':_0x254a1a['report']['ok'],'service':_0x254a1a[_0x5d39bc(0x9e)]?.[_0x5d39bc(0x6e)],'version':_0x254a1a[_0x5d39bc(0x9e)]?.['version'],'serviceCount':_0x254a1a[_0x5d39bc(0x95)][_0x5d39bc(0xae)],'services':_0x254a1a['manifests'][_0x5d39bc(0xa5)](_0x18afe2=>({'service':_0x18afe2[_0x5d39bc(0x9e)]?.[_0x5d39bc(0x6e)],'version':_0x18afe2[_0x5d39bc(0x9e)]?.[_0x5d39bc(0xb8)],'commandCount':_0x18afe2[_0x5d39bc(0x9e)]?.['commands']['length']??0x0,'errors':_0x18afe2[_0x5d39bc(0xa0)]['errors']})),'errors':_0x254a1a['report'][_0x5d39bc(0xa8)],'commandCount':_0x254a1a['normalizedManifest']?.[_0x5d39bc(0x98)][_0x5d39bc(0xae)]??0x0},'description':_0x5d39bc(0x85)};},async 'execute'(_0x13db74){const _0x44735c=a33_0x365f49,_0x3ab4c1=importServiceManifest(_0x13db74[_0x44735c(0xb7)](_0x44735c(0x86)));if(_0x3ab4c1['entries'][_0x44735c(0xae)]!==0x1)return{'ok':!![],'data':{'registryPath':_0x3ab4c1['registryPath'],'imported':_0x3ab4c1['imported'],'updated':_0x3ab4c1['updated'],'serviceCount':_0x3ab4c1[_0x44735c(0x70)],'services':_0x3ab4c1[_0x44735c(0xa4)][_0x44735c(0xa5)](summarizeService)},'message':_0x44735c(0x7e)+_0x3ab4c1[_0x44735c(0x78)]+_0x44735c(0xaf)+_0x3ab4c1[_0x44735c(0xac)]+'\x20service(s).'};return{'ok':!![],'data':{'registryPath':_0x3ab4c1['registryPath'],'replaced':_0x3ab4c1['replaced'],'imported':_0x3ab4c1['imported'],'updated':_0x3ab4c1['updated'],'serviceCount':_0x3ab4c1[_0x44735c(0x70)],'service':summarizeService(_0x3ab4c1[_0x44735c(0x9c)])},'message':(_0x3ab4c1[_0x44735c(0x75)]?_0x44735c(0x93):'Imported')+_0x44735c(0x8c)+_0x3ab4c1['entry'][_0x44735c(0x8f)]+'.'};}},{'service':a33_0x365f49(0x6e),'command':a33_0x365f49(0x7d),'description':a33_0x365f49(0xb3),'risk':a33_0x365f49(0x87),'requiresAuth':![],'requiresAppCode':![],'flags':[SERVICE_FLAG,FILE_FLAG],async 'dryRun'(_0x4d479a){const _0x57a5ab=a33_0x365f49,_0x54058e=getLocalServiceEntry(_0x4d479a[_0x57a5ab(0xb7)](_0x57a5ab(0x6e)));return{'method':_0x57a5ab(0x77),'url':_0x4d479a['str'](_0x57a5ab(0x86)),'body':{'service':_0x4d479a[_0x57a5ab(0xb7)](_0x57a5ab(0x6e)),'found':Boolean(_0x54058e),'version':_0x54058e?.[_0x57a5ab(0xb8)],'source':_0x54058e?.['source']},'description':'Preview\x20Service\x20Tree\x20export\x20from\x20~/.lovrabet/service.json'};},async 'execute'(_0x49bedc){const _0x4a8547=a33_0x365f49,_0x4dc57b=exportServiceManifest(_0x49bedc[_0x4a8547(0xb7)](_0x4a8547(0x6e)),_0x49bedc[_0x4a8547(0xb7)](_0x4a8547(0x86)));return{'ok':!![],'data':{'registryPath':_0x4dc57b[_0x4a8547(0x91)],'file':_0x4dc57b[_0x4a8547(0xb4)],'service':summarizeService(_0x4dc57b['entry'])},'message':_0x4a8547(0x97)+_0x4dc57b[_0x4a8547(0x9c)][_0x4a8547(0x8f)]+'.'};}},{'service':'service','command':a33_0x365f49(0x81),'description':a33_0x365f49(0xb5),'risk':'read','requiresAuth':![],'requiresAppCode':![],'flags':[],async 'execute'(){const _0x492316=a33_0x365f49,_0x49df9a=listLocalServices();return{'ok':!![],'data':{'registryPath':getServiceRegistryPath(),'total':_0x49df9a['length'],'services':_0x49df9a[_0x492316(0xa5)](summarizeService)}};}},{'service':a33_0x365f49(0x6e),'command':a33_0x365f49(0x89),'description':a33_0x365f49(0x8d),'risk':a33_0x365f49(0x87),'requiresAuth':![],'requiresAppCode':![],'flags':[SERVICE_FLAG],async 'dryRun'(_0xae6247){const _0x2f0854=a33_0x365f49,_0x3cb2a0=getLocalServiceEntry(_0xae6247['str'](_0x2f0854(0x6e)));return{'method':_0x2f0854(0x77),'url':getServiceRegistryPath(),'body':{'service':_0xae6247[_0x2f0854(0xb7)](_0x2f0854(0x6e)),'found':Boolean(_0x3cb2a0),'version':_0x3cb2a0?.[_0x2f0854(0xb8)],'source':_0x3cb2a0?.[_0x2f0854(0x73)]},'description':'Preview\x20Service\x20Tree\x20removal\x20from\x20~/.lovrabet/service.json'};},async 'execute'(_0x185432){const _0x4d3dca=a33_0x365f49,_0x46d366=removeServiceManifest(_0x185432[_0x4d3dca(0xb7)]('service'));return{'ok':!![],'data':{'registryPath':_0x46d366[_0x4d3dca(0x91)],'serviceCount':_0x46d366[_0x4d3dca(0x70)],'service':summarizeService(_0x46d366[_0x4d3dca(0x9c)])},'message':_0x4d3dca(0x94)+_0x46d366[_0x4d3dca(0x9c)][_0x4d3dca(0x8f)]+'.'};}},{'service':a33_0x365f49(0x6e),'command':a33_0x365f49(0x6f),'description':a33_0x365f49(0x8a),'risk':a33_0x365f49(0x99),'requiresAuth':![],'requiresAppCode':![],'flags':[SERVICE_FLAG],async 'execute'(_0x3c8c36){const _0x58608=a33_0x365f49,_0x5e522c=getLocalServiceEntry(_0x3c8c36[_0x58608(0xb7)](_0x58608(0x6e)));if(!_0x5e522c)return{'ok':![],'data':{'registryPath':getServiceRegistryPath(),'service':_0x3c8c36[_0x58608(0xb7)](_0x58608(0x6e))},'message':_0x58608(0x96)+_0x3c8c36['str'](_0x58608(0x6e))};return{'ok':!![],'data':{'registryPath':getServiceRegistryPath(),'service':summarizeService(_0x5e522c),'manifest':_0x5e522c[_0x58608(0x83)],'normalizedManifest':_0x5e522c[_0x58608(0x9e)]}};}}];
|
|
1
|
+
const a33_0x28f41c=a33_0x589c;function a33_0x589c(_0x15efc7,_0x5302ce){_0x15efc7=_0x15efc7-0x142;const _0x20c81e=a33_0x20c8();let _0x589ca6=_0x20c81e[_0x15efc7];return _0x589ca6;}(function(_0x4a1345,_0x166178){const _0x1e1ed9=a33_0x589c,_0x589855=_0x4a1345();while(!![]){try{const _0x38209f=parseInt(_0x1e1ed9(0x17e))/0x1+-parseInt(_0x1e1ed9(0x14f))/0x2+-parseInt(_0x1e1ed9(0x159))/0x3*(parseInt(_0x1e1ed9(0x14b))/0x4)+-parseInt(_0x1e1ed9(0x15d))/0x5+-parseInt(_0x1e1ed9(0x17f))/0x6*(parseInt(_0x1e1ed9(0x181))/0x7)+parseInt(_0x1e1ed9(0x162))/0x8+parseInt(_0x1e1ed9(0x161))/0x9;if(_0x38209f===_0x166178)break;else _0x589855['push'](_0x589855['shift']());}catch(_0x2fd3df){_0x589855['push'](_0x589855['shift']());}}}(a33_0x20c8,0x2c479));import{exportServiceManifest,formatValidationFailure,getLocalServiceEntry,getServiceRegistryPath,importServiceManifest,listLocalServices,loadServiceManifestFromFile,removeServiceManifest}from'../../commands/service/registry.js';function a33_0x20c8(){const _0x288c3a=['export','lower\x20kebab-case\x20service\x20code','Updated','373192aBXhWu','Imported','normalizedManifest','list','160102kvIeXY','registryServiceCode','entries','registry','map','read','Preview\x20Service\x20Tree\x20removal\x20from\x20~/.lovrabet/service.json','Service\x20manifest\x20validation\x20passed.','List\x20locally\x20imported\x20Service\x20Tree\x20manifests','entry','3jYEqnJ','flags','Imported\x20','target','975905mWrjZw','service','Preview\x20Service\x20Tree\x20export\x20from\x20~/.lovrabet/service.json','registryPath','3250233cBeVkv','2195224VhCkPv','filePath','Removed\x20service\x20','remove','kind','registryIndex','length','type','Local\x20service\x20not\x20found:\x20','serviceCode','Show\x20a\x20locally\x20imported\x20Service\x20Tree\x20manifest','commands','write','import','serviceCount','Service\x20Tree\x20manifest\x20file\x20path','name','warnings','\x20service\x20','str','cliPath','source','\x20service(s),\x20updated\x20','Exported\x20service\x20','Preview\x20Service\x20Tree\x20import\x20into\x20~/.lovrabet/service.json','validate','report','updated','18546ihxWRm','18pqnPbE','file','243103xDdjRg','Validate\x20a\x20Service\x20Tree\x20JSON\x20manifest','manifests','risk','string','version','errors','required','reduce','replaced','imported','WRITE','hash'];a33_0x20c8=function(){return _0x288c3a;};return a33_0x20c8();}const FILE_FLAG={'name':a33_0x28f41c(0x180),'type':a33_0x28f41c(0x185),'required':!![],'description':a33_0x28f41c(0x171)},SERVICE_FLAG={'name':'service','type':'string','required':!![],'description':'Local\x20service\x20code,\x20for\x20example\x20crm','pattern':{'regex':/^[a-z][a-z0-9-]*$/,'description':a33_0x28f41c(0x149)}};function summarizeService(_0x6eed65){const _0xdfe8ce=a33_0x28f41c;return{'serviceCode':_0x6eed65[_0xdfe8ce(0x16b)],'name':_0x6eed65['normalizedManifest'][_0xdfe8ce(0x15e)][_0xdfe8ce(0x172)],'version':_0x6eed65[_0xdfe8ce(0x186)],'importedAt':_0x6eed65['importedAt'],'source':_0x6eed65[_0xdfe8ce(0x177)],'commandCount':_0x6eed65[_0xdfe8ce(0x14d)][_0xdfe8ce(0x16d)][_0xdfe8ce(0x168)],'commands':_0x6eed65[_0xdfe8ce(0x14d)][_0xdfe8ce(0x16d)][_0xdfe8ce(0x153)](_0x41fca0=>({'path':_0x41fca0[_0xdfe8ce(0x176)],'description':_0x41fca0['description'],'risk':_0x41fca0['risk'],'target':_0x41fca0[_0xdfe8ce(0x15c)],'flags':_0x41fca0[_0xdfe8ce(0x15a)][_0xdfe8ce(0x153)](_0x237182=>({'name':_0x237182['name'],'cliName':_0x237182['cliName'],'type':_0x237182[_0xdfe8ce(0x169)],'required':_0x237182[_0xdfe8ce(0x142)]===!![]}))}))};}function summarizeLoadedManifest(_0x113f36){const _0x5510f5=a33_0x28f41c;return{'service':_0x113f36[_0x5510f5(0x14d)]?.[_0x5510f5(0x15e)],'version':_0x113f36['normalizedManifest']?.[_0x5510f5(0x186)],'commandCount':_0x113f36['normalizedManifest']?.['commands'][_0x5510f5(0x168)]??0x0,'commands':_0x113f36[_0x5510f5(0x14d)]?.[_0x5510f5(0x16d)]['map'](_0x37bb42=>({'path':_0x37bb42[_0x5510f5(0x176)],'risk':_0x37bb42[_0x5510f5(0x184)],'target':_0x37bb42['target']}))??[],'registryIndex':_0x113f36[_0x5510f5(0x167)],'registryServiceCode':_0x113f36[_0x5510f5(0x150)],'errors':_0x113f36[_0x5510f5(0x17c)][_0x5510f5(0x187)],'warnings':_0x113f36['report'][_0x5510f5(0x173)]};}export const serviceDefinitions=[{'service':'service','command':a33_0x28f41c(0x17b),'description':a33_0x28f41c(0x182),'risk':a33_0x28f41c(0x154),'requiresAuth':![],'requiresAppCode':![],'flags':[FILE_FLAG],async 'execute'(_0x1a208c){const _0x14e539=a33_0x28f41c,_0x251b71=loadServiceManifestFromFile(_0x1a208c[_0x14e539(0x175)](_0x14e539(0x180)));if(!_0x251b71['report']['ok'])return{'ok':![],'data':{'file':_0x251b71[_0x14e539(0x163)],'hash':_0x251b71[_0x14e539(0x147)],'kind':_0x251b71[_0x14e539(0x166)],'serviceCount':_0x251b71[_0x14e539(0x183)][_0x14e539(0x168)],'services':_0x251b71[_0x14e539(0x183)][_0x14e539(0x153)](summarizeLoadedManifest),'errors':_0x251b71[_0x14e539(0x17c)][_0x14e539(0x187)],'warnings':_0x251b71['report'][_0x14e539(0x173)]},'message':formatValidationFailure(_0x251b71[_0x14e539(0x17c)])};if(_0x251b71[_0x14e539(0x166)]===_0x14e539(0x152)||_0x251b71[_0x14e539(0x183)]['length']!==0x1)return{'ok':!![],'data':{'file':_0x251b71[_0x14e539(0x163)],'hash':_0x251b71[_0x14e539(0x147)],'kind':_0x251b71[_0x14e539(0x166)],'serviceCount':_0x251b71[_0x14e539(0x183)][_0x14e539(0x168)],'commandCount':_0x251b71['manifests'][_0x14e539(0x143)]((_0x4dfd67,_0x3f9c76)=>_0x4dfd67+(_0x3f9c76[_0x14e539(0x14d)]?.[_0x14e539(0x16d)][_0x14e539(0x168)]??0x0),0x0),'services':_0x251b71[_0x14e539(0x183)][_0x14e539(0x153)](summarizeLoadedManifest),'warnings':_0x251b71[_0x14e539(0x17c)]['warnings']},'message':'Service\x20registry\x20validation\x20passed.'};return{'ok':!![],'data':{'file':_0x251b71[_0x14e539(0x163)],'hash':_0x251b71[_0x14e539(0x147)],'kind':_0x251b71[_0x14e539(0x166)],'service':_0x251b71[_0x14e539(0x14d)]?.['service'],'version':_0x251b71['normalizedManifest']?.[_0x14e539(0x186)],'commandCount':_0x251b71[_0x14e539(0x14d)]?.[_0x14e539(0x16d)][_0x14e539(0x168)]??0x0,'commands':_0x251b71[_0x14e539(0x14d)]?.[_0x14e539(0x16d)][_0x14e539(0x153)](_0x245969=>({'path':_0x245969[_0x14e539(0x176)],'risk':_0x245969[_0x14e539(0x184)],'target':_0x245969[_0x14e539(0x15c)]})),'warnings':_0x251b71[_0x14e539(0x17c)][_0x14e539(0x173)]},'message':_0x14e539(0x156)};}},{'service':a33_0x28f41c(0x15e),'command':a33_0x28f41c(0x16f),'description':'Import\x20a\x20Service\x20Tree\x20manifest\x20into\x20the\x20local\x20runtime\x20registry','risk':a33_0x28f41c(0x16e),'requiresAuth':![],'requiresAppCode':![],'flags':[FILE_FLAG],async 'dryRun'(_0x48dfbb){const _0x2aacfb=a33_0x28f41c,_0x53e9a7=loadServiceManifestFromFile(_0x48dfbb['str'](_0x2aacfb(0x180)));return{'method':'WRITE','url':getServiceRegistryPath(),'body':{'file':_0x53e9a7[_0x2aacfb(0x163)],'hash':_0x53e9a7['hash'],'kind':_0x53e9a7['kind'],'ok':_0x53e9a7[_0x2aacfb(0x17c)]['ok'],'service':_0x53e9a7[_0x2aacfb(0x14d)]?.[_0x2aacfb(0x15e)],'version':_0x53e9a7[_0x2aacfb(0x14d)]?.[_0x2aacfb(0x186)],'serviceCount':_0x53e9a7[_0x2aacfb(0x183)][_0x2aacfb(0x168)],'services':_0x53e9a7[_0x2aacfb(0x183)][_0x2aacfb(0x153)](_0x49fd30=>({'service':_0x49fd30[_0x2aacfb(0x14d)]?.[_0x2aacfb(0x15e)],'version':_0x49fd30[_0x2aacfb(0x14d)]?.['version'],'commandCount':_0x49fd30['normalizedManifest']?.[_0x2aacfb(0x16d)]['length']??0x0,'errors':_0x49fd30[_0x2aacfb(0x17c)][_0x2aacfb(0x187)]})),'errors':_0x53e9a7[_0x2aacfb(0x17c)][_0x2aacfb(0x187)],'commandCount':_0x53e9a7['normalizedManifest']?.[_0x2aacfb(0x16d)][_0x2aacfb(0x168)]??0x0},'description':_0x2aacfb(0x17a)};},async 'execute'(_0x4e4361){const _0xdc3328=a33_0x28f41c,_0xd24684=importServiceManifest(_0x4e4361[_0xdc3328(0x175)](_0xdc3328(0x180)));if(_0xd24684[_0xdc3328(0x151)]['length']!==0x1)return{'ok':!![],'data':{'registryPath':_0xd24684[_0xdc3328(0x160)],'imported':_0xd24684[_0xdc3328(0x145)],'updated':_0xd24684[_0xdc3328(0x17d)],'serviceCount':_0xd24684[_0xdc3328(0x170)],'services':_0xd24684[_0xdc3328(0x151)][_0xdc3328(0x153)](summarizeService)},'message':_0xdc3328(0x15b)+_0xd24684[_0xdc3328(0x145)]+_0xdc3328(0x178)+_0xd24684[_0xdc3328(0x17d)]+'\x20service(s).'};return{'ok':!![],'data':{'registryPath':_0xd24684[_0xdc3328(0x160)],'replaced':_0xd24684[_0xdc3328(0x144)],'imported':_0xd24684['imported'],'updated':_0xd24684[_0xdc3328(0x17d)],'serviceCount':_0xd24684[_0xdc3328(0x170)],'service':summarizeService(_0xd24684[_0xdc3328(0x158)])},'message':(_0xd24684[_0xdc3328(0x144)]?_0xdc3328(0x14a):_0xdc3328(0x14c))+_0xdc3328(0x174)+_0xd24684[_0xdc3328(0x158)][_0xdc3328(0x16b)]+'.'};}},{'service':a33_0x28f41c(0x15e),'command':a33_0x28f41c(0x148),'description':'Export\x20a\x20local\x20Service\x20Tree\x20manifest\x20to\x20a\x20JSON\x20file','risk':a33_0x28f41c(0x16e),'requiresAuth':![],'requiresAppCode':![],'flags':[SERVICE_FLAG,FILE_FLAG],async 'dryRun'(_0x19beaf){const _0x13ddc5=a33_0x28f41c,_0x3b9de0=getLocalServiceEntry(_0x19beaf[_0x13ddc5(0x175)](_0x13ddc5(0x15e)));return{'method':_0x13ddc5(0x146),'url':_0x19beaf['str'](_0x13ddc5(0x180)),'body':{'service':_0x19beaf[_0x13ddc5(0x175)](_0x13ddc5(0x15e)),'found':Boolean(_0x3b9de0),'version':_0x3b9de0?.['version'],'source':_0x3b9de0?.[_0x13ddc5(0x177)]},'description':_0x13ddc5(0x15f)};},async 'execute'(_0x26d161){const _0x373d89=a33_0x28f41c,_0x4dffab=exportServiceManifest(_0x26d161[_0x373d89(0x175)](_0x373d89(0x15e)),_0x26d161[_0x373d89(0x175)]('file'));return{'ok':!![],'data':{'registryPath':_0x4dffab['registryPath'],'file':_0x4dffab[_0x373d89(0x163)],'service':summarizeService(_0x4dffab[_0x373d89(0x158)])},'message':_0x373d89(0x179)+_0x4dffab[_0x373d89(0x158)][_0x373d89(0x16b)]+'.'};}},{'service':'service','command':a33_0x28f41c(0x14e),'description':a33_0x28f41c(0x157),'risk':'read','requiresAuth':![],'requiresAppCode':![],'flags':[],async 'execute'(){const _0x56dee2=a33_0x28f41c,_0x3e3f30=listLocalServices();return{'ok':!![],'data':{'registryPath':getServiceRegistryPath(),'total':_0x3e3f30[_0x56dee2(0x168)],'services':_0x3e3f30[_0x56dee2(0x153)](summarizeService)}};}},{'service':a33_0x28f41c(0x15e),'command':a33_0x28f41c(0x165),'description':'Remove\x20a\x20local\x20Service\x20Tree\x20manifest\x20from\x20the\x20runtime\x20registry','risk':a33_0x28f41c(0x16e),'requiresAuth':![],'requiresAppCode':![],'flags':[SERVICE_FLAG],async 'dryRun'(_0x216d92){const _0x1698c3=a33_0x28f41c,_0x3f5cf7=getLocalServiceEntry(_0x216d92[_0x1698c3(0x175)]('service'));return{'method':_0x1698c3(0x146),'url':getServiceRegistryPath(),'body':{'service':_0x216d92[_0x1698c3(0x175)](_0x1698c3(0x15e)),'found':Boolean(_0x3f5cf7),'version':_0x3f5cf7?.[_0x1698c3(0x186)],'source':_0x3f5cf7?.[_0x1698c3(0x177)]},'description':_0x1698c3(0x155)};},async 'execute'(_0x36c8eb){const _0x508218=a33_0x28f41c,_0x4bcc09=removeServiceManifest(_0x36c8eb[_0x508218(0x175)](_0x508218(0x15e)));return{'ok':!![],'data':{'registryPath':_0x4bcc09[_0x508218(0x160)],'serviceCount':_0x4bcc09[_0x508218(0x170)],'service':summarizeService(_0x4bcc09[_0x508218(0x158)])},'message':_0x508218(0x164)+_0x4bcc09[_0x508218(0x158)][_0x508218(0x16b)]+'.'};}},{'service':a33_0x28f41c(0x15e),'command':'detail','description':a33_0x28f41c(0x16c),'risk':'read','requiresAuth':![],'requiresAppCode':![],'flags':[SERVICE_FLAG],async 'execute'(_0xd18f9a){const _0x4430b2=a33_0x28f41c,_0x55487a=getLocalServiceEntry(_0xd18f9a[_0x4430b2(0x175)](_0x4430b2(0x15e)));if(!_0x55487a)return{'ok':![],'data':{'registryPath':getServiceRegistryPath(),'service':_0xd18f9a[_0x4430b2(0x175)](_0x4430b2(0x15e))},'message':_0x4430b2(0x16a)+_0xd18f9a['str'](_0x4430b2(0x15e))};return{'ok':!![],'data':{'registryPath':getServiceRegistryPath(),'service':summarizeService(_0x55487a),'manifest':_0x55487a['manifest'],'normalizedManifest':_0x55487a['normalizedManifest']}};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a34_0xb613d9=a34_0x52e7;(function(_0x3e3d7b,_0x1f7d88){const _0x3df16b=a34_0x52e7,_0x1a91ff=_0x3e3d7b();while(!![]){try{const _0x4ffc55=parseInt(_0x3df16b(0xa9))/0x1+-parseInt(_0x3df16b(0xaf))/0x2+-parseInt(_0x3df16b(0xc1))/0x3+parseInt(_0x3df16b(0xd4))/0x4*(-parseInt(_0x3df16b(0xc3))/0x5)+-parseInt(_0x3df16b(0xab))/0x6+-parseInt(_0x3df16b(0xd5))/0x7+parseInt(_0x3df16b(0xa5))/0x8;if(_0x4ffc55===_0x1f7d88)break;else _0x1a91ff['push'](_0x1a91ff['shift']());}catch(_0x2d4ad5){_0x1a91ff['push'](_0x1a91ff['shift']());}}}(a34_0x1ccc,0xab219));import{createHash}from'node:crypto';import{existsSync,mkdirSync,readFileSync,renameSync,unlinkSync,writeFileSync}from'node:fs';import{homedir}from'node:os';import{dirname,resolve}from'node:path';import{normalizeServiceTreeManifest,validateServiceTreeManifest}from'@lovrabet/cli-framework';import{PRODUCT_CONFIG}from'../../constant/product.js';function a34_0x52e7(_0x42dc22,_0x41e3bf){_0x42dc22=_0x42dc22-0x99;const _0x1ccc16=a34_0x1ccc();let _0x52e73e=_0x1ccc16[_0x42dc22];return _0x52e73e;}import{CliErrors}from'../../errors.js';export const SERVICE_REGISTRY_SCHEMA_VERSION=0x1;export const SERVICE_REGISTRY_FILE_NAME=a34_0xb613d9(0xaa);export function getServiceRegistryPath(_0x4bc351={}){const _0x23bedf=a34_0xb613d9;return resolve(_0x4bc351[_0x23bedf(0xa4)]??homedir(),PRODUCT_CONFIG['homeDirName'],SERVICE_REGISTRY_FILE_NAME);}export function emptyServiceRegistry(){return{'schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'services':[]};}export function readServiceRegistry(_0x43792a={}){const _0xf5c2e4=a34_0xb613d9,_0x24f45f=getServiceRegistryPath(_0x43792a);if(!existsSync(_0x24f45f))return emptyServiceRegistry();try{const _0x3c098b=readFileSync(_0x24f45f,_0xf5c2e4(0xae));if(!_0x3c098b[_0xf5c2e4(0xdc)]())return emptyServiceRegistry();const _0x3b50d2=JSON['parse'](_0x3c098b);if(_0x3b50d2[_0xf5c2e4(0xbd)]!==SERVICE_REGISTRY_SCHEMA_VERSION)throw CliErrors[_0xf5c2e4(0x9f)]('Unsupported\x20service\x20registry\x20schemaVersion:\x20'+String(_0x3b50d2[_0xf5c2e4(0xbd)]),'Remove\x20or\x20migrate\x20'+_0x24f45f+'.');if(!Array[_0xf5c2e4(0xb1)](_0x3b50d2[_0xf5c2e4(0xe8)]))return emptyServiceRegistry();return{'schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'updatedAt':_0x3b50d2['updatedAt'],'services':_0x3b50d2['services']};}catch(_0x24043f){if(_0x24043f instanceof Error&&_0x24043f[_0xf5c2e4(0xd3)]===_0xf5c2e4(0xe4))throw _0x24043f;throw CliErrors[_0xf5c2e4(0x9f)](_0xf5c2e4(0xbc)+_0x24f45f,_0xf5c2e4(0xa0));}}function a34_0x1ccc(){const _0x597950=['schemaVersion','manifests','string','digest','3916122YPwGRH','version','460330ByfHiz','path','errors','reduce','Local\x20service\x20not\x20found:\x20','find','risk','code','importedAt','services\x20must\x20be\x20an\x20array','now','Service\x20registry\x20has\x20no\x20services\x20to\x20import.','commands','message','registry','findIndex','name','36eNxXEr','1094674FEKMca','invalid','stringify','Service\x20manifest\x20file\x20not\x20found:\x20','cliPath','updatedAt','hex','trim','].manifest','length','startsWith','warnings','manifest','.tmp','Unsupported\x20schemaVersion:\x20','CliError','registryIndex','commandCount','push','services','report','Invalid\x20service\x20manifest\x20JSON:\x20','command','update','slice','serviceCode','validation','Fix\x20the\x20JSON\x20file\x20or\x20move\x20it\x20aside\x20and\x20import\x20services\x20again.','join','source','localeCompare','homeDir','27006176ahZnUG','$.services[','toISOString','Run\x20lovrabet\x20service\x20list\x20to\x20see\x20imported\x20services.','325872czNPoE','service.json','2437698zWxIah','ENOENT','kind','utf8','608116thEfdU','map','isArray','file','parse','service','Fix\x20the\x20JSON\x20syntax\x20and\x20run\x20service\x20validate\x20again.','normalizedManifest','target','object','Add\x20at\x20least\x20one\x20service\x20manifest,\x20then\x20run\x20service\x20import\x20again.','Cannot\x20write\x20service\x20registry:\x20','description','Invalid\x20service\x20registry\x20JSON:\x20'];a34_0x1ccc=function(){return _0x597950;};return a34_0x1ccc();}export function writeServiceRegistry(_0x4cfc1b,_0x559040={}){const _0x16738b=a34_0xb613d9,_0x44c484=getServiceRegistryPath(_0x559040),_0x110fe1=dirname(_0x44c484);!existsSync(_0x110fe1)&&mkdirSync(_0x110fe1,{'recursive':!![]});const _0x15d719=_0x44c484+_0x16738b(0xe2);try{writeFileSync(_0x15d719,JSON[_0x16738b(0xd7)](_0x4cfc1b,null,0x2)+'\x0a',{'encoding':_0x16738b(0xae),'mode':0x180}),renameSync(_0x15d719,_0x44c484);}catch(_0x204a11){try{unlinkSync(_0x15d719);}catch{}if(_0x204a11?.[_0x16738b(0xca)]===_0x16738b(0xac))throw CliErrors[_0x16738b(0x9f)](_0x16738b(0xba)+_0x44c484);throw _0x204a11;}return _0x44c484;}export function loadServiceManifestFromFile(_0x3ce33c){const _0x245fc4=a34_0xb613d9,_0x3dfb67=resolve(_0x3ce33c);if(!existsSync(_0x3dfb67))throw CliErrors['validation'](_0x245fc4(0xd8)+_0x3ce33c);let _0x140922;const _0x30cc82=readFileSync(_0x3dfb67,_0x245fc4(0xae));try{_0x140922=JSON['parse'](_0x30cc82);}catch{throw CliErrors['validation'](_0x245fc4(0x9a)+_0x3ce33c,_0x245fc4(0xb5));}const _0x3325b8=sha256(_0x30cc82),_0x181f11=extractLoadedServiceManifests(_0x140922,_0x3325b8),_0x5651ad=aggregateValidationReports(_0x181f11),_0x532e28=_0x181f11[0x0];return{'filePath':_0x3dfb67,'hash':_0x3325b8,'kind':isServiceRegistryLike(_0x140922)?_0x245fc4(0xd1):_0x245fc4(0xe1),'manifest':_0x532e28?.[_0x245fc4(0xe1)]??_0x140922,'report':_0x5651ad,'normalizedManifest':_0x181f11[_0x245fc4(0xde)]===0x1?_0x532e28?.[_0x245fc4(0xb6)]:undefined,'manifests':_0x181f11};}export function importServiceManifest(_0x26771a,_0x5247d6={}){const _0x1a978b=a34_0xb613d9,_0x9fa702=loadServiceManifestFromFile(_0x26771a);if(!_0x9fa702['report']['ok'])throw CliErrors[_0x1a978b(0x9f)](formatValidationFailure(_0x9fa702[_0x1a978b(0x99)]),'Fix\x20the\x20service\x20manifest\x20and\x20run\x20service\x20validate\x20again.');if(_0x9fa702[_0x1a978b(0xbe)]['length']===0x0)throw CliErrors[_0x1a978b(0x9f)](_0x1a978b(0xce),_0x1a978b(0xb9));const _0x55c77a=readServiceRegistry(_0x5247d6),_0x4e6412=(_0x5247d6[_0x1a978b(0xcd)]??(()=>new Date()))()[_0x1a978b(0xa7)](),_0x538711=[];let _0x246ea1=0x0,_0x4f68d6=0x0;for(const _0x18ecb4 of _0x9fa702[_0x1a978b(0xbe)]){if(!_0x18ecb4['normalizedManifest'])continue;const _0x369e14=_0x18ecb4['normalizedManifest']['service'][_0x1a978b(0xca)],_0x19280f={'serviceCode':_0x369e14,'version':_0x18ecb4['normalizedManifest'][_0x1a978b(0xc2)],'importedAt':_0x4e6412,'source':{'type':_0x1a978b(0xb2),'path':_0x9fa702['filePath'],'hash':_0x18ecb4['sourceHash']},'manifest':_0x18ecb4[_0x1a978b(0xe1)],'normalizedManifest':_0x18ecb4[_0x1a978b(0xb6)]},_0x5d2353=_0x55c77a[_0x1a978b(0xe8)][_0x1a978b(0xd2)](_0x43a75c=>_0x43a75c[_0x1a978b(0x9e)]===_0x369e14);_0x5d2353>=0x0?(_0x55c77a[_0x1a978b(0xe8)][_0x5d2353]=_0x19280f,_0x4f68d6++):(_0x55c77a[_0x1a978b(0xe8)]['push'](_0x19280f),_0x246ea1++),_0x538711[_0x1a978b(0xe7)](_0x19280f);}_0x55c77a[_0x1a978b(0xe8)]['sort']((_0x47c76a,_0x32b36c)=>_0x47c76a['serviceCode'][_0x1a978b(0xa3)](_0x32b36c['serviceCode'])),_0x55c77a[_0x1a978b(0xda)]=_0x4e6412;const _0x5856c3=writeServiceRegistry(_0x55c77a,_0x5247d6);return{'registryPath':_0x5856c3,'entry':_0x538711[0x0],'replaced':_0x538711['length']===0x1?_0x4f68d6===0x1:_0x4f68d6>0x0,'entries':_0x538711,'imported':_0x246ea1,'updated':_0x4f68d6,'serviceCount':_0x55c77a[_0x1a978b(0xe8)][_0x1a978b(0xde)]};}export function exportServiceManifest(_0x24b016,_0xa3cd0e,_0x2e2696={}){const _0x3bc59f=a34_0xb613d9,_0x155a38=getServiceRegistryPath(_0x2e2696),_0x5f4e70=getLocalServiceEntry(_0x24b016,_0x2e2696);if(!_0x5f4e70)throw CliErrors[_0x3bc59f(0x9f)](_0x3bc59f(0xc7)+_0x24b016,_0x3bc59f(0xa8));const _0x2908d4=resolve(_0xa3cd0e),_0x1883c0=dirname(_0x2908d4);return!existsSync(_0x1883c0)&&mkdirSync(_0x1883c0,{'recursive':!![]}),writeFileSync(_0x2908d4,JSON[_0x3bc59f(0xd7)](_0x5f4e70[_0x3bc59f(0xe1)],null,0x2)+'\x0a',{'encoding':_0x3bc59f(0xae),'mode':0x180}),{'registryPath':_0x155a38,'filePath':_0x2908d4,'entry':_0x5f4e70};}export function removeServiceManifest(_0x5c3ad9,_0x544cb1={}){const _0x3795b4=a34_0xb613d9,_0x2568d6=readServiceRegistry(_0x544cb1),_0x2904b9=_0x5c3ad9[_0x3795b4(0xdc)](),_0x475f92=_0x2568d6['services']['findIndex'](_0x4fd4fe=>_0x4fd4fe[_0x3795b4(0x9e)]===_0x2904b9);if(_0x475f92<0x0)throw CliErrors[_0x3795b4(0x9f)](_0x3795b4(0xc7)+_0x2904b9,_0x3795b4(0xa8));const [_0x4199b3]=_0x2568d6[_0x3795b4(0xe8)]['splice'](_0x475f92,0x1),_0x36b616=(_0x544cb1[_0x3795b4(0xcd)]??(()=>new Date()))()[_0x3795b4(0xa7)]();_0x2568d6['updatedAt']=_0x36b616;const _0x57556a=writeServiceRegistry(_0x2568d6,_0x544cb1);return{'registryPath':_0x57556a,'entry':_0x4199b3,'serviceCount':_0x2568d6[_0x3795b4(0xe8)][_0x3795b4(0xde)]};}export function listLocalServices(_0x322378={}){const _0x246d53=a34_0xb613d9;return readServiceRegistry(_0x322378)[_0x246d53(0xe8)];}export function getLocalServiceEntry(_0x13f39b,_0x1f568f={}){const _0x342d7b=a34_0xb613d9;return readServiceRegistry(_0x1f568f)[_0x342d7b(0xe8)][_0x342d7b(0xc8)](_0x2d3f57=>_0x2d3f57[_0x342d7b(0x9e)]===_0x13f39b[_0x342d7b(0xdc)]());}export function listLocalServiceTrees(_0x57059c={}){const _0x4f12e4=a34_0xb613d9;return readServiceRegistry(_0x57059c)[_0x4f12e4(0xe8)][_0x4f12e4(0xb0)](_0x18ea99=>_0x18ea99[_0x4f12e4(0xb6)]);}export function inspectServiceRegistry(_0x3be87d={}){const _0x320d1a=a34_0xb613d9,_0x3bc8ae=getServiceRegistryPath(_0x3be87d);if(!existsSync(_0x3bc8ae))return emptyServiceRegistryInspection(_0x3bc8ae,'missing',![]);try{const _0x2ba8cd=readFileSync(_0x3bc8ae,_0x320d1a(0xae));if(!_0x2ba8cd[_0x320d1a(0xdc)]())return emptyServiceRegistryInspection(_0x3bc8ae,'empty',!![]);const _0x585ce7=JSON[_0x320d1a(0xb3)](_0x2ba8cd);if(_0x585ce7['schemaVersion']!==SERVICE_REGISTRY_SCHEMA_VERSION)return{...emptyServiceRegistryInspection(_0x3bc8ae,_0x320d1a(0xd6),!![]),'schemaVersion':_0x585ce7[_0x320d1a(0xbd)],'message':_0x320d1a(0xe3)+String(_0x585ce7[_0x320d1a(0xbd)])};if(!Array[_0x320d1a(0xb1)](_0x585ce7[_0x320d1a(0xe8)]))return{...emptyServiceRegistryInspection(_0x3bc8ae,_0x320d1a(0xd6),!![]),'schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'updatedAt':_0x585ce7[_0x320d1a(0xda)],'message':_0x320d1a(0xcc)};const _0x5cf417=_0x585ce7[_0x320d1a(0xe8)][_0x320d1a(0xb0)](summarizeLocalServiceEntry);return{'registryPath':_0x3bc8ae,'exists':!![],'status':'ok','schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'updatedAt':_0x585ce7[_0x320d1a(0xda)],'serviceCount':_0x5cf417[_0x320d1a(0xde)],'commandCount':_0x5cf417[_0x320d1a(0xc6)]((_0x3cf85d,_0x4e21ae)=>_0x3cf85d+_0x4e21ae[_0x320d1a(0xe6)],0x0),'services':_0x5cf417};}catch(_0x12065e){return{...emptyServiceRegistryInspection(_0x3bc8ae,_0x320d1a(0xd6),!![]),'message':_0x12065e instanceof Error?_0x12065e[_0x320d1a(0xd0)]:String(_0x12065e)};}}export function formatValidationFailure(_0xb0ad9b){const _0x54008e=a34_0xb613d9,_0x2355f9=_0xb0ad9b[_0x54008e(0xc5)][_0x54008e(0xb0)](_0x2bd673=>_0x2bd673['path']+':\x20'+_0x2bd673['message']);return'Service\x20manifest\x20validation\x20failed:\x0a'+_0x2355f9[_0x54008e(0xa1)]('\x0a');}function extractLoadedServiceManifests(_0x3f5b44,_0x5022e8){const _0x4f7dcc=a34_0xb613d9;if(!isServiceRegistryLike(_0x3f5b44)){const _0x1fe648=_0x3f5b44,_0x3a2790=validateServiceTreeManifest(_0x1fe648);return[{'manifest':_0x1fe648,'report':_0x3a2790,'normalizedManifest':_0x3a2790['ok']?normalizeServiceTreeManifest(_0x1fe648):undefined,'sourceHash':_0x5022e8}];}return _0x3f5b44[_0x4f7dcc(0xe8)][_0x4f7dcc(0xb0)]((_0xe5325,_0x120c83)=>{const _0x1dd903=_0x4f7dcc,_0x406364=isObjectRecord(_0xe5325)?_0xe5325[_0x1dd903(0xe1)]:undefined,_0x7287ca=validateServiceTreeManifest(_0x406364),_0x5625b1=isObjectRecord(_0xe5325)&&typeof _0xe5325[_0x1dd903(0x9e)]===_0x1dd903(0xbf)?_0xe5325[_0x1dd903(0x9e)]:undefined;return{'manifest':_0x406364,'report':_0x7287ca,'normalizedManifest':_0x7287ca['ok']?normalizeServiceTreeManifest(_0x406364):undefined,'sourceHash':sha256(JSON[_0x1dd903(0xd7)](_0x406364,null,0x2)+'\x0a'),'registryIndex':_0x120c83,'registryServiceCode':_0x5625b1};});}function aggregateValidationReports(_0xf7511e){const _0x357825=a34_0xb613d9,_0x17f250=_0xf7511e['flatMap'](_0x18f8aa=>_0x18f8aa[_0x357825(0xe5)]===undefined?_0x18f8aa[_0x357825(0x99)][_0x357825(0xc5)]:_0x18f8aa[_0x357825(0x99)][_0x357825(0xc5)][_0x357825(0xb0)](_0x5a27c8=>({..._0x5a27c8,'path':prefixRegistryIssuePath(_0x18f8aa[_0x357825(0xe5)],_0x5a27c8[_0x357825(0xc4)])}))),_0xff2b37=_0xf7511e['flatMap'](_0x41961=>_0x41961['registryIndex']===undefined?_0x41961[_0x357825(0x99)]['warnings']:_0x41961[_0x357825(0x99)][_0x357825(0xe0)]['map'](_0x1106e2=>({..._0x1106e2,'path':prefixRegistryIssuePath(_0x41961[_0x357825(0xe5)],_0x1106e2[_0x357825(0xc4)])})));return{'ok':_0x17f250[_0x357825(0xde)]===0x0,'errors':_0x17f250,'warnings':_0xff2b37};}function prefixRegistryIssuePath(_0x1e1089,_0x3824b7){const _0x34de80=a34_0xb613d9;if(_0x3824b7==='$')return _0x34de80(0xa6)+_0x1e1089+_0x34de80(0xdd);if(_0x3824b7[_0x34de80(0xdf)]('$.'))return _0x34de80(0xa6)+_0x1e1089+_0x34de80(0xdd)+_0x3824b7[_0x34de80(0x9d)](0x1);if(_0x3824b7[_0x34de80(0xdf)]('$['))return _0x34de80(0xa6)+_0x1e1089+'].manifest'+_0x3824b7['slice'](0x1);return _0x34de80(0xa6)+_0x1e1089+'].manifest.'+_0x3824b7;}function isServiceRegistryLike(_0x3d52bb){const _0x15fcf6=a34_0xb613d9;return isObjectRecord(_0x3d52bb)&&_0x3d52bb['schemaVersion']===SERVICE_REGISTRY_SCHEMA_VERSION&&Array['isArray'](_0x3d52bb[_0x15fcf6(0xe8)]);}function isObjectRecord(_0x5f24b7){const _0x1ab423=a34_0xb613d9;return Boolean(_0x5f24b7)&&typeof _0x5f24b7===_0x1ab423(0xb8)&&!Array[_0x1ab423(0xb1)](_0x5f24b7);}function emptyServiceRegistryInspection(_0x46fab3,_0x3631eb,_0x3ec21d){return{'registryPath':_0x46fab3,'exists':_0x3ec21d,'status':_0x3631eb,'serviceCount':0x0,'commandCount':0x0,'services':[]};}function summarizeLocalServiceEntry(_0x1c3126){const _0x14d8cf=a34_0xb613d9,_0x56bc02=_0x1c3126['normalizedManifest'],_0x32aac3=_0x56bc02[_0x14d8cf(0xcf)][_0x14d8cf(0xb0)](_0x240039=>({'path':_0x240039[_0x14d8cf(0xd9)],'description':_0x240039[_0x14d8cf(0xbb)],'risk':_0x240039[_0x14d8cf(0xc9)],'targetKind':_0x240039[_0x14d8cf(0xb7)][_0x14d8cf(0xad)],'targetCommand':_0x240039['target'][_0x14d8cf(0x9b)]}));return{'serviceCode':_0x1c3126[_0x14d8cf(0x9e)],'name':_0x56bc02['service'][_0x14d8cf(0xd3)],'description':_0x56bc02[_0x14d8cf(0xb4)][_0x14d8cf(0xbb)],'version':_0x1c3126['version'],'importedAt':_0x1c3126[_0x14d8cf(0xcb)],'source':_0x1c3126[_0x14d8cf(0xa2)],'commandCount':_0x32aac3[_0x14d8cf(0xde)],'commands':_0x32aac3};}function sha256(_0x356d60){const _0x31bc93=a34_0xb613d9;return createHash('sha256')[_0x31bc93(0x9c)](_0x356d60)[_0x31bc93(0xc0)](_0x31bc93(0xdb));}
|
|
1
|
+
const a34_0x4d91a0=a34_0x4a34;(function(_0x272e66,_0x4cd02b){const _0x290100=a34_0x4a34,_0x1e9ca6=_0x272e66();while(!![]){try{const _0x5ec7bf=-parseInt(_0x290100(0x166))/0x1+parseInt(_0x290100(0x163))/0x2*(-parseInt(_0x290100(0x140))/0x3)+-parseInt(_0x290100(0x164))/0x4+-parseInt(_0x290100(0x17c))/0x5+parseInt(_0x290100(0x16b))/0x6*(parseInt(_0x290100(0x145))/0x7)+parseInt(_0x290100(0x138))/0x8+parseInt(_0x290100(0x14d))/0x9*(parseInt(_0x290100(0x15d))/0xa);if(_0x5ec7bf===_0x4cd02b)break;else _0x1e9ca6['push'](_0x1e9ca6['shift']());}catch(_0x267828){_0x1e9ca6['push'](_0x1e9ca6['shift']());}}}(a34_0x5d8d,0x421a6));import{createHash}from'node:crypto';import{existsSync,mkdirSync,readFileSync,renameSync,unlinkSync,writeFileSync}from'node:fs';import{homedir}from'node:os';import{dirname,resolve}from'node:path';import{normalizeServiceTreeManifest,validateServiceTreeManifest}from'@lovrabet/cli-framework';import{PRODUCT_CONFIG}from'../../constant/product.js';import{CliErrors}from'../../errors.js';export const SERVICE_REGISTRY_SCHEMA_VERSION=0x1;export const SERVICE_REGISTRY_FILE_NAME=a34_0x4d91a0(0x15b);export function getServiceRegistryPath(_0x1dbb44={}){const _0x50b337=a34_0x4d91a0;return resolve(_0x1dbb44[_0x50b337(0x175)]??homedir(),PRODUCT_CONFIG[_0x50b337(0x150)],SERVICE_REGISTRY_FILE_NAME);}export function emptyServiceRegistry(){return{'schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'services':[]};}export function readServiceRegistry(_0x143f53={}){const _0x12ce39=a34_0x4d91a0,_0x3a00e6=getServiceRegistryPath(_0x143f53);if(!existsSync(_0x3a00e6))return emptyServiceRegistry();try{const _0x4d30e1=readFileSync(_0x3a00e6,_0x12ce39(0x130));if(!_0x4d30e1['trim']())return emptyServiceRegistry();const _0x46f0f5=JSON['parse'](_0x4d30e1);if(_0x46f0f5['schemaVersion']!==SERVICE_REGISTRY_SCHEMA_VERSION)throw CliErrors[_0x12ce39(0x141)](_0x12ce39(0x143)+String(_0x46f0f5[_0x12ce39(0x16d)]),_0x12ce39(0x146)+_0x3a00e6+'.');if(!Array[_0x12ce39(0x171)](_0x46f0f5[_0x12ce39(0x179)]))return emptyServiceRegistry();return{'schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'updatedAt':_0x46f0f5[_0x12ce39(0x12d)],'services':_0x46f0f5[_0x12ce39(0x179)]};}catch(_0x3341c8){if(_0x3341c8 instanceof Error&&_0x3341c8[_0x12ce39(0x148)]===_0x12ce39(0x14c))throw _0x3341c8;throw CliErrors['validation'](_0x12ce39(0x147)+_0x3a00e6,'Fix\x20the\x20JSON\x20file\x20or\x20move\x20it\x20aside\x20and\x20import\x20services\x20again.');}}export function writeServiceRegistry(_0x574b10,_0x46b3ba={}){const _0x53fdc5=a34_0x4d91a0,_0x25f097=getServiceRegistryPath(_0x46b3ba),_0x40205b=dirname(_0x25f097);!existsSync(_0x40205b)&&mkdirSync(_0x40205b,{'recursive':!![]});const _0x181462=_0x25f097+_0x53fdc5(0x142);try{writeFileSync(_0x181462,JSON[_0x53fdc5(0x17d)](_0x574b10,null,0x2)+'\x0a',{'encoding':_0x53fdc5(0x130),'mode':0x180}),renameSync(_0x181462,_0x25f097);}catch(_0x6cba67){try{unlinkSync(_0x181462);}catch{}if(_0x6cba67?.['code']===_0x53fdc5(0x15c))throw CliErrors[_0x53fdc5(0x141)]('Cannot\x20write\x20service\x20registry:\x20'+_0x25f097);throw _0x6cba67;}return _0x25f097;}export function loadServiceManifestFromFile(_0x2b6843){const _0x38a842=a34_0x4d91a0,_0x207d62=resolve(_0x2b6843);if(!existsSync(_0x207d62))throw CliErrors['validation'](_0x38a842(0x156)+_0x2b6843);let _0x1b4dc9;const _0x772b5b=readFileSync(_0x207d62,_0x38a842(0x130));try{_0x1b4dc9=JSON[_0x38a842(0x162)](_0x772b5b);}catch{throw CliErrors['validation']('Invalid\x20service\x20manifest\x20JSON:\x20'+_0x2b6843,'Fix\x20the\x20JSON\x20syntax\x20and\x20run\x20service\x20validate\x20again.');}const _0x3927bb=sha256(_0x772b5b),_0x33336c=extractLoadedServiceManifests(_0x1b4dc9,_0x3927bb),_0x391034=aggregateValidationReports(_0x33336c),_0x4d822b=_0x33336c[0x0];return{'filePath':_0x207d62,'hash':_0x3927bb,'kind':isServiceRegistryLike(_0x1b4dc9)?'registry':_0x38a842(0x178),'manifest':_0x4d822b?.[_0x38a842(0x178)]??_0x1b4dc9,'report':_0x391034,'normalizedManifest':_0x33336c[_0x38a842(0x16f)]===0x1?_0x4d822b?.[_0x38a842(0x14a)]:undefined,'manifests':_0x33336c};}export function importServiceManifest(_0x45ca25,_0xded252={}){const _0x40a26c=a34_0x4d91a0,_0x19f178=loadServiceManifestFromFile(_0x45ca25);if(!_0x19f178[_0x40a26c(0x17a)]['ok'])throw CliErrors['validation'](formatValidationFailure(_0x19f178[_0x40a26c(0x17a)]),_0x40a26c(0x13f));if(_0x19f178[_0x40a26c(0x158)][_0x40a26c(0x16f)]===0x0)throw CliErrors[_0x40a26c(0x141)](_0x40a26c(0x161),_0x40a26c(0x160));const _0xcd429c=readServiceRegistry(_0xded252),_0x15552a=(_0xded252['now']??(()=>new Date()))()['toISOString'](),_0x358133=[];let _0x2e164f=0x0,_0x15e09d=0x0;for(const _0x574ad5 of _0x19f178[_0x40a26c(0x158)]){if(!_0x574ad5[_0x40a26c(0x14a)])continue;const _0x17c44d=_0x574ad5[_0x40a26c(0x14a)][_0x40a26c(0x133)][_0x40a26c(0x136)],_0x5f2500={'serviceCode':_0x17c44d,'version':_0x574ad5[_0x40a26c(0x14a)][_0x40a26c(0x153)],'importedAt':_0x15552a,'source':{'type':'file','path':_0x19f178[_0x40a26c(0x167)],'hash':_0x574ad5['sourceHash']},'manifest':_0x574ad5[_0x40a26c(0x178)],'normalizedManifest':_0x574ad5[_0x40a26c(0x14a)]},_0x3aaac1=_0xcd429c[_0x40a26c(0x179)][_0x40a26c(0x16c)](_0x28298f=>_0x28298f[_0x40a26c(0x159)]===_0x17c44d);_0x3aaac1>=0x0?(_0xcd429c[_0x40a26c(0x179)][_0x3aaac1]=_0x5f2500,_0x15e09d++):(_0xcd429c[_0x40a26c(0x179)][_0x40a26c(0x157)](_0x5f2500),_0x2e164f++),_0x358133[_0x40a26c(0x157)](_0x5f2500);}_0xcd429c[_0x40a26c(0x179)][_0x40a26c(0x169)]((_0x36949f,_0x136ae9)=>_0x36949f[_0x40a26c(0x159)][_0x40a26c(0x177)](_0x136ae9['serviceCode'])),_0xcd429c['updatedAt']=_0x15552a;const _0x4d2d73=writeServiceRegistry(_0xcd429c,_0xded252);return{'registryPath':_0x4d2d73,'entry':_0x358133[0x0],'replaced':_0x358133[_0x40a26c(0x16f)]===0x1?_0x15e09d===0x1:_0x15e09d>0x0,'entries':_0x358133,'imported':_0x2e164f,'updated':_0x15e09d,'serviceCount':_0xcd429c[_0x40a26c(0x179)]['length']};}export function exportServiceManifest(_0xd3afe5,_0x7fca3e,_0x3e7c27={}){const _0x736b63=a34_0x4d91a0,_0x5158c2=getServiceRegistryPath(_0x3e7c27),_0x4da9d7=getLocalServiceEntry(_0xd3afe5,_0x3e7c27);if(!_0x4da9d7)throw CliErrors[_0x736b63(0x141)](_0x736b63(0x134)+_0xd3afe5,_0x736b63(0x137));const _0x50742d=resolve(_0x7fca3e),_0x428f06=dirname(_0x50742d);return!existsSync(_0x428f06)&&mkdirSync(_0x428f06,{'recursive':!![]}),writeFileSync(_0x50742d,JSON['stringify'](_0x4da9d7['manifest'],null,0x2)+'\x0a',{'encoding':_0x736b63(0x130),'mode':0x180}),{'registryPath':_0x5158c2,'filePath':_0x50742d,'entry':_0x4da9d7};}export function removeServiceManifest(_0x5bb0e1,_0x2d9277={}){const _0x498e7e=a34_0x4d91a0,_0x44e127=readServiceRegistry(_0x2d9277),_0x1e07ec=_0x5bb0e1['trim'](),_0x47a9ae=_0x44e127[_0x498e7e(0x179)][_0x498e7e(0x16c)](_0x40aff1=>_0x40aff1[_0x498e7e(0x159)]===_0x1e07ec);if(_0x47a9ae<0x0)throw CliErrors[_0x498e7e(0x141)](_0x498e7e(0x134)+_0x1e07ec,'Run\x20lovrabet\x20service\x20list\x20to\x20see\x20imported\x20services.');const [_0x132673]=_0x44e127[_0x498e7e(0x179)][_0x498e7e(0x149)](_0x47a9ae,0x1),_0x230723=(_0x2d9277[_0x498e7e(0x172)]??(()=>new Date()))()['toISOString']();_0x44e127[_0x498e7e(0x12d)]=_0x230723;const _0x183f86=writeServiceRegistry(_0x44e127,_0x2d9277);return{'registryPath':_0x183f86,'entry':_0x132673,'serviceCount':_0x44e127['services']['length']};}export function listLocalServices(_0x33b624={}){const _0x52ea16=a34_0x4d91a0;return readServiceRegistry(_0x33b624)[_0x52ea16(0x179)];}export function getLocalServiceEntry(_0x2da9f0,_0x51958f={}){const _0x55eea8=a34_0x4d91a0;return readServiceRegistry(_0x51958f)[_0x55eea8(0x179)][_0x55eea8(0x14e)](_0x3a36c9=>_0x3a36c9[_0x55eea8(0x159)]===_0x2da9f0[_0x55eea8(0x14b)]());}function a34_0x5d8d(){const _0x3a0635=['3226424PJJVtE','flatMap','message','cliPath','path','Service\x20manifest\x20validation\x20failed:\x0a','].manifest.','Fix\x20the\x20service\x20manifest\x20and\x20run\x20service\x20validate\x20again.','21327RSYDul','validation','.tmp','Unsupported\x20service\x20registry\x20schemaVersion:\x20','commands','105ZRYTLa','Remove\x20or\x20migrate\x20','Invalid\x20service\x20registry\x20JSON:\x20','name','splice','normalizedManifest','trim','CliError','5112UqjVEU','find','warnings','homeDirName','empty','slice','version','services\x20must\x20be\x20an\x20array','string','Service\x20manifest\x20file\x20not\x20found:\x20','push','manifests','serviceCode','missing','service.json','ENOENT','8060LouWFJ','reduce','digest','Add\x20at\x20least\x20one\x20service\x20manifest,\x20then\x20run\x20service\x20import\x20again.','Service\x20registry\x20has\x20no\x20services\x20to\x20import.','parse','142zhjdfB','261820EmDiCz','source','162946RozLDJ','filePath','].manifest','sort','description','168774iEkuiL','findIndex','schemaVersion','object','length','Unsupported\x20schemaVersion:\x20','isArray','now','errors','risk','homeDir','registryIndex','localeCompare','manifest','services','report','importedAt','1395740zPaWYi','stringify','sha256','commandCount','hex','updatedAt','invalid','map','utf8','target','$.services[','service','Local\x20service\x20not\x20found:\x20','startsWith','code','Run\x20lovrabet\x20service\x20list\x20to\x20see\x20imported\x20services.'];a34_0x5d8d=function(){return _0x3a0635;};return a34_0x5d8d();}export function listLocalServiceTrees(_0x34231d={}){const _0x4f2e9e=a34_0x4d91a0;return readServiceRegistry(_0x34231d)[_0x4f2e9e(0x179)][_0x4f2e9e(0x12f)](_0x1d35b4=>_0x1d35b4[_0x4f2e9e(0x14a)]);}export function inspectServiceRegistry(_0x36cb7d={}){const _0xe34f=a34_0x4d91a0,_0x2f151c=getServiceRegistryPath(_0x36cb7d);if(!existsSync(_0x2f151c))return emptyServiceRegistryInspection(_0x2f151c,_0xe34f(0x15a),![]);try{const _0x3a8828=readFileSync(_0x2f151c,_0xe34f(0x130));if(!_0x3a8828[_0xe34f(0x14b)]())return emptyServiceRegistryInspection(_0x2f151c,_0xe34f(0x151),!![]);const _0x407f9d=JSON[_0xe34f(0x162)](_0x3a8828);if(_0x407f9d[_0xe34f(0x16d)]!==SERVICE_REGISTRY_SCHEMA_VERSION)return{...emptyServiceRegistryInspection(_0x2f151c,'invalid',!![]),'schemaVersion':_0x407f9d['schemaVersion'],'message':_0xe34f(0x170)+String(_0x407f9d[_0xe34f(0x16d)])};if(!Array['isArray'](_0x407f9d['services']))return{...emptyServiceRegistryInspection(_0x2f151c,_0xe34f(0x12e),!![]),'schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'updatedAt':_0x407f9d['updatedAt'],'message':_0xe34f(0x154)};const _0x5e2bf6=_0x407f9d[_0xe34f(0x179)][_0xe34f(0x12f)](summarizeLocalServiceEntry);return{'registryPath':_0x2f151c,'exists':!![],'status':'ok','schemaVersion':SERVICE_REGISTRY_SCHEMA_VERSION,'updatedAt':_0x407f9d[_0xe34f(0x12d)],'serviceCount':_0x5e2bf6[_0xe34f(0x16f)],'commandCount':_0x5e2bf6[_0xe34f(0x15e)]((_0x17a886,_0x1fb98e)=>_0x17a886+_0x1fb98e[_0xe34f(0x12b)],0x0),'services':_0x5e2bf6};}catch(_0xdb5cfc){return{...emptyServiceRegistryInspection(_0x2f151c,'invalid',!![]),'message':_0xdb5cfc instanceof Error?_0xdb5cfc[_0xe34f(0x13a)]:String(_0xdb5cfc)};}}export function formatValidationFailure(_0x3534cc){const _0x2584fc=a34_0x4d91a0,_0x400026=_0x3534cc[_0x2584fc(0x173)][_0x2584fc(0x12f)](_0x54544f=>_0x54544f['path']+':\x20'+_0x54544f[_0x2584fc(0x13a)]);return _0x2584fc(0x13d)+_0x400026['join']('\x0a');}function extractLoadedServiceManifests(_0x21892b,_0xd29e8f){if(!isServiceRegistryLike(_0x21892b)){const _0x503b96=_0x21892b,_0x520c9f=validateServiceTreeManifest(_0x503b96);return[{'manifest':_0x503b96,'report':_0x520c9f,'normalizedManifest':_0x520c9f['ok']?normalizeServiceTreeManifest(_0x503b96):undefined,'sourceHash':_0xd29e8f}];}return _0x21892b['services']['map']((_0x8d885a,_0x55e942)=>{const _0x35b407=a34_0x4a34,_0x5f045b=isObjectRecord(_0x8d885a)?_0x8d885a['manifest']:undefined,_0x219474=validateServiceTreeManifest(_0x5f045b),_0xc6edc9=isObjectRecord(_0x8d885a)&&typeof _0x8d885a['serviceCode']===_0x35b407(0x155)?_0x8d885a['serviceCode']:undefined;return{'manifest':_0x5f045b,'report':_0x219474,'normalizedManifest':_0x219474['ok']?normalizeServiceTreeManifest(_0x5f045b):undefined,'sourceHash':sha256(JSON[_0x35b407(0x17d)](_0x5f045b,null,0x2)+'\x0a'),'registryIndex':_0x55e942,'registryServiceCode':_0xc6edc9};});}function aggregateValidationReports(_0x209d8a){const _0x292e4e=a34_0x4d91a0,_0x2c0e9a=_0x209d8a[_0x292e4e(0x139)](_0x7efd21=>_0x7efd21[_0x292e4e(0x176)]===undefined?_0x7efd21['report'][_0x292e4e(0x173)]:_0x7efd21['report'][_0x292e4e(0x173)][_0x292e4e(0x12f)](_0x1df298=>({..._0x1df298,'path':prefixRegistryIssuePath(_0x7efd21[_0x292e4e(0x176)],_0x1df298[_0x292e4e(0x13c)])}))),_0x10c793=_0x209d8a[_0x292e4e(0x139)](_0x26194d=>_0x26194d[_0x292e4e(0x176)]===undefined?_0x26194d[_0x292e4e(0x17a)][_0x292e4e(0x14f)]:_0x26194d[_0x292e4e(0x17a)]['warnings'][_0x292e4e(0x12f)](_0x36b5ef=>({..._0x36b5ef,'path':prefixRegistryIssuePath(_0x26194d[_0x292e4e(0x176)],_0x36b5ef['path'])})));return{'ok':_0x2c0e9a['length']===0x0,'errors':_0x2c0e9a,'warnings':_0x10c793};}function a34_0x4a34(_0x309813,_0x4a65a8){_0x309813=_0x309813-0x12a;const _0x5d8d9f=a34_0x5d8d();let _0x4a342f=_0x5d8d9f[_0x309813];return _0x4a342f;}function prefixRegistryIssuePath(_0x2e1c61,_0x305264){const _0x3e7c68=a34_0x4d91a0;if(_0x305264==='$')return _0x3e7c68(0x132)+_0x2e1c61+'].manifest';if(_0x305264[_0x3e7c68(0x135)]('$.'))return'$.services['+_0x2e1c61+_0x3e7c68(0x168)+_0x305264[_0x3e7c68(0x152)](0x1);if(_0x305264[_0x3e7c68(0x135)]('$['))return _0x3e7c68(0x132)+_0x2e1c61+_0x3e7c68(0x168)+_0x305264[_0x3e7c68(0x152)](0x1);return _0x3e7c68(0x132)+_0x2e1c61+_0x3e7c68(0x13e)+_0x305264;}function isServiceRegistryLike(_0x4ed959){const _0x2abb4b=a34_0x4d91a0;return isObjectRecord(_0x4ed959)&&_0x4ed959['schemaVersion']===SERVICE_REGISTRY_SCHEMA_VERSION&&Array[_0x2abb4b(0x171)](_0x4ed959[_0x2abb4b(0x179)]);}function isObjectRecord(_0x5d8542){const _0x1ea658=a34_0x4d91a0;return Boolean(_0x5d8542)&&typeof _0x5d8542===_0x1ea658(0x16e)&&!Array[_0x1ea658(0x171)](_0x5d8542);}function emptyServiceRegistryInspection(_0x355417,_0x5cf6c5,_0x2ddda6){return{'registryPath':_0x355417,'exists':_0x2ddda6,'status':_0x5cf6c5,'serviceCount':0x0,'commandCount':0x0,'services':[]};}function summarizeLocalServiceEntry(_0xefedec){const _0x1ca485=a34_0x4d91a0,_0x22a539=_0xefedec[_0x1ca485(0x14a)],_0x234193=_0x22a539[_0x1ca485(0x144)][_0x1ca485(0x12f)](_0x59decc=>({'path':_0x59decc[_0x1ca485(0x13b)],'description':_0x59decc['description'],'risk':_0x59decc[_0x1ca485(0x174)],'targetKind':_0x59decc[_0x1ca485(0x131)]['kind'],'targetCommand':_0x59decc['target']['command']}));return{'serviceCode':_0xefedec[_0x1ca485(0x159)],'name':_0x22a539[_0x1ca485(0x133)][_0x1ca485(0x148)],'description':_0x22a539[_0x1ca485(0x133)][_0x1ca485(0x16a)],'version':_0xefedec[_0x1ca485(0x153)],'importedAt':_0xefedec[_0x1ca485(0x17b)],'source':_0xefedec[_0x1ca485(0x165)],'commandCount':_0x234193['length'],'commands':_0x234193};}function sha256(_0xb7cdaf){const _0x6d2066=a34_0x4d91a0;return createHash(_0x6d2066(0x12a))['update'](_0xb7cdaf)[_0x6d2066(0x15f)](_0x6d2066(0x12c));}
|