@lovrabet/rabetbase-cli 2.0.2-beta.3 → 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 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- 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 -1
- 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 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/update.js +1 -1
- 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 +1 -1
- package/lib/api/pull-silent.js +0 -1
package/lib/commands/api/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a15_0x45c2(){const _0x16679f=['9QWJsVz','\x20succeeded,\x20','23274mXttGa','\x20failed','filter','join','13415uXOHAH','name','.ts','write','76TGQjqz','-client','output','\x20dataset(s),\x20generated\x20','appcode','2370mWOMgj','1725872eWIvMa','log','Pulling\x20','map','error','string','\x20\x20•\x20','199402aiskGr','11XXfjpf','\x20dataset(s)\x20→\x20','includes',')...','client','str','slice','apiFilePath','\x20model(s)','App\x20\x22','split','497785OzAaRy','length','1452540RjOgpj','selectedAppName','apiDir','1046268hJpeRV','cookie','Done:\x20','fail','endsWith','\x22\x20not\x20found\x20in\x20config.\x20Available:\x20','message','env','appCode','\x20app(s)\x20failed','pull','7vmWzCu','clientFilePath','Pull\x20datasets\x20and\x20generate\x20API\x20config\x20files\x20(./src/api/)','start','modelCount','./src/api/','Override\x20app\x20code','Pulled\x20','api','succeed'];a15_0x45c2=function(){return _0x16679f;};return a15_0x45c2();}const a15_0x4fa886=a15_0x4742;(function(_0x860bc5,_0x348533){const _0x5ec326=a15_0x4742,_0x26a434=_0x860bc5();while(!![]){try{const _0x479b35=parseInt(_0x5ec326(0xfc))/0x1+parseInt(_0x5ec326(0xf0))/0x2*(parseInt(_0x5ec326(0x116))/0x3)+-parseInt(_0x5ec326(0xe3))/0x4*(-parseInt(_0x5ec326(0x11c))/0x5)+parseInt(_0x5ec326(0x101))/0x6+parseInt(_0x5ec326(0x10c))/0x7*(-parseInt(_0x5ec326(0xe9))/0x8)+-parseInt(_0x5ec326(0x118))/0x9*(parseInt(_0x5ec326(0xe8))/0xa)+parseInt(_0x5ec326(0xf1))/0xb*(parseInt(_0x5ec326(0xfe))/0xc);if(_0x479b35===_0x348533)break;else _0x26a434['push'](_0x26a434['shift']());}catch(_0x25d2c3){_0x26a434['push'](_0x26a434['shift']());}}}(a15_0x45c2,0x4cd30));import a15_0x281242 from'ora';import{initEnv,getEnv}from'../../constant/env.js';import{fetchModelList}from'../../api/fetch-model-list.js';function a15_0x4742(_0x305d5c,_0x12d007){_0x305d5c=_0x305d5c-0xe0;const _0x45c2ab=a15_0x45c2();let _0x47424f=_0x45c2ab[_0x305d5c];return _0x47424f;}import{generateApiFile}from'../../api/generate-api-file.js';import{getMultiAppConfigs}from'../../utils/config.js';export const apiPull={'service':a15_0x4fa886(0x114),'command':a15_0x4fa886(0x10b),'description':a15_0x4fa886(0x10e),'risk':a15_0x4fa886(0xe2),'requiresAppCode':!![],'hasFormat':![],'flags':[{'name':a15_0x4fa886(0xe7),'type':a15_0x4fa886(0xee),'description':a15_0x4fa886(0x112),'hidden':!![]},{'name':a15_0x4fa886(0xe5),'type':'string','description':'Output\x20directory\x20(default:\x20./src/api/)'}],async 'execute'(_0x567ac5){const _0x43aa43=a15_0x4fa886,_0x554188=_0x567ac5[_0x43aa43(0xf6)]('appcode'),_0x39963a=_0x567ac5[_0x43aa43(0xf6)](_0x43aa43(0xe5))||undefined;if(!_0x554188){let _0x5994cd=getMultiAppConfigs();if(_0x5994cd&&_0x5994cd[_0x43aa43(0xfd)]>0x0){if(_0x567ac5[_0x43aa43(0xff)]){const _0x18468e=_0x5994cd[_0x43aa43(0x11a)](_0x2396e6=>_0x2396e6[_0x43aa43(0xe0)]===_0x567ac5[_0x43aa43(0xff)]);if(_0x18468e['length']===0x0){const _0x2fcfc5=_0x5994cd[_0x43aa43(0xec)](_0x2b0ce8=>_0x2b0ce8[_0x43aa43(0xe0)])[_0x43aa43(0x11b)](',\x20');return{'ok':![],'message':_0x43aa43(0xfa)+_0x567ac5[_0x43aa43(0xff)]+_0x43aa43(0x106)+_0x2fcfc5};}_0x5994cd=_0x18468e;}let _0x13bbcc=0x0,_0x4fa6af=0x0;for(const _0x53492e of _0x5994cd){const _0x4bfbb9=_0x53492e[_0x43aa43(0x102)]||_0x567ac5[_0x43aa43(0x102)],_0x182399=_0x53492e[_0x43aa43(0x108)]||'production';initEnv(_0x182399);const _0x32b0e4=_0x53492e[_0x43aa43(0x100)]||_0x39963a||_0x43aa43(0x111),_0x5d4284=_0x53492e['isDefault']?'':_0x53492e[_0x43aa43(0xe0)]||_0x53492e[_0x43aa43(0xe7)],_0x1a1359=a15_0x281242(_0x43aa43(0xeb)+_0x53492e[_0x43aa43(0xe0)]+'\x20('+_0x53492e[_0x43aa43(0xe7)]+_0x43aa43(0xf4))[_0x43aa43(0x10f)]();try{const {configArray:_0x47b8f4}=await fetchModelList(_0x53492e[_0x43aa43(0xe7)],_0x4bfbb9),_0x175276=await generateApiFile(_0x47b8f4,_0x5d4284,_0x53492e[_0x43aa43(0xe7)],_0x53492e['isDefault'],_0x182399,_0x32b0e4,_0x53492e[_0x43aa43(0xe0)]);_0x1a1359['succeed'](_0x53492e[_0x43aa43(0xe0)]+':\x20'+_0x47b8f4[_0x43aa43(0xfd)]+_0x43aa43(0xf2)+_0x175276[_0x43aa43(0x110)]+_0x43aa43(0xf9)),console[_0x43aa43(0xea)](_0x43aa43(0xef)+_0x175276[_0x43aa43(0xf8)]),console[_0x43aa43(0xea)](_0x43aa43(0xef)+_0x175276[_0x43aa43(0x10d)]),_0x13bbcc++;}catch(_0x3b9662){_0x1a1359['fail'](_0x53492e[_0x43aa43(0xe0)]+':\x20'+(_0x3b9662 instanceof Error?_0x3b9662[_0x43aa43(0x107)]:String(_0x3b9662))),_0x4fa6af++;}}return console[_0x43aa43(0xea)](),_0x4fa6af>0x0&&console[_0x43aa43(0xed)]('!\x20'+_0x4fa6af+_0x43aa43(0x10a)),{'ok':_0x4fa6af===0x0,'message':_0x43aa43(0x103)+_0x13bbcc+_0x43aa43(0x117)+_0x4fa6af+_0x43aa43(0x119)};}}const _0x11e2ef=_0x554188&&_0x554188[_0x43aa43(0xf3)]('-')?_0x554188[_0x43aa43(0xfb)]('-')[_0x43aa43(0xf7)](0x1)[_0x43aa43(0x11b)]('-'):'',_0x55ac61=_0x39963a||_0x567ac5[_0x43aa43(0x100)]||_0x43aa43(0x111),_0x186d46=!_0x554188,_0x37b82c=a15_0x281242('Pulling\x20API\x20config\x20for\x20'+_0x567ac5['appCode']+'...')['start']();try{const {configArray:_0x6d5d96}=await fetchModelList(_0x567ac5[_0x43aa43(0x109)],_0x567ac5['cookie']),_0x2c15a1=await generateApiFile(_0x6d5d96,_0x11e2ef,_0x567ac5[_0x43aa43(0x109)],_0x186d46,getEnv(),_0x55ac61);_0x37b82c[_0x43aa43(0x115)](_0x43aa43(0x113)+_0x6d5d96[_0x43aa43(0xfd)]+_0x43aa43(0xe6)+_0x2c15a1[_0x43aa43(0x110)]+'\x20model(s)');const _0x390e1c=_0x11e2ef?_0x11e2ef+'-api':_0x43aa43(0x114),_0x2c5734=_0x11e2ef?_0x11e2ef+_0x43aa43(0xe4):_0x43aa43(0xf5),_0x55f5ec=_0x55ac61[_0x43aa43(0x105)]('/')?_0x55ac61:_0x55ac61+'/';return console[_0x43aa43(0xea)](_0x43aa43(0xef)+_0x55f5ec+_0x390e1c+_0x43aa43(0xe1)),console[_0x43aa43(0xea)](_0x43aa43(0xef)+_0x55f5ec+_0x2c5734+_0x43aa43(0xe1)),{'ok':!![],'data':{'datasetCount':_0x6d5d96[_0x43aa43(0xfd)],'modelCount':_0x2c15a1[_0x43aa43(0x110)]}};}catch(_0x4dc2a9){_0x37b82c[_0x43aa43(0x104)]('Failed:\x20'+(_0x4dc2a9 instanceof Error?_0x4dc2a9[_0x43aa43(0x107)]:String(_0x4dc2a9)));throw _0x4dc2a9;}}};
|
package/lib/commands/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a17_0x1dfc5e=a17_0x2ecf;(function(_0x39c4bf,_0x5afde6){const _0x3bcde5=a17_0x2ecf,_0x2fc926=_0x39c4bf();while(!![]){try{const _0x4cd296=parseInt(_0x3bcde5(0x90))/0x1+-parseInt(_0x3bcde5(0xb4))/0x2+parseInt(_0x3bcde5(0x8f))/0x3+-parseInt(_0x3bcde5(0xb1))/0x4*(-parseInt(_0x3bcde5(0x7c))/0x5)+parseInt(_0x3bcde5(0xa2))/0x6*(parseInt(_0x3bcde5(0x93))/0x7)+-parseInt(_0x3bcde5(0xb2))/0x8*(parseInt(_0x3bcde5(0x9b))/0x9)+-parseInt(_0x3bcde5(0x9d))/0xa;if(_0x4cd296===_0x5afde6)break;else _0x2fc926['push'](_0x2fc926['shift']());}catch(_0x5c1769){_0x2fc926['push'](_0x2fc926['shift']());}}}(a17_0x2213,0xed4cf));import{resolveWriteConfigPath,readConfigFile,writeConfigFile}from'../context.js';function getConfigPath(_0x13667b={}){const _0x33719a=a17_0x2ecf,_0x57a2ae=_0x13667b[_0x33719a(0xae)]?_0x33719a(0xae):_0x33719a(0x88);return resolveWriteConfigPath(_0x57a2ae);}function readConfig(_0x5a8d70={}){return readConfigFile(getConfigPath(_0x5a8d70));}function writeConfig(_0x3d2d3a,_0x22aff7={}){writeConfigFile(getConfigPath(_0x22aff7),_0x3d2d3a);}function listApps(_0x5ad26b){const _0x2afc21=a17_0x2ecf,{apps:_0x114b1e,defaultApp:_0x2600a1,currentApp:_0x216c6b}=_0x5ad26b[_0x2afc21(0x9c)],_0x3f066e=Object['entries'](_0x114b1e);if(_0x3f066e[_0x2afc21(0x94)]===0x0){const _0x1e9d71=_0x5ad26b[_0x2afc21(0x9c)]['appCode'];_0x1e9d71?(console[_0x2afc21(0x89)]('Single-app\x20mode:'),console[_0x2afc21(0x89)](_0x2afc21(0x82)+_0x1e9d71+'\x20\x20env:\x20'+_0x5ad26b[_0x2afc21(0x9c)][_0x2afc21(0xaa)]),console[_0x2afc21(0x89)](_0x2afc21(0xa5))):console[_0x2afc21(0x89)](_0x2afc21(0xa0));return;}console[_0x2afc21(0x89)](_0x2afc21(0x83));for(const [_0x6a450c,_0x372774]of _0x3f066e){const _0x2930da=_0x6a450c===_0x2600a1,_0x319840=_0x6a450c===_0x216c6b,_0x483409=_0x319840?'\x20*':_0x2930da?_0x2afc21(0x79):'';console[_0x2afc21(0x89)]('\x20\x20'+_0x6a450c+_0x483409),console['log']('\x20\x20\x20\x20appcode:\x20'+_0x372774['appcode']);if(_0x372774[_0x2afc21(0xaa)])console[_0x2afc21(0x89)](_0x2afc21(0x9a)+_0x372774['env']);if(_0x372774['apiDir'])console['log'](_0x2afc21(0x8d)+_0x372774['apiDir']);if(_0x372774['cookie'])console[_0x2afc21(0x89)](_0x2afc21(0xac));if(_0x372774[_0x2afc21(0xa4)])console[_0x2afc21(0x89)](_0x2afc21(0x97));if(_0x372774[_0x2afc21(0xb6)])console['log'](_0x2afc21(0xbc)+_0x372774[_0x2afc21(0xb6)]);if(_0x372774[_0x2afc21(0x99)])console['log']('\x20\x20\x20\x20pageSize:\x20\x20'+_0x372774[_0x2afc21(0x99)]);if(_0x372774[_0x2afc21(0x86)])console['log'](_0x2afc21(0x77)+_0x372774['riskLevel']);if(_0x372774[_0x2afc21(0x7e)])console[_0x2afc21(0x89)]('\x20\x20\x20\x20locale:\x20\x20\x20\x20'+_0x372774['locale']);console[_0x2afc21(0x89)]('');}_0x2600a1?console[_0x2afc21(0x89)]('Default:\x20'+_0x2600a1):console[_0x2afc21(0x89)](_0x2afc21(0xa1));}function useApp(_0x7e1174,_0x3d3b50,_0x3c8537){const _0x3fa24c=a17_0x2ecf,_0x555b48=_0x3d3b50[0x0];!_0x555b48&&(console['error'](_0x3fa24c(0xb5)),process[_0x3fa24c(0x98)](0x1));const _0x32572d=readConfig(_0x3c8537),_0x37ac01=_0x32572d[_0x3fa24c(0x81)]||{};if(!_0x37ac01[_0x555b48]){const _0x5b55ae=Object[_0x3fa24c(0xa8)](_0x37ac01);_0x5b55ae[_0x3fa24c(0x94)]===0x0?console[_0x3fa24c(0xb8)]('No\x20apps\x20configured.\x20Use\x20`rabetbase\x20app\x20add\x20'+_0x555b48+_0x3fa24c(0xb9)):console['error'](_0x3fa24c(0x7a)+_0x555b48+_0x3fa24c(0xb7)+_0x5b55ae[_0x3fa24c(0x7d)](',\x20')),process[_0x3fa24c(0x98)](0x1);}_0x32572d[_0x3fa24c(0x9e)]=_0x555b48,writeConfig(_0x32572d,_0x3c8537);const _0x223f6c=_0x3c8537[_0x3fa24c(0xae)]?_0x3fa24c(0x78):'';console['log'](_0x3fa24c(0xa7)+_0x555b48+_0x3fa24c(0xaf)+_0x37ac01[_0x555b48][_0x3fa24c(0x96)]+')'+_0x223f6c);}function a17_0x2213(){const _0x1f3362=['locale','slice','Added','apps','\x20\x20appcode:\x20','Configured\x20apps:\x0a','use','apidir','riskLevel','pagesize','project','log','\x22\x20not\x20found.','remove','\x20app\x20\x22','\x20\x20\x20\x20apiDir:\x20\x20\x20\x20','Migrated\x20existing\x20app\x20\x22','3281493KRhxkw','783097kfRnau','app','Set\x20as\x20default\x20app.','35pJcFir','length','Manage\x20multiple\x20apps\x20in\x20one\x20workspace','appcode','\x20\x20\x20\x20accessKey:\x20(set)','exit','pageSize','\x20\x20\x20\x20env:\x20\x20\x20\x20\x20\x20\x20','3714831viNLsh','config','8658250hXLTed','defaultApp','Removed\x20app\x20\x22','No\x20apps\x20configured.\x20Use\x20`rabetbase\x20app\x20add\x20<name>\x20--appcode\x20<code>`\x20to\x20add\x20one.','No\x20default\x20app\x20set.\x20Use\x20`rabetbase\x20app\x20use\x20<name>`\x20to\x20set\x20one.','859686IMGwns','\x22\x20to\x20multi-app\x20config\x20(set\x20as\x20default).','accessKey','\x0aUse\x20`rabetbase\x20app\x20add\x20<name>\x20--appcode\x20<code>`\x20to\x20enable\x20multi-app\x20mode.','list','Default\x20app\x20set\x20to\x20\x22','keys','add','env','--appcode\x20is\x20required\x20when\x20adding\x20an\x20app.','\x20\x20\x20\x20cookie:\x20\x20\x20\x20(set)','accesskey','global','\x22\x20(appcode:\x20','apiDir','4664QRSlam','16oTjXnh','Default\x20app\x20changed\x20to\x20\x22','1914506ArSsnJ','Usage:\x20rabetbase\x20app\x20use\x20<name>\x20[--global]','format','\x22\x20not\x20found.\x20Available:\x20','error','\x20--appcode\x20<code>`\x20first.','Usage:\x20rabetbase\x20app\x20remove\x20<name>\x20[--global]','cookie','\x20\x20\x20\x20format:\x20\x20\x20\x20','\x20\x20\x20\x20riskLevel:\x20','\x20(global)','\x20(default)','App\x20\x22','risklevel','4405FaHoqu','join'];a17_0x2213=function(){return _0x1f3362;};return a17_0x2213();}function migrateLegacySingleApp(_0x270469,_0x12728b){const _0x4b6716=a17_0x2ecf,_0x41721b=_0x270469[_0x4b6716(0x96)]||_0x270469[_0x4b6716(0x91)];if(!_0x41721b)return;const _0x9ab246=String(_0x41721b);if(_0x9ab246===_0x12728b)return;const _0x2a29e6={'appcode':_0x41721b};if(_0x270469[_0x4b6716(0xaa)])_0x2a29e6[_0x4b6716(0xaa)]=_0x270469['env'];if(_0x270469[_0x4b6716(0xb0)])_0x2a29e6[_0x4b6716(0xb0)]=_0x270469[_0x4b6716(0xb0)];if(_0x270469[_0x4b6716(0xbb)])_0x2a29e6['cookie']=_0x270469['cookie'];if(_0x270469[_0x4b6716(0xa4)])_0x2a29e6[_0x4b6716(0xa4)]=_0x270469['accessKey'];if(_0x270469[_0x4b6716(0xb6)])_0x2a29e6[_0x4b6716(0xb6)]=_0x270469[_0x4b6716(0xb6)];if(_0x270469[_0x4b6716(0x99)])_0x2a29e6[_0x4b6716(0x99)]=_0x270469[_0x4b6716(0x99)];if(_0x270469['riskLevel'])_0x2a29e6[_0x4b6716(0x86)]=_0x270469[_0x4b6716(0x86)];if(_0x270469['locale'])_0x2a29e6[_0x4b6716(0x7e)]=_0x270469[_0x4b6716(0x7e)];_0x270469[_0x4b6716(0x81)][_0x9ab246]=_0x2a29e6,_0x270469[_0x4b6716(0x9e)]=_0x9ab246,delete _0x270469['appcode'],delete _0x270469[_0x4b6716(0x91)],console['log'](_0x4b6716(0x8e)+_0x9ab246+_0x4b6716(0xa3));}function a17_0x2ecf(_0x2313c,_0x4e48e7){_0x2313c=_0x2313c-0x77;const _0x22132d=a17_0x2213();let _0x2ecf6c=_0x22132d[_0x2313c];return _0x2ecf6c;}function addApp(_0x4202cb,_0x5cbe03,_0x4f0ff7){const _0x4a10b3=a17_0x2ecf,_0x4288f1=_0x5cbe03[0x0];!_0x4288f1&&(console[_0x4a10b3(0xb8)]('Usage:\x20rabetbase\x20app\x20add\x20<name>\x20--appcode\x20<code>\x20[--env\x20<env>]\x20[--apiDir\x20<dir>]\x20[--global]'),process[_0x4a10b3(0x98)](0x1));const _0x26942b=_0x4f0ff7[_0x4a10b3(0x96)];!_0x26942b&&(console[_0x4a10b3(0xb8)](_0x4a10b3(0xab)),process[_0x4a10b3(0x98)](0x1));const _0x38efe0=readConfig(_0x4f0ff7);if(!_0x38efe0['apps'])_0x38efe0['apps']={};Object[_0x4a10b3(0xa8)](_0x38efe0[_0x4a10b3(0x81)])['length']===0x0&&migrateLegacySingleApp(_0x38efe0,_0x4288f1);const _0x37b1fc={'appcode':_0x26942b};if(_0x4f0ff7[_0x4a10b3(0xaa)])_0x37b1fc[_0x4a10b3(0xaa)]=_0x4f0ff7['env'];if(_0x4f0ff7[_0x4a10b3(0xb0)]||_0x4f0ff7[_0x4a10b3(0x85)])_0x37b1fc['apiDir']=_0x4f0ff7[_0x4a10b3(0xb0)]||_0x4f0ff7[_0x4a10b3(0x85)];if(_0x4f0ff7[_0x4a10b3(0xbb)])_0x37b1fc['cookie']=_0x4f0ff7['cookie'];if(_0x4f0ff7[_0x4a10b3(0xa4)]||_0x4f0ff7[_0x4a10b3(0xad)])_0x37b1fc[_0x4a10b3(0xa4)]=_0x4f0ff7[_0x4a10b3(0xa4)]||_0x4f0ff7[_0x4a10b3(0xad)];if(_0x4f0ff7[_0x4a10b3(0xb6)])_0x37b1fc[_0x4a10b3(0xb6)]=_0x4f0ff7[_0x4a10b3(0xb6)];if(_0x4f0ff7[_0x4a10b3(0x99)]||_0x4f0ff7[_0x4a10b3(0x87)])_0x37b1fc[_0x4a10b3(0x99)]=Number(_0x4f0ff7[_0x4a10b3(0x99)]||_0x4f0ff7[_0x4a10b3(0x87)]);if(_0x4f0ff7[_0x4a10b3(0x86)]||_0x4f0ff7[_0x4a10b3(0x7b)])_0x37b1fc[_0x4a10b3(0x86)]=_0x4f0ff7[_0x4a10b3(0x86)]||_0x4f0ff7['risklevel'];if(_0x4f0ff7[_0x4a10b3(0x7e)])_0x37b1fc[_0x4a10b3(0x7e)]=_0x4f0ff7['locale'];const _0x926431=!!_0x38efe0['apps'][_0x4288f1];_0x38efe0['apps'][_0x4288f1]=_0x37b1fc;!_0x38efe0[_0x4a10b3(0x9e)]&&(_0x38efe0[_0x4a10b3(0x9e)]=_0x4288f1);writeConfig(_0x38efe0,_0x4f0ff7);const _0x1758ba=_0x4f0ff7['global']?_0x4a10b3(0x78):'';console[_0x4a10b3(0x89)]((_0x926431?'Updated':_0x4a10b3(0x80))+_0x4a10b3(0x8c)+_0x4288f1+'\x22\x20(appcode:\x20'+_0x26942b+')'+_0x1758ba),_0x38efe0['defaultApp']===_0x4288f1&&!_0x926431&&console['log'](_0x4a10b3(0x92));}function removeApp(_0xc70763,_0x1ead2f,_0x2888bb){const _0x36b134=a17_0x2ecf,_0x116a42=_0x1ead2f[0x0];!_0x116a42&&(console[_0x36b134(0xb8)](_0x36b134(0xba)),process[_0x36b134(0x98)](0x1));const _0x1552ce=readConfig(_0x2888bb);(!_0x1552ce[_0x36b134(0x81)]||!_0x1552ce[_0x36b134(0x81)][_0x116a42])&&(console['error'](_0x36b134(0x7a)+_0x116a42+_0x36b134(0x8a)),process[_0x36b134(0x98)](0x1));delete _0x1552ce['apps'][_0x116a42];if(_0x1552ce['defaultApp']===_0x116a42){const _0xfd6e73=Object[_0x36b134(0xa8)](_0x1552ce[_0x36b134(0x81)]);_0x1552ce[_0x36b134(0x9e)]=_0xfd6e73[_0x36b134(0x94)]>0x0?_0xfd6e73[0x0]:undefined,_0x1552ce[_0x36b134(0x9e)]?console[_0x36b134(0x89)](_0x36b134(0xb3)+_0x1552ce[_0x36b134(0x9e)]+'\x22.'):delete _0x1552ce[_0x36b134(0x9e)];}Object[_0x36b134(0xa8)](_0x1552ce['apps'])[_0x36b134(0x94)]===0x0&&(delete _0x1552ce['apps'],delete _0x1552ce[_0x36b134(0x9e)]),writeConfig(_0x1552ce,_0x2888bb),console['log'](_0x36b134(0x9f)+_0x116a42+'\x22.');}export const appCommand={'name':'app','description':a17_0x1dfc5e(0x95),async 'run'(_0x12803c,_0x5104af,_0x24307a){const _0x48be14=a17_0x1dfc5e,_0x704828=_0x5104af[0x0],_0x4bad24=_0x5104af[_0x48be14(0x7f)](0x1);switch(_0x704828){case _0x48be14(0xa6):listApps(_0x12803c);break;case _0x48be14(0x84):useApp(_0x12803c,_0x4bad24,_0x24307a);break;case _0x48be14(0xa9):addApp(_0x12803c,_0x4bad24,_0x24307a);break;case _0x48be14(0x8b):removeApp(_0x12803c,_0x4bad24,_0x24307a);break;default:listApps(_0x12803c);break;}}};
|
|
1
|
+
function a16_0x2609(){const _0x526660=['app','\x20(default)','Migrated\x20existing\x20app\x20\x22','Usage:\x20rabetbase\x20app\x20use\x20<name>\x20[--global]','3302cYbdvN','global','pageSize','accessKey','24348BTbFjH','defaultApp','project','apps','accesskey','50NDgSnV','--appcode\x20is\x20required\x20when\x20adding\x20an\x20app.','No\x20default\x20app\x20set.\x20Use\x20`rabetbase\x20app\x20use\x20<name>`\x20to\x20set\x20one.','apidir','format','\x22\x20to\x20multi-app\x20config\x20(set\x20as\x20default).','\x20\x20env:\x20','No\x20apps\x20configured.\x20Use\x20`rabetbase\x20app\x20add\x20<name>\x20--appcode\x20<code>`\x20to\x20add\x20one.','702500VQEETz','pagesize','appcode','571869lRhgnp','log','apiDir','6yjbOXZ','slice','\x20(global)','Usage:\x20rabetbase\x20app\x20remove\x20<name>\x20[--global]','3608297QcHsoS','Manage\x20multiple\x20apps\x20in\x20one\x20workspace','4VNRRkj','\x20--appcode\x20<code>`\x20first.','App\x20\x22','keys','\x20\x20\x20\x20pageSize:\x20\x20','use','\x20\x20\x20\x20format:\x20\x20\x20\x20','\x22\x20not\x20found.','length','remove','appCode','Default\x20app\x20set\x20to\x20\x22','Default:\x20','2268427EpBJig','24dkbvHe','\x20\x20\x20\x20cookie:\x20\x20\x20\x20(set)','Removed\x20app\x20\x22','env','list','258TxThwO','Single-app\x20mode:','\x20\x20\x20\x20accessKey:\x20(set)','cookie','locale','\x22\x20(appcode:\x20','\x20\x20\x20\x20apiDir:\x20\x20\x20\x20','riskLevel','4724TEcOHu','2349065QIBHeY','Set\x20as\x20default\x20app.','risklevel','\x20app\x20\x22','Added','config','add','join','exit','Configured\x20apps:\x0a','\x22\x20not\x20found.\x20Available:\x20','error'];a16_0x2609=function(){return _0x526660;};return a16_0x2609();}const a16_0x254741=a16_0x58a6;(function(_0x564fde,_0x16c753){const _0xca78e2=a16_0x58a6,_0x39f285=_0x564fde();while(!![]){try{const _0x5e3fc9=-parseInt(_0xca78e2(0x1c0))/0x1+-parseInt(_0xca78e2(0x19e))/0x2*(parseInt(_0xca78e2(0x196))/0x3)+-parseInt(_0xca78e2(0x183))/0x4*(parseInt(_0xca78e2(0x19f))/0x5)+-parseInt(_0xca78e2(0x1c6))/0x6*(-parseInt(_0xca78e2(0x190))/0x7)+-parseInt(_0xca78e2(0x191))/0x8*(parseInt(_0xca78e2(0x1c3))/0x9)+parseInt(_0xca78e2(0x1b8))/0xa*(parseInt(_0xca78e2(0x1ca))/0xb)+-parseInt(_0xca78e2(0x1b3))/0xc*(-parseInt(_0xca78e2(0x1af))/0xd);if(_0x5e3fc9===_0x16c753)break;else _0x39f285['push'](_0x39f285['shift']());}catch(_0x2bf5e0){_0x39f285['push'](_0x39f285['shift']());}}}(a16_0x2609,0xdf056));import{resolveWriteConfigPath,readConfigFile,writeConfigFile}from'../context.js';function getConfigPath(_0x2c875b={}){const _0xea0d53=a16_0x58a6,_0x470a28=_0x2c875b['global']?_0xea0d53(0x1b0):_0xea0d53(0x1b5);return resolveWriteConfigPath(_0x470a28);}function readConfig(_0x27b0cf={}){return readConfigFile(getConfigPath(_0x27b0cf));}function writeConfig(_0x3ed107,_0x54d103={}){writeConfigFile(getConfigPath(_0x54d103),_0x3ed107);}function listApps(_0x1ae3d){const _0x3104d5=a16_0x58a6,{apps:_0x305934,defaultApp:_0x14a86c,currentApp:_0x105aa6}=_0x1ae3d[_0x3104d5(0x1a4)],_0x4249e6=Object['entries'](_0x305934);if(_0x4249e6['length']===0x0){const _0x2e301c=_0x1ae3d[_0x3104d5(0x1a4)][_0x3104d5(0x18d)];_0x2e301c?(console[_0x3104d5(0x1c4)](_0x3104d5(0x197)),console[_0x3104d5(0x1c4)]('\x20\x20appcode:\x20'+_0x2e301c+_0x3104d5(0x1be)+_0x1ae3d[_0x3104d5(0x1a4)][_0x3104d5(0x194)]),console[_0x3104d5(0x1c4)]('\x0aUse\x20`rabetbase\x20app\x20add\x20<name>\x20--appcode\x20<code>`\x20to\x20enable\x20multi-app\x20mode.')):console[_0x3104d5(0x1c4)](_0x3104d5(0x1bf));return;}console[_0x3104d5(0x1c4)](_0x3104d5(0x1a8));for(const [_0x3fe367,_0x5134b7]of _0x4249e6){const _0x389ebf=_0x3fe367===_0x14a86c,_0x1515b8=_0x3fe367===_0x105aa6,_0x2932a0=_0x1515b8?'\x20*':_0x389ebf?_0x3104d5(0x1ac):'';console[_0x3104d5(0x1c4)]('\x20\x20'+_0x3fe367+_0x2932a0),console[_0x3104d5(0x1c4)]('\x20\x20\x20\x20appcode:\x20'+_0x5134b7[_0x3104d5(0x1c2)]);if(_0x5134b7[_0x3104d5(0x194)])console[_0x3104d5(0x1c4)]('\x20\x20\x20\x20env:\x20\x20\x20\x20\x20\x20\x20'+_0x5134b7['env']);if(_0x5134b7[_0x3104d5(0x1c5)])console[_0x3104d5(0x1c4)](_0x3104d5(0x19c)+_0x5134b7[_0x3104d5(0x1c5)]);if(_0x5134b7['cookie'])console[_0x3104d5(0x1c4)](_0x3104d5(0x192));if(_0x5134b7['accessKey'])console[_0x3104d5(0x1c4)](_0x3104d5(0x198));if(_0x5134b7['format'])console[_0x3104d5(0x1c4)](_0x3104d5(0x189)+_0x5134b7['format']);if(_0x5134b7[_0x3104d5(0x1b1)])console[_0x3104d5(0x1c4)](_0x3104d5(0x187)+_0x5134b7[_0x3104d5(0x1b1)]);if(_0x5134b7[_0x3104d5(0x19d)])console[_0x3104d5(0x1c4)]('\x20\x20\x20\x20riskLevel:\x20'+_0x5134b7['riskLevel']);if(_0x5134b7[_0x3104d5(0x19a)])console[_0x3104d5(0x1c4)]('\x20\x20\x20\x20locale:\x20\x20\x20\x20'+_0x5134b7[_0x3104d5(0x19a)]);console[_0x3104d5(0x1c4)]('');}_0x14a86c?console[_0x3104d5(0x1c4)](_0x3104d5(0x18f)+_0x14a86c):console[_0x3104d5(0x1c4)](_0x3104d5(0x1ba));}function useApp(_0x461cca,_0x232b4e,_0x18a1a1){const _0x18dfd5=a16_0x58a6,_0x1969a2=_0x232b4e[0x0];!_0x1969a2&&(console[_0x18dfd5(0x1aa)](_0x18dfd5(0x1ae)),process[_0x18dfd5(0x1a7)](0x1));const _0xec5f63=readConfig(_0x18a1a1),_0x29b4ae=_0xec5f63[_0x18dfd5(0x1b6)]||{};if(!_0x29b4ae[_0x1969a2]){const _0x2420df=Object['keys'](_0x29b4ae);_0x2420df[_0x18dfd5(0x18b)]===0x0?console['error']('No\x20apps\x20configured.\x20Use\x20`rabetbase\x20app\x20add\x20'+_0x1969a2+_0x18dfd5(0x184)):console[_0x18dfd5(0x1aa)](_0x18dfd5(0x185)+_0x1969a2+_0x18dfd5(0x1a9)+_0x2420df[_0x18dfd5(0x1a6)](',\x20')),process[_0x18dfd5(0x1a7)](0x1);}_0xec5f63[_0x18dfd5(0x1b4)]=_0x1969a2,writeConfig(_0xec5f63,_0x18a1a1);const _0xf1de8=_0x18a1a1[_0x18dfd5(0x1b0)]?'\x20(global)':'';console[_0x18dfd5(0x1c4)](_0x18dfd5(0x18e)+_0x1969a2+_0x18dfd5(0x19b)+_0x29b4ae[_0x1969a2]['appcode']+')'+_0xf1de8);}function migrateLegacySingleApp(_0x50c430,_0x10dce0){const _0x8c25d6=a16_0x58a6,_0x3df9ce=_0x50c430[_0x8c25d6(0x1c2)]||_0x50c430[_0x8c25d6(0x1ab)];if(!_0x3df9ce)return;const _0x20ae3e=String(_0x3df9ce);if(_0x20ae3e===_0x10dce0)return;const _0x2faaa8={'appcode':_0x3df9ce};if(_0x50c430[_0x8c25d6(0x194)])_0x2faaa8['env']=_0x50c430[_0x8c25d6(0x194)];if(_0x50c430['apiDir'])_0x2faaa8[_0x8c25d6(0x1c5)]=_0x50c430['apiDir'];if(_0x50c430['cookie'])_0x2faaa8[_0x8c25d6(0x199)]=_0x50c430[_0x8c25d6(0x199)];if(_0x50c430[_0x8c25d6(0x1b2)])_0x2faaa8[_0x8c25d6(0x1b2)]=_0x50c430[_0x8c25d6(0x1b2)];if(_0x50c430[_0x8c25d6(0x1bc)])_0x2faaa8['format']=_0x50c430['format'];if(_0x50c430[_0x8c25d6(0x1b1)])_0x2faaa8['pageSize']=_0x50c430[_0x8c25d6(0x1b1)];if(_0x50c430[_0x8c25d6(0x19d)])_0x2faaa8['riskLevel']=_0x50c430[_0x8c25d6(0x19d)];if(_0x50c430['locale'])_0x2faaa8[_0x8c25d6(0x19a)]=_0x50c430[_0x8c25d6(0x19a)];_0x50c430[_0x8c25d6(0x1b6)][_0x20ae3e]=_0x2faaa8,_0x50c430['defaultApp']=_0x20ae3e,delete _0x50c430['appcode'],delete _0x50c430['app'],console['log'](_0x8c25d6(0x1ad)+_0x20ae3e+_0x8c25d6(0x1bd));}function a16_0x58a6(_0x948f0a,_0x1ce4d5){_0x948f0a=_0x948f0a-0x182;const _0x260908=a16_0x2609();let _0x58a696=_0x260908[_0x948f0a];return _0x58a696;}function addApp(_0x12cb99,_0xf7b46f,_0xd5c217){const _0x33fc5f=a16_0x58a6,_0x1f48df=_0xf7b46f[0x0];!_0x1f48df&&(console['error']('Usage:\x20rabetbase\x20app\x20add\x20<name>\x20--appcode\x20<code>\x20[--env\x20<env>]\x20[--apiDir\x20<dir>]\x20[--global]'),process[_0x33fc5f(0x1a7)](0x1));const _0x406275=_0xd5c217[_0x33fc5f(0x1c2)];!_0x406275&&(console['error'](_0x33fc5f(0x1b9)),process[_0x33fc5f(0x1a7)](0x1));const _0x24c566=readConfig(_0xd5c217);if(!_0x24c566['apps'])_0x24c566[_0x33fc5f(0x1b6)]={};Object[_0x33fc5f(0x186)](_0x24c566[_0x33fc5f(0x1b6)])[_0x33fc5f(0x18b)]===0x0&&migrateLegacySingleApp(_0x24c566,_0x1f48df);const _0x3a1505={'appcode':_0x406275};if(_0xd5c217['env'])_0x3a1505[_0x33fc5f(0x194)]=_0xd5c217[_0x33fc5f(0x194)];if(_0xd5c217['apiDir']||_0xd5c217[_0x33fc5f(0x1bb)])_0x3a1505[_0x33fc5f(0x1c5)]=_0xd5c217[_0x33fc5f(0x1c5)]||_0xd5c217[_0x33fc5f(0x1bb)];if(_0xd5c217[_0x33fc5f(0x199)])_0x3a1505['cookie']=_0xd5c217[_0x33fc5f(0x199)];if(_0xd5c217['accessKey']||_0xd5c217['accesskey'])_0x3a1505[_0x33fc5f(0x1b2)]=_0xd5c217[_0x33fc5f(0x1b2)]||_0xd5c217[_0x33fc5f(0x1b7)];if(_0xd5c217[_0x33fc5f(0x1bc)])_0x3a1505[_0x33fc5f(0x1bc)]=_0xd5c217[_0x33fc5f(0x1bc)];if(_0xd5c217[_0x33fc5f(0x1b1)]||_0xd5c217[_0x33fc5f(0x1c1)])_0x3a1505[_0x33fc5f(0x1b1)]=Number(_0xd5c217['pageSize']||_0xd5c217[_0x33fc5f(0x1c1)]);if(_0xd5c217[_0x33fc5f(0x19d)]||_0xd5c217[_0x33fc5f(0x1a1)])_0x3a1505['riskLevel']=_0xd5c217['riskLevel']||_0xd5c217[_0x33fc5f(0x1a1)];if(_0xd5c217[_0x33fc5f(0x19a)])_0x3a1505[_0x33fc5f(0x19a)]=_0xd5c217[_0x33fc5f(0x19a)];const _0x4f7695=!!_0x24c566[_0x33fc5f(0x1b6)][_0x1f48df];_0x24c566[_0x33fc5f(0x1b6)][_0x1f48df]=_0x3a1505;!_0x24c566[_0x33fc5f(0x1b4)]&&(_0x24c566['defaultApp']=_0x1f48df);writeConfig(_0x24c566,_0xd5c217);const _0x114b88=_0xd5c217[_0x33fc5f(0x1b0)]?_0x33fc5f(0x1c8):'';console[_0x33fc5f(0x1c4)]((_0x4f7695?'Updated':_0x33fc5f(0x1a3))+_0x33fc5f(0x1a2)+_0x1f48df+_0x33fc5f(0x19b)+_0x406275+')'+_0x114b88),_0x24c566['defaultApp']===_0x1f48df&&!_0x4f7695&&console[_0x33fc5f(0x1c4)](_0x33fc5f(0x1a0));}function removeApp(_0x4cd8cc,_0x2e5156,_0x196a08){const _0x19fea1=a16_0x58a6,_0x491d24=_0x2e5156[0x0];!_0x491d24&&(console['error'](_0x19fea1(0x1c9)),process[_0x19fea1(0x1a7)](0x1));const _0xf5eeea=readConfig(_0x196a08);(!_0xf5eeea['apps']||!_0xf5eeea[_0x19fea1(0x1b6)][_0x491d24])&&(console[_0x19fea1(0x1aa)]('App\x20\x22'+_0x491d24+_0x19fea1(0x18a)),process[_0x19fea1(0x1a7)](0x1));delete _0xf5eeea[_0x19fea1(0x1b6)][_0x491d24];if(_0xf5eeea[_0x19fea1(0x1b4)]===_0x491d24){const _0x3bcf64=Object[_0x19fea1(0x186)](_0xf5eeea['apps']);_0xf5eeea['defaultApp']=_0x3bcf64[_0x19fea1(0x18b)]>0x0?_0x3bcf64[0x0]:undefined,_0xf5eeea[_0x19fea1(0x1b4)]?console['log']('Default\x20app\x20changed\x20to\x20\x22'+_0xf5eeea[_0x19fea1(0x1b4)]+'\x22.'):delete _0xf5eeea[_0x19fea1(0x1b4)];}Object[_0x19fea1(0x186)](_0xf5eeea['apps'])['length']===0x0&&(delete _0xf5eeea[_0x19fea1(0x1b6)],delete _0xf5eeea[_0x19fea1(0x1b4)]),writeConfig(_0xf5eeea,_0x196a08),console['log'](_0x19fea1(0x193)+_0x491d24+'\x22.');}export const appCommand={'name':a16_0x254741(0x1ab),'description':a16_0x254741(0x182),async 'run'(_0x1fa5a7,_0x38d881,_0x59b87b){const _0x3b7ef9=a16_0x254741,_0x197335=_0x38d881[0x0],_0x1caa54=_0x38d881[_0x3b7ef9(0x1c7)](0x1);switch(_0x197335){case _0x3b7ef9(0x195):listApps(_0x1fa5a7);break;case _0x3b7ef9(0x188):useApp(_0x1fa5a7,_0x1caa54,_0x59b87b);break;case _0x3b7ef9(0x1a5):addApp(_0x1fa5a7,_0x1caa54,_0x59b87b);break;case _0x3b7ef9(0x18c):removeApp(_0x1fa5a7,_0x1caa54,_0x59b87b);break;default:listApps(_0x1fa5a7);break;}}};
|
package/lib/commands/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a17_0x5335(){const _0x4defd5=['Authenticate\x20with\x20rabetbase','95qnpqPy','516678OHnlMB','13166289JAHukE','2451351opHxmN','8570368gPZeSl','auth','1971364sFLimW','220980zeUXux','4lVuCfO','242537Uastum'];a17_0x5335=function(){return _0x4defd5;};return a17_0x5335();}const a17_0x4243e6=a17_0x377d;function a17_0x377d(_0x35c627,_0x4089b4){_0x35c627=_0x35c627-0x99;const _0x5335b2=a17_0x5335();let _0x377df6=_0x5335b2[_0x35c627];return _0x377df6;}(function(_0x4b417b,_0x2f088e){const _0x3c6b58=a17_0x377d,_0x4759bf=_0x4b417b();while(!![]){try{const _0x57f4ec=parseInt(_0x3c6b58(0xa0))/0x1+-parseInt(_0x3c6b58(0x9f))/0x2*(-parseInt(_0x3c6b58(0xa3))/0x3)+-parseInt(_0x3c6b58(0x9d))/0x4+parseInt(_0x3c6b58(0xa2))/0x5*(parseInt(_0x3c6b58(0x9e))/0x6)+-parseInt(_0x3c6b58(0x9a))/0x7+-parseInt(_0x3c6b58(0x9b))/0x8+parseInt(_0x3c6b58(0x99))/0x9;if(_0x57f4ec===_0x2f088e)break;else _0x4759bf['push'](_0x4759bf['shift']());}catch(_0x131149){_0x4759bf['push'](_0x4759bf['shift']());}}}(a17_0x5335,0xcbf16));import{jsx as a17_0x38b996}from'react/jsx-runtime';import{render}from'ink';import{AuthServer}from'../auth/auth-server-ui.js';export const authCommand={'name':a17_0x4243e6(0x9c),'description':a17_0x4243e6(0xa1),async 'run'(_0x395739,_0x1e6e2b,_0x116d46){render(a17_0x38b996(AuthServer,{}));}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a18_0x3216(_0x25953c,_0x31b397){_0x25953c=_0x25953c-0x1a7;const _0x427381=a18_0x4273();let _0x32163b=_0x427381[_0x25953c];return _0x32163b;}const a18_0x5387f5=a18_0x3216;(function(_0x56e063,_0x39bd0e){const _0x2e4768=a18_0x3216,_0x4c4123=_0x56e063();while(!![]){try{const _0x5420b3=parseInt(_0x2e4768(0x1ce))/0x1*(parseInt(_0x2e4768(0x1ab))/0x2)+parseInt(_0x2e4768(0x1b9))/0x3*(-parseInt(_0x2e4768(0x1bb))/0x4)+parseInt(_0x2e4768(0x1c9))/0x5+parseInt(_0x2e4768(0x1ba))/0x6*(-parseInt(_0x2e4768(0x1b7))/0x7)+parseInt(_0x2e4768(0x1c6))/0x8*(-parseInt(_0x2e4768(0x1c2))/0x9)+parseInt(_0x2e4768(0x1be))/0xa+-parseInt(_0x2e4768(0x1ac))/0xb*(parseInt(_0x2e4768(0x1b5))/0xc);if(_0x5420b3===_0x39bd0e)break;else _0x4c4123['push'](_0x4c4123['shift']());}catch(_0x2f3170){_0x4c4123['push'](_0x4c4123['shift']());}}}(a18_0x4273,0x59773));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';export const bffDelete={'service':a18_0x5387f5(0x1b3),'command':a18_0x5387f5(0x1ad),'description':'Delete\x20a\x20BFF\x20script\x20from\x20remote\x20and\x20local','risk':a18_0x5387f5(0x1ae),'flags':[{'name':'target','type':a18_0x5387f5(0x1c5),'required':!![],'description':a18_0x5387f5(0x1b2)}],async 'validate'(_0x1c4e85){const _0x26ef5d=a18_0x5387f5,_0x2a5a48=loadBffProjectConfig(_0x1c4e85['appCode']),_0x233ba0=await readBffLockFile(_0x2a5a48[_0x26ef5d(0x1b8)]);if(!_0x233ba0)throw CliErrors[_0x26ef5d(0x1cb)](_0x26ef5d(0x1ca));},async 'execute'(_0x2f0e73){const _0x31731c=a18_0x5387f5,_0x5d5bf7=loadBffProjectConfig(_0x2f0e73['appCode']),_0xf33d90=await readBffLockFile(_0x5d5bf7['lockFilePath']);if(!_0xf33d90)throw CliErrors[_0x31731c(0x1cb)](_0x31731c(0x1bc));const {lockData:_0x3e613e,appLock:_0x11f2f0}=ensureLockScope(_0xf33d90,_0x5d5bf7[_0x31731c(0x1cf)],_0x5d5bf7[_0x31731c(0x1c3)],_0x31731c(0x1ad),_0x5d5bf7[_0x31731c(0x1cf)],_0x5d5bf7[_0x31731c(0x1aa)]+'/'+_0x5d5bf7[_0x31731c(0x1cf)]),_0x562d7b=_0x2f0e73[_0x31731c(0x1b1)](_0x31731c(0x1c1)),_0x22514d=Object['keys'](_0x11f2f0[_0x31731c(0x1d0)]),_0x3b81e8=resolveDeleteTarget(_0x562d7b,_0x22514d),_0x200c66=_0x11f2f0[_0x31731c(0x1d0)][_0x3b81e8];if(!_0x200c66)throw CliErrors['validation'](_0x31731c(0x1cc)+_0x3b81e8+'\x22.');await deleteBffScript(_0x200c66['remoteId']),delete _0x11f2f0[_0x31731c(0x1d0)][_0x3b81e8],_0x11f2f0['lastSync']=new Date()[_0x31731c(0x1d1)](),await writeBffLockFile(_0x5d5bf7['lockFilePath'],_0x3e613e);const _0x6ab4c6=resolveLocalFilePathFromLockKey(_0x5d5bf7,_0x3b81e8);let _0x64a4f;await fileExists(_0x6ab4c6)&&(_0x64a4f=await moveToTrash(_0x5d5bf7[_0x31731c(0x1d2)],_0x5d5bf7['trashDir'],_0x6ab4c6),await cleanupEmptyDirectories(dirname(_0x6ab4c6),_0x5d5bf7[_0x31731c(0x1bf)]));const _0x58f24a={'deleted':_0x3b81e8,'remoteId':_0x200c66[_0x31731c(0x1a7)]};if(_0x64a4f)_0x58f24a[_0x31731c(0x1c0)]=_0x64a4f;return{'ok':!![],'data':_0x58f24a,'message':_0x31731c(0x1b0)+_0x3b81e8+(_0x64a4f?_0x31731c(0x1af):'')};}};function a18_0x4273(){const _0x346008=['join','101871XgENiD','lockFilePath','39IzlCQY','42CWKXiH','16396eOQdeW','BFF\x20lock\x20file\x20not\x20found.','Function\x20not\x20found:\x20','4684360WDBkzF','scriptsRootDir','trashedTo','target','9EONvBp','scriptsRoot','includes','string','87496GQXhQL','split','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','2759220uWhbBK','BFF\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','validation','No\x20lock\x20entry\x20found\x20for\x20\x22','startsWith','73512VfueqR','appCode','functions','toISOString','projectRoot','\x20\x20-\x20','remoteId','map','length','scriptsWorkspaceRoot','8CyMiua','2866534SkuEej','delete','high-risk-write','\x20(local\x20file\x20moved\x20to\x20trash)','Deleted\x20','str','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','bff','replace','36VwHiwB'];a18_0x4273=function(){return _0x346008;};return a18_0x4273();}function resolveDeleteTarget(_0x300d39,_0x5697e3){const _0x3e5aa4=a18_0x5387f5;if(_0x300d39[_0x3e5aa4(0x1c4)]('/')){const _0x31debc=_0x5697e3['find'](_0x47c269=>_0x47c269===_0x300d39);if(!_0x31debc)throw CliErrors[_0x3e5aa4(0x1cb)](_0x3e5aa4(0x1bd)+_0x300d39);return _0x31debc;}const _0x13c688=_0x5697e3['filter'](_0x34f734=>_0x34f734[_0x3e5aa4(0x1c7)]('/')['at'](-0x1)===_0x300d39);if(_0x13c688[_0x3e5aa4(0x1a9)]===0x0)throw CliErrors['validation']('Function\x20not\x20found:\x20'+_0x300d39);if(_0x13c688[_0x3e5aa4(0x1a9)]>0x1)throw CliErrors['validation']('Multiple\x20functions\x20match\x20\x22'+_0x300d39+_0x3e5aa4(0x1c8)+_0x13c688[_0x3e5aa4(0x1a8)](_0x1353e3=>_0x3e5aa4(0x1d3)+_0x1353e3)[_0x3e5aa4(0x1b6)]('\x0a'));return _0x13c688[0x0];}async function moveToTrash(_0x4d63c6,_0x4d0560,_0x419266){const _0x253395=a18_0x5387f5,_0x4a42fb=new Date()[_0x253395(0x1d1)]()[_0x253395(0x1b4)](/[:.]/g,'-'),_0x44f499=relative(_0x4d63c6,_0x419266),_0x31a61d=join(_0x4d0560,_0x4a42fb,_0x44f499);return await mkdir(dirname(_0x31a61d),{'recursive':!![]}),await rename(_0x419266,_0x31a61d),_0x31a61d;}async function cleanupEmptyDirectories(_0x9c7234,_0x3ae2f2){const _0x733a46=a18_0x5387f5;let _0x2d8a75=resolve(_0x9c7234);const _0x2da860=resolve(_0x3ae2f2);while(_0x2d8a75[_0x733a46(0x1cd)](''+_0x2da860+sep)||_0x2d8a75===_0x2da860){if(_0x2d8a75===_0x2da860)return;try{const _0xaf11aa=await readdir(_0x2d8a75);if(_0xaf11aa[_0x733a46(0x1a9)]>0x0)return;await rmdir(_0x2d8a75);}catch{return;}_0x2d8a75=dirname(_0x2d8a75);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a19_0x14ebeb=a19_0x3723;(function(_0x5c9503,_0x1077fd){const _0x5d6e31=a19_0x3723,_0xe730cb=_0x5c9503();while(!![]){try{const _0x18601d=-parseInt(_0x5d6e31(0xab))/0x1+parseInt(_0x5d6e31(0xb3))/0x2+-parseInt(_0x5d6e31(0xa7))/0x3*(parseInt(_0x5d6e31(0xa4))/0x4)+-parseInt(_0x5d6e31(0xa5))/0x5+-parseInt(_0x5d6e31(0xb4))/0x6*(-parseInt(_0x5d6e31(0xb1))/0x7)+-parseInt(_0x5d6e31(0xb0))/0x8*(-parseInt(_0x5d6e31(0xa0))/0x9)+parseInt(_0x5d6e31(0xaa))/0xa;if(_0x18601d===_0x1077fd)break;else _0xe730cb['push'](_0xe730cb['shift']());}catch(_0x37e5c5){_0xe730cb['push'](_0xe730cb['shift']());}}}(a19_0x4320,0x686b5));function a19_0x4320(){const _0x11b768=['3443490JsUYvq','730370SRKGen','Get\x20BFF\x20script\x20details\x20by\x20ID','scriptContent','bff','updatedTime','368LiHiaI','4005932HOLKxr','verbose','1552174OoCMFC','6sEGuwf','createdTime','number','bool','read','120105VLveZX','num','appCode','Script\x20ID','588LLurHN','2374050UiDdHC','scriptType','13749zVTiVa','boolean','(none)'];a19_0x4320=function(){return _0x11b768;};return a19_0x4320();}function a19_0x3723(_0x4649a1,_0x114644){_0x4649a1=_0x4649a1-0x9f;const _0x432033=a19_0x4320();let _0x372386=_0x432033[_0x4649a1];return _0x372386;}import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a19_0x14ebeb(0xae),'command':'detail','description':a19_0x14ebeb(0xac),'risk':a19_0x14ebeb(0x9f),'flags':[{'name':'id','type':a19_0x14ebeb(0xb6),'required':!![],'description':a19_0x14ebeb(0xa3)},{'name':a19_0x14ebeb(0xb2),'type':a19_0x14ebeb(0xa8),'description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x595d3a){const _0x301956=a19_0x14ebeb,_0x38b442=await getBffScriptInfo(_0x595d3a[_0x301956(0xa1)]('id')),_0x4d8167=_0x595d3a[_0x301956(0xb7)]('verbose');if(_0x4d8167)return{'ok':!![],'data':_0x38b442};return{'ok':!![],'data':{'id':_0x38b442['id'],'appCode':_0x38b442[_0x301956(0xa2)],'scriptType':_0x38b442[_0x301956(0xa6)],'description':_0x38b442['description']||_0x301956(0xa9),'createdTime':_0x38b442[_0x301956(0xb5)]??'','updatedTime':_0x38b442[_0x301956(0xaf)]??'','scriptContent':_0x38b442[_0x301956(0xad)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a20_0x46bf(_0x33e552,_0x56b65b){_0x33e552=_0x33e552-0x7b;const _0x461913=a20_0x4619();let _0x46bf98=_0x461913[_0x33e552];return _0x46bf98;}(function(_0x2a822c,_0x2d98eb){const _0x4dcf09=a20_0x46bf,_0x188b22=_0x2a822c();while(!![]){try{const _0x2aef9b=-parseInt(_0x4dcf09(0x81))/0x1*(-parseInt(_0x4dcf09(0x7e))/0x2)+parseInt(_0x4dcf09(0x7d))/0x3+-parseInt(_0x4dcf09(0x85))/0x4*(parseInt(_0x4dcf09(0x80))/0x5)+-parseInt(_0x4dcf09(0x82))/0x6*(-parseInt(_0x4dcf09(0x7b))/0x7)+parseInt(_0x4dcf09(0x84))/0x8+-parseInt(_0x4dcf09(0x7f))/0x9*(parseInt(_0x4dcf09(0x7c))/0xa)+-parseInt(_0x4dcf09(0x83))/0xb;if(_0x2aef9b===_0x2d98eb)break;else _0x188b22['push'](_0x188b22['shift']());}catch(_0x27583d){_0x188b22['push'](_0x188b22['shift']());}}}(a20_0x4619,0xa155e));import{bffList}from'./list.js';import{bffDetail}from'./detail.js';import{bffStatus}from'./status.js';import{bffNew}from'./new.js';import{bffPush}from'./push.js';function a20_0x4619(){const _0x327d0f=['9VZebdk','255bzasJT','81421HzTJta','5979612QeJNAR','6405454vxRNlE','10392560sbddMQ','88360Wlwhkc','7eqmBNJ','8067830rzewos','1909746DeIlzT','6vfMIrv'];a20_0x4619=function(){return _0x327d0f;};return a20_0x4619();}import{bffPull}from'./pull.js';import{bffDelete}from'./delete.js';export const bffDefinitions=[bffList,bffDetail,bffStatus,bffNew,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a21_0x5f5c(_0x10e68c,_0x3fbbd9){_0x10e68c=_0x10e68c-0x18b;const _0x86afad=a21_0x86af();let _0x5f5c1b=_0x86afad[_0x10e68c];return _0x5f5c1b;}const a21_0x2aab9f=a21_0x5f5c;function a21_0x86af(){const _0x341b18=['No\x20BFF\x20scripts\x20found.','bool','type','289122HKzTvj','string','read','bff','124WHHagS','1266LABUUv','name','verbose','Filter\x20by\x20script\x20name','appCode','1626200HSyfCo','2801457LRCLMY','(unnamed)','Return\x20full\x20script\x20objects','7273YwnsxO','str','326613mkWsLn','scriptType','List\x20BFF\x20scripts','ENDPOINT','boolean','59005GhwtdU','functionName','length','map','30026oQesiY'];a21_0x86af=function(){return _0x341b18;};return a21_0x86af();}(function(_0x48f9d4,_0x37eec8){const _0x11b811=a21_0x5f5c,_0x58a115=_0x48f9d4();while(!![]){try{const _0x36c22a=-parseInt(_0x11b811(0x18d))/0x1+-parseInt(_0x11b811(0x196))/0x2+-parseInt(_0x11b811(0x19a))/0x3+parseInt(_0x11b811(0x19e))/0x4*(parseInt(_0x11b811(0x192))/0x5)+parseInt(_0x11b811(0x19f))/0x6*(parseInt(_0x11b811(0x18b))/0x7)+-parseInt(_0x11b811(0x1a4))/0x8+parseInt(_0x11b811(0x1a5))/0x9;if(_0x36c22a===_0x37eec8)break;else _0x58a115['push'](_0x58a115['shift']());}catch(_0x4047ab){_0x58a115['push'](_0x58a115['shift']());}}}(a21_0x86af,0x3e452));import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a21_0x2aab9f(0x19d),'command':'list','description':a21_0x2aab9f(0x18f),'risk':a21_0x2aab9f(0x19c),'flags':[{'name':a21_0x2aab9f(0x199),'type':a21_0x2aab9f(0x19b),'description':'Script\x20type\x20filter','default':a21_0x2aab9f(0x190),'enum':[a21_0x2aab9f(0x190),'COMMON']},{'name':a21_0x2aab9f(0x1a0),'type':a21_0x2aab9f(0x19b),'description':a21_0x2aab9f(0x1a2)},{'name':a21_0x2aab9f(0x1a1),'type':a21_0x2aab9f(0x191),'description':a21_0x2aab9f(0x1a7)}],async 'execute'(_0x415ee9){const _0x2ece39=a21_0x2aab9f,_0x1f6fb2=await listBffScripts(_0x415ee9[_0x2ece39(0x1a3)],_0x415ee9[_0x2ece39(0x18c)]('type'),{'scriptName':_0x415ee9[_0x2ece39(0x18c)]('name')||undefined}),_0x396430=_0x415ee9[_0x2ece39(0x198)](_0x2ece39(0x1a1));return{'ok':!![],'data':_0x396430?_0x1f6fb2:_0x1f6fb2[_0x2ece39(0x195)](_0x5ccad1=>({'id':_0x5ccad1['id'],'functionName':_0x5ccad1[_0x2ece39(0x193)]??'','description':_0x5ccad1['description']||_0x2ece39(0x1a6),'scriptType':_0x5ccad1[_0x2ece39(0x18e)]})),'message':_0x1f6fb2[_0x2ece39(0x194)]===0x0?_0x2ece39(0x197):undefined};}};
|
package/lib/commands/bff/new.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a23_0x7d0496=a23_0x1568;(function(_0x1e7970,_0x453f2c){const _0x5e3cf0=a23_0x1568,_0x34f8e2=_0x1e7970();while(!![]){try{const _0x22d04e=parseInt(_0x5e3cf0(0x1fc))/0x1+-parseInt(_0x5e3cf0(0x1c9))/0x2*(-parseInt(_0x5e3cf0(0x1df))/0x3)+parseInt(_0x5e3cf0(0x1da))/0x4*(parseInt(_0x5e3cf0(0x1d8))/0x5)+-parseInt(_0x5e3cf0(0x1ed))/0x6*(parseInt(_0x5e3cf0(0x1bb))/0x7)+parseInt(_0x5e3cf0(0x1f5))/0x8*(-parseInt(_0x5e3cf0(0x1e5))/0x9)+-parseInt(_0x5e3cf0(0x1ab))/0xa+-parseInt(_0x5e3cf0(0x1bc))/0xb*(parseInt(_0x5e3cf0(0x1b8))/0xc);if(_0x22d04e===_0x453f2c)break;else _0x34f8e2['push'](_0x34f8e2['shift']());}catch(_0x230e68){_0x34f8e2['push'](_0x34f8e2['shift']());}}}(a23_0x3066,0xd542a));import{createInterface}from'node:readline';function a23_0x1568(_0x1a9ffa,_0x14e563){_0x1a9ffa=_0x1a9ffa-0x1a6;const _0x30661b=a23_0x3066();let _0x156858=_0x30661b[_0x1a9ffa];return _0x156858;}import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffNew={'service':a23_0x7d0496(0x1ff),'command':a23_0x7d0496(0x1ea),'description':a23_0x7d0496(0x1ae),'risk':'write','flags':[{'name':'type','type':'string','required':!![],'enum':[a23_0x7d0496(0x1f9),a23_0x7d0496(0x1e3),a23_0x7d0496(0x1eb)],'description':a23_0x7d0496(0x1f3)},{'name':a23_0x7d0496(0x1f1),'type':a23_0x7d0496(0x1d5),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a23_0x7d0496(0x1b4),'type':a23_0x7d0496(0x1d5),'description':'Script\x20description'},{'name':a23_0x7d0496(0x1fb),'type':a23_0x7d0496(0x1d5),'description':a23_0x7d0496(0x1dc)},{'name':a23_0x7d0496(0x1ba),'type':a23_0x7d0496(0x1d5),'description':a23_0x7d0496(0x1b0)},{'name':a23_0x7d0496(0x1b3),'type':a23_0x7d0496(0x1d5),'description':a23_0x7d0496(0x1f8)},{'name':a23_0x7d0496(0x1cf),'type':a23_0x7d0496(0x1d5),'description':a23_0x7d0496(0x1b7),'enum':[a23_0x7d0496(0x1f6),a23_0x7d0496(0x1af)]}],async 'validate'(_0x3ea138){const _0x6ee182=a23_0x7d0496,_0x2deafe=_0x3ea138[_0x6ee182(0x1d4)](_0x6ee182(0x1f1));if(!isValidBffFunctionName(_0x2deafe))throw CliErrors[_0x6ee182(0x1e2)](_0x6ee182(0x1b6)+_0x2deafe+_0x6ee182(0x1b9));},async 'execute'(_0x25b8ff){const _0x201dfe=a23_0x7d0496,_0x3b8b37=loadBffProjectConfig(_0x25b8ff['appCode']),_0x220b24=_0x25b8ff['str'](_0x201dfe(0x1d9)),_0x1d4b99=_0x25b8ff[_0x201dfe(0x1d4)](_0x201dfe(0x1f1)),_0xaeadd2=_0x25b8ff['str'](_0x201dfe(0x1b4))||undefined,_0x50c096=_0x220b24===_0x201dfe(0x1eb)?await resolveHookOptions(_0x3b8b37,_0x25b8ff):undefined,_0x442a02=buildFilePath(_0x3b8b37,_0x220b24,_0x1d4b99,_0x50c096);if(await fileExists(_0x442a02))throw CliErrors[_0x201dfe(0x1e2)]('File\x20already\x20exists:\x20'+_0x442a02);await mkdir(dirname(_0x442a02),{'recursive':!![]});const _0x18df44=generateTemplate(_0x220b24,_0x1d4b99,_0x3b8b37,_0xaeadd2,_0x50c096);await writeFile(_0x442a02,_0x18df44,_0x201dfe(0x1dd));const _0x474743={'type':_0x220b24,'name':_0x1d4b99,'path':_0x442a02};if(_0xaeadd2)_0x474743[_0x201dfe(0x1b4)]=_0xaeadd2;if(_0x50c096){if(_0x50c096[_0x201dfe(0x1fb)])_0x474743[_0x201dfe(0x1fb)]=_0x50c096[_0x201dfe(0x1fb)];_0x474743[_0x201dfe(0x1f2)]=_0x50c096[_0x201dfe(0x1f2)],_0x474743[_0x201dfe(0x1d6)]=_0x50c096[_0x201dfe(0x1d6)],_0x474743['functionNode']=_0x50c096['functionNode'];}return{'ok':!![],'data':_0x474743,'message':_0x201dfe(0x1a9)+_0x220b24+_0x201dfe(0x1b5)+_0x1d4b99};}};async function resolveHookOptions(_0x601741,_0x5232e2){const _0x1e73be=a23_0x7d0496,_0x3d1de4=loadAliasMap(_0x5232e2[_0x1e73be(0x1fa)]),_0x240807=_0x3d1de4[_0x1e73be(0x1cc)]>0x0;let _0x44cf59,_0x1bbd62,_0x4ccde2;const _0x2f600f=_0x5232e2[_0x1e73be(0x1d4)](_0x1e73be(0x1fb)),_0x124b75=_0x5232e2[_0x1e73be(0x1d4)]('datasetcode');if(_0x2f600f){const _0x1e87b6=resolveAlias(_0x5232e2[_0x1e73be(0x1fa)],_0x2f600f);if(!_0x1e87b6){const _0x9f91cd=_0x240807?_0x1e73be(0x1b2)+_0x3d1de4[_0x1e73be(0x1ca)](_0x6983f5=>_0x6983f5[_0x1e73be(0x1fb)])[_0x1e73be(0x1ce)](',\x20'):_0x1e73be(0x1cd)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors['validation'](_0x1e73be(0x1ee)+_0x2f600f+'\x22\x20not\x20found.\x20'+_0x9f91cd);}_0x44cf59=_0x2f600f,_0x1bbd62=_0x1e87b6;}else{if(_0x124b75){_0x1bbd62=_0x124b75;const _0x1b7c1c=_0x3d1de4[_0x1e73be(0x1d7)](_0x3eee26=>_0x3eee26[_0x1e73be(0x1f2)]===_0x124b75);_0x44cf59=_0x1b7c1c?.[_0x1e73be(0x1fb)];}else{if(_0x5232e2[_0x1e73be(0x1bf)])throw CliErrors[_0x1e73be(0x1e2)](_0x1e73be(0x1e0));else{if(_0x240807){const _0x452b4b=_0x3d1de4[_0x1e73be(0x1ca)](_0xcb7834=>_0xcb7834['alias']+'\x20('+_0xcb7834[_0x1e73be(0x1d0)]+')'),_0x2b7e02=await promptSelect(_0x1e73be(0x1bd),_0x452b4b),_0x585e9f=_0x3d1de4[_0x2b7e02];if(!_0x585e9f)throw CliErrors[_0x1e73be(0x1e2)]('Invalid\x20dataset\x20selection.');_0x44cf59=_0x585e9f[_0x1e73be(0x1fb)],_0x1bbd62=_0x585e9f['datasetCode'];}else{const _0x1555b3=await listDatasets(_0x601741[_0x1e73be(0x1fd)]);if(_0x1555b3[_0x1e73be(0x1cc)]===0x0)throw CliErrors[_0x1e73be(0x1e2)](_0x1e73be(0x1de));const _0x210a8c=_0x1555b3[_0x1e73be(0x1ca)](_0xdc3a8b=>_0xdc3a8b[_0x1e73be(0x1f1)]+'\x20('+_0xdc3a8b['code']+')'),_0x400ac1=await promptSelect(_0x1e73be(0x1bd),_0x210a8c),_0x731461=_0x1555b3[_0x400ac1];if(!_0x731461)throw CliErrors[_0x1e73be(0x1e2)](_0x1e73be(0x1c8));_0x1bbd62=_0x731461[_0x1e73be(0x1e6)],_0x44cf59=undefined;}}}}const _0x341801=await listDatasets(_0x601741[_0x1e73be(0x1fd)]),_0x5cd48a=_0x341801[_0x1e73be(0x1d7)](_0x387dc8=>_0x387dc8[_0x1e73be(0x1e6)]===_0x1bbd62);if(!_0x5cd48a)throw CliErrors[_0x1e73be(0x1e2)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x1bbd62+_0x1e73be(0x1c3)+(_0x44cf59?_0x1e73be(0x1a8)+CLI_BIN_NAME+_0x1e73be(0x1c5):''));_0x4ccde2=_0x5cd48a['id'];const _0x39b38f=_0x44cf59??_0x1bbd62,_0x201c87=await listBffDatasetOperations(_0x601741[_0x1e73be(0x1fd)],_0x4ccde2),_0x4efeb1=_0x201c87?Object['keys'](_0x201c87):[];if(_0x4efeb1['length']===0x0)throw CliErrors[_0x1e73be(0x1e2)](_0x1e73be(0x1c7)+_0x39b38f+'.');let _0x23298c;const _0x2e1d3b=_0x5232e2[_0x1e73be(0x1d4)]('operation-type');if(_0x2e1d3b){if(!_0x4efeb1[_0x1e73be(0x1ec)](_0x2e1d3b))throw CliErrors[_0x1e73be(0x1e2)]('Operation\x20type\x20\x22'+_0x2e1d3b+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x39b38f+'.\x20'+(_0x1e73be(0x1ac)+_0x4efeb1[_0x1e73be(0x1ce)](',\x20')));_0x23298c=_0x2e1d3b;}else{if(_0x5232e2[_0x1e73be(0x1bf)])throw CliErrors[_0x1e73be(0x1e2)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x24d2c8=await promptSelect('Select\x20operation\x20type:',_0x4efeb1);_0x23298c=_0x4efeb1[_0x24d2c8]??_0x4efeb1[0x0];}let _0x4ec01d=normalizeHookFunctionNode(_0x5232e2['str']('function-node'));if(!_0x4ec01d){if(_0x5232e2[_0x1e73be(0x1d4)](_0x1e73be(0x1cf)))throw CliErrors[_0x1e73be(0x1e2)](_0x1e73be(0x1c6));if(_0x5232e2[_0x1e73be(0x1bf)])throw CliErrors[_0x1e73be(0x1e2)](_0x1e73be(0x1c4));const _0x517a41=await promptSelect('Select\x20trigger\x20node:',[_0x1e73be(0x1f6),'after']);_0x4ec01d=[_0x1e73be(0x1f6),_0x1e73be(0x1af)][_0x517a41]??_0x1e73be(0x1f6);}return{'alias':_0x44cf59,'datasetCode':_0x1bbd62,'datasetId':_0x4ccde2,'operationType':_0x23298c,'functionNode':_0x4ec01d};}async function promptSelect(_0x4344a0,_0x334b59){const _0x18870a=a23_0x7d0496;if(_0x334b59[_0x18870a(0x1cc)]===0x1)return 0x0;for(const [_0x23a313,_0x5d97b2]of _0x334b59['entries']()){process['stderr'][_0x18870a(0x1f4)]('\x20\x20'+(_0x23a313+0x1)+'.\x20'+_0x5d97b2+'\x0a');}const _0x3815c1=createInterface({'input':process[_0x18870a(0x1be)],'output':process[_0x18870a(0x1e1)]});while(!![]){const _0x1d3c07=await new Promise(_0x47538d=>{const _0x5a8e70=_0x18870a;_0x3815c1[_0x5a8e70(0x1d2)](_0x4344a0+'\x20',_0x47538d);}),_0x1fd371=Number[_0x18870a(0x1db)](_0x1d3c07[_0x18870a(0x1ad)](),0xa);if(Number[_0x18870a(0x1b1)](_0x1fd371)&&_0x1fd371>=0x1&&_0x1fd371<=_0x334b59[_0x18870a(0x1cc)])return _0x3815c1[_0x18870a(0x1c2)](),_0x1fd371-0x1;process[_0x18870a(0x1e1)]['write']('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x334b59[_0x18870a(0x1cc)]+'.\x0a');}}function buildFilePath(_0x121e8d,_0x488e08,_0x2c0027,_0x1609b4){const _0x449466=a23_0x7d0496;if(_0x488e08==='HOOK'){if(!_0x1609b4)throw CliErrors[_0x449466(0x1e2)](_0x449466(0x1c1));const _0x3d0a76=_0x1609b4[_0x449466(0x1fb)]??_0x1609b4['datasetCode'];return join(_0x121e8d[_0x449466(0x1ef)],_0x449466(0x1eb),_0x3d0a76,_0x1609b4[_0x449466(0x1d6)],_0x1609b4['functionNode'],_0x2c0027+_0x449466(0x1cb));}return join(_0x121e8d[_0x449466(0x1ef)],_0x488e08,_0x2c0027+'.js');}function a23_0x3066(){const _0x1890e7=['--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Invalid\x20dataset\x20selection.','18AqGHeb','map','.js','length','No\x20api.ts\x20found.\x20Run\x20`','join','function-node','tableName','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Request\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Business\x20result\x20(wrapped\x20in\x20response.data).\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','question','(params,\x20context)\x20{\x0a\x20\x20void\x20context;\x0a\x20\x20return\x20params;\x0a}\x0a','str','string','operationType','find','16565wJOxTd','type','1784XRSRIL','parseInt','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','utf8','No\x20datasets\x20found\x20for\x20this\x20app.','291087LcpjCf','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','stderr','validation','ENDPOINT','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Current\x20request\x20params\x20or\x20response\x20result.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Modified\x20params\x20object.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','9wAfzZV','code','\x0a\x20*\x20[脚本名称]\x20','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','new','HOOK','includes','16098CoRpCV','Alias\x20\x22','scriptsRootDir','TODO:\x20add\x20script\x20description','name','datasetCode','Script\x20type','write','8389816IfTJcO','before','.js\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Input\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Processing\x20result.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Operation\x20type\x20(HOOK\x20only)','COMMON','apiDir','alias','826716KTGjby','appCode','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','bff','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','Created\x20','\x0a\x20*\x20[触发节点]\x20','2835390JwQPpQ','Available:\x20','trim','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','after','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','isInteger','Available\x20aliases:\x20','operation-type','description','\x20function:\x20','Invalid\x20function\x20name\x20\x22','Trigger\x20node\x20(HOOK\x20only)','288bkqOcd','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','datasetcode','455xKzIMU','365475UYvjvf','Select\x20dataset:','stdin','nonInteractive','functionNode','HOOK\x20requires\x20alias/operation/node\x20options.','close','\x22.\x20','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x20api\x20pull`\x20to\x20refresh.'];a23_0x3066=function(){return _0x1890e7;};return a23_0x3066();}function generateTemplate(_0x453169,_0x2d13bc,_0x38cab0,_0x260e34,_0x37ba88){const _0x1c1026=a23_0x7d0496,_0x4cdb1c=_0x260e34?.[_0x1c1026(0x1ad)]()||_0x1c1026(0x1f0);if(_0x453169===_0x1c1026(0x1f9))return _0x1c1026(0x1a7)+_0x4cdb1c+_0x1c1026(0x1e7)+_0x2d13bc+_0x1c1026(0x1e9)+_0x2d13bc+_0x1c1026(0x1f7)+_0x2d13bc+_0x1c1026(0x1d3);if(_0x453169==='ENDPOINT')return _0x1c1026(0x1fe)+_0x4cdb1c+_0x1c1026(0x1a6)+_0x38cab0[_0x1c1026(0x1fd)]+'/endpoint/'+_0x2d13bc+_0x1c1026(0x1d1)+_0x2d13bc+_0x1c1026(0x1d3);if(!_0x37ba88)throw CliErrors[_0x1c1026(0x1e2)](_0x1c1026(0x1e8));return'/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x4cdb1c+_0x1c1026(0x1a6)+_0x38cab0[_0x1c1026(0x1fd)]+'/'+_0x37ba88[_0x1c1026(0x1f2)]+'/'+_0x37ba88['operationType']+_0x1c1026(0x1aa)+_0x37ba88[_0x1c1026(0x1c0)]+_0x1c1026(0x1e4)+_0x2d13bc+_0x1c1026(0x1d3);}
|
|
1
|
+
const a22_0x56bc11=a22_0xe834;(function(_0x5653ae,_0x303b89){const _0xe1fcd=a22_0xe834,_0x4b9304=_0x5653ae();while(!![]){try{const _0x5db4bb=-parseInt(_0xe1fcd(0xb0))/0x1*(-parseInt(_0xe1fcd(0x9c))/0x2)+-parseInt(_0xe1fcd(0xb5))/0x3+parseInt(_0xe1fcd(0xde))/0x4+parseInt(_0xe1fcd(0xa3))/0x5+parseInt(_0xe1fcd(0xa5))/0x6+-parseInt(_0xe1fcd(0xd7))/0x7+parseInt(_0xe1fcd(0xeb))/0x8*(-parseInt(_0xe1fcd(0xcc))/0x9);if(_0x5db4bb===_0x303b89)break;else _0x4b9304['push'](_0x4b9304['shift']());}catch(_0x30b568){_0x4b9304['push'](_0x4b9304['shift']());}}}(a22_0x1858,0xb985d));function a22_0x1858(){const _0xe9f827=['1611pIcgKI','\x0a\x20*\x20[脚本名称]\x20','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','\x20api\x20pull`\x20to\x20refresh.','366585TvVXMC','appCode','TODO:\x20add\x20script\x20description','str','COMMON','includes','File\x20already\x20exists:\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Dataset\x20not\x20found\x20for\x20code\x20\x22','alias','(params,\x20context)\x20{\x0a\x20\x20void\x20context;\x0a\x20\x20return\x20params;\x0a}\x0a','stdin','type','length','datasetcode','No\x20operation\x20types\x20found\x20for\x20dataset\x20','map','\x0a\x20*\x20[触发节点]\x20','find','tableName','parseInt','apiDir','Operation\x20type\x20\x22','140085aMObBy','\x22.\x20','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','datasetCode','ENDPOINT','HOOK','operation-type','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','utf8','validation','question','4933467pvOBpt','code','Script\x20description','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Created\x20','write','5813396GAnBHF','Alias\x20\x22','name','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','.js','\x20function:\x20','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','No\x20api.ts\x20found.\x20Run\x20`','\x22\x20not\x20found.\x20','HOOK\x20requires\x20alias/operation/node\x20options.','close','Select\x20trigger\x20node:','operationType','696IdcqQL','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','Select\x20dataset:','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','.js\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Input\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Processing\x20result.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','new','function-node','Trigger\x20node\x20(HOOK\x20only)','Invalid\x20dataset\x20selection.','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Current\x20request\x20params\x20or\x20response\x20result.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Modified\x20params\x20object.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','description','stderr','No\x20datasets\x20found\x20for\x20this\x20app.','74OMvreH','join','before','\x22\x20not\x20found\x20for\x20dataset\x20','entries','Available:\x20','Available\x20aliases:\x20','516090fcSLlA','scriptsRootDir','7949148CsjUYZ','keys','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','after','Invalid\x20function\x20name\x20\x22','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','functionNode','string','isInteger','nonInteractive'];a22_0x1858=function(){return _0xe9f827;};return a22_0x1858();}import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffNew={'service':'bff','command':a22_0x56bc11(0x94),'description':a22_0x56bc11(0xe1),'risk':a22_0x56bc11(0xdd),'flags':[{'name':a22_0x56bc11(0xc1),'type':a22_0x56bc11(0xad),'required':!![],'enum':[a22_0x56bc11(0xb9),'ENDPOINT',a22_0x56bc11(0xd1)],'description':'Script\x20type'},{'name':a22_0x56bc11(0xe0),'type':'string','required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':'description','type':a22_0x56bc11(0xad),'description':a22_0x56bc11(0xd9)},{'name':'alias','type':a22_0x56bc11(0xad),'description':a22_0x56bc11(0xdb)},{'name':a22_0x56bc11(0xc3),'type':a22_0x56bc11(0xad),'description':a22_0x56bc11(0xab)},{'name':a22_0x56bc11(0xd2),'type':a22_0x56bc11(0xad),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a22_0x56bc11(0xad),'description':a22_0x56bc11(0x96),'enum':[a22_0x56bc11(0x9e),a22_0x56bc11(0xa8)]}],async 'validate'(_0x67edf7){const _0x1e8500=a22_0x56bc11,_0x19b48a=_0x67edf7[_0x1e8500(0xb8)](_0x1e8500(0xe0));if(!isValidBffFunctionName(_0x19b48a))throw CliErrors[_0x1e8500(0xd5)](_0x1e8500(0xa9)+_0x19b48a+_0x1e8500(0xd3));},async 'execute'(_0x1aa221){const _0x374b71=a22_0x56bc11,_0x5b5801=loadBffProjectConfig(_0x1aa221[_0x374b71(0xb6)]),_0x261902=_0x1aa221[_0x374b71(0xb8)]('type'),_0x127daf=_0x1aa221[_0x374b71(0xb8)]('name'),_0x330c79=_0x1aa221[_0x374b71(0xb8)](_0x374b71(0x99))||undefined,_0x2b8e26=_0x261902==='HOOK'?await resolveHookOptions(_0x5b5801,_0x1aa221):undefined,_0x1af1f5=buildFilePath(_0x5b5801,_0x261902,_0x127daf,_0x2b8e26);if(await fileExists(_0x1af1f5))throw CliErrors[_0x374b71(0xd5)](_0x374b71(0xbb)+_0x1af1f5);await mkdir(dirname(_0x1af1f5),{'recursive':!![]});const _0x103351=generateTemplate(_0x261902,_0x127daf,_0x5b5801,_0x330c79,_0x2b8e26);await writeFile(_0x1af1f5,_0x103351,_0x374b71(0xd4));const _0x2f5fe1={'type':_0x261902,'name':_0x127daf,'path':_0x1af1f5};if(_0x330c79)_0x2f5fe1[_0x374b71(0x99)]=_0x330c79;if(_0x2b8e26){if(_0x2b8e26[_0x374b71(0xbe)])_0x2f5fe1['alias']=_0x2b8e26[_0x374b71(0xbe)];_0x2f5fe1['datasetCode']=_0x2b8e26[_0x374b71(0xcf)],_0x2f5fe1[_0x374b71(0xea)]=_0x2b8e26[_0x374b71(0xea)],_0x2f5fe1[_0x374b71(0xac)]=_0x2b8e26['functionNode'];}return{'ok':!![],'data':_0x2f5fe1,'message':_0x374b71(0xdc)+_0x261902+_0x374b71(0xe3)+_0x127daf};}};async function resolveHookOptions(_0x2aa348,_0x20a0f7){const _0x23356c=a22_0x56bc11,_0x3c80ea=loadAliasMap(_0x20a0f7[_0x23356c(0xca)]),_0x9bd01b=_0x3c80ea[_0x23356c(0xc2)]>0x0;let _0x420c20,_0x4c93de,_0x541fa9;const _0x272b63=_0x20a0f7['str'](_0x23356c(0xbe)),_0x4106a2=_0x20a0f7['str'](_0x23356c(0xc3));if(_0x272b63){const _0x1be821=resolveAlias(_0x20a0f7['apiDir'],_0x272b63);if(!_0x1be821){const _0x260f1e=_0x9bd01b?_0x23356c(0xa2)+_0x3c80ea[_0x23356c(0xc5)](_0x498071=>_0x498071[_0x23356c(0xbe)])['join'](',\x20'):_0x23356c(0xe5)+CLI_BIN_NAME+_0x23356c(0xbc);throw CliErrors[_0x23356c(0xd5)](_0x23356c(0xdf)+_0x272b63+_0x23356c(0xe6)+_0x260f1e);}_0x420c20=_0x272b63,_0x4c93de=_0x1be821;}else{if(_0x4106a2){_0x4c93de=_0x4106a2;const _0x9ce6a7=_0x3c80ea[_0x23356c(0xc7)](_0x331743=>_0x331743[_0x23356c(0xcf)]===_0x4106a2);_0x420c20=_0x9ce6a7?.[_0x23356c(0xbe)];}else{if(_0x20a0f7[_0x23356c(0xaf)])throw CliErrors[_0x23356c(0xd5)](_0x23356c(0xee));else{if(_0x9bd01b){const _0x307ff1=_0x3c80ea[_0x23356c(0xc5)](_0xf13827=>_0xf13827[_0x23356c(0xbe)]+'\x20('+_0xf13827[_0x23356c(0xc8)]+')'),_0x17ed51=await promptSelect('Select\x20dataset:',_0x307ff1),_0x484e8a=_0x3c80ea[_0x17ed51];if(!_0x484e8a)throw CliErrors[_0x23356c(0xd5)](_0x23356c(0x97));_0x420c20=_0x484e8a[_0x23356c(0xbe)],_0x4c93de=_0x484e8a[_0x23356c(0xcf)];}else{const _0x4d22bf=await listDatasets(_0x2aa348[_0x23356c(0xb6)]);if(_0x4d22bf[_0x23356c(0xc2)]===0x0)throw CliErrors[_0x23356c(0xd5)](_0x23356c(0x9b));const _0x35d1f1=_0x4d22bf[_0x23356c(0xc5)](_0x3e0985=>_0x3e0985[_0x23356c(0xe0)]+'\x20('+_0x3e0985[_0x23356c(0xd8)]+')'),_0x3bad5f=await promptSelect(_0x23356c(0xed),_0x35d1f1),_0x35e902=_0x4d22bf[_0x3bad5f];if(!_0x35e902)throw CliErrors[_0x23356c(0xd5)](_0x23356c(0x97));_0x4c93de=_0x35e902['code'],_0x420c20=undefined;}}}}const _0x5d3042=await listDatasets(_0x2aa348['appCode']),_0x4f63f6=_0x5d3042['find'](_0x5b6361=>_0x5b6361[_0x23356c(0xd8)]===_0x4c93de);if(!_0x4f63f6)throw CliErrors[_0x23356c(0xd5)](_0x23356c(0xbd)+_0x4c93de+_0x23356c(0xcd)+(_0x420c20?_0x23356c(0xda)+CLI_BIN_NAME+_0x23356c(0xb4):''));_0x541fa9=_0x4f63f6['id'];const _0x41cbac=_0x420c20??_0x4c93de,_0x3a0e5a=await listBffDatasetOperations(_0x2aa348[_0x23356c(0xb6)],_0x541fa9),_0x36aa3d=_0x3a0e5a?Object[_0x23356c(0xa6)](_0x3a0e5a):[];if(_0x36aa3d[_0x23356c(0xc2)]===0x0)throw CliErrors['validation'](_0x23356c(0xc4)+_0x41cbac+'.');let _0x1beb0c;const _0x5ecd05=_0x20a0f7[_0x23356c(0xb8)]('operation-type');if(_0x5ecd05){if(!_0x36aa3d[_0x23356c(0xba)](_0x5ecd05))throw CliErrors[_0x23356c(0xd5)](_0x23356c(0xcb)+_0x5ecd05+_0x23356c(0x9f)+_0x41cbac+'.\x20'+(_0x23356c(0xa1)+_0x36aa3d[_0x23356c(0x9d)](',\x20')));_0x1beb0c=_0x5ecd05;}else{if(_0x20a0f7[_0x23356c(0xaf)])throw CliErrors[_0x23356c(0xd5)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x28c6d2=await promptSelect('Select\x20operation\x20type:',_0x36aa3d);_0x1beb0c=_0x36aa3d[_0x28c6d2]??_0x36aa3d[0x0];}let _0xe3dc04=normalizeHookFunctionNode(_0x20a0f7['str'](_0x23356c(0x95)));if(!_0xe3dc04){if(_0x20a0f7['str'](_0x23356c(0x95)))throw CliErrors[_0x23356c(0xd5)](_0x23356c(0xce));if(_0x20a0f7[_0x23356c(0xaf)])throw CliErrors[_0x23356c(0xd5)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x4eaa01=await promptSelect(_0x23356c(0xe9),[_0x23356c(0x9e),_0x23356c(0xa8)]);_0xe3dc04=[_0x23356c(0x9e),_0x23356c(0xa8)][_0x4eaa01]??'before';}return{'alias':_0x420c20,'datasetCode':_0x4c93de,'datasetId':_0x541fa9,'operationType':_0x1beb0c,'functionNode':_0xe3dc04};}function a22_0xe834(_0x3760a1,_0x275a5f){_0x3760a1=_0x3760a1-0x93;const _0x18588c=a22_0x1858();let _0xe8341=_0x18588c[_0x3760a1];return _0xe8341;}async function promptSelect(_0x3dd0d9,_0x144e55){const _0x422785=a22_0x56bc11;if(_0x144e55['length']===0x1)return 0x0;for(const [_0x4b6ec0,_0x55c031]of _0x144e55[_0x422785(0xa0)]()){process[_0x422785(0x9a)][_0x422785(0xdd)]('\x20\x20'+(_0x4b6ec0+0x1)+'.\x20'+_0x55c031+'\x0a');}const _0x3db3c0=createInterface({'input':process[_0x422785(0xc0)],'output':process[_0x422785(0x9a)]});while(!![]){const _0x4047eb=await new Promise(_0x1d072e=>{const _0x58f58d=_0x422785;_0x3db3c0[_0x58f58d(0xd6)](_0x3dd0d9+'\x20',_0x1d072e);}),_0x2c7a42=Number[_0x422785(0xc9)](_0x4047eb['trim'](),0xa);if(Number[_0x422785(0xae)](_0x2c7a42)&&_0x2c7a42>=0x1&&_0x2c7a42<=_0x144e55[_0x422785(0xc2)])return _0x3db3c0[_0x422785(0xe8)](),_0x2c7a42-0x1;process['stderr'][_0x422785(0xdd)](_0x422785(0xe4)+_0x144e55['length']+'.\x0a');}}function buildFilePath(_0x2f0fb8,_0x2bbead,_0x59bd2e,_0x4a7851){const _0x532878=a22_0x56bc11;if(_0x2bbead===_0x532878(0xd1)){if(!_0x4a7851)throw CliErrors['validation'](_0x532878(0xe7));const _0x23130b=_0x4a7851[_0x532878(0xbe)]??_0x4a7851[_0x532878(0xcf)];return join(_0x2f0fb8['scriptsRootDir'],_0x532878(0xd1),_0x23130b,_0x4a7851['operationType'],_0x4a7851[_0x532878(0xac)],_0x59bd2e+_0x532878(0xe2));}return join(_0x2f0fb8[_0x532878(0xa4)],_0x2bbead,_0x59bd2e+_0x532878(0xe2));}function generateTemplate(_0x33e03f,_0x4f9c02,_0x19db36,_0x41ab76,_0x32e53a){const _0x18361b=a22_0x56bc11,_0x207936=_0x41ab76?.['trim']()||_0x18361b(0xb7);if(_0x33e03f==='COMMON')return'/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x207936+_0x18361b(0xb1)+_0x4f9c02+_0x18361b(0xb3)+_0x4f9c02+_0x18361b(0x93)+_0x4f9c02+_0x18361b(0xbf);if(_0x33e03f===_0x18361b(0xd0))return _0x18361b(0xa7)+_0x207936+_0x18361b(0xec)+_0x19db36[_0x18361b(0xb6)]+'/endpoint/'+_0x4f9c02+'\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Request\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Business\x20result\x20(wrapped\x20in\x20response.data).\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x4f9c02+_0x18361b(0xbf);if(!_0x32e53a)throw CliErrors[_0x18361b(0xd5)](_0x18361b(0xb2));return _0x18361b(0xaa)+_0x207936+_0x18361b(0xec)+_0x19db36[_0x18361b(0xb6)]+'/'+_0x32e53a[_0x18361b(0xcf)]+'/'+_0x32e53a['operationType']+_0x18361b(0xc6)+_0x32e53a['functionNode']+_0x18361b(0x98)+_0x4f9c02+_0x18361b(0xbf);}
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a23_0x250d08=a23_0x1c1b;(function(_0x45fdd7,_0x2b0003){const _0x17dc8c=a23_0x1c1b,_0x47a080=_0x45fdd7();while(!![]){try{const _0x181898=parseInt(_0x17dc8c(0xf4))/0x1+parseInt(_0x17dc8c(0x10e))/0x2*(parseInt(_0x17dc8c(0x11c))/0x3)+parseInt(_0x17dc8c(0x107))/0x4*(-parseInt(_0x17dc8c(0x111))/0x5)+parseInt(_0x17dc8c(0x109))/0x6+parseInt(_0x17dc8c(0xf0))/0x7*(-parseInt(_0x17dc8c(0x120))/0x8)+-parseInt(_0x17dc8c(0xed))/0x9*(parseInt(_0x17dc8c(0xef))/0xa)+parseInt(_0x17dc8c(0x126))/0xb;if(_0x181898===_0x2b0003)break;else _0x47a080['push'](_0x47a080['shift']());}catch(_0x1758b3){_0x47a080['push'](_0x47a080['shift']());}}}(a23_0x1349,0xe1da1));import{createInterface}from'node:readline';import{writeFile}from'node:fs/promises';import{listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';function a23_0x1349(){const _0x1a496c=['functionNode','ENDPOINT','Pull\x20complete:\x20','utf8','functions','push','bff','1785GaPzMn','apps','functionName','type','8dKZAcq','fromEntries','Remote\x20script\x20missing\x20id.','map','write','datasetCode','39255909hwYHJd','validation','nonInteractive','\x20failed','\x20pulled,\x20','operationType','str','string','Remote\x20script\x20missing\x20content.','apiDir','length','trim','Force\x20overwrite\x20local\x20unsynced\x20changes','message','appCode','Force\x20pull\x20cancelled.','1696392wnaWTE','boolean','70qxLREZ','8089963xLwxQQ','lastSync','Would\x20pull\x20','GET','656664HXpmRi','stderr','scriptsRoot','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','alias','aliases','scriptsWorkspaceRoot','bool','hookLocation','No\x20remote\x20BFF\x20scripts\x20found.','includes','scriptType','question','close','Pull\x20only\x20this\x20script\x20type','filePath','toLowerCase','all','force','5476dsMBTE','pull','324096nzmbKu','toISOString','lockKey','local\x20unsynced\x20changes','COMMON','450hAiCtN','hash','\x20file(s)','3700KdAGcc','lockFilePath','\x20skipped,\x20','scriptContent'];a23_0x1349=function(){return _0x1a496c;};return a23_0x1349();}import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,ensureParentDirectory,fileExists,normalizeBffType,resolveRemoteScriptTarget}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';export const bffPull={'service':a23_0x250d08(0x11b),'command':'pull','description':'Pull\x20remote\x20BFF\x20scripts\x20to\x20local','risk':a23_0x250d08(0x124),'flags':[{'name':'type','type':a23_0x250d08(0x12d),'description':a23_0x250d08(0x102),'enum':[a23_0x250d08(0x10d),a23_0x250d08(0x116),'HOOK']},{'name':a23_0x250d08(0x106),'type':a23_0x250d08(0xee),'description':a23_0x250d08(0xe9)}],async 'dryRun'(_0x2df3d1){const _0x266d58=a23_0x250d08,_0x5e3e6b=loadBffProjectConfig(_0x2df3d1[_0x266d58(0xeb)]),_0x33bf04=await readBffLockFile(_0x5e3e6b['lockFilePath']),{appLock:_0x557fa1}=ensureLockScope(_0x33bf04??createEmptyBffLock(),_0x5e3e6b[_0x266d58(0xeb)],_0x5e3e6b[_0x266d58(0xf6)],_0x266d58(0x108),_0x5e3e6b[_0x266d58(0xeb)],_0x5e3e6b[_0x266d58(0xfa)]+'/'+_0x5e3e6b['appCode']),_0x369cc6=buildDatasetCodeToAliasMap(_0x2df3d1[_0x266d58(0x12f)]),_0x5b8ffb=normalizeBffType(_0x2df3d1['str']('type'))??undefined,[_0xc8050d,_0x2c0f42]=await Promise['all']([listBffScripts(_0x2df3d1[_0x266d58(0xeb)],_0x5b8ffb),getBffScriptStatistics(_0x2df3d1[_0x266d58(0xeb)])]),_0x4d366d=createHookLocationMap(_0x2c0f42),_0xf7529f=[];for(const _0x5cc92a of _0xc8050d){const _0x5ed10e=resolveRemoteScriptTarget(_0x5e3e6b,_0x5cc92a,_0x4d366d,_0x557fa1[_0x266d58(0x119)],_0x369cc6);if(_0x5ed10e)_0xf7529f[_0x266d58(0x11a)](_0x5ed10e[_0x266d58(0x10b)]);}return{'method':_0x266d58(0xf3),'url':'/api/management/library/scripts/list','body':{'scripts':_0xf7529f,'appCode':_0x2df3d1[_0x266d58(0xeb)]},'description':_0x266d58(0xf2)+_0xf7529f[_0x266d58(0x130)]+_0x266d58(0x110)};},async 'execute'(_0x50bbdf){const _0xc8938e=a23_0x250d08,_0x409779=loadBffProjectConfig(_0x50bbdf[_0xc8938e(0xeb)]),_0x541b0e=await readBffLockFile(_0x409779['lockFilePath']),{lockData:_0x31c94b,appLock:_0x2f5616}=ensureLockScope(_0x541b0e??createEmptyBffLock(),_0x409779[_0xc8938e(0xeb)],_0x409779['scriptsRoot'],'pull',_0x409779[_0xc8938e(0xeb)],_0x409779[_0xc8938e(0xfa)]+'/'+_0x409779[_0xc8938e(0xeb)]),_0x2107e2=normalizeBffType(_0x50bbdf['str']('type'))??undefined;if(_0x50bbdf[_0xc8938e(0x12c)](_0xc8938e(0x11f))&&!_0x2107e2)throw CliErrors[_0xc8938e(0x127)]('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x139602,_0x33efa4]=await Promise[_0xc8938e(0x105)]([listBffScripts(_0x50bbdf[_0xc8938e(0xeb)],_0x2107e2),getBffScriptStatistics(_0x50bbdf[_0xc8938e(0xeb)])]);if(_0x139602[_0xc8938e(0x130)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xc8938e(0xfd)};const _0xc6cfeb=_0x50bbdf[_0xc8938e(0xfb)]('force');if(_0xc6cfeb&&!_0x50bbdf[_0xc8938e(0x128)]){const _0x3578b6=await confirmForce();if(!_0x3578b6)throw CliErrors['cancelled'](_0xc8938e(0xec));}if(_0xc6cfeb&&_0x50bbdf['nonInteractive']){}const _0x159670=buildDatasetCodeToAliasMap(_0x50bbdf[_0xc8938e(0x12f)]),_0x5a1d43=createHookLocationMap(_0x33efa4),_0x5af14c=cloneLockData(_0x31c94b),_0x192fd6=_0x5af14c[_0xc8938e(0x11d)][_0x409779[_0xc8938e(0xeb)]],_0x29ba37=[],_0x371e13=[],_0x125b6f=[];for(const _0x89c5d5 of _0x139602){const _0x36360a=resolveRemoteScriptTarget(_0x409779,_0x89c5d5,_0x5a1d43,_0x2f5616[_0xc8938e(0x119)],_0x159670);if(!_0x36360a){_0x371e13[_0xc8938e(0x11a)]({'lockKey':_0x89c5d5[_0xc8938e(0xff)]+'/'+_0x89c5d5[_0xc8938e(0x11e)],'reason':'unresolvable\x20target\x20path'});continue;}const _0xc42954=_0x2f5616[_0xc8938e(0x119)][_0x36360a[_0xc8938e(0x10b)]];try{if(!_0xc6cfeb){const _0x366470=await hasUnsyncedLocalChanges(_0x36360a[_0xc8938e(0x103)],_0xc42954);if(_0x366470){_0x371e13[_0xc8938e(0x11a)]({'lockKey':_0x36360a[_0xc8938e(0x10b)],'reason':_0xc8938e(0x10c)});continue;}}if(!_0x89c5d5['id'])throw new Error(_0xc8938e(0x122));if(_0x89c5d5[_0xc8938e(0x114)]==null)throw new Error(_0xc8938e(0x12e));const _0x2690ee=_0x89c5d5['scriptContent'];await ensureParentDirectory(_0x36360a[_0xc8938e(0x103)]),await writeFile(_0x36360a['filePath'],_0x2690ee,_0xc8938e(0x118));const _0x4f8374={'hash':computeContentHash(_0x2690ee),'remoteId':_0x89c5d5['id'],'version':_0x89c5d5['version']};_0x36360a[_0xc8938e(0x11f)]==='HOOK'&&_0x36360a[_0xc8938e(0xfc)]&&(_0x4f8374[_0xc8938e(0xf8)]=_0x36360a[_0xc8938e(0xfc)][_0xc8938e(0xf8)],_0x4f8374[_0xc8938e(0x125)]=_0x36360a['hookLocation'][_0xc8938e(0x125)],_0x4f8374['operationType']=_0x36360a[_0xc8938e(0xfc)][_0xc8938e(0x12b)],_0x4f8374[_0xc8938e(0x115)]=_0x36360a['hookLocation']['functionNode']),_0x192fd6[_0xc8938e(0x119)][_0x36360a[_0xc8938e(0x10b)]]=_0x4f8374,_0x29ba37[_0xc8938e(0x11a)]({'lockKey':_0x36360a[_0xc8938e(0x10b)],'remoteId':_0x89c5d5['id']});}catch(_0x9651ec){_0x125b6f[_0xc8938e(0x11a)]({'lockKey':_0x36360a['lockKey'],'error':_0x9651ec instanceof Error?_0x9651ec[_0xc8938e(0xea)]:String(_0x9651ec)});}}return _0x192fd6[_0xc8938e(0xf1)]=new Date()[_0xc8938e(0x10a)](),await writeBffLockFile(_0x409779[_0xc8938e(0x112)],_0x5af14c),{'ok':_0x125b6f[_0xc8938e(0x130)]===0x0,'data':{'pulled':_0x29ba37,'skipped':_0x371e13,'failed':_0x125b6f},'message':_0xc8938e(0x117)+_0x29ba37['length']+_0xc8938e(0x12a)+_0x371e13[_0xc8938e(0x130)]+_0xc8938e(0x113)+_0x125b6f[_0xc8938e(0x130)]+_0xc8938e(0x129)};}};async function hasUnsyncedLocalChanges(_0x1e20fd,_0xd8e5be){const _0x2e33d3=a23_0x250d08;if(!await fileExists(_0x1e20fd))return![];const _0x40e43c=await computeFileHash(_0x1e20fd);if(!_0xd8e5be)return!![];return _0x40e43c!==_0xd8e5be[_0x2e33d3(0x10f)];}function cloneLockData(_0x53b113){const _0x3c6e29=a23_0x250d08;return{'aliases':{..._0x53b113[_0x3c6e29(0xf9)]},'apps':Object[_0x3c6e29(0x121)](Object['entries'](_0x53b113['apps'])[_0x3c6e29(0x123)](([_0xbe8c45,_0x10e60f])=>[_0xbe8c45,{'scriptsRoot':_0x10e60f[_0x3c6e29(0xf6)],'lastSync':_0x10e60f[_0x3c6e29(0xf1)],'functions':{..._0x10e60f['functions']}}]))};}function a23_0x1c1b(_0x36ac11,_0x3e30e2){_0x36ac11=_0x36ac11-0xe9;const _0x134957=a23_0x1349();let _0x1c1b32=_0x134957[_0x36ac11];return _0x1c1b32;}function buildDatasetCodeToAliasMap(_0x28e59c){const _0x5599b1=a23_0x250d08,_0xc02814=loadAliasMap(_0x28e59c);return new Map(_0xc02814['map'](_0x15022c=>[_0x15022c[_0x5599b1(0x125)],_0x15022c['alias']]));}async function confirmForce(){const _0x788423=a23_0x250d08,_0x44eac2=createInterface({'input':process['stdin'],'output':process[_0x788423(0xf5)]}),_0x4f099c=await new Promise(_0x56f4ea=>{const _0xa9c5eb=_0x788423;_0x44eac2[_0xa9c5eb(0x100)](_0xa9c5eb(0xf7),_0x56f4ea);});return _0x44eac2[_0x788423(0x101)](),['y','yes'][_0x788423(0xfe)](_0x4f099c[_0x788423(0x131)]()[_0x788423(0x104)]());}
|
package/lib/commands/bff/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a25_0x3e2519=a25_0x379d;(function(_0x547015,_0x55a756){const _0x42434b=a25_0x379d,_0x51b5ca=_0x547015();while(!![]){try{const _0x5b54e0=parseInt(_0x42434b(0xb9))/0x1+-parseInt(_0x42434b(0xd0))/0x2+parseInt(_0x42434b(0xa9))/0x3+-parseInt(_0x42434b(0xd4))/0x4+parseInt(_0x42434b(0xae))/0x5+parseInt(_0x42434b(0xba))/0x6*(parseInt(_0x42434b(0xcf))/0x7)+parseInt(_0x42434b(0xb7))/0x8*(-parseInt(_0x42434b(0xa7))/0x9);if(_0x5b54e0===_0x55a756)break;else _0x51b5ca['push'](_0x51b5ca['shift']());}catch(_0x1de93f){_0x51b5ca['push'](_0x51b5ca['shift']());}}}(a25_0x4b1e,0x61fcc));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets}from'../../core/api-client.js';function a25_0x4b1e(){const _0x3ec8be=['functionNode','hash','aliasToDatasetCode','COMMON','\x20skipped,\x20','description','scriptsWorkspaceRoot','filePath','boolean','lockKey','apiDir','HOOK','functions','appCode','push','validation','datasetCode','get','1251279wdfVDO','Run\x20`','282573pijUHq','Incomplete\x20HOOK\x20path:\x20','has','set','datasetCodeToId','2227040CukvVs','force','bool','version','No\x20local\x20BFF\x20functions\x20found.','lockFilePath','values','remoteId','POST','32dzDVFg','name','745090prgWQp','186PHmCmH','lastSync','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','str','alias','Push\x20only\x20this\x20script\x20type','Would\x20push\x20','filter','\x20failed','string','/api/management/library/scripts/save','length','\x22.\x20','bff','Force\x20push\x20ignoring\x20hash\x20protection','type','unchanged','high-risk-write','\x20uploaded,\x20','scriptsRoot','Cannot\x20resolve\x20dataset\x20for\x20\x22','151123TDsqcR','435340EJMQWk','Push\x20complete:\x20','datasetId','some','3115192qryLwY','map','ENDPOINT','operationType','Push\x20local\x20BFF\x20scripts\x20to\x20remote','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.'];a25_0x4b1e=function(){return _0x3ec8be;};return a25_0x4b1e();}import{loadAliasMap}from'../../core/alias-resolver.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{normalizeBffType,scanLocalBffFunctions}from'../../core/bff/file-system.js';function a25_0x379d(_0x1a0cac,_0x17aa74){_0x1a0cac=_0x1a0cac-0x96;const _0x4b1ede=a25_0x4b1e();let _0x379d56=_0x4b1ede[_0x1a0cac];return _0x379d56;}import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{extractScriptDescription}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPush={'service':a25_0x3e2519(0xc7),'command':a25_0x3e2519(0xa3),'description':a25_0x3e2519(0xd8),'risk':a25_0x3e2519(0xcb),'flags':[{'name':a25_0x3e2519(0xc9),'type':a25_0x3e2519(0xc3),'description':a25_0x3e2519(0xbf),'enum':[a25_0x3e2519(0x98),a25_0x3e2519(0xd6),a25_0x3e2519(0xa0)]},{'name':'name','type':'string','description':a25_0x3e2519(0xbc)},{'name':'force','type':a25_0x3e2519(0x9d),'description':a25_0x3e2519(0xc8)}],async 'dryRun'(_0x2f8702){const _0x4eac1f=a25_0x3e2519,_0x2e6cd7=loadBffProjectConfig(_0x2f8702[_0x4eac1f(0xa2)]),_0xb5ebf=await readBffLockFile(_0x2e6cd7[_0x4eac1f(0xb3)]),{appLock:_0x242a12}=ensureLockScope(_0xb5ebf??createEmptyBffLock(),_0x2e6cd7[_0x4eac1f(0xa2)],_0x2e6cd7['scriptsRoot'],_0x4eac1f(0xa3),_0x2e6cd7['appCode'],_0x2e6cd7[_0x4eac1f(0x9b)]+'/'+_0x2e6cd7['appCode']),_0x3144b4=await getTargetFunctions(_0x2e6cd7,_0x2f8702),_0x56ad30=_0x2f8702[_0x4eac1f(0xb0)](_0x4eac1f(0xaf)),_0x128edc=[];for(const _0x4d4742 of _0x3144b4){const _0x578f74=await computeFileHash(_0x4d4742['filePath']),_0x2eaef=_0x242a12[_0x4eac1f(0xa1)][_0x4d4742[_0x4eac1f(0x9e)]];if(!_0x56ad30&&_0x2eaef&&_0x2eaef[_0x4eac1f(0x96)]===_0x578f74)continue;_0x128edc[_0x4eac1f(0xa3)](_0x4d4742[_0x4eac1f(0x9e)]);}return{'method':_0x4eac1f(0xb6),'url':_0x4eac1f(0xc4),'body':{'files':_0x128edc,'appCode':_0x2f8702[_0x4eac1f(0xa2)]},'description':_0x4eac1f(0xc0)+_0x128edc[_0x4eac1f(0xc5)]+'\x20file(s)'};},async 'execute'(_0x575655){const _0xc4ba7d=a25_0x3e2519,_0x3a09cf=loadBffProjectConfig(_0x575655[_0xc4ba7d(0xa2)]),_0x174dfa=await readBffLockFile(_0x3a09cf[_0xc4ba7d(0xb3)]),{lockData:_0x15eae2,appLock:_0x299f02}=ensureLockScope(_0x174dfa??createEmptyBffLock(),_0x3a09cf['appCode'],_0x3a09cf[_0xc4ba7d(0xcd)],_0xc4ba7d(0xa3),_0x3a09cf[_0xc4ba7d(0xa2)],_0x3a09cf['scriptsWorkspaceRoot']+'/'+_0x3a09cf[_0xc4ba7d(0xa2)]),_0x15e593=await getTargetFunctions(_0x3a09cf,_0x575655);if(_0x15e593[_0xc4ba7d(0xc5)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0xc4ba7d(0xb2)};const _0x26e3f3=_0x575655['bool']('force'),_0x13e4d5=await buildHookMaps(_0x3a09cf[_0xc4ba7d(0xa2)],_0x575655[_0xc4ba7d(0x9f)],_0x15e593,_0x299f02),_0xfc6583=[],_0x11432b=[],_0x19c18c=[];for(const _0x5b650a of _0x15e593){const _0x5d8b86=await computeFileHash(_0x5b650a[_0xc4ba7d(0x9c)]),_0x58ad90=_0x299f02['functions'][_0x5b650a[_0xc4ba7d(0x9e)]];if(!_0x26e3f3&&_0x58ad90&&_0x58ad90[_0xc4ba7d(0x96)]===_0x5d8b86){_0x11432b[_0xc4ba7d(0xa3)]({'lockKey':_0x5b650a[_0xc4ba7d(0x9e)],'reason':_0xc4ba7d(0xca)});continue;}try{await uploadSingleFunction(_0x3a09cf[_0xc4ba7d(0xa2)],_0x5b650a,_0x299f02,_0x13e4d5);const _0x52bb50=_0x299f02['functions'][_0x5b650a['lockKey']];_0xfc6583['push']({'lockKey':_0x5b650a[_0xc4ba7d(0x9e)],'remoteId':_0x52bb50?.[_0xc4ba7d(0xb5)]??0x0});}catch(_0x30e61b){_0x19c18c[_0xc4ba7d(0xa3)]({'lockKey':_0x5b650a[_0xc4ba7d(0x9e)],'error':_0x30e61b instanceof Error?_0x30e61b['message']:String(_0x30e61b)});}}return _0x299f02[_0xc4ba7d(0xbb)]=new Date()['toISOString'](),await writeBffLockFile(_0x3a09cf['lockFilePath'],_0x15eae2),{'ok':_0x19c18c['length']===0x0,'data':{'uploaded':_0xfc6583,'skipped':_0x11432b,'failed':_0x19c18c},'message':_0xc4ba7d(0xd1)+_0xfc6583['length']+_0xc4ba7d(0xcc)+_0x11432b['length']+_0xc4ba7d(0x99)+_0x19c18c['length']+_0xc4ba7d(0xc2)};}};async function getTargetFunctions(_0x4c25e0,_0x309a03){const _0x3e4908=a25_0x3e2519,_0xd18fd8=_0x309a03[_0x3e4908(0xbd)](_0x3e4908(0xc9)),_0x1a3177=_0x309a03['str'](_0x3e4908(0xb8)),_0x12b76f=normalizeBffType(_0xd18fd8)??undefined;if(_0x1a3177&&!_0x12b76f)throw CliErrors['validation'](_0x3e4908(0xd9));const _0x2eface=await scanLocalBffFunctions(_0x4c25e0,_0x12b76f);if(_0x1a3177){const _0x2b142c=_0x2eface[_0x3e4908(0xc1)](_0x3c4ddb=>_0x3c4ddb[_0x3e4908(0xb8)]===_0x1a3177);if(_0x2b142c['length']===0x0)throw CliErrors[_0x3e4908(0xa4)]('Local\x20function\x20not\x20found:\x20'+_0x12b76f+'/'+_0x1a3177);return _0x2b142c;}return _0x2eface;}async function buildHookMaps(_0x2f94a1,_0x2abe7e,_0x15e67b,_0x17f647){const _0x461a36=a25_0x3e2519,_0x58ea4f=_0x15e67b[_0x461a36(0xd3)](_0x4305c2=>_0x4305c2[_0x461a36(0xc9)]===_0x461a36(0xa0));if(!_0x58ea4f)return{'aliasToDatasetCode':new Map(),'datasetCodeToId':new Map()};const _0x139c18=loadAliasMap(_0x2abe7e),_0x4cb1ab=new Map(_0x139c18['map'](_0x56a4b4=>[_0x56a4b4['alias'],_0x56a4b4['datasetCode']]));for(const _0xc5aacf of Object[_0x461a36(0xb4)](_0x17f647['functions'])){_0xc5aacf[_0x461a36(0xbe)]&&_0xc5aacf['datasetCode']&&!_0x4cb1ab['has'](_0xc5aacf['alias'])&&_0x4cb1ab[_0x461a36(0xac)](_0xc5aacf[_0x461a36(0xbe)],_0xc5aacf[_0x461a36(0xa5)]);}const _0x4440d4=await listDatasets(_0x2f94a1),_0x9309b2=new Map(_0x4440d4[_0x461a36(0xd5)](_0x511608=>[_0x511608['code'],_0x511608['id']]));return{'aliasToDatasetCode':_0x4cb1ab,'datasetCodeToId':_0x9309b2};}async function uploadSingleFunction(_0x4bd999,_0x431ef3,_0xe04f29,_0x291eb6){const _0x2d4581=a25_0x3e2519,_0x50d908=await readFile(_0x431ef3[_0x2d4581(0x9c)],'utf8'),_0x42edfe=await computeFileHash(_0x431ef3[_0x2d4581(0x9c)]),_0x5cb1f=_0xe04f29[_0x2d4581(0xa1)][_0x431ef3[_0x2d4581(0x9e)]];if(_0x5cb1f?.[_0x2d4581(0xb5)]&&_0x5cb1f[_0x2d4581(0xb1)]==null)throw CliErrors['validation'](_0x431ef3['lockKey']+':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.');let _0x26f1e9=extractScriptDescription(_0x50d908);if(!_0x26f1e9&&_0x5cb1f?.[_0x2d4581(0xb5)]){const _0x27db20=await getBffScriptInfo(_0x5cb1f[_0x2d4581(0xb5)]);_0x26f1e9=_0x27db20['description']||undefined;}const _0x554baf={'appCode':_0x4bd999,'functionName':_0x431ef3[_0x2d4581(0xb8)],'scriptType':_0x431ef3[_0x2d4581(0xc9)],'scriptContent':_0x50d908};if(_0x5cb1f?.[_0x2d4581(0xb5)])_0x554baf['id']=_0x5cb1f[_0x2d4581(0xb5)];if(_0x5cb1f?.[_0x2d4581(0xb1)]!=null)_0x554baf[_0x2d4581(0xb1)]=_0x5cb1f[_0x2d4581(0xb1)];if(_0x26f1e9)_0x554baf[_0x2d4581(0x9a)]=_0x26f1e9;if(_0x431ef3[_0x2d4581(0xc9)]==='HOOK'){const _0x1b6714=_0x431ef3[_0x2d4581(0xbe)];if(!_0x1b6714||!_0x431ef3[_0x2d4581(0xd7)]||!_0x431ef3[_0x2d4581(0xda)])throw CliErrors[_0x2d4581(0xa4)](_0x2d4581(0xaa)+_0x431ef3['lockKey']);const _0x7bc852=_0x291eb6[_0x2d4581(0x97)][_0x2d4581(0xa6)](_0x1b6714)??_0x5cb1f?.[_0x2d4581(0xa5)]??_0x1b6714,_0x477cc5=_0x291eb6[_0x2d4581(0xad)][_0x2d4581(0xa6)](_0x7bc852);if(!_0x477cc5)throw CliErrors[_0x2d4581(0xa4)](_0x2d4581(0xce)+_0x1b6714+_0x2d4581(0xc6)+(_0x2d4581(0xa8)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.'));_0x554baf[_0x2d4581(0xd2)]=_0x477cc5,_0x554baf[_0x2d4581(0xd7)]=_0x431ef3[_0x2d4581(0xd7)],_0x554baf[_0x2d4581(0xda)]=_0x431ef3['functionNode'];}const _0x54d7bd=await saveBffScript(_0x554baf),_0xa46497=await getBffScriptInfo(_0x54d7bd),_0x43f27d={'hash':_0x42edfe,'remoteId':_0x54d7bd,'version':_0xa46497[_0x2d4581(0xb1)]};if(_0x431ef3[_0x2d4581(0xc9)]===_0x2d4581(0xa0)){const _0x4ddbc3=_0x431ef3[_0x2d4581(0xbe)],_0x1397a8=_0x291eb6[_0x2d4581(0x97)][_0x2d4581(0xa6)](_0x4ddbc3)??_0x5cb1f?.[_0x2d4581(0xa5)]??_0x4ddbc3;_0x291eb6[_0x2d4581(0x97)][_0x2d4581(0xab)](_0x4ddbc3)?_0x43f27d[_0x2d4581(0xbe)]=_0x4ddbc3:_0x43f27d[_0x2d4581(0xbe)]=_0x5cb1f?.[_0x2d4581(0xbe)],_0x43f27d[_0x2d4581(0xa5)]=_0x1397a8,_0x43f27d[_0x2d4581(0xd7)]=_0x431ef3[_0x2d4581(0xd7)],_0x43f27d[_0x2d4581(0xda)]=_0x431ef3[_0x2d4581(0xda)];}_0xe04f29['functions'][_0x431ef3[_0x2d4581(0x9e)]]=_0x43f27d;}
|
|
1
|
+
function a24_0x35ac(){const _0x4ef973=['/api/management/library/scripts/save','set','No\x20local\x20BFF\x20functions\x20found.','POST','map','description','713553YJEAhX','COMMON','Would\x20push\x20','1086TzdTkg','length','appCode','4705FfyVEB','force','Push\x20complete:\x20','Incomplete\x20HOOK\x20path:\x20','Local\x20function\x20not\x20found:\x20','aliasToDatasetCode','type','push','scriptsRoot','lockKey','\x20file(s)','2629TheTVU','filePath','validation','510JakVwS','302kGnyDR','22380KunWLn','version','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.','functionNode','897aNTyWU','str','filter','55314831QipSuO','Run\x20`','Cannot\x20resolve\x20dataset\x20for\x20\x22','16fsEPJm','datasetCodeToId','has','lockFilePath','get','datasetCode','string','Force\x20push\x20ignoring\x20hash\x20protection','datasetId','functions','Push\x20only\x20this\x20script\x20type','2858919fBVFCs',':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.','HOOK','values','message','bool','remoteId','\x22.\x20','high-risk-write','Push\x20local\x20BFF\x20scripts\x20to\x20remote','hash','apiDir','129141lWQoox','\x20skipped,\x20','name','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','code','some','utf8','alias','scriptsWorkspaceRoot','20wmBxwB','operationType'];a24_0x35ac=function(){return _0x4ef973;};return a24_0x35ac();}const a24_0x36abaa=a24_0x1abb;(function(_0x52ac38,_0x13c15d){const _0x1eadfc=a24_0x1abb,_0x32fa9b=_0x52ac38();while(!![]){try{const _0x2b23e6=parseInt(_0x1eadfc(0x1db))/0x1*(-parseInt(_0x1eadfc(0x1d6))/0x2)+-parseInt(_0x1eadfc(0x1c1))/0x3*(parseInt(_0x1eadfc(0x1b9))/0x4)+-parseInt(_0x1eadfc(0x1c7))/0x5*(parseInt(_0x1eadfc(0x1c4))/0x6)+parseInt(_0x1eadfc(0x1ec))/0x7*(-parseInt(_0x1eadfc(0x1e1))/0x8)+-parseInt(_0x1eadfc(0x1b0))/0x9*(parseInt(_0x1eadfc(0x1d5))/0xa)+-parseInt(_0x1eadfc(0x1d2))/0xb*(parseInt(_0x1eadfc(0x1d7))/0xc)+parseInt(_0x1eadfc(0x1de))/0xd;if(_0x2b23e6===_0x13c15d)break;else _0x32fa9b['push'](_0x32fa9b['shift']());}catch(_0x52c3c2){_0x32fa9b['push'](_0x32fa9b['shift']());}}}(a24_0x35ac,0xbae9c));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{normalizeBffType,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{extractScriptDescription}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';function a24_0x1abb(_0x3a9993,_0x42caef){_0x3a9993=_0x3a9993-0x1ae;const _0x35aced=a24_0x35ac();let _0x1abba7=_0x35aced[_0x3a9993];return _0x1abba7;}import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPush={'service':'bff','command':'push','description':a24_0x36abaa(0x1f5),'risk':a24_0x36abaa(0x1f4),'flags':[{'name':a24_0x36abaa(0x1cd),'type':'string','description':a24_0x36abaa(0x1eb),'enum':[a24_0x36abaa(0x1c2),'ENDPOINT',a24_0x36abaa(0x1ee)]},{'name':a24_0x36abaa(0x1b2),'type':a24_0x36abaa(0x1e7),'description':a24_0x36abaa(0x1b3)},{'name':a24_0x36abaa(0x1c8),'type':'boolean','description':a24_0x36abaa(0x1e8)}],async 'dryRun'(_0x1c6dbe){const _0x2f310c=a24_0x36abaa,_0x419819=loadBffProjectConfig(_0x1c6dbe[_0x2f310c(0x1c6)]),_0x1f9dac=await readBffLockFile(_0x419819[_0x2f310c(0x1e4)]),{appLock:_0x14e0b0}=ensureLockScope(_0x1f9dac??createEmptyBffLock(),_0x419819[_0x2f310c(0x1c6)],_0x419819['scriptsRoot'],_0x2f310c(0x1ce),_0x419819[_0x2f310c(0x1c6)],_0x419819[_0x2f310c(0x1b8)]+'/'+_0x419819['appCode']),_0x5ddeea=await getTargetFunctions(_0x419819,_0x1c6dbe),_0x4cf7af=_0x1c6dbe[_0x2f310c(0x1f1)](_0x2f310c(0x1c8)),_0x13f536=[];for(const _0x1a5131 of _0x5ddeea){const _0x2268c1=await computeFileHash(_0x1a5131[_0x2f310c(0x1d3)]),_0x4ed932=_0x14e0b0[_0x2f310c(0x1ea)][_0x1a5131[_0x2f310c(0x1d0)]];if(!_0x4cf7af&&_0x4ed932&&_0x4ed932[_0x2f310c(0x1ae)]===_0x2268c1)continue;_0x13f536[_0x2f310c(0x1ce)](_0x1a5131[_0x2f310c(0x1d0)]);}return{'method':_0x2f310c(0x1be),'url':_0x2f310c(0x1bb),'body':{'files':_0x13f536,'appCode':_0x1c6dbe[_0x2f310c(0x1c6)]},'description':_0x2f310c(0x1c3)+_0x13f536[_0x2f310c(0x1c5)]+_0x2f310c(0x1d1)};},async 'execute'(_0x5a8f4a){const _0x46bfd8=a24_0x36abaa,_0x4e00c9=loadBffProjectConfig(_0x5a8f4a[_0x46bfd8(0x1c6)]),_0x24f147=await readBffLockFile(_0x4e00c9[_0x46bfd8(0x1e4)]),{lockData:_0x4fc68e,appLock:_0x17d8f7}=ensureLockScope(_0x24f147??createEmptyBffLock(),_0x4e00c9[_0x46bfd8(0x1c6)],_0x4e00c9[_0x46bfd8(0x1cf)],_0x46bfd8(0x1ce),_0x4e00c9[_0x46bfd8(0x1c6)],_0x4e00c9[_0x46bfd8(0x1b8)]+'/'+_0x4e00c9['appCode']),_0x37e18e=await getTargetFunctions(_0x4e00c9,_0x5a8f4a);if(_0x37e18e[_0x46bfd8(0x1c5)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x46bfd8(0x1bd)};const _0x357daa=_0x5a8f4a[_0x46bfd8(0x1f1)](_0x46bfd8(0x1c8)),_0x5404e8=await buildHookMaps(_0x4e00c9[_0x46bfd8(0x1c6)],_0x5a8f4a[_0x46bfd8(0x1af)],_0x37e18e,_0x17d8f7),_0x15289c=[],_0x16095c=[],_0x35ab25=[];for(const _0x23fcb7 of _0x37e18e){const _0x2320b3=await computeFileHash(_0x23fcb7[_0x46bfd8(0x1d3)]),_0x5434b1=_0x17d8f7[_0x46bfd8(0x1ea)][_0x23fcb7[_0x46bfd8(0x1d0)]];if(!_0x357daa&&_0x5434b1&&_0x5434b1['hash']===_0x2320b3){_0x16095c[_0x46bfd8(0x1ce)]({'lockKey':_0x23fcb7['lockKey'],'reason':'unchanged'});continue;}try{await uploadSingleFunction(_0x4e00c9[_0x46bfd8(0x1c6)],_0x23fcb7,_0x17d8f7,_0x5404e8);const _0x15d220=_0x17d8f7[_0x46bfd8(0x1ea)][_0x23fcb7[_0x46bfd8(0x1d0)]];_0x15289c[_0x46bfd8(0x1ce)]({'lockKey':_0x23fcb7[_0x46bfd8(0x1d0)],'remoteId':_0x15d220?.[_0x46bfd8(0x1f2)]??0x0});}catch(_0x17ce82){_0x35ab25['push']({'lockKey':_0x23fcb7[_0x46bfd8(0x1d0)],'error':_0x17ce82 instanceof Error?_0x17ce82[_0x46bfd8(0x1f0)]:String(_0x17ce82)});}}return _0x17d8f7['lastSync']=new Date()['toISOString'](),await writeBffLockFile(_0x4e00c9[_0x46bfd8(0x1e4)],_0x4fc68e),{'ok':_0x35ab25[_0x46bfd8(0x1c5)]===0x0,'data':{'uploaded':_0x15289c,'skipped':_0x16095c,'failed':_0x35ab25},'message':_0x46bfd8(0x1c9)+_0x15289c[_0x46bfd8(0x1c5)]+'\x20uploaded,\x20'+_0x16095c[_0x46bfd8(0x1c5)]+_0x46bfd8(0x1b1)+_0x35ab25[_0x46bfd8(0x1c5)]+'\x20failed'};}};async function getTargetFunctions(_0x2d6537,_0x49a883){const _0x7712f=a24_0x36abaa,_0x47adb8=_0x49a883[_0x7712f(0x1dc)](_0x7712f(0x1cd)),_0x14adaf=_0x49a883[_0x7712f(0x1dc)](_0x7712f(0x1b2)),_0x3ffae1=normalizeBffType(_0x47adb8)??undefined;if(_0x14adaf&&!_0x3ffae1)throw CliErrors[_0x7712f(0x1d4)](_0x7712f(0x1d9));const _0x25d6b4=await scanLocalBffFunctions(_0x2d6537,_0x3ffae1);if(_0x14adaf){const _0x15000f=_0x25d6b4[_0x7712f(0x1dd)](_0x2405da=>_0x2405da[_0x7712f(0x1b2)]===_0x14adaf);if(_0x15000f[_0x7712f(0x1c5)]===0x0)throw CliErrors[_0x7712f(0x1d4)](_0x7712f(0x1cb)+_0x3ffae1+'/'+_0x14adaf);return _0x15000f;}return _0x25d6b4;}async function buildHookMaps(_0x383888,_0x35744e,_0x47e42b,_0xb5860a){const _0x29c567=a24_0x36abaa,_0x22acce=_0x47e42b[_0x29c567(0x1b5)](_0x41d13e=>_0x41d13e['type']===_0x29c567(0x1ee));if(!_0x22acce)return{'aliasToDatasetCode':new Map(),'datasetCodeToId':new Map()};const _0x37dbc2=loadAliasMap(_0x35744e),_0x5d2cb5=new Map(_0x37dbc2[_0x29c567(0x1bf)](_0x11b927=>[_0x11b927[_0x29c567(0x1b7)],_0x11b927[_0x29c567(0x1e6)]]));for(const _0x1066e9 of Object[_0x29c567(0x1ef)](_0xb5860a[_0x29c567(0x1ea)])){_0x1066e9[_0x29c567(0x1b7)]&&_0x1066e9[_0x29c567(0x1e6)]&&!_0x5d2cb5[_0x29c567(0x1e3)](_0x1066e9[_0x29c567(0x1b7)])&&_0x5d2cb5[_0x29c567(0x1bc)](_0x1066e9[_0x29c567(0x1b7)],_0x1066e9['datasetCode']);}const _0x3bf48c=await listDatasets(_0x383888),_0x51c529=new Map(_0x3bf48c[_0x29c567(0x1bf)](_0x1da60a=>[_0x1da60a[_0x29c567(0x1b4)],_0x1da60a['id']]));return{'aliasToDatasetCode':_0x5d2cb5,'datasetCodeToId':_0x51c529};}async function uploadSingleFunction(_0x6afbb0,_0x89a86a,_0x3b2532,_0x1f6e2d){const _0x287941=a24_0x36abaa,_0x23e9e5=await readFile(_0x89a86a[_0x287941(0x1d3)],_0x287941(0x1b6)),_0x46bcd0=await computeFileHash(_0x89a86a[_0x287941(0x1d3)]),_0x425cc4=_0x3b2532[_0x287941(0x1ea)][_0x89a86a[_0x287941(0x1d0)]];if(_0x425cc4?.['remoteId']&&_0x425cc4[_0x287941(0x1d8)]==null)throw CliErrors[_0x287941(0x1d4)](_0x89a86a[_0x287941(0x1d0)]+_0x287941(0x1ed));let _0xdbca34=extractScriptDescription(_0x23e9e5);if(!_0xdbca34&&_0x425cc4?.[_0x287941(0x1f2)]){const _0x595e53=await getBffScriptInfo(_0x425cc4[_0x287941(0x1f2)]);_0xdbca34=_0x595e53[_0x287941(0x1c0)]||undefined;}const _0x19f694={'appCode':_0x6afbb0,'functionName':_0x89a86a[_0x287941(0x1b2)],'scriptType':_0x89a86a[_0x287941(0x1cd)],'scriptContent':_0x23e9e5};if(_0x425cc4?.[_0x287941(0x1f2)])_0x19f694['id']=_0x425cc4['remoteId'];if(_0x425cc4?.['version']!=null)_0x19f694['version']=_0x425cc4[_0x287941(0x1d8)];if(_0xdbca34)_0x19f694[_0x287941(0x1c0)]=_0xdbca34;if(_0x89a86a['type']===_0x287941(0x1ee)){const _0x29e095=_0x89a86a['alias'];if(!_0x29e095||!_0x89a86a[_0x287941(0x1ba)]||!_0x89a86a[_0x287941(0x1da)])throw CliErrors['validation'](_0x287941(0x1ca)+_0x89a86a['lockKey']);const _0x2d5e58=_0x1f6e2d[_0x287941(0x1cc)][_0x287941(0x1e5)](_0x29e095)??_0x425cc4?.[_0x287941(0x1e6)]??_0x29e095,_0x446af1=_0x1f6e2d[_0x287941(0x1e2)][_0x287941(0x1e5)](_0x2d5e58);if(!_0x446af1)throw CliErrors[_0x287941(0x1d4)](_0x287941(0x1e0)+_0x29e095+_0x287941(0x1f3)+(_0x287941(0x1df)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.'));_0x19f694[_0x287941(0x1e9)]=_0x446af1,_0x19f694[_0x287941(0x1ba)]=_0x89a86a['operationType'],_0x19f694[_0x287941(0x1da)]=_0x89a86a[_0x287941(0x1da)];}const _0x1d2aeb=await saveBffScript(_0x19f694),_0x462e02=await getBffScriptInfo(_0x1d2aeb),_0xcc026={'hash':_0x46bcd0,'remoteId':_0x1d2aeb,'version':_0x462e02[_0x287941(0x1d8)]};if(_0x89a86a['type']===_0x287941(0x1ee)){const _0x57e4d0=_0x89a86a[_0x287941(0x1b7)],_0x1f4063=_0x1f6e2d['aliasToDatasetCode'][_0x287941(0x1e5)](_0x57e4d0)??_0x425cc4?.[_0x287941(0x1e6)]??_0x57e4d0;_0x1f6e2d[_0x287941(0x1cc)][_0x287941(0x1e3)](_0x57e4d0)?_0xcc026[_0x287941(0x1b7)]=_0x57e4d0:_0xcc026[_0x287941(0x1b7)]=_0x425cc4?.[_0x287941(0x1b7)],_0xcc026[_0x287941(0x1e6)]=_0x1f4063,_0xcc026[_0x287941(0x1ba)]=_0x89a86a['operationType'],_0xcc026[_0x287941(0x1da)]=_0x89a86a[_0x287941(0x1da)];}_0x3b2532[_0x287941(0x1ea)][_0x89a86a['lockKey']]=_0xcc026;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a25_0x2435(_0x452ae9,_0x4d5012){_0x452ae9=_0x452ae9-0x18f;const _0x104d5f=a25_0x104d();let _0x2435d8=_0x104d5f[_0x452ae9];return _0x2435d8;}function a25_0x104d(){const _0x1a25f6=['\x20modified,\x20','lockKey','functions','8278072XkDwmR','\x20unchanged','appCode','22685dzfFtA','alias','apiDir','116969PedvLz','402USMnYX','Also\x20check\x20for\x20remote-only\x20scripts\x20not\x20present\x20locally','lockFilePath','length','bff','remote','Check\x20local\x20BFF\x20sync\x20status\x20against\x20lock\x20file','All\x20BFF\x20scripts\x20are\x20in\x20sync.','299595dEPUjm','has','24276aLMris','datasetCode','hash','512870shvQNg','push','status','bool','54bGPVVQ','888909CRoFcI','scriptsRoot','\x20remote-only','28uActyv','scriptsWorkspaceRoot','map'];a25_0x104d=function(){return _0x1a25f6;};return a25_0x104d();}const a25_0x5996ff=a25_0x2435;(function(_0x54dc0e,_0x5532af){const _0x5a3e3f=a25_0x2435,_0x23bfe9=_0x54dc0e();while(!![]){try{const _0x4d4ea8=-parseInt(_0x5a3e3f(0x1a8))/0x1*(-parseInt(_0x5a3e3f(0x19c))/0x2)+parseInt(_0x5a3e3f(0x18f))/0x3+-parseInt(_0x5a3e3f(0x191))/0x4+-parseInt(_0x5a3e3f(0x1a5))/0x5*(parseInt(_0x5a3e3f(0x1a9))/0x6)+parseInt(_0x5a3e3f(0x199))/0x7+-parseInt(_0x5a3e3f(0x1a2))/0x8+-parseInt(_0x5a3e3f(0x198))/0x9*(-parseInt(_0x5a3e3f(0x194))/0xa);if(_0x4d4ea8===_0x5532af)break;else _0x23bfe9['push'](_0x23bfe9['shift']());}catch(_0x34a095){_0x23bfe9['push'](_0x23bfe9['shift']());}}}(a25_0x104d,0xc9fc5));import{listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile}from'../../core/bff/lock.js';export const bffStatus={'service':a25_0x5996ff(0x1ad),'command':a25_0x5996ff(0x196),'description':a25_0x5996ff(0x1af),'risk':'read','flags':[{'name':a25_0x5996ff(0x1ae),'type':'boolean','description':a25_0x5996ff(0x1aa)}],async 'execute'(_0x5f19b5){const _0x986eac=a25_0x5996ff,_0x409ef6=loadBffProjectConfig(_0x5f19b5[_0x986eac(0x1a4)]),_0x5c1906=await readBffLockFile(_0x409ef6[_0x986eac(0x1ab)]),{appLock:_0x3787bc}=ensureLockScope(_0x5c1906??createEmptyBffLock(),_0x409ef6[_0x986eac(0x1a4)],_0x409ef6[_0x986eac(0x19a)],_0x986eac(0x196),_0x409ef6[_0x986eac(0x1a4)],_0x409ef6[_0x986eac(0x19d)]+'/'+_0x409ef6[_0x986eac(0x1a4)]),_0x4dbc1f=await scanLocalBffFunctions(_0x409ef6),_0x415455=[],_0x6b260c=[],_0x1982f9=[];for(const _0xee1681 of _0x4dbc1f){const _0x21dbc4=await computeFileHash(_0xee1681['filePath']),_0x7c919=_0x3787bc['functions'][_0xee1681['lockKey']];if(!_0x7c919)_0x415455[_0x986eac(0x195)](_0xee1681[_0x986eac(0x1a0)]);else _0x7c919[_0x986eac(0x193)]!==_0x21dbc4?_0x6b260c[_0x986eac(0x195)](_0xee1681['lockKey']):_0x1982f9[_0x986eac(0x195)](_0xee1681[_0x986eac(0x1a0)]);}const _0xa9547d=[];if(_0x5f19b5[_0x986eac(0x197)](_0x986eac(0x1ae))){const _0x3ce6c8=loadAliasMap(_0x5f19b5[_0x986eac(0x1a7)]),_0x259522=new Map(_0x3ce6c8[_0x986eac(0x19e)](_0x22422c=>[_0x22422c[_0x986eac(0x192)],_0x22422c[_0x986eac(0x1a6)]])),[_0x499b74,_0x322d4d]=await Promise['all']([listBffScripts(_0x5f19b5['appCode']),getBffScriptStatistics(_0x5f19b5['appCode'])]),_0x30ea1d=createHookLocationMap(_0x322d4d),_0x439ce1=new Set(_0x4dbc1f['map'](_0x3c576f=>_0x3c576f[_0x986eac(0x1a0)]));for(const _0x47fa09 of _0x499b74){const _0x3fd74d=resolveRemoteScriptTarget(_0x409ef6,_0x47fa09,_0x30ea1d,_0x3787bc[_0x986eac(0x1a1)],_0x259522);_0x3fd74d&&!_0x439ce1[_0x986eac(0x190)](_0x3fd74d[_0x986eac(0x1a0)])&&_0xa9547d['push'](_0x3fd74d[_0x986eac(0x1a0)]);}}const _0x8413ee=_0x415455['length']===0x0&&_0x6b260c['length']===0x0&&_0xa9547d[_0x986eac(0x1ac)]===0x0;return{'ok':!![],'data':{'added':_0x415455,'modified':_0x6b260c,'unchanged':_0x1982f9,'remoteOnly':_0xa9547d},'message':_0x8413ee?_0x986eac(0x1b0):_0x415455[_0x986eac(0x1ac)]+'\x20added,\x20'+_0x6b260c['length']+_0x986eac(0x19f)+_0x1982f9[_0x986eac(0x1ac)]+_0x986eac(0x1a3)+(_0xa9547d[_0x986eac(0x1ac)]>0x0?',\x20'+_0xa9547d[_0x986eac(0x1ac)]+_0x986eac(0x19b):'')};}};
|
package/lib/commands/build.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a26_0x5667(){const _0xc6fa41=['toString','error','npm\x20run\x20build\x20exited\x20with\x20code\x20','logger','项目构建失败','60639aKwFxb','close','651760HYrzfb','node_modules','npm\x20run\x20build','data','22ChpqVu','info','now','343MjoUHL','4176780kYSEgW','trim','pipe','build','10xDXQPN','npm','1485885FZjFpg','14646FRuTXV','9656mRymcZ','.bin','4FByKvh','2007nRtqDF','项目构建成功','cwd','env','项目构建出错','PATH','success','595659grEVOr','run'];a26_0x5667=function(){return _0xc6fa41;};return a26_0x5667();}(function(_0x34552a,_0x5b54a2){const _0x2b112a=a26_0x3d71,_0x1d7a2e=_0x34552a();while(!![]){try{const _0x33b172=parseInt(_0x2b112a(0x1d1))/0x1*(-parseInt(_0x2b112a(0x1bc))/0x2)+-parseInt(_0x2b112a(0x1ca))/0x3+parseInt(_0x2b112a(0x1c2))/0x4*(parseInt(_0x2b112a(0x1be))/0x5)+parseInt(_0x2b112a(0x1bf))/0x6*(-parseInt(_0x2b112a(0x1b7))/0x7)+parseInt(_0x2b112a(0x1c0))/0x8*(parseInt(_0x2b112a(0x1c3))/0x9)+parseInt(_0x2b112a(0x1d3))/0xa*(-parseInt(_0x2b112a(0x1d7))/0xb)+parseInt(_0x2b112a(0x1b8))/0xc;if(_0x33b172===_0x5b54a2)break;else _0x1d7a2e['push'](_0x1d7a2e['shift']());}catch(_0x489808){_0x1d7a2e['push'](_0x1d7a2e['shift']());}}}(a26_0x5667,0x27b86));import{delimiter,join}from'node:path';import{spawn}from'node:child_process';function a26_0x3d71(_0x18b149,_0x465c8f){_0x18b149=_0x18b149-0x1b7;const _0x566745=a26_0x5667();let _0x3d710d=_0x566745[_0x18b149];return _0x3d710d;}function runBuild(_0x4e3248){return new Promise((_0x2088ae,_0x2c06a6)=>{const _0x5a5d27=a26_0x3d71,_0x95f63a=Date[_0x5a5d27(0x1d9)]();_0x4e3248[_0x5a5d27(0x1cf)][_0x5a5d27(0x1d8)]('build','开始构建项目',{'command':_0x5a5d27(0x1d5)});let _0x23cb41='';const _0x1361a4=spawn(_0x5a5d27(0x1bd),[_0x5a5d27(0x1cb),_0x5a5d27(0x1bb)],{'stdio':['inherit','inherit',_0x5a5d27(0x1ba)],'shell':!![],'env':{...process['env'],'PATH':''+join(process[_0x5a5d27(0x1c5)](),_0x5a5d27(0x1d4),_0x5a5d27(0x1c1))+delimiter+process[_0x5a5d27(0x1c6)][_0x5a5d27(0x1c8)]}});_0x1361a4['stderr']?.['on'](_0x5a5d27(0x1d6),_0x1b3884=>{const _0x39f973=_0x5a5d27;_0x23cb41+=_0x1b3884[_0x39f973(0x1cc)]();}),_0x1361a4['on'](_0x5a5d27(0x1d2),_0x511f8d=>{const _0x1f887b=_0x5a5d27,_0x4371e8=Date[_0x1f887b(0x1d9)]()-_0x95f63a;if(_0x511f8d===0x0||_0x511f8d===null)_0x4e3248[_0x1f887b(0x1cf)][_0x1f887b(0x1c9)](_0x1f887b(0x1bb),_0x1f887b(0x1c4),_0x4371e8),_0x2088ae();else{const _0x2a867d={'exitCode':_0x511f8d,'duration':_0x4371e8,'command':'npm\x20run\x20build','cwd':process[_0x1f887b(0x1c5)]()};_0x23cb41[_0x1f887b(0x1b9)]()&&(_0x2a867d['stderr']=_0x23cb41['trim']()),_0x4e3248[_0x1f887b(0x1cf)][_0x1f887b(0x1cd)]('build',_0x1f887b(0x1d0),_0x2a867d),_0x2c06a6(new Error(_0x1f887b(0x1ce)+_0x511f8d));}}),_0x1361a4['on'](_0x5a5d27(0x1cd),_0x25a2e8=>{const _0x3bb6d4=_0x5a5d27,_0x261510=Date['now']()-_0x95f63a;_0x4e3248[_0x3bb6d4(0x1cf)][_0x3bb6d4(0x1cd)]('build',_0x3bb6d4(0x1c7),{'error':_0x25a2e8['message'],'duration':_0x261510,'stderr':_0x23cb41[_0x3bb6d4(0x1b9)]()||undefined}),_0x2c06a6(_0x25a2e8);});});}export const buildCommand={'name':'build','description':'Build\x20project',async 'run'(_0x3df536,_0x3d9703,_0x181f1f){await runBuild(_0x3df536);}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a27_0x50d6(){const _0xdb5630=['290VcxWAv','info','error','yellow','toLowerCase','gray','version','@latest','parse','red','281YZBdtp','7tJARNs','succeed','\x20\x20Run\x20manually:\x20npm\x20install\x20-g\x20','\x20\x20Try\x20manually:\x20','pipe','Already\x20up\x20to\x20date\x20(v','green','npm','/latest','607245ijlLml','https://registry.npmjs.org/','46bQUaLu','update','Checking\x20for\x20updates...','cli','Update\x20failed','Current\x20version:\x20','start','utf-8','bun','6586101lmxJVs','31876qDnaxz','Update\x20rabetbase\x20CLI\x20to\x20the\x20latest\x20version','install','package.json','...','4287784SrClMW','Update\x20available:\x20','stableVersion','2556936SxzLku','Version\x20comparison\x20failed','\x20→\x20','9155700SEUAvi','coerce','Updated\x20to\x20v','json','log','fail'];a27_0x50d6=function(){return _0xdb5630;};return a27_0x50d6();}const a27_0x4171a9=a27_0x73cf;(function(_0x25468f,_0x2f2e73){const _0x1a6b33=a27_0x73cf,_0x5a3ee4=_0x25468f();while(!![]){try{const _0x43824e=-parseInt(_0x1a6b33(0x1a5))/0x1*(-parseInt(_0x1a6b33(0x180))/0x2)+parseInt(_0x1a6b33(0x1af))/0x3+parseInt(_0x1a6b33(0x18a))/0x4*(parseInt(_0x1a6b33(0x19b))/0x5)+parseInt(_0x1a6b33(0x192))/0x6+parseInt(_0x1a6b33(0x1a6))/0x7*(-parseInt(_0x1a6b33(0x18f))/0x8)+-parseInt(_0x1a6b33(0x189))/0x9+parseInt(_0x1a6b33(0x195))/0xa;if(_0x43824e===_0x2f2e73)break;else _0x5a3ee4['push'](_0x5a3ee4['shift']());}catch(_0x50813a){_0x5a3ee4['push'](_0x5a3ee4['shift']());}}}(a27_0x50d6,0xb5e54));import{readFileSync}from'node:fs';import{resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import a27_0x4a640f from'chalk';import a27_0x3e46fe from'ora';import a27_0x4f521a from'semver';function a27_0x73cf(_0x4a6d21,_0x236909){_0x4a6d21=_0x4a6d21-0x17f;const _0x50d6d8=a27_0x50d6();let _0x73cfd3=_0x50d6d8[_0x4a6d21];return _0x73cfd3;}import{execa}from'execa';import{NPM_PACKAGE_NAME}from'../constant/cli.js';import{BUILD_NUMBER}from'../generated/build-info.js';import{getCdnConfig}from'../utils/cdn-config.js';function getCurrentVersion(){const _0x4bc3c2=a27_0x73cf;try{const _0x5efb56=resolve(dirname(fileURLToPath(import.meta.url)),'..'),_0x1fc7d3=JSON[_0x4bc3c2(0x1a3)](readFileSync(resolve(_0x5efb56,_0x4bc3c2(0x18d)),_0x4bc3c2(0x187))),_0x246016=_0x1fc7d3[_0x4bc3c2(0x1a1)]||'0.0.0';return BUILD_NUMBER?_0x246016+'+'+BUILD_NUMBER:_0x246016;}catch{return'0.0.0';}}function detectPackageManager(){const _0x4bcca0=a27_0x73cf,_0x24b6c3=process['execPath'][_0x4bcca0(0x19f)]();if(_0x24b6c3['includes'](_0x4bcca0(0x188)))return _0x4bcca0(0x188);return _0x4bcca0(0x1ad);}async function fetchLatestNpmVersion(){const _0x3012a8=a27_0x73cf;try{const _0x54e65f=await fetch(_0x3012a8(0x17f)+NPM_PACKAGE_NAME+_0x3012a8(0x1ae),{'signal':AbortSignal['timeout'](0x2710)});if(!_0x54e65f['ok'])return null;const _0x27c3b3=await _0x54e65f[_0x3012a8(0x198)]();return _0x27c3b3[_0x3012a8(0x1a1)]??null;}catch{return null;}}async function fetchLatestVersion(){const _0x3f3117=a27_0x73cf,_0x41bcb2=await fetchLatestNpmVersion();if(_0x41bcb2)return _0x41bcb2;const _0x1a4fb2=await getCdnConfig();return _0x1a4fb2?.[_0x3f3117(0x183)]?.[_0x3f3117(0x191)]??null;}async function runSelfUpdate(_0x131a24,_0x10c0d6,_0xf59258){const _0xcd6e55=a27_0x73cf,_0x426762=getCurrentVersion();console[_0xcd6e55(0x199)](_0xcd6e55(0x185)+_0x426762);const _0x2a4c4f=a27_0x3e46fe(_0xcd6e55(0x182))[_0xcd6e55(0x186)](),_0x19664a=await fetchLatestVersion();if(!_0x19664a){_0x2a4c4f[_0xcd6e55(0x19a)]('Unable\x20to\x20check\x20for\x20updates\x20(network\x20error)'),console[_0xcd6e55(0x199)](a27_0x4a640f[_0xcd6e55(0x1a0)](_0xcd6e55(0x1a8)+NPM_PACKAGE_NAME+'@latest'));return;}const _0x3fde06=a27_0x4f521a[_0xcd6e55(0x196)](_0x426762),_0x380f71=a27_0x4f521a['coerce'](_0x19664a);if(!_0x3fde06||!_0x380f71){_0x2a4c4f[_0xcd6e55(0x19a)](_0xcd6e55(0x193));return;}if(!a27_0x4f521a['lt'](_0x3fde06,_0x380f71)){_0x2a4c4f[_0xcd6e55(0x1a7)](_0xcd6e55(0x1ab)+_0x19664a+')');return;}_0x2a4c4f[_0xcd6e55(0x19c)](_0xcd6e55(0x190)+a27_0x4a640f[_0xcd6e55(0x19e)](_0x426762)+_0xcd6e55(0x194)+a27_0x4a640f[_0xcd6e55(0x1ac)](_0x19664a));const _0x5a8d6d=detectPackageManager(),_0x57cf8d=a27_0x3e46fe('Updating\x20via\x20'+_0x5a8d6d+_0xcd6e55(0x18e))[_0xcd6e55(0x186)]();try{await execa(_0x5a8d6d,[_0xcd6e55(0x18c),'-g',NPM_PACKAGE_NAME+_0xcd6e55(0x1a2)],{'stdio':_0xcd6e55(0x1aa)}),_0x57cf8d['succeed'](_0xcd6e55(0x197)+_0x19664a),console['log'](a27_0x4a640f[_0xcd6e55(0x1a0)]('\x20\x20Restart\x20your\x20terminal\x20to\x20use\x20the\x20new\x20version.'));}catch(_0x4b76dc){_0x57cf8d['fail'](_0xcd6e55(0x184)),console[_0xcd6e55(0x19d)](a27_0x4a640f[_0xcd6e55(0x1a4)]('\x20\x20'+_0x4b76dc['message'])),console[_0xcd6e55(0x199)](a27_0x4a640f[_0xcd6e55(0x1a0)](_0xcd6e55(0x1a9)+_0x5a8d6d+'\x20install\x20-g\x20'+NPM_PACKAGE_NAME+'@latest'));}}export const updateCommand={'name':a27_0x4171a9(0x181),'description':a27_0x4171a9(0x18b),async 'run'(_0x3d7a54,_0x15850f,_0x49b5b2){await runSelfUpdate(_0x3d7a54,_0x15850f,_0x49b5b2);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1be963,_0x20f40e){const _0x4eb224=a28_0xa680,_0x43c67f=_0x1be963();while(!![]){try{const _0x5beaae=-parseInt(_0x4eb224(0x1e7))/0x1+-parseInt(_0x4eb224(0x1ea))/0x2+-parseInt(_0x4eb224(0x1e8))/0x3*(parseInt(_0x4eb224(0x1e9))/0x4)+parseInt(_0x4eb224(0x1e5))/0x5+parseInt(_0x4eb224(0x1e4))/0x6+parseInt(_0x4eb224(0x1e3))/0x7+-parseInt(_0x4eb224(0x1e6))/0x8;if(_0x5beaae===_0x20f40e)break;else _0x43c67f['push'](_0x43c67f['shift']());}catch(_0x44ba23){_0x43c67f['push'](_0x43c67f['shift']());}}}(a28_0x2c50,0x1a84e));function a28_0xa680(_0x8f5ef7,_0x3afc25){_0x8f5ef7=_0x8f5ef7-0x1e3;const _0x2c5092=a28_0x2c50();let _0xa680b=_0x2c5092[_0x8f5ef7];return _0xa680b;}import{codegenSdk}from'./sdk.js';function a28_0x2c50(){const _0x4b8811=['48vbgYuZ','30364DNnBYS','63460MVkczM','279790BCUYMA','1043544xgFZZj','631335wlrQcY','454632xwJDsl','21524sJUxiK'];a28_0x2c50=function(){return _0x4b8811;};return a28_0x2c50();}import{codegenSql}from'./sql.js';export const codegenDefinitions=[codegenSdk,codegenSql];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a29_0x35ad(){const _0x1da45a=['Generate\x20TypeScript\x20SDK\x20code\x20for\x20a\x20dataset\x20operation','466200RXBvoO','sdk','1129302KOoGtQ','23160xGYxDS','169491BXZESm','boolean','2AKhdPr','305955gokAba','168627SzdIBv','skip-imports','string','Operation\x20name\x20(e.g.\x20filter,\x20getOne,\x20create,\x20update)','name','573904uffxYf','tableName','Omit\x20import\x20statements\x20from\x20generated\x20code','code','appCode','str','783zBKiFa','read','alias'];a29_0x35ad=function(){return _0x1da45a;};return a29_0x35ad();}const a29_0x1ad5c7=a29_0xe791;(function(_0x1ea589,_0x456ba1){const _0x41f4fa=a29_0xe791,_0x3dfbed=_0x1ea589();while(!![]){try{const _0x58de40=-parseInt(_0x41f4fa(0x117))/0x1*(-parseInt(_0x41f4fa(0x115))/0x2)+parseInt(_0x41f4fa(0x116))/0x3+-parseInt(_0x41f4fa(0x105))/0x4+parseInt(_0x41f4fa(0x10f))/0x5+parseInt(_0x41f4fa(0x111))/0x6+-parseInt(_0x41f4fa(0x113))/0x7+parseInt(_0x41f4fa(0x112))/0x8*(-parseInt(_0x41f4fa(0x10b))/0x9);if(_0x58de40===_0x456ba1)break;else _0x3dfbed['push'](_0x3dfbed['shift']());}catch(_0x362505){_0x3dfbed['push'](_0x3dfbed['shift']());}}}(a29_0x35ad,0x205a3));import{getOperationDetail,generateSdkCode}from'../../core/api-client.js';function a29_0xe791(_0xb5bf7,_0x4a66fc){_0xb5bf7=_0xb5bf7-0x102;const _0x35ad72=a29_0x35ad();let _0xe79103=_0x35ad72[_0xb5bf7];return _0xe79103;}import{CODE_FLAG_OPTIONAL}from'../common/flags.js';export const codegenSdk={'service':'codegen','command':a29_0x1ad5c7(0x110),'description':a29_0x1ad5c7(0x10e),'risk':a29_0x1ad5c7(0x10c),'flags':[CODE_FLAG_OPTIONAL,{'name':a29_0x1ad5c7(0x10d),'type':a29_0x1ad5c7(0x102),'description':'Dataset\x20alias\x20defined\x20in\x20api.ts\x20(e.g.\x20order,\x20coupon)'},{'name':'operation','type':a29_0x1ad5c7(0x102),'required':!![],'description':a29_0x1ad5c7(0x103)},{'name':a29_0x1ad5c7(0x118),'type':a29_0x1ad5c7(0x114),'description':a29_0x1ad5c7(0x107)}],async 'execute'(_0x181c65){const _0x136ff0=a29_0x1ad5c7,{dataset:_0x40cb11,operation:_0x50903a}=await getOperationDetail(_0x181c65[_0x136ff0(0x109)],_0x181c65['str'](_0x136ff0(0x108)),_0x181c65[_0x136ff0(0x10a)]('operation')),_0x3b60fa=generateSdkCode(_0x40cb11,_0x50903a,{'includeImports':!_0x181c65['bool'](_0x136ff0(0x118))});return{'ok':!![],'data':{'dataset':{'name':_0x40cb11[_0x136ff0(0x104)],'code':_0x40cb11['code'],'tableName':_0x40cb11[_0x136ff0(0x106)]},'operation':_0x181c65['str']('operation'),'code':_0x3b60fa}};}};
|