@lovrabet/rabetbase-cli 2.0.4-beta.5 → 2.0.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/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/get-session-user.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/api/shared.js +1 -1
- package/lib/commands/app/add.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/remote.js +1 -1
- package/lib/commands/app/remove.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app/use.js +1 -1
- package/lib/commands/auth/index.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 -1
- 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/app-selector.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.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 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/logs/index.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/index.js +1 -1
- package/lib/commands/project-upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/skill/index.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/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/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/framework/types.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/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.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/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/platform.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/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a20_0x4aaf(_0x76b161,_0x22820f){_0x76b161=_0x76b161-0xce;const _0x20c4f1=a20_0x20c4();let _0x4aaf8b=_0x20c4f1[_0x76b161];return _0x4aaf8b;}const a20_0x134343=a20_0x4aaf;(function(_0x5d1f2c,_0x18090b){const _0x486a98=a20_0x4aaf,_0x31e75c=_0x5d1f2c();while(!![]){try{const _0x3455c=-parseInt(_0x486a98(0xdb))/0x1*(-parseInt(_0x486a98(0xd8))/0x2)+parseInt(_0x486a98(0xd4))/0x3+-parseInt(_0x486a98(0xdd))/0x4*(-parseInt(_0x486a98(0xd0))/0x5)+parseInt(_0x486a98(0xd2))/0x6+-parseInt(_0x486a98(0xd1))/0x7*(parseInt(_0x486a98(0xce))/0x8)+parseInt(_0x486a98(0xd9))/0x9+-parseInt(_0x486a98(0xcf))/0xa;if(_0x3455c===_0x18090b)break;else _0x31e75c['push'](_0x31e75c['shift']());}catch(_0x4173ff){_0x31e75c['push'](_0x31e75c['shift']());}}}(a20_0x20c4,0x922c7));import{listRemoteApps}from'../../core/api-client.js';function a20_0x20c4(){const _0x5914f6=['713786DarRSN','9383112AVHgqJ','appDesc','1yfSMuF','remote','8uQocFM','map','8BwPDCP','12911960RVXRfG','2373465GCvbvj','7399658gAqSva','845886ottAHW','appName','1371567uNyGQC','../../core/api-client.js','appCode','cookie'];a20_0x20c4=function(){return _0x5914f6;};return a20_0x20c4();}async function execute(_0x286efa){const _0x5a7e2d=a20_0x4aaf,{setActiveCookie:_0x4799e1}=await import(_0x5a7e2d(0xd5));_0x4799e1(_0x286efa[_0x5a7e2d(0xd7)]);const _0x3f0de1=await listRemoteApps(),_0x2ee3a7=_0x3f0de1[_0x5a7e2d(0xde)](_0x156f60=>({..._0x156f60['id']!=null?{'id':_0x156f60['id']}:{},'appCode':_0x156f60[_0x5a7e2d(0xd6)],'appName':_0x156f60[_0x5a7e2d(0xd3)],..._0x156f60['appDesc']!=null?{'appDesc':_0x156f60[_0x5a7e2d(0xda)]}:{}}));return{'ok':!![],'data':_0x2ee3a7};}export const appRemoteDefinition={'service':'app','command':a20_0x134343(0xdc),'description':'List\x20apps\x20available\x20on\x20the\x20platform','risk':'read','requiresAuth':!![],'requiresAppCode':![],'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a21_0x120bfe=a21_0x4c4b;(function(_0xc9e532,_0x36db65){const _0x19c25e=a21_0x4c4b,_0x12de36=_0xc9e532();while(!![]){try{const _0x2b1409=parseInt(_0x19c25e(0x1f8))/0x1+-parseInt(_0x19c25e(0x1f2))/0x2+-parseInt(_0x19c25e(0x1f7))/0x3*(-parseInt(_0x19c25e(0x1ef))/0x4)+parseInt(_0x19c25e(0x1f3))/0x5*(-parseInt(_0x19c25e(0x1fb))/0x6)+parseInt(_0x19c25e(0x1fd))/0x7*(parseInt(_0x19c25e(0x1e7))/0x8)+parseInt(_0x19c25e(0x1ee))/0x9+-parseInt(_0x19c25e(0x1f5))/0xa;if(_0x2b1409===_0x36db65)break;else _0x12de36['push'](_0x12de36['shift']());}catch(_0x2e39ca){_0x12de36['push'](_0x12de36['shift']());}}}(a21_0x4ff0,0x24480));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{readConfig,writeConfig}from'./shared.js';function a21_0x4ff0(){const _0x3498ab=['18144uDbuZJ','215843sDMXYr','str','\x20app\x20remove\x20--name\x20<name>','88710WxrbEx','apps','1364426QpQYPr','write','remove','Usage:\x20','keys','bool','validation','App\x20\x22','8GyQcui','defaultApp','string','\x20Default\x20app\x20changed\x20to\x20\x22','Remove\x20an\x20app\x20from\x20config','App\x20name\x20to\x20remove','length','2610324eIzLDa','36NLmpjA','Removed\x20app\x20\x22','\x22\x20not\x20found.','145462zPcRAm','65uOfdAq','global','3416850DbjezR','name'];a21_0x4ff0=function(){return _0x3498ab;};return a21_0x4ff0();}function a21_0x4c4b(_0x4817dc,_0x11c3df){_0x4817dc=_0x4817dc-0x1e2;const _0x4ff0b8=a21_0x4ff0();let _0x4c4bd2=_0x4ff0b8[_0x4817dc];return _0x4c4bd2;}async function execute(_0x3d0956){const _0x36b6e9=a21_0x4c4b,_0x300b83=_0x3d0956[_0x36b6e9(0x1f9)](_0x36b6e9(0x1f6));if(!_0x300b83)throw CliErrors[_0x36b6e9(0x1e5)]('Missing\x20app\x20name.',_0x36b6e9(0x1e2)+CLI_BIN_NAME+_0x36b6e9(0x1fa));const _0x517f38={'global':_0x3d0956[_0x36b6e9(0x1e4)]('global')},_0x1a0cf6=readConfig(_0x517f38),_0x576e5c=_0x1a0cf6[_0x36b6e9(0x1fc)];if(!_0x576e5c||!_0x576e5c[_0x300b83])throw CliErrors['validation'](_0x36b6e9(0x1e6)+_0x300b83+_0x36b6e9(0x1f1));delete _0x576e5c[_0x300b83];let _0x3ef798='';if(_0x1a0cf6[_0x36b6e9(0x1e8)]===_0x300b83){const _0x12f780=Object[_0x36b6e9(0x1e3)](_0x576e5c);_0x1a0cf6['defaultApp']=_0x12f780[_0x36b6e9(0x1ed)]>0x0?_0x12f780[0x0]:undefined,_0x1a0cf6[_0x36b6e9(0x1e8)]?_0x3ef798=_0x36b6e9(0x1ea)+_0x1a0cf6[_0x36b6e9(0x1e8)]+'\x22.':delete _0x1a0cf6[_0x36b6e9(0x1e8)];}return Object[_0x36b6e9(0x1e3)](_0x576e5c)['length']===0x0&&(delete _0x1a0cf6[_0x36b6e9(0x1fc)],delete _0x1a0cf6[_0x36b6e9(0x1e8)]),writeConfig(_0x1a0cf6,_0x517f38),{'ok':!![],'message':_0x36b6e9(0x1f0)+_0x300b83+'\x22.'+_0x3ef798};}export const appRemoveDefinition={'service':'app','command':a21_0x120bfe(0x1ff),'description':a21_0x120bfe(0x1eb),'risk':a21_0x120bfe(0x1fe),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':'name','type':a21_0x120bfe(0x1e9),'description':a21_0x120bfe(0x1ec),'required':!![]},{'name':a21_0x120bfe(0x1f4),'type':'boolean','description':'Use\x20global\x20config\x20scope','default':![]}],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2975a2,_0x4adb0c){const _0x4e2a56=a22_0x1a4f,_0x139a71=_0x2975a2();while(!![]){try{const _0x72944f=-parseInt(_0x4e2a56(0xc4))/0x1*(parseInt(_0x4e2a56(0xd1))/0x2)+parseInt(_0x4e2a56(0xd5))/0x3*(parseInt(_0x4e2a56(0xcf))/0x4)+-parseInt(_0x4e2a56(0xd9))/0x5+parseInt(_0x4e2a56(0xd3))/0x6*(parseInt(_0x4e2a56(0xc8))/0x7)+-parseInt(_0x4e2a56(0xce))/0x8+parseInt(_0x4e2a56(0xd0))/0x9+parseInt(_0x4e2a56(0xd8))/0xa;if(_0x72944f===_0x4adb0c)break;else _0x139a71['push'](_0x139a71['shift']());}catch(_0x576a10){_0x139a71['push'](_0x139a71['shift']());}}}(a22_0x1fd6,0x680db));import{resolveWriteConfigPath,readConfigFile,writeConfigFile}from'../../context.js';function a22_0x1fd6(){const _0x5cda54=['600245McdMBN','apiDir','defaultApp','349637hzXOJA','pageSize','cookie','apps','7GrmJuF','log','\x22\x20to\x20multi-app\x20config\x20(set\x20as\x20default).','global','riskLevel','Migrated\x20existing\x20app\x20\x22','4558640wvRHui','90260UCbyxM','1159749RsyuAj','2heixVx','format','4291674vLJtmL','\x20(global)','69xxrpxv','appcode','app','1025840cINQCa'];a22_0x1fd6=function(){return _0x5cda54;};return a22_0x1fd6();}export function getConfigPath(_0x43c1cc={}){const _0x342b0a=a22_0x1a4f,_0x47f68e=_0x43c1cc[_0x342b0a(0xcb)]?'global':'project';return resolveWriteConfigPath(_0x47f68e);}export function readConfig(_0x4d012f={}){return readConfigFile(getConfigPath(_0x4d012f));}function a22_0x1a4f(_0x164e10,_0x5a3f11){_0x164e10=_0x164e10-0xc2;const _0x1fd6a7=a22_0x1fd6();let _0x1a4feb=_0x1fd6a7[_0x164e10];return _0x1a4feb;}export function writeConfig(_0xb22c0d,_0x136285={}){writeConfigFile(getConfigPath(_0x136285),_0xb22c0d);}export function scopeLabel(_0x3f5881){const _0x567b16=a22_0x1a4f;return _0x3f5881[_0x567b16(0xcb)]?_0x567b16(0xd4):'';}export function migrateLegacySingleApp(_0x27bce9,_0x2f606e){const _0x2d5e5d=a22_0x1a4f,_0x62ecdd=_0x27bce9[_0x2d5e5d(0xd6)]||_0x27bce9[_0x2d5e5d(0xd7)];if(!_0x62ecdd)return;const _0x2e7a4d=String(_0x62ecdd);if(_0x2e7a4d===_0x2f606e)return;const _0x6bf56c=['env',_0x2d5e5d(0xc2),_0x2d5e5d(0xc6),'accessKey',_0x2d5e5d(0xd2),_0x2d5e5d(0xc5),_0x2d5e5d(0xcc),'locale'],_0x343d3f={'appcode':_0x62ecdd};for(const _0x5a92a0 of _0x6bf56c){if(_0x27bce9[_0x5a92a0]!=null)_0x343d3f[_0x5a92a0]=_0x27bce9[_0x5a92a0];}_0x27bce9[_0x2d5e5d(0xc7)][_0x2e7a4d]=_0x343d3f,_0x27bce9[_0x2d5e5d(0xc3)]=_0x2e7a4d,delete _0x27bce9[_0x2d5e5d(0xd6)],delete _0x27bce9[_0x2d5e5d(0xd7)],console[_0x2d5e5d(0xc9)](_0x2d5e5d(0xcd)+_0x2e7a4d+_0x2d5e5d(0xca));}
|
package/lib/commands/app/use.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a23_0x4fe6d9=a23_0x20c6;(function(_0x4a2d9a,_0xdef073){const _0x4bf566=a23_0x20c6,_0x681f3d=_0x4a2d9a();while(!![]){try{const _0x40837e=-parseInt(_0x4bf566(0x1bc))/0x1+parseInt(_0x4bf566(0x1b7))/0x2*(-parseInt(_0x4bf566(0x1ce))/0x3)+-parseInt(_0x4bf566(0x1cd))/0x4+parseInt(_0x4bf566(0x1ca))/0x5+parseInt(_0x4bf566(0x1c4))/0x6*(-parseInt(_0x4bf566(0x1b6))/0x7)+parseInt(_0x4bf566(0x1c8))/0x8+parseInt(_0x4bf566(0x1cc))/0x9;if(_0x40837e===_0xdef073)break;else _0x681f3d['push'](_0x681f3d['shift']());}catch(_0x5228fe){_0x681f3d['push'](_0x681f3d['shift']());}}}(a23_0x19d6,0x21c3c));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{readConfig,writeConfig,scopeLabel}from'./shared.js';function a23_0x20c6(_0x12117a,_0x4bbe46){_0x12117a=_0x12117a-0x1b0;const _0x19d62e=a23_0x19d6();let _0x20c688=_0x19d62e[_0x12117a];return _0x20c688;}async function execute(_0x1478c3){const _0xdb75a9=a23_0x20c6,_0x407608=_0x1478c3[_0xdb75a9(0x1be)](_0xdb75a9(0x1ba));if(!_0x407608)throw CliErrors[_0xdb75a9(0x1c1)](_0xdb75a9(0x1c5),_0xdb75a9(0x1b4)+CLI_BIN_NAME+_0xdb75a9(0x1b9));const _0x4331c9={'global':_0x1478c3[_0xdb75a9(0x1c2)](_0xdb75a9(0x1d0))},_0x506bc2=readConfig(_0x4331c9),_0x4ced0f=_0x506bc2[_0xdb75a9(0x1cf)]??{};if(!_0x4ced0f[_0x407608]){const _0x40d806=Object[_0xdb75a9(0x1b0)](_0x4ced0f),_0x5c0a67=_0x40d806['length']===0x0?'Use\x20`'+CLI_BIN_NAME+'\x20app\x20add\x20--name\x20'+_0x407608+_0xdb75a9(0x1c0):_0xdb75a9(0x1cb)+_0x40d806[_0xdb75a9(0x1bb)](',\x20');throw CliErrors[_0xdb75a9(0x1c1)](_0xdb75a9(0x1bf)+_0x407608+_0xdb75a9(0x1b1),_0x5c0a67);}return _0x506bc2[_0xdb75a9(0x1b3)]=_0x407608,writeConfig(_0x506bc2,_0x4331c9),{'ok':!![],'message':'Default\x20app\x20set\x20to\x20\x22'+_0x407608+_0xdb75a9(0x1bd)+_0x4ced0f[_0x407608]['appcode']+')'+scopeLabel(_0x4331c9)};}export const appUseDefinition={'service':a23_0x4fe6d9(0x1b2),'command':a23_0x4fe6d9(0x1b5),'description':a23_0x4fe6d9(0x1b8),'risk':a23_0x4fe6d9(0x1c7),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a23_0x4fe6d9(0x1ba),'type':a23_0x4fe6d9(0x1c6),'description':'App\x20name\x20to\x20activate','required':!![]},{'name':a23_0x4fe6d9(0x1d0),'type':a23_0x4fe6d9(0x1c9),'description':a23_0x4fe6d9(0x1c3),'default':![]}],'execute':execute};function a23_0x19d6(){const _0x527eb5=['608296OwVDJU','141nrHxAK','apps','global','keys','\x22\x20not\x20found.','app','defaultApp','Usage:\x20','use','7JpVOHu','1894Egnhtw','Switch\x20the\x20default\x20app','\x20app\x20use\x20--name\x20<name>','name','join','175352opxnvg','\x22\x20(appcode:\x20','str','App\x20\x22','\x20--appcode\x20<code>`\x20first.','validation','bool','Use\x20global\x20config\x20scope','960456qdxRUd','Missing\x20app\x20name.','string','write','422440QXvEhK','boolean','1014380ohSzwP','Available:\x20','3731670lFYAFE'];a23_0x19d6=function(){return _0x527eb5;};return a23_0x19d6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a24_0x41a90a=a24_0x54c3;(function(_0x54b6e6,_0x28257b){const _0x515ea6=a24_0x54c3,_0x49be02=_0x54b6e6();while(!![]){try{const _0x3da910=-parseInt(_0x515ea6(0x9b))/0x1+parseInt(_0x515ea6(0xa7))/0x2+parseInt(_0x515ea6(0xa2))/0x3+-parseInt(_0x515ea6(0xa3))/0x4+-parseInt(_0x515ea6(0x9d))/0x5+parseInt(_0x515ea6(0xa5))/0x6+parseInt(_0x515ea6(0xa1))/0x7*(-parseInt(_0x515ea6(0x9c))/0x8);if(_0x3da910===_0x28257b)break;else _0x49be02['push'](_0x49be02['shift']());}catch(_0x55b232){_0x49be02['push'](_0x49be02['shift']());}}}(a24_0x49fb,0x5b691));function a24_0x49fb(){const _0x2a9a77=['15169KevKAU','1244778dBDsJZ','2252980FmzYXl','login','3883026viKTMG','✓\x20Logged\x20out','1396276rKXXen','logout','write','../../auth/auth-server-ui.js','auth','Clear\x20login\x20session','232299IXXZzi','2024aTErdp','210115PmbJzd','Login\x20via\x20browser','log','read'];a24_0x49fb=function(){return _0x2a9a77;};return a24_0x49fb();}import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a24_0x54c3(_0x3f0789,_0x2677d5){_0x3f0789=_0x3f0789-0x99;const _0x49fbb8=a24_0x49fb();let _0x54c3ec=_0x49fbb8[_0x3f0789];return _0x54c3ec;}export const authDefinitions=[{'service':a24_0x41a90a(0x99),'command':a24_0x41a90a(0xa4),'description':a24_0x41a90a(0x9e),'risk':a24_0x41a90a(0xa0),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x13f537){const _0x1b3b31=a24_0x41a90a,{runAuthServer:_0x12b101}=await import(_0x1b3b31(0xaa));return await _0x12b101(),{'ok':!![]};}},{'service':'auth','command':a24_0x41a90a(0xa8),'description':a24_0x41a90a(0x9a),'risk':a24_0x41a90a(0xa9),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x29f5f7){const _0x74759f=a24_0x41a90a;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x74759f(0x9f)](_0x74759f(0xa6))):console[_0x74759f(0x9f)]('!\x20Not\x20logged\x20in'),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a25_0x4b64(){const _0x4a2280=['split','No\x20lock\x20entry\x20found\x20for\x20\x22','2184889CosIml','projectRoot','toISOString','Deleted\x20','string','str','trashDir','keys','lockFilePath','/api/management/library/scripts/delete','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','appCode','high-risk-write','Delete\x20a\x20BFF\x20script\x20from\x20remote\x20and\x20local','11NygwBo','5rIVpAl','\x20(local\x20file\x20moved\x20to\x20trash)','63396DoPieV','join','5450484tkfsAF','140NNiRde','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','lastSync','scriptsRootDir','20778AnjxTp','delete','validation','BFF\x20lock\x20file\x20not\x20found.','remoteId','filter','target','functions','8zsiFGp','258167jujEZn','length','996TgrDXK','3715770sLMXFz','8944983gneRsE','POST','30hDCPnl','\x20\x20-\x20','Function\x20not\x20found:\x20','replace','BFF\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','find'];a25_0x4b64=function(){return _0x4a2280;};return a25_0x4b64();}const a25_0x40235e=a25_0x1b15;(function(_0x615c3f,_0x32a357){const _0x247d34=a25_0x1b15,_0x230362=_0x615c3f();while(!![]){try{const _0x12b49c=parseInt(_0x247d34(0x16c))/0x1*(-parseInt(_0x247d34(0x14b))/0x2)+-parseInt(_0x247d34(0x165))/0x3*(parseInt(_0x247d34(0x168))/0x4)+parseInt(_0x247d34(0x163))/0x5*(parseInt(_0x247d34(0x167))/0x6)+parseInt(_0x247d34(0x154))/0x7*(-parseInt(_0x247d34(0x174))/0x8)+-parseInt(_0x247d34(0x149))/0x9+parseInt(_0x247d34(0x148))/0xa*(parseInt(_0x247d34(0x162))/0xb)+-parseInt(_0x247d34(0x147))/0xc*(-parseInt(_0x247d34(0x145))/0xd);if(_0x12b49c===_0x32a357)break;else _0x230362['push'](_0x230362['shift']());}catch(_0x59f1d6){_0x230362['push'](_0x230362['shift']());}}}(a25_0x4b64,0x8b668));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a25_0x1b15(_0x2462b8,_0x409b77){_0x2462b8=_0x2462b8-0x145;const _0x4b64b9=a25_0x4b64();let _0x1b15cb=_0x4b64b9[_0x2462b8];return _0x1b15cb;}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':'bff','command':a25_0x40235e(0x16d),'description':a25_0x40235e(0x161),'risk':a25_0x40235e(0x160),'flags':[{'name':'target','type':a25_0x40235e(0x158),'required':!![],'description':a25_0x40235e(0x150)}],async 'validate'(_0x8ca3a1){const _0x120ce9=a25_0x40235e,_0xf78b58=loadBffProjectConfig(_0x8ca3a1[_0x120ce9(0x15f)]),_0x3c2d1c=await readBffLockFile(_0xf78b58['lockFilePath']);if(!_0x3c2d1c)throw CliErrors['validation'](_0x120ce9(0x14f));},async 'dryRun'(_0x33bc7b){const _0x2e5603=a25_0x40235e,_0x2f04d6=loadBffProjectConfig(_0x33bc7b[_0x2e5603(0x15f)]),_0x41e5f1=await readBffLockFile(_0x2f04d6[_0x2e5603(0x15c)]);if(!_0x41e5f1)throw CliErrors[_0x2e5603(0x16e)](_0x2e5603(0x16f));const {appLock:_0x507d0e}=ensureLockScope(_0x41e5f1,_0x33bc7b['appCode'],_0x2f04d6['scriptsRoot'],_0x2e5603(0x16d)),_0x6ef69=_0x33bc7b[_0x2e5603(0x159)](_0x2e5603(0x172)),_0x47b068=Object['keys'](_0x507d0e[_0x2e5603(0x173)]),_0x153041=resolveDeleteTarget(_0x6ef69,_0x47b068),_0x13c4ad=_0x507d0e['functions'][_0x153041];if(!_0x13c4ad)throw CliErrors[_0x2e5603(0x16e)](_0x2e5603(0x153)+_0x153041+'\x22.');const _0x144386=resolveLocalFilePathFromLockKey(_0x2f04d6,_0x153041),_0x2f9dba=relative(_0x2f04d6[_0x2e5603(0x155)],_0x144386),_0x17a898=join(_0x2f04d6[_0x2e5603(0x15a)],'<timestamp>',_0x2f9dba);return{'method':_0x2e5603(0x14a),'url':_0x2e5603(0x15d),'body':{'appCode':_0x33bc7b[_0x2e5603(0x15f)],'target':_0x153041,'remoteId':_0x13c4ad['remoteId'],'localFilePath':_0x144386,'trashedPath':_0x17a898},'description':'Would\x20delete\x20'+_0x153041+_0x2e5603(0x15e)};},async 'execute'(_0x3e9a73){const _0x383942=a25_0x40235e,_0x477904=loadBffProjectConfig(_0x3e9a73[_0x383942(0x15f)]),_0x4adfc4=await readBffLockFile(_0x477904['lockFilePath']);if(!_0x4adfc4)throw CliErrors[_0x383942(0x16e)](_0x383942(0x16f));const {lockData:_0x3e21ed,appLock:_0x12cc41}=ensureLockScope(_0x4adfc4,_0x3e9a73['appCode'],_0x477904['scriptsRoot'],_0x383942(0x16d)),_0x594a27=_0x3e9a73[_0x383942(0x159)]('target'),_0x2b979f=Object[_0x383942(0x15b)](_0x12cc41[_0x383942(0x173)]),_0xab4b9=resolveDeleteTarget(_0x594a27,_0x2b979f),_0x455e07=_0x12cc41[_0x383942(0x173)][_0xab4b9];if(!_0x455e07)throw CliErrors[_0x383942(0x16e)](_0x383942(0x153)+_0xab4b9+'\x22.');await deleteBffScript(_0x455e07[_0x383942(0x170)]),delete _0x12cc41['functions'][_0xab4b9],_0x12cc41[_0x383942(0x16a)]=new Date()[_0x383942(0x156)](),await writeBffLockFile(_0x477904[_0x383942(0x15c)],_0x3e21ed);const _0x1ea145=resolveLocalFilePathFromLockKey(_0x477904,_0xab4b9);let _0x1d1962;await fileExists(_0x1ea145)&&(_0x1d1962=await moveToTrash(_0x477904[_0x383942(0x155)],_0x477904[_0x383942(0x15a)],_0x1ea145),await cleanupEmptyDirectories(dirname(_0x1ea145),_0x477904[_0x383942(0x16b)]));const _0x3a2bcc={'deleted':_0xab4b9,'remoteId':_0x455e07[_0x383942(0x170)]};if(_0x1d1962)_0x3a2bcc['trashedTo']=_0x1d1962;return{'ok':!![],'data':_0x3a2bcc,'message':_0x383942(0x157)+_0xab4b9+(_0x1d1962?_0x383942(0x164):'')};}};function resolveDeleteTarget(_0x528305,_0x302b67){const _0x47fcbf=a25_0x40235e;if(_0x528305['includes']('/')){const _0x45b2dd=_0x302b67[_0x47fcbf(0x151)](_0x4aab32=>_0x4aab32===_0x528305);if(!_0x45b2dd)throw CliErrors[_0x47fcbf(0x16e)](_0x47fcbf(0x14d)+_0x528305);return _0x45b2dd;}const _0x301d0f=_0x302b67[_0x47fcbf(0x171)](_0x13a28=>_0x13a28[_0x47fcbf(0x152)]('/')['at'](-0x1)===_0x528305);if(_0x301d0f[_0x47fcbf(0x146)]===0x0)throw CliErrors['validation'](_0x47fcbf(0x14d)+_0x528305);if(_0x301d0f['length']>0x1)throw CliErrors['validation']('Multiple\x20functions\x20match\x20\x22'+_0x528305+_0x47fcbf(0x169)+_0x301d0f['map'](_0x3361f5=>_0x47fcbf(0x14c)+_0x3361f5)[_0x47fcbf(0x166)]('\x0a'));return _0x301d0f[0x0];}async function moveToTrash(_0x38dd1d,_0x176ceb,_0x2196b5){const _0x697367=a25_0x40235e,_0xcaf7be=new Date()['toISOString']()[_0x697367(0x14e)](/[:.]/g,'-'),_0x48ab5a=relative(_0x38dd1d,_0x2196b5),_0x4a16b7=join(_0x176ceb,_0xcaf7be,_0x48ab5a);return await mkdir(dirname(_0x4a16b7),{'recursive':!![]}),await rename(_0x2196b5,_0x4a16b7),_0x4a16b7;}async function cleanupEmptyDirectories(_0x57585e,_0x579a14){const _0x37c1f0=a25_0x40235e;let _0x504a6b=resolve(_0x57585e);const _0x5dd984=resolve(_0x579a14);while(_0x504a6b['startsWith'](''+_0x5dd984+sep)||_0x504a6b===_0x5dd984){if(_0x504a6b===_0x5dd984)return;try{const _0x4ee538=await readdir(_0x504a6b);if(_0x4ee538[_0x37c1f0(0x146)]>0x0)return;await rmdir(_0x504a6b);}catch{return;}_0x504a6b=dirname(_0x504a6b);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a26_0x4574c3=a26_0x1fd8;(function(_0x45ca68,_0x4bb276){const _0x125f58=a26_0x1fd8,_0x64e430=_0x45ca68();while(!![]){try{const _0x405d2b=parseInt(_0x125f58(0x82))/0x1+parseInt(_0x125f58(0x90))/0x2*(-parseInt(_0x125f58(0x91))/0x3)+parseInt(_0x125f58(0x8d))/0x4+-parseInt(_0x125f58(0x8b))/0x5+-parseInt(_0x125f58(0x8e))/0x6+parseInt(_0x125f58(0x83))/0x7+parseInt(_0x125f58(0x80))/0x8*(parseInt(_0x125f58(0x89))/0x9);if(_0x405d2b===_0x4bb276)break;else _0x64e430['push'](_0x64e430['shift']());}catch(_0x447bb3){_0x64e430['push'](_0x64e430['shift']());}}}(a26_0x5ecf,0x9474f));function a26_0x5ecf(){const _0x2d8708=['4049346USDNLS','num','number','appCode','Script\x20ID','boolean','9TmsFKv','Return\x20full\x20raw\x20script\x20object','4918205sUOHxE','(none)','4183264hidzXi','4907568qNgrzW','verbose','2eJWIxb','1230279CXYzHC','createdTime','1404392ockRYo','scriptType','1019898dbvrVb'];a26_0x5ecf=function(){return _0x2d8708;};return a26_0x5ecf();}function a26_0x1fd8(_0x2eb792,_0x20d6ca){_0x2eb792=_0x2eb792-0x7f;const _0x5ecfd9=a26_0x5ecf();let _0x1fd898=_0x5ecfd9[_0x2eb792];return _0x1fd898;}import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':'detail','description':'Get\x20BFF\x20script\x20details\x20by\x20ID','risk':'read','flags':[{'name':'id','type':a26_0x4574c3(0x85),'required':!![],'description':a26_0x4574c3(0x87)},{'name':a26_0x4574c3(0x8f),'type':a26_0x4574c3(0x88),'description':a26_0x4574c3(0x8a)}],async 'execute'(_0x2c0535){const _0x71df2f=a26_0x4574c3,_0x47e028=await getBffScriptInfo(_0x2c0535[_0x71df2f(0x84)]('id')),_0x4bde6b=_0x2c0535['bool'](_0x71df2f(0x8f));if(_0x4bde6b)return{'ok':!![],'data':_0x47e028};return{'ok':!![],'data':{'id':_0x47e028['id'],'appCode':_0x47e028[_0x71df2f(0x86)],'scriptType':_0x47e028[_0x71df2f(0x81)],'description':_0x47e028['description']||_0x71df2f(0x8c),'createdTime':_0x47e028[_0x71df2f(0x7f)]??'','updatedTime':_0x47e028['updatedTime']??'','scriptContent':_0x47e028['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a27_0x5902(_0x765e1d,_0x37eb7e){_0x765e1d=_0x765e1d-0x1cd;const _0x2dc7df=a27_0x2dc7();let _0x5902e4=_0x2dc7df[_0x765e1d];return _0x5902e4;}(function(_0x448f2e,_0x1a366e){const _0x543479=a27_0x5902,_0xa7d762=_0x448f2e();while(!![]){try{const _0x191b71=parseInt(_0x543479(0x1ce))/0x1+parseInt(_0x543479(0x1d0))/0x2+parseInt(_0x543479(0x1d1))/0x3+-parseInt(_0x543479(0x1d3))/0x4*(-parseInt(_0x543479(0x1d2))/0x5)+parseInt(_0x543479(0x1cd))/0x6+parseInt(_0x543479(0x1cf))/0x7+-parseInt(_0x543479(0x1d4))/0x8;if(_0x191b71===_0x1a366e)break;else _0xa7d762['push'](_0xa7d762['shift']());}catch(_0x44d2d1){_0xa7d762['push'](_0xa7d762['shift']());}}}(a27_0x2dc7,0x95051));import{bffList}from'./list.js';import{bffDetail}from'./detail.js';import{bffStatus}from'./status.js';function a27_0x2dc7(){const _0x4f2cb6=['362454kMikcn','7848211fbUAYa','2002624JLwcEr','927996AJrFVl','10zjtccn','962704GQaRWC','23710936hNwKYm','1791774BSdUQk'];a27_0x2dc7=function(){return _0x4f2cb6;};return a27_0x2dc7();}import{bffNew}from'./new.js';import{bffPush}from'./push.js';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
|
-
|
|
1
|
+
function a28_0x5396(){const _0x38adf4=['bool','string','Return\x20full\x20script\x20objects','3894580zSylGG','ENDPOINT','List\x20BFF\x20scripts','5863280KOjuTR','verbose','691966MDpRJO','list','description','str','7uyuoaH','(unnamed)','859802bgwers','3jbUQiC','type','351896EylnSP','Filter\x20by\x20script\x20name','867595cclkWk','18OPLRzr','appCode','boolean','map','3185214VlnnYE','Script\x20type\x20filter'];a28_0x5396=function(){return _0x38adf4;};return a28_0x5396();}const a28_0x5e4de1=a28_0x23c9;function a28_0x23c9(_0x2540d4,_0x5a0278){_0x2540d4=_0x2540d4-0xe1;const _0x5396f9=a28_0x5396();let _0x23c9ae=_0x5396f9[_0x2540d4];return _0x23c9ae;}(function(_0x3b6ef5,_0x1f9a1b){const _0x14041c=a28_0x23c9,_0x5952c7=_0x3b6ef5();while(!![]){try{const _0x4f7115=-parseInt(_0x14041c(0xec))/0x1+-parseInt(_0x14041c(0xf2))/0x2*(-parseInt(_0x14041c(0xf3))/0x3)+-parseInt(_0x14041c(0xf5))/0x4+parseInt(_0x14041c(0xf7))/0x5+-parseInt(_0x14041c(0xe2))/0x6*(-parseInt(_0x14041c(0xf0))/0x7)+-parseInt(_0x14041c(0xea))/0x8+parseInt(_0x14041c(0xf8))/0x9*(parseInt(_0x14041c(0xe7))/0xa);if(_0x4f7115===_0x1f9a1b)break;else _0x5952c7['push'](_0x5952c7['shift']());}catch(_0x195e0a){_0x5952c7['push'](_0x5952c7['shift']());}}}(a28_0x5396,0x61be3));import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':'bff','command':a28_0x5e4de1(0xed),'description':a28_0x5e4de1(0xe9),'risk':'read','flags':[{'name':'type','type':a28_0x5e4de1(0xe5),'description':a28_0x5e4de1(0xe3),'default':'ENDPOINT','enum':[a28_0x5e4de1(0xe8),'COMMON']},{'name':'name','type':'string','description':a28_0x5e4de1(0xf6)},{'name':a28_0x5e4de1(0xeb),'type':a28_0x5e4de1(0xfa),'description':a28_0x5e4de1(0xe6)}],async 'execute'(_0x1f48f3){const _0x511244=a28_0x5e4de1,_0x9bd68=await listBffScripts(_0x1f48f3[_0x511244(0xf9)],_0x1f48f3[_0x511244(0xef)](_0x511244(0xf4)),{'scriptName':_0x1f48f3[_0x511244(0xef)]('name')||undefined}),_0x1fbd16=_0x1f48f3[_0x511244(0xe4)](_0x511244(0xeb));return{'ok':!![],'data':_0x1fbd16?_0x9bd68:_0x9bd68[_0x511244(0xe1)](_0x2325a8=>({'id':_0x2325a8['id'],'functionName':_0x2325a8['functionName']??'','description':_0x2325a8[_0x511244(0xee)]||_0x511244(0xf1),'scriptType':_0x2325a8['scriptType']})),'message':_0x9bd68['length']===0x0?'No\x20BFF\x20scripts\x20found.':undefined};}};
|
package/lib/commands/bff/new.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a29_0x5f127c=a29_0x1779;(function(_0x1cc087,_0x198c6b){const _0x54291c=a29_0x1779,_0x2dc2e9=_0x1cc087();while(!![]){try{const _0x4f2a91=parseInt(_0x54291c(0x15e))/0x1*(parseInt(_0x54291c(0x14d))/0x2)+parseInt(_0x54291c(0x197))/0x3*(-parseInt(_0x54291c(0x199))/0x4)+-parseInt(_0x54291c(0x156))/0x5+parseInt(_0x54291c(0x189))/0x6*(parseInt(_0x54291c(0x177))/0x7)+-parseInt(_0x54291c(0x15b))/0x8*(-parseInt(_0x54291c(0x16a))/0x9)+-parseInt(_0x54291c(0x176))/0xa+parseInt(_0x54291c(0x145))/0xb*(parseInt(_0x54291c(0x183))/0xc);if(_0x4f2a91===_0x198c6b)break;else _0x2dc2e9['push'](_0x2dc2e9['shift']());}catch(_0x28fcae){_0x2dc2e9['push'](_0x2dc2e9['shift']());}}}(a29_0x58c0,0x91df7));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';function a29_0x1779(_0x597e21,_0x3ff0f2){_0x597e21=_0x597e21-0x141;const _0x58c031=a29_0x58c0();let _0x17791b=_0x58c031[_0x597e21];return _0x17791b;}import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';function a29_0x58c0(){const _0x2409d3=['operation-type','.js','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','52LkhbkD','COMMON','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','stderr','type','HOOK','bff','join','\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','5572830FpSWmD','Trigger\x20node\x20(HOOK\x20only)','entries','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','HOOK\x20requires\x20alias/operation/node\x20options.','438920fMDPSu','scriptsRootDir','/endpoint/','2858esXfiP','name','Operation\x20type\x20\x22','\x22\x20not\x20found.\x20','nonInteractive','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','function-node','\x0a\x20*\x20[触发节点]\x20','tableName','Function\x20name\x20(valid\x20JS\x20identifier)','apiDir','validation','117TMuHdL','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','Alias\x20\x22','alias','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','write','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','length','\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','new','find','Available\x20aliases:\x20','3059180FYgpXl','1295wrSjsA','/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','before','Created\x20','operationType','Select\x20operation\x20type:','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','str','ENDPOINT','Script\x20description','code','TODO:\x20add\x20script\x20description','12KZvZgH','\x20api\x20pull`\x20to\x20refresh.','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Available:\x20','appCode','includes','33294TygrSp','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','Select\x20trigger\x20node:','datasetcode','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','Select\x20dataset:','No\x20operation\x20types\x20found\x20for\x20dataset\x20','after','datasetCode','description','question','string','map','205398rdsVeP','Invalid\x20function\x20name\x20\x22','24XikZui','parseInt','\x0a\x20*\x20[脚本名称]\x20','\x20function:\x20','Dataset\x20not\x20found\x20for\x20code\x20\x22','functionNode','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','keys','isInteger','No\x20datasets\x20found\x20for\x20this\x20app.','6761227qrMGly','No\x20api.ts\x20found.\x20Run\x20`','Operation\x20type\x20(HOOK\x20only)','\x22.\x20','stdin'];a29_0x58c0=function(){return _0x2409d3;};return a29_0x58c0();}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':a29_0x5f127c(0x153),'command':a29_0x5f127c(0x173),'description':a29_0x5f127c(0x16e),'risk':a29_0x5f127c(0x16f),'flags':[{'name':a29_0x5f127c(0x151),'type':a29_0x5f127c(0x195),'required':!![],'enum':[a29_0x5f127c(0x14e),a29_0x5f127c(0x17f),a29_0x5f127c(0x152)],'description':'Script\x20type'},{'name':a29_0x5f127c(0x15f),'type':'string','required':!![],'description':a29_0x5f127c(0x167)},{'name':'description','type':a29_0x5f127c(0x195),'description':a29_0x5f127c(0x180)},{'name':'alias','type':a29_0x5f127c(0x195),'description':a29_0x5f127c(0x170)},{'name':a29_0x5f127c(0x18c),'type':a29_0x5f127c(0x195),'description':a29_0x5f127c(0x16b)},{'name':a29_0x5f127c(0x14a),'type':a29_0x5f127c(0x195),'description':a29_0x5f127c(0x147)},{'name':a29_0x5f127c(0x164),'type':a29_0x5f127c(0x195),'description':a29_0x5f127c(0x157),'enum':['before',a29_0x5f127c(0x191)]}],async 'validate'(_0x797973){const _0x467653=a29_0x5f127c,_0x3c55a7=_0x797973[_0x467653(0x17e)](_0x467653(0x15f));if(!isValidBffFunctionName(_0x3c55a7))throw CliErrors[_0x467653(0x169)](_0x467653(0x198)+_0x3c55a7+_0x467653(0x163));},async 'execute'(_0x1f4353){const _0x8da50d=a29_0x5f127c,_0x475256=loadBffProjectConfig(_0x1f4353[_0x8da50d(0x187)]),_0x7fd557=_0x1f4353[_0x8da50d(0x17e)](_0x8da50d(0x151)),_0x349041=_0x1f4353[_0x8da50d(0x17e)]('name'),_0x576bc1=_0x1f4353[_0x8da50d(0x17e)]('description')||undefined,_0x1d14b9=_0x7fd557==='HOOK'?await resolveHookOptions(_0x475256,_0x1f4353):undefined,_0x14595d=buildFilePath(_0x475256,_0x7fd557,_0x349041,_0x1d14b9);if(await fileExists(_0x14595d))throw CliErrors[_0x8da50d(0x169)]('File\x20already\x20exists:\x20'+_0x14595d);await mkdir(dirname(_0x14595d),{'recursive':!![]});const _0x105574=generateTemplate(_0x7fd557,_0x349041,_0x1f4353[_0x8da50d(0x187)],_0x576bc1,_0x1d14b9);await writeFile(_0x14595d,_0x105574,'utf8');const _0x3a9f5f={'type':_0x7fd557,'name':_0x349041,'path':_0x14595d};if(_0x576bc1)_0x3a9f5f[_0x8da50d(0x193)]=_0x576bc1;if(_0x1d14b9){if(_0x1d14b9[_0x8da50d(0x16d)])_0x3a9f5f[_0x8da50d(0x16d)]=_0x1d14b9[_0x8da50d(0x16d)];_0x3a9f5f[_0x8da50d(0x192)]=_0x1d14b9[_0x8da50d(0x192)],_0x3a9f5f[_0x8da50d(0x17b)]=_0x1d14b9[_0x8da50d(0x17b)],_0x3a9f5f[_0x8da50d(0x19e)]=_0x1d14b9['functionNode'];}return{'ok':!![],'data':_0x3a9f5f,'message':_0x8da50d(0x17a)+_0x7fd557+_0x8da50d(0x19c)+_0x349041};}};async function resolveHookOptions(_0x565f68,_0x23b0a0){const _0x2c1e5e=a29_0x5f127c,_0x1b69eb=loadAliasMap(_0x23b0a0[_0x2c1e5e(0x168)],undefined,resolveApiFilePath(_0x23b0a0[_0x2c1e5e(0x168)],_0x23b0a0[_0x2c1e5e(0x187)])),_0x51f7eb=_0x1b69eb[_0x2c1e5e(0x171)]>0x0;let _0x39f61e,_0x529619,_0x26fce2;const _0x5b3c96=_0x23b0a0[_0x2c1e5e(0x17e)](_0x2c1e5e(0x16d)),_0x3537fc=_0x23b0a0['str'](_0x2c1e5e(0x18c));if(_0x5b3c96){const _0x6144ec=resolveAlias(_0x23b0a0[_0x2c1e5e(0x168)],_0x5b3c96,undefined,resolveApiFilePath(_0x23b0a0[_0x2c1e5e(0x168)],_0x23b0a0[_0x2c1e5e(0x187)]));if(!_0x6144ec){const _0x562120=_0x51f7eb?_0x2c1e5e(0x175)+_0x1b69eb[_0x2c1e5e(0x196)](_0x4e62c7=>_0x4e62c7[_0x2c1e5e(0x16d)])['join'](',\x20'):_0x2c1e5e(0x146)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x16c)+_0x5b3c96+_0x2c1e5e(0x161)+_0x562120);}_0x39f61e=_0x5b3c96,_0x529619=_0x6144ec;}else{if(_0x3537fc){_0x529619=_0x3537fc;const _0x3d4d59=_0x1b69eb[_0x2c1e5e(0x174)](_0x590469=>_0x590469['datasetCode']===_0x3537fc);_0x39f61e=_0x3d4d59?.[_0x2c1e5e(0x16d)];}else{if(_0x23b0a0['nonInteractive'])throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x185));else{if(_0x51f7eb){const _0x42bcc3=_0x1b69eb['map'](_0x36b6cd=>_0x36b6cd[_0x2c1e5e(0x16d)]+'\x20('+_0x36b6cd[_0x2c1e5e(0x166)]+')'),_0x70c497=await promptSelect(_0x2c1e5e(0x18f),_0x42bcc3),_0x32689f=_0x1b69eb[_0x70c497];if(!_0x32689f)throw CliErrors[_0x2c1e5e(0x169)]('Invalid\x20dataset\x20selection.');_0x39f61e=_0x32689f[_0x2c1e5e(0x16d)],_0x529619=_0x32689f[_0x2c1e5e(0x192)];}else{const _0x229fa2=await listDatasets(_0x23b0a0[_0x2c1e5e(0x187)]);if(_0x229fa2[_0x2c1e5e(0x171)]===0x0)throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x144));const _0x37d760=_0x229fa2['map'](_0x4a036d=>_0x4a036d[_0x2c1e5e(0x15f)]+'\x20('+_0x4a036d[_0x2c1e5e(0x181)]+')'),_0x3e753e=await promptSelect('Select\x20dataset:',_0x37d760),_0x327b5c=_0x229fa2[_0x3e753e];if(!_0x327b5c)throw CliErrors[_0x2c1e5e(0x169)]('Invalid\x20dataset\x20selection.');_0x529619=_0x327b5c[_0x2c1e5e(0x181)],_0x39f61e=undefined;}}}}const _0x26676e=await listDatasets(_0x23b0a0[_0x2c1e5e(0x187)]),_0xa3d72b=_0x26676e[_0x2c1e5e(0x174)](_0x4d2827=>_0x4d2827['code']===_0x529619);if(!_0xa3d72b)throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x19d)+_0x529619+_0x2c1e5e(0x148)+(_0x39f61e?_0x2c1e5e(0x141)+CLI_BIN_NAME+_0x2c1e5e(0x184):''));_0x26fce2=_0xa3d72b['id'];const _0x17a119=_0x39f61e??_0x529619,_0xec09eb=await listBffDatasetOperations(_0x23b0a0[_0x2c1e5e(0x187)],_0x26fce2),_0x283277=_0xec09eb?Object[_0x2c1e5e(0x142)](_0xec09eb):[];if(_0x283277['length']===0x0)throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x190)+_0x17a119+'.');let _0x8a07c6;const _0x37893c=_0x23b0a0[_0x2c1e5e(0x17e)](_0x2c1e5e(0x14a));if(_0x37893c){if(!_0x283277[_0x2c1e5e(0x188)](_0x37893c))throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x160)+_0x37893c+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x17a119+'.\x20'+(_0x2c1e5e(0x186)+_0x283277[_0x2c1e5e(0x154)](',\x20')));_0x8a07c6=_0x37893c;}else{if(_0x23b0a0[_0x2c1e5e(0x162)])throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x18d));const _0x38b636=await promptSelect(_0x2c1e5e(0x17c),_0x283277);_0x8a07c6=_0x283277[_0x38b636]??_0x283277[0x0];}let _0x179eec=normalizeHookFunctionNode(_0x23b0a0[_0x2c1e5e(0x17e)](_0x2c1e5e(0x164)));if(!_0x179eec){if(_0x23b0a0[_0x2c1e5e(0x17e)](_0x2c1e5e(0x164)))throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x17d));if(_0x23b0a0[_0x2c1e5e(0x162)])throw CliErrors[_0x2c1e5e(0x169)](_0x2c1e5e(0x14f));const _0x488ae7=await promptSelect(_0x2c1e5e(0x18b),[_0x2c1e5e(0x179),_0x2c1e5e(0x191)]);_0x179eec=[_0x2c1e5e(0x179),'after'][_0x488ae7]??_0x2c1e5e(0x179);}return{'alias':_0x39f61e,'datasetCode':_0x529619,'datasetId':_0x26fce2,'operationType':_0x8a07c6,'functionNode':_0x179eec};}async function promptSelect(_0x1baac9,_0x15b02f){const _0x5bef2f=a29_0x5f127c;if(_0x15b02f['length']===0x1)return 0x0;for(const [_0x45baf0,_0x407dc5]of _0x15b02f[_0x5bef2f(0x158)]()){process[_0x5bef2f(0x150)][_0x5bef2f(0x16f)]('\x20\x20'+(_0x45baf0+0x1)+'.\x20'+_0x407dc5+'\x0a');}const _0x5f13d9=createInterface({'input':process[_0x5bef2f(0x149)],'output':process[_0x5bef2f(0x150)]});while(!![]){const _0x36e94d=await new Promise(_0x16f953=>{const _0x323224=_0x5bef2f;_0x5f13d9[_0x323224(0x194)](_0x1baac9+'\x20',_0x16f953);}),_0x4d43fb=Number[_0x5bef2f(0x19a)](_0x36e94d['trim'](),0xa);if(Number[_0x5bef2f(0x143)](_0x4d43fb)&&_0x4d43fb>=0x1&&_0x4d43fb<=_0x15b02f['length'])return _0x5f13d9['close'](),_0x4d43fb-0x1;process['stderr']['write'](_0x5bef2f(0x18e)+_0x15b02f[_0x5bef2f(0x171)]+'.\x0a');}}function buildFilePath(_0x4f09a0,_0x3ac343,_0x12dc61,_0x267f53){const _0x13b7f9=a29_0x5f127c;if(_0x3ac343===_0x13b7f9(0x152)){if(!_0x267f53)throw CliErrors['validation'](_0x13b7f9(0x15a));const _0x2fe242=_0x267f53['alias']??_0x267f53[_0x13b7f9(0x192)];return join(_0x4f09a0[_0x13b7f9(0x15c)],'HOOK',_0x2fe242,_0x267f53['operationType'],_0x267f53[_0x13b7f9(0x19e)],_0x12dc61+_0x13b7f9(0x14b));}return join(_0x4f09a0[_0x13b7f9(0x15c)],_0x3ac343,_0x12dc61+'.js');}export function generateTemplate(_0x21bac5,_0x4b46fe,_0x3ebd7b,_0x1dce93,_0x28c5eb){const _0x4d4b11=a29_0x5f127c,_0x2b80c3=_0x1dce93?.['trim']()||_0x4d4b11(0x182);if(_0x21bac5==='COMMON')return _0x4d4b11(0x178)+_0x2b80c3+_0x4d4b11(0x19b)+_0x4b46fe+'\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/'+_0x4b46fe+'.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'+_0x4b46fe+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x21bac5===_0x4d4b11(0x17f))return'/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x2b80c3+_0x4d4b11(0x14c)+_0x3ebd7b+_0x4d4b11(0x15d)+_0x4b46fe+_0x4d4b11(0x172)+_0x4b46fe+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x28c5eb)throw CliErrors[_0x4d4b11(0x169)](_0x4d4b11(0x159));return _0x4d4b11(0x18a)+_0x2b80c3+_0x4d4b11(0x14c)+_0x3ebd7b+'/'+_0x28c5eb[_0x4d4b11(0x192)]+'/'+_0x28c5eb[_0x4d4b11(0x17b)]+_0x4d4b11(0x165)+_0x28c5eb[_0x4d4b11(0x19e)]+_0x4d4b11(0x155)+_0x4b46fe+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
|
1
|
+
function a29_0x3501(_0x5bdba3,_0x36d238){_0x5bdba3=_0x5bdba3-0x72;const _0x869290=a29_0x8692();let _0x3501e5=_0x869290[_0x5bdba3];return _0x3501e5;}const a29_0x166eee=a29_0x3501;(function(_0x186b17,_0x36f113){const _0x3c0699=a29_0x3501,_0x271a45=_0x186b17();while(!![]){try{const _0xe3f100=-parseInt(_0x3c0699(0xb8))/0x1*(parseInt(_0x3c0699(0xbf))/0x2)+parseInt(_0x3c0699(0x84))/0x3*(parseInt(_0x3c0699(0x88))/0x4)+-parseInt(_0x3c0699(0xa5))/0x5+parseInt(_0x3c0699(0x98))/0x6+-parseInt(_0x3c0699(0x96))/0x7*(parseInt(_0x3c0699(0xb3))/0x8)+parseInt(_0x3c0699(0x99))/0x9*(parseInt(_0x3c0699(0xbc))/0xa)+parseInt(_0x3c0699(0xad))/0xb;if(_0xe3f100===_0x36f113)break;else _0x271a45['push'](_0x271a45['shift']());}catch(_0x2715f7){_0x271a45['push'](_0x271a45['shift']());}}}(a29_0x8692,0x57969));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a29_0x8692(){const _0x556b1f=['No\x20api.ts\x20found.\x20Run\x20`','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','trim','stderr','\x0a\x20*\x20[触发节点]\x20','54527YUQgXX','\x22.\x20','validation','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','alias','75536oPAEKO','scriptsRootDir','ENDPOINT','function-node','includes','141787aWSALw','\x20function:\x20','/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','nonInteractive','4710QHeLMk','HOOK','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','4hKhIaw','Script\x20type','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x0a\x20*\x20[脚本名称]\x20','description','datasetCode','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','code','appCode','No\x20datasets\x20found\x20for\x20this\x20app.','stdin','before','map','keys','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','length','Created\x20','Available\x20aliases:\x20','apiDir','string','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','name','join','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','Invalid\x20function\x20name\x20\x22','bff','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','/endpoint/','856230qBpPKP','question','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','4ARnlOR','File\x20already\x20exists:\x20','after','Function\x20name\x20(valid\x20JS\x20identifier)','\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','Invalid\x20dataset\x20selection.','Script\x20description','operation-type','\x22\x20not\x20found\x20for\x20dataset\x20','close','operationType','datasetcode','find','write','259NrojLE','Alias\x20\x22','3387978XmTyIh','2619GVSxEG','Operation\x20type\x20\x22','\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','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','type','tableName','Select\x20dataset:','.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','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','COMMON','functionNode','2010oXEbZx','str','new'];a29_0x8692=function(){return _0x556b1f;};return a29_0x8692();}import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.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':a29_0x166eee(0x81),'command':a29_0x166eee(0xa7),'description':a29_0x166eee(0xa9),'risk':a29_0x166eee(0x95),'flags':[{'name':a29_0x166eee(0x9d),'type':'string','required':!![],'enum':[a29_0x166eee(0xa3),a29_0x166eee(0xb5),a29_0x166eee(0xbd)],'description':a29_0x166eee(0xc0)},{'name':a29_0x166eee(0x7d),'type':a29_0x166eee(0x7b),'required':!![],'description':a29_0x166eee(0x8b)},{'name':a29_0x166eee(0xc3),'type':'string','description':a29_0x166eee(0x8e)},{'name':'alias','type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a29_0x166eee(0x93),'type':a29_0x166eee(0x7b),'description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a29_0x166eee(0x8f),'type':a29_0x166eee(0x7b),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a29_0x166eee(0xb6),'type':'string','description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a29_0x166eee(0x73),'after']}],async 'validate'(_0x1f6ab5){const _0x5dc447=a29_0x166eee,_0x4c0e39=_0x1f6ab5[_0x5dc447(0xa6)](_0x5dc447(0x7d));if(!isValidBffFunctionName(_0x4c0e39))throw CliErrors[_0x5dc447(0xaf)](_0x5dc447(0x80)+_0x4c0e39+_0x5dc447(0x7f));},async 'execute'(_0x579fd1){const _0x1310fe=a29_0x166eee,_0x5772be=loadBffProjectConfig(_0x579fd1[_0x1310fe(0xc7)]),_0x2b78ab=_0x579fd1[_0x1310fe(0xa6)](_0x1310fe(0x9d)),_0x2aee08=_0x579fd1['str'](_0x1310fe(0x7d)),_0x55e3cd=_0x579fd1[_0x1310fe(0xa6)](_0x1310fe(0xc3))||undefined,_0x30af0d=_0x2b78ab===_0x1310fe(0xbd)?await resolveHookOptions(_0x5772be,_0x579fd1):undefined,_0x156946=buildFilePath(_0x5772be,_0x2b78ab,_0x2aee08,_0x30af0d);if(await fileExists(_0x156946))throw CliErrors[_0x1310fe(0xaf)](_0x1310fe(0x89)+_0x156946);await mkdir(dirname(_0x156946),{'recursive':!![]});const _0x581b8c=generateTemplate(_0x2b78ab,_0x2aee08,_0x579fd1['appCode'],_0x55e3cd,_0x30af0d);await writeFile(_0x156946,_0x581b8c,'utf8');const _0x5b6131={'type':_0x2b78ab,'name':_0x2aee08,'path':_0x156946};if(_0x55e3cd)_0x5b6131[_0x1310fe(0xc3)]=_0x55e3cd;if(_0x30af0d){if(_0x30af0d['alias'])_0x5b6131[_0x1310fe(0xb2)]=_0x30af0d['alias'];_0x5b6131[_0x1310fe(0xc4)]=_0x30af0d[_0x1310fe(0xc4)],_0x5b6131['operationType']=_0x30af0d[_0x1310fe(0x92)],_0x5b6131[_0x1310fe(0xa4)]=_0x30af0d['functionNode'];}return{'ok':!![],'data':_0x5b6131,'message':_0x1310fe(0x78)+_0x2b78ab+_0x1310fe(0xb9)+_0x2aee08};}};async function resolveHookOptions(_0x54ecc1,_0x92cff8){const _0xe2717=a29_0x166eee,_0x573142=loadAliasMap(_0x92cff8['apiDir'],undefined,resolveApiFilePath(_0x92cff8[_0xe2717(0x7a)],_0x92cff8[_0xe2717(0xc7)])),_0x7e07f0=_0x573142[_0xe2717(0x77)]>0x0;let _0x5e81ed,_0x28ab6b,_0x9885fc;const _0x56b610=_0x92cff8[_0xe2717(0xa6)](_0xe2717(0xb2)),_0x33ad0f=_0x92cff8[_0xe2717(0xa6)]('datasetcode');if(_0x56b610){const _0x130575=resolveAlias(_0x92cff8[_0xe2717(0x7a)],_0x56b610,undefined,resolveApiFilePath(_0x92cff8[_0xe2717(0x7a)],_0x92cff8[_0xe2717(0xc7)]));if(!_0x130575){const _0x5f509e=_0x7e07f0?_0xe2717(0x79)+_0x573142[_0xe2717(0x74)](_0x30b7b6=>_0x30b7b6['alias'])[_0xe2717(0x7e)](',\x20'):_0xe2717(0xa8)+CLI_BIN_NAME+_0xe2717(0x9c);throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x97)+_0x56b610+'\x22\x20not\x20found.\x20'+_0x5f509e);}_0x5e81ed=_0x56b610,_0x28ab6b=_0x130575;}else{if(_0x33ad0f){_0x28ab6b=_0x33ad0f;const _0x2d64f2=_0x573142[_0xe2717(0x94)](_0x45c1ff=>_0x45c1ff['datasetCode']===_0x33ad0f);_0x5e81ed=_0x2d64f2?.['alias'];}else{if(_0x92cff8[_0xe2717(0xbb)])throw CliErrors[_0xe2717(0xaf)](_0xe2717(0xb1));else{if(_0x7e07f0){const _0x293070=_0x573142[_0xe2717(0x74)](_0x1045cd=>_0x1045cd[_0xe2717(0xb2)]+'\x20('+_0x1045cd[_0xe2717(0x9e)]+')'),_0x4541b4=await promptSelect(_0xe2717(0x9f),_0x293070),_0xa90fcd=_0x573142[_0x4541b4];if(!_0xa90fcd)throw CliErrors[_0xe2717(0xaf)]('Invalid\x20dataset\x20selection.');_0x5e81ed=_0xa90fcd['alias'],_0x28ab6b=_0xa90fcd[_0xe2717(0xc4)];}else{const _0x5aa09e=await listDatasets(_0x92cff8[_0xe2717(0xc7)]);if(_0x5aa09e[_0xe2717(0x77)]===0x0)throw CliErrors['validation'](_0xe2717(0xc8));const _0x16a82b=_0x5aa09e['map'](_0x201b3a=>_0x201b3a['name']+'\x20('+_0x201b3a[_0xe2717(0xc6)]+')'),_0x56767d=await promptSelect('Select\x20dataset:',_0x16a82b),_0x5c3ed2=_0x5aa09e[_0x56767d];if(!_0x5c3ed2)throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x8d));_0x28ab6b=_0x5c3ed2[_0xe2717(0xc6)],_0x5e81ed=undefined;}}}}const _0x468135=await listDatasets(_0x92cff8['appCode']),_0x421801=_0x468135[_0xe2717(0x94)](_0x19b58e=>_0x19b58e[_0xe2717(0xc6)]===_0x28ab6b);if(!_0x421801)throw CliErrors[_0xe2717(0xaf)](_0xe2717(0xc1)+_0x28ab6b+_0xe2717(0xae)+(_0x5e81ed?_0xe2717(0xb0)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x9885fc=_0x421801['id'];const _0x27b158=_0x5e81ed??_0x28ab6b,_0x217a55=await listBffDatasetOperations(_0x92cff8[_0xe2717(0xc7)],_0x9885fc),_0x134939=_0x217a55?Object[_0xe2717(0x75)](_0x217a55):[];if(_0x134939[_0xe2717(0x77)]===0x0)throw CliErrors['validation']('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x27b158+'.');let _0xeb6729;const _0x3fdc43=_0x92cff8[_0xe2717(0xa6)](_0xe2717(0x8f));if(_0x3fdc43){if(!_0x134939[_0xe2717(0xb7)](_0x3fdc43))throw CliErrors['validation'](_0xe2717(0x9a)+_0x3fdc43+_0xe2717(0x90)+_0x27b158+'.\x20'+('Available:\x20'+_0x134939[_0xe2717(0x7e)](',\x20')));_0xeb6729=_0x3fdc43;}else{if(_0x92cff8[_0xe2717(0xbb)])throw CliErrors['validation'](_0xe2717(0x7c));const _0x152806=await promptSelect('Select\x20operation\x20type:',_0x134939);_0xeb6729=_0x134939[_0x152806]??_0x134939[0x0];}let _0x46d930=normalizeHookFunctionNode(_0x92cff8[_0xe2717(0xa6)]('function-node'));if(!_0x46d930){if(_0x92cff8[_0xe2717(0xa6)](_0xe2717(0xb6)))throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x76));if(_0x92cff8[_0xe2717(0xbb)])throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x87));const _0x2d659c=await promptSelect('Select\x20trigger\x20node:',['before',_0xe2717(0x8a)]);_0x46d930=['before',_0xe2717(0x8a)][_0x2d659c]??_0xe2717(0x73);}return{'alias':_0x5e81ed,'datasetCode':_0x28ab6b,'datasetId':_0x9885fc,'operationType':_0xeb6729,'functionNode':_0x46d930};}async function promptSelect(_0x4d2bcd,_0x2d9fbb){const _0x10eafd=a29_0x166eee;if(_0x2d9fbb[_0x10eafd(0x77)]===0x1)return 0x0;for(const [_0x198216,_0x2c6ca3]of _0x2d9fbb['entries']()){process['stderr'][_0x10eafd(0x95)]('\x20\x20'+(_0x198216+0x1)+'.\x20'+_0x2c6ca3+'\x0a');}const _0x3f2008=createInterface({'input':process[_0x10eafd(0x72)],'output':process[_0x10eafd(0xab)]});while(!![]){const _0x21fbda=await new Promise(_0x54cd1e=>{const _0x455b67=_0x10eafd;_0x3f2008[_0x455b67(0x85)](_0x4d2bcd+'\x20',_0x54cd1e);}),_0x339b0c=Number['parseInt'](_0x21fbda['trim'](),0xa);if(Number['isInteger'](_0x339b0c)&&_0x339b0c>=0x1&&_0x339b0c<=_0x2d9fbb[_0x10eafd(0x77)])return _0x3f2008[_0x10eafd(0x91)](),_0x339b0c-0x1;process[_0x10eafd(0xab)]['write'](_0x10eafd(0x82)+_0x2d9fbb[_0x10eafd(0x77)]+'.\x0a');}}function buildFilePath(_0x1a7b34,_0x34768c,_0x5c52ca,_0x5940f5){const _0x132f0b=a29_0x166eee;if(_0x34768c==='HOOK'){if(!_0x5940f5)throw CliErrors['validation']('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x532e2c=_0x5940f5[_0x132f0b(0xb2)]??_0x5940f5[_0x132f0b(0xc4)];return join(_0x1a7b34['scriptsRootDir'],_0x132f0b(0xbd),_0x532e2c,_0x5940f5[_0x132f0b(0x92)],_0x5940f5['functionNode'],_0x5c52ca+'.js');}return join(_0x1a7b34[_0x132f0b(0xb4)],_0x34768c,_0x5c52ca+'.js');}export function generateTemplate(_0x1cf6d3,_0x40262a,_0x157c1b,_0x58bb5a,_0x360ce6){const _0x40645b=a29_0x166eee,_0x554e29=_0x58bb5a?.[_0x40645b(0xaa)]()||'TODO:\x20add\x20script\x20description';if(_0x1cf6d3===_0x40645b(0xa3))return _0x40645b(0xba)+_0x554e29+_0x40645b(0xc2)+_0x40262a+_0x40645b(0xa2)+_0x40262a+_0x40645b(0xa0)+_0x40262a+_0x40645b(0xbe);if(_0x1cf6d3===_0x40645b(0xb5))return _0x40645b(0xc5)+_0x554e29+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x157c1b+_0x40645b(0x83)+_0x40262a+_0x40645b(0x8c)+_0x40262a+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x360ce6)throw CliErrors[_0x40645b(0xaf)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');return _0x40645b(0x86)+_0x554e29+_0x40645b(0xa1)+_0x157c1b+'/'+_0x360ce6['datasetCode']+'/'+_0x360ce6[_0x40645b(0x92)]+_0x40645b(0xac)+_0x360ce6[_0x40645b(0xa4)]+_0x40645b(0x9b)+_0x40262a+_0x40645b(0xbe);}
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x5f3016=a30_0x2366;(function(_0x378cce,_0x4b4a6a){const _0x516336=a30_0x2366,_0x31a3b3=_0x378cce();while(!![]){try{const _0x1b326b=parseInt(_0x516336(0x1c8))/0x1+parseInt(_0x516336(0x1bd))/0x2*(parseInt(_0x516336(0x1d4))/0x3)+-parseInt(_0x516336(0x1cf))/0x4+-parseInt(_0x516336(0x1d2))/0x5+-parseInt(_0x516336(0x1bf))/0x6+parseInt(_0x516336(0x1d1))/0x7+parseInt(_0x516336(0x1d5))/0x8*(parseInt(_0x516336(0x1d3))/0x9);if(_0x1b326b===_0x4b4a6a)break;else _0x31a3b3['push'](_0x31a3b3['shift']());}catch(_0x4178f3){_0x31a3b3['push'](_0x31a3b3['shift']());}}}(a30_0x4142,0x232da));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';import{resolveApiFilePath}from'../../context.js';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';function a30_0x4142(){const _0x39764a=['scriptsRoot','lockFilePath','hookLocation','lastSync','COMMON','nonInteractive','300228pOFuXG','pull','390761OghSRF','871855kXyNGQ','2755179GqbKGH','93eEdEDr','8cqDkJN','GET','force','\x20remote\x20BFF\x20script(s)\x20for\x20pull','\x20skipped,\x20','scriptType','length','skipped','would_pull','stringify','functions','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Pull\x20complete:\x20','ENDPOINT','question','datasetCode','message','operationType','yes','HOOK','bool','filePath','&type=','/api/management/library/scripts/list?appCode=','apps','lockKey','apiDir','unresolvable\x20target\x20path','boolean','type','appCode','alias','functionName','all','bff','No\x20remote\x20BFF\x20scripts\x20found.','toISOString','stdin','Force\x20pull\x20cancelled.','\x22\x20not\x20found\x20after\x20ensureLockScope.','\x20failed','close','\x20pulled,\x20','string','write','5410xJjpur','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','1678620rcViFR','utf8','Force\x20overwrite\x20local\x20unsynced\x20changes','push','str','scriptContent','stderr','Pull\x20only\x20this\x20script\x20type','version','227479BaeSCW'];a30_0x4142=function(){return _0x39764a;};return a30_0x4142();}export const bffPull={'service':a30_0x5f3016(0x1f7),'command':a30_0x5f3016(0x1d0),'description':'Pull\x20remote\x20BFF\x20scripts\x20to\x20local','risk':a30_0x5f3016(0x1bc),'flags':[{'name':a30_0x5f3016(0x1f2),'type':a30_0x5f3016(0x1bb),'description':a30_0x5f3016(0x1c6),'enum':[a30_0x5f3016(0x1cd),a30_0x5f3016(0x1e2),a30_0x5f3016(0x1e8)]},{'name':a30_0x5f3016(0x1d7),'type':a30_0x5f3016(0x1f1),'description':a30_0x5f3016(0x1c1)}],async 'dryRun'(_0x57f370){const _0x33060b=a30_0x5f3016,_0xd16549=loadBffProjectConfig(_0x57f370[_0x33060b(0x1f3)]),_0x5cab49=await readBffLockFile(_0xd16549['lockFilePath']),{appLock:_0x58bde5}=ensureLockScope(_0x5cab49??createEmptyBffLock(),_0x57f370[_0x33060b(0x1f3)],_0xd16549['scriptsRoot'],_0x33060b(0x1d0)),_0x522240=normalizeBffType(_0x57f370[_0x33060b(0x1c3)]('type'))??undefined,_0x5a30e0=buildDatasetCodeToAliasMap(_0x57f370[_0x33060b(0x1ef)],_0x57f370['appCode']),[_0x3f7fb3,_0x48f684]=await Promise[_0x33060b(0x1f6)]([listBffScripts(_0x57f370[_0x33060b(0x1f3)],_0x522240),getBffScriptStatistics(_0x57f370[_0x33060b(0x1f3)])]),_0x60b60e=createHookLocationMap(_0x48f684),_0x4871e3=[];for(const _0x36a265 of _0x3f7fb3){const _0xb0af39=resolveRemoteScriptTarget(_0xd16549,_0x36a265,_0x60b60e,_0x58bde5['functions'],_0x5a30e0);if(!_0xb0af39){_0x4871e3[_0x33060b(0x1c2)]({'scriptType':_0x36a265[_0x33060b(0x1da)],'functionName':_0x36a265[_0x33060b(0x1f5)]??'','status':_0x33060b(0x1dc),'reason':_0x33060b(0x1f0)});continue;}const _0x53152d=_0x58bde5[_0x33060b(0x1df)][_0xb0af39[_0x33060b(0x1ee)]],_0x242f4f=_0x36a265[_0x33060b(0x1c4)]!=null?computeContentHash(_0x36a265[_0x33060b(0x1c4)]):undefined,_0x1e3f0d=await hasUnsyncedLocalChanges(_0xb0af39[_0x33060b(0x1ea)],_0x53152d,_0x242f4f);_0x4871e3[_0x33060b(0x1c2)]({'lockKey':_0xb0af39['lockKey'],'filePath':_0xb0af39['filePath'],'remoteId':_0x36a265['id']??null,'status':_0x1e3f0d?'conflict':_0x33060b(0x1dd)});}return{'method':_0x33060b(0x1d6),'url':_0x33060b(0x1ec)+_0x57f370[_0x33060b(0x1f3)]+(_0x522240?_0x33060b(0x1eb)+_0x522240:''),'body':{'appCode':_0x57f370['appCode'],'filterType':_0x522240??null,'files':_0x4871e3},'description':'Would\x20inspect\x20'+_0x4871e3[_0x33060b(0x1db)]+_0x33060b(0x1d8)};},async 'execute'(_0x51b52d){const _0x11e8ac=a30_0x5f3016,_0x2a1dfd=loadBffProjectConfig(_0x51b52d[_0x11e8ac(0x1f3)]),_0x12dc67=await readBffLockFile(_0x2a1dfd[_0x11e8ac(0x1ca)]),{lockData:_0x274d9b,appLock:_0x3f0af8}=ensureLockScope(_0x12dc67??createEmptyBffLock(),_0x51b52d[_0x11e8ac(0x1f3)],_0x2a1dfd[_0x11e8ac(0x1c9)],_0x11e8ac(0x1d0)),_0x262d98=normalizeBffType(_0x51b52d[_0x11e8ac(0x1c3)](_0x11e8ac(0x1f2)))??undefined;if(_0x51b52d['str'](_0x11e8ac(0x1f2))&&!_0x262d98)throw CliErrors['validation'](_0x11e8ac(0x1e0));const [_0x1613aa,_0x569d16]=await Promise[_0x11e8ac(0x1f6)]([listBffScripts(_0x51b52d[_0x11e8ac(0x1f3)],_0x262d98),getBffScriptStatistics(_0x51b52d[_0x11e8ac(0x1f3)])]);if(_0x1613aa[_0x11e8ac(0x1db)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x11e8ac(0x1f8)};const _0x10bd27=_0x51b52d[_0x11e8ac(0x1e9)](_0x11e8ac(0x1d7));if(_0x10bd27&&!_0x51b52d[_0x11e8ac(0x1ce)]){const _0x2ce1ca=await confirmForce();if(!_0x2ce1ca)throw CliErrors['cancelled'](_0x11e8ac(0x1fb));}if(_0x10bd27&&_0x51b52d[_0x11e8ac(0x1ce)]){}const _0x369df5=buildDatasetCodeToAliasMap(_0x51b52d['apiDir'],_0x51b52d['appCode']),_0xcd300c=createHookLocationMap(_0x569d16),_0x2163b3=JSON['parse'](JSON[_0x11e8ac(0x1de)](_0x274d9b)),_0x21cf28=_0x51b52d[_0x11e8ac(0x1f3)],_0x4e8fb6=_0x2163b3[_0x11e8ac(0x1ed)][_0x21cf28];if(!_0x4e8fb6)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x21cf28+_0x11e8ac(0x1b7));const _0x58612b=[],_0x7e8a7=[],_0x1eeda9=[];for(const _0x51b4f2 of _0x1613aa){const _0x3e8480=resolveRemoteScriptTarget(_0x2a1dfd,_0x51b4f2,_0xcd300c,_0x3f0af8[_0x11e8ac(0x1df)],_0x369df5);if(!_0x3e8480){_0x7e8a7['push']({'lockKey':_0x51b4f2[_0x11e8ac(0x1da)]+'/'+_0x51b4f2[_0x11e8ac(0x1f5)],'reason':'unresolvable\x20target\x20path'});continue;}const _0x446bee=_0x3f0af8['functions'][_0x3e8480[_0x11e8ac(0x1ee)]];try{if(!_0x51b4f2['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x51b4f2['scriptContent']==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x495c9f=_0x51b4f2[_0x11e8ac(0x1c4)],_0x5f1dd7=computeContentHash(_0x495c9f);if(!_0x10bd27){const _0x5d2722=await hasUnsyncedLocalChanges(_0x3e8480['filePath'],_0x446bee,_0x5f1dd7);if(_0x5d2722){_0x7e8a7[_0x11e8ac(0x1c2)]({'lockKey':_0x3e8480['lockKey'],'reason':'local\x20unsynced\x20changes'});continue;}}await ensureParentDirectory(_0x3e8480[_0x11e8ac(0x1ea)]),await writeFile(_0x3e8480[_0x11e8ac(0x1ea)],_0x495c9f,_0x11e8ac(0x1c0));const _0x19b119={'hash':_0x5f1dd7,'remoteId':_0x51b4f2['id'],'version':_0x51b4f2[_0x11e8ac(0x1c7)]};_0x3e8480['type']===_0x11e8ac(0x1e8)&&_0x3e8480['hookLocation']&&(_0x19b119[_0x11e8ac(0x1f4)]=_0x3e8480['hookLocation'][_0x11e8ac(0x1f4)],_0x19b119[_0x11e8ac(0x1e4)]=_0x3e8480[_0x11e8ac(0x1cb)][_0x11e8ac(0x1e4)],_0x19b119[_0x11e8ac(0x1e6)]=_0x3e8480[_0x11e8ac(0x1cb)][_0x11e8ac(0x1e6)],_0x19b119['functionNode']=_0x3e8480[_0x11e8ac(0x1cb)]['functionNode']),_0x4e8fb6[_0x11e8ac(0x1df)][_0x3e8480[_0x11e8ac(0x1ee)]]=_0x19b119,_0x58612b['push']({'lockKey':_0x3e8480[_0x11e8ac(0x1ee)],'remoteId':_0x51b4f2['id']});}catch(_0x5ca625){_0x1eeda9[_0x11e8ac(0x1c2)]({'lockKey':_0x3e8480[_0x11e8ac(0x1ee)],'error':_0x5ca625 instanceof Error?_0x5ca625[_0x11e8ac(0x1e5)]:String(_0x5ca625)});}}return _0x4e8fb6[_0x11e8ac(0x1cc)]=new Date()[_0x11e8ac(0x1f9)](),await writeBffLockFile(_0x2a1dfd[_0x11e8ac(0x1ca)],_0x2163b3),{'ok':_0x1eeda9[_0x11e8ac(0x1db)]===0x0,'data':{'pulled':_0x58612b,'skipped':_0x7e8a7,'failed':_0x1eeda9},'message':_0x11e8ac(0x1e1)+_0x58612b[_0x11e8ac(0x1db)]+_0x11e8ac(0x1ba)+_0x7e8a7[_0x11e8ac(0x1db)]+_0x11e8ac(0x1d9)+_0x1eeda9[_0x11e8ac(0x1db)]+_0x11e8ac(0x1b8)};}};async function hasUnsyncedLocalChanges(_0x2a25f7,_0xd6a33,_0x42ab2d){if(!await fileExists(_0x2a25f7))return![];const _0x2e64e4=await computeFileHash(_0x2a25f7);if(!_0xd6a33)return _0x42ab2d?_0x2e64e4!==_0x42ab2d:!![];return _0x2e64e4!==_0xd6a33['hash'];}function buildDatasetCodeToAliasMap(_0xb5cbe6,_0x34f37c){const _0xf211=a30_0x5f3016,_0x2c6dbb=loadAliasMap(_0xb5cbe6,undefined,resolveApiFilePath(_0xb5cbe6,_0x34f37c));return new Map(_0x2c6dbb['map'](_0x5402b0=>[_0x5402b0[_0xf211(0x1e4)],_0x5402b0[_0xf211(0x1f4)]]));}function a30_0x2366(_0x2aa91a,_0x4faa07){_0x2aa91a=_0x2aa91a-0x1b7;const _0x414237=a30_0x4142();let _0x236693=_0x414237[_0x2aa91a];return _0x236693;}async function confirmForce(){const _0xad9eb0=a30_0x5f3016,_0x48e30f=createInterface({'input':process[_0xad9eb0(0x1fa)],'output':process[_0xad9eb0(0x1c5)]}),_0x434680=await new Promise(_0x4b06b8=>{const _0x26b67f=_0xad9eb0;_0x48e30f[_0x26b67f(0x1e3)](_0x26b67f(0x1be),_0x4b06b8);});return _0x48e30f[_0xad9eb0(0x1b9)](),['y',_0xad9eb0(0x1e7)]['includes'](_0x434680['trim']()['toLowerCase']());}
|
package/lib/commands/bff/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x374596=a31_0x3745;(function(_0x5cf99a,_0x1205e5){const _0x5a05f7=a31_0x3745,_0x29cc31=_0x5cf99a();while(!![]){try{const _0xe8fbb3=parseInt(_0x5a05f7(0x101))/0x1*(parseInt(_0x5a05f7(0xe9))/0x2)+parseInt(_0x5a05f7(0x11a))/0x3*(-parseInt(_0x5a05f7(0x114))/0x4)+-parseInt(_0x5a05f7(0xeb))/0x5*(parseInt(_0x5a05f7(0xe6))/0x6)+-parseInt(_0x5a05f7(0x112))/0x7*(-parseInt(_0x5a05f7(0x10e))/0x8)+parseInt(_0x5a05f7(0x10f))/0x9*(parseInt(_0x5a05f7(0x107))/0xa)+parseInt(_0x5a05f7(0xfe))/0xb+parseInt(_0x5a05f7(0xfb))/0xc*(parseInt(_0x5a05f7(0xe8))/0xd);if(_0xe8fbb3===_0x1205e5)break;else _0x29cc31['push'](_0x29cc31['shift']());}catch(_0x27a772){_0x29cc31['push'](_0x29cc31['shift']());}}}(a31_0x1ece,0xba67a));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets}from'../../core/api-client.js';function a31_0x3745(_0x5b05cb,_0x3cea1a){_0x5b05cb=_0x5b05cb-0xdf;const _0x1ece55=a31_0x1ece();let _0x37454e=_0x1ece55[_0x5b05cb];return _0x37454e;}import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.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';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPush={'service':a31_0x374596(0x115),'command':a31_0x374596(0xff),'description':a31_0x374596(0x106),'risk':a31_0x374596(0x11f),'flags':[{'name':a31_0x374596(0x110),'type':a31_0x374596(0xe2),'description':'Push\x20only\x20this\x20script\x20type','enum':['COMMON',a31_0x374596(0x122),a31_0x374596(0x123)]},{'name':a31_0x374596(0x121),'type':a31_0x374596(0xe2),'description':'Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)'},{'name':'force','type':'boolean','description':a31_0x374596(0xee)}],async 'dryRun'(_0x580a05){const _0x4d0a40=a31_0x374596,_0x20a82d=loadBffProjectConfig(_0x580a05[_0x4d0a40(0x11b)]),_0x4a35aa=await readBffLockFile(_0x20a82d['lockFilePath']),{appLock:_0x3a60ca}=ensureLockScope(_0x4a35aa??createEmptyBffLock(),_0x580a05[_0x4d0a40(0x11b)],_0x20a82d[_0x4d0a40(0x11e)],'push'),_0x392526=await getTargetFunctions(_0x20a82d,_0x580a05),_0x131de7=_0x580a05['bool']('force'),_0x122298=[];for(const _0x1d8608 of _0x392526){const _0x4784fd=await computeFileHash(_0x1d8608[_0x4d0a40(0xf3)]),_0x3886e9=_0x3a60ca['functions'][_0x1d8608['lockKey']],_0x3d8cec=!!_0x3886e9&&_0x3886e9[_0x4d0a40(0xe0)]===_0x4784fd;_0x122298[_0x4d0a40(0xff)]({'lockKey':_0x1d8608[_0x4d0a40(0xe5)],'filePath':_0x1d8608['filePath'],'remoteId':_0x3886e9?.[_0x4d0a40(0x102)]??null,'mode':_0x3886e9?.[_0x4d0a40(0x102)]?'update':_0x4d0a40(0x105),'status':!_0x131de7&&_0x3d8cec?_0x4d0a40(0xec):_0x4d0a40(0x103)});}return{'method':'POST','url':_0x4d0a40(0xf0),'body':{'appCode':_0x580a05[_0x4d0a40(0x11b)],'force':_0x131de7,'files':_0x122298},'description':_0x4d0a40(0xe4)+_0x122298['length']+_0x4d0a40(0x10d)};},async 'execute'(_0x89dc61){const _0x5075a4=a31_0x374596,_0x26e517=loadBffProjectConfig(_0x89dc61[_0x5075a4(0x11b)]),_0x278c19=await readBffLockFile(_0x26e517[_0x5075a4(0xf9)]),{lockData:_0x4b26e9,appLock:_0x2e5fae}=ensureLockScope(_0x278c19??createEmptyBffLock(),_0x89dc61['appCode'],_0x26e517['scriptsRoot'],_0x5075a4(0xff)),_0x21d887=await getTargetFunctions(_0x26e517,_0x89dc61);if(_0x21d887[_0x5075a4(0xfa)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x5075a4(0x108)};const _0x3808b8=_0x89dc61[_0x5075a4(0xfc)](_0x5075a4(0xf6)),_0x51e8ca=await buildHookMaps(_0x89dc61[_0x5075a4(0x11b)],_0x89dc61[_0x5075a4(0x11c)],_0x21d887,_0x2e5fae),_0x470d1a=[],_0x26fdab=[],_0x36d2ca=[];for(const _0x4e17ca of _0x21d887){const _0x585a08=await computeFileHash(_0x4e17ca[_0x5075a4(0xf3)]),_0x1db17a=_0x2e5fae[_0x5075a4(0x109)][_0x4e17ca[_0x5075a4(0xe5)]];if(!_0x3808b8&&_0x1db17a&&_0x1db17a[_0x5075a4(0xe0)]===_0x585a08){_0x26fdab[_0x5075a4(0xff)]({'lockKey':_0x4e17ca[_0x5075a4(0xe5)],'reason':_0x5075a4(0xec)});continue;}try{await uploadSingleFunction(_0x89dc61[_0x5075a4(0x11b)],_0x4e17ca,_0x2e5fae,_0x51e8ca);const _0x255dc8=_0x2e5fae[_0x5075a4(0x109)][_0x4e17ca[_0x5075a4(0xe5)]];_0x470d1a[_0x5075a4(0xff)]({'lockKey':_0x4e17ca[_0x5075a4(0xe5)],'remoteId':_0x255dc8?.[_0x5075a4(0x102)]??0x0});}catch(_0x5ddc21){_0x36d2ca[_0x5075a4(0xff)]({'lockKey':_0x4e17ca[_0x5075a4(0xe5)],'error':_0x5ddc21 instanceof Error?_0x5ddc21[_0x5075a4(0xf8)]:String(_0x5ddc21)});}}return _0x2e5fae['lastSync']=new Date()['toISOString'](),await writeBffLockFile(_0x26e517[_0x5075a4(0xf9)],_0x4b26e9),{'ok':_0x36d2ca[_0x5075a4(0xfa)]===0x0,'data':{'uploaded':_0x470d1a,'skipped':_0x26fdab,'failed':_0x36d2ca},'message':'Push\x20complete:\x20'+_0x470d1a['length']+_0x5075a4(0x120)+_0x26fdab[_0x5075a4(0xfa)]+_0x5075a4(0xdf)+_0x36d2ca[_0x5075a4(0xfa)]+_0x5075a4(0xed)};}};async function getTargetFunctions(_0x35e9fa,_0x91e688){const _0x24f68b=a31_0x374596,_0x36fa2b=_0x91e688[_0x24f68b(0x111)](_0x24f68b(0x110)),_0x37cc3f=_0x91e688[_0x24f68b(0x111)](_0x24f68b(0x121)),_0x4875a7=normalizeBffType(_0x36fa2b)??undefined;if(_0x37cc3f&&!_0x4875a7)throw CliErrors[_0x24f68b(0xea)](_0x24f68b(0x117));const _0x2e748d=await scanLocalBffFunctions(_0x35e9fa,_0x4875a7);if(_0x37cc3f){const _0x47eaf4=_0x2e748d[_0x24f68b(0x10b)](_0x2b74a9=>_0x2b74a9['name']===_0x37cc3f);if(_0x47eaf4['length']===0x0)throw CliErrors[_0x24f68b(0xea)]('Local\x20function\x20not\x20found:\x20'+_0x4875a7+'/'+_0x37cc3f);return _0x47eaf4;}return _0x2e748d;}async function buildHookMaps(_0x27a40b,_0x3f3b29,_0x1ea50b,_0x52557e){const _0x1c6647=a31_0x374596,_0x3e592d=_0x1ea50b[_0x1c6647(0xf4)](_0x5101b3=>_0x5101b3[_0x1c6647(0x110)]===_0x1c6647(0x123));if(!_0x3e592d)return{'aliasToDatasetCode':new Map(),'datasetCodeToId':new Map()};const _0x3d2cfb=loadAliasMap(_0x3f3b29,undefined,resolveApiFilePath(_0x3f3b29,_0x27a40b)),_0x44133d=new Map(_0x3d2cfb[_0x1c6647(0xf1)](_0x5974bc=>[_0x5974bc[_0x1c6647(0x10c)],_0x5974bc['datasetCode']]));for(const _0x57a485 of Object['values'](_0x52557e['functions'])){_0x57a485[_0x1c6647(0x10c)]&&_0x57a485[_0x1c6647(0xf7)]&&!_0x44133d[_0x1c6647(0xef)](_0x57a485[_0x1c6647(0x10c)])&&_0x44133d[_0x1c6647(0x119)](_0x57a485[_0x1c6647(0x10c)],_0x57a485['datasetCode']);}const _0x58a5a2=await listDatasets(_0x27a40b),_0x574ef0=new Map(_0x58a5a2[_0x1c6647(0xf1)](_0x35c03e=>[_0x35c03e[_0x1c6647(0xe1)],_0x35c03e['id']]));return{'aliasToDatasetCode':_0x44133d,'datasetCodeToId':_0x574ef0};}async function uploadSingleFunction(_0x46b785,_0x51bdf7,_0x494170,_0x44ef81){const _0x4b4305=a31_0x374596,_0x312ad9=await readFile(_0x51bdf7['filePath'],_0x4b4305(0xfd)),_0x4bcd8c=await computeFileHash(_0x51bdf7[_0x4b4305(0xf3)]),_0x2da821=_0x494170[_0x4b4305(0x109)][_0x51bdf7[_0x4b4305(0xe5)]];if(_0x2da821?.[_0x4b4305(0x102)]&&_0x2da821['version']==null)throw CliErrors[_0x4b4305(0xea)](_0x51bdf7[_0x4b4305(0xe5)]+_0x4b4305(0x116));let _0x34d345=extractScriptDescription(_0x312ad9);if(!_0x34d345&&_0x2da821?.[_0x4b4305(0x102)]){const _0x1b4a9c=await getBffScriptInfo(_0x2da821[_0x4b4305(0x102)]);_0x34d345=_0x1b4a9c[_0x4b4305(0x10a)]||undefined;}const _0x2078c7={'appCode':_0x46b785,'functionName':_0x51bdf7[_0x4b4305(0x121)],'scriptType':_0x51bdf7['type'],'scriptContent':_0x312ad9};if(_0x2da821?.[_0x4b4305(0x102)])_0x2078c7['id']=_0x2da821['remoteId'];if(_0x2da821?.[_0x4b4305(0x118)]!=null)_0x2078c7['version']=_0x2da821[_0x4b4305(0x118)];if(_0x34d345)_0x2078c7[_0x4b4305(0x10a)]=_0x34d345;if(_0x51bdf7[_0x4b4305(0x110)]===_0x4b4305(0x123)){const _0x17ae63=_0x51bdf7[_0x4b4305(0x10c)];if(!_0x17ae63||!_0x51bdf7[_0x4b4305(0xe3)]||!_0x51bdf7[_0x4b4305(0xf5)])throw CliErrors[_0x4b4305(0xea)]('Incomplete\x20HOOK\x20path:\x20'+_0x51bdf7['lockKey']);const _0x3583b9=_0x44ef81[_0x4b4305(0x104)][_0x4b4305(0x113)](_0x17ae63)??_0x2da821?.[_0x4b4305(0xf7)]??_0x17ae63,_0x10ea0b=_0x44ef81[_0x4b4305(0x100)]['get'](_0x3583b9);if(!_0x10ea0b)throw CliErrors[_0x4b4305(0xea)](_0x4b4305(0xe7)+_0x17ae63+'\x22.\x20'+(_0x4b4305(0xf2)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.'));_0x2078c7[_0x4b4305(0x11d)]=_0x10ea0b,_0x2078c7[_0x4b4305(0xe3)]=_0x51bdf7[_0x4b4305(0xe3)],_0x2078c7['functionNode']=_0x51bdf7['functionNode'];}const _0x117e64=await saveBffScript(_0x2078c7),_0x702923=await getBffScriptInfo(_0x117e64),_0xa90afb={'hash':_0x4bcd8c,'remoteId':_0x117e64,'version':_0x702923[_0x4b4305(0x118)]};if(_0x51bdf7['type']===_0x4b4305(0x123)){const _0x47101c=_0x51bdf7[_0x4b4305(0x10c)],_0x8cc76a=_0x44ef81['aliasToDatasetCode'][_0x4b4305(0x113)](_0x47101c)??_0x2da821?.['datasetCode']??_0x47101c;_0x44ef81[_0x4b4305(0x104)][_0x4b4305(0xef)](_0x47101c)?_0xa90afb['alias']=_0x47101c:_0xa90afb[_0x4b4305(0x10c)]=_0x2da821?.[_0x4b4305(0x10c)],_0xa90afb[_0x4b4305(0xf7)]=_0x8cc76a,_0xa90afb[_0x4b4305(0xe3)]=_0x51bdf7[_0x4b4305(0xe3)],_0xa90afb[_0x4b4305(0xf5)]=_0x51bdf7['functionNode'];}_0x494170[_0x4b4305(0x109)][_0x51bdf7[_0x4b4305(0xe5)]]=_0xa90afb;}function a31_0x1ece(){const _0x3ee759=['497092RGhkwW','validation','395VdnDqU','unchanged','\x20failed','Force\x20push\x20ignoring\x20hash\x20protection','has','/api/management/library/scripts/save','map','Run\x20`','filePath','some','functionNode','force','datasetCode','message','lockFilePath','length','468nWRskn','bool','utf8','4815921IBqUbH','push','datasetCodeToId','1UqAOIY','remoteId','would_push','aliasToDatasetCode','create','Push\x20local\x20BFF\x20scripts\x20to\x20remote','5260xyuuZf','No\x20local\x20BFF\x20functions\x20found.','functions','description','filter','alias','\x20local\x20BFF\x20script(s)\x20for\x20push','36592EutENX','5634nZmuPi','type','str','1309AnALOJ','get','12hMgbrW','bff',':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.','version','set','1480881zxbuYD','appCode','apiDir','datasetId','scriptsRoot','high-risk-write','\x20uploaded,\x20','name','ENDPOINT','HOOK','\x20skipped,\x20','hash','code','string','operationType','Would\x20inspect\x20','lockKey','47742ZpPjcE','Cannot\x20resolve\x20dataset\x20for\x20\x22','334009iccmlr'];a31_0x1ece=function(){return _0x3ee759;};return a31_0x1ece();}
|
|
1
|
+
const a31_0x1e5aee=a31_0x1453;(function(_0x359e57,_0x1369fa){const _0x3c7204=a31_0x1453,_0x294598=_0x359e57();while(!![]){try{const _0xf81189=parseInt(_0x3c7204(0x173))/0x1+-parseInt(_0x3c7204(0x172))/0x2+parseInt(_0x3c7204(0x167))/0x3*(parseInt(_0x3c7204(0x183))/0x4)+-parseInt(_0x3c7204(0x16d))/0x5*(parseInt(_0x3c7204(0x15e))/0x6)+-parseInt(_0x3c7204(0x149))/0x7+parseInt(_0x3c7204(0x182))/0x8+parseInt(_0x3c7204(0x178))/0x9;if(_0xf81189===_0x1369fa)break;else _0x294598['push'](_0x294598['shift']());}catch(_0x47c48e){_0x294598['push'](_0x294598['shift']());}}}(a31_0x9fe3,0x48509));function a31_0x1453(_0x4091da,_0x40fb8a){_0x4091da=_0x4091da-0x147;const _0x9fe353=a31_0x9fe3();let _0x145316=_0x9fe353[_0x4091da];return _0x145316;}import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.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';import{CLI_BIN_NAME}from'../../constant/cli.js';function a31_0x9fe3(){const _0x314bbf=['apiDir','aliasToDatasetCode','remoteId','scriptsRoot','bool','159051TWQOws','unchanged','\x20failed','Local\x20function\x20not\x20found:\x20','ENDPOINT','force','558185UyYDQS','No\x20local\x20BFF\x20functions\x20found.','Push\x20local\x20BFF\x20scripts\x20to\x20remote','\x20local\x20BFF\x20script(s)\x20for\x20push','get','677150HUFMGg','77356tUFbXM','create','operationType','code','Would\x20inspect\x20','12116565HAQhUM','\x20uploaded,\x20','bff','type','\x20skipped,\x20','update','/api/management/library/scripts/save','validation','alias','length','584856RAobMk','4PxlrQi','lastSync','POST','Run\x20`','functionNode','name','push','Push\x20only\x20this\x20script\x20type','HOOK','version','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','2497628oPYfpt','Push\x20complete:\x20','description','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','values','has','filePath','lockFilePath','string','Cannot\x20resolve\x20dataset\x20for\x20\x22','utf8','some','datasetCodeToId','appCode','lockKey','high-risk-write','hash','message','set','str','datasetCode','30pasQny','filter','functions','map'];a31_0x9fe3=function(){return _0x314bbf;};return a31_0x9fe3();}export const bffPush={'service':a31_0x1e5aee(0x17a),'command':a31_0x1e5aee(0x189),'description':a31_0x1e5aee(0x16f),'risk':a31_0x1e5aee(0x158),'flags':[{'name':'type','type':'string','description':a31_0x1e5aee(0x18a),'enum':['COMMON',a31_0x1e5aee(0x16b),'HOOK']},{'name':a31_0x1e5aee(0x188),'type':a31_0x1e5aee(0x151),'description':a31_0x1e5aee(0x14c)},{'name':a31_0x1e5aee(0x16c),'type':'boolean','description':'Force\x20push\x20ignoring\x20hash\x20protection'}],async 'dryRun'(_0x33e869){const _0x4708b0=a31_0x1e5aee,_0x2c15d7=loadBffProjectConfig(_0x33e869[_0x4708b0(0x156)]),_0x3c20af=await readBffLockFile(_0x2c15d7[_0x4708b0(0x150)]),{appLock:_0x5bef30}=ensureLockScope(_0x3c20af??createEmptyBffLock(),_0x33e869[_0x4708b0(0x156)],_0x2c15d7[_0x4708b0(0x165)],_0x4708b0(0x189)),_0x7fcf08=await getTargetFunctions(_0x2c15d7,_0x33e869),_0x4a370b=_0x33e869['bool'](_0x4708b0(0x16c)),_0x8324b6=[];for(const _0x2d2522 of _0x7fcf08){const _0x569472=await computeFileHash(_0x2d2522[_0x4708b0(0x14f)]),_0x345f9f=_0x5bef30['functions'][_0x2d2522['lockKey']],_0x39a183=!!_0x345f9f&&_0x345f9f[_0x4708b0(0x159)]===_0x569472;_0x8324b6[_0x4708b0(0x189)]({'lockKey':_0x2d2522[_0x4708b0(0x157)],'filePath':_0x2d2522[_0x4708b0(0x14f)],'remoteId':_0x345f9f?.[_0x4708b0(0x164)]??null,'mode':_0x345f9f?.['remoteId']?_0x4708b0(0x17d):_0x4708b0(0x174),'status':!_0x4a370b&&_0x39a183?_0x4708b0(0x168):'would_push'});}return{'method':_0x4708b0(0x185),'url':_0x4708b0(0x17e),'body':{'appCode':_0x33e869['appCode'],'force':_0x4a370b,'files':_0x8324b6},'description':_0x4708b0(0x177)+_0x8324b6[_0x4708b0(0x181)]+_0x4708b0(0x170)};},async 'execute'(_0x10ad24){const _0x4c5240=a31_0x1e5aee,_0x3782e3=loadBffProjectConfig(_0x10ad24[_0x4c5240(0x156)]),_0x4efe49=await readBffLockFile(_0x3782e3[_0x4c5240(0x150)]),{lockData:_0x4304a4,appLock:_0x4e748a}=ensureLockScope(_0x4efe49??createEmptyBffLock(),_0x10ad24[_0x4c5240(0x156)],_0x3782e3[_0x4c5240(0x165)],_0x4c5240(0x189)),_0x3c271e=await getTargetFunctions(_0x3782e3,_0x10ad24);if(_0x3c271e[_0x4c5240(0x181)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x4c5240(0x16e)};const _0x40e229=_0x10ad24[_0x4c5240(0x166)](_0x4c5240(0x16c)),_0x8133ca=await buildHookMaps(_0x10ad24['appCode'],_0x10ad24[_0x4c5240(0x162)],_0x3c271e,_0x4e748a),_0x5ece4c=[],_0x5b0de4=[],_0x26e999=[];for(const _0x5aa655 of _0x3c271e){const _0xbd5c40=await computeFileHash(_0x5aa655[_0x4c5240(0x14f)]),_0x16c3af=_0x4e748a[_0x4c5240(0x160)][_0x5aa655[_0x4c5240(0x157)]];if(!_0x40e229&&_0x16c3af&&_0x16c3af[_0x4c5240(0x159)]===_0xbd5c40){_0x5b0de4[_0x4c5240(0x189)]({'lockKey':_0x5aa655[_0x4c5240(0x157)],'reason':_0x4c5240(0x168)});continue;}try{await uploadSingleFunction(_0x10ad24[_0x4c5240(0x156)],_0x5aa655,_0x4e748a,_0x8133ca);const _0xad56bb=_0x4e748a[_0x4c5240(0x160)][_0x5aa655[_0x4c5240(0x157)]];_0x5ece4c[_0x4c5240(0x189)]({'lockKey':_0x5aa655[_0x4c5240(0x157)],'remoteId':_0xad56bb?.[_0x4c5240(0x164)]??0x0});}catch(_0xa210ce){_0x26e999[_0x4c5240(0x189)]({'lockKey':_0x5aa655[_0x4c5240(0x157)],'error':_0xa210ce instanceof Error?_0xa210ce[_0x4c5240(0x15a)]:String(_0xa210ce)});}}return _0x4e748a[_0x4c5240(0x184)]=new Date()['toISOString'](),await writeBffLockFile(_0x3782e3[_0x4c5240(0x150)],_0x4304a4),{'ok':_0x26e999[_0x4c5240(0x181)]===0x0,'data':{'uploaded':_0x5ece4c,'skipped':_0x5b0de4,'failed':_0x26e999},'message':_0x4c5240(0x14a)+_0x5ece4c[_0x4c5240(0x181)]+_0x4c5240(0x179)+_0x5b0de4[_0x4c5240(0x181)]+_0x4c5240(0x17c)+_0x26e999[_0x4c5240(0x181)]+_0x4c5240(0x169)};}};async function getTargetFunctions(_0x283a5e,_0x265192){const _0x40db79=a31_0x1e5aee,_0x24a79a=_0x265192[_0x40db79(0x15c)]('type'),_0x2d8f57=_0x265192['str'](_0x40db79(0x188)),_0x448c3c=normalizeBffType(_0x24a79a)??undefined;if(_0x2d8f57&&!_0x448c3c)throw CliErrors[_0x40db79(0x17f)]('--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.');const _0x4cd7a0=await scanLocalBffFunctions(_0x283a5e,_0x448c3c);if(_0x2d8f57){const _0x505eaf=_0x4cd7a0[_0x40db79(0x15f)](_0x1afe82=>_0x1afe82[_0x40db79(0x188)]===_0x2d8f57);if(_0x505eaf[_0x40db79(0x181)]===0x0)throw CliErrors['validation'](_0x40db79(0x16a)+_0x448c3c+'/'+_0x2d8f57);return _0x505eaf;}return _0x4cd7a0;}async function buildHookMaps(_0x53722a,_0x4cddab,_0x3bbeb2,_0xf2f169){const _0x3d612f=a31_0x1e5aee,_0x126803=_0x3bbeb2[_0x3d612f(0x154)](_0x38e559=>_0x38e559[_0x3d612f(0x17b)]==='HOOK');if(!_0x126803)return{'aliasToDatasetCode':new Map(),'datasetCodeToId':new Map()};const _0x2121aa=loadAliasMap(_0x4cddab,undefined,resolveApiFilePath(_0x4cddab,_0x53722a)),_0x16eab3=new Map(_0x2121aa[_0x3d612f(0x161)](_0x4f7533=>[_0x4f7533[_0x3d612f(0x180)],_0x4f7533[_0x3d612f(0x15d)]]));for(const _0x114a4a of Object[_0x3d612f(0x14d)](_0xf2f169[_0x3d612f(0x160)])){_0x114a4a['alias']&&_0x114a4a[_0x3d612f(0x15d)]&&!_0x16eab3[_0x3d612f(0x14e)](_0x114a4a['alias'])&&_0x16eab3[_0x3d612f(0x15b)](_0x114a4a[_0x3d612f(0x180)],_0x114a4a[_0x3d612f(0x15d)]);}const _0x41b7e7=await listDatasets(_0x53722a),_0x33c661=new Map(_0x41b7e7[_0x3d612f(0x161)](_0x1c440b=>[_0x1c440b[_0x3d612f(0x176)],_0x1c440b['id']]));return{'aliasToDatasetCode':_0x16eab3,'datasetCodeToId':_0x33c661};}async function uploadSingleFunction(_0x53b66a,_0x2632c9,_0x5bc058,_0x367b6d){const _0x4a14e8=a31_0x1e5aee,_0x43df12=await readFile(_0x2632c9[_0x4a14e8(0x14f)],_0x4a14e8(0x153)),_0x51cae0=await computeFileHash(_0x2632c9[_0x4a14e8(0x14f)]),_0xe84e0b=_0x5bc058[_0x4a14e8(0x160)][_0x2632c9[_0x4a14e8(0x157)]];if(_0xe84e0b?.[_0x4a14e8(0x164)]&&_0xe84e0b[_0x4a14e8(0x147)]==null)throw CliErrors[_0x4a14e8(0x17f)](_0x2632c9[_0x4a14e8(0x157)]+':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.');let _0x2cb1d1=extractScriptDescription(_0x43df12);if(!_0x2cb1d1&&_0xe84e0b?.['remoteId']){const _0x1f0b57=await getBffScriptInfo(_0xe84e0b[_0x4a14e8(0x164)]);_0x2cb1d1=_0x1f0b57[_0x4a14e8(0x14b)]||undefined;}const _0x4aa874={'appCode':_0x53b66a,'functionName':_0x2632c9[_0x4a14e8(0x188)],'scriptType':_0x2632c9['type'],'scriptContent':_0x43df12};if(_0xe84e0b?.[_0x4a14e8(0x164)])_0x4aa874['id']=_0xe84e0b[_0x4a14e8(0x164)];if(_0xe84e0b?.[_0x4a14e8(0x147)]!=null)_0x4aa874['version']=_0xe84e0b[_0x4a14e8(0x147)];if(_0x2cb1d1)_0x4aa874[_0x4a14e8(0x14b)]=_0x2cb1d1;if(_0x2632c9[_0x4a14e8(0x17b)]===_0x4a14e8(0x18b)){const _0x146cf1=_0x2632c9[_0x4a14e8(0x180)];if(!_0x146cf1||!_0x2632c9[_0x4a14e8(0x175)]||!_0x2632c9[_0x4a14e8(0x187)])throw CliErrors[_0x4a14e8(0x17f)]('Incomplete\x20HOOK\x20path:\x20'+_0x2632c9['lockKey']);const _0x2b8e28=_0x367b6d[_0x4a14e8(0x163)]['get'](_0x146cf1)??_0xe84e0b?.[_0x4a14e8(0x15d)]??_0x146cf1,_0x5c7c6b=_0x367b6d[_0x4a14e8(0x155)]['get'](_0x2b8e28);if(!_0x5c7c6b)throw CliErrors['validation'](_0x4a14e8(0x152)+_0x146cf1+'\x22.\x20'+(_0x4a14e8(0x186)+CLI_BIN_NAME+_0x4a14e8(0x148)));_0x4aa874['datasetId']=_0x5c7c6b,_0x4aa874[_0x4a14e8(0x175)]=_0x2632c9['operationType'],_0x4aa874[_0x4a14e8(0x187)]=_0x2632c9[_0x4a14e8(0x187)];}const _0xcbafa3=await saveBffScript(_0x4aa874),_0x108651=await getBffScriptInfo(_0xcbafa3),_0x13d31b={'hash':_0x51cae0,'remoteId':_0xcbafa3,'version':_0x108651[_0x4a14e8(0x147)]};if(_0x2632c9[_0x4a14e8(0x17b)]===_0x4a14e8(0x18b)){const _0x3b1b9a=_0x2632c9[_0x4a14e8(0x180)],_0x16b879=_0x367b6d['aliasToDatasetCode'][_0x4a14e8(0x171)](_0x3b1b9a)??_0xe84e0b?.[_0x4a14e8(0x15d)]??_0x3b1b9a;_0x367b6d[_0x4a14e8(0x163)][_0x4a14e8(0x14e)](_0x3b1b9a)?_0x13d31b[_0x4a14e8(0x180)]=_0x3b1b9a:_0x13d31b[_0x4a14e8(0x180)]=_0xe84e0b?.['alias'],_0x13d31b['datasetCode']=_0x16b879,_0x13d31b['operationType']=_0x2632c9[_0x4a14e8(0x175)],_0x13d31b[_0x4a14e8(0x187)]=_0x2632c9['functionNode'];}_0x5bc058[_0x4a14e8(0x160)][_0x2632c9[_0x4a14e8(0x157)]]=_0x13d31b;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x2285cb=a32_0x32f6;(function(_0x4579b3,_0x44642d){const _0x58927b=a32_0x32f6,_0x5c20b0=_0x4579b3();while(!![]){try{const _0x128e46=-parseInt(_0x58927b(0xc0))/0x1*(-parseInt(_0x58927b(0xc8))/0x2)+-parseInt(_0x58927b(0xc1))/0x3*(-parseInt(_0x58927b(0xdb))/0x4)+-parseInt(_0x58927b(0xd5))/0x5+-parseInt(_0x58927b(0xc2))/0x6+-parseInt(_0x58927b(0xce))/0x7*(parseInt(_0x58927b(0xc3))/0x8)+-parseInt(_0x58927b(0xcf))/0x9*(-parseInt(_0x58927b(0xcc))/0xa)+parseInt(_0x58927b(0xd9))/0xb*(parseInt(_0x58927b(0xd7))/0xc);if(_0x128e46===_0x44642d)break;else _0x5c20b0['push'](_0x5c20b0['shift']());}catch(_0x7d267d){_0x5c20b0['push'](_0x5c20b0['shift']());}}}(a32_0x2964,0xcdaa7));import{listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';function a32_0x32f6(_0x5b96fb,_0x19cc0d){_0x5b96fb=_0x5b96fb-0xbf;const _0x2964e4=a32_0x2964();let _0x32f61c=_0x2964e4[_0x5b96fb];return _0x32f61c;}import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';function a32_0x2964(){const _0x316652=['datasetCode','\x20unchanged','\x20modified,\x20','push','Also\x20check\x20for\x20remote-only\x20scripts\x20not\x20present\x20locally','hash','lockKey','length','28918nLLszv','3yUgVBv','603390hJdcHt','8JNcbQz','status','bff','filePath','All\x20BFF\x20scripts\x20are\x20in\x20sync.','4QiYOCB','appCode','Check\x20local\x20BFF\x20sync\x20status\x20against\x20lock\x20file','lockFilePath','2745160xnfMRW','remote','3584434ZKRENL','18bwjOrR','has','all','bool','read','map','3347640UTOCBW','apiDir','12zrEScd','functions','3016937bNTqnk','boolean','4973708EizmCu'];a32_0x2964=function(){return _0x316652;};return a32_0x2964();}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':a32_0x2285cb(0xc5),'command':a32_0x2285cb(0xc4),'description':a32_0x2285cb(0xca),'risk':a32_0x2285cb(0xd3),'flags':[{'name':a32_0x2285cb(0xcd),'type':a32_0x2285cb(0xda),'description':a32_0x2285cb(0xe0)}],async 'execute'(_0x4cac63){const _0x5c514a=a32_0x2285cb,_0xe8af1c=loadBffProjectConfig(_0x4cac63[_0x5c514a(0xc9)]),_0x3ad593=await readBffLockFile(_0xe8af1c[_0x5c514a(0xcb)]),{appLock:_0x52698e}=ensureLockScope(_0x3ad593??createEmptyBffLock(),_0x4cac63[_0x5c514a(0xc9)],_0xe8af1c['scriptsRoot'],_0x5c514a(0xc4)),_0x356634=await scanLocalBffFunctions(_0xe8af1c),_0x288551=[],_0x157acc=[],_0x183e95=[];for(const _0x468b2f of _0x356634){const _0x435e65=await computeFileHash(_0x468b2f[_0x5c514a(0xc6)]),_0x3e34be=_0x52698e[_0x5c514a(0xd8)][_0x468b2f['lockKey']];if(!_0x3e34be)_0x288551[_0x5c514a(0xdf)](_0x468b2f[_0x5c514a(0xe2)]);else _0x3e34be[_0x5c514a(0xe1)]!==_0x435e65?_0x157acc[_0x5c514a(0xdf)](_0x468b2f[_0x5c514a(0xe2)]):_0x183e95[_0x5c514a(0xdf)](_0x468b2f[_0x5c514a(0xe2)]);}const _0x95f68=[];if(_0x4cac63[_0x5c514a(0xd2)](_0x5c514a(0xcd))){const _0x2f983c=loadAliasMap(_0x4cac63[_0x5c514a(0xd6)],undefined,resolveApiFilePath(_0x4cac63[_0x5c514a(0xd6)],_0x4cac63[_0x5c514a(0xc9)])),_0x4e7f50=new Map(_0x2f983c[_0x5c514a(0xd4)](_0x54f3ba=>[_0x54f3ba[_0x5c514a(0xdc)],_0x54f3ba['alias']])),[_0x21ddc2,_0x26481d]=await Promise[_0x5c514a(0xd1)]([listBffScripts(_0x4cac63[_0x5c514a(0xc9)]),getBffScriptStatistics(_0x4cac63['appCode'])]),_0x457fd4=createHookLocationMap(_0x26481d),_0x1d078b=new Set(_0x356634['map'](_0x1c2e74=>_0x1c2e74[_0x5c514a(0xe2)]));for(const _0x1ea74c of _0x21ddc2){const _0x3107e7=resolveRemoteScriptTarget(_0xe8af1c,_0x1ea74c,_0x457fd4,_0x52698e[_0x5c514a(0xd8)],_0x4e7f50);_0x3107e7&&!_0x1d078b[_0x5c514a(0xd0)](_0x3107e7[_0x5c514a(0xe2)])&&_0x95f68[_0x5c514a(0xdf)](_0x3107e7[_0x5c514a(0xe2)]);}}const _0x5c3724=_0x288551['length']===0x0&&_0x157acc[_0x5c514a(0xbf)]===0x0&&_0x95f68[_0x5c514a(0xbf)]===0x0;return{'ok':!![],'data':{'added':_0x288551,'modified':_0x157acc,'unchanged':_0x183e95,'remoteOnly':_0x95f68},'message':_0x5c3724?_0x5c514a(0xc7):_0x288551[_0x5c514a(0xbf)]+'\x20added,\x20'+_0x157acc[_0x5c514a(0xbf)]+_0x5c514a(0xde)+_0x183e95['length']+_0x5c514a(0xdd)+(_0x95f68['length']>0x0?',\x20'+_0x95f68[_0x5c514a(0xbf)]+'\x20remote-only':'')};}};
|
package/lib/commands/build.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a33_0x65ca(_0x257354,_0x4aaf62){_0x257354=_0x257354-0x1a8;const _0x21a07b=a33_0x21a0();let _0x65ca8a=_0x21a07b[_0x257354];return _0x65ca8a;}const a33_0x547156=a33_0x65ca;(function(_0x1e3c54,_0xbbf850){const _0xaa7b05=a33_0x65ca,_0xfc3871=_0x1e3c54();while(!![]){try{const _0x540680=-parseInt(_0xaa7b05(0x1af))/0x1*(parseInt(_0xaa7b05(0x1a8))/0x2)+parseInt(_0xaa7b05(0x1ac))/0x3*(parseInt(_0xaa7b05(0x1bf))/0x4)+-parseInt(_0xaa7b05(0x1bc))/0x5*(-parseInt(_0xaa7b05(0x1ab))/0x6)+-parseInt(_0xaa7b05(0x1ba))/0x7+parseInt(_0xaa7b05(0x1b8))/0x8*(parseInt(_0xaa7b05(0x1bb))/0x9)+parseInt(_0xaa7b05(0x1ae))/0xa+-parseInt(_0xaa7b05(0x1bd))/0xb;if(_0x540680===_0xbbf850)break;else _0xfc3871['push'](_0xfc3871['shift']());}catch(_0x4471b0){_0xfc3871['push'](_0xfc3871['shift']());}}}(a33_0x21a0,0xcadb1));function a33_0x21a0(){const _0x260ace=['84FcngPY','项目构建成功','8340300fgBOls','241UqBZFT','logger','cwd','stderr','node_modules','npm\x20run\x20build','error','now','info','504ylOAKd','.bin','4611908KllUCC','145188kfKcWu','630335VIPLue','10489017MNkSGp','开始构建项目','135588FyZgSw','toString','trim','Build\x20project','message','build','inherit','close','run','4002lrNhwY','npm','npm\x20run\x20build\x20exited\x20with\x20code\x20','6KeZlNX'];a33_0x21a0=function(){return _0x260ace;};return a33_0x21a0();}import{delimiter,join}from'node:path';import{spawn}from'node:child_process';function runBuild(_0x4dcaed){return new Promise((_0x5d2dd5,_0x4c04f4)=>{const _0xf9937e=a33_0x65ca,_0x424f19=Date[_0xf9937e(0x1b6)]();_0x4dcaed['logger'][_0xf9937e(0x1b7)](_0xf9937e(0x1c4),_0xf9937e(0x1be),{'command':_0xf9937e(0x1b4)});let _0x479507='';const _0x86a9c7=spawn(_0xf9937e(0x1a9),[_0xf9937e(0x1c7),_0xf9937e(0x1c4)],{'stdio':[_0xf9937e(0x1c5),_0xf9937e(0x1c5),'pipe'],'shell':!![],'env':{...process.env,'PATH':''+join(process[_0xf9937e(0x1b1)](),_0xf9937e(0x1b3),_0xf9937e(0x1b9))+delimiter+process.env.PATH}});_0x86a9c7[_0xf9937e(0x1b2)]?.['on']('data',_0x21a148=>{const _0x384983=_0xf9937e;_0x479507+=_0x21a148[_0x384983(0x1c0)]();}),_0x86a9c7['on'](_0xf9937e(0x1c6),_0x3ca3ea=>{const _0x4558f9=_0xf9937e,_0x484bb7=Date['now']()-_0x424f19;if(_0x3ca3ea===0x0||_0x3ca3ea===null)_0x4dcaed[_0x4558f9(0x1b0)]['success'](_0x4558f9(0x1c4),_0x4558f9(0x1ad),_0x484bb7),_0x5d2dd5();else{const _0x496629={'exitCode':_0x3ca3ea,'duration':_0x484bb7,'command':'npm\x20run\x20build','cwd':process[_0x4558f9(0x1b1)]()};_0x479507[_0x4558f9(0x1c1)]()&&(_0x496629[_0x4558f9(0x1b2)]=_0x479507[_0x4558f9(0x1c1)]()),_0x4dcaed[_0x4558f9(0x1b0)][_0x4558f9(0x1b5)]('build','项目构建失败',_0x496629),_0x4c04f4(new Error(_0x4558f9(0x1aa)+_0x3ca3ea));}}),_0x86a9c7['on'](_0xf9937e(0x1b5),_0x1aea3a=>{const _0x33127f=_0xf9937e,_0x3edd11=Date[_0x33127f(0x1b6)]()-_0x424f19;_0x4dcaed[_0x33127f(0x1b0)][_0x33127f(0x1b5)](_0x33127f(0x1c4),'项目构建出错',{'error':_0x1aea3a[_0x33127f(0x1c3)],'duration':_0x3edd11,'stderr':_0x479507[_0x33127f(0x1c1)]()||undefined}),_0x4c04f4(_0x1aea3a);});});}export const buildCommand={'name':a33_0x547156(0x1c4),'description':a33_0x547156(0x1c2),async 'run'(_0x1ddaa9,_0x58cfa5,_0xfda4eb){await runBuild(_0x1ddaa9);}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0xa9c1c7=a34_0x2d29;(function(_0x4b0297,_0x59d621){const _0x55930a=a34_0x2d29,_0x1ab0f5=_0x4b0297();while(!![]){try{const _0x2a04e2=-parseInt(_0x55930a(0x140))/0x1*(-parseInt(_0x55930a(0x124))/0x2)+parseInt(_0x55930a(0x12f))/0x3*(parseInt(_0x55930a(0x143))/0x4)+-parseInt(_0x55930a(0x145))/0x5*(-parseInt(_0x55930a(0x138))/0x6)+parseInt(_0x55930a(0x11e))/0x7*(parseInt(_0x55930a(0x12a))/0x8)+parseInt(_0x55930a(0x135))/0x9*(-parseInt(_0x55930a(0x11a))/0xa)+-parseInt(_0x55930a(0x118))/0xb+-parseInt(_0x55930a(0x13d))/0xc;if(_0x2a04e2===_0x59d621)break;else _0x1ab0f5['push'](_0x1ab0f5['shift']());}catch(_0x34b9b3){_0x1ab0f5['push'](_0x1ab0f5['shift']());}}}(a34_0xd118,0xcba61));import a34_0x41c5f6 from'chalk';import a34_0x553286 from'ora';import a34_0x34e004 from'semver';import{execa}from'execa';import{NPM_PACKAGE_NAME}from'../constant/cli.js';import{VERSION,GIT_COMMIT,BUILD_TIME}from'../generated/build-info.js';import{getCdnConfig}from'../utils/cdn-config.js';import{resolveNpmBin}from'../utils/platform.js';function getCurrentVersion(){const _0x2e11f0=a34_0x2d29;return GIT_COMMIT!==_0x2e11f0(0x13f)?VERSION+'\x20('+GIT_COMMIT+',\x20'+BUILD_TIME['slice'](0x0,0xa)+')':VERSION;}function detectPackageManager(){const _0x3432e6=a34_0x2d29,_0x3f21d1=process[_0x3432e6(0x120)][_0x3432e6(0x13c)]();if(_0x3f21d1[_0x3432e6(0x136)](_0x3432e6(0x129)))return _0x3432e6(0x129);return _0x3432e6(0x144);}function a34_0xd118(){const _0x1cc7c7=['toLowerCase','20354040UilsZW','gray','unknown','1MtGgnB','pipe','succeed','272IhPsGt','npm','155EjKyuC','/latest','Checking\x20for\x20updates...','info','Unable\x20to\x20check\x20for\x20updates','coerce','12869703uxaZtY','\x20install\x20-g\x20','171040OHxXga','version','run','fail','2078853XjQMAu','Updating\x20via\x20','execPath','update','json','\x20\x20Restart\x20your\x20terminal\x20to\x20use\x20the\x20new\x20version.','544916pSCIgb','\x20→\x20','Update\x20rabetbase\x20CLI\x20to\x20the\x20latest\x20version','red','https://registry.npmjs.org/','bun','40cOSgGq','Updated\x20to\x20v','log','message','start','37998uCZpWU','\x20\x20Run\x20manually:\x20npm\x20install\x20-g\x20','@latest','...','Unable\x20to\x20check\x20for\x20updates\x20(network\x20error)','error','99jhBAff','includes','green','245766txJeTt','Current\x20version:\x20','Version\x20comparison\x20failed','\x20\x20Try\x20manually:\x20'];a34_0xd118=function(){return _0x1cc7c7;};return a34_0xd118();}async function fetchLatestNpmVersion(){const _0x24ff3a=a34_0x2d29;try{const _0x456c92=await fetch(_0x24ff3a(0x128)+NPM_PACKAGE_NAME+_0x24ff3a(0x146),{'signal':AbortSignal['timeout'](0x2710)});if(!_0x456c92['ok'])return null;const _0xd53ece=await _0x456c92[_0x24ff3a(0x122)]();return _0xd53ece[_0x24ff3a(0x11b)]??null;}catch{return null;}}function a34_0x2d29(_0x257731,_0x1e792d){_0x257731=_0x257731-0x117;const _0xd118a8=a34_0xd118();let _0x2d2954=_0xd118a8[_0x257731];return _0x2d2954;}async function fetchLatestVersion(){const _0x5e6c1a=await fetchLatestNpmVersion();if(_0x5e6c1a)return _0x5e6c1a;const _0x4bbc85=await getCdnConfig();return _0x4bbc85?.['cli']?.['stableVersion']??null;}async function execute(_0x3c66c2){const _0xd57313=a34_0x2d29,_0x1faafe=getCurrentVersion();console[_0xd57313(0x12c)](_0xd57313(0x139)+_0x1faafe);const _0x571195=a34_0x553286(_0xd57313(0x147))[_0xd57313(0x12e)](),_0x5b9e73=await fetchLatestVersion();if(!_0x5b9e73)return _0x571195['fail'](_0xd57313(0x133)),console['log'](a34_0x41c5f6['gray'](_0xd57313(0x130)+NPM_PACKAGE_NAME+_0xd57313(0x131))),{'ok':![],'message':_0xd57313(0x149)};const _0x41ac7a=a34_0x34e004[_0xd57313(0x117)](_0x1faafe),_0x50b7fd=a34_0x34e004[_0xd57313(0x117)](_0x5b9e73);if(!_0x41ac7a||!_0x50b7fd)return _0x571195['fail'](_0xd57313(0x13a)),{'ok':![],'message':'Version\x20comparison\x20failed'};if(!a34_0x34e004['lt'](_0x41ac7a,_0x50b7fd))return _0x571195['succeed']('Already\x20up\x20to\x20date\x20(v'+_0x5b9e73+')'),{'ok':!![]};_0x571195[_0xd57313(0x148)]('Update\x20available:\x20'+a34_0x41c5f6['yellow'](_0x1faafe)+_0xd57313(0x125)+a34_0x41c5f6[_0xd57313(0x137)](_0x5b9e73));const _0x518850=detectPackageManager(),_0x31c1ba=_0x518850===_0xd57313(0x144)?resolveNpmBin(_0xd57313(0x144)):_0x518850,_0x52989e=a34_0x553286(_0xd57313(0x11f)+_0x518850+_0xd57313(0x132))[_0xd57313(0x12e)]();try{return await execa(_0x31c1ba,['install','-g',NPM_PACKAGE_NAME+'@latest'],{'stdio':_0xd57313(0x141)}),_0x52989e[_0xd57313(0x142)](_0xd57313(0x12b)+_0x5b9e73),console[_0xd57313(0x12c)](a34_0x41c5f6['gray'](_0xd57313(0x123))),{'ok':!![]};}catch(_0x46bba5){return _0x52989e[_0xd57313(0x11d)]('Update\x20failed'),console[_0xd57313(0x134)](a34_0x41c5f6[_0xd57313(0x127)]('\x20\x20'+_0x46bba5[_0xd57313(0x12d)])),console[_0xd57313(0x12c)](a34_0x41c5f6[_0xd57313(0x13e)](_0xd57313(0x13b)+_0x518850+_0xd57313(0x119)+NPM_PACKAGE_NAME+_0xd57313(0x131))),{'ok':![],'message':_0x46bba5[_0xd57313(0x12d)]};}}export const updateDefinition={'service':a34_0xa9c1c7(0x121),'command':a34_0xa9c1c7(0x11c),'description':a34_0xa9c1c7(0x126),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],'execute':execute};
|