@lovrabet/rabetbase-cli 2.0.2-beta.2 → 2.0.2-beta.6
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/ai-setup/config.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/doc.js +1 -0
- package/lib/commands/api/index.js +1 -0
- package/lib/commands/api/list.js +1 -0
- package/lib/commands/api/pull.js +1 -0
- package/lib/commands/app.js +1 -1
- package/lib/commands/auth.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/new.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/build.js +1 -1
- package/lib/commands/cli-update.js +1 -0
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/flags.js +1 -0
- package/lib/commands/config.js +1 -1
- package/lib/commands/create.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/links.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/doctor.js +1 -0
- package/lib/commands/init.js +1 -1
- package/lib/commands/logout.js +1 -1
- package/lib/commands/logs.js +1 -1
- package/lib/commands/mcp.js +1 -1
- package/lib/commands/menu/index.js +1 -0
- package/lib/commands/menu/shared/compare-table.js +1 -0
- package/lib/commands/menu/shared/index.js +1 -0
- package/lib/commands/menu/shared/inquirer.js +1 -0
- package/lib/commands/menu/shared/local-pages.js +1 -0
- package/lib/commands/menu/shared/logic.js +1 -0
- package/lib/commands/menu/shared/service.js +1 -0
- package/lib/commands/menu/shared/sync-core.js +1 -0
- package/lib/commands/menu/shared/update-core.js +1 -0
- package/lib/commands/menu/shared/valid-url.js +1 -0
- package/lib/commands/menu/sync.js +1 -0
- package/lib/commands/menu/update.js +1 -0
- package/lib/commands/preview.js +1 -1
- package/lib/commands/project-upgrade.js +1 -0
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run.js +1 -1
- package/lib/commands/skill.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/sql/list.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/non-interactive.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/errors.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/response.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/McpInstallUI.js +1 -1
- package/lib/mcp/claude.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/mcp/mcp-install-non-interactive.js +1 -1
- package/lib/mcp/mcp-installer.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/ui/IDESelector.js +1 -1
- package/lib/ui/useIDESelection.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +5 -2
- package/templates/generate-api/api.ts.tpl +4 -4
- package/templates/generate-api/client.ts.tpl +2 -2
- package/lib/api/api-doc-ui.js +0 -1
- package/lib/api/api-pull-ui.js +0 -1
- package/lib/api/main.js +0 -1
- package/lib/api/pull-silent.js +0 -1
- package/lib/app-menu/app-menu-sync-ui.js +0 -1
- package/lib/app-menu/create-menu.js +0 -1
- package/lib/app-menu/get-local-pages.js +0 -1
- package/lib/app-menu/get-online-menu-list.js +0 -1
- package/lib/app-menu/types.js +0 -1
- package/lib/app-menu/use-get-online-menu-list.js +0 -1
- package/lib/app-menu/utils.js +0 -1
- package/lib/app-menu/valid-url.js +0 -1
- package/lib/app-menu-update-cdn/current-content.js +0 -1
- package/lib/app-menu-update-cdn/input-cdn-asset.js +0 -1
- package/lib/app-menu-update-cdn/main.js +0 -1
- package/lib/app-menu-update-cdn/update-menu-cdn-url.js +0 -1
- package/lib/commands/api.js +0 -1
- package/lib/commands/menu.js +0 -1
- /package/lib/{app-menu-update-cdn → commands/menu/shared}/types.js +0 -0
package/lib/core/api-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2d4245,_0x52127a){const _0x4c9cc5=a74_0x2e0d,_0x519f6a=_0x2d4245();while(!![]){try{const _0x1d403a=-parseInt(_0x4c9cc5(0x176))/0x1*(parseInt(_0x4c9cc5(0x139))/0x2)+parseInt(_0x4c9cc5(0x18c))/0x3*(-parseInt(_0x4c9cc5(0x153))/0x4)+parseInt(_0x4c9cc5(0x13c))/0x5*(parseInt(_0x4c9cc5(0x199))/0x6)+-parseInt(_0x4c9cc5(0x177))/0x7*(parseInt(_0x4c9cc5(0x183))/0x8)+parseInt(_0x4c9cc5(0x194))/0x9*(-parseInt(_0x4c9cc5(0x193))/0xa)+parseInt(_0x4c9cc5(0x197))/0xb*(parseInt(_0x4c9cc5(0x173))/0xc)+parseInt(_0x4c9cc5(0x147))/0xd*(parseInt(_0x4c9cc5(0x195))/0xe);if(_0x1d403a===_0x52127a)break;else _0x519f6a['push'](_0x519f6a['shift']());}catch(_0x4998e2){_0x519f6a['push'](_0x519f6a['shift']());}}}(a74_0x50a0,0xe169d));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';import{CliErrors}from'../errors.js';import{extractList}from'../framework/response.js';let _activeCookie;export function setActiveCookie(_0x4cc756){_activeCookie=_0x4cc756||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}async function apiRequest(_0x294c80,_0x2df5d0={}){const _0x2113e7=a74_0x2e0d,{method:method=_0x2113e7(0x159),body:_0x6fac56,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0x2df5d0,_0x1e2056=useRuntime?getRuntimeDomain():getApiDomain(),_0x3dfc66=_activeCookie||getCookie(),_0x5695f3=''+_0x1e2056+_0x294c80,_0x4dc89e=new AbortController(),_0x37fb58=setTimeout(()=>_0x4dc89e[_0x2113e7(0x15b)](),timeout);try{const _0x1cce88=await fetch(_0x5695f3,{'method':method,'headers':{'Content-Type':_0x2113e7(0x13e),'Cookie':_0x3dfc66,'X-Invoke-Source':_0x2113e7(0x17b),...headers},'body':_0x6fac56?JSON[_0x2113e7(0x16c)](_0x6fac56):undefined,'signal':_0x4dc89e[_0x2113e7(0x19b)]});let _0x148b64;try{_0x148b64=await _0x1cce88[_0x2113e7(0x174)]();}catch{throw CliErrors[_0x2113e7(0x148)](_0x2113e7(0x18f)+_0x1cce88[_0x2113e7(0x156)]+')',_0x1cce88[_0x2113e7(0x156)]>=0x190?_0x2113e7(0x15a):undefined);}if(!_0x1cce88['ok']||_0x148b64[_0x2113e7(0x136)]===![])throw CliErrors[_0x2113e7(0x148)](_0x148b64[_0x2113e7(0x16a)]||_0x148b64['message']||_0x2113e7(0x185)+_0x1cce88[_0x2113e7(0x156)],_0x148b64['errorCode']?_0x2113e7(0x140)+_0x148b64[_0x2113e7(0x17c)]:undefined);return _0x148b64;}catch(_0x2db261){if(_0x2db261 instanceof Error&&_0x2db261[_0x2113e7(0x15c)]===_0x2113e7(0x162))throw CliErrors['apiError'](_0x2113e7(0x14d)+_0x5695f3);throw _0x2db261;}finally{clearTimeout(_0x37fb58);}}export async function listBffScripts(_0x52c273,_0x57a4fe,_0x1a0f84){const _0x25808f=a74_0x2e0d;let _0xd0895b=_0x25808f(0x16e)+_0x52c273;if(_0x57a4fe)_0xd0895b+='&type='+_0x57a4fe;const _0x4b944e=await apiRequest(_0xd0895b);let _0x2d3f36=extractList(_0x4b944e[_0x25808f(0x141)]);if(_0x1a0f84?.[_0x25808f(0x14f)]){const _0xf7ea7a=_0x1a0f84[_0x25808f(0x14f)][_0x25808f(0x17a)]();_0x2d3f36=_0x2d3f36[_0x25808f(0x166)](_0x191b03=>_0x191b03[_0x25808f(0x134)]?.[_0x25808f(0x17a)]()[_0x25808f(0x160)](_0xf7ea7a)||_0x191b03[_0x25808f(0x186)]?.['toLowerCase']()[_0x25808f(0x160)](_0xf7ea7a));}return _0x2d3f36;}function a74_0x2e0d(_0x54a405,_0x28b63d){_0x54a405=_0x54a405-0x132;const _0x50a0e0=a74_0x50a0();let _0x2e0d6e=_0x50a0e0[_0x54a405];return _0x2e0d6e;}export async function getBffScriptInfo(_0x5643ea){const _0x5aa96c=a74_0x2e0d,_0x17e4f6=await apiRequest('/api/management/library/scripts/info?id='+_0x5643ea);if(!_0x17e4f6['data'])throw CliErrors[_0x5aa96c(0x18e)](_0x5aa96c(0x150)+_0x5643ea);return _0x17e4f6['data'];}export async function saveBffScript(_0x44899d){const _0x2ff2bd=a74_0x2e0d,_0x28d6b9=await apiRequest('/api/management/library/scripts/save',{'method':_0x2ff2bd(0x198),'body':_0x44899d});return _0x28d6b9[_0x2ff2bd(0x141)];}export async function deleteBffScript(_0x4c5431){const _0x17c568=a74_0x2e0d;await apiRequest(_0x17c568(0x155),{'method':_0x17c568(0x198),'body':{'id':_0x4c5431}});}export async function getBffScriptStatistics(_0x377845){const _0x5774fb=a74_0x2e0d,_0x400d85=await apiRequest('/api/management/library/scripts/statistics?appCode='+_0x377845);return extractList(_0x400d85[_0x5774fb(0x141)]);}export async function listBffDatasetOperations(_0x96fb81,_0x2a99da){const _0x59ca2d=a74_0x2e0d,_0x56f3ee=await apiRequest('/smartapi/dataset/get-dataset-operation',{'method':_0x59ca2d(0x198),'body':{'appCode':_0x96fb81,'datasetId':_0x2a99da}});return _0x56f3ee[_0x59ca2d(0x141)];}export async function listSqlQueries(_0x594278,_0x585e20){const _0xe08a2b=a74_0x2e0d,_0x9479e4=await apiRequest('/smartapi/custom/queryUserCustomSqlList',{'method':_0xe08a2b(0x198),'body':{'appCode':_0x594278,'currentPage':_0x585e20?.[_0xe08a2b(0x16b)]??0x1,'pageSize':_0x585e20?.[_0xe08a2b(0x17f)]??0x32,'sqlCode':_0x585e20?.[_0xe08a2b(0x18d)],'sqlName':_0x585e20?.[_0xe08a2b(0x18a)]}});return _0x9479e4[_0xe08a2b(0x141)];}export async function getSqlQueryInfo(_0x294149,_0x52eb44){const _0x3bb6c2=await listSqlQueries(_0x294149,{'sqlCode':_0x52eb44}),_0x4c146f=_0x3bb6c2['tableData']?.[0x0];if(!_0x4c146f)throw CliErrors['validation']('SQL\x20query\x20not\x20found:\x20'+_0x52eb44);return _0x4c146f;}export async function saveSqlQuery(_0x1b7c19){const _0x1fc982=a74_0x2e0d,_0x3c521a=await apiRequest(_0x1fc982(0x187),{'method':_0x1fc982(0x198),'body':_0x1b7c19});return _0x3c521a[_0x1fc982(0x141)];}export async function executeSql(_0x5df433,_0x1c6cfc,_0x4b7fdc){const _0x37e324=a74_0x2e0d,_0x11fdd6=await apiRequest(_0x37e324(0x152),{'method':_0x37e324(0x198),'body':{'appCode':_0x5df433,'sqlCode':_0x1c6cfc,..._0x4b7fdc&&{'params':_0x4b7fdc}},'useRuntime':!![]});return _0x11fdd6[_0x37e324(0x141)];}export async function listDatasets(_0x39f469,_0x191782){const _0x25b533=a74_0x2e0d,_0x73ebbe={'appCode':_0x39f469,'deleted':![]};if(_0x191782?.[_0x25b533(0x182)])_0x73ebbe[_0x25b533(0x182)]=_0x191782[_0x25b533(0x182)];if(_0x191782?.[_0x25b533(0x15c)])_0x73ebbe[_0x25b533(0x15c)]=_0x191782[_0x25b533(0x15c)];const _0x2fcb7a=await apiRequest(_0x25b533(0x149),{'method':_0x25b533(0x198),'body':_0x73ebbe});return extractList(_0x2fcb7a['data']);}export async function searchDatasets(_0x525556,_0x474892){const _0x1cef74=a74_0x2e0d,_0xf25e63=await listDatasets(_0x525556,{'name':_0x474892}),_0x46c729=_0x474892[_0x1cef74(0x17a)](),_0x5b639a=new Set(_0xf25e63['map'](_0x1c6e0b=>_0x1c6e0b['id'])),_0x2eafb1=_0xf25e63[_0x1cef74(0x166)](_0x4d15bb=>_0x4d15bb[_0x1cef74(0x13b)]?.[_0x1cef74(0x169)]?.[_0x1cef74(0x17a)]()['includes'](_0x46c729)||_0x4d15bb[_0x1cef74(0x186)]?.[_0x1cef74(0x17a)]()['includes'](_0x46c729)),_0x1a7f1d=await listDatasets(_0x525556,{'code':_0x474892});for(const _0x3c1d94 of _0x1a7f1d){!_0x5b639a[_0x1cef74(0x14a)](_0x3c1d94['id'])&&(_0xf25e63[_0x1cef74(0x181)](_0x3c1d94),_0x5b639a[_0x1cef74(0x171)](_0x3c1d94['id']));}return _0xf25e63;}export function normalizeDatasetOperations(_0x2557c1){const _0x2b6d84=a74_0x2e0d;if(Array[_0x2b6d84(0x17e)](_0x2557c1))return _0x2557c1[_0x2b6d84(0x166)](_0x491576=>_0x491576!=null&&typeof _0x491576==='object');if(_0x2557c1&&typeof _0x2557c1===_0x2b6d84(0x143))return Object[_0x2b6d84(0x133)](_0x2557c1)[_0x2b6d84(0x166)](([,_0x5d6e69])=>_0x5d6e69!=null&&typeof _0x5d6e69==='object')[_0x2b6d84(0x170)](([_0x5d6863,_0x1b6d25])=>({..._0x1b6d25,'name':_0x1b6d25[_0x2b6d84(0x15c)]??_0x1b6d25[_0x2b6d84(0x157)]??_0x5d6863}));return[];}export async function getDatasetDetail(_0x167933){const _0x1a5de8=a74_0x2e0d,_0x4d9ea3=/^\d+$/['test'](_0x167933)?'id':_0x1a5de8(0x182),_0x2f3835=await apiRequest(_0x1a5de8(0x14c)+_0x4d9ea3+'='+_0x167933);return _0x2f3835[_0x1a5de8(0x141)];}export async function getDatasetOperations(_0x411200){const _0x7bb73e=a74_0x2e0d,_0x1aced9=await getDatasetDetail(_0x411200),_0xa74a7=normalizeDatasetOperations(_0x1aced9[_0x7bb73e(0x178)])[_0x7bb73e(0x170)](_0x4ff767=>({'name':_0x4ff767['name']||_0x4ff767['operationName'],'displayName':_0x4ff767[_0x7bb73e(0x14e)]||_0x4ff767[_0x7bb73e(0x15c)],'type':_0x4ff767['type'],'method':_0x4ff767[_0x7bb73e(0x13f)],'path':_0x4ff767[_0x7bb73e(0x15d)],'enabled':_0x4ff767[_0x7bb73e(0x18b)]??!![],'requestFields':_0x4ff767[_0x7bb73e(0x158)],'responseFields':_0x4ff767[_0x7bb73e(0x13d)]}));return{'dataset':{'id':_0x1aced9['id']??_0x1aced9[_0x7bb73e(0x163)],'name':_0x1aced9[_0x7bb73e(0x15c)],'code':_0x1aced9[_0x7bb73e(0x182)]||_0x1aced9['modelCode'],'tableName':_0x1aced9[_0x7bb73e(0x169)]||_0x1aced9[_0x7bb73e(0x13b)]?.['tableName']},'operations':_0xa74a7};}export async function getOperationDetail(_0x34cfce,_0x53b582,_0x12c806){const _0xbba63b=a74_0x2e0d;let _0x4bc2e5=_0x53b582;if(!/^\d+$/[_0xbba63b(0x17d)](_0x53b582)){const _0x4bfadd=await listDatasets(_0x34cfce,{'code':_0x53b582}),_0x470572=_0x4bfadd[_0xbba63b(0x196)](_0x2d91dd=>_0x2d91dd[_0xbba63b(0x182)]===_0x53b582||String(_0x2d91dd['id'])===_0x53b582);if(!_0x470572)throw CliErrors[_0xbba63b(0x18e)]('Dataset\x20not\x20found:\x20'+_0x53b582);_0x4bc2e5=String(_0x470572['id']);}const _0x5c1a8d=await getDatasetDetail(_0x4bc2e5),_0x47ac37=normalizeDatasetOperations(_0x5c1a8d[_0xbba63b(0x178)])['find'](_0x3ec57d=>(_0x3ec57d[_0xbba63b(0x15c)]||_0x3ec57d['operationName'])===_0x12c806);if(!_0x47ac37)throw CliErrors[_0xbba63b(0x18e)]('Operation\x20\x22'+_0x12c806+'\x22\x20not\x20found\x20in\x20dataset\x20'+_0x53b582);return{'dataset':{'id':_0x5c1a8d['id']??_0x5c1a8d[_0xbba63b(0x163)],'name':_0x5c1a8d['name'],'code':_0x5c1a8d[_0xbba63b(0x182)]||_0x5c1a8d[_0xbba63b(0x15f)],'tableName':_0x5c1a8d[_0xbba63b(0x169)]||_0x5c1a8d[_0xbba63b(0x13b)]?.[_0xbba63b(0x169)]},'operation':_0x47ac37};}function a74_0x50a0(){const _0x3c5321=['delete','tableName','errorMsg','currentPage','stringify','join','/api/management/library/scripts/list?appCode=','create','map','add','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','1502124gRrTbS','json','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','579UGWqwi','3997XpCtCy','operations','\x20\x20pageSize:\x2020,','toLowerCase','cli:rabetbase','errorCode','test','isArray','pageSize','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','push','code','17112IWNwpX','});','API\x20error:\x20','description','/api/node-toolbox/sql/save','//\x20','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','sqlName','enabled','1764669ZxHZas','sqlCode','validation','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','\x20\x20return\x20rows;','replace','if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);','1693220GKGTQJ','63zPRpXs','14pYyozj','find','88prUPjW','POST','10932GgqrQs','update','signal','const\x20data\x20=\x20await\x20client.sql.execute({','entries','functionName','target','success','const\x20result\x20=\x20await\x20client.models.','\x20\x20\x20\x20sqlCode:\x20\x27','1348fqrUBN','remove','dbtableConfig','4390DmCDLL','responseFields','application/json','method','API\x20error\x20code:\x20','data','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','object','.remove(id);','.filter({','.create({\x20/*\x20fields\x20*/\x20});','22194289xDIiBi','apiError','/smartapi/dataset/get-dataset-list','has','//\x20SQL:\x20','/smartapi/dataset/get-driven-data?','Request\x20timeout:\x20','displayName','scriptName','BFF\x20script\x20not\x20found:\x20id=','includeImports','/api/custom/executeSql','4hZtnvS','(/*\x20params\x20*/);','/api/management/library/scripts/delete','status','operationName','requestFields','GET','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','abort','name','path','const\x20results\x20=\x20data.execResult\x20||\x20[];','modelCode','includes','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','AbortError','modelId','.getOne(id);','\x20\x20currentPage:\x201,','filter','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});'];a74_0x50a0=function(){return _0x3c5321;};return a74_0x50a0();}export function generateSdkCode(_0xf76317,_0x3e7c41,_0x14ba98){const _0x21caff=a74_0x2e0d,_0x403395=_0x14ba98?.[_0x21caff(0x151)]??!![],_0x2cfe14='dataset_'+_0xf76317['code']?.[_0x21caff(0x191)](/-/g,'_'),_0x4c25c4=_0x3e7c41['name']||_0x3e7c41['operationName']||_0x21caff(0x166),_0x2eeaf7=[];_0x403395&&_0x2eeaf7[_0x21caff(0x181)](_0x21caff(0x142),'',_0x21caff(0x167),'');_0x2eeaf7['push'](_0x21caff(0x188)+_0xf76317[_0x21caff(0x15c)]+'\x20('+(_0xf76317[_0x21caff(0x169)]||'table')+')');if(_0x4c25c4==='filter')_0x2eeaf7[_0x21caff(0x181)]('const\x20result\x20=\x20await\x20client.models.'+_0x2cfe14+_0x21caff(0x145),'\x20\x20where:\x20{},',_0x21caff(0x179),_0x21caff(0x165),_0x21caff(0x184));else{if(_0x4c25c4==='getOne')_0x2eeaf7[_0x21caff(0x181)](_0x21caff(0x137)+_0x2cfe14+_0x21caff(0x164));else{if(_0x4c25c4===_0x21caff(0x16f))_0x2eeaf7[_0x21caff(0x181)]('const\x20result\x20=\x20await\x20client.models.'+_0x2cfe14+_0x21caff(0x146));else{if(_0x4c25c4===_0x21caff(0x19a))_0x2eeaf7[_0x21caff(0x181)]('const\x20result\x20=\x20await\x20client.models.'+_0x2cfe14+_0x21caff(0x172));else _0x4c25c4===_0x21caff(0x168)||_0x4c25c4===_0x21caff(0x13a)?_0x2eeaf7['push'](_0x21caff(0x137)+_0x2cfe14+_0x21caff(0x144)):_0x2eeaf7[_0x21caff(0x181)]('const\x20result\x20=\x20await\x20client.models.'+_0x2cfe14+'.'+_0x4c25c4+_0x21caff(0x154));}}}return _0x2eeaf7[_0x21caff(0x16d)]('\x0a');}export function generateSqlCodeTemplate(_0x3e3178,_0xa8d798){const _0x4f21ca=a74_0x2e0d,_0x2fea8e=_0xa8d798?.[_0x4f21ca(0x135)]??'sdk',_0x40c56d=_0xa8d798?.[_0x4f21ca(0x151)]??!![],_0x16e14a=[];return _0x16e14a[_0x4f21ca(0x181)](_0x4f21ca(0x14b)+_0x3e3178[_0x4f21ca(0x18a)]+'\x20('+_0x3e3178['sqlCode']+')'),_0x2fea8e==='sdk'?(_0x40c56d&&_0x16e14a['push']('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x4f21ca(0x167),''),_0x16e14a[_0x4f21ca(0x181)](_0x4f21ca(0x132),'\x20\x20sqlCode:\x20\x27'+_0x3e3178[_0x4f21ca(0x18d)]+'\x27,',_0x4f21ca(0x189),_0x4f21ca(0x184),_0x4f21ca(0x192),_0x4f21ca(0x15e))):_0x16e14a[_0x4f21ca(0x181)](_0x4f21ca(0x161),_0x4f21ca(0x175),_0x4f21ca(0x180),_0x4f21ca(0x138)+_0x3e3178['sqlCode']+'\x27,','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','\x20\x20});',_0x4f21ca(0x190),'}'),_0x16e14a['join']('\x0a');}export async function getErConfig(_0x4a4d44,_0x3bf3e1){const _0x140419=a74_0x2e0d,_0x394546=await apiRequest('/smartapi/question/er-config',{'method':'POST','body':{'appCode':_0x4a4d44,'dblinkId':_0x3bf3e1}});return _0x394546[_0x140419(0x141)];}
|
|
1
|
+
(function(_0x48bdb2,_0x36a698){const _0x3d93fb=a76_0x5f3c,_0x5a17eb=_0x48bdb2();while(!![]){try{const _0xef7c10=-parseInt(_0x3d93fb(0x249))/0x1+-parseInt(_0x3d93fb(0x1ff))/0x2*(parseInt(_0x3d93fb(0x200))/0x3)+parseInt(_0x3d93fb(0x1ea))/0x4*(parseInt(_0x3d93fb(0x20e))/0x5)+parseInt(_0x3d93fb(0x1ed))/0x6*(-parseInt(_0x3d93fb(0x240))/0x7)+-parseInt(_0x3d93fb(0x223))/0x8+parseInt(_0x3d93fb(0x237))/0x9*(-parseInt(_0x3d93fb(0x207))/0xa)+parseInt(_0x3d93fb(0x241))/0xb*(parseInt(_0x3d93fb(0x1f8))/0xc);if(_0xef7c10===_0x36a698)break;else _0x5a17eb['push'](_0x5a17eb['shift']());}catch(_0x354bc8){_0x5a17eb['push'](_0x5a17eb['shift']());}}}(a76_0x4135,0x533d6));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain,getRuntimeDomain}from'../constant/domain.js';import{CliErrors}from'../errors.js';import{extractList}from'../framework/response.js';let _activeCookie;export function setActiveCookie(_0x48df17){_activeCookie=_0x48df17||undefined;}export function clearActiveCookie(){_activeCookie=undefined;}async function apiRequest(_0x566867,_0x15c924={}){const _0x3020cf=a76_0x5f3c,{method:method='GET',body:_0x4a125b,headers:headers={},timeout:timeout=0x7530,useRuntime:useRuntime=![]}=_0x15c924,_0x5edb83=useRuntime?getRuntimeDomain():getApiDomain(),_0x4a8956=_activeCookie||getCookie(),_0x498b84=''+_0x5edb83+_0x566867,_0x31c5d8=new AbortController(),_0x13f4a9=setTimeout(()=>_0x31c5d8[_0x3020cf(0x1ee)](),timeout);try{const _0x3cfcd7=await fetch(_0x498b84,{'method':method,'headers':{'Content-Type':_0x3020cf(0x21b),'Cookie':_0x4a8956,'X-Invoke-Source':_0x3020cf(0x229),...headers},'body':_0x4a125b?JSON[_0x3020cf(0x245)](_0x4a125b):undefined,'signal':_0x31c5d8[_0x3020cf(0x208)]});let _0x1c76a3;try{_0x1c76a3=await _0x3cfcd7['json']();}catch{throw CliErrors[_0x3020cf(0x230)](_0x3020cf(0x1e2)+_0x3cfcd7[_0x3020cf(0x22a)]+')',_0x3cfcd7['status']>=0x190?_0x3020cf(0x1f1):undefined);}if(!_0x3cfcd7['ok']||_0x1c76a3[_0x3020cf(0x216)]===![])throw CliErrors[_0x3020cf(0x230)](_0x1c76a3[_0x3020cf(0x238)]||_0x1c76a3['message']||_0x3020cf(0x247)+_0x3cfcd7[_0x3020cf(0x22a)],_0x1c76a3[_0x3020cf(0x242)]?_0x3020cf(0x20d)+_0x1c76a3['errorCode']:undefined);return _0x1c76a3;}catch(_0x104c09){if(_0x104c09 instanceof Error&&_0x104c09[_0x3020cf(0x20b)]===_0x3020cf(0x251))throw CliErrors[_0x3020cf(0x230)](_0x3020cf(0x226)+_0x498b84);throw _0x104c09;}finally{clearTimeout(_0x13f4a9);}}function a76_0x4135(){const _0x26b2c6=['replace','});','(/*\x20params\x20*/);','//\x20','apiError','toLowerCase','modelCode','sdk','\x20\x20currentPage:\x201,','/smartapi/dataset/get-dataset-operation','const\x20result\x20=\x20await\x20client.models.','18YQsJzz','errorMsg','validation','pageSize','.create({\x20/*\x20fields\x20*/\x20});','Operation\x20\x22','const\x20results\x20=\x20data.execResult\x20||\x20[];','includes','description','266XceauM','14258783VLSmxY','errorCode','create','\x20\x20const\x20rows\x20=\x20await\x20context.client.sql.execute({','stringify','test','API\x20error:\x20','tableData','537150QQJFrV','tableName','/api/management/library/scripts/statistics?appCode=','getOne','.remove(id);','/api/node-toolbox/sql/save','/api/management/library/scripts/delete','object','AbortError','API\x20returned\x20non-JSON\x20response\x20(HTTP\x20','\x20\x20where:\x20{},','/smartapi/custom/queryUserCustomSqlList','scriptName','\x20\x20sqlCode:\x20\x27','target','sqlCode','data','11944TrLeqL','\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','sqlName','1884Iridgi','abort','modelId','operationName','Check\x20your\x20auth\x20cookie\x20and\x20try\x20again.','export\x20default\x20async\x20function\x20handler(params,\x20context)\x20{','//\x20BFF\x20context:\x20context.client.sql.execute\x20returns\x20rows\x20directly','enabled','push','//\x20SQL:\x20','includeImports','12kNhyfw','responseFields','\x20\x20\x20\x20sqlCode:\x20\x27','path','has','const\x20client\x20=\x20new\x20LovrabetClient({\x20appCode:\x20\x27<YOUR_APP_CODE>\x27\x20});','/api/management/library/scripts/list?appCode=','1056492dJQloJ','3bqyWvC','entries','filter','type','POST','code','delete','125780kQtKtr','signal','.filter({','BFF\x20script\x20not\x20found:\x20id=','name','\x20\x20return\x20rows;','API\x20error\x20code:\x20','595mRpGiz','join','/api/custom/executeSql','.update(id,\x20{\x20/*\x20fields\x20*/\x20});','/smartapi/dataset/get-dataset-list','map','/api/management/library/scripts/save','update','success','/smartapi/question/er-config','find','requestFields','/smartapi/dataset/get-driven-data?','application/json','const\x20data\x20=\x20await\x20client.sql.execute({','/api/management/library/scripts/info?id=','SQL\x20query\x20not\x20found:\x20','method','dataset_','add','\x20\x20\x20\x20params:\x20{\x20/*\x20parameter\x20values\x20*/\x20},','1665224lUQUjy','functionName','\x22\x20not\x20found\x20in\x20dataset\x20','Request\x20timeout:\x20','isArray','displayName','cli:rabetbase','status','import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;'];a76_0x4135=function(){return _0x26b2c6;};return a76_0x4135();}export async function listBffScripts(_0x190b67,_0x295147,_0x14c2f7){const _0x419860=a76_0x5f3c;let _0x14b3b2=_0x419860(0x1fe)+_0x190b67;if(_0x295147)_0x14b3b2+='&type='+_0x295147;const _0x40eda1=await apiRequest(_0x14b3b2);let _0xdddd9e=extractList(_0x40eda1[_0x419860(0x1e9)]);if(_0x14c2f7?.['scriptName']){const _0x53d398=_0x14c2f7[_0x419860(0x1e5)][_0x419860(0x231)]();_0xdddd9e=_0xdddd9e[_0x419860(0x202)](_0x57320f=>_0x57320f[_0x419860(0x224)]?.[_0x419860(0x231)]()['includes'](_0x53d398)||_0x57320f[_0x419860(0x23f)]?.[_0x419860(0x231)]()[_0x419860(0x23e)](_0x53d398));}return _0xdddd9e;}export async function getBffScriptInfo(_0x4e60cb){const _0x149107=a76_0x5f3c,_0x5d55aa=await apiRequest(_0x149107(0x21d)+_0x4e60cb);if(!_0x5d55aa[_0x149107(0x1e9)])throw CliErrors[_0x149107(0x239)](_0x149107(0x20a)+_0x4e60cb);return _0x5d55aa[_0x149107(0x1e9)];}export async function saveBffScript(_0x2e7d86){const _0x2ab4b2=a76_0x5f3c,_0x48bf42=await apiRequest(_0x2ab4b2(0x214),{'method':_0x2ab4b2(0x204),'body':_0x2e7d86});return _0x48bf42['data'];}export async function deleteBffScript(_0x47da57){const _0x4b7e07=a76_0x5f3c;await apiRequest(_0x4b7e07(0x24f),{'method':_0x4b7e07(0x204),'body':{'id':_0x47da57}});}export async function getBffScriptStatistics(_0x553f10){const _0x37f5eb=a76_0x5f3c,_0x362dd7=await apiRequest(_0x37f5eb(0x24b)+_0x553f10);return extractList(_0x362dd7['data']);}export async function listBffDatasetOperations(_0x15c39b,_0x32625e){const _0x13886e=a76_0x5f3c,_0x5033cd=await apiRequest(_0x13886e(0x235),{'method':_0x13886e(0x204),'body':{'appCode':_0x15c39b,'datasetId':_0x32625e}});return _0x5033cd[_0x13886e(0x1e9)];}export async function listSqlQueries(_0x3ab629,_0x176d76){const _0x29fc41=a76_0x5f3c,_0x38eaab=await apiRequest(_0x29fc41(0x1e4),{'method':_0x29fc41(0x204),'body':{'appCode':_0x3ab629,'currentPage':_0x176d76?.['currentPage']??0x1,'pageSize':_0x176d76?.[_0x29fc41(0x23a)]??0x32,'sqlCode':_0x176d76?.[_0x29fc41(0x1e8)],'sqlName':_0x176d76?.['sqlName']}});return _0x38eaab[_0x29fc41(0x1e9)];}export async function getSqlQueryInfo(_0x163c7d,_0xda3e98){const _0x49b7ed=a76_0x5f3c,_0x3581f4=await listSqlQueries(_0x163c7d,{'sqlCode':_0xda3e98}),_0x42d817=_0x3581f4[_0x49b7ed(0x248)]?.[0x0];if(!_0x42d817)throw CliErrors[_0x49b7ed(0x239)](_0x49b7ed(0x21e)+_0xda3e98);return _0x42d817;}export async function saveSqlQuery(_0x48c68f){const _0x295a93=a76_0x5f3c,_0x1bf2e9=await apiRequest(_0x295a93(0x24e),{'method':_0x295a93(0x204),'body':_0x48c68f});return _0x1bf2e9[_0x295a93(0x1e9)];}export async function executeSql(_0x371970,_0x8ad576,_0x15cfdc){const _0x2b8e02=a76_0x5f3c,_0x28648c=await apiRequest(_0x2b8e02(0x210),{'method':_0x2b8e02(0x204),'body':{'appCode':_0x371970,'sqlCode':_0x8ad576,..._0x15cfdc&&{'params':_0x15cfdc}},'useRuntime':!![]});return _0x28648c[_0x2b8e02(0x1e9)];}export async function listDatasets(_0x2f3d7b,_0x2db51f){const _0x954d7e=a76_0x5f3c,_0x22e9d7={'appCode':_0x2f3d7b,'deleted':![]};if(_0x2db51f?.[_0x954d7e(0x205)])_0x22e9d7[_0x954d7e(0x205)]=_0x2db51f['code'];if(_0x2db51f?.[_0x954d7e(0x20b)])_0x22e9d7[_0x954d7e(0x20b)]=_0x2db51f['name'];const _0x56d202=await apiRequest(_0x954d7e(0x212),{'method':'POST','body':_0x22e9d7});return extractList(_0x56d202[_0x954d7e(0x1e9)]);}export async function searchDatasets(_0xac3ab8,_0x1602ca){const _0x23d0da=a76_0x5f3c,_0x36d5b1=await listDatasets(_0xac3ab8,{'name':_0x1602ca}),_0x5749b6=_0x1602ca[_0x23d0da(0x231)](),_0x13b562=new Set(_0x36d5b1['map'](_0x446f10=>_0x446f10['id'])),_0x3d86f7=_0x36d5b1[_0x23d0da(0x202)](_0x1e8828=>_0x1e8828['dbtableConfig']?.[_0x23d0da(0x24a)]?.[_0x23d0da(0x231)]()[_0x23d0da(0x23e)](_0x5749b6)||_0x1e8828[_0x23d0da(0x23f)]?.['toLowerCase']()[_0x23d0da(0x23e)](_0x5749b6)),_0x421ebb=await listDatasets(_0xac3ab8,{'code':_0x1602ca});for(const _0x19b88d of _0x421ebb){!_0x13b562[_0x23d0da(0x1fc)](_0x19b88d['id'])&&(_0x36d5b1[_0x23d0da(0x1f5)](_0x19b88d),_0x13b562[_0x23d0da(0x221)](_0x19b88d['id']));}return _0x36d5b1;}export function normalizeDatasetOperations(_0x2c1119){const _0x5e5043=a76_0x5f3c;if(Array[_0x5e5043(0x227)](_0x2c1119))return _0x2c1119[_0x5e5043(0x202)](_0x39f339=>_0x39f339!=null&&typeof _0x39f339==='object');if(_0x2c1119&&typeof _0x2c1119===_0x5e5043(0x250))return Object[_0x5e5043(0x201)](_0x2c1119)[_0x5e5043(0x202)](([,_0x37a5ec])=>_0x37a5ec!=null&&typeof _0x37a5ec===_0x5e5043(0x250))[_0x5e5043(0x213)](([_0x2218dc,_0x50fcb4])=>({..._0x50fcb4,'name':_0x50fcb4[_0x5e5043(0x20b)]??_0x50fcb4[_0x5e5043(0x1f0)]??_0x2218dc}));return[];}export async function getDatasetDetail(_0x183161){const _0x1849fb=a76_0x5f3c,_0x41ab98=/^\d+$/[_0x1849fb(0x246)](_0x183161)?'id':_0x1849fb(0x205),_0x3df61f=await apiRequest(_0x1849fb(0x21a)+_0x41ab98+'='+_0x183161);return _0x3df61f[_0x1849fb(0x1e9)];}function a76_0x5f3c(_0x2d12b7,_0x2341e3){_0x2d12b7=_0x2d12b7-0x1e2;const _0x413538=a76_0x4135();let _0x5f3cab=_0x413538[_0x2d12b7];return _0x5f3cab;}export async function getDatasetOperations(_0x585574){const _0x5f2bd4=a76_0x5f3c,_0x4fed33=await getDatasetDetail(_0x585574),_0x1914df=normalizeDatasetOperations(_0x4fed33['operations'])[_0x5f2bd4(0x213)](_0x52b2bd=>({'name':_0x52b2bd[_0x5f2bd4(0x20b)]||_0x52b2bd['operationName'],'displayName':_0x52b2bd[_0x5f2bd4(0x228)]||_0x52b2bd['name'],'type':_0x52b2bd[_0x5f2bd4(0x203)],'method':_0x52b2bd[_0x5f2bd4(0x21f)],'path':_0x52b2bd[_0x5f2bd4(0x1fb)],'enabled':_0x52b2bd[_0x5f2bd4(0x1f4)]??!![],'requestFields':_0x52b2bd[_0x5f2bd4(0x219)],'responseFields':_0x52b2bd[_0x5f2bd4(0x1f9)]}));return{'dataset':{'id':_0x4fed33['id']??_0x4fed33[_0x5f2bd4(0x1ef)],'name':_0x4fed33[_0x5f2bd4(0x20b)],'code':_0x4fed33[_0x5f2bd4(0x205)]||_0x4fed33[_0x5f2bd4(0x232)],'tableName':_0x4fed33['tableName']||_0x4fed33['dbtableConfig']?.[_0x5f2bd4(0x24a)]},'operations':_0x1914df};}export async function getOperationDetail(_0x1f8da3,_0x476a20,_0x316b80){const _0x4ec502=a76_0x5f3c;let _0x492f9e=_0x476a20;if(!/^\d+$/[_0x4ec502(0x246)](_0x476a20)){const _0x169039=await listDatasets(_0x1f8da3,{'code':_0x476a20}),_0x1cb500=_0x169039[_0x4ec502(0x218)](_0x52ab9e=>_0x52ab9e['code']===_0x476a20||String(_0x52ab9e['id'])===_0x476a20);if(!_0x1cb500)throw CliErrors[_0x4ec502(0x239)]('Dataset\x20not\x20found:\x20'+_0x476a20);_0x492f9e=String(_0x1cb500['id']);}const _0x554bce=await getDatasetDetail(_0x492f9e),_0x1e535b=normalizeDatasetOperations(_0x554bce['operations'])[_0x4ec502(0x218)](_0x2119b9=>(_0x2119b9[_0x4ec502(0x20b)]||_0x2119b9[_0x4ec502(0x1f0)])===_0x316b80);if(!_0x1e535b)throw CliErrors[_0x4ec502(0x239)](_0x4ec502(0x23c)+_0x316b80+_0x4ec502(0x225)+_0x476a20);return{'dataset':{'id':_0x554bce['id']??_0x554bce['modelId'],'name':_0x554bce[_0x4ec502(0x20b)],'code':_0x554bce['code']||_0x554bce['modelCode'],'tableName':_0x554bce[_0x4ec502(0x24a)]||_0x554bce['dbtableConfig']?.[_0x4ec502(0x24a)]},'operation':_0x1e535b};}export function generateSdkCode(_0x484703,_0x597dbb,_0x469649){const _0x359f4c=a76_0x5f3c,_0x2d8501=_0x469649?.[_0x359f4c(0x1f7)]??!![],_0x563c34=_0x359f4c(0x220)+_0x484703[_0x359f4c(0x205)]?.[_0x359f4c(0x22c)](/-/g,'_'),_0x5803db=_0x597dbb[_0x359f4c(0x20b)]||_0x597dbb[_0x359f4c(0x1f0)]||_0x359f4c(0x202),_0x144095=[];_0x2d8501&&_0x144095[_0x359f4c(0x1f5)](_0x359f4c(0x22b),'',_0x359f4c(0x1fd),'');_0x144095[_0x359f4c(0x1f5)](_0x359f4c(0x22f)+_0x484703['name']+'\x20('+(_0x484703[_0x359f4c(0x24a)]||'table')+')');if(_0x5803db===_0x359f4c(0x202))_0x144095[_0x359f4c(0x1f5)](_0x359f4c(0x236)+_0x563c34+_0x359f4c(0x209),_0x359f4c(0x1e3),'\x20\x20pageSize:\x2020,',_0x359f4c(0x234),_0x359f4c(0x22d));else{if(_0x5803db===_0x359f4c(0x24c))_0x144095[_0x359f4c(0x1f5)]('const\x20result\x20=\x20await\x20client.models.'+_0x563c34+'.getOne(id);');else{if(_0x5803db===_0x359f4c(0x243))_0x144095[_0x359f4c(0x1f5)](_0x359f4c(0x236)+_0x563c34+_0x359f4c(0x23b));else{if(_0x5803db===_0x359f4c(0x215))_0x144095['push'](_0x359f4c(0x236)+_0x563c34+_0x359f4c(0x211));else _0x5803db===_0x359f4c(0x206)||_0x5803db==='remove'?_0x144095['push'](_0x359f4c(0x236)+_0x563c34+_0x359f4c(0x24d)):_0x144095[_0x359f4c(0x1f5)]('const\x20result\x20=\x20await\x20client.models.'+_0x563c34+'.'+_0x5803db+_0x359f4c(0x22e));}}}return _0x144095['join']('\x0a');}export function generateSqlCodeTemplate(_0x2c86a7,_0x769dc7){const _0x2e713a=a76_0x5f3c,_0x46b6e2=_0x769dc7?.[_0x2e713a(0x1e7)]??'sdk',_0x1c1d89=_0x769dc7?.['includeImports']??!![],_0x8d0281=[];return _0x8d0281[_0x2e713a(0x1f5)](_0x2e713a(0x1f6)+_0x2c86a7[_0x2e713a(0x1ec)]+'\x20('+_0x2c86a7['sqlCode']+')'),_0x46b6e2===_0x2e713a(0x233)?(_0x1c1d89&&_0x8d0281['push']('import\x20{\x20LovrabetClient\x20}\x20from\x20\x27@lovrabet/sdk\x27;','',_0x2e713a(0x1fd),''),_0x8d0281['push'](_0x2e713a(0x21c),_0x2e713a(0x1e6)+_0x2c86a7[_0x2e713a(0x1e8)]+'\x27,',_0x2e713a(0x1eb),_0x2e713a(0x22d),'if\x20(!data.execSuccess)\x20throw\x20new\x20Error(\x27SQL\x20execution\x20failed\x27);',_0x2e713a(0x23d))):_0x8d0281['push'](_0x2e713a(0x1f3),_0x2e713a(0x1f2),_0x2e713a(0x244),_0x2e713a(0x1fa)+_0x2c86a7['sqlCode']+'\x27,',_0x2e713a(0x222),'\x20\x20});',_0x2e713a(0x20c),'}'),_0x8d0281[_0x2e713a(0x20f)]('\x0a');}export async function getErConfig(_0x39572b,_0x1a58cf){const _0x591ee4=a76_0x5f3c,_0x1c64de=await apiRequest(_0x591ee4(0x217),{'method':'POST','body':{'appCode':_0x39572b,'dblinkId':_0x1a58cf}});return _0x1c64de[_0x591ee4(0x1e9)];}
|
package/lib/core/bff/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a77_0x2d83c6=a77_0x39c7;(function(_0x527d70,_0x3f6782){const _0x261895=a77_0x39c7,_0x2552af=_0x527d70();while(!![]){try{const _0x3d3667=parseInt(_0x261895(0x190))/0x1*(parseInt(_0x261895(0x185))/0x2)+parseInt(_0x261895(0x188))/0x3+-parseInt(_0x261895(0x187))/0x4+-parseInt(_0x261895(0x186))/0x5+parseInt(_0x261895(0x18a))/0x6*(parseInt(_0x261895(0x18b))/0x7)+-parseInt(_0x261895(0x189))/0x8*(parseInt(_0x261895(0x18d))/0x9)+parseInt(_0x261895(0x192))/0xa;if(_0x3d3667===_0x3f6782)break;else _0x2552af['push'](_0x2552af['shift']());}catch(_0x5a8f6c){_0x2552af['push'](_0x2552af['shift']());}}}(a77_0xbd5c,0x82c3b));import{resolve}from'node:path';function a77_0x39c7(_0x55cfc6,_0x581125){_0x55cfc6=_0x55cfc6-0x185;const _0xbd5cc4=a77_0xbd5c();let _0x39c7a7=_0xbd5cc4[_0x55cfc6];return _0x39c7a7;}const DOT_DIR=a77_0x2d83c6(0x191),LOCK_FILE_NAME='bff.lock.json',TRASH_DIR_NAME=a77_0x2d83c6(0x18f);function a77_0xbd5c(){const _0xfc7b51=['bff','18xFfyoO','/bff','bff-trash','78037nbhbFS','.rabetbase','2946350KnkRsJ','4jKUwBT','1407780jHFYTg','576100ZCLiPv','456084WyQmRz','1850912oeljFa','4927098pnTIPe','7RCCicK'];a77_0xbd5c=function(){return _0xfc7b51;};return a77_0xbd5c();}export function loadBffProjectConfig(_0x2195f4,_0x55eaee){const _0x57c82d=a77_0x2d83c6,_0x5aba28=resolve(_0x55eaee??process['cwd']()),_0x1fb819=DOT_DIR+_0x57c82d(0x18e),_0x881322=_0x1fb819+'/'+_0x2195f4;return{'projectRoot':_0x5aba28,'appCode':_0x2195f4,'scriptsBaseDir':DOT_DIR,'scriptsWorkspaceRoot':_0x1fb819,'scriptsRoot':_0x881322,'scriptsRootDir':resolve(_0x5aba28,DOT_DIR,_0x57c82d(0x18c),_0x2195f4),'lockFilePath':resolve(_0x5aba28,DOT_DIR,LOCK_FILE_NAME),'trashDir':resolve(_0x5aba28,DOT_DIR,TRASH_DIR_NAME)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a78_0x4b60e4=a78_0x3c19;(function(_0x387ffb,_0x5587f3){const _0x30e41a=a78_0x3c19,_0x556024=_0x387ffb();while(!![]){try{const _0x26eb8a=-parseInt(_0x30e41a(0x1f1))/0x1+-parseInt(_0x30e41a(0x1dd))/0x2+-parseInt(_0x30e41a(0x1d2))/0x3*(parseInt(_0x30e41a(0x1e9))/0x4)+parseInt(_0x30e41a(0x1e5))/0x5+-parseInt(_0x30e41a(0x1d8))/0x6*(parseInt(_0x30e41a(0x1ec))/0x7)+-parseInt(_0x30e41a(0x1d6))/0x8+-parseInt(_0x30e41a(0x1d0))/0x9*(-parseInt(_0x30e41a(0x1e6))/0xa);if(_0x26eb8a===_0x5587f3)break;else _0x556024['push'](_0x556024['shift']());}catch(_0x313b64){_0x556024['push'](_0x556024['shift']());}}}(a78_0x4b3f,0x31774));import{access,mkdir,readdir,stat}from'node:fs/promises';import{constants}from'node:fs';import{dirname,join}from'node:path';import{findHookLocationByRemoteId,snakeToCamel}from'./utils.js';export const SUPPORTED_BFF_TYPES=[a78_0x4b60e4(0x1f5),a78_0x4b60e4(0x1de),'HOOK'];export function normalizeBffType(_0x27ca58){const _0x3b70ff=a78_0x4b60e4;if(!_0x27ca58)return undefined;const _0x3226a1=_0x27ca58[_0x3b70ff(0x1f2)]()[_0x3b70ff(0x1d9)]();return SUPPORTED_BFF_TYPES[_0x3b70ff(0x1d1)](_0x3226a1)?_0x3226a1:undefined;}async function scanJsFilesRecursively(_0x564adf,_0x58d2cf){const _0x3c2401=a78_0x4b60e4,_0x26a64a=[];try{const _0x5eeb5c=await readdir(_0x564adf,{'withFileTypes':!![]});for(const _0x4106bd of _0x5eeb5c){const _0x5edb78=join(_0x564adf,_0x4106bd[_0x3c2401(0x1d4)]);if(_0x4106bd[_0x3c2401(0x1e3)]())_0x26a64a[_0x3c2401(0x1da)](...await scanJsFilesRecursively(_0x5edb78,_0x58d2cf+'/'+_0x4106bd['name']));else _0x4106bd[_0x3c2401(0x1df)]()&&_0x4106bd[_0x3c2401(0x1d4)][_0x3c2401(0x1db)](_0x3c2401(0x1d3))&&_0x26a64a[_0x3c2401(0x1da)]({'lockKey':_0x58d2cf+'/'+_0x4106bd[_0x3c2401(0x1d4)][_0x3c2401(0x1f4)](/\.js$/,''),'filePath':_0x5edb78});}}catch(_0x2565f1){if(_0x2565f1[_0x3c2401(0x1e4)]!==_0x3c2401(0x1f3))throw _0x2565f1;}return _0x26a64a;}async function scanFlatFunctions(_0x596c01,_0x1f9b8f){const _0x4820f5=a78_0x4b60e4,_0x2ced9f=join(_0x596c01['scriptsRootDir'],_0x1f9b8f),_0x3ee55a=await scanJsFilesRecursively(_0x2ced9f,_0x1f9b8f);return _0x3ee55a[_0x4820f5(0x1f7)](({lockKey:_0x3a4ba1,filePath:_0x5c2c62})=>({'type':_0x1f9b8f,'name':_0x3a4ba1[_0x4820f5(0x1e1)]('/')['at'](-0x1)??'','filePath':_0x5c2c62,'lockKey':_0x3a4ba1}));}async function scanHookFunctions(_0x549591){const _0x4f4952=a78_0x4b60e4,_0xf4186c=join(_0x549591[_0x4f4952(0x1f6)],_0x4f4952(0x1e7)),_0x33ca42=[];try{const _0xead5ae=await readdir(_0xf4186c,{'withFileTypes':!![]});for(const _0x68d7b of _0xead5ae){if(!_0x68d7b[_0x4f4952(0x1e3)]())continue;const _0x497af1=_0x68d7b['name'],_0x36d1b4=join(_0xf4186c,_0x497af1),_0x108062=await readdir(_0x36d1b4,{'withFileTypes':!![]});for(const _0x1f2427 of _0x108062){if(!_0x1f2427[_0x4f4952(0x1e3)]())continue;const _0x314790=_0x1f2427['name'],_0x38b0f0=join(_0x36d1b4,_0x314790),_0x3f295c=await readdir(_0x38b0f0,{'withFileTypes':!![]});for(const _0x116544 of _0x3f295c){if(!_0x116544[_0x4f4952(0x1e3)]())continue;const _0x2ad604=_0x116544[_0x4f4952(0x1d4)],_0xc08330=join(_0x38b0f0,_0x2ad604),_0x1191aa=await readdir(_0xc08330,{'withFileTypes':!![]});for(const _0x52c268 of _0x1191aa){if(!_0x52c268[_0x4f4952(0x1df)]()||!_0x52c268[_0x4f4952(0x1d4)][_0x4f4952(0x1db)]('.js'))continue;const _0x17ba94=_0x52c268[_0x4f4952(0x1d4)][_0x4f4952(0x1f4)](/\.js$/,'');_0x33ca42[_0x4f4952(0x1da)]({'type':'HOOK','name':_0x17ba94,'filePath':join(_0xc08330,_0x52c268['name']),'lockKey':'HOOK/'+_0x497af1+'/'+_0x314790+'/'+_0x2ad604+'/'+_0x17ba94,'alias':_0x497af1,'operationType':_0x314790,'functionNode':_0x2ad604});}}}}}catch(_0x10c58e){if(_0x10c58e['code']!==_0x4f4952(0x1f3))throw _0x10c58e;}return _0x33ca42;}export async function scanLocalBffFunctions(_0x2ad796,_0x424e58){const _0x873f2b=a78_0x4b60e4;if(_0x424e58==='COMMON'||_0x424e58===_0x873f2b(0x1de))return scanFlatFunctions(_0x2ad796,_0x424e58);if(_0x424e58===_0x873f2b(0x1e7))return scanHookFunctions(_0x2ad796);const [_0x226126,_0x4c0ca2,_0xabe450]=await Promise[_0x873f2b(0x1dc)]([scanFlatFunctions(_0x2ad796,_0x873f2b(0x1f5)),scanFlatFunctions(_0x2ad796,_0x873f2b(0x1de)),scanHookFunctions(_0x2ad796)]);return[..._0x226126,..._0x4c0ca2,..._0xabe450];}export function resolveLocalFilePathFromLockKey(_0x5d89fd,_0x573d49){const _0x12e032=a78_0x4b60e4;return join(_0x5d89fd[_0x12e032(0x1f6)],..._0x573d49[_0x12e032(0x1e1)]('/'))+_0x12e032(0x1d3);}function a78_0x4b3f(){const _0x27f764=['name','afterScriptId','1836496eAZnAq','functionName','694542PyehGF','toUpperCase','push','endsWith','all','696002BEjnkw','ENDPOINT','isFile','functionNode','split','operationType','isDirectory','code','981005EHSSOh','12623210FIcGXq','HOOK','alias','4AoDbIQ','beforeScriptId','set','14NUPOZi','datasetCode','HOOK/','scriptType','get','141082awDJIe','trim','ENOENT','replace','COMMON','scriptsRootDir','map','9nOiGyu','includes','917253mAoIKS','.js'];a78_0x4b3f=function(){return _0x27f764;};return a78_0x4b3f();}export function createHookLocationMap(_0x9fcc9f){const _0x4cef01=a78_0x4b60e4,_0x4d9245=new Map();for(const _0x3f8a32 of _0x9fcc9f){_0x3f8a32[_0x4cef01(0x1ea)]&&_0x4d9245[_0x4cef01(0x1eb)](_0x3f8a32[_0x4cef01(0x1ea)],{'datasetCode':_0x3f8a32[_0x4cef01(0x1ed)],'operationType':snakeToCamel(_0x3f8a32[_0x4cef01(0x1e2)]),'functionNode':'before'}),_0x3f8a32[_0x4cef01(0x1d5)]&&_0x4d9245[_0x4cef01(0x1eb)](_0x3f8a32[_0x4cef01(0x1d5)],{'datasetCode':_0x3f8a32[_0x4cef01(0x1ed)],'operationType':snakeToCamel(_0x3f8a32[_0x4cef01(0x1e2)]),'functionNode':'after'});}return _0x4d9245;}function a78_0x3c19(_0x55705c,_0x164190){_0x55705c=_0x55705c-0x1d0;const _0x4b3f6b=a78_0x4b3f();let _0x3c1918=_0x4b3f6b[_0x55705c];return _0x3c1918;}export function resolveRemoteScriptTarget(_0xc1f618,_0x2c0452,_0xff6929,_0x4bed9b,_0x275df6){const _0x5d43d8=a78_0x4b60e4,_0x47322d=normalizeBffType(_0x2c0452[_0x5d43d8(0x1ef)]);if(!_0x47322d||!_0x2c0452['functionName'])return null;if(_0x47322d===_0x5d43d8(0x1e7)){const _0x4f0e6d=(_0x2c0452['id']?_0xff6929['get'](_0x2c0452['id']):undefined)??findHookLocationByRemoteId(_0x4bed9b,_0x2c0452['id']);if(!_0x4f0e6d)return null;const _0x4539d2=_0x4f0e6d[_0x5d43d8(0x1e8)]||_0x275df6[_0x5d43d8(0x1f0)](_0x4f0e6d[_0x5d43d8(0x1ed)]),_0x2a4092=_0x4539d2??_0x4f0e6d[_0x5d43d8(0x1ed)],_0x1d963d={..._0x4f0e6d,'alias':_0x4539d2},_0x231c7c=_0x5d43d8(0x1ee)+_0x2a4092+'/'+_0x1d963d[_0x5d43d8(0x1e2)]+'/'+_0x1d963d[_0x5d43d8(0x1e0)]+'/'+_0x2c0452[_0x5d43d8(0x1d7)];return{'lockKey':_0x231c7c,'filePath':resolveLocalFilePathFromLockKey(_0xc1f618,_0x231c7c),'type':_0x5d43d8(0x1e7),'hookLocation':_0x1d963d};}const _0x14075f=_0x47322d+'/'+_0x2c0452[_0x5d43d8(0x1d7)];return{'lockKey':_0x14075f,'filePath':resolveLocalFilePathFromLockKey(_0xc1f618,_0x14075f),'type':_0x47322d};}export async function ensureParentDirectory(_0x150e71){await mkdir(dirname(_0x150e71),{'recursive':!![]});}export async function fileExists(_0x257a78){try{return await access(_0x257a78,constants['F_OK']),!![];}catch{return![];}}export async function directoryExists(_0x6dd60e){const _0x28f302=a78_0x4b60e4;try{const _0x81ec9d=await stat(_0x6dd60e);return _0x81ec9d[_0x28f302(0x1e3)]();}catch{return![];}}
|
package/lib/core/bff/hash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a79_0x4a15(_0x52d463,_0x159001){_0x52d463=_0x52d463-0x110;const _0x49ee47=a79_0x49ee();let _0x4a15b7=_0x49ee47[_0x52d463];return _0x4a15b7;}(function(_0x56df89,_0xf7a8cb){const _0x459e3d=a79_0x4a15,_0x2d9ecb=_0x56df89();while(!![]){try{const _0x5d09e1=parseInt(_0x459e3d(0x118))/0x1+-parseInt(_0x459e3d(0x112))/0x2*(-parseInt(_0x459e3d(0x110))/0x3)+-parseInt(_0x459e3d(0x11c))/0x4+parseInt(_0x459e3d(0x111))/0x5*(-parseInt(_0x459e3d(0x117))/0x6)+-parseInt(_0x459e3d(0x116))/0x7+-parseInt(_0x459e3d(0x11d))/0x8*(-parseInt(_0x459e3d(0x115))/0x9)+parseInt(_0x459e3d(0x11b))/0xa;if(_0x5d09e1===_0xf7a8cb)break;else _0x2d9ecb['push'](_0x2d9ecb['shift']());}catch(_0x563baf){_0x2d9ecb['push'](_0x2d9ecb['shift']());}}}(a79_0x49ee,0x3cee1));function a79_0x49ee(){const _0x527b92=['hex','update','3127158iXEtHC','758940hYGlgW','6KrnGgr','335269ihTNUN','md5','digest','4003380oBtOhR','1106736Fakcrg','8KZGnTZ','591slmDhV','2323735fTyLxe','166OKXRCA'];a79_0x49ee=function(){return _0x527b92;};return a79_0x49ee();}import{readFile}from'node:fs/promises';import a79_0x2e65b1 from'node:crypto';export function computeContentHash(_0xae4248){const _0x197735=a79_0x4a15;return a79_0x2e65b1['createHash'](_0x197735(0x119))[_0x197735(0x114)](_0xae4248)[_0x197735(0x11a)](_0x197735(0x113));}export async function computeFileHash(_0x47b01d){const _0x20d237=await readFile(_0x47b01d,'utf8');return computeContentHash(_0x20d237);}
|
package/lib/core/bff/lock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x11f6b6,_0x2ecda8){const _0x5c0133=a80_0x2535,_0x5b223c=_0x11f6b6();while(!![]){try{const _0x20b083=-parseInt(_0x5c0133(0x162))/0x1*(-parseInt(_0x5c0133(0x171))/0x2)+-parseInt(_0x5c0133(0x172))/0x3*(-parseInt(_0x5c0133(0x15c))/0x4)+-parseInt(_0x5c0133(0x15d))/0x5*(parseInt(_0x5c0133(0x16c))/0x6)+parseInt(_0x5c0133(0x159))/0x7+-parseInt(_0x5c0133(0x163))/0x8+-parseInt(_0x5c0133(0x16f))/0x9*(-parseInt(_0x5c0133(0x16d))/0xa)+-parseInt(_0x5c0133(0x176))/0xb;if(_0x20b083===_0x2ecda8)break;else _0x5b223c['push'](_0x5b223c['shift']());}catch(_0x527072){_0x5b223c['push'](_0x5b223c['shift']());}}}(a80_0x24ed,0x4195a));import{mkdir,readFile,writeFile}from'node:fs/promises';import{dirname}from'node:path';export function createEmptyBffLock(_0x4b64f2){return{'aliases':_0x4b64f2?{'default':_0x4b64f2}:{},'apps':{}};}function normalizeLockFile(_0x172059,_0x3843f5,_0x55881f){const _0x502097=a80_0x2535;if(_0x502097(0x167)in _0x172059&&_0x172059['apps']&&typeof _0x172059[_0x502097(0x167)]==='object')return(!_0x172059['aliases']||typeof _0x172059[_0x502097(0x15f)]!==_0x502097(0x16b))&&(_0x172059[_0x502097(0x15f)]={}),!_0x172059[_0x502097(0x15f)][_0x502097(0x170)]&&(_0x172059['aliases'][_0x502097(0x170)]=_0x3843f5),_0x172059;const _0x5ca504=_0x172059,_0x1ef649=_0x5ca504[_0x502097(0x168)]?.[_0x502097(0x165)]?.[_0x502097(0x173)]()||_0x3843f5,_0x404c3a=_0x5ca504['meta']?.['scriptsRoot']?.[_0x502097(0x173)]()||_0x55881f;return{'aliases':{'default':_0x1ef649},'apps':{[_0x1ef649]:{'scriptsRoot':_0x404c3a,'lastSync':_0x5ca504[_0x502097(0x164)]||'','functions':_0x5ca504['functions']||{}}}};}export function ensureLockScope(_0x4e2967,_0x33d91f,_0x56ed5f,_0x30a830,_0x38b738,_0x472ef9){const _0x73ff02=a80_0x2535,_0x5ae1f5=normalizeLockFile(_0x4e2967,_0x38b738,_0x472ef9);!_0x5ae1f5[_0x73ff02(0x15f)][_0x73ff02(0x170)]&&(_0x5ae1f5[_0x73ff02(0x15f)][_0x73ff02(0x170)]=_0x38b738);let _0x587974=_0x5ae1f5[_0x73ff02(0x167)][_0x33d91f];if(!_0x587974)return _0x587974={'scriptsRoot':_0x56ed5f,'lastSync':'','functions':{}},_0x5ae1f5[_0x73ff02(0x167)][_0x33d91f]=_0x587974,{'lockData':_0x5ae1f5,'appLock':_0x587974};if(!_0x587974[_0x73ff02(0x15a)])_0x587974[_0x73ff02(0x15a)]=_0x56ed5f;else{if(_0x587974[_0x73ff02(0x15a)]!==_0x56ed5f)throw new Error(_0x30a830+_0x73ff02(0x174)+(_0x73ff02(0x15b)+_0x56ed5f+_0x73ff02(0x160)+_0x587974[_0x73ff02(0x15a)]+_0x73ff02(0x15e))+_0x73ff02(0x16a));}return!_0x587974[_0x73ff02(0x16e)]&&(_0x587974[_0x73ff02(0x16e)]={}),!_0x587974[_0x73ff02(0x164)]&&(_0x587974[_0x73ff02(0x164)]=''),{'lockData':_0x5ae1f5,'appLock':_0x587974};}function a80_0x2535(_0x402a68,_0x24988f){_0x402a68=_0x402a68-0x159;const _0x24ed49=a80_0x24ed();let _0x253514=_0x24ed49[_0x402a68];return _0x253514;}export async function readBffLockFile(_0x33a4f9){const _0xeb7d17=a80_0x2535;try{const _0x42235e=await readFile(_0x33a4f9,_0xeb7d17(0x175));return JSON[_0xeb7d17(0x177)](_0x42235e);}catch(_0x2a28a8){if(_0x2a28a8[_0xeb7d17(0x166)]===_0xeb7d17(0x169))return null;throw new Error('Failed\x20to\x20read\x20BFF\x20lock\x20file:\x20'+String(_0x2a28a8));}}function a80_0x24ed(){const _0x1b1e66=['aliases','\x22\x20vs\x20lock\x20\x22','stringify','8fYKDEo','2422336YfxVsH','lastSync','appCode','code','apps','meta','ENOENT','Check\x20.rabetbase/bff.lock.json\x20or\x20operate\x20from\x20the\x20correct\x20project\x20directory.','object','12tOOREt','147550vDWKrO','functions','45AYpfcF','default','67506kCCMQl','3mFEvMj','trim',':\x20scriptsRoot\x20mismatch\x20—\x20','utf8','1277364DZZsdi','parse','2475116HmCdcS','scriptsRoot','current\x20\x22','1710916ajoKVX','1093915hptrJB','\x22.\x20'];a80_0x24ed=function(){return _0x1b1e66;};return a80_0x24ed();}export async function writeBffLockFile(_0x57aeb3,_0x85524f){const _0x3a8664=a80_0x2535;await mkdir(dirname(_0x57aeb3),{'recursive':!![]}),await writeFile(_0x57aeb3,JSON[_0x3a8664(0x161)](_0x85524f,null,0x2),_0x3a8664(0x175));}
|
package/lib/core/bff/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x31b4d5,_0x165265){const _0x4abdec=a82_0x2092,_0x2e5c0b=_0x31b4d5();while(!![]){try{const _0xb6adc0=parseInt(_0x4abdec(0xe7))/0x1+parseInt(_0x4abdec(0xeb))/0x2+-parseInt(_0x4abdec(0xf5))/0x3+-parseInt(_0x4abdec(0xf3))/0x4+-parseInt(_0x4abdec(0xf6))/0x5+parseInt(_0x4abdec(0xe8))/0x6+parseInt(_0x4abdec(0xf2))/0x7*(parseInt(_0x4abdec(0xf4))/0x8);if(_0xb6adc0===_0x165265)break;else _0x2e5c0b['push'](_0x2e5c0b['shift']());}catch(_0x26c7fe){_0x2e5c0b['push'](_0x2e5c0b['shift']());}}}(a82_0x3426,0xa5329));export function snakeToCamel(_0x28184c){const _0x1882a7=a82_0x2092;return _0x28184c[_0x1882a7(0xe9)]()[_0x1882a7(0xea)](/_([a-z])/g,(_0x1f8efe,_0x5cc1b7)=>_0x5cc1b7[_0x1882a7(0xf0)]());}export function findHookLocationByRemoteId(_0x36f90b,_0x1855bf){const _0x29318b=a82_0x2092;if(!_0x1855bf)return undefined;for(const _0x554496 of Object[_0x29318b(0xec)](_0x36f90b)){if(_0x554496[_0x29318b(0xe6)]===_0x1855bf&&_0x554496[_0x29318b(0xed)]&&_0x554496['operationType']&&_0x554496[_0x29318b(0xe5)])return{'datasetCode':_0x554496[_0x29318b(0xed)],'operationType':_0x554496[_0x29318b(0xf1)],'functionNode':_0x554496[_0x29318b(0xe5)]};}return undefined;}export function extractScriptDescription(_0x3b6a35){const _0x156742=a82_0x2092,_0x31ccef=_0x3b6a35[_0x156742(0xf7)](/\[\s*脚本描述\s*]\s*(.+)/);return _0x31ccef?.[0x1]?.[_0x156742(0xef)]()||undefined;}function a82_0x2092(_0x2063d0,_0x528336){_0x2063d0=_0x2063d0-0xe4;const _0x3426f0=a82_0x3426();let _0x209250=_0x3426f0[_0x2063d0];return _0x209250;}export function isValidBffFunctionName(_0x43b982){const _0x4504b1=a82_0x2092;return/^[A-Za-z_$][A-Za-z0-9_$]*$/[_0x4504b1(0xee)](_0x43b982);}function a82_0x3426(){const _0x4691c5=['test','trim','toUpperCase','operationType','7YnLzHH','5397444Lmhkrg','10301576PSDOuZ','2404392aSbRyZ','2918840WsjQcF','match','after','functionNode','remoteId','1095728NDzTzQ','417084nfcIuv','toLowerCase','replace','1916606ZQVwOq','values','datasetCode'];a82_0x3426=function(){return _0x4691c5;};return a82_0x3426();}export function normalizeHookFunctionNode(_0x2fec29){const _0x42f209=a82_0x2092;if(!_0x2fec29)return undefined;const _0x1850db=_0x2fec29[_0x42f209(0xef)]()[_0x42f209(0xe9)]();if(_0x1850db==='before'||_0x1850db===_0x42f209(0xe4))return _0x1850db;return undefined;}
|
package/lib/core/db-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4462dc,_0x5a7ed9){const _0x55464a=a83_0x3dc9,_0xdfc2b7=_0x4462dc();while(!![]){try{const _0x102368=-parseInt(_0x55464a(0xb2))/0x1+-parseInt(_0x55464a(0xa6))/0x2*(parseInt(_0x55464a(0xbb))/0x3)+-parseInt(_0x55464a(0xb7))/0x4+-parseInt(_0x55464a(0xb5))/0x5+parseInt(_0x55464a(0xb4))/0x6*(parseInt(_0x55464a(0xaf))/0x7)+-parseInt(_0x55464a(0xad))/0x8*(-parseInt(_0x55464a(0xba))/0x9)+parseInt(_0x55464a(0xa5))/0xa;if(_0x102368===_0x5a7ed9)break;else _0xdfc2b7['push'](_0xdfc2b7['shift']());}catch(_0x5c4d8c){_0xdfc2b7['push'](_0xdfc2b7['shift']());}}}(a83_0x324b,0x34489));import{listDatasets}from'./api-client.js';const cache=new Map();function a83_0x324b(){const _0x3ac60c=['isNaN','1032248VDPGPb','.\x20Be\x20more\x20specific.','set','403092mnGwxr','101493YDjjcB','join','dbtableConfig','map','No\x20linked\x20databases\x20found\x20for\x20this\x20app.\x20Make\x20sure\x20datasets\x20have\x20been\x20created.','8850250ZxHgga','8JBiHTB','\x22\x20matches\x20multiple\x20databases:\x20','has','dbId','db-','No\x20database\x20matching\x20\x22','dbName','8PdAwrv','length','189ZWjwUL','find','entries','218927SxQjzH','filter','62922QjenNm','1932480AJTKfL'];a83_0x324b=function(){return _0x3ac60c;};return a83_0x324b();}export async function listDatabases(_0x26dca8){const _0x54aa3c=a83_0x3dc9;if(cache[_0x54aa3c(0xa8)](_0x26dca8))return cache['get'](_0x26dca8);const _0x18053c=await listDatasets(_0x26dca8),_0x1d8b61=new Map();for(const _0x5e0ea2 of _0x18053c){const _0x1be14f=_0x5e0ea2[_0x54aa3c(0xa2)];_0x1be14f?.[_0x54aa3c(0xa9)]!=null&&_0x1d8b61['set'](_0x1be14f[_0x54aa3c(0xa9)],_0x1be14f['dbName']??_0x54aa3c(0xaa)+_0x1be14f[_0x54aa3c(0xa9)]);}const _0x2efe35=[..._0x1d8b61[_0x54aa3c(0xb1)]()][_0x54aa3c(0xa3)](([_0x2f46e8,_0x563ab2])=>({'dbId':_0x2f46e8,'dbName':_0x563ab2}));return cache[_0x54aa3c(0xb9)](_0x26dca8,_0x2efe35),_0x2efe35;}export async function resolveDb(_0x6b8af6,_0x381957){const _0x47b390=a83_0x3dc9,_0x105f94=await listDatabases(_0x6b8af6);if(_0x105f94['length']===0x0)return{'resolved':[],'error':_0x47b390(0xa4)};if(!_0x381957)return{'resolved':_0x105f94};const _0x2dca79=Number(_0x381957);if(!Number[_0x47b390(0xb6)](_0x2dca79)){const _0x33c0e6=_0x105f94[_0x47b390(0xb0)](_0x22fea0=>_0x22fea0['dbId']===_0x2dca79);if(_0x33c0e6)return{'resolved':[_0x33c0e6]};}const _0x5737cb=_0x381957['toLowerCase'](),_0x350af0=_0x105f94[_0x47b390(0xb3)](_0x304f42=>_0x304f42[_0x47b390(0xac)]['toLowerCase']()['includes'](_0x5737cb));if(_0x350af0[_0x47b390(0xae)]>0x0)return{'resolved':_0x350af0};const _0x5341d7=_0x105f94[_0x47b390(0xa3)](_0x51725a=>_0x51725a[_0x47b390(0xac)]+'\x20('+_0x51725a['dbId']+')')[_0x47b390(0xa1)](',\x20');return{'resolved':[],'error':_0x47b390(0xab)+_0x381957+'\x22.\x20Available:\x20'+_0x5341d7};}function a83_0x3dc9(_0x415c0c,_0x3bddef){_0x415c0c=_0x415c0c-0xa1;const _0x324b14=a83_0x324b();let _0x3dc9cd=_0x324b14[_0x415c0c];return _0x3dc9cd;}export async function resolveOneDb(_0x195ec7,_0x3d5770){const _0x34ba7e=a83_0x3dc9,{resolved:_0x1d8f88,error:_0x446306}=await resolveDb(_0x195ec7,_0x3d5770);if(_0x446306)return{'db':null,'error':_0x446306};if(_0x1d8f88[_0x34ba7e(0xae)]===0x1)return{'db':_0x1d8f88[0x0]};if(!_0x3d5770){const _0x4d15a0=_0x1d8f88[_0x34ba7e(0xa3)](_0x4563c2=>_0x4563c2[_0x34ba7e(0xac)]+'\x20('+_0x4563c2['dbId']+')')[_0x34ba7e(0xa1)](',\x20');return{'db':null,'error':'Multiple\x20databases\x20found.\x20Specify\x20one\x20with\x20--db:\x20'+_0x4d15a0};}const _0x456301=_0x1d8f88['map'](_0xadb950=>_0xadb950[_0x34ba7e(0xac)]+'\x20('+_0xadb950[_0x34ba7e(0xa9)]+')')[_0x34ba7e(0xa1)](',\x20');return{'db':null,'error':'\x22'+_0x3d5770+_0x34ba7e(0xa7)+_0x456301+_0x34ba7e(0xb8)};}export async function getDbName(_0x12a3f8,_0x2f5783){const _0x2c8ed3=a83_0x3dc9,_0x568bbc=await listDatabases(_0x12a3f8);return _0x568bbc['find'](_0x39b4c0=>_0x39b4c0[_0x2c8ed3(0xa9)]===_0x2f5783)?.[_0x2c8ed3(0xac)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3fafa6,_0xb842d5){const _0x44429f=a84_0x4867,_0x58b185=_0x3fafa6();while(!![]){try{const _0x387c6b=parseInt(_0x44429f(0x149))/0x1+-parseInt(_0x44429f(0x154))/0x2*(-parseInt(_0x44429f(0x158))/0x3)+parseInt(_0x44429f(0x141))/0x4+parseInt(_0x44429f(0x144))/0x5*(parseInt(_0x44429f(0x13e))/0x6)+parseInt(_0x44429f(0x151))/0x7+parseInt(_0x44429f(0x15c))/0x8+parseInt(_0x44429f(0x14a))/0x9*(-parseInt(_0x44429f(0x14d))/0xa);if(_0x387c6b===_0xb842d5)break;else _0x58b185['push'](_0x58b185['shift']());}catch(_0x55c0ab){_0x58b185['push'](_0x58b185['shift']());}}}(a84_0x1dfc,0x5c5f8));export function detectSqlType(_0x2a2396){const _0x5701b9=a84_0x4867;if(!_0x2a2396?.[_0x5701b9(0x156)]())return{'type':_0x5701b9(0x157),'isSelectOnly':![],'isDangerous':![],'reason':_0x5701b9(0x155)};const _0x553b43=_0x2a2396[_0x5701b9(0x143)](/#\{[^}]*\}/g,'?')['replace'](/\$\{[^}]*\}/g,'?')['replace'](/@[^(\s]+(\([^)]*\))?/g,'')[_0x5701b9(0x143)](/\/\*[\s\S]*?\*\//g,'')[_0x5701b9(0x156)](),_0x20ec9c=_0x553b43[_0x5701b9(0x140)]('\x0a');let _0x195369='';for(const _0x34f5d3 of _0x20ec9c){const _0x1162c1=_0x34f5d3[_0x5701b9(0x156)]();if(!_0x1162c1||_0x1162c1[_0x5701b9(0x14f)]('--')||_0x1162c1[_0x5701b9(0x14f)]('/*'))continue;_0x195369=_0x1162c1;break;}const _0x742148=_0x195369[_0x5701b9(0x147)]();if(_0x742148[_0x5701b9(0x14f)](_0x5701b9(0x15d))||_0x742148[_0x5701b9(0x14f)]('WITH')){const _0x5e826d=/\b(INSERT|UPDATE|DELETE|DROP|ALTER|CREATE|TRUNCATE)\b/i[_0x5701b9(0x13d)](_0x553b43);return{'type':_0x5701b9(0x15d),'isSelectOnly':!_0x5e826d,'isDangerous':_0x5e826d,'reason':_0x5e826d?'SQL\x20contains\x20modification\x20statements\x20alongside\x20SELECT':undefined};}if(_0x742148['startsWith'](_0x5701b9(0x142)))return{'type':_0x5701b9(0x142),'isSelectOnly':![],'isDangerous':![]};if(_0x742148[_0x5701b9(0x14f)](_0x5701b9(0x14c)))return{'type':_0x5701b9(0x14c),'isSelectOnly':![],'isDangerous':![]};if(_0x742148[_0x5701b9(0x14f)](_0x5701b9(0x13f)))return{'type':_0x5701b9(0x13f),'isSelectOnly':![],'isDangerous':!![],'reason':'DELETE\x20statements\x20are\x20blocked\x20from\x20auto-save'};if(/^(CREATE|ALTER|DROP|TRUNCATE)/i[_0x5701b9(0x13d)](_0x742148))return{'type':_0x5701b9(0x153),'isSelectOnly':![],'isDangerous':!![],'reason':'DDL\x20statements\x20are\x20blocked\x20from\x20auto-save'};return{'type':'UNKNOWN','isSelectOnly':![],'isDangerous':![]};}function extractTables(_0x2ce589){const _0xaa398=a84_0x4867,_0x12b6c8=_0x2ce589[_0xaa398(0x143)](/#\{[^}]*\}/g,'?')[_0xaa398(0x143)](/\$\{[^}]*\}/g,'?')['replace'](/'[^']*'/g,'\x27\x27')['replace'](/--.*$/gm,'')[_0xaa398(0x143)](/\/\*[\s\S]*?\*\//g,''),_0x2d2e01=[],_0x50ddd5=_0x12b6c8[_0xaa398(0x146)](/FROM\s+([^\s,)(]+)/i);if(_0x50ddd5?.[0x1])_0x2d2e01[_0xaa398(0x150)](_0x50ddd5[0x1][_0xaa398(0x143)](/[`"]/g,''));for(const _0x56feec of _0x12b6c8[_0xaa398(0x145)](/(?:INNER|LEFT|RIGHT|FULL|CROSS)?\s*JOIN\s+([^\s,)(]+)/gi)){const _0x591dd8=_0x56feec[0x1]?.[_0xaa398(0x143)](/[`"]/g,'');if(_0x591dd8&&!_0x2d2e01['includes'](_0x591dd8))_0x2d2e01[_0xaa398(0x150)](_0x591dd8);}const _0x52676f=_0x12b6c8['match'](/INTO\s+([^\s(]+)/i);if(_0x52676f?.[0x1]){const _0x105d0f=_0x52676f[0x1][_0xaa398(0x143)](/[`"]/g,'');if(!_0x2d2e01[_0xaa398(0x15f)](_0x105d0f))_0x2d2e01[_0xaa398(0x150)](_0x105d0f);}const _0x267263=_0x12b6c8[_0xaa398(0x146)](/UPDATE\s+([^\s,)(]+)/i);if(_0x267263?.[0x1]){const _0x5ba3d7=_0x267263[0x1][_0xaa398(0x143)](/[`"]/g,'');if(!_0x2d2e01[_0xaa398(0x15f)](_0x5ba3d7))_0x2d2e01[_0xaa398(0x150)](_0x5ba3d7);}return _0x2d2e01;}function a84_0x1dfc(){const _0x831a76=['match','toUpperCase','Unable\x20to\x20detect\x20SQL\x20type.\x20Please\x20check\x20the\x20SQL\x20content.','674560ARPmrB','63npdPAz','\x20statements\x20cannot\x20be\x20auto-saved.\x20Please\x20operate\x20manually\x20on\x20the\x20platform.','UPDATE','2395390OpMAxC','join','startsWith','push','2376276TrFCgX','isDangerous','DDL','20974xAbiBR','SQL\x20content\x20is\x20empty','trim','UNKNOWN','75MDnvbN','type','add','\x20with\x20parameters:\x20','4020272yaOLiM','SELECT','\x20query\x20targeting\x20','includes','test','27138gguORS','DELETE','split','816112MSaoDx','INSERT','replace','80JLQCwE','matchAll'];a84_0x1dfc=function(){return _0x831a76;};return a84_0x1dfc();}function extractParameters(_0x180443){const _0x2bb3c8=a84_0x4867,_0xb53fa0=new Set();for(const _0x1137f1 of _0x180443[_0x2bb3c8(0x145)](/#\{(\w+)\}/g))if(_0x1137f1[0x1])_0xb53fa0[_0x2bb3c8(0x15a)](_0x1137f1[0x1]);for(const _0x3e9952 of _0x180443[_0x2bb3c8(0x145)](/\$\{(\w+)\}/g))if(_0x3e9952[0x1])_0xb53fa0[_0x2bb3c8(0x15a)](_0x3e9952[0x1]);return Array['from'](_0xb53fa0);}function a84_0x4867(_0x3e358a,_0x760555){_0x3e358a=_0x3e358a-0x13d;const _0x1dfcb5=a84_0x1dfc();let _0x48670c=_0x1dfcb5[_0x3e358a];return _0x48670c;}export function validateSql(_0x31ce1a){const _0x24414e=a84_0x4867,_0x372ce7=detectSqlType(_0x31ce1a),_0x45b0f8=extractTables(_0x31ce1a),_0xd43422=extractParameters(_0x31ce1a);if(_0x372ce7[_0x24414e(0x152)])return{'valid':![],'sqlType':_0x372ce7,'tables':_0x45b0f8,'parameters':_0xd43422,'message':_0x372ce7['reason']||_0x372ce7[_0x24414e(0x159)]+_0x24414e(0x14b)};if(_0x372ce7[_0x24414e(0x159)]===_0x24414e(0x157))return{'valid':![],'sqlType':_0x372ce7,'tables':_0x45b0f8,'parameters':_0xd43422,'message':_0x24414e(0x148)};return{'valid':!![],'sqlType':_0x372ce7,'tables':_0x45b0f8,'parameters':_0xd43422,'message':_0x372ce7[_0x24414e(0x159)]+_0x24414e(0x15e)+(_0x45b0f8['length']?_0x45b0f8[_0x24414e(0x14e)](',\x20'):'unknown\x20table(s)')+(_0xd43422['length']?_0x24414e(0x15b)+_0xd43422[_0x24414e(0x14e)](',\x20'):'')};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0xda691c,_0x3b81e4){const _0xca188f=a83_0x3bd9,_0x2c6224=_0xda691c();while(!![]){try{const _0x1c7ff9=-parseInt(_0xca188f(0x1f1))/0x1+-parseInt(_0xca188f(0x201))/0x2+-parseInt(_0xca188f(0x1ec))/0x3+parseInt(_0xca188f(0x1cc))/0x4+-parseInt(_0xca188f(0x1d3))/0x5*(-parseInt(_0xca188f(0x1fc))/0x6)+parseInt(_0xca188f(0x1f2))/0x7+-parseInt(_0xca188f(0x1e2))/0x8;if(_0x1c7ff9===_0x3b81e4)break;else _0x2c6224['push'](_0x2c6224['shift']());}catch(_0x248f23){_0x2c6224['push'](_0x2c6224['shift']());}}}(a83_0x22f9,0x34274));import{jsx as a83_0x198ccc,jsxs as a83_0x3054d9,Fragment as a83_0x45c821}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';function a83_0x3bd9(_0x1c6e10,_0x69c752){_0x1c6e10=_0x1c6e10-0x1c1;const _0x22f938=a83_0x22f9();let _0x3bd94a=_0x22f938[_0x1c6e10];return _0x3bd94a;}import{existsSync}from'node:fs';import a83_0x542c8c from'node:path';import{getIsSessionValid}from'../auth/is-session-valid.js';function a83_0x22f9(){const _0x3e46e6=['Yes','production','\x20Logging\x20in...','\x20←\x20','AppCode\x20cannot\x20exceed\x20100\x20characters','creating','!\x20No\x20valid\x20login\x20detected','*\x20Project\x20name:\x20','*\x20Logging\x20in,\x20please\x20complete\x20in\x20browser...','yellow','556680BTrqCB','confirm-api-pull','login-process','cyan','[optional]:\x20','project-name','cwd','confirm-mcp-setup','skills-mcp-setup','*\x20Automatically\x20pull\x20API\x20config?','236922iagWCq','\x20already\x20exists,\x20please\x20use\x20a\x20different\x20name','Project\x20name\x20must\x20start\x20with\x20a\x20letter\x20or\x20number\x20and\x20only\x20contain\x20letters,\x20numbers,\x20-\x20and\x20_','column','rightArrow','105751yBrnNx','1460557mrILsa','login-check','Invalid\x20AppCode','*\x20Creating\x20project...','trim','If\x20Yes,\x20npx\x20skills\x20will\x20guide\x20you\x20to\x20select\x20an\x20AI\x20agent\x20and\x20install\x20the\x20developer\x20skill\x20pack,\x20then\x20Cursor\x20MCP\x20will\x20be\x20configured\x20automatically','backspace','*\x20Create\x20new\x20project','Invalid\x20project\x20name','app-code','192mVqdCO','AppCode\x20can\x20only\x20contain\x20letters,\x20numbers,\x20hyphens\x20and\x20underscores,\x20and\x20must\x20start\x20with\x20a\x20letter\x20or\x20number','Project\x20directory\x20','value','*\x20Install\x20AI\x20Skills\x20and\x20configure\x20MCP?','310400fuhIeN','login','App\x20Code','\x20Checking...','Directory\x20\x22','*\x20Checking\x20login\x20status...','red','includes','Project\x20name\x20cannot\x20exceed\x2050\x20characters','leftArrow','login-prompt','delete','Pull\x20API\x20config','length','api-pull','\x20\x20Use\x20←→\x20to\x20choose,\x20press\x20Enter\x20to\x20confirm','resolve','step','gray','492220PuKIqs','Login\x20status','Press\x20Enter\x20to\x20confirm\x20or\x20type\x20a\x20custom\x20name','green','Skills\x20&\x20MCP','return','env','45535utrkTh','test','Logged\x20in','\x22\x20already\x20exists','√\x20Valid\x20login\x20detected'];a83_0x22f9=function(){return _0x3e46e6;};return a83_0x22f9();}import{authServer}from'../auth/auth-server.js';import{readConfig}from'../utils/config.js';export function EnhancedGuidedCreate(_0x11b300){const _0x35ee9a=a83_0x3bd9,{onCreate:_0x421fe6,env:_0x18f6fb}=_0x11b300,[_0x165b0a,_0x159686]=useState('project-name'),[_0x4f0ee8,_0x2c04fe]=useState(''),[_0x405bdb,_0x64a3]=useState(''),[_0x5e6d73,_0x457858]=useState(''),[_0x4ea882,_0x1f7551]=useState(''),[_0x446acf,_0x519303]=useState([]),[_0x57a654,_0x94271b]=useState(null),[_0xc804b9,_0x146fec]=useState(![]),[_0x574d49,_0xeb6f6d]=useState(![]),[_0x304766,_0x32a0d8]=useState(![]),[_0x39d507,_0x33e627]=useState(0x0),[_0x79631e,_0x3fa72a]=useState(0x0),[_0x57c78e,_0x2df04f]=useState(0x0),[_0x3f69e6,_0x632ae7]=useState(''),_0x2e0ad0='my-app',_0x26b0b2=readConfig(),_0x4b3984=typeof _0x26b0b2[_0x35ee9a(0x1d2)]==='string'?_0x26b0b2[_0x35ee9a(0x1d2)]:undefined;function _0x1c3785(_0x1df5b2){const _0x24c485=_0x35ee9a,_0x59f601=_0x1df5b2||_0x2e0ad0,_0x33eba8=a83_0x542c8c[_0x24c485(0x1c9)](process[_0x24c485(0x1e8)](),_0x59f601);return existsSync(_0x33eba8);}function _0x4a9c03(_0x5d13b8){const _0x2d2435=_0x35ee9a;if(_0x5d13b8[_0x2d2435(0x1c6)]>0x32)return{'valid':![],'message':_0x2d2435(0x1c1)};const _0x106b9c=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(_0x5d13b8?.[_0x2d2435(0x1f6)]()&&!_0x106b9c[_0x2d2435(0x1d4)](_0x5d13b8))return{'valid':![],'message':_0x2d2435(0x1ee)};return{'valid':!![]};}function _0x2299b7(_0x9ca254){const _0x135ad6=_0x35ee9a;if(!_0x9ca254['trim']())return{'valid':!![]};if(_0x9ca254['length']>0x64)return{'valid':![],'message':_0x135ad6(0x1dc)};const _0x2fd026=/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;if(!_0x2fd026[_0x135ad6(0x1d4)](_0x9ca254))return{'valid':![],'message':_0x135ad6(0x1fd)};return{'valid':!![]};}async function _0x453112(){_0x146fec(!![]);try{const _0x5193a5=await getIsSessionValid();return _0x94271b(_0x5193a5),_0x5193a5;}catch(_0x271926){return _0x94271b(![]),![];}finally{_0x146fec(![]);}}async function _0x4f6ab2(){_0xeb6f6d(!![]);try{const _0xe84391=await authServer({'silent':!![]});return _0x94271b(_0xe84391),_0xe84391;}catch(_0x556c82){return _0x94271b(![]),![];}finally{_0xeb6f6d(![]);}}return useInput(async(_0x274d5b,_0x16862c)=>{const _0x32fb90=_0x35ee9a;if(_0x16862c[_0x32fb90(0x1c2)]||_0x16862c[_0x32fb90(0x1f0)]){if(_0x165b0a===_0x32fb90(0x1e3)){_0x33e627(_0x46f320=>_0x46f320===0x0?0x1:0x0);return;}if(_0x165b0a===_0x32fb90(0x1e9)){_0x3fa72a(_0x415fef=>_0x415fef===0x0?0x1:0x0);return;}if(_0x165b0a===_0x32fb90(0x1c3)){_0x2df04f(_0x1b618d=>_0x1b618d===0x0?0x1:0x0);return;}}if(_0x16862c[_0x32fb90(0x1d1)]){if(_0x165b0a===_0x32fb90(0x1e7)){const _0x4242b3=_0x5e6d73[_0x32fb90(0x1f6)]()||_0x2e0ad0;if(_0x4ea882)return;if(_0x1c3785(_0x4242b3)){_0x632ae7(_0x32fb90(0x1fe)+_0x4242b3+_0x32fb90(0x1ed));return;}_0x2c04fe(_0x4242b3),_0x519303([{'step':_0x32fb90(0x1e7),'label':'Project\x20Name','value':_0x4242b3}]),_0x457858(''),_0x1f7551(''),_0x632ae7(''),_0x159686(_0x32fb90(0x1fb));return;}if(_0x165b0a===_0x32fb90(0x1fb)){if(_0x4ea882)return;const _0x42a0e8=_0x5e6d73[_0x32fb90(0x1f6)]();_0x64a3(_0x42a0e8),_0x519303(_0x12c291=>[..._0x12c291,{'step':'app-code','label':_0x32fb90(0x203),'value':_0x42a0e8||'Not\x20set'}]),_0x457858(''),_0x1f7551('');if(_0x42a0e8){_0x159686(_0x32fb90(0x1f3));const _0x1cb6db=await _0x453112();_0x1cb6db?_0x159686(_0x32fb90(0x1e3)):_0x159686(_0x32fb90(0x1c3));}else{const _0x49f923=_0x18f6fb||_0x4b3984||_0x32fb90(0x1d9);_0x421fe6({'projectName':_0x4f0ee8,'appCode':undefined,'pullApi':![],'setupMcp':![],'env':_0x49f923}),_0x159686('creating');}return;}if(_0x165b0a===_0x32fb90(0x1e3)){const _0xa78b46=_0x39d507===0x0;_0x32a0d8(_0xa78b46),_0x519303(_0x582591=>[..._0x582591,{'step':_0x32fb90(0x1c7),'label':_0x32fb90(0x1c5),'value':_0xa78b46?'Yes':'No'}]),_0x159686(_0x32fb90(0x1e9));return;}if(_0x165b0a===_0x32fb90(0x1e9)){const _0x4d0f00=_0x79631e===0x0;_0x519303(_0x48cf30=>[..._0x48cf30,{'step':_0x32fb90(0x1ea),'label':_0x32fb90(0x1d0),'value':_0x4d0f00?_0x32fb90(0x1d8):'No'}]);const _0x1756a9=_0x18f6fb||_0x4b3984||_0x32fb90(0x1d9);_0x421fe6({'projectName':_0x4f0ee8,'appCode':_0x405bdb,'pullApi':_0x304766,'setupMcp':_0x4d0f00,'env':_0x1756a9}),_0x159686(_0x32fb90(0x1dd));return;}if(_0x165b0a===_0x32fb90(0x1c3)){const _0xf2ea99=_0x57c78e===0x0;if(_0xf2ea99){_0x159686('login-process');const _0x47212d=await _0x4f6ab2();_0x47212d?(_0x519303(_0x509e52=>[..._0x509e52,{'step':_0x32fb90(0x202),'label':_0x32fb90(0x1cd),'value':_0x32fb90(0x1d5)}]),_0x159686('confirm-api-pull')):(_0x519303(_0x31770c=>[..._0x31770c,{'step':'login','label':_0x32fb90(0x1cd),'value':'Login\x20failed'}]),_0x159686(_0x32fb90(0x1e9)));}else _0x519303(_0x231782=>[..._0x231782,{'step':'login','label':_0x32fb90(0x1cd),'value':'Login\x20skipped'}]),_0x159686(_0x32fb90(0x1e9));return;}}if(_0x16862c[_0x32fb90(0x1f8)]||_0x16862c[_0x32fb90(0x1c4)]){_0x457858(_0xd5014d=>{const _0x49a5cb=_0x32fb90,_0x3e08e2=_0xd5014d['slice'](0x0,-0x1);if(_0x165b0a===_0x49a5cb(0x1e7)){const {valid:_0x164f08,message:_0x3ce979}=_0x4a9c03(_0x3e08e2);_0x1f7551(_0x164f08?'':_0x3ce979||_0x49a5cb(0x1fa));if(_0x164f08&&!_0x4ea882){const _0x517a44=_0x3e08e2||_0x2e0ad0;_0x1c3785(_0x517a44)?_0x632ae7(_0x49a5cb(0x205)+_0x517a44+_0x49a5cb(0x1d6)):_0x632ae7('');}}else{if(_0x165b0a===_0x49a5cb(0x1fb)){const {valid:_0x2bc3af,message:_0x55bc85}=_0x2299b7(_0x3e08e2);_0x1f7551(_0x2bc3af?'':_0x55bc85||_0x49a5cb(0x1f4));}}return _0x3e08e2;});return;}if([_0x32fb90(0x1dd),_0x32fb90(0x1f3),_0x32fb90(0x1e4),'confirm-api-pull','confirm-mcp-setup',_0x32fb90(0x1c3)][_0x32fb90(0x208)](_0x165b0a))return;_0x457858(_0x5c8c74=>{const _0x2e0c42=_0x32fb90,_0x1cd933=_0x5c8c74+_0x274d5b;if(_0x165b0a==='project-name'){const {valid:_0x3a8556,message:_0x1ef2ce}=_0x4a9c03(_0x1cd933);_0x1f7551(_0x3a8556?'':_0x1ef2ce||_0x2e0c42(0x1fa));if(_0x3a8556&&!_0x4ea882){const _0x1f5e63=_0x1cd933||_0x2e0ad0;_0x1c3785(_0x1f5e63)?_0x632ae7('Directory\x20\x22'+_0x1f5e63+_0x2e0c42(0x1d6)):_0x632ae7('');}}else{if(_0x165b0a===_0x2e0c42(0x1fb)){const {valid:_0x3bb755,message:_0x4c4bb0}=_0x2299b7(_0x1cd933);_0x1f7551(_0x3bb755?'':_0x4c4bb0||_0x2e0c42(0x1f4));}}return _0x1cd933;});}),a83_0x3054d9(Box,{'flexDirection':_0x35ee9a(0x1ef),'marginTop':0x1,'children':[_0x446acf[_0x35ee9a(0x1c6)]===0x0&&a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1e5),'children':_0x35ee9a(0x1f9)})}),_0x446acf['map'](_0x146a5b=>a83_0x3054d9(Box,{'children':[a83_0x198ccc(Text,{'color':'green','children':'√\x20'+_0x146a5b['label']+':\x20'}),a83_0x198ccc(Text,{'color':_0x35ee9a(0x1e5),'children':_0x146a5b[_0x35ee9a(0x1ff)]})]},_0x146a5b[_0x35ee9a(0x1ca)])),_0x165b0a===_0x35ee9a(0x1e7)&&a83_0x3054d9(a83_0x45c821,{'children':[a83_0x3054d9(Box,{'children':[a83_0x198ccc(Text,{'children':_0x35ee9a(0x1df)}),_0x5e6d73?a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cf),'children':_0x5e6d73}):a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cb),'children':_0x2e0ad0}),_0x4ea882&&a83_0x3054d9(Text,{'color':_0x35ee9a(0x207),'children':[_0x35ee9a(0x1db),_0x4ea882]}),_0x3f69e6&&a83_0x3054d9(Text,{'color':'red','children':['\x20←\x20',_0x3f69e6]})]}),!_0x4ea882&&!_0x3f69e6&&!_0x5e6d73&&a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':'gray','children':_0x35ee9a(0x1ce)})})]}),_0x165b0a===_0x35ee9a(0x1fb)&&a83_0x3054d9(a83_0x45c821,{'children':[a83_0x3054d9(Box,{'children':[a83_0x198ccc(Text,{'children':'*\x20AppCode\x20'}),a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cb),'children':_0x35ee9a(0x1e6)}),a83_0x198ccc(Text,{'color':'green','children':_0x5e6d73}),_0x4ea882&&a83_0x3054d9(Text,{'color':_0x35ee9a(0x207),'children':[_0x35ee9a(0x1db),_0x4ea882]})]}),!_0x4ea882&&a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':'gray','children':'Bind\x20AppCode\x20to\x20auto-configure\x20API,\x20e.g.\x20app-c4c89304\x20(press\x20Enter\x20to\x20skip)'})})]}),_0x165b0a===_0x35ee9a(0x1f3)&&a83_0x3054d9(Box,{'children':[a83_0x198ccc(Text,{'children':_0x35ee9a(0x206)}),_0xc804b9&&a83_0x198ccc(Text,{'color':'gray','children':_0x35ee9a(0x204)})]}),_0x165b0a===_0x35ee9a(0x1e3)&&a83_0x3054d9(a83_0x45c821,{'children':[a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cf),'children':_0x35ee9a(0x1d7)})}),a83_0x198ccc(Box,{'marginTop':0x1,'children':a83_0x198ccc(Text,{'children':_0x35ee9a(0x1eb)})}),a83_0x3054d9(Box,{'marginLeft':0x2,'children':[a83_0x3054d9(Text,{'color':_0x39d507===0x0?_0x35ee9a(0x1cf):_0x35ee9a(0x1cb),'children':[_0x39d507===0x0?'▶\x20':'\x20\x20',_0x35ee9a(0x1d8)]}),a83_0x198ccc(Text,{'children':'\x20'}),a83_0x3054d9(Text,{'color':_0x39d507===0x1?_0x35ee9a(0x1cf):_0x35ee9a(0x1cb),'children':[_0x39d507===0x1?'▶\x20':'\x20\x20','No']})]}),a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cb),'children':_0x35ee9a(0x1c8)})}),a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1e1),'children':'\x20\x20Recommended:\x20Yes,\x20to\x20auto-configure\x20API'})})]}),_0x165b0a===_0x35ee9a(0x1e9)&&a83_0x3054d9(a83_0x45c821,{'children':[a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cf),'children':'√'})}),a83_0x198ccc(Box,{'marginTop':0x1,'children':a83_0x198ccc(Text,{'children':_0x35ee9a(0x200)})}),a83_0x3054d9(Box,{'marginLeft':0x2,'children':[a83_0x3054d9(Text,{'color':_0x79631e===0x0?_0x35ee9a(0x1cf):'gray','children':[_0x79631e===0x0?'▶\x20':'\x20\x20',_0x35ee9a(0x1d8)]}),a83_0x198ccc(Text,{'children':'\x20'}),a83_0x3054d9(Text,{'color':_0x79631e===0x1?_0x35ee9a(0x1cf):'gray','children':[_0x79631e===0x1?'▶\x20':'\x20\x20','No']})]}),a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cb),'children':_0x35ee9a(0x1c8)})}),a83_0x198ccc(Box,{'marginTop':0x1,'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cb),'children':_0x35ee9a(0x1f7)})})]}),_0x165b0a===_0x35ee9a(0x1c3)&&a83_0x3054d9(a83_0x45c821,{'children':[a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':'yellow','children':_0x35ee9a(0x1de)})}),a83_0x198ccc(Box,{'marginTop':0x1,'children':a83_0x198ccc(Text,{'children':'*\x20Login\x20first\x20to\x20pull\x20API\x20config?'})}),a83_0x3054d9(Box,{'marginLeft':0x2,'children':[a83_0x3054d9(Text,{'color':_0x57c78e===0x0?'green':_0x35ee9a(0x1cb),'children':[_0x57c78e===0x0?'▶\x20':'\x20\x20',_0x35ee9a(0x1d8)]}),a83_0x198ccc(Text,{'children':'\x20'}),a83_0x3054d9(Text,{'color':_0x57c78e===0x1?_0x35ee9a(0x1cf):_0x35ee9a(0x1cb),'children':[_0x57c78e===0x1?'▶\x20':'\x20\x20','No']})]}),a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cb),'children':_0x35ee9a(0x1c8)})})]}),_0x165b0a===_0x35ee9a(0x1e4)&&a83_0x3054d9(Box,{'children':[a83_0x198ccc(Text,{'children':_0x35ee9a(0x1e0)}),_0x574d49&&a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cb),'children':_0x35ee9a(0x1da)})]}),_0x165b0a==='creating'&&a83_0x198ccc(Box,{'children':a83_0x198ccc(Text,{'color':_0x35ee9a(0x1cf),'children':_0x35ee9a(0x1f5)})})]});}
|
|
1
|
+
(function(_0x5e367d,_0x41f917){const _0x233ed2=a85_0x8072,_0x3ec48c=_0x5e367d();while(!![]){try{const _0x1bd22e=parseInt(_0x233ed2(0xe1))/0x1+-parseInt(_0x233ed2(0xdb))/0x2*(parseInt(_0x233ed2(0xc6))/0x3)+-parseInt(_0x233ed2(0xd0))/0x4+parseInt(_0x233ed2(0xab))/0x5*(parseInt(_0x233ed2(0xce))/0x6)+-parseInt(_0x233ed2(0xaf))/0x7+-parseInt(_0x233ed2(0xa8))/0x8*(parseInt(_0x233ed2(0xae))/0x9)+-parseInt(_0x233ed2(0xe4))/0xa*(-parseInt(_0x233ed2(0xb5))/0xb);if(_0x1bd22e===_0x41f917)break;else _0x3ec48c['push'](_0x3ec48c['shift']());}catch(_0xc12be8){_0x3ec48c['push'](_0x3ec48c['shift']());}}}(a85_0x2b5c,0x43308));function a85_0x2b5c(){const _0x6b3eb5=['slice','66PAUImT','label','cyan','production','length','Project\x20Name','App\x20Code','rightArrow','login-check','*\x20Login\x20first\x20to\x20pull\x20API\x20config?','project-name','green','column','Bind\x20AppCode\x20to\x20auto-configure\x20API,\x20e.g.\x20app-c4c89304\x20(press\x20Enter\x20to\x20skip)','Invalid\x20project\x20name','Logged\x20in','Project\x20name\x20cannot\x20exceed\x2050\x20characters','222135qQjMNO','login-prompt','app-code','red','Project\x20directory\x20','Login\x20status','\x22\x20already\x20exists','step','900aPRQlJ','return','1005764mrHOHh','gray','\x20already\x20exists,\x20please\x20use\x20a\x20different\x20name','login','\x20←\x20','login-process','Press\x20Enter\x20to\x20confirm\x20or\x20type\x20a\x20custom\x20name','delete','Yes','AppCode\x20can\x20only\x20contain\x20letters,\x20numbers,\x20hyphens\x20and\x20underscores,\x20and\x20must\x20start\x20with\x20a\x20letter\x20or\x20number','*\x20Creating\x20project...','10nwiFoF','creating','Login\x20skipped','map','trim','AppCode\x20cannot\x20exceed\x20100\x20characters','341501YKyvJV','*\x20Logging\x20in,\x20please\x20complete\x20in\x20browser...','*\x20Create\x20new\x20project','1412640JLXjmW','\x20Checking...','leftArrow','Not\x20set','\x20\x20Use\x20←→\x20to\x20choose,\x20press\x20Enter\x20to\x20confirm','80560yrSBck','Invalid\x20AppCode','resolve','11230nwiARN','[optional]:\x20','cwd','396VwuMxY','1302217TkEcsG','Project\x20name\x20must\x20start\x20with\x20a\x20letter\x20or\x20number\x20and\x20only\x20contain\x20letters,\x20numbers,\x20-\x20and\x20_','string','Directory\x20\x22','env'];a85_0x2b5c=function(){return _0x6b3eb5;};return a85_0x2b5c();}function a85_0x8072(_0x4030d8,_0xe4e520){_0x4030d8=_0x4030d8-0xa7;const _0x2b5c8e=a85_0x2b5c();let _0x8072ce=_0x2b5c8e[_0x4030d8];return _0x8072ce;}import{jsx as a85_0x4e8542,jsxs as a85_0x2c1f78,Fragment as a85_0x4ed775}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import{existsSync}from'node:fs';import a85_0x316d4f from'node:path';import{getIsSessionValid}from'../auth/is-session-valid.js';import{authServer}from'../auth/auth-server.js';import{readConfig}from'../utils/config.js';export function EnhancedGuidedCreate(_0x5570a0){const _0x29f853=a85_0x8072,{onCreate:_0x1a7845,env:_0xb4fdf5}=_0x5570a0,[_0x407c3c,_0xf4bddb]=useState('project-name'),[_0x5e75bc,_0x1d07a8]=useState(''),[_0x4cead8,_0x41d128]=useState(''),[_0x12e2c9,_0x2bf332]=useState(''),[_0x1685d4,_0x52d59b]=useState(''),[_0x1ed2f5,_0x549919]=useState([]),[_0x3cbf66,_0x52d01a]=useState(null),[_0x569f0c,_0xa1e00a]=useState(![]),[_0x522d44,_0x529f06]=useState(![]),[_0x30b66a,_0x1221e2]=useState(0x0),[_0x2ab046,_0x27af41]=useState(''),_0xf9932c='my-app',_0xe8600e=readConfig(),_0x5f3b12=typeof _0xe8600e[_0x29f853(0xb3)]===_0x29f853(0xb1)?_0xe8600e[_0x29f853(0xb3)]:undefined;function _0x318c32(_0x9538bf){const _0x945b23=_0x29f853,_0x3bdc1c=_0x9538bf||_0xf9932c,_0x108dc6=a85_0x316d4f[_0x945b23(0xaa)](process[_0x945b23(0xad)](),_0x3bdc1c);return existsSync(_0x108dc6);}function _0x119c76(_0x1a39b1){const _0x3a10ea=_0x29f853;if(_0x1a39b1[_0x3a10ea(0xb9)]>0x32)return{'valid':![],'message':_0x3a10ea(0xc5)};const _0x2bace1=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(_0x1a39b1?.[_0x3a10ea(0xdf)]()&&!_0x2bace1['test'](_0x1a39b1))return{'valid':![],'message':_0x3a10ea(0xb0)};return{'valid':!![]};}function _0x333d05(_0xdac9ad){const _0x546213=_0x29f853;if(!_0xdac9ad['trim']())return{'valid':!![]};if(_0xdac9ad[_0x546213(0xb9)]>0x64)return{'valid':![],'message':_0x546213(0xe0)};const _0x2e1f1d=/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;if(!_0x2e1f1d['test'](_0xdac9ad))return{'valid':![],'message':_0x546213(0xd9)};return{'valid':!![]};}async function _0x486354(){_0xa1e00a(!![]);try{const _0x8b1dea=await getIsSessionValid();return _0x52d01a(_0x8b1dea),_0x8b1dea;}catch(_0x14d5a1){return _0x52d01a(![]),![];}finally{_0xa1e00a(![]);}}async function _0x4cea5e(){_0x529f06(!![]);try{const _0x3dd7ab=await authServer({'silent':!![]});return _0x52d01a(_0x3dd7ab),_0x3dd7ab;}catch(_0x49b6fb){return _0x52d01a(![]),![];}finally{_0x529f06(![]);}}function _0x19b3d6(_0x48b28d){const _0x4b1cab=_0x29f853,_0x2bd0e8=_0xb4fdf5||_0x5f3b12||_0x4b1cab(0xb8);_0x1a7845({'projectName':_0x5e75bc,'appCode':_0x48b28d,'env':_0x2bd0e8}),_0xf4bddb(_0x4b1cab(0xdc));}return useInput(async(_0x57b973,_0x428caf)=>{const _0x3b0f0a=_0x29f853;if(_0x428caf[_0x3b0f0a(0xe6)]||_0x428caf[_0x3b0f0a(0xbc)]){if(_0x407c3c==='login-prompt'){_0x1221e2(_0x1f2703=>_0x1f2703===0x0?0x1:0x0);return;}}if(_0x428caf[_0x3b0f0a(0xcf)]){if(_0x407c3c===_0x3b0f0a(0xbf)){const _0x167e0e=_0x12e2c9[_0x3b0f0a(0xdf)]()||_0xf9932c;if(_0x1685d4)return;if(_0x318c32(_0x167e0e)){_0x27af41(_0x3b0f0a(0xca)+_0x167e0e+_0x3b0f0a(0xd2));return;}_0x1d07a8(_0x167e0e),_0x549919([{'step':_0x3b0f0a(0xbf),'label':_0x3b0f0a(0xba),'value':_0x167e0e}]),_0x2bf332(''),_0x52d59b(''),_0x27af41(''),_0xf4bddb(_0x3b0f0a(0xc8));return;}if(_0x407c3c===_0x3b0f0a(0xc8)){if(_0x1685d4)return;const _0x474b5c=_0x12e2c9[_0x3b0f0a(0xdf)]();_0x41d128(_0x474b5c),_0x549919(_0x4c268f=>[..._0x4c268f,{'step':_0x3b0f0a(0xc8),'label':_0x3b0f0a(0xbb),'value':_0x474b5c||_0x3b0f0a(0xe7)}]),_0x2bf332(''),_0x52d59b('');if(_0x474b5c){_0xf4bddb(_0x3b0f0a(0xbd));const _0x83f7f3=await _0x486354();_0x83f7f3?_0x19b3d6(_0x474b5c):_0xf4bddb(_0x3b0f0a(0xc7));}else _0x19b3d6(undefined);return;}if(_0x407c3c===_0x3b0f0a(0xc7)){const _0x2b09ed=_0x30b66a===0x0;if(_0x2b09ed){_0xf4bddb(_0x3b0f0a(0xd5));const _0x5afb3d=await _0x4cea5e();_0x5afb3d?(_0x549919(_0x4b25cb=>[..._0x4b25cb,{'step':_0x3b0f0a(0xd3),'label':_0x3b0f0a(0xcb),'value':_0x3b0f0a(0xc4)}]),_0x19b3d6(_0x4cead8)):(_0x549919(_0x11ee85=>[..._0x11ee85,{'step':'login','label':_0x3b0f0a(0xcb),'value':'Login\x20failed'}]),_0x19b3d6(_0x4cead8));}else _0x549919(_0x224aaf=>[..._0x224aaf,{'step':_0x3b0f0a(0xd3),'label':_0x3b0f0a(0xcb),'value':_0x3b0f0a(0xdd)}]),_0x19b3d6(_0x4cead8);return;}}if(_0x428caf['backspace']||_0x428caf[_0x3b0f0a(0xd7)]){_0x2bf332(_0xad7bb6=>{const _0x1a014b=_0x3b0f0a,_0x2ca474=_0xad7bb6[_0x1a014b(0xb4)](0x0,-0x1);if(_0x407c3c==='project-name'){const {valid:_0x45e821,message:_0x18bc8f}=_0x119c76(_0x2ca474);_0x52d59b(_0x45e821?'':_0x18bc8f||_0x1a014b(0xc3));if(_0x45e821&&!_0x1685d4){const _0x2e47e2=_0x2ca474||_0xf9932c;_0x318c32(_0x2e47e2)?_0x27af41(_0x1a014b(0xb2)+_0x2e47e2+_0x1a014b(0xcc)):_0x27af41('');}}else{if(_0x407c3c==='app-code'){const {valid:_0x124ff3,message:_0x55b86d}=_0x333d05(_0x2ca474);_0x52d59b(_0x124ff3?'':_0x55b86d||_0x1a014b(0xa9));}}return _0x2ca474;});return;}if([_0x3b0f0a(0xdc),_0x3b0f0a(0xbd),_0x3b0f0a(0xd5),_0x3b0f0a(0xc7)]['includes'](_0x407c3c))return;_0x2bf332(_0x1fb53e=>{const _0x30c241=_0x3b0f0a,_0x4c9dc8=_0x1fb53e+_0x57b973;if(_0x407c3c===_0x30c241(0xbf)){const {valid:_0x1027ce,message:_0x34d297}=_0x119c76(_0x4c9dc8);_0x52d59b(_0x1027ce?'':_0x34d297||_0x30c241(0xc3));if(_0x1027ce&&!_0x1685d4){const _0x34ed5a=_0x4c9dc8||_0xf9932c;_0x318c32(_0x34ed5a)?_0x27af41(_0x30c241(0xb2)+_0x34ed5a+'\x22\x20already\x20exists'):_0x27af41('');}}else{if(_0x407c3c===_0x30c241(0xc8)){const {valid:_0x53197b,message:_0x2cb6d4}=_0x333d05(_0x4c9dc8);_0x52d59b(_0x53197b?'':_0x2cb6d4||'Invalid\x20AppCode');}}return _0x4c9dc8;});}),a85_0x2c1f78(Box,{'flexDirection':_0x29f853(0xc1),'marginTop':0x1,'children':[_0x1ed2f5[_0x29f853(0xb9)]===0x0&&a85_0x4e8542(Box,{'children':a85_0x4e8542(Text,{'color':_0x29f853(0xb7),'children':_0x29f853(0xe3)})}),_0x1ed2f5[_0x29f853(0xde)](_0x1709fe=>a85_0x2c1f78(Box,{'children':[a85_0x4e8542(Text,{'color':_0x29f853(0xc0),'children':'√\x20'+_0x1709fe[_0x29f853(0xb6)]+':\x20'}),a85_0x4e8542(Text,{'color':'cyan','children':_0x1709fe['value']})]},_0x1709fe[_0x29f853(0xcd)])),_0x407c3c===_0x29f853(0xbf)&&a85_0x2c1f78(a85_0x4ed775,{'children':[a85_0x2c1f78(Box,{'children':[a85_0x4e8542(Text,{'children':'*\x20Project\x20name:\x20'}),_0x12e2c9?a85_0x4e8542(Text,{'color':_0x29f853(0xc0),'children':_0x12e2c9}):a85_0x4e8542(Text,{'color':_0x29f853(0xd1),'children':_0xf9932c}),_0x1685d4&&a85_0x2c1f78(Text,{'color':_0x29f853(0xc9),'children':[_0x29f853(0xd4),_0x1685d4]}),_0x2ab046&&a85_0x2c1f78(Text,{'color':'red','children':[_0x29f853(0xd4),_0x2ab046]})]}),!_0x1685d4&&!_0x2ab046&&!_0x12e2c9&&a85_0x4e8542(Box,{'children':a85_0x4e8542(Text,{'color':_0x29f853(0xd1),'children':_0x29f853(0xd6)})})]}),_0x407c3c===_0x29f853(0xc8)&&a85_0x2c1f78(a85_0x4ed775,{'children':[a85_0x2c1f78(Box,{'children':[a85_0x4e8542(Text,{'children':'*\x20AppCode\x20'}),a85_0x4e8542(Text,{'color':_0x29f853(0xd1),'children':_0x29f853(0xac)}),a85_0x4e8542(Text,{'color':_0x29f853(0xc0),'children':_0x12e2c9}),_0x1685d4&&a85_0x2c1f78(Text,{'color':'red','children':[_0x29f853(0xd4),_0x1685d4]})]}),!_0x1685d4&&a85_0x4e8542(Box,{'children':a85_0x4e8542(Text,{'color':_0x29f853(0xd1),'children':_0x29f853(0xc2)})})]}),_0x407c3c===_0x29f853(0xbd)&&a85_0x2c1f78(Box,{'children':[a85_0x4e8542(Text,{'children':'*\x20Checking\x20login\x20status...'}),_0x569f0c&&a85_0x4e8542(Text,{'color':'gray','children':_0x29f853(0xe5)})]}),_0x407c3c==='login-prompt'&&a85_0x2c1f78(a85_0x4ed775,{'children':[a85_0x4e8542(Box,{'children':a85_0x4e8542(Text,{'color':'yellow','children':'!\x20No\x20valid\x20login\x20detected'})}),a85_0x4e8542(Box,{'marginTop':0x1,'children':a85_0x4e8542(Text,{'children':_0x29f853(0xbe)})}),a85_0x2c1f78(Box,{'marginLeft':0x2,'children':[a85_0x2c1f78(Text,{'color':_0x30b66a===0x0?'green':_0x29f853(0xd1),'children':[_0x30b66a===0x0?'▶\x20':'\x20\x20',_0x29f853(0xd8)]}),a85_0x4e8542(Text,{'children':'\x20'}),a85_0x2c1f78(Text,{'color':_0x30b66a===0x1?'green':_0x29f853(0xd1),'children':[_0x30b66a===0x1?'▶\x20':'\x20\x20','No']})]}),a85_0x4e8542(Box,{'children':a85_0x4e8542(Text,{'color':_0x29f853(0xd1),'children':_0x29f853(0xa7)})})]}),_0x407c3c===_0x29f853(0xd5)&&a85_0x2c1f78(Box,{'children':[a85_0x4e8542(Text,{'children':_0x29f853(0xe2)}),_0x522d44&&a85_0x4e8542(Text,{'color':_0x29f853(0xd1),'children':'\x20Logging\x20in...'})]}),_0x407c3c==='creating'&&a85_0x4e8542(Box,{'children':a85_0x4e8542(Text,{'color':'green','children':_0x29f853(0xda)})})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x168fde,_0xe1ddfc){const _0x18161c=a86_0xf9d8,_0x3e8e62=_0x168fde();while(!![]){try{const _0x2cfe8b=-parseInt(_0x18161c(0x132))/0x1+-parseInt(_0x18161c(0x136))/0x2*(-parseInt(_0x18161c(0x12e))/0x3)+-parseInt(_0x18161c(0x131))/0x4*(parseInt(_0x18161c(0x130))/0x5)+parseInt(_0x18161c(0x133))/0x6+parseInt(_0x18161c(0x135))/0x7*(parseInt(_0x18161c(0x12f))/0x8)+-parseInt(_0x18161c(0x12c))/0x9*(parseInt(_0x18161c(0x12d))/0xa)+parseInt(_0x18161c(0x138))/0xb;if(_0x2cfe8b===_0xe1ddfc)break;else _0x3e8e62['push'](_0x3e8e62['shift']());}catch(_0xcb6a1f){_0x3e8e62['push'](_0x3e8e62['shift']());}}}(a86_0x15e5,0x9594c));function a86_0x15e5(){const _0x270dd3=['3rMqVOr','72TWpXGQ','1240EDAJxQ','19028aBWIqh','666005mbtlrh','6958830dDpaIC','replace','115066mpwPsL','2307670elvZZz','now','10694255NVnTUP','toFixed','9LTKXHp','9753620aWgCQa'];a86_0x15e5=function(){return _0x270dd3;};return a86_0x15e5();}function a86_0xf9d8(_0x1bb3f,_0xea8528){_0x1bb3f=_0x1bb3f-0x12c;const _0x15e5e5=a86_0x15e5();let _0xf9d8e1=_0x15e5e5[_0x1bb3f];return _0xf9d8e1;}export function formatElapsed(_0x237367){const _0xa546cf=a86_0xf9d8,_0x4c77db=Date[_0xa546cf(0x137)]()-_0x237367;if(_0x4c77db<0x3e8)return _0x4c77db+'ms';const _0x1146cf=(_0x4c77db/0x3e8)[_0xa546cf(0x139)](0x2),_0x305cd1=_0x1146cf[_0xa546cf(0x134)](/\.?0+$/u,'');return _0x305cd1+'s';}
|
package/lib/create-app/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x3654b3,_0x5d04c5){const _0x362478=a85_0x28cd,_0xb3a07a=_0x3654b3();while(!![]){try{const _0x585232=-parseInt(_0x362478(0xd8))/0x1*(-parseInt(_0x362478(0x84))/0x2)+parseInt(_0x362478(0xc7))/0x3+parseInt(_0x362478(0xd1))/0x4*(-parseInt(_0x362478(0xa8))/0x5)+-parseInt(_0x362478(0x88))/0x6+-parseInt(_0x362478(0x75))/0x7*(parseInt(_0x362478(0x74))/0x8)+-parseInt(_0x362478(0xd4))/0x9*(-parseInt(_0x362478(0xc8))/0xa)+parseInt(_0x362478(0xaf))/0xb;if(_0x585232===_0x5d04c5)break;else _0xb3a07a['push'](_0xb3a07a['shift']());}catch(_0xc43e63){_0xb3a07a['push'](_0xb3a07a['shift']());}}}(a85_0x13d1,0x35b34));import{jsx as a85_0x54212b,Fragment as a85_0x4dada8,jsxs as a85_0x2dd0f5}from'react/jsx-runtime';import a85_0x31b05a from'path';import a85_0x441cf4 from'fs';import{fileURLToPath}from'node:url';import{Box,Text}from'ink';import{useEffect,useState}from'react';import{EnhancedGuidedCreate}from'./enhanced-guided-create.js';import{pullApiSilent}from'../api/pull-silent.js';import{readConfig}from'../utils/config.js';import{writeConfigFile,NEW_CONFIG_NAME}from'../context.js';import{useCopyProjectTemplate}from'./use-copy-project-template.js';function a85_0x13d1(){const _0x52512d=['package.json','√\x20Configuration\x20file\x20created,\x20AppCode:\x20','开始创建项目:\x20','warn','10JVreDp','配置应用AppCode失败','resolve','mcp-','\x20√\x20','cyan','\x20\x20(Skipped\x20npx;\x20assuming\x20skills\x20are\x20already\x20installed)','1657392MLasoC','Configure\x20MCP\x20server:\x20','更新\x20package.json\x20失败','API\x20配置拉取成功:\x20','inherit','\x20Generated\x20by\x20rabetbase\x20cli\x20','green','repeat','CLI\x20版本检查','Project\x20name\x20contains\x20invalid\x20characters.\x20Not\x20allowed:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20and\x20control\x20characters','setLogPath','info','cd\x20','join','W_OK','1.\x20','pullApi','rabetbase\x20api\x20pull','projectCode','*\x20Pulling\x20API\x20configuration...','项目创建完成:\x20','×\x20Project\x20creation\x20failed:\x20','Cursor','length','1156554SLtmKI','26970xVbeWV','status','*\x20Cleaning\x20up\x20failed\x20project\x20directory:\x20','name','success','../..','message','create','needsUpgrade','661372jGBwXm','map','*\x20Configuring\x20MCP...','36NSjnwN','parse','currentVersion','toLocaleString','1097nkeDoa','production','utf8','配置应用AppCode:\x20','*\x20Configuring\x20AppCode\x20for\x20project\x20','then','16ZNmjOJ','80423YCnOJF','Cannot\x20create\x20project\x20in\x20current\x20directory,\x20please\x20check\x20directory\x20permissions','readFileSync','\x20MCP\x20Cursor:\x20','*\x20Installing\x20AI\x20Skills\x20via\x20npx\x20skills...','更新\x20package.json\x20name','existsSync','*\x20Creating\x20configuration\x20file\x20for\x20project\x20','description','rabetbase\x20mcp\x20install','projectName','cursor','🚀\x20Next\x20Steps:','Pull\x20API\x20configuration:','error','764KnjEgD','accessSync','skipped','\x20\x20✗\x20MCP\x20Cursor:\x20','2354472JobZMR','dirname','column','Start\x20project:','项目创建失败:\x20','*\x20Updating\x20package.json\x20name\x20and\x20description\x20fields','manual','push','1.0.0','test','Project\x20directory\x20','yellow','log','√\x20package.json\x20updated:\x20name=','doTask','√\x20Configuration\x20file\x20created,\x20you\x20can\x20configure\x20later\x20with\x20\x27rabetbase\x20config\x20set\x20appcode\x20<app-code>\x27','Skills\x20installed\x20and\x20MCP\x20configured','Project\x20name\x20is\x20too\x20long,\x20maximum\x20100\x20characters','env','cwd','API\x20配置拉取失败:\x20','Project\x20name\x20cannot\x20be\x20empty','red','2.\x20','trim','\x20|\x20AppCode:\x20','appCode','white'];a85_0x13d1=function(){return _0x52512d;};return a85_0x13d1();}function a85_0x28cd(_0x32088d,_0x19ab83){_0x32088d=_0x32088d-0x70;const _0x13d173=a85_0x13d1();let _0x28cd00=_0x13d173[_0x32088d];return _0x28cd00;}import{useInstallDependencies}from'./use-install-dependencies.js';import{useFormatCode}from'./use-format-code.js';import{TaskFinished}from'./task-finished.js';import{TaskRunning}from'./task-running.js';import{logger}from'../utils/logger.js';import{configureMcp}from'../ai-setup/config.js';import{runNpxSkillsAdd,NPX_SKILLS_ADD_COMMAND_LINE}from'../skills/npx-skills-add.js';import{checkCliVersion,printCliUpgradeWarning}from'../utils/cli-version-check.js';export function CreateApp(_0x2ec990){const _0x22fba1=a85_0x28cd,[_0x35de4f,_0x35c705]=useState(![]),[_0x313f1c,_0x39b23e]=useState(![]),[_0x31add8,_0x2e7659]=useState(null),[_0x24309e,_0x26f7b6]=useState(null),[_0x19eaa5,_0x21d0e2]=useState(![]),_0x27cb41=useCopyProjectTemplate(),_0x231d32=useInstallDependencies(),_0x2e4795=useFormatCode();useEffect(()=>{const _0x14a073=a85_0x28cd;checkCliVersion()[_0x14a073(0x73)](_0x540549=>{const _0x492deb=_0x14a073;_0x540549[_0x492deb(0xd0)]&&(printCliUpgradeWarning(_0x540549),logger[_0x492deb(0xba)](_0x492deb(0xcf),_0x492deb(0xb7),{'currentVersion':_0x540549[_0x492deb(0xd6)],'stableVersion':_0x540549['stableVersion'],'needsUpgrade':_0x540549[_0x492deb(0xd0)]}));});},[]);const _0x572160=async _0x21f4c0=>{const _0x1977cf=a85_0x28cd;if(!_0x21f4c0[_0x1977cf(0x7f)]||_0x21f4c0['projectName'][_0x1977cf(0xa0)]()===''){console['error'](_0x1977cf(0x9d));return;}const _0x3b6ebb=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x3b6ebb[_0x1977cf(0x91)](_0x21f4c0[_0x1977cf(0x7f)])){console[_0x1977cf(0x83)](_0x1977cf(0xb8));return;}if(_0x21f4c0[_0x1977cf(0x7f)][_0x1977cf(0xc6)]>0x64){console[_0x1977cf(0x83)](_0x1977cf(0x99));return;}const _0x2510d8=a85_0x31b05a[_0x1977cf(0xaa)](process['cwd'](),_0x21f4c0[_0x1977cf(0x7f)]);if(a85_0x441cf4[_0x1977cf(0x7b)](_0x2510d8)){console[_0x1977cf(0x83)](_0x1977cf(0x92)+_0x21f4c0[_0x1977cf(0x7f)]+'\x20already\x20exists,\x20please\x20use\x20a\x20different\x20name');return;}try{const _0x45859c=a85_0x31b05a['dirname'](_0x2510d8);a85_0x441cf4[_0x1977cf(0x85)](_0x45859c,a85_0x441cf4['constants'][_0x1977cf(0xbd)]);}catch(_0x9df4f3){console[_0x1977cf(0x83)](_0x1977cf(0x76));return;}_0x2e7659(_0x21f4c0),_0x35c705(!![]),logger[_0x1977cf(0xb9)](_0x2510d8),logger[_0x1977cf(0xba)]('create',_0x1977cf(0xa6)+_0x21f4c0['projectName'],{'projectDir':_0x2510d8,'appCode':_0x21f4c0[_0x1977cf(0xa2)]});try{await _0x27cb41[_0x1977cf(0x96)](_0x21f4c0[_0x1977cf(0x7f)]),await _0x168347(_0x21f4c0[_0x1977cf(0x7f)]),await _0x231d32[_0x1977cf(0x96)](_0x21f4c0['projectName']),await _0x2e4795[_0x1977cf(0x96)](_0x21f4c0[_0x1977cf(0x7f)]),await _0x2597fb(_0x21f4c0[_0x1977cf(0x7f)],_0x21f4c0['appCode']||'',_0x21f4c0[_0x1977cf(0x9a)]);if(_0x21f4c0[_0x1977cf(0xbf)]&&_0x21f4c0['appCode']){console[_0x1977cf(0x94)](_0x1977cf(0xc2));try{const _0x3b58e2=await pullApiSilent(_0x21f4c0[_0x1977cf(0xa2)],undefined,_0x2510d8,_0x21f4c0[_0x1977cf(0x9a)]);_0x3b58e2?(console[_0x1977cf(0x94)]('√\x20API\x20configuration\x20pulled\x20successfully'),logger[_0x1977cf(0xba)](_0x1977cf(0xcf),_0x1977cf(0xb2)+_0x21f4c0['appCode'])):(console['log']('!\x20API\x20configuration\x20pull\x20failed,\x20you\x20can\x20manually\x20run:\x20rabetbase\x20api\x20pull'),logger[_0x1977cf(0xa7)](_0x1977cf(0xcf),_0x1977cf(0x9c)+_0x21f4c0[_0x1977cf(0xa2)]));}catch(_0x22fe99){console[_0x1977cf(0x94)]('!\x20API\x20configuration\x20pull\x20error,\x20project\x20created,\x20you\x20can\x20manually\x20run:\x20rabetbase\x20api\x20pull'),logger[_0x1977cf(0xa7)](_0x1977cf(0xcf),'API\x20配置拉取异常',{'error':_0x22fe99 instanceof Error?_0x22fe99[_0x1977cf(0xce)]:String(_0x22fe99)});}}const _0x1abd2a=[];let _0x48d62f=![];if(_0x21f4c0['setupMcp']&&_0x21f4c0[_0x1977cf(0xa2)]){console['log'](_0x1977cf(0x79));try{const _0x5198e4=runNpxSkillsAdd(_0x2510d8,{'stdio':_0x1977cf(0xb3)});_0x48d62f=_0x5198e4['ok'],_0x5198e4[_0x1977cf(0x86)]&&console[_0x1977cf(0x94)](_0x1977cf(0xae));}catch(_0x467f6f){logger[_0x1977cf(0xa7)](_0x1977cf(0xcf),'Skills\x20安装异常,继续配置\x20MCP',{'error':_0x467f6f instanceof Error?_0x467f6f[_0x1977cf(0xce)]:String(_0x467f6f)});}console[_0x1977cf(0x94)](_0x1977cf(0xd3));const _0x36fb02=_0x1977cf(0x80);try{const _0x318cf3=await configureMcp(_0x36fb02,_0x2510d8);_0x1abd2a[_0x1977cf(0x8f)]({'ide':'Cursor','status':_0x318cf3['status'],'message':_0x318cf3[_0x1977cf(0xce)]}),console[_0x1977cf(0x94)]('\x20\x20'+(_0x318cf3[_0x1977cf(0xc9)]===_0x1977cf(0xcc)?'✓':_0x318cf3['status']===_0x1977cf(0x8e)?'⚠️':'✗')+_0x1977cf(0x78)+_0x318cf3[_0x1977cf(0xce)]);}catch(_0x4a7c5f){_0x1abd2a[_0x1977cf(0x8f)]({'ide':_0x1977cf(0xc5),'status':_0x1977cf(0x83),'message':_0x4a7c5f instanceof Error?_0x4a7c5f[_0x1977cf(0xce)]:String(_0x4a7c5f)}),console[_0x1977cf(0x94)](_0x1977cf(0x87)+(_0x4a7c5f instanceof Error?_0x4a7c5f[_0x1977cf(0xce)]:String(_0x4a7c5f)));}}_0x21d0e2(_0x48d62f),_0x26f7b6(_0x1abd2a[_0x1977cf(0xc6)]>0x0?_0x1abd2a:null),console['log']('√\x20Lovrabet\x20MCP\x20and\x20Skill\x20configuration\x20completed'),logger[_0x1977cf(0xcc)](_0x1977cf(0xcf),_0x1977cf(0xc3)+_0x21f4c0['projectName']),_0x39b23e(!![]),_0x35c705(![]);}catch(_0x1741b8){logger[_0x1977cf(0x83)](_0x1977cf(0xcf),_0x1977cf(0x8c)+_0x21f4c0[_0x1977cf(0x7f)],{'error':_0x1741b8 instanceof Error?_0x1741b8[_0x1977cf(0xce)]:String(_0x1741b8)});try{a85_0x441cf4[_0x1977cf(0x7b)](_0x2510d8)&&(console['log'](_0x1977cf(0xca)+_0x2510d8),a85_0x441cf4['rmSync'](_0x2510d8,{'recursive':!![],'force':!![]}));}catch(_0x121509){logger[_0x1977cf(0xa7)](_0x1977cf(0xcf),'清理项目目录失败:\x20'+_0x2510d8);}_0x35c705(![]),console[_0x1977cf(0x83)](_0x1977cf(0xc4)+(_0x1741b8 instanceof Error?_0x1741b8[_0x1977cf(0xce)]:String(_0x1741b8)));}},_0xb71533=async _0x4683d6=>{const _0xc58189=a85_0x28cd;await _0x572160({'projectName':_0x4683d6,'env':_0x2ec990[_0xc58189(0x9a)]});},_0x168347=async _0x20288=>{const _0x2c8af2=a85_0x28cd,_0x1ec24d=a85_0x31b05a[_0x2c8af2(0xaa)](process[_0x2c8af2(0x9b)](),_0x20288),_0xfb3c2b=a85_0x31b05a[_0x2c8af2(0xbc)](_0x1ec24d,'package.json');try{console[_0x2c8af2(0x94)](_0x2c8af2(0x8d));const _0x165b7a=fileURLToPath(import.meta.url),_0x5c3192=a85_0x31b05a['resolve'](a85_0x31b05a[_0x2c8af2(0x89)](_0x165b7a),_0x2c8af2(0xcd)),_0x3c8452=a85_0x31b05a[_0x2c8af2(0xbc)](_0x5c3192,_0x2c8af2(0xa4));let _0x502050=_0x2c8af2(0x90);try{const _0x2e6a4b=JSON[_0x2c8af2(0xd5)](a85_0x441cf4['readFileSync'](_0x3c8452,'utf8'));_0x502050=_0x2e6a4b['version']||'1.0.0';}catch(_0x597742){}const _0xc53d6e=a85_0x441cf4[_0x2c8af2(0x77)](_0xfb3c2b,_0x2c8af2(0x70)),_0x4a89ca=JSON[_0x2c8af2(0xd5)](_0xc53d6e);_0x4a89ca[_0x2c8af2(0xcb)]=_0x20288,_0x4a89ca[_0x2c8af2(0x7d)]=_0x20288+_0x2c8af2(0xb4)+_0x502050,a85_0x441cf4['writeFileSync'](_0xfb3c2b,JSON['stringify'](_0x4a89ca,null,0x2)+'\x0a',_0x2c8af2(0x70)),console[_0x2c8af2(0x94)](_0x2c8af2(0x95)+_0x20288),logger[_0x2c8af2(0xba)](_0x2c8af2(0xcf),_0x2c8af2(0x7a));}catch(_0x46f2e7){logger[_0x2c8af2(0x83)](_0x2c8af2(0xcf),_0x2c8af2(0xb1));throw _0x46f2e7;}},_0x2597fb=async(_0x21b39a,_0x29d2b1,_0x76ecd8)=>{const _0xc53622=a85_0x28cd,_0x5c5bb2=a85_0x31b05a[_0xc53622(0xaa)](process[_0xc53622(0x9b)](),_0x21b39a),_0x2d8fef=a85_0x31b05a[_0xc53622(0xbc)](_0x5c5bb2,NEW_CONFIG_NAME);try{_0x29d2b1?console[_0xc53622(0x94)](_0xc53622(0x72)+_0x21b39a+':\x20'+_0x29d2b1):console[_0xc53622(0x94)](_0xc53622(0x7c)+_0x21b39a);const _0x5cedfa=fileURLToPath(import.meta.url),_0x122789=a85_0x31b05a[_0xc53622(0xaa)](a85_0x31b05a[_0xc53622(0x89)](_0x5cedfa),_0xc53622(0xcd)),_0x3ed33c=a85_0x31b05a['join'](_0x122789,_0xc53622(0xa4));let _0x5103f3=_0xc53622(0x90);try{const _0x4edbc2=JSON[_0xc53622(0xd5)](a85_0x441cf4[_0xc53622(0x77)](_0x3ed33c,_0xc53622(0x70)));_0x5103f3=_0x4edbc2['version']||_0xc53622(0x90);}catch{}const _0x59d3a5=readConfig(),_0x115953=typeof _0x59d3a5['env']==='string'?_0x59d3a5['env']:undefined,{app:_0x437ffa,appcode:_0x437860,..._0x38c310}=_0x59d3a5,_0x4ffc13={..._0x38c310,'appcode':_0x29d2b1||'','env':_0x76ecd8||_0x115953||_0xc53622(0xd9),'createdAt':new Date()[_0xc53622(0xd7)](),'version':_0x5103f3};writeConfigFile(_0x2d8fef,_0x4ffc13),_0x29d2b1?console[_0xc53622(0x94)](_0xc53622(0xa5)+_0x29d2b1):console[_0xc53622(0x94)](_0xc53622(0x97)),logger[_0xc53622(0xba)](_0xc53622(0xcf),_0xc53622(0x71)+_0x29d2b1);}catch(_0x46fc8b){logger[_0xc53622(0x83)](_0xc53622(0xcf),_0xc53622(0xa9));}};useEffect(()=>{const _0x1bb23b=a85_0x28cd;_0x2ec990[_0x1bb23b(0xc1)]&&_0xb71533(_0x2ec990[_0x1bb23b(0xc1)]);},[_0x2ec990[_0x22fba1(0xc1)]]);if(!_0x35de4f&&!_0x313f1c&&!_0x2ec990[_0x22fba1(0xc1)])return a85_0x54212b(EnhancedGuidedCreate,{'onCreate':_0x572160,'env':_0x2ec990['env']});if(_0x35de4f)return a85_0x2dd0f5(a85_0x4dada8,{'children':[a85_0x2dd0f5(Box,{'marginTop':0x1,'children':[a85_0x54212b(Box,{'width':'1'}),a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'children':_0x22fba1(0xac)}),a85_0x54212b(Text,{'children':'Project\x20name:\x20'}),a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'children':_0x31add8?.['projectName']}),_0x31add8?.['appCode']&&a85_0x2dd0f5(a85_0x4dada8,{'children':[a85_0x54212b(Text,{'children':_0x22fba1(0xa1)}),a85_0x54212b(Text,{'color':_0x22fba1(0xad),'children':_0x31add8['appCode']})]})]}),a85_0x54212b(TaskRunning,{..._0x27cb41}),a85_0x54212b(TaskRunning,{..._0x231d32}),a85_0x54212b(TaskRunning,{..._0x2e4795})]});if(_0x313f1c){const _0x4dfa70=_0x24309e&&_0x24309e[_0x22fba1(0xc6)]>0x0,_0x2f34d3=_0x4dfa70||_0x19eaa5;let _0xecea61=0x1;const _0x448e71=_0x2f34d3?_0xecea61++:_0xecea61+0x2,_0x44f59a=_0x2f34d3?_0xecea61:_0xecea61+0x3;return a85_0x2dd0f5(a85_0x4dada8,{'children':[a85_0x2dd0f5(Box,{'marginTop':0x1,'children':[a85_0x54212b(Box,{'width':'1'}),a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'children':_0x22fba1(0xac)}),a85_0x54212b(Text,{'children':'Project\x20name:\x20'}),a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'children':_0x31add8?.[_0x22fba1(0x7f)]}),_0x31add8?.[_0x22fba1(0xa2)]&&a85_0x2dd0f5(a85_0x4dada8,{'children':[a85_0x54212b(Text,{'children':'\x20|\x20AppCode:\x20'}),a85_0x54212b(Text,{'color':_0x22fba1(0xad),'children':_0x31add8[_0x22fba1(0xa2)]})]})]}),a85_0x54212b(TaskFinished,{..._0x27cb41}),a85_0x54212b(TaskFinished,{..._0x231d32}),a85_0x54212b(TaskFinished,{..._0x2e4795}),_0x4dfa70&&a85_0x2dd0f5(a85_0x4dada8,{'children':[a85_0x54212b(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'children':'─'[_0x22fba1(0xb6)](0x3c)})}),a85_0x54212b(Box,{'marginTop':0x1,'children':a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'bold':!![],'children':_0x22fba1(0x98)})}),_0x24309e[_0x22fba1(0xd2)]((_0x5e692f,_0x437cb4)=>a85_0x54212b(Box,{'marginLeft':0x2,'children':a85_0x2dd0f5(Text,{'color':_0x5e692f[_0x22fba1(0xc9)]===_0x22fba1(0xcc)?_0x22fba1(0xa3):_0x5e692f[_0x22fba1(0xc9)]===_0x22fba1(0x8e)?_0x22fba1(0x93):_0x22fba1(0x9e),'children':[_0x5e692f['ide'],':\x20',_0x5e692f['message']]})},_0x22fba1(0xab)+_0x437cb4))]}),a85_0x54212b(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'children':'─'[_0x22fba1(0xb6)](0x3c)})}),a85_0x54212b(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a85_0x54212b(Text,{'color':_0x22fba1(0xad),'bold':!![],'children':_0x22fba1(0x81)})}),a85_0x2dd0f5(Box,{'marginLeft':0x2,'flexDirection':_0x22fba1(0x8a),'children':[!_0x2f34d3&&a85_0x2dd0f5(a85_0x4dada8,{'children':[a85_0x2dd0f5(Box,{'children':[a85_0x54212b(Text,{'color':_0x22fba1(0xb5),'children':_0x22fba1(0xbe)}),a85_0x54212b(Text,{'color':_0x22fba1(0xa3),'children':'Install\x20AI\x20Skills:\x20'}),a85_0x54212b(Text,{'color':'cyan','bold':!![],'children':NPX_SKILLS_ADD_COMMAND_LINE})]}),_0x31add8?.['appCode']&&a85_0x2dd0f5(Box,{'marginTop':0x1,'children':[a85_0x54212b(Text,{'color':_0x22fba1(0x93),'children':_0x22fba1(0x9f)}),a85_0x54212b(Text,{'color':_0x22fba1(0xa3),'children':_0x22fba1(0xb0)}),a85_0x54212b(Text,{'color':'cyan','bold':!![],'children':_0x22fba1(0x7e)})]})]}),a85_0x2dd0f5(Box,{'marginTop':_0x2f34d3?0x0:0x1,'children':[a85_0x2dd0f5(Text,{'color':_0x2f34d3?_0x22fba1(0xb5):_0x22fba1(0x93),'children':[_0x2f34d3?'1':_0x31add8?.[_0x22fba1(0xa2)]?'3':'2','.','\x20']}),a85_0x54212b(Text,{'color':_0x22fba1(0xa3),'children':_0x22fba1(0x8b)}),a85_0x54212b(Text,{'color':_0x22fba1(0xad),'bold':!![],'children':_0x22fba1(0xbb)+_0x31add8?.['projectName']+'\x20&&\x20rabetbase\x20start'})]}),_0x31add8?.[_0x22fba1(0xa2)]&&!_0x31add8?.[_0x22fba1(0xbf)]&&a85_0x2dd0f5(Box,{'children':[a85_0x2dd0f5(Text,{'color':_0x2f34d3?_0x22fba1(0xb5):_0x22fba1(0x93),'children':[_0x2f34d3?'2':'4','.','\x20']}),a85_0x54212b(Text,{'color':_0x22fba1(0xa3),'children':_0x22fba1(0x82)}),a85_0x54212b(Text,{'color':_0x22fba1(0xad),'bold':!![],'children':_0x22fba1(0xc0)})]})]}),a85_0x54212b(Box,{'marginTop':0x1,'children':a85_0x54212b(Text,{'color':'green','children':'─'[_0x22fba1(0xb6)](0x3c)})})]});}return null;}
|
|
1
|
+
(function(_0x13a17c,_0x5912de){const _0x79aff9=a87_0x3bb5,_0x219f8c=_0x13a17c();while(!![]){try{const _0x59b109=-parseInt(_0x79aff9(0xa0))/0x1*(-parseInt(_0x79aff9(0xba))/0x2)+-parseInt(_0x79aff9(0x8a))/0x3*(-parseInt(_0x79aff9(0xb8))/0x4)+parseInt(_0x79aff9(0x96))/0x5+parseInt(_0x79aff9(0xd9))/0x6*(-parseInt(_0x79aff9(0x9b))/0x7)+-parseInt(_0x79aff9(0x90))/0x8+-parseInt(_0x79aff9(0xac))/0x9*(-parseInt(_0x79aff9(0x9c))/0xa)+parseInt(_0x79aff9(0xcf))/0xb;if(_0x59b109===_0x5912de)break;else _0x219f8c['push'](_0x219f8c['shift']());}catch(_0x497c61){_0x219f8c['push'](_0x219f8c['shift']());}}}(a87_0x2fb4,0x2fd6b));import{jsx as a87_0x1ff642,Fragment as a87_0x4b3849,jsxs as a87_0x38b553}from'react/jsx-runtime';function a87_0x3bb5(_0x535d06,_0x498e0f){_0x535d06=_0x535d06-0x84;const _0x2fb411=a87_0x2fb4();let _0x3bb57a=_0x2fb411[_0x535d06];return _0x3bb57a;}import a87_0x209598 from'path';function a87_0x2fb4(){const _0x82ca45=['rmSync','error','description','Project\x20name\x20cannot\x20be\x20empty','env','Project\x20directory\x20','项目创建完成:\x20','test','existsSync','constants','stringify','8235vcZgqr','√\x20Pulled\x20','projectCode','green','API\x20configuration\x20pulled:\x20','version','\x20Generated\x20by\x20rabetbase\x20cli\x20','更新\x20package.json\x20失败','stableVersion','cwd','*\x20Creating\x20configuration\x20file\x20for\x20project\x20','项目创建失败:\x20','29292gYKbTN','\x20already\x20exists,\x20please\x20use\x20a\x20different\x20name','14228LRpbIq','!\x20API\x20configuration\x20pull\x20error,\x20project\x20created,\x20you\x20can\x20manually\x20run:\x20rabetbase\x20api\x20pull','doTask','Project\x20name\x20is\x20too\x20long,\x20maximum\x20100\x20characters','√\x20Configuration\x20file\x20created,\x20you\x20can\x20configure\x20later\x20with\x20\x27rabetbase\x20config\x20set\x20appcode\x20<app-code>\x27','Start\x20project:','length','currentVersion','warn','trim','info','create','../..','cyan','accessSync','success','🚀\x20Next\x20Steps:','string','resolve','appCode','join','1208328vkMdqe','log','projectName','\x20|\x20AppCode:\x20','name','dirname','white','1.0.0','parse','\x20dataset(s),\x20generated\x20','12rifSIN','cookie','modelCount','Project\x20name:\x20','√\x20Configuration\x20file\x20created,\x20AppCode:\x20','清理项目目录失败:\x20','\x20√\x20','production','1.\x20','readFileSync','setLogPath','column','./src/api/','repeat','Project\x20name\x20contains\x20invalid\x20characters.\x20Not\x20allowed:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20and\x20control\x20characters','3cWiLYa','*\x20Cleaning\x20up\x20failed\x20project\x20directory:\x20','rabetbase\x20api\x20pull','2.\x20','cd\x20','配置应用AppCode失败','942528BaorDG','√\x20package.json\x20updated:\x20name=','utf8','needsUpgrade','×\x20Project\x20creation\x20failed:\x20','*\x20Updating\x20package.json\x20name\x20and\x20description\x20fields','634815RqzIUl','yellow','chdir','开始创建项目:\x20','message','394233mTymxO','1370OInouL','package.json','配置应用AppCode:\x20','then','8qDSvOy'];a87_0x2fb4=function(){return _0x82ca45;};return a87_0x2fb4();}import a87_0x118fc0 from'fs';import{fileURLToPath}from'node:url';import{Box,Text}from'ink';import{useEffect,useState}from'react';import{EnhancedGuidedCreate}from'./enhanced-guided-create.js';import{fetchModelList}from'../api/fetch-model-list.js';import{generateApiFile}from'../api/generate-api-file.js';import{initEnv}from'../constant/env.js';import{readConfig}from'../utils/config.js';import{writeConfigFile,NEW_CONFIG_NAME}from'../context.js';import{useCopyProjectTemplate}from'./use-copy-project-template.js';import{useInstallDependencies}from'./use-install-dependencies.js';import{useFormatCode}from'./use-format-code.js';import{TaskFinished}from'./task-finished.js';import{TaskRunning}from'./task-running.js';import{logger}from'../utils/logger.js';import{checkCliVersion,printCliUpgradeWarning}from'../utils/cli-version-check.js';export function CreateApp(_0x14be20){const _0x2a30e6=a87_0x3bb5,[_0x139dc0,_0x59418e]=useState(![]),[_0x4e1dee,_0x1ca472]=useState(![]),[_0x2f6b3a,_0x1d9b48]=useState(![]),[_0x276697,_0x55135a]=useState(null),_0x43f85f=useCopyProjectTemplate(),_0x3dfd19=useInstallDependencies(),_0x3d62dc=useFormatCode();useEffect(()=>{const _0xa7ab93=a87_0x3bb5;checkCliVersion()[_0xa7ab93(0x9f)](_0x554b10=>{const _0x4ac534=_0xa7ab93;_0x554b10[_0x4ac534(0x93)]&&(printCliUpgradeWarning(_0x554b10),logger['info'](_0x4ac534(0xc5),'CLI\x20版本检查',{'currentVersion':_0x554b10[_0x4ac534(0xc1)],'stableVersion':_0x554b10[_0x4ac534(0xb4)],'needsUpgrade':_0x554b10[_0x4ac534(0x93)]}));});},[]);const _0x1ac7e4=async _0x166a09=>{const _0x20b4ba=a87_0x3bb5;if(!_0x166a09[_0x20b4ba(0xd1)]||_0x166a09[_0x20b4ba(0xd1)][_0x20b4ba(0xc3)]()===''){console[_0x20b4ba(0xa2)](_0x20b4ba(0xa4));return;}const _0x329d51=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x329d51[_0x20b4ba(0xa8)](_0x166a09[_0x20b4ba(0xd1)])){console[_0x20b4ba(0xa2)](_0x20b4ba(0x89));return;}if(_0x166a09[_0x20b4ba(0xd1)][_0x20b4ba(0xc0)]>0x64){console[_0x20b4ba(0xa2)](_0x20b4ba(0xbd));return;}const _0x15df00=a87_0x209598[_0x20b4ba(0xcc)](process[_0x20b4ba(0xb5)](),_0x166a09[_0x20b4ba(0xd1)]);if(a87_0x118fc0['existsSync'](_0x15df00)){console[_0x20b4ba(0xa2)](_0x20b4ba(0xa6)+_0x166a09['projectName']+_0x20b4ba(0xb9));return;}try{const _0x3a6694=a87_0x209598[_0x20b4ba(0xd4)](_0x15df00);a87_0x118fc0[_0x20b4ba(0xc8)](_0x3a6694,a87_0x118fc0[_0x20b4ba(0xaa)]['W_OK']);}catch(_0x18b52b){console[_0x20b4ba(0xa2)]('Cannot\x20create\x20project\x20in\x20current\x20directory,\x20please\x20check\x20directory\x20permissions');return;}_0x55135a(_0x166a09),_0x59418e(!![]),logger[_0x20b4ba(0x85)](_0x15df00),logger['info']('create',_0x20b4ba(0x99)+_0x166a09[_0x20b4ba(0xd1)],{'projectDir':_0x15df00,'appCode':_0x166a09['appCode']});try{await _0x43f85f[_0x20b4ba(0xbc)](_0x166a09[_0x20b4ba(0xd1)]),await _0x6019ab(_0x166a09[_0x20b4ba(0xd1)]),await _0x3dfd19['doTask'](_0x166a09[_0x20b4ba(0xd1)]),await _0x3d62dc[_0x20b4ba(0xbc)](_0x166a09[_0x20b4ba(0xd1)]),await _0x45748b(_0x166a09[_0x20b4ba(0xd1)],_0x166a09[_0x20b4ba(0xcd)]||'',_0x166a09[_0x20b4ba(0xa5)]);if(_0x166a09[_0x20b4ba(0xcd)]){console[_0x20b4ba(0xd0)]('*\x20Pulling\x20API\x20configuration...');const _0x54b190=process[_0x20b4ba(0xb5)]();try{process[_0x20b4ba(0x98)](_0x15df00);const _0x3ee441=_0x166a09[_0x20b4ba(0xa5)]||_0x20b4ba(0xe0);initEnv(_0x3ee441);const {configArray:_0x1cc040}=await fetchModelList(_0x166a09[_0x20b4ba(0xcd)],_0x14be20[_0x20b4ba(0xda)]||''),_0x50d84c=_0x20b4ba(0x87),_0x210037=await generateApiFile(_0x1cc040,'',_0x166a09['appCode'],!![],_0x3ee441,_0x50d84c);console['log'](_0x20b4ba(0xad)+_0x1cc040[_0x20b4ba(0xc0)]+_0x20b4ba(0xd8)+_0x210037[_0x20b4ba(0xdb)]+'\x20model(s)'),logger[_0x20b4ba(0xc4)]('create',_0x20b4ba(0xb0)+_0x166a09[_0x20b4ba(0xcd)]),_0x1d9b48(!![]);}catch(_0x48ad64){console['log'](_0x20b4ba(0xbb)),logger[_0x20b4ba(0xc2)]('create','API\x20配置拉取异常',{'error':_0x48ad64 instanceof Error?_0x48ad64[_0x20b4ba(0x9a)]:String(_0x48ad64)});}finally{process['chdir'](_0x54b190);}}logger[_0x20b4ba(0xc9)](_0x20b4ba(0xc5),_0x20b4ba(0xa7)+_0x166a09[_0x20b4ba(0xd1)]),_0x1ca472(!![]),_0x59418e(![]);}catch(_0x5cfaa5){logger['error'](_0x20b4ba(0xc5),_0x20b4ba(0xb7)+_0x166a09[_0x20b4ba(0xd1)],{'error':_0x5cfaa5 instanceof Error?_0x5cfaa5[_0x20b4ba(0x9a)]:String(_0x5cfaa5)});try{a87_0x118fc0[_0x20b4ba(0xa9)](_0x15df00)&&(console[_0x20b4ba(0xd0)](_0x20b4ba(0x8b)+_0x15df00),a87_0x118fc0[_0x20b4ba(0xa1)](_0x15df00,{'recursive':!![],'force':!![]}));}catch(_0x1b1856){logger[_0x20b4ba(0xc2)](_0x20b4ba(0xc5),_0x20b4ba(0xde)+_0x15df00);}_0x59418e(![]),console[_0x20b4ba(0xa2)](_0x20b4ba(0x94)+(_0x5cfaa5 instanceof Error?_0x5cfaa5[_0x20b4ba(0x9a)]:String(_0x5cfaa5)));}},_0x5655e3=async _0xe132f1=>{await _0x1ac7e4({'projectName':_0xe132f1,'env':_0x14be20['env']});},_0x6019ab=async _0x449f52=>{const _0x5c2945=a87_0x3bb5,_0x2f9e33=a87_0x209598[_0x5c2945(0xcc)](process[_0x5c2945(0xb5)](),_0x449f52),_0x407833=a87_0x209598[_0x5c2945(0xce)](_0x2f9e33,_0x5c2945(0x9d));try{console[_0x5c2945(0xd0)](_0x5c2945(0x95));const _0x4adbb4=fileURLToPath(import.meta.url),_0x2fa01d=a87_0x209598[_0x5c2945(0xcc)](a87_0x209598[_0x5c2945(0xd4)](_0x4adbb4),'../..'),_0x21d644=a87_0x209598[_0x5c2945(0xce)](_0x2fa01d,_0x5c2945(0x9d));let _0x39a082='1.0.0';try{const _0x2012d2=JSON[_0x5c2945(0xd7)](a87_0x118fc0[_0x5c2945(0x84)](_0x21d644,_0x5c2945(0x92)));_0x39a082=_0x2012d2[_0x5c2945(0xb1)]||_0x5c2945(0xd6);}catch(_0x2cf30d){}const _0x1ca11f=a87_0x118fc0['readFileSync'](_0x407833,_0x5c2945(0x92)),_0x22b8bb=JSON['parse'](_0x1ca11f);_0x22b8bb[_0x5c2945(0xd3)]=_0x449f52,_0x22b8bb[_0x5c2945(0xa3)]=_0x449f52+_0x5c2945(0xb2)+_0x39a082,a87_0x118fc0['writeFileSync'](_0x407833,JSON[_0x5c2945(0xab)](_0x22b8bb,null,0x2)+'\x0a',_0x5c2945(0x92)),console[_0x5c2945(0xd0)](_0x5c2945(0x91)+_0x449f52),logger['info']('create','更新\x20package.json\x20name');}catch(_0x389b01){logger[_0x5c2945(0xa2)](_0x5c2945(0xc5),_0x5c2945(0xb3));throw _0x389b01;}},_0x45748b=async(_0x5d9c71,_0x5045f2,_0x41ed87)=>{const _0x1efd43=a87_0x3bb5,_0x3f09f2=a87_0x209598[_0x1efd43(0xcc)](process['cwd'](),_0x5d9c71),_0x2c5987=a87_0x209598[_0x1efd43(0xce)](_0x3f09f2,NEW_CONFIG_NAME);try{_0x5045f2?console[_0x1efd43(0xd0)]('*\x20Configuring\x20AppCode\x20for\x20project\x20'+_0x5d9c71+':\x20'+_0x5045f2):console['log'](_0x1efd43(0xb6)+_0x5d9c71);const _0x2276b9=fileURLToPath(import.meta.url),_0xb95d92=a87_0x209598[_0x1efd43(0xcc)](a87_0x209598[_0x1efd43(0xd4)](_0x2276b9),_0x1efd43(0xc6)),_0x305dd1=a87_0x209598[_0x1efd43(0xce)](_0xb95d92,'package.json');let _0x3f842a='1.0.0';try{const _0x217532=JSON[_0x1efd43(0xd7)](a87_0x118fc0[_0x1efd43(0x84)](_0x305dd1,_0x1efd43(0x92)));_0x3f842a=_0x217532[_0x1efd43(0xb1)]||_0x1efd43(0xd6);}catch{}const _0x9bbbdb=readConfig(),_0x5a470c=typeof _0x9bbbdb['env']===_0x1efd43(0xcb)?_0x9bbbdb[_0x1efd43(0xa5)]:undefined,{app:_0x5190a1,appcode:_0x48f9db,..._0x269b44}=_0x9bbbdb,_0x65a638={..._0x269b44,'appcode':_0x5045f2||'','env':_0x41ed87||_0x5a470c||'production','createdAt':new Date()['toLocaleString'](),'version':_0x3f842a};writeConfigFile(_0x2c5987,_0x65a638),_0x5045f2?console['log'](_0x1efd43(0xdd)+_0x5045f2):console[_0x1efd43(0xd0)](_0x1efd43(0xbe)),logger[_0x1efd43(0xc4)](_0x1efd43(0xc5),_0x1efd43(0x9e)+_0x5045f2);}catch(_0x2472ab){logger[_0x1efd43(0xa2)]('create',_0x1efd43(0x8f));}};useEffect(()=>{const _0x38ad15=a87_0x3bb5;_0x14be20[_0x38ad15(0xae)]&&_0x5655e3(_0x14be20[_0x38ad15(0xae)]);},[_0x14be20['projectCode']]);if(!_0x139dc0&&!_0x4e1dee&&!_0x14be20['projectCode'])return a87_0x1ff642(EnhancedGuidedCreate,{'onCreate':_0x1ac7e4,'env':_0x14be20[_0x2a30e6(0xa5)]});if(_0x139dc0)return a87_0x38b553(a87_0x4b3849,{'children':[a87_0x38b553(Box,{'marginTop':0x1,'children':[a87_0x1ff642(Box,{'width':'1'}),a87_0x1ff642(Text,{'color':'green','children':_0x2a30e6(0xdf)}),a87_0x1ff642(Text,{'children':_0x2a30e6(0xdc)}),a87_0x1ff642(Text,{'color':_0x2a30e6(0xaf),'children':_0x276697?.['projectName']}),_0x276697?.[_0x2a30e6(0xcd)]&&a87_0x38b553(a87_0x4b3849,{'children':[a87_0x1ff642(Text,{'children':_0x2a30e6(0xd2)}),a87_0x1ff642(Text,{'color':_0x2a30e6(0xc7),'children':_0x276697['appCode']})]})]}),a87_0x1ff642(TaskRunning,{..._0x43f85f}),a87_0x1ff642(TaskRunning,{..._0x3dfd19}),a87_0x1ff642(TaskRunning,{..._0x3d62dc})]});if(_0x4e1dee)return a87_0x38b553(a87_0x4b3849,{'children':[a87_0x38b553(Box,{'marginTop':0x1,'children':[a87_0x1ff642(Box,{'width':'1'}),a87_0x1ff642(Text,{'color':'green','children':'\x20√\x20'}),a87_0x1ff642(Text,{'children':_0x2a30e6(0xdc)}),a87_0x1ff642(Text,{'color':'green','children':_0x276697?.['projectName']}),_0x276697?.[_0x2a30e6(0xcd)]&&a87_0x38b553(a87_0x4b3849,{'children':[a87_0x1ff642(Text,{'children':_0x2a30e6(0xd2)}),a87_0x1ff642(Text,{'color':_0x2a30e6(0xc7),'children':_0x276697['appCode']})]})]}),a87_0x1ff642(TaskFinished,{..._0x43f85f}),a87_0x1ff642(TaskFinished,{..._0x3dfd19}),a87_0x1ff642(TaskFinished,{..._0x3d62dc}),a87_0x1ff642(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a87_0x1ff642(Text,{'color':'green','children':'─'[_0x2a30e6(0x88)](0x3c)})}),a87_0x1ff642(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a87_0x1ff642(Text,{'color':'cyan','bold':!![],'children':_0x2a30e6(0xca)})}),a87_0x38b553(Box,{'marginLeft':0x2,'flexDirection':_0x2a30e6(0x86),'children':[a87_0x38b553(Box,{'children':[a87_0x1ff642(Text,{'color':_0x2a30e6(0xaf),'children':_0x2a30e6(0xe1)}),a87_0x1ff642(Text,{'color':_0x2a30e6(0xd5),'children':_0x2a30e6(0xbf)}),a87_0x1ff642(Text,{'color':_0x2a30e6(0xc7),'bold':!![],'children':_0x2a30e6(0x8e)+_0x276697?.[_0x2a30e6(0xd1)]+'\x20&&\x20rabetbase\x20run\x20start'})]}),_0x276697?.[_0x2a30e6(0xcd)]&&!_0x2f6b3a&&a87_0x38b553(Box,{'marginTop':0x1,'children':[a87_0x1ff642(Text,{'color':_0x2a30e6(0x97),'children':_0x2a30e6(0x8d)}),a87_0x1ff642(Text,{'color':'white','children':'Pull\x20API\x20configuration:'}),a87_0x1ff642(Text,{'color':_0x2a30e6(0xc7),'bold':!![],'children':_0x2a30e6(0x8c)})]})]}),a87_0x1ff642(Box,{'marginTop':0x1,'children':a87_0x1ff642(Text,{'color':_0x2a30e6(0xaf),'children':'─'['repeat'](0x3c)})})]});return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x514821,_0x5ee39d){const _0x1fa4a2=a88_0x2904,_0x52dec1=_0x514821();while(!![]){try{const _0x31ca1a=parseInt(_0x1fa4a2(0x1b2))/0x1+-parseInt(_0x1fa4a2(0x1a1))/0x2+parseInt(_0x1fa4a2(0x1b0))/0x3+parseInt(_0x1fa4a2(0x1b7))/0x4*(parseInt(_0x1fa4a2(0x1a9))/0x5)+-parseInt(_0x1fa4a2(0x19a))/0x6+-parseInt(_0x1fa4a2(0x1ac))/0x7*(parseInt(_0x1fa4a2(0x1a6))/0x8)+-parseInt(_0x1fa4a2(0x1ab))/0x9*(-parseInt(_0x1fa4a2(0x1a5))/0xa);if(_0x31ca1a===_0x5ee39d)break;else _0x52dec1['push'](_0x52dec1['shift']());}catch(_0x351065){_0x52dec1['push'](_0x52dec1['shift']());}}}(a88_0x30f7,0x74c76));import a88_0x4ce7a1 from'path';import{fileURLToPath}from'url';import a88_0x8a501d from'fs/promises';import{existsSync}from'fs';import{copyDirectory}from'../utils/copy-directory.js';import{exec}from'child_process';function a88_0x2904(_0x1f6f08,_0x4efcb7){_0x1f6f08=_0x1f6f08-0x197;const _0x30f7a7=a88_0x30f7();let _0x29040b=_0x30f7a7[_0x1f6f08];return _0x29040b;}import{promisify}from'util';import{checkCliVersion,printCliUpgradeWarning}from'../utils/cli-version-check.js';const execAsync=promisify(exec);function getTemplateDir(){const _0xef8edb=a88_0x2904,_0x2a382b=fileURLToPath(import.meta.url),_0x159ae0=a88_0x4ce7a1[_0xef8edb(0x1a4)](_0x2a382b);return a88_0x4ce7a1[_0xef8edb(0x1b5)](_0x159ae0,_0xef8edb(0x1bc));}export async function createProjectNonInteractive(_0x5df738,_0x20e4ab){const _0x687b5b=a88_0x2904,_0x527f97=await checkCliVersion();_0x527f97['needsUpgrade']&&printCliUpgradeWarning(_0x527f97);(!_0x5df738||_0x5df738['trim']()==='')&&(console['error'](_0x687b5b(0x1bb)),process[_0x687b5b(0x1a8)](0x1));const _0x54a17a=/[<>:"|?*\x00-\x1f\x7f]/;_0x54a17a[_0x687b5b(0x1c6)](_0x5df738)&&(console['error']('Project\x20name\x20contains\x20invalid\x20characters.\x20Not\x20allowed:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20and\x20control\x20characters'),process[_0x687b5b(0x1a8)](0x1));_0x5df738[_0x687b5b(0x1a2)]>0x64&&(console['error'](_0x687b5b(0x1bd)),process[_0x687b5b(0x1a8)](0x1));const _0x711278=a88_0x4ce7a1[_0x687b5b(0x1b5)](process[_0x687b5b(0x19d)](),_0x5df738);existsSync(_0x711278)&&(console[_0x687b5b(0x1c4)](_0x687b5b(0x1c3)+_0x5df738+'\x20already\x20exists,\x20please\x20use\x20a\x20different\x20name'),process[_0x687b5b(0x1a8)](0x1));try{const _0x3a0e78=a88_0x4ce7a1['dirname'](_0x711278);await a88_0x8a501d['access'](_0x3a0e78,a88_0x8a501d[_0x687b5b(0x1b8)][_0x687b5b(0x1c5)]);}catch(_0x2d6dda){console[_0x687b5b(0x1c4)](_0x687b5b(0x1b1)),process[_0x687b5b(0x1a8)](0x1);}try{console['log']('*\x20Creating\x20project\x20'+_0x5df738+_0x687b5b(0x197));const _0x267200=getTemplateDir();await copyDirectory(_0x267200,_0x711278),console[_0x687b5b(0x19f)]('\x20\x20√\x20Project\x20template\x20created'),await updatePackageJsonName(_0x5df738),console[_0x687b5b(0x19f)](_0x687b5b(0x1aa)),console[_0x687b5b(0x19f)]('\x20\x20Installing\x20dependencies...'),console[_0x687b5b(0x19f)](_0x687b5b(0x1c0)),await formatCode(_0x711278),console[_0x687b5b(0x19f)](_0x687b5b(0x198)),await configureAppEnv(_0x5df738,_0x20e4ab),console[_0x687b5b(0x19f)]('\x20\x20√\x20Environment\x20configured'),console[_0x687b5b(0x19f)](_0x687b5b(0x1a0)+_0x5df738+'\x20created\x20successfully!'),console[_0x687b5b(0x19f)](_0x687b5b(0x1b6)+_0x5df738),console['log'](_0x687b5b(0x1b4));}catch(_0x1ae89a){const _0x1421ed=_0x1ae89a instanceof Error?_0x1ae89a[_0x687b5b(0x1c1)]:String(_0x1ae89a);try{existsSync(_0x711278)&&await a88_0x8a501d['rm'](_0x711278,{'recursive':!![],'force':!![]});}catch{}console[_0x687b5b(0x1c4)]('×\x20Project\x20creation\x20failed:\x20'+_0x1421ed),process['exit'](0x1);}}function a88_0x30f7(){const _0x255168=['1477592YTBoGN','length','bun\x20--version','dirname','5770WjRoai','8taDCls','readFile','exit','435cbNzfc','\x20\x20√\x20package.json\x20updated','28503TqdXDh','5949545aglXuU','package.json','join','\x20install','1345569oNHfHQ','Cannot\x20create\x20project\x20in\x20current\x20directory,\x20please\x20check\x20directory\x20permissions','64164dQEXCJ','A\x20project\x20created\x20with\x20Lovrabet\x20CLI','\x20\x20rabetbase\x20run\x20start\x0a','resolve','\x0a\x20\x20cd\x20','11444obsVUZ','constants','writeFile','bun\x20run\x20format','Project\x20name\x20cannot\x20be\x20empty','../../templates/projects/sub-app-react-demo','Project\x20name\x20is\x20too\x20long,\x20maximum\x20100\x20characters','utf-8','parse','\x20\x20√\x20Dependency\x20install\x20skipped\x20(non-interactive)','message','description','Project\x20directory\x20','error','W_OK','test','...','\x20\x20√\x20Code\x20formatted','bun','3131376RmVPjN','name','stringify','cwd','rabetbase.config.json','log','\x0a√\x20Project\x20'];a88_0x30f7=function(){return _0x255168;};return a88_0x30f7();}async function updatePackageJsonName(_0x4a80ec){const _0x306e87=a88_0x2904,_0x3928d2=a88_0x4ce7a1['resolve'](process[_0x306e87(0x19d)](),_0x4a80ec),_0x10ddac=a88_0x4ce7a1[_0x306e87(0x1ae)](_0x3928d2,_0x306e87(0x1ad)),_0x244a26=await a88_0x8a501d[_0x306e87(0x1a7)](_0x10ddac,_0x306e87(0x1be)),_0x5d0d66=JSON[_0x306e87(0x1bf)](_0x244a26);_0x5d0d66[_0x306e87(0x19b)]=_0x4a80ec,_0x5d0d66[_0x306e87(0x1c2)]=_0x306e87(0x1b3),await a88_0x8a501d[_0x306e87(0x1b9)](_0x10ddac,JSON[_0x306e87(0x19c)](_0x5d0d66,null,0x2)+'\x0a');}async function installDependencies(_0x3ab3b2){const _0x39bec8=a88_0x2904,_0x4bc383=detectPackageManager(),_0xf24644=_0x4bc383+_0x39bec8(0x1af);try{await execAsync(_0xf24644,{'cwd':_0x3ab3b2});}catch(_0x2da5d4){throw new Error('依赖安装失败:\x20'+_0x2da5d4);}}function detectPackageManager(){const _0x33d48a=a88_0x2904;try{return execAsync(_0x33d48a(0x1a3),{}),_0x33d48a(0x199);}catch{return'npm';}}async function formatCode(_0x55f539){const _0x5c9617=a88_0x2904;try{await execAsync(_0x5c9617(0x1ba),{'cwd':_0x55f539});}catch{}}async function configureAppEnv(_0x590ba7,_0x189898){const _0x6fdadb=a88_0x2904,_0x19a234=a88_0x4ce7a1['resolve'](process[_0x6fdadb(0x19d)](),_0x590ba7),_0x26ae23=a88_0x4ce7a1[_0x6fdadb(0x1ae)](_0x19a234,_0x6fdadb(0x19e));let _0x664633={};if(existsSync(_0x26ae23)){const _0x3e0d57=await a88_0x8a501d[_0x6fdadb(0x1a7)](_0x26ae23,_0x6fdadb(0x1be));_0x664633=JSON[_0x6fdadb(0x1bf)](_0x3e0d57);}_0x189898&&(_0x664633['env']=_0x189898),await a88_0x8a501d['writeFile'](_0x26ae23,JSON[_0x6fdadb(0x19c)](_0x664633,null,0x2)+'\x0a');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2bb49b,_0x28ce2a){var _0x11b3c8=a89_0xee9d,_0x4b6e85=_0x2bb49b();while(!![]){try{var _0x3ad299=-parseInt(_0x11b3c8(0x1f4))/0x1*(-parseInt(_0x11b3c8(0x1f7))/0x2)+parseInt(_0x11b3c8(0x1fd))/0x3*(-parseInt(_0x11b3c8(0x1f5))/0x4)+-parseInt(_0x11b3c8(0x1fa))/0x5*(-parseInt(_0x11b3c8(0x1f6))/0x6)+-parseInt(_0x11b3c8(0x1f8))/0x7*(-parseInt(_0x11b3c8(0x1ef))/0x8)+-parseInt(_0x11b3c8(0x1f1))/0x9+-parseInt(_0x11b3c8(0x1f9))/0xa*(-parseInt(_0x11b3c8(0x1fc))/0xb)+-parseInt(_0x11b3c8(0x1f0))/0xc*(parseInt(_0x11b3c8(0x1fb))/0xd);if(_0x3ad299===_0x28ce2a)break;else _0x4b6e85['push'](_0x4b6e85['shift']());}catch(_0x4b9ff1){_0x4b6e85['push'](_0x4b6e85['shift']());}}}(a89_0x574e,0x8dd37));import{jsx as a89_0x25ec57,jsxs as a89_0x49b356}from'react/jsx-runtime';import{Box,Text}from'ink';function a89_0x574e(){var _0x4622b9=['103dQRgMG','8ZiJpBU','6686562LJouCO','15914MPXHBC','364zOeJbF','2878110IwciBo','5eUfEJT','13DKGAMv','33QqJMLT','732291KdCPEp','127504BEYWBa','28438596GKISTY','1684899zqecPq','\x20√\x20','taskName'];a89_0x574e=function(){return _0x4622b9;};return a89_0x574e();}import{TaskTime}from'./task-time.js';function a89_0xee9d(_0x3c1aa6,_0x136b50){_0x3c1aa6=_0x3c1aa6-0x1ef;var _0x574e5=a89_0x574e();var _0xee9d57=_0x574e5[_0x3c1aa6];return _0xee9d57;}export function TaskFinished(_0x3057ff){var _0x63a362=a89_0xee9d;return a89_0x49b356(Box,{'children':[a89_0x25ec57(Box,{'width':'1'}),a89_0x25ec57(Text,{'color':'green','children':_0x63a362(0x1f2)}),a89_0x25ec57(Text,{'children':_0x3057ff[_0x63a362(0x1f3)]}),a89_0x25ec57(TaskTime,{'elapsed':_0x3057ff['elapsed']})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x572992,_0x3d4bad){var _0x232a6c=a90_0x178b,_0x276895=_0x572992();while(!![]){try{var _0x3bc1d6=parseInt(_0x232a6c(0x81))/0x1*(-parseInt(_0x232a6c(0x7e))/0x2)+parseInt(_0x232a6c(0x7a))/0x3*(parseInt(_0x232a6c(0x85))/0x4)+parseInt(_0x232a6c(0x7d))/0x5*(-parseInt(_0x232a6c(0x87))/0x6)+parseInt(_0x232a6c(0x7f))/0x7*(parseInt(_0x232a6c(0x84))/0x8)+parseInt(_0x232a6c(0x7c))/0x9*(-parseInt(_0x232a6c(0x82))/0xa)+parseInt(_0x232a6c(0x78))/0xb*(parseInt(_0x232a6c(0x80))/0xc)+-parseInt(_0x232a6c(0x88))/0xd*(-parseInt(_0x232a6c(0x7b))/0xe);if(_0x3bc1d6===_0x3d4bad)break;else _0x276895['push'](_0x276895['shift']());}catch(_0x531909){_0x276895['push'](_0x276895['shift']());}}}(a90_0x5664,0x4bbea));import{jsx as a90_0x47a828,jsxs as a90_0x3a262d}from'react/jsx-runtime';function a90_0x178b(_0x2a8426,_0x3fec34){_0x2a8426=_0x2a8426-0x78;var _0x5664ea=a90_0x5664();var _0x178b26=_0x5664ea[_0x2a8426];return _0x178b26;}import{Text}from'ink';import a90_0x203058 from'ink-spinner';export function TaskLoading(_0x48fb67){var _0x100b35=a90_0x178b;if(_0x48fb67['finished'])return a90_0x47a828(Text,{'color':_0x100b35(0x83),'children':_0x100b35(0x86)});if(_0x48fb67['loading'])return a90_0x3a262d(Text,{'color':'green','children':['\x20',a90_0x47a828(a90_0x203058,{'type':'dots'}),'\x20']});return a90_0x47a828(Text,{'children':_0x100b35(0x79)});}function a90_0x5664(){var _0x12c7d5=['12imwxMP','13UpzLCb','99363VdPEod','\x20\x20\x20','2073TvqxBd','1525958AdidVp','9RrJwfr','1256380dEknJT','2LMbIph','14YYNwll','492UXFPns','268311XnPlqi','2900470DiRRBc','green','2113376erfgNi','2104TKWYlP','\x20√\x20'];a90_0x5664=function(){return _0x12c7d5;};return a90_0x5664();}
|