@lovrabet/rabetbase-cli 2.0.7 → 2.0.8
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/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/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.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/schema.js +1 -0
- 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/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/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -0
- 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/schema-export.js +1 -0
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.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/apply-jq-filter.js +1 -0
- 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 +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a20_0x1d16(_0x11b483,_0x2e5cfd){_0x11b483=_0x11b483-0x88;const _0x7db397=a20_0x7db3();let _0x1d1682=_0x7db397[_0x11b483];return _0x1d1682;}const a20_0x2db5e1=a20_0x1d16;(function(_0xf24f21,_0x5e7129){const _0x30c11f=a20_0x1d16,_0x33d2b2=_0xf24f21();while(!![]){try{const _0x56b6f2=-parseInt(_0x30c11f(0x89))/0x1+-parseInt(_0x30c11f(0x93))/0x2+parseInt(_0x30c11f(0x90))/0x3+parseInt(_0x30c11f(0x8f))/0x4+parseInt(_0x30c11f(0x95))/0x5+-parseInt(_0x30c11f(0x88))/0x6*(parseInt(_0x30c11f(0x8d))/0x7)+parseInt(_0x30c11f(0x94))/0x8;if(_0x56b6f2===_0x5e7129)break;else _0x33d2b2['push'](_0x33d2b2['shift']());}catch(_0x41d56e){_0x33d2b2['push'](_0x33d2b2['shift']());}}}(a20_0x7db3,0x1dee3));import{listRemoteApps}from'../../core/api-client.js';async function execute(_0x562f14){const _0x3aa685=a20_0x1d16,{setActiveCookie:_0x2a2462}=await import('../../core/api-client.js');_0x2a2462(_0x562f14[_0x3aa685(0x8c)]);const _0x16acc9=await listRemoteApps(),_0x409005=_0x16acc9['map'](_0x50fa9a=>({..._0x50fa9a['id']!=null?{'id':_0x50fa9a['id']}:{},'appCode':_0x50fa9a['appCode'],'appName':_0x50fa9a[_0x3aa685(0x8b)],..._0x50fa9a['appDesc']!=null?{'appDesc':_0x50fa9a[_0x3aa685(0x91)]}:{}}));return{'ok':!![],'data':_0x409005};}function a20_0x7db3(){const _0x3c9ee2=['281376cPBrvm','381714ZBwlRC','appDesc','List\x20apps\x20available\x20on\x20the\x20platform','68936VFGuRv','1004888BUJYre','61415mCtzuQ','12042oMNyQl','148308APHxBT','read','appName','cookie','105pEYvFl','app'];a20_0x7db3=function(){return _0x3c9ee2;};return a20_0x7db3();}export const appRemoteDefinition={'service':a20_0x2db5e1(0x8e),'command':'remote','description':a20_0x2db5e1(0x92),'risk':a20_0x2db5e1(0x8a),'requiresAuth':!![],'requiresAppCode':![],'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a21_0x4d0689=a21_0x1633;(function(_0x3566e2,_0x4ad33a){const _0x25c8e3=a21_0x1633,_0x2b7bf4=_0x3566e2();while(!![]){try{const _0x4c2b5e=-parseInt(_0x25c8e3(0x135))/0x1+-parseInt(_0x25c8e3(0x130))/0x2*(parseInt(_0x25c8e3(0x14b))/0x3)+parseInt(_0x25c8e3(0x12e))/0x4+-parseInt(_0x25c8e3(0x129))/0x5+-parseInt(_0x25c8e3(0x143))/0x6*(-parseInt(_0x25c8e3(0x147))/0x7)+-parseInt(_0x25c8e3(0x13a))/0x8+-parseInt(_0x25c8e3(0x12d))/0x9*(-parseInt(_0x25c8e3(0x134))/0xa);if(_0x4c2b5e===_0x4ad33a)break;else _0x2b7bf4['push'](_0x2b7bf4['shift']());}catch(_0x5e991e){_0x2b7bf4['push'](_0x2b7bf4['shift']());}}}(a21_0x315d,0x85a23));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{readRawConfigWithLayers}from'../../context.js';function a21_0x315d(){const _0x4a6b4d=['projectConfig','\x20Default\x20app\x20changed\x20to\x20\x22','App\x20profile\x20name\x20to\x20remove','Usage:\x20','boolean','6oBedcZ','defaultApp','validation','name','103971rIVisS','\x20config.','keys','apps','3144rPmdQe','global','5061580pMIDxh','Remove\x20an\x20app\x20from\x20config','trim','app','21136806tNwQSH','2768712UIRPjP','args','1082eGSuvl','\x20app\x20remove\x20<name>\x20[--global]','length','object','10PYmvcb','733078SYnCLW','\x22\x20not\x20found.','Use\x20global\x20config\x20scope','Missing\x20app\x20name.','project','1566720gYMrKn','remove','Removed\x20app\x20\x22','\x20Note:\x20app\x20\x22'];a21_0x315d=function(){return _0x4a6b4d;};return a21_0x315d();}import{readConfig,writeConfig,scopeLabel,resolveAppScopeForWrite,appDefinedIn}from'./shared.js';async function validateArgs(_0x584409){const _0xa706aa=a21_0x1633,_0x5e365f=_0x584409[_0xa706aa(0x12f)][0x0]?.[_0xa706aa(0x12b)]();if(!_0x5e365f)throw CliErrors[_0xa706aa(0x145)](_0xa706aa(0x138),_0xa706aa(0x141)+CLI_BIN_NAME+_0xa706aa(0x131));}async function execute(_0x5bde00){const _0x2ea80d=a21_0x1633,_0x257840=_0x5bde00[_0x2ea80d(0x12f)][0x0]?.[_0x2ea80d(0x12b)]();if(!_0x257840)throw CliErrors[_0x2ea80d(0x145)](_0x2ea80d(0x138),'Usage:\x20'+CLI_BIN_NAME+_0x2ea80d(0x131));const _0x34895f=_0x5bde00['bool']('global'),{config:_0x59850d,layers:_0x3965af}=readRawConfigWithLayers(),_0x9da8fd=_0x59850d[_0x2ea80d(0x14a)]??{};if(!_0x9da8fd[_0x257840])throw CliErrors['validation']('App\x20\x22'+_0x257840+'\x22\x20not\x20found.');const _0x4654a4=_0x3965af['globalConfig'][_0x2ea80d(0x14a)]&&typeof _0x3965af['globalConfig'][_0x2ea80d(0x14a)]===_0x2ea80d(0x133)?_0x3965af['globalConfig'][_0x2ea80d(0x14a)]:{},_0x14dbb1=_0x3965af[_0x2ea80d(0x13e)][_0x2ea80d(0x14a)]&&typeof _0x3965af[_0x2ea80d(0x13e)][_0x2ea80d(0x14a)]==='object'?_0x3965af[_0x2ea80d(0x13e)][_0x2ea80d(0x14a)]:{},_0x1f3da8=appDefinedIn(_0x257840,_0x4654a4,_0x14dbb1),_0xd7b1f5=resolveAppScopeForWrite(_0x257840,_0x34895f,_0x3965af),_0x15701c={'global':_0xd7b1f5===_0x2ea80d(0x14c)},_0x3e175d=readConfig(_0x15701c),_0x230d1d=_0x3e175d[_0x2ea80d(0x14a)];if(!_0x230d1d||!_0x230d1d[_0x257840])throw CliErrors[_0x2ea80d(0x145)]('App\x20\x22'+_0x257840+_0x2ea80d(0x136));delete _0x230d1d[_0x257840];let _0x3b25b7='';if(_0x3e175d[_0x2ea80d(0x144)]===_0x257840){const _0x487a3e=Object['keys'](_0x230d1d);_0x3e175d['defaultApp']=_0x487a3e[_0x2ea80d(0x132)]>0x0?_0x487a3e[0x0]:undefined,_0x3e175d['defaultApp']?_0x3b25b7=_0x2ea80d(0x13f)+_0x3e175d[_0x2ea80d(0x144)]+'\x22.':delete _0x3e175d[_0x2ea80d(0x144)];}Object[_0x2ea80d(0x149)](_0x230d1d)['length']===0x0&&(delete _0x3e175d[_0x2ea80d(0x14a)],delete _0x3e175d[_0x2ea80d(0x144)]);writeConfig(_0x3e175d,_0x15701c);const _0x2c45fc=_0x1f3da8==='both'?_0x2ea80d(0x13d)+_0x257840+'\x22\x20still\x20defined\x20in\x20'+(_0xd7b1f5===_0x2ea80d(0x139)?'global':_0x2ea80d(0x139))+_0x2ea80d(0x148):'';return{'ok':!![],'message':_0x2ea80d(0x13c)+_0x257840+'\x22'+scopeLabel(_0x15701c)+'.'+_0x3b25b7+_0x2c45fc};}function a21_0x1633(_0x20b99c,_0x1abb6c){_0x20b99c=_0x20b99c-0x129;const _0x315d77=a21_0x315d();let _0x1633c1=_0x315d77[_0x20b99c];return _0x1633c1;}export const appRemoveDefinition={'service':a21_0x4d0689(0x12c),'command':a21_0x4d0689(0x13b),'description':a21_0x4d0689(0x12a),'risk':'high-risk-write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a21_0x4d0689(0x146),'description':a21_0x4d0689(0x140),'required':!![]}],'flags':[{'name':a21_0x4d0689(0x14c),'type':a21_0x4d0689(0x142),'description':a21_0x4d0689(0x137),'default':![]}],'validate':validateArgs,'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x568b68,_0x480820){const _0x1095e5=a22_0x2924,_0x46a89a=_0x568b68();while(!![]){try{const _0x1dcbe9=parseInt(_0x1095e5(0x1fd))/0x1*(-parseInt(_0x1095e5(0x1ef))/0x2)+parseInt(_0x1095e5(0x1f8))/0x3*(-parseInt(_0x1095e5(0x1f1))/0x4)+parseInt(_0x1095e5(0x1fb))/0x5+parseInt(_0x1095e5(0x205))/0x6*(parseInt(_0x1095e5(0x1ec))/0x7)+-parseInt(_0x1095e5(0x1ff))/0x8*(parseInt(_0x1095e5(0x1f5))/0x9)+parseInt(_0x1095e5(0x200))/0xa+parseInt(_0x1095e5(0x20d))/0xb*(parseInt(_0x1095e5(0x1f7))/0xc);if(_0x1dcbe9===_0x480820)break;else _0x46a89a['push'](_0x46a89a['shift']());}catch(_0x2282c2){_0x46a89a['push'](_0x46a89a['shift']());}}}(a22_0x3d44,0x6fa02));import{resolveWriteConfigPath,readConfigFile,writeConfigFile}from'../../context.js';function a22_0x2924(_0x213be9,_0x16730e){_0x213be9=_0x213be9-0x1ea;const _0x3d4442=a22_0x3d44();let _0x292467=_0x3d4442[_0x213be9];return _0x292467;}export function resolveAppScopeForWrite(_0x179b70,_0x3cfd06,_0x4f0999){const _0x2c31ce=a22_0x2924;if(_0x3cfd06)return _0x2c31ce(0x1f3);const _0x7c0b4e=_0x4f0999[_0x2c31ce(0x1fc)][_0x2c31ce(0x1ed)]&&typeof _0x4f0999[_0x2c31ce(0x1fc)][_0x2c31ce(0x1ed)]===_0x2c31ce(0x1ea)?_0x4f0999[_0x2c31ce(0x1fc)][_0x2c31ce(0x1ed)]:{},_0x4f6827=_0x4f0999[_0x2c31ce(0x20b)][_0x2c31ce(0x1ed)]&&typeof _0x4f0999[_0x2c31ce(0x20b)][_0x2c31ce(0x1ed)]===_0x2c31ce(0x1ea)?_0x4f0999[_0x2c31ce(0x20b)][_0x2c31ce(0x1ed)]:{};if(Object['prototype'][_0x2c31ce(0x203)]['call'](_0x7c0b4e,_0x179b70))return _0x2c31ce(0x204);if(Object[_0x2c31ce(0x201)][_0x2c31ce(0x203)][_0x2c31ce(0x202)](_0x4f6827,_0x179b70))return'global';return _0x2c31ce(0x204);}export function appDefinedIn(_0x2c107b,_0xe420e3,_0x352f41){const _0x1389ac=a22_0x2924,_0x2ff079=Object['prototype']['hasOwnProperty'][_0x1389ac(0x202)](_0xe420e3,_0x2c107b),_0x5c208a=Object['prototype'][_0x1389ac(0x203)]['call'](_0x352f41,_0x2c107b);if(_0x2ff079&&_0x5c208a)return _0x1389ac(0x20a);if(_0x5c208a)return'project';return _0x1389ac(0x1f3);}export function resolveDefaultAppSource(_0x1df96e){const _0x48e512=a22_0x2924,_0x56ead0=_0x1df96e[_0x48e512(0x1fc)][_0x48e512(0x1ed)]&&typeof _0x1df96e[_0x48e512(0x1fc)][_0x48e512(0x1ed)]===_0x48e512(0x1ea)?_0x1df96e[_0x48e512(0x1fc)]['apps']:{};if(_0x48e512(0x1ee)in _0x1df96e[_0x48e512(0x1fc)])return _0x48e512(0x204);if(Object[_0x48e512(0x20c)](_0x56ead0)[_0x48e512(0x1eb)]>0x0)return _0x48e512(0x204);if(_0x1df96e[_0x48e512(0x20b)]['defaultApp'])return _0x48e512(0x1f3);return null;}export function getConfigPath(_0x4490e7={}){const _0x425ae7=a22_0x2924,_0x2a411b=_0x4490e7[_0x425ae7(0x1f3)]?_0x425ae7(0x1f3):'project';return resolveWriteConfigPath(_0x2a411b);}function a22_0x3d44(){const _0x1b8c82=['hasOwnProperty','project','174FhoXfS','apiDir','riskLevel','env','appcode','both','globalConfig','keys','55bwKCpa','object','length','126147pDdouA','apps','defaultApp','806248ivGTZy','locale','976092FXlhPF','accessKey','global','format','103311JHXgkr','cookie','3341688UAfXtO','3eoZGIB','\x22\x20to\x20multi-app\x20config\x20(set\x20as\x20default).','\x20(global)','1486310wrUJfx','projectConfig','2UnZRLa','app','584YPbLLD','1332150eBpxMY','prototype','call'];a22_0x3d44=function(){return _0x1b8c82;};return a22_0x3d44();}export function readConfig(_0x51c5a5={}){return readConfigFile(getConfigPath(_0x51c5a5));}export function writeConfig(_0x2386c1,_0x4a124d={}){writeConfigFile(getConfigPath(_0x4a124d),_0x2386c1);}export function scopeLabel(_0x158300){const _0x2887cf=a22_0x2924;return _0x158300['global']?_0x2887cf(0x1fa):'';}export function migrateLegacySingleApp(_0x511750,_0x17ccde){const _0x4de2bf=a22_0x2924,_0x54a1f1=_0x511750[_0x4de2bf(0x209)]||_0x511750[_0x4de2bf(0x1fe)];if(!_0x54a1f1)return;const _0x2b4366=String(_0x54a1f1);if(_0x2b4366===_0x17ccde)return;const _0x443046=[_0x4de2bf(0x208),_0x4de2bf(0x206),_0x4de2bf(0x1f6),_0x4de2bf(0x1f2),_0x4de2bf(0x1f4),'pageSize',_0x4de2bf(0x207),_0x4de2bf(0x1f0)],_0x5969e4={'appcode':_0x54a1f1};for(const _0x2fd863 of _0x443046){if(_0x511750[_0x2fd863]!=null)_0x5969e4[_0x2fd863]=_0x511750[_0x2fd863];}_0x511750[_0x4de2bf(0x1ed)][_0x2b4366]=_0x5969e4,_0x511750[_0x4de2bf(0x1ee)]=_0x2b4366,delete _0x511750[_0x4de2bf(0x209)],delete _0x511750[_0x4de2bf(0x1fe)],console['log']('Migrated\x20existing\x20app\x20\x22'+_0x2b4366+_0x4de2bf(0x1f9));}
|
package/lib/commands/app/use.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a23_0x239e64=a23_0x53b2;(function(_0x45f31f,_0x1a9c00){const _0x30df98=a23_0x53b2,_0x137aa1=_0x45f31f();while(!![]){try{const _0x15fe44=-parseInt(_0x30df98(0x1e8))/0x1+parseInt(_0x30df98(0x1e3))/0x2*(parseInt(_0x30df98(0x1f4))/0x3)+-parseInt(_0x30df98(0x1fa))/0x4*(-parseInt(_0x30df98(0x1de))/0x5)+parseInt(_0x30df98(0x1ee))/0x6+parseInt(_0x30df98(0x1ef))/0x7*(parseInt(_0x30df98(0x1e2))/0x8)+parseInt(_0x30df98(0x1e7))/0x9*(parseInt(_0x30df98(0x1ea))/0xa)+parseInt(_0x30df98(0x1f6))/0xb*(-parseInt(_0x30df98(0x1e9))/0xc);if(_0x15fe44===_0x1a9c00)break;else _0x137aa1['push'](_0x137aa1['shift']());}catch(_0x1397c7){_0x137aa1['push'](_0x137aa1['shift']());}}}(a23_0x5a4a,0x621a8));import{CliErrors}from'../../errors.js';function a23_0x5a4a(){const _0xa5cad6=['Usage:\x20','91398FFJXfV','global','642455SWeoaY','length','\x20app\x20use\x20<name>\x20[--global]','Missing\x20app\x20name.','772xutbYJ','join','Use\x20`','bool','Switch\x20the\x20default\x20app','App\x20\x22','name','apps','9185leeNPF','\x22\x20not\x20found.','appcode','Use\x20global\x20config\x20scope','967912QXZCRo','42ylvDQt','defaultApp','validation','app','171pusgBV','651393gTapAT','132RztQLB','21130fhDxHt','args','boolean','\x20--appcode\x20<code>`\x20first.','1789434ArWuaL','21AuBCeL','\x22\x20(appcode:\x20','Default\x20app\x20set\x20to\x20\x22','trim'];a23_0x5a4a=function(){return _0xa5cad6;};return a23_0x5a4a();}import{CLI_BIN_NAME}from'../../constant/cli.js';import{readRawConfigWithLayers}from'../../context.js';import{readConfig,writeConfig,scopeLabel,resolveAppScopeForWrite}from'./shared.js';async function validateArgs(_0x224c74){const _0x2e6425=a23_0x53b2,_0x5c053f=_0x224c74[_0x2e6425(0x1eb)][0x0]?.[_0x2e6425(0x1f2)]();if(!_0x5c053f)throw CliErrors['validation'](_0x2e6425(0x1f9),_0x2e6425(0x1f3)+CLI_BIN_NAME+_0x2e6425(0x1f8));}async function execute(_0x3de035){const _0x3f3ffa=a23_0x53b2,_0x494701=_0x3de035[_0x3f3ffa(0x1eb)][0x0]?.[_0x3f3ffa(0x1f2)]();if(!_0x494701)throw CliErrors[_0x3f3ffa(0x1e5)](_0x3f3ffa(0x1f9),_0x3f3ffa(0x1f3)+CLI_BIN_NAME+_0x3f3ffa(0x1f8));const _0x41dd81=_0x3de035[_0x3f3ffa(0x1fd)](_0x3f3ffa(0x1f5)),{config:_0x1b0a21,layers:_0x5f13ba}=readRawConfigWithLayers(),_0x2a7e1e=_0x1b0a21[_0x3f3ffa(0x201)]??{};if(!_0x2a7e1e[_0x494701]){const _0x15e1da=Object['keys'](_0x2a7e1e),_0x31d3e4=_0x15e1da[_0x3f3ffa(0x1f7)]===0x0?_0x3f3ffa(0x1fc)+CLI_BIN_NAME+'\x20app\x20add\x20'+_0x494701+_0x3f3ffa(0x1ed):'Available:\x20'+_0x15e1da[_0x3f3ffa(0x1fb)](',\x20');throw CliErrors[_0x3f3ffa(0x1e5)](_0x3f3ffa(0x1ff)+_0x494701+_0x3f3ffa(0x1df),_0x31d3e4);}const _0x23ce62=resolveAppScopeForWrite(_0x494701,_0x41dd81,_0x5f13ba),_0x185d1c={'global':_0x23ce62===_0x3f3ffa(0x1f5)},_0x5da4b4=readConfig(_0x185d1c);return _0x5da4b4[_0x3f3ffa(0x1e4)]=_0x494701,writeConfig(_0x5da4b4,_0x185d1c),{'ok':!![],'message':_0x3f3ffa(0x1f1)+_0x494701+_0x3f3ffa(0x1f0)+_0x2a7e1e[_0x494701][_0x3f3ffa(0x1e0)]+')'+scopeLabel(_0x185d1c)};}function a23_0x53b2(_0x21ec34,_0x2c6638){_0x21ec34=_0x21ec34-0x1de;const _0x5a4a1b=a23_0x5a4a();let _0x53b231=_0x5a4a1b[_0x21ec34];return _0x53b231;}export const appUseDefinition={'service':a23_0x239e64(0x1e6),'command':'use','description':a23_0x239e64(0x1fe),'risk':'write','requiresAuth':![],'requiresAppCode':![],'args':[{'name':a23_0x239e64(0x200),'description':'App\x20profile\x20name\x20to\x20activate','required':!![]}],'flags':[{'name':a23_0x239e64(0x1f5),'type':a23_0x239e64(0x1ec),'description':a23_0x239e64(0x1e1),'default':![]}],'validate':validateArgs,'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a24_0xce23(){const _0x1d8823=['✓\x20Logged\x20out','log','30540HtGLAm','5584072LSIBhU','../../auth/auth-server-ui.js','3076632ZvEQAW','9713403fUvMqX','1553zUtWyb','252190qHLWme','583rTNStR','1218kzGRng','5rpXyex','login','write','!\x20Not\x20logged\x20in','32067zgjWUw','1906gtRIoY'];a24_0xce23=function(){return _0x1d8823;};return a24_0xce23();}const a24_0x592572=a24_0x2eb9;function a24_0x2eb9(_0x179f84,_0x2106b8){_0x179f84=_0x179f84-0x1ee;const _0xce23df=a24_0xce23();let _0x2eb9f3=_0xce23df[_0x179f84];return _0x2eb9f3;}(function(_0x12c303,_0x116e02){const _0x442eaf=a24_0x2eb9,_0x3d65a7=_0x12c303();while(!![]){try{const _0x4c7c50=parseInt(_0x442eaf(0x1fa))/0x1*(parseInt(_0x442eaf(0x1f2))/0x2)+parseInt(_0x442eaf(0x1f5))/0x3+parseInt(_0x442eaf(0x1f8))/0x4*(parseInt(_0x442eaf(0x1fe))/0x5)+-parseInt(_0x442eaf(0x1fd))/0x6*(parseInt(_0x442eaf(0x1f1))/0x7)+-parseInt(_0x442eaf(0x1f6))/0x8+-parseInt(_0x442eaf(0x1f9))/0x9+-parseInt(_0x442eaf(0x1fb))/0xa*(-parseInt(_0x442eaf(0x1fc))/0xb);if(_0x4c7c50===_0x116e02)break;else _0x3d65a7['push'](_0x3d65a7['shift']());}catch(_0x46e650){_0x3d65a7['push'](_0x3d65a7['shift']());}}}(a24_0xce23,0xd8f9f));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':a24_0x592572(0x1ee),'description':'Login\x20via\x20browser','risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x61be92){const _0x29881e=a24_0x592572,{runAuthServer:_0x2adf66}=await import(_0x29881e(0x1f7));return await _0x2adf66(),{'ok':!![]};}},{'service':'auth','command':'logout','description':'Clear\x20login\x20session','risk':a24_0x592572(0x1ef),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x28f5eb){const _0x5eea47=a24_0x592572;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x5eea47(0x1f4)](_0x5eea47(0x1f3))):console['log'](_0x5eea47(0x1f0)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0xdd4b87=a25_0x4e0f;(function(_0x11fff9,_0x5eee7b){const _0x461b89=a25_0x4e0f,_0x44be59=_0x11fff9();while(!![]){try{const _0x1c2199=-parseInt(_0x461b89(0xca))/0x1*(parseInt(_0x461b89(0xb8))/0x2)+-parseInt(_0x461b89(0xa8))/0x3*(-parseInt(_0x461b89(0xc9))/0x4)+-parseInt(_0x461b89(0xad))/0x5*(parseInt(_0x461b89(0xb1))/0x6)+parseInt(_0x461b89(0xbf))/0x7*(-parseInt(_0x461b89(0xa9))/0x8)+parseInt(_0x461b89(0x9c))/0x9+-parseInt(_0x461b89(0x9b))/0xa*(-parseInt(_0x461b89(0xb6))/0xb)+parseInt(_0x461b89(0xaf))/0xc;if(_0x1c2199===_0x5eee7b)break;else _0x44be59['push'](_0x44be59['shift']());}catch(_0x2eb8b4){_0x44be59['push'](_0x44be59['shift']());}}}(a25_0x4823,0xb7d62));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a25_0x4e0f(_0x586679,_0x2613b7){_0x586679=_0x586679-0x9b;const _0x482320=a25_0x4823();let _0x4e0f86=_0x482320[_0x586679];return _0x4e0f86;}import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';function a25_0x4823(){const _0x5879b9=['lockFilePath','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','42581fUKJEq','lastSync','trashedTo','Function\x20not\x20found:\x20','Delete\x20a\x20BFF\x20script\x20from\x20remote\x20and\x20local','scriptsRoot','POST','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','BFF\x20lock\x20file\x20not\x20found.','functions','339632qZlKlL','4483DJPlcK','split','\x20\x20-\x20','20sIDhuq','5001057yOflto','delete','<timestamp>','filter','toISOString','string','Would\x20delete\x20','remoteId','appCode','scriptsRootDir','map','Deleted\x20','45CrPvAy','1016xMKhPl','validation','\x20(local\x20file\x20moved\x20to\x20trash)','/api/management/library/scripts/delete','70tKCyon','No\x20lock\x20entry\x20found\x20for\x20\x22','18782640oKWDBK','replace','517146vSszfL','BFF\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','bff','str','high-risk-write','746185CQHkUC','target','356piaDKG','trashDir','length','projectRoot','find'];a25_0x4823=function(){return _0x5879b9;};return a25_0x4823();}import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';export const bffDelete={'service':a25_0xdd4b87(0xb3),'command':a25_0xdd4b87(0x9d),'description':a25_0xdd4b87(0xc3),'risk':a25_0xdd4b87(0xb5),'flags':[{'name':a25_0xdd4b87(0xb7),'type':a25_0xdd4b87(0xa1),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x3b930e){const _0x2cd9c6=a25_0xdd4b87,_0x32372c=loadBffProjectConfig(_0x3b930e[_0x2cd9c6(0xa4)]),_0x2b25ad=await readBffLockFile(_0x32372c['lockFilePath']);if(!_0x2b25ad)throw CliErrors[_0x2cd9c6(0xaa)](_0x2cd9c6(0xb2));},async 'dryRun'(_0x5a2bae){const _0x4c727d=a25_0xdd4b87,_0x1c52de=loadBffProjectConfig(_0x5a2bae['appCode']),_0x99d7cc=await readBffLockFile(_0x1c52de[_0x4c727d(0xbd)]);if(!_0x99d7cc)throw CliErrors[_0x4c727d(0xaa)]('BFF\x20lock\x20file\x20not\x20found.');const {appLock:_0x130563}=ensureLockScope(_0x99d7cc,_0x5a2bae['appCode'],_0x1c52de[_0x4c727d(0xc4)],_0x4c727d(0x9d)),_0x3747bb=_0x5a2bae['str'](_0x4c727d(0xb7)),_0x561ff8=Object['keys'](_0x130563[_0x4c727d(0xc8)]),_0x4a278a=resolveDeleteTarget(_0x3747bb,_0x561ff8),_0x115f6b=_0x130563[_0x4c727d(0xc8)][_0x4a278a];if(!_0x115f6b)throw CliErrors[_0x4c727d(0xaa)]('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x4a278a+'\x22.');const _0x1980a8=resolveLocalFilePathFromLockKey(_0x1c52de,_0x4a278a),_0x4c6eb6=relative(_0x1c52de[_0x4c727d(0xbb)],_0x1980a8),_0xd34e6d=join(_0x1c52de[_0x4c727d(0xb9)],_0x4c727d(0x9e),_0x4c6eb6);return{'method':_0x4c727d(0xc5),'url':_0x4c727d(0xac),'body':{'appCode':_0x5a2bae[_0x4c727d(0xa4)],'target':_0x4a278a,'remoteId':_0x115f6b[_0x4c727d(0xa3)],'localFilePath':_0x1980a8,'trashedPath':_0xd34e6d},'description':_0x4c727d(0xa2)+_0x4a278a+_0x4c727d(0xc6)};},async 'execute'(_0x201752){const _0x230981=a25_0xdd4b87,_0x3fc93b=loadBffProjectConfig(_0x201752[_0x230981(0xa4)]),_0x27d1aa=await readBffLockFile(_0x3fc93b[_0x230981(0xbd)]);if(!_0x27d1aa)throw CliErrors['validation'](_0x230981(0xc7));const {lockData:_0x5ab009,appLock:_0x218af3}=ensureLockScope(_0x27d1aa,_0x201752['appCode'],_0x3fc93b['scriptsRoot'],_0x230981(0x9d)),_0x1aa66e=_0x201752[_0x230981(0xb4)](_0x230981(0xb7)),_0x4076d6=Object['keys'](_0x218af3[_0x230981(0xc8)]),_0x521fb9=resolveDeleteTarget(_0x1aa66e,_0x4076d6),_0xf98b47=_0x218af3[_0x230981(0xc8)][_0x521fb9];if(!_0xf98b47)throw CliErrors[_0x230981(0xaa)](_0x230981(0xae)+_0x521fb9+'\x22.');await deleteBffScript(_0xf98b47[_0x230981(0xa3)]),delete _0x218af3[_0x230981(0xc8)][_0x521fb9],_0x218af3[_0x230981(0xc0)]=new Date()[_0x230981(0xa0)](),await writeBffLockFile(_0x3fc93b['lockFilePath'],_0x5ab009);const _0x33d944=resolveLocalFilePathFromLockKey(_0x3fc93b,_0x521fb9);let _0x555cf4;await fileExists(_0x33d944)&&(_0x555cf4=await moveToTrash(_0x3fc93b[_0x230981(0xbb)],_0x3fc93b[_0x230981(0xb9)],_0x33d944),await cleanupEmptyDirectories(dirname(_0x33d944),_0x3fc93b[_0x230981(0xa5)]));const _0x381f4a={'deleted':_0x521fb9,'remoteId':_0xf98b47[_0x230981(0xa3)]};if(_0x555cf4)_0x381f4a[_0x230981(0xc1)]=_0x555cf4;return{'ok':!![],'data':_0x381f4a,'message':_0x230981(0xa7)+_0x521fb9+(_0x555cf4?_0x230981(0xab):'')};}};function resolveDeleteTarget(_0x28528e,_0x5a5715){const _0x26261e=a25_0xdd4b87;if(_0x28528e['includes']('/')){const _0x3c0c4f=_0x5a5715[_0x26261e(0xbc)](_0x54546e=>_0x54546e===_0x28528e);if(!_0x3c0c4f)throw CliErrors['validation'](_0x26261e(0xc2)+_0x28528e);return _0x3c0c4f;}const _0x2bc858=_0x5a5715[_0x26261e(0x9f)](_0x244404=>_0x244404[_0x26261e(0xcb)]('/')['at'](-0x1)===_0x28528e);if(_0x2bc858[_0x26261e(0xba)]===0x0)throw CliErrors[_0x26261e(0xaa)](_0x26261e(0xc2)+_0x28528e);if(_0x2bc858[_0x26261e(0xba)]>0x1)throw CliErrors[_0x26261e(0xaa)]('Multiple\x20functions\x20match\x20\x22'+_0x28528e+_0x26261e(0xbe)+_0x2bc858[_0x26261e(0xa6)](_0x233d51=>_0x26261e(0xcc)+_0x233d51)['join']('\x0a'));return _0x2bc858[0x0];}async function moveToTrash(_0x1d162a,_0x3e53e5,_0x32531b){const _0x542cf7=a25_0xdd4b87,_0x601d96=new Date()[_0x542cf7(0xa0)]()[_0x542cf7(0xb0)](/[:.]/g,'-'),_0x269dc1=relative(_0x1d162a,_0x32531b),_0x49d723=join(_0x3e53e5,_0x601d96,_0x269dc1);return await mkdir(dirname(_0x49d723),{'recursive':!![]}),await rename(_0x32531b,_0x49d723),_0x49d723;}async function cleanupEmptyDirectories(_0x5bb919,_0x1058a0){const _0x544ff2=a25_0xdd4b87;let _0x2c9226=resolve(_0x5bb919);const _0x49c7a5=resolve(_0x1058a0);while(_0x2c9226['startsWith'](''+_0x49c7a5+sep)||_0x2c9226===_0x49c7a5){if(_0x2c9226===_0x49c7a5)return;try{const _0x17c772=await readdir(_0x2c9226);if(_0x17c772[_0x544ff2(0xba)]>0x0)return;await rmdir(_0x2c9226);}catch{return;}_0x2c9226=dirname(_0x2c9226);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a26_0x107f8d=a26_0x1bac;function a26_0x1bac(_0x194b92,_0xc93a1d){_0x194b92=_0x194b92-0x82;const _0x121997=a26_0x1219();let _0x1bacb6=_0x121997[_0x194b92];return _0x1bacb6;}(function(_0x474ee0,_0x4abbff){const _0x316c3d=a26_0x1bac,_0x4c841a=_0x474ee0();while(!![]){try{const _0x58ddc3=-parseInt(_0x316c3d(0x85))/0x1+-parseInt(_0x316c3d(0x96))/0x2*(parseInt(_0x316c3d(0x91))/0x3)+-parseInt(_0x316c3d(0x84))/0x4*(parseInt(_0x316c3d(0x8b))/0x5)+-parseInt(_0x316c3d(0x86))/0x6*(-parseInt(_0x316c3d(0x8c))/0x7)+parseInt(_0x316c3d(0x8a))/0x8+parseInt(_0x316c3d(0x94))/0x9+-parseInt(_0x316c3d(0x83))/0xa;if(_0x58ddc3===_0x4abbff)break;else _0x4c841a['push'](_0x4c841a['shift']());}catch(_0xa4cb9b){_0x4c841a['push'](_0x4c841a['shift']());}}}(a26_0x1219,0x71769));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a26_0x107f8d(0x92),'command':a26_0x107f8d(0x89),'description':a26_0x107f8d(0x8f),'risk':'read','flags':[{'name':'id','type':'number','required':!![],'description':a26_0x107f8d(0x95)},{'name':a26_0x107f8d(0x88),'type':'boolean','description':a26_0x107f8d(0x87)}],async 'execute'(_0x42c9d2){const _0x43a3aa=a26_0x107f8d,_0x460eb7=await getBffScriptInfo(_0x42c9d2['num']('id')),_0x1f5913=_0x42c9d2['bool'](_0x43a3aa(0x88));if(_0x1f5913)return{'ok':!![],'data':_0x460eb7};return{'ok':!![],'data':{'id':_0x460eb7['id'],'appCode':_0x460eb7[_0x43a3aa(0x90)],'scriptType':_0x460eb7[_0x43a3aa(0x8e)],'description':_0x460eb7[_0x43a3aa(0x82)]||_0x43a3aa(0x93),'createdTime':_0x460eb7[_0x43a3aa(0x8d)]??'','updatedTime':_0x460eb7['updatedTime']??'','scriptContent':_0x460eb7[_0x43a3aa(0x97)]??''}};}};function a26_0x1219(){const _0x2ee521=['2393155QDoDPx','1057QaeAhr','createdTime','scriptType','Get\x20BFF\x20script\x20details\x20by\x20ID','appCode','1191RFDLpC','bff','(none)','7325199nBWjeg','Script\x20ID','3058kgIuIA','scriptContent','description','263480oKJGHg','4sXNGem','323764dQtgBj','34710pFkEIH','Return\x20full\x20raw\x20script\x20object','verbose','detail','1704440XHesci'];a26_0x1219=function(){return _0x2ee521;};return a26_0x1219();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x40df0e,_0x3ca057){const _0x41a38e=a27_0x3c89,_0x3aa9e2=_0x40df0e();while(!![]){try{const _0xd5feca=parseInt(_0x41a38e(0x7d))/0x1*(-parseInt(_0x41a38e(0x7b))/0x2)+parseInt(_0x41a38e(0x7a))/0x3+parseInt(_0x41a38e(0x7e))/0x4*(parseInt(_0x41a38e(0x79))/0x5)+parseInt(_0x41a38e(0x7c))/0x6*(parseInt(_0x41a38e(0x82))/0x7)+-parseInt(_0x41a38e(0x81))/0x8*(parseInt(_0x41a38e(0x78))/0x9)+parseInt(_0x41a38e(0x7f))/0xa+parseInt(_0x41a38e(0x80))/0xb;if(_0xd5feca===_0x3ca057)break;else _0x3aa9e2['push'](_0x3aa9e2['shift']());}catch(_0x7f9d50){_0x3aa9e2['push'](_0x3aa9e2['shift']());}}}(a27_0x2074,0xb24e8));import{bffList}from'./list.js';import{bffDetail}from'./detail.js';import{bffStatus}from'./status.js';function a27_0x3c89(_0x190f8c,_0x2d7a3f){_0x190f8c=_0x190f8c-0x78;const _0x20744d=a27_0x2074();let _0x3c89d8=_0x20744d[_0x190f8c];return _0x3c89d8;}import{bffNew}from'./new.js';import{bffPush}from'./push.js';import{bffPull}from'./pull.js';import{bffDelete}from'./delete.js';function a27_0x2074(){const _0xa43cd7=['10768560OudALy','3274073XncyIU','213736HFUcur','4952962jTPKQj','288UIMPpe','255AlEtIw','1900599ZlKBxR','484jDvVuB','6qqHPwL','5826VKxWDY','21928IpgqEp'];a27_0x2074=function(){return _0xa43cd7;};return a27_0x2074();}export const bffDefinitions=[bffList,bffDetail,bffStatus,bffNew,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x5714ef=a28_0x4251;(function(_0x277262,_0x185a64){const _0x524cea=a28_0x4251,_0x40bba4=_0x277262();while(!![]){try{const _0x2d5c4b=-parseInt(_0x524cea(0x1b2))/0x1+-parseInt(_0x524cea(0x1be))/0x2*(parseInt(_0x524cea(0x1b9))/0x3)+-parseInt(_0x524cea(0x1bc))/0x4+-parseInt(_0x524cea(0x1c5))/0x5*(parseInt(_0x524cea(0x1bb))/0x6)+-parseInt(_0x524cea(0x1c8))/0x7+parseInt(_0x524cea(0x1c2))/0x8+parseInt(_0x524cea(0x1c7))/0x9;if(_0x2d5c4b===_0x185a64)break;else _0x40bba4['push'](_0x40bba4['shift']());}catch(_0x5aab61){_0x40bba4['push'](_0x40bba4['shift']());}}}(a28_0x4125,0x5f9dc));function a28_0x4125(){const _0x977129=['14829921nURXla','1674120xAHxsy','name','appCode','List\x20BFF\x20scripts','404653ipiKAi','description','COMMON','Script\x20type\x20filter','map','verbose','(unnamed)','345BvgFdA','read','1624908VYzrwA','2745504iSIkwF','string','3698zdJgRW','ENDPOINT','length','Filter\x20by\x20script\x20name','4460136zkiSSb','boolean','list','5GVqWBD','type'];a28_0x4125=function(){return _0x977129;};return a28_0x4125();}import{listBffScripts}from'../../core/api-client.js';function a28_0x4251(_0x22aef1,_0x2a62d7){_0x22aef1=_0x22aef1-0x1b0;const _0x412565=a28_0x4125();let _0x42515e=_0x412565[_0x22aef1];return _0x42515e;}export const bffList={'service':'bff','command':a28_0x5714ef(0x1c4),'description':a28_0x5714ef(0x1b1),'risk':a28_0x5714ef(0x1ba),'flags':[{'name':'type','type':'string','description':a28_0x5714ef(0x1b5),'default':a28_0x5714ef(0x1bf),'enum':[a28_0x5714ef(0x1bf),a28_0x5714ef(0x1b4)]},{'name':a28_0x5714ef(0x1c9),'type':a28_0x5714ef(0x1bd),'description':a28_0x5714ef(0x1c1)},{'name':a28_0x5714ef(0x1b7),'type':a28_0x5714ef(0x1c3),'description':'Return\x20full\x20script\x20objects'}],async 'execute'(_0x17f8a1){const _0x2e8770=a28_0x5714ef,_0x2c3e95=await listBffScripts(_0x17f8a1[_0x2e8770(0x1b0)],_0x17f8a1['str'](_0x2e8770(0x1c6)),{'scriptName':_0x17f8a1['str'](_0x2e8770(0x1c9))||undefined}),_0x35d335=_0x17f8a1['bool'](_0x2e8770(0x1b7));return{'ok':!![],'data':_0x35d335?_0x2c3e95:_0x2c3e95[_0x2e8770(0x1b6)](_0x2e15c2=>({'id':_0x2e15c2['id'],'functionName':_0x2e15c2['functionName']??'','description':_0x2e15c2[_0x2e8770(0x1b3)]||_0x2e8770(0x1b8),'scriptType':_0x2e15c2['scriptType']})),'message':_0x2c3e95[_0x2e8770(0x1c0)]===0x0?'No\x20BFF\x20scripts\x20found.':undefined};}};
|
package/lib/commands/bff/new.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a29_0x3708d8=a29_0x268f;(function(_0x168131,_0x57e7ba){const _0x343102=a29_0x268f,_0xf1c60=_0x168131();while(!![]){try{const _0x2dbed3=-parseInt(_0x343102(0xba))/0x1+-parseInt(_0x343102(0xa8))/0x2+-parseInt(_0x343102(0x9b))/0x3+-parseInt(_0x343102(0x99))/0x4*(parseInt(_0x343102(0xb8))/0x5)+-parseInt(_0x343102(0xaa))/0x6*(-parseInt(_0x343102(0xb2))/0x7)+-parseInt(_0x343102(0x83))/0x8+parseInt(_0x343102(0x8d))/0x9;if(_0x2dbed3===_0x57e7ba)break;else _0xf1c60['push'](_0xf1c60['shift']());}catch(_0xdae3ff){_0xf1c60['push'](_0xf1c60['shift']());}}}(a29_0x1138,0xda487));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_0x1138(){const _0x4a1b02=['type','HOOK\x20requires\x20alias/operation/node\x20options.','map','\x20api\x20pull`\x20to\x20refresh.','\x0a\x20*\x20[触发节点]\x20','No\x20operation\x20types\x20found\x20for\x20dataset\x20','functionNode','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','TODO:\x20add\x20script\x20description','Script\x20description','No\x20datasets\x20found\x20for\x20this\x20app.','.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','keys','string','find','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Select\x20dataset:','Alias\x20\x22','scriptsRootDir','before','7846496FhXoQm','write','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','function-node','Invalid\x20function\x20name\x20\x22','Select\x20operation\x20type:','new','No\x20api.ts\x20found.\x20Run\x20`','datasetCode','42571449mTcCpO','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','.js','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','Created\x20','Trigger\x20node\x20(HOOK\x20only)','File\x20already\x20exists:\x20','stdin','parseInt','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','operationType','\x22\x20not\x20found\x20for\x20dataset\x20','164GIiQXw','code','259671bMPfHJ','HOOK','includes','\x0a\x20*\x20[脚本名称]\x20','description','question','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','operation-type','appCode','entries','str','COMMON','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','2412176JRjpjF','Select\x20trigger\x20node:','3450dLhNXR','datasetcode','Invalid\x20dataset\x20selection.','nonInteractive','validation','close','name','stderr','8505TClXTT','after','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','ENDPOINT','length','\x20function:\x20','115970jkdObg','\x22.\x20','1310288FdfIkG','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','apiDir','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','\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','Dataset\x20not\x20found\x20for\x20code\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','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','alias','bff','join','trim'];a29_0x1138=function(){return _0x4a1b02;};return a29_0x1138();}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_0x3708d8(0xc5),'command':a29_0x3708d8(0x8a),'description':a29_0x3708d8(0xc3),'risk':a29_0x3708d8(0x84),'flags':[{'name':'type','type':a29_0x3708d8(0x7c),'required':!![],'enum':['COMMON',a29_0x3708d8(0xb5),a29_0x3708d8(0x9c)],'description':'Script\x20type'},{'name':a29_0x3708d8(0xb0),'type':'string','required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a29_0x3708d8(0x9f),'type':a29_0x3708d8(0x7c),'description':a29_0x3708d8(0x78)},{'name':a29_0x3708d8(0xc4),'type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a29_0x3708d8(0xab),'type':a29_0x3708d8(0x7c),'description':a29_0x3708d8(0x96)},{'name':'operation-type','type':a29_0x3708d8(0x7c),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a29_0x3708d8(0x87),'type':a29_0x3708d8(0x7c),'description':a29_0x3708d8(0x92),'enum':['before',a29_0x3708d8(0xb3)]}],async 'validate'(_0x243ed2){const _0x6a5bb2=a29_0x3708d8,_0x59da83=_0x243ed2[_0x6a5bb2(0xa5)]('name');if(!isValidBffFunctionName(_0x59da83))throw CliErrors[_0x6a5bb2(0xae)](_0x6a5bb2(0x88)+_0x59da83+_0x6a5bb2(0xa1));},async 'execute'(_0x36eb21){const _0x192f02=a29_0x3708d8,_0x320040=loadBffProjectConfig(_0x36eb21[_0x192f02(0xa3)]),_0x3cab9e=_0x36eb21[_0x192f02(0xa5)](_0x192f02(0xc8)),_0x171c7e=_0x36eb21['str'](_0x192f02(0xb0)),_0x51a939=_0x36eb21[_0x192f02(0xa5)](_0x192f02(0x9f))||undefined,_0x1e5b80=_0x3cab9e===_0x192f02(0x9c)?await resolveHookOptions(_0x320040,_0x36eb21):undefined,_0x2d872a=buildFilePath(_0x320040,_0x3cab9e,_0x171c7e,_0x1e5b80);if(await fileExists(_0x2d872a))throw CliErrors[_0x192f02(0xae)](_0x192f02(0x93)+_0x2d872a);await mkdir(dirname(_0x2d872a),{'recursive':!![]});const _0x3775de=generateTemplate(_0x3cab9e,_0x171c7e,_0x36eb21[_0x192f02(0xa3)],_0x51a939,_0x1e5b80);await writeFile(_0x2d872a,_0x3775de,'utf8');const _0x36311c={'type':_0x3cab9e,'name':_0x171c7e,'path':_0x2d872a};if(_0x51a939)_0x36311c[_0x192f02(0x9f)]=_0x51a939;if(_0x1e5b80){if(_0x1e5b80[_0x192f02(0xc4)])_0x36311c[_0x192f02(0xc4)]=_0x1e5b80[_0x192f02(0xc4)];_0x36311c[_0x192f02(0x8c)]=_0x1e5b80['datasetCode'],_0x36311c['operationType']=_0x1e5b80['operationType'],_0x36311c[_0x192f02(0xce)]=_0x1e5b80[_0x192f02(0xce)];}return{'ok':!![],'data':_0x36311c,'message':_0x192f02(0x91)+_0x3cab9e+_0x192f02(0xb7)+_0x171c7e};}};function a29_0x268f(_0x423b91,_0x257975){_0x423b91=_0x423b91-0x76;const _0x1138b5=a29_0x1138();let _0x268f05=_0x1138b5[_0x423b91];return _0x268f05;}async function resolveHookOptions(_0x4bdf93,_0x272b43){const _0x18e723=a29_0x3708d8,_0x222654=loadAliasMap(_0x272b43[_0x18e723(0xbe)],undefined,resolveApiFilePath(_0x272b43['apiDir'],_0x272b43[_0x18e723(0xa3)])),_0x3c1eb7=_0x222654['length']>0x0;let _0x437a1c,_0x5cddd6,_0x51859f;const _0x1f89e=_0x272b43['str'](_0x18e723(0xc4)),_0x104d6f=_0x272b43['str'](_0x18e723(0xab));if(_0x1f89e){const _0x3b851f=resolveAlias(_0x272b43[_0x18e723(0xbe)],_0x1f89e,undefined,resolveApiFilePath(_0x272b43[_0x18e723(0xbe)],_0x272b43[_0x18e723(0xa3)]));if(!_0x3b851f){const _0x1fb600=_0x3c1eb7?'Available\x20aliases:\x20'+_0x222654[_0x18e723(0xca)](_0x219746=>_0x219746[_0x18e723(0xc4)])[_0x18e723(0xc6)](',\x20'):_0x18e723(0x8b)+CLI_BIN_NAME+_0x18e723(0xbd);throw CliErrors['validation'](_0x18e723(0x80)+_0x1f89e+'\x22\x20not\x20found.\x20'+_0x1fb600);}_0x437a1c=_0x1f89e,_0x5cddd6=_0x3b851f;}else{if(_0x104d6f){_0x5cddd6=_0x104d6f;const _0x83ac7e=_0x222654[_0x18e723(0x7d)](_0x2b9f0b=>_0x2b9f0b[_0x18e723(0x8c)]===_0x104d6f);_0x437a1c=_0x83ac7e?.[_0x18e723(0xc4)];}else{if(_0x272b43[_0x18e723(0xad)])throw CliErrors['validation'](_0x18e723(0xb4));else{if(_0x3c1eb7){const _0x4e0ea7=_0x222654['map'](_0x3f3b7e=>_0x3f3b7e[_0x18e723(0xc4)]+'\x20('+_0x3f3b7e['tableName']+')'),_0x7c4d1=await promptSelect(_0x18e723(0x7f),_0x4e0ea7),_0x3029cd=_0x222654[_0x7c4d1];if(!_0x3029cd)throw CliErrors[_0x18e723(0xae)](_0x18e723(0xac));_0x437a1c=_0x3029cd['alias'],_0x5cddd6=_0x3029cd['datasetCode'];}else{const _0x7d7e13=await listDatasets(_0x272b43[_0x18e723(0xa3)]);if(_0x7d7e13['length']===0x0)throw CliErrors[_0x18e723(0xae)](_0x18e723(0x79));const _0x187e26=_0x7d7e13[_0x18e723(0xca)](_0x3c82e2=>_0x3c82e2[_0x18e723(0xb0)]+'\x20('+_0x3c82e2[_0x18e723(0x9a)]+')'),_0x238a24=await promptSelect(_0x18e723(0x7f),_0x187e26),_0x1331b2=_0x7d7e13[_0x238a24];if(!_0x1331b2)throw CliErrors[_0x18e723(0xae)]('Invalid\x20dataset\x20selection.');_0x5cddd6=_0x1331b2[_0x18e723(0x9a)],_0x437a1c=undefined;}}}}const _0x5e11c4=await listDatasets(_0x272b43[_0x18e723(0xa3)]),_0x309f00=_0x5e11c4[_0x18e723(0x7d)](_0x8459c3=>_0x8459c3[_0x18e723(0x9a)]===_0x5cddd6);if(!_0x309f00)throw CliErrors[_0x18e723(0xae)](_0x18e723(0xc1)+_0x5cddd6+_0x18e723(0xb9)+(_0x437a1c?_0x18e723(0xbf)+CLI_BIN_NAME+_0x18e723(0xcb):''));_0x51859f=_0x309f00['id'];const _0x2be2ad=_0x437a1c??_0x5cddd6,_0x18e08c=await listBffDatasetOperations(_0x272b43[_0x18e723(0xa3)],_0x51859f),_0x3bfc59=_0x18e08c?Object[_0x18e723(0x7b)](_0x18e08c):[];if(_0x3bfc59['length']===0x0)throw CliErrors[_0x18e723(0xae)](_0x18e723(0xcd)+_0x2be2ad+'.');let _0x1cf19d;const _0x302f14=_0x272b43[_0x18e723(0xa5)](_0x18e723(0xa2));if(_0x302f14){if(!_0x3bfc59[_0x18e723(0x9d)](_0x302f14))throw CliErrors[_0x18e723(0xae)]('Operation\x20type\x20\x22'+_0x302f14+_0x18e723(0x98)+_0x2be2ad+'.\x20'+('Available:\x20'+_0x3bfc59['join'](',\x20')));_0x1cf19d=_0x302f14;}else{if(_0x272b43['nonInteractive'])throw CliErrors[_0x18e723(0xae)](_0x18e723(0x76));const _0x1bbe98=await promptSelect(_0x18e723(0x89),_0x3bfc59);_0x1cf19d=_0x3bfc59[_0x1bbe98]??_0x3bfc59[0x0];}let _0x412369=normalizeHookFunctionNode(_0x272b43[_0x18e723(0xa5)](_0x18e723(0x87)));if(!_0x412369){if(_0x272b43[_0x18e723(0xa5)](_0x18e723(0x87)))throw CliErrors['validation'](_0x18e723(0xbc));if(_0x272b43[_0x18e723(0xad)])throw CliErrors['validation'](_0x18e723(0x86));const _0x307872=await promptSelect(_0x18e723(0xa9),['before',_0x18e723(0xb3)]);_0x412369=[_0x18e723(0x82),_0x18e723(0xb3)][_0x307872]??_0x18e723(0x82);}return{'alias':_0x437a1c,'datasetCode':_0x5cddd6,'datasetId':_0x51859f,'operationType':_0x1cf19d,'functionNode':_0x412369};}async function promptSelect(_0x435b3d,_0x25bd43){const _0xadb06b=a29_0x3708d8;if(_0x25bd43[_0xadb06b(0xb6)]===0x1)return 0x0;for(const [_0x21943b,_0x17e87d]of _0x25bd43[_0xadb06b(0xa4)]()){process[_0xadb06b(0xb1)][_0xadb06b(0x84)]('\x20\x20'+(_0x21943b+0x1)+'.\x20'+_0x17e87d+'\x0a');}const _0x203813=createInterface({'input':process[_0xadb06b(0x94)],'output':process[_0xadb06b(0xb1)]});while(!![]){const _0x52b7fe=await new Promise(_0x4c097f=>{const _0x148f11=_0xadb06b;_0x203813[_0x148f11(0xa0)](_0x435b3d+'\x20',_0x4c097f);}),_0x3c12a8=Number[_0xadb06b(0x95)](_0x52b7fe[_0xadb06b(0xc7)](),0xa);if(Number['isInteger'](_0x3c12a8)&&_0x3c12a8>=0x1&&_0x3c12a8<=_0x25bd43[_0xadb06b(0xb6)])return _0x203813[_0xadb06b(0xaf)](),_0x3c12a8-0x1;process['stderr']['write'](_0xadb06b(0x90)+_0x25bd43['length']+'.\x0a');}}function buildFilePath(_0x568c99,_0x1420ed,_0x50dab1,_0x15a49d){const _0x24ce39=a29_0x3708d8;if(_0x1420ed===_0x24ce39(0x9c)){if(!_0x15a49d)throw CliErrors[_0x24ce39(0xae)](_0x24ce39(0xc9));const _0x2248b0=_0x15a49d[_0x24ce39(0xc4)]??_0x15a49d[_0x24ce39(0x8c)];return join(_0x568c99[_0x24ce39(0x81)],_0x24ce39(0x9c),_0x2248b0,_0x15a49d['operationType'],_0x15a49d[_0x24ce39(0xce)],_0x50dab1+_0x24ce39(0x8f));}return join(_0x568c99[_0x24ce39(0x81)],_0x1420ed,_0x50dab1+'.js');}export function generateTemplate(_0x2bedae,_0x3a11bc,_0x19b538,_0x15ec4b,_0x52266c){const _0x5ee85c=a29_0x3708d8,_0x65ea03=_0x15ec4b?.[_0x5ee85c(0xc7)]()||_0x5ee85c(0x77);if(_0x2bedae===_0x5ee85c(0xa6))return'/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x65ea03+_0x5ee85c(0x9e)+_0x3a11bc+_0x5ee85c(0x85)+_0x3a11bc+_0x5ee85c(0x7a)+_0x3a11bc+_0x5ee85c(0x7e);if(_0x2bedae===_0x5ee85c(0xb5))return'/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x65ea03+_0x5ee85c(0xbb)+_0x19b538+'/endpoint/'+_0x3a11bc+_0x5ee85c(0xc0)+_0x3a11bc+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x52266c)throw CliErrors[_0x5ee85c(0xae)](_0x5ee85c(0xa7));return _0x5ee85c(0x8e)+_0x65ea03+_0x5ee85c(0xbb)+_0x19b538+'/'+_0x52266c[_0x5ee85c(0x8c)]+'/'+_0x52266c[_0x5ee85c(0x97)]+_0x5ee85c(0xcc)+_0x52266c[_0x5ee85c(0xce)]+_0x5ee85c(0xc2)+_0x3a11bc+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
|
1
|
+
const a29_0x148bc3=a29_0x10df;(function(_0x1be716,_0xc079e4){const _0x1d601d=a29_0x10df,_0x32351f=_0x1be716();while(!![]){try{const _0x5afedf=parseInt(_0x1d601d(0xcc))/0x1+-parseInt(_0x1d601d(0xec))/0x2*(parseInt(_0x1d601d(0x10b))/0x3)+-parseInt(_0x1d601d(0x107))/0x4*(-parseInt(_0x1d601d(0xed))/0x5)+parseInt(_0x1d601d(0xda))/0x6*(-parseInt(_0x1d601d(0xf4))/0x7)+-parseInt(_0x1d601d(0x10a))/0x8*(parseInt(_0x1d601d(0xd6))/0x9)+-parseInt(_0x1d601d(0xfe))/0xa*(parseInt(_0x1d601d(0xf1))/0xb)+parseInt(_0x1d601d(0x110))/0xc;if(_0x5afedf===_0xc079e4)break;else _0x32351f['push'](_0x32351f['shift']());}catch(_0x3ffd3c){_0x32351f['push'](_0x32351f['shift']());}}}(a29_0x5b04,0xc45ed));import{createInterface}from'node:readline';function a29_0x5b04(){const _0x177235=['226900onhBds','apiDir','ENDPOINT','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','No\x20datasets\x20found\x20for\x20this\x20app.','Operation\x20type\x20\x22','\x22\x20not\x20found\x20for\x20dataset\x20','stderr','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','\x0a\x20*\x20[脚本名称]\x20','279HfjfWI','map','validation','after','11370lfTxsz','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','operationType','Script\x20type','datasetCode','Select\x20dataset:','stdin','string','includes','.js','new','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','tableName','functionNode','Invalid\x20function\x20name\x20\x22','before','2FNpZek','5084265WiaPAS','HOOK\x20requires\x20alias/operation/node\x20options.','No\x20api.ts\x20found.\x20Run\x20`','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','33eGvAys','code','Trigger\x20node\x20(HOOK\x20only)','5012mxpcyU','HOOK','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','write','Invalid\x20dataset\x20selection.','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','name','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','/endpoint/','length','3848030wjtqbW','scriptsRootDir','alias','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Function\x20name\x20(valid\x20JS\x20identifier)','datasetcode','str','nonInteractive','4UHoASK','function-node','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','210928XfvqWc','1794189zwrSaQ','\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','trim','\x0a\x20*\x20[触发节点]\x20','Select\x20trigger\x20node:','41846616LYiWwZ','appCode','keys','operation-type','find','join','.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','Dataset\x20not\x20found\x20for\x20code\x20\x22','description','entries','\x22\x20not\x20found.\x20','type','bff','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.'];a29_0x5b04=function(){return _0x177235;};return a29_0x5b04();}import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{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';function a29_0x10df(_0x44a897,_0x54027a){_0x44a897=_0x44a897-0xc6;const _0x5b046b=a29_0x5b04();let _0x10dfff=_0x5b046b[_0x44a897];return _0x10dfff;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffNew={'service':a29_0x148bc3(0xca),'command':a29_0x148bc3(0xe6),'description':a29_0x148bc3(0xcf),'risk':a29_0x148bc3(0xf7),'flags':[{'name':'type','type':'string','required':!![],'enum':['COMMON',a29_0x148bc3(0xce),a29_0x148bc3(0xf5)],'description':a29_0x148bc3(0xdf)},{'name':a29_0x148bc3(0xfa),'type':a29_0x148bc3(0xe3),'required':!![],'description':a29_0x148bc3(0x103)},{'name':'description','type':'string','description':'Script\x20description'},{'name':a29_0x148bc3(0x100),'type':a29_0x148bc3(0xe3),'description':a29_0x148bc3(0xf9)},{'name':a29_0x148bc3(0x104),'type':'string','description':a29_0x148bc3(0xdd)},{'name':a29_0x148bc3(0x113),'type':a29_0x148bc3(0xe3),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a29_0x148bc3(0x108),'type':a29_0x148bc3(0xe3),'description':a29_0x148bc3(0xf3),'enum':['before',a29_0x148bc3(0xd9)]}],async 'validate'(_0x188845){const _0x5f11ad=a29_0x148bc3,_0x1afbef=_0x188845[_0x5f11ad(0x105)]('name');if(!isValidBffFunctionName(_0x1afbef))throw CliErrors[_0x5f11ad(0xd8)](_0x5f11ad(0xea)+_0x1afbef+_0x5f11ad(0x101));},async 'execute'(_0x583fd7){const _0x3d93fb=a29_0x148bc3,_0x55aaf4=loadBffProjectConfig(_0x583fd7[_0x3d93fb(0x111)]),_0x34251a=_0x583fd7['str'](_0x3d93fb(0xc9)),_0x4711b4=_0x583fd7['str'](_0x3d93fb(0xfa)),_0x57958f=_0x583fd7[_0x3d93fb(0x105)](_0x3d93fb(0xc6))||undefined,_0x186a4e=_0x34251a==='HOOK'?await resolveHookOptions(_0x55aaf4,_0x583fd7):undefined,_0x50daf8=buildFilePath(_0x55aaf4,_0x34251a,_0x4711b4,_0x186a4e);if(await fileExists(_0x50daf8))throw CliErrors[_0x3d93fb(0xd8)]('File\x20already\x20exists:\x20'+_0x50daf8);await mkdir(dirname(_0x50daf8),{'recursive':!![]});const _0x4e6716=generateTemplate(_0x34251a,_0x4711b4,_0x583fd7[_0x3d93fb(0x111)],_0x57958f,_0x186a4e);await writeFile(_0x50daf8,_0x4e6716,'utf8');const _0x54293a={'type':_0x34251a,'name':_0x4711b4,'path':_0x50daf8};if(_0x57958f)_0x54293a[_0x3d93fb(0xc6)]=_0x57958f;if(_0x186a4e){if(_0x186a4e['alias'])_0x54293a[_0x3d93fb(0x100)]=_0x186a4e['alias'];_0x54293a['datasetCode']=_0x186a4e[_0x3d93fb(0xe0)],_0x54293a[_0x3d93fb(0xde)]=_0x186a4e[_0x3d93fb(0xde)],_0x54293a[_0x3d93fb(0xe9)]=_0x186a4e['functionNode'];}return{'ok':!![],'data':_0x54293a,'message':'Created\x20'+_0x34251a+'\x20function:\x20'+_0x4711b4};}};async function resolveHookOptions(_0x42d99f,_0x36a520){const _0x43d02c=a29_0x148bc3,_0x5520a4=loadAliasMap(_0x36a520[_0x43d02c(0xcd)],undefined,resolveApiFilePath(_0x36a520['apiDir'],_0x36a520[_0x43d02c(0x111)])),_0x5bfa77=_0x5520a4[_0x43d02c(0xfd)]>0x0;let _0xffaa8c,_0x2b92ba,_0x404019;const _0x423373=_0x36a520[_0x43d02c(0x105)](_0x43d02c(0x100)),_0x24f551=_0x36a520[_0x43d02c(0x105)](_0x43d02c(0x104));if(_0x423373){const _0x41a2b6=resolveAlias(_0x36a520[_0x43d02c(0xcd)],_0x423373,undefined,resolveApiFilePath(_0x36a520[_0x43d02c(0xcd)],_0x36a520['appCode']));if(!_0x41a2b6){const _0x2c2973=_0x5bfa77?'Available\x20aliases:\x20'+_0x5520a4[_0x43d02c(0xd7)](_0x4d8f28=>_0x4d8f28['alias'])[_0x43d02c(0x115)](',\x20'):_0x43d02c(0xef)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x43d02c(0xd8)]('Alias\x20\x22'+_0x423373+_0x43d02c(0xc8)+_0x2c2973);}_0xffaa8c=_0x423373,_0x2b92ba=_0x41a2b6;}else{if(_0x24f551){_0x2b92ba=_0x24f551;const _0x598c53=_0x5520a4[_0x43d02c(0x114)](_0x3b393a=>_0x3b393a[_0x43d02c(0xe0)]===_0x24f551);_0xffaa8c=_0x598c53?.[_0x43d02c(0x100)];}else{if(_0x36a520[_0x43d02c(0x106)])throw CliErrors[_0x43d02c(0xd8)](_0x43d02c(0x102));else{if(_0x5bfa77){const _0x5be4df=_0x5520a4['map'](_0x2aebb9=>_0x2aebb9['alias']+'\x20('+_0x2aebb9[_0x43d02c(0xe8)]+')'),_0x34b7de=await promptSelect(_0x43d02c(0xe1),_0x5be4df),_0x4fe32e=_0x5520a4[_0x34b7de];if(!_0x4fe32e)throw CliErrors[_0x43d02c(0xd8)](_0x43d02c(0xf8));_0xffaa8c=_0x4fe32e[_0x43d02c(0x100)],_0x2b92ba=_0x4fe32e[_0x43d02c(0xe0)];}else{const _0x4e704a=await listDatasets(_0x36a520[_0x43d02c(0x111)]);if(_0x4e704a[_0x43d02c(0xfd)]===0x0)throw CliErrors['validation'](_0x43d02c(0xd0));const _0x58aaf7=_0x4e704a[_0x43d02c(0xd7)](_0x847a0b=>_0x847a0b[_0x43d02c(0xfa)]+'\x20('+_0x847a0b['code']+')'),_0x552ba8=await promptSelect(_0x43d02c(0xe1),_0x58aaf7),_0x249089=_0x4e704a[_0x552ba8];if(!_0x249089)throw CliErrors[_0x43d02c(0xd8)](_0x43d02c(0xf8));_0x2b92ba=_0x249089[_0x43d02c(0xf2)],_0xffaa8c=undefined;}}}}const _0xb843ee=await listDatasets(_0x36a520[_0x43d02c(0x111)]),_0x1e37b1=_0xb843ee['find'](_0x30bbe1=>_0x30bbe1[_0x43d02c(0xf2)]===_0x2b92ba);if(!_0x1e37b1)throw CliErrors[_0x43d02c(0xd8)](_0x43d02c(0x117)+_0x2b92ba+'\x22.\x20'+(_0xffaa8c?_0x43d02c(0xdc)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x404019=_0x1e37b1['id'];const _0x27482a=_0xffaa8c??_0x2b92ba,_0x4334b4=await listBffDatasetOperations(_0x36a520[_0x43d02c(0x111)],_0x404019),_0x31af5f=_0x4334b4?Object[_0x43d02c(0x112)](_0x4334b4):[];if(_0x31af5f[_0x43d02c(0xfd)]===0x0)throw CliErrors['validation']('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x27482a+'.');let _0x243614;const _0x552778=_0x36a520[_0x43d02c(0x105)]('operation-type');if(_0x552778){if(!_0x31af5f[_0x43d02c(0xe4)](_0x552778))throw CliErrors[_0x43d02c(0xd8)](_0x43d02c(0xd1)+_0x552778+_0x43d02c(0xd2)+_0x27482a+'.\x20'+('Available:\x20'+_0x31af5f[_0x43d02c(0x115)](',\x20')));_0x243614=_0x552778;}else{if(_0x36a520[_0x43d02c(0x106)])throw CliErrors[_0x43d02c(0xd8)](_0x43d02c(0x109));const _0x4cff18=await promptSelect('Select\x20operation\x20type:',_0x31af5f);_0x243614=_0x31af5f[_0x4cff18]??_0x31af5f[0x0];}let _0x5929b2=normalizeHookFunctionNode(_0x36a520['str'](_0x43d02c(0x108)));if(!_0x5929b2){if(_0x36a520[_0x43d02c(0x105)]('function-node'))throw CliErrors['validation'](_0x43d02c(0xe7));if(_0x36a520[_0x43d02c(0x106)])throw CliErrors[_0x43d02c(0xd8)](_0x43d02c(0xcb));const _0x19afa8=await promptSelect(_0x43d02c(0x10f),['before',_0x43d02c(0xd9)]);_0x5929b2=[_0x43d02c(0xeb),_0x43d02c(0xd9)][_0x19afa8]??'before';}return{'alias':_0xffaa8c,'datasetCode':_0x2b92ba,'datasetId':_0x404019,'operationType':_0x243614,'functionNode':_0x5929b2};}async function promptSelect(_0x48615d,_0x899b1e){const _0xe4d234=a29_0x148bc3;if(_0x899b1e[_0xe4d234(0xfd)]===0x1)return 0x0;for(const [_0x6b6e0a,_0x1e7799]of _0x899b1e[_0xe4d234(0xc7)]()){process[_0xe4d234(0xd3)][_0xe4d234(0xf7)]('\x20\x20'+(_0x6b6e0a+0x1)+'.\x20'+_0x1e7799+'\x0a');}const _0x1019ad=createInterface({'input':process[_0xe4d234(0xe2)],'output':process[_0xe4d234(0xd3)]});while(!![]){const _0x20f416=await new Promise(_0x5cbc89=>{_0x1019ad['question'](_0x48615d+'\x20',_0x5cbc89);}),_0x1de874=Number['parseInt'](_0x20f416[_0xe4d234(0x10d)](),0xa);if(Number['isInteger'](_0x1de874)&&_0x1de874>=0x1&&_0x1de874<=_0x899b1e[_0xe4d234(0xfd)])return _0x1019ad['close'](),_0x1de874-0x1;process[_0xe4d234(0xd3)]['write'](_0xe4d234(0xf6)+_0x899b1e[_0xe4d234(0xfd)]+'.\x0a');}}function buildFilePath(_0x42dc64,_0x1d3d95,_0x2628f9,_0x2bd089){const _0x5c257c=a29_0x148bc3;if(_0x1d3d95===_0x5c257c(0xf5)){if(!_0x2bd089)throw CliErrors[_0x5c257c(0xd8)](_0x5c257c(0xee));const _0x2bb0dd=_0x2bd089[_0x5c257c(0x100)]??_0x2bd089['datasetCode'];return join(_0x42dc64['scriptsRootDir'],_0x5c257c(0xf5),_0x2bb0dd,_0x2bd089['operationType'],_0x2bd089['functionNode'],_0x2628f9+_0x5c257c(0xe5));}return join(_0x42dc64[_0x5c257c(0xff)],_0x1d3d95,_0x2628f9+'.js');}export function generateTemplate(_0x25ea3c,_0x8cb2b3,_0x40d4cb,_0x1b4c16,_0x48af37){const _0x3f58ca=a29_0x148bc3,_0x17bf82=_0x1b4c16?.[_0x3f58ca(0x10d)]()||'TODO:\x20add\x20script\x20description';if(_0x25ea3c==='COMMON')return'/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x17bf82+_0x3f58ca(0xd5)+_0x8cb2b3+_0x3f58ca(0xd4)+_0x8cb2b3+_0x3f58ca(0x116)+_0x8cb2b3+_0x3f58ca(0xfb);if(_0x25ea3c===_0x3f58ca(0xce))return _0x3f58ca(0xf0)+_0x17bf82+_0x3f58ca(0xdb)+_0x40d4cb+_0x3f58ca(0xfc)+_0x8cb2b3+_0x3f58ca(0x10c)+_0x8cb2b3+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x48af37)throw CliErrors['validation']('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');return'/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x17bf82+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x40d4cb+'/'+_0x48af37[_0x3f58ca(0xe0)]+'/'+_0x48af37[_0x3f58ca(0xde)]+_0x3f58ca(0x10e)+_0x48af37[_0x3f58ca(0xe9)]+'\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'+_0x8cb2b3+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x222e80=a30_0x5b78;(function(_0x305bef,_0x233707){const _0x298010=a30_0x5b78,_0x3ee075=_0x305bef();while(!![]){try{const _0xebeec1=parseInt(_0x298010(0x1a2))/0x1+parseInt(_0x298010(0x1db))/0x2+parseInt(_0x298010(0x1d7))/0x3+-parseInt(_0x298010(0x1d0))/0x4*(-parseInt(_0x298010(0x1b6))/0x5)+parseInt(_0x298010(0x1a3))/0x6+-parseInt(_0x298010(0x1d2))/0x7+parseInt(_0x298010(0x1cb))/0x8*(-parseInt(_0x298010(0x19a))/0x9);if(_0xebeec1===_0x233707)break;else _0x3ee075['push'](_0x3ee075['shift']());}catch(_0x27c335){_0x3ee075['push'](_0x3ee075['shift']());}}}(a30_0x5810,0x9d273));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';export const bffPull={'service':a30_0x222e80(0x1dd),'command':'pull','description':a30_0x222e80(0x1b7),'risk':a30_0x222e80(0x1d6),'flags':[{'name':a30_0x222e80(0x1a9),'type':'string','description':'Pull\x20only\x20this\x20script\x20type','enum':[a30_0x222e80(0x1b1),a30_0x222e80(0x1b9),a30_0x222e80(0x1e1)]},{'name':a30_0x222e80(0x19d),'type':a30_0x222e80(0x1bb),'description':a30_0x222e80(0x1c7)}],async 'dryRun'(_0xd2d26){const _0x1bc43a=a30_0x222e80,_0x1788d7=loadBffProjectConfig(_0xd2d26['appCode']),_0x56a154=await readBffLockFile(_0x1788d7['lockFilePath']),{appLock:_0x2b77e9}=ensureLockScope(_0x56a154??createEmptyBffLock(),_0xd2d26[_0x1bc43a(0x1a5)],_0x1788d7[_0x1bc43a(0x1df)],_0x1bc43a(0x1ce)),_0x5a9aa4=normalizeBffType(_0xd2d26[_0x1bc43a(0x1d4)]('type'))??undefined,_0x36714d=buildDatasetCodeToAliasMap(_0xd2d26[_0x1bc43a(0x1cf)],_0xd2d26[_0x1bc43a(0x1a5)]),[_0x5cf490,_0x5bb380]=await Promise[_0x1bc43a(0x19e)]([listBffScripts(_0xd2d26[_0x1bc43a(0x1a5)],_0x5a9aa4),getBffScriptStatistics(_0xd2d26[_0x1bc43a(0x1a5)])]),_0x50087c=createHookLocationMap(_0x5bb380),_0xfd0f3a=[];for(const _0x31e030 of _0x5cf490){const _0x91bf17=resolveRemoteScriptTarget(_0x1788d7,_0x31e030,_0x50087c,_0x2b77e9[_0x1bc43a(0x1cc)],_0x36714d);if(!_0x91bf17){_0xfd0f3a['push']({'scriptType':_0x31e030[_0x1bc43a(0x1de)],'functionName':_0x31e030['functionName']??'','status':_0x1bc43a(0x1dc),'reason':'unresolvable\x20target\x20path'});continue;}const _0x150de7=_0x2b77e9[_0x1bc43a(0x1cc)][_0x91bf17[_0x1bc43a(0x1af)]],_0x3f7091=_0x31e030['scriptContent']!=null?computeContentHash(_0x31e030[_0x1bc43a(0x1d5)]):undefined,_0x534c64=await hasUnsyncedLocalChanges(_0x91bf17['filePath'],_0x150de7,_0x3f7091);_0xfd0f3a[_0x1bc43a(0x1a1)]({'lockKey':_0x91bf17[_0x1bc43a(0x1af)],'filePath':_0x91bf17[_0x1bc43a(0x1be)],'remoteId':_0x31e030['id']??null,'status':_0x534c64?_0x1bc43a(0x1cd):_0x1bc43a(0x1c4)});}return{'method':_0x1bc43a(0x1c5),'url':'/api/management/library/scripts/list?appCode='+_0xd2d26[_0x1bc43a(0x1a5)]+(_0x5a9aa4?'&type='+_0x5a9aa4:''),'body':{'appCode':_0xd2d26[_0x1bc43a(0x1a5)],'filterType':_0x5a9aa4??null,'files':_0xfd0f3a},'description':_0x1bc43a(0x199)+_0xfd0f3a['length']+'\x20remote\x20BFF\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4302b7){const _0x321e8a=a30_0x222e80,_0x31d09d=loadBffProjectConfig(_0x4302b7[_0x321e8a(0x1a5)]),_0x19a3c8=await readBffLockFile(_0x31d09d[_0x321e8a(0x1ad)]),{lockData:_0x307378,appLock:_0x20e152}=ensureLockScope(_0x19a3c8??createEmptyBffLock(),_0x4302b7[_0x321e8a(0x1a5)],_0x31d09d[_0x321e8a(0x1df)],_0x321e8a(0x1ce)),_0x1e1e08=normalizeBffType(_0x4302b7[_0x321e8a(0x1d4)](_0x321e8a(0x1a9)))??undefined;if(_0x4302b7['str'](_0x321e8a(0x1a9))&&!_0x1e1e08)throw CliErrors['validation'](_0x321e8a(0x1a7));const [_0x47e975,_0xa46fee]=await Promise['all']([listBffScripts(_0x4302b7[_0x321e8a(0x1a5)],_0x1e1e08),getBffScriptStatistics(_0x4302b7[_0x321e8a(0x1a5)])]);if(_0x47e975[_0x321e8a(0x1c0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x321e8a(0x1a0)};const _0x580be1=_0x4302b7[_0x321e8a(0x1b0)](_0x321e8a(0x19d));if(_0x580be1&&!_0x4302b7[_0x321e8a(0x1bc)]){const _0x5dbae0=await confirmForce();if(!_0x5dbae0)throw CliErrors[_0x321e8a(0x1bd)](_0x321e8a(0x1b2));}if(_0x580be1&&_0x4302b7[_0x321e8a(0x1bc)]){}const _0xaf2b53=buildDatasetCodeToAliasMap(_0x4302b7[_0x321e8a(0x1cf)],_0x4302b7[_0x321e8a(0x1a5)]),_0x3b9187=createHookLocationMap(_0xa46fee),_0x4ad371=JSON[_0x321e8a(0x1c2)](JSON[_0x321e8a(0x1ab)](_0x307378)),_0x52501d=_0x4302b7[_0x321e8a(0x1a5)],_0x6fa57d=_0x4ad371[_0x321e8a(0x1ac)][_0x52501d];if(!_0x6fa57d)throw new Error(_0x321e8a(0x1b5)+_0x52501d+_0x321e8a(0x1d9));const _0x13d448=[],_0x3917da=[],_0x89fb7d=[];for(const _0xa02e4d of _0x47e975){const _0xfa6cc2=resolveRemoteScriptTarget(_0x31d09d,_0xa02e4d,_0x3b9187,_0x20e152[_0x321e8a(0x1cc)],_0xaf2b53);if(!_0xfa6cc2){_0x3917da['push']({'lockKey':_0xa02e4d[_0x321e8a(0x1de)]+'/'+_0xa02e4d[_0x321e8a(0x1c8)],'reason':_0x321e8a(0x1c1)});continue;}const _0x4e6cbb=_0x20e152[_0x321e8a(0x1cc)][_0xfa6cc2['lockKey']];try{if(!_0xa02e4d['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0xa02e4d['scriptContent']==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x494a08=_0xa02e4d[_0x321e8a(0x1d5)],_0xe4a94d=computeContentHash(_0x494a08);if(!_0x580be1){const _0x54b728=await hasUnsyncedLocalChanges(_0xfa6cc2[_0x321e8a(0x1be)],_0x4e6cbb,_0xe4a94d);if(_0x54b728){_0x3917da[_0x321e8a(0x1a1)]({'lockKey':_0xfa6cc2[_0x321e8a(0x1af)],'reason':_0x321e8a(0x1a4)});continue;}}await ensureParentDirectory(_0xfa6cc2[_0x321e8a(0x1be)]),await writeFile(_0xfa6cc2[_0x321e8a(0x1be)],_0x494a08,_0x321e8a(0x1aa));const _0x6daf55={'hash':_0xe4a94d,'remoteId':_0xa02e4d['id'],'version':_0xa02e4d[_0x321e8a(0x1e0)]};_0xfa6cc2[_0x321e8a(0x1a9)]==='HOOK'&&_0xfa6cc2[_0x321e8a(0x1c9)]&&(_0x6daf55[_0x321e8a(0x1ba)]=_0xfa6cc2[_0x321e8a(0x1c9)]['alias'],_0x6daf55[_0x321e8a(0x1b3)]=_0xfa6cc2[_0x321e8a(0x1c9)][_0x321e8a(0x1b3)],_0x6daf55['operationType']=_0xfa6cc2[_0x321e8a(0x1c9)][_0x321e8a(0x1c3)],_0x6daf55[_0x321e8a(0x1c6)]=_0xfa6cc2[_0x321e8a(0x1c9)]['functionNode']),_0x6fa57d[_0x321e8a(0x1cc)][_0xfa6cc2['lockKey']]=_0x6daf55,_0x13d448[_0x321e8a(0x1a1)]({'lockKey':_0xfa6cc2['lockKey'],'remoteId':_0xa02e4d['id']});}catch(_0x4a6bb9){_0x89fb7d['push']({'lockKey':_0xfa6cc2[_0x321e8a(0x1af)],'error':_0x4a6bb9 instanceof Error?_0x4a6bb9[_0x321e8a(0x19b)]:String(_0x4a6bb9)});}}return _0x6fa57d[_0x321e8a(0x1b8)]=new Date()['toISOString'](),await writeBffLockFile(_0x31d09d[_0x321e8a(0x1ad)],_0x4ad371),{'ok':_0x89fb7d[_0x321e8a(0x1c0)]===0x0,'data':{'pulled':_0x13d448,'skipped':_0x3917da,'failed':_0x89fb7d},'message':_0x321e8a(0x19c)+_0x13d448['length']+_0x321e8a(0x1d3)+_0x3917da[_0x321e8a(0x1c0)]+_0x321e8a(0x1da)+_0x89fb7d[_0x321e8a(0x1c0)]+_0x321e8a(0x1b4)};}};async function hasUnsyncedLocalChanges(_0x4c1689,_0x148004,_0x76f011){const _0x23d5d0=a30_0x222e80;if(!await fileExists(_0x4c1689))return![];const _0x2fae5f=await computeFileHash(_0x4c1689);if(!_0x148004)return _0x76f011?_0x2fae5f!==_0x76f011:!![];return _0x2fae5f!==_0x148004[_0x23d5d0(0x1a6)];}function buildDatasetCodeToAliasMap(_0x1079fe,_0xf3a005){const _0x45ef42=a30_0x222e80,_0x26f937=loadAliasMap(_0x1079fe,undefined,resolveApiFilePath(_0x1079fe,_0xf3a005));return new Map(_0x26f937[_0x45ef42(0x1a8)](_0x187dab=>[_0x187dab['datasetCode'],_0x187dab[_0x45ef42(0x1ba)]]));}async function confirmForce(){const _0x2297b8=a30_0x222e80,_0x2f151f=createInterface({'input':process[_0x2297b8(0x1ae)],'output':process['stderr']}),_0x25bbd1=await new Promise(_0x4aebfe=>{const _0x77a5ba=_0x2297b8;_0x2f151f[_0x77a5ba(0x1ca)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x4aebfe);});return _0x2f151f[_0x2297b8(0x1bf)](),['y','yes'][_0x2297b8(0x19f)](_0x25bbd1[_0x2297b8(0x1d1)]()[_0x2297b8(0x1d8)]());}function a30_0x5b78(_0x57ce98,_0x1edc89){_0x57ce98=_0x57ce98-0x199;const _0x581009=a30_0x5810();let _0x5b7855=_0x581009[_0x57ce98];return _0x5b7855;}function a30_0x5810(){const _0x3465af=['nonInteractive','cancelled','filePath','close','length','unresolvable\x20target\x20path','parse','operationType','would_pull','GET','functionNode','Force\x20overwrite\x20local\x20unsynced\x20changes','functionName','hookLocation','question','2655888NSvgqA','functions','conflict','pull','apiDir','12BmlQLs','trim','1897623NKJTRr','\x20pulled,\x20','str','scriptContent','write','1027971ZGLqNU','toLowerCase','\x22\x20not\x20found\x20after\x20ensureLockScope.','\x20skipped,\x20','866548tgFJXJ','skipped','bff','scriptType','scriptsRoot','version','HOOK','Would\x20inspect\x20','63ZeLBpE','message','Pull\x20complete:\x20','force','all','includes','No\x20remote\x20BFF\x20scripts\x20found.','push','155788EIuzCa','7662966jfvloS','local\x20unsynced\x20changes','appCode','hash','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','map','type','utf8','stringify','apps','lockFilePath','stdin','lockKey','bool','COMMON','Force\x20pull\x20cancelled.','datasetCode','\x20failed','Lock\x20scope\x20for\x20app\x20\x22','1716350mbCQyc','Pull\x20remote\x20BFF\x20scripts\x20to\x20local','lastSync','ENDPOINT','alias','boolean'];a30_0x5810=function(){return _0x3465af;};return a30_0x5810();}
|
package/lib/commands/bff/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x4256bd=a31_0x2fba;(function(_0x402c7c,_0x196db9){const _0x39d82f=a31_0x2fba,_0x13342d=_0x402c7c();while(!![]){try{const _0x18d995=parseInt(_0x39d82f(0x206))/0x1+parseInt(_0x39d82f(0x20c))/0x2*(parseInt(_0x39d82f(0x21d))/0x3)+-parseInt(_0x39d82f(0x223))/0x4*(-parseInt(_0x39d82f(0x1e5))/0x5)+parseInt(_0x39d82f(0x221))/0x6*(-parseInt(_0x39d82f(0x1fe))/0x7)+-parseInt(_0x39d82f(0x1f9))/0x8+-parseInt(_0x39d82f(0x21c))/0x9+-parseInt(_0x39d82f(0x211))/0xa*(-parseInt(_0x39d82f(0x1e7))/0xb);if(_0x18d995===_0x196db9)break;else _0x13342d['push'](_0x13342d['shift']());}catch(_0x28c352){_0x13342d['push'](_0x13342d['shift']());}}}(a31_0x4b54,0xd8974));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets}from'../../core/api-client.js';function a31_0x2fba(_0x123eeb,_0x20a4d6){_0x123eeb=_0x123eeb-0x1e4;const _0x4b5452=a31_0x4b54();let _0x2fbaff=_0x4b5452[_0x123eeb];return _0x2fbaff;}import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';function a31_0x4b54(){const _0x23c0d4=['boolean','high-risk-write','lockFilePath','58280oXfdat','str','scriptsRoot','lastSync','Force\x20push\x20ignoring\x20hash\x20protection','description','apiDir','has','remoteId','functions','Push\x20local\x20BFF\x20scripts\x20to\x20remote','5133312pBDhGH','12yoWuFY','datasetCode','Run\x20`','datasetId','10402158kXYQLh','appCode','1984388LSbFBV','aliasToDatasetCode','type','ENDPOINT','Push\x20complete:\x20','No\x20local\x20BFF\x20functions\x20found.','COMMON','/api/management/library/scripts/save','5HSamkd','version','5390aGEHgf','Incomplete\x20HOOK\x20path:\x20','\x22.\x20','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','\x20local\x20BFF\x20script(s)\x20for\x20push','lockKey','map','functionNode','push','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.','toISOString','operationType','validation','utf8','HOOK','values','length','alias','7129664dJuzUa','get','bff','force','Cannot\x20resolve\x20dataset\x20for\x20\x22','7OOrvMS','string','filePath','hash','unchanged','\x20uploaded,\x20','Push\x20only\x20this\x20script\x20type','some','45436Iqrdjq','bool','Local\x20function\x20not\x20found:\x20','name','Would\x20inspect\x20','would_push','342586oyeINX','update'];a31_0x4b54=function(){return _0x23c0d4;};return a31_0x4b54();}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_0x4256bd(0x1fb),'command':'push','description':a31_0x4256bd(0x21b),'risk':a31_0x4256bd(0x20f),'flags':[{'name':a31_0x4256bd(0x225),'type':a31_0x4256bd(0x1ff),'description':a31_0x4256bd(0x204),'enum':[a31_0x4256bd(0x229),a31_0x4256bd(0x226),a31_0x4256bd(0x1f5)]},{'name':a31_0x4256bd(0x209),'type':a31_0x4256bd(0x1ff),'description':'Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)'},{'name':a31_0x4256bd(0x1fc),'type':a31_0x4256bd(0x20e),'description':a31_0x4256bd(0x215)}],async 'dryRun'(_0x5f2310){const _0x59f9ad=a31_0x4256bd,_0x274692=loadBffProjectConfig(_0x5f2310[_0x59f9ad(0x222)]),_0xe7ed2b=await readBffLockFile(_0x274692[_0x59f9ad(0x210)]),{appLock:_0x360eb2}=ensureLockScope(_0xe7ed2b??createEmptyBffLock(),_0x5f2310[_0x59f9ad(0x222)],_0x274692[_0x59f9ad(0x213)],_0x59f9ad(0x1ef)),_0x56655b=await getTargetFunctions(_0x274692,_0x5f2310),_0x101066=_0x5f2310['bool'](_0x59f9ad(0x1fc)),_0x2eadea=[];for(const _0x3a7b28 of _0x56655b){const _0x291e18=await computeFileHash(_0x3a7b28[_0x59f9ad(0x200)]),_0xb8aa06=_0x360eb2['functions'][_0x3a7b28[_0x59f9ad(0x1ec)]],_0x3950dc=!!_0xb8aa06&&_0xb8aa06[_0x59f9ad(0x201)]===_0x291e18;_0x2eadea[_0x59f9ad(0x1ef)]({'lockKey':_0x3a7b28[_0x59f9ad(0x1ec)],'filePath':_0x3a7b28[_0x59f9ad(0x200)],'remoteId':_0xb8aa06?.[_0x59f9ad(0x219)]??null,'mode':_0xb8aa06?.[_0x59f9ad(0x219)]?_0x59f9ad(0x20d):'create','status':!_0x101066&&_0x3950dc?_0x59f9ad(0x202):_0x59f9ad(0x20b)});}return{'method':'POST','url':_0x59f9ad(0x1e4),'body':{'appCode':_0x5f2310['appCode'],'force':_0x101066,'files':_0x2eadea},'description':_0x59f9ad(0x20a)+_0x2eadea['length']+_0x59f9ad(0x1eb)};},async 'execute'(_0x5b4d45){const _0x3a9ec0=a31_0x4256bd,_0x16d571=loadBffProjectConfig(_0x5b4d45[_0x3a9ec0(0x222)]),_0x3dde48=await readBffLockFile(_0x16d571[_0x3a9ec0(0x210)]),{lockData:_0x3bc190,appLock:_0x3d8020}=ensureLockScope(_0x3dde48??createEmptyBffLock(),_0x5b4d45[_0x3a9ec0(0x222)],_0x16d571[_0x3a9ec0(0x213)],'push'),_0x383f0e=await getTargetFunctions(_0x16d571,_0x5b4d45);if(_0x383f0e[_0x3a9ec0(0x1f7)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x3a9ec0(0x228)};const _0x5e2ac0=_0x5b4d45[_0x3a9ec0(0x207)](_0x3a9ec0(0x1fc)),_0x2c15a2=await buildHookMaps(_0x5b4d45[_0x3a9ec0(0x222)],_0x5b4d45[_0x3a9ec0(0x217)],_0x383f0e,_0x3d8020),_0x37f938=[],_0x2fe0d8=[],_0xbfbcb=[];for(const _0x44fd55 of _0x383f0e){const _0x336a4b=await computeFileHash(_0x44fd55[_0x3a9ec0(0x200)]),_0xa502c4=_0x3d8020[_0x3a9ec0(0x21a)][_0x44fd55[_0x3a9ec0(0x1ec)]];if(!_0x5e2ac0&&_0xa502c4&&_0xa502c4[_0x3a9ec0(0x201)]===_0x336a4b){_0x2fe0d8[_0x3a9ec0(0x1ef)]({'lockKey':_0x44fd55[_0x3a9ec0(0x1ec)],'reason':_0x3a9ec0(0x202)});continue;}try{await uploadSingleFunction(_0x5b4d45[_0x3a9ec0(0x222)],_0x44fd55,_0x3d8020,_0x2c15a2);const _0x43e6d1=_0x3d8020[_0x3a9ec0(0x21a)][_0x44fd55[_0x3a9ec0(0x1ec)]];_0x37f938[_0x3a9ec0(0x1ef)]({'lockKey':_0x44fd55[_0x3a9ec0(0x1ec)],'remoteId':_0x43e6d1?.[_0x3a9ec0(0x219)]??0x0});}catch(_0x5d9ae8){_0xbfbcb[_0x3a9ec0(0x1ef)]({'lockKey':_0x44fd55[_0x3a9ec0(0x1ec)],'error':_0x5d9ae8 instanceof Error?_0x5d9ae8['message']:String(_0x5d9ae8)});}}return _0x3d8020[_0x3a9ec0(0x214)]=new Date()[_0x3a9ec0(0x1f1)](),await writeBffLockFile(_0x16d571[_0x3a9ec0(0x210)],_0x3bc190),{'ok':_0xbfbcb[_0x3a9ec0(0x1f7)]===0x0,'data':{'uploaded':_0x37f938,'skipped':_0x2fe0d8,'failed':_0xbfbcb},'message':_0x3a9ec0(0x227)+_0x37f938[_0x3a9ec0(0x1f7)]+_0x3a9ec0(0x203)+_0x2fe0d8[_0x3a9ec0(0x1f7)]+'\x20skipped,\x20'+_0xbfbcb[_0x3a9ec0(0x1f7)]+'\x20failed'};}};async function getTargetFunctions(_0x349cff,_0x48fa7a){const _0x37e98e=a31_0x4256bd,_0x449e94=_0x48fa7a['str']('type'),_0x23c4c3=_0x48fa7a[_0x37e98e(0x212)](_0x37e98e(0x209)),_0x270433=normalizeBffType(_0x449e94)??undefined;if(_0x23c4c3&&!_0x270433)throw CliErrors[_0x37e98e(0x1f3)](_0x37e98e(0x1f0));const _0x52d02f=await scanLocalBffFunctions(_0x349cff,_0x270433);if(_0x23c4c3){const _0x426b4f=_0x52d02f['filter'](_0x93072=>_0x93072[_0x37e98e(0x209)]===_0x23c4c3);if(_0x426b4f[_0x37e98e(0x1f7)]===0x0)throw CliErrors[_0x37e98e(0x1f3)](_0x37e98e(0x208)+_0x270433+'/'+_0x23c4c3);return _0x426b4f;}return _0x52d02f;}async function buildHookMaps(_0x45e866,_0x45f525,_0x3152e0,_0x489da7){const _0xfff472=a31_0x4256bd,_0x341731=_0x3152e0[_0xfff472(0x205)](_0x39ffad=>_0x39ffad[_0xfff472(0x225)]===_0xfff472(0x1f5));if(!_0x341731)return{'aliasToDatasetCode':new Map(),'datasetCodeToId':new Map()};const _0x1a98b6=loadAliasMap(_0x45f525,undefined,resolveApiFilePath(_0x45f525,_0x45e866)),_0x6bec5c=new Map(_0x1a98b6[_0xfff472(0x1ed)](_0x11b127=>[_0x11b127[_0xfff472(0x1f8)],_0x11b127[_0xfff472(0x21e)]]));for(const _0x38c6dc of Object[_0xfff472(0x1f6)](_0x489da7['functions'])){_0x38c6dc[_0xfff472(0x1f8)]&&_0x38c6dc[_0xfff472(0x21e)]&&!_0x6bec5c[_0xfff472(0x218)](_0x38c6dc[_0xfff472(0x1f8)])&&_0x6bec5c['set'](_0x38c6dc['alias'],_0x38c6dc['datasetCode']);}const _0x2fe436=await listDatasets(_0x45e866),_0x402c0e=new Map(_0x2fe436[_0xfff472(0x1ed)](_0x510c0e=>[_0x510c0e['code'],_0x510c0e['id']]));return{'aliasToDatasetCode':_0x6bec5c,'datasetCodeToId':_0x402c0e};}async function uploadSingleFunction(_0x5db8ae,_0x32e28b,_0x3f0085,_0x290ec2){const _0x55d6f4=a31_0x4256bd,_0x5b9f8c=await readFile(_0x32e28b[_0x55d6f4(0x200)],_0x55d6f4(0x1f4)),_0x40abb9=await computeFileHash(_0x32e28b[_0x55d6f4(0x200)]),_0x28f2c7=_0x3f0085['functions'][_0x32e28b[_0x55d6f4(0x1ec)]];if(_0x28f2c7?.[_0x55d6f4(0x219)]&&_0x28f2c7[_0x55d6f4(0x1e6)]==null)throw CliErrors[_0x55d6f4(0x1f3)](_0x32e28b[_0x55d6f4(0x1ec)]+':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.');let _0x502aa9=extractScriptDescription(_0x5b9f8c);if(!_0x502aa9&&_0x28f2c7?.['remoteId']){const _0x4d5a60=await getBffScriptInfo(_0x28f2c7[_0x55d6f4(0x219)]);_0x502aa9=_0x4d5a60[_0x55d6f4(0x216)]||undefined;}const _0x39ec50={'appCode':_0x5db8ae,'functionName':_0x32e28b[_0x55d6f4(0x209)],'scriptType':_0x32e28b[_0x55d6f4(0x225)],'scriptContent':_0x5b9f8c};if(_0x28f2c7?.['remoteId'])_0x39ec50['id']=_0x28f2c7[_0x55d6f4(0x219)];if(_0x28f2c7?.[_0x55d6f4(0x1e6)]!=null)_0x39ec50[_0x55d6f4(0x1e6)]=_0x28f2c7['version'];if(_0x502aa9)_0x39ec50[_0x55d6f4(0x216)]=_0x502aa9;if(_0x32e28b['type']==='HOOK'){const _0x3d77ef=_0x32e28b[_0x55d6f4(0x1f8)];if(!_0x3d77ef||!_0x32e28b[_0x55d6f4(0x1f2)]||!_0x32e28b[_0x55d6f4(0x1ee)])throw CliErrors[_0x55d6f4(0x1f3)](_0x55d6f4(0x1e8)+_0x32e28b[_0x55d6f4(0x1ec)]);const _0x2fc031=_0x290ec2[_0x55d6f4(0x224)][_0x55d6f4(0x1fa)](_0x3d77ef)??_0x28f2c7?.[_0x55d6f4(0x21e)]??_0x3d77ef,_0x2c94ce=_0x290ec2['datasetCodeToId']['get'](_0x2fc031);if(!_0x2c94ce)throw CliErrors[_0x55d6f4(0x1f3)](_0x55d6f4(0x1fd)+_0x3d77ef+_0x55d6f4(0x1e9)+(_0x55d6f4(0x21f)+CLI_BIN_NAME+_0x55d6f4(0x1ea)));_0x39ec50[_0x55d6f4(0x220)]=_0x2c94ce,_0x39ec50[_0x55d6f4(0x1f2)]=_0x32e28b['operationType'],_0x39ec50[_0x55d6f4(0x1ee)]=_0x32e28b[_0x55d6f4(0x1ee)];}const _0x84b9ef=await saveBffScript(_0x39ec50),_0x21cab9=await getBffScriptInfo(_0x84b9ef),_0x56b978={'hash':_0x40abb9,'remoteId':_0x84b9ef,'version':_0x21cab9[_0x55d6f4(0x1e6)]};if(_0x32e28b[_0x55d6f4(0x225)]===_0x55d6f4(0x1f5)){const _0xe669f0=_0x32e28b[_0x55d6f4(0x1f8)],_0x319401=_0x290ec2['aliasToDatasetCode']['get'](_0xe669f0)??_0x28f2c7?.[_0x55d6f4(0x21e)]??_0xe669f0;_0x290ec2['aliasToDatasetCode'][_0x55d6f4(0x218)](_0xe669f0)?_0x56b978['alias']=_0xe669f0:_0x56b978[_0x55d6f4(0x1f8)]=_0x28f2c7?.[_0x55d6f4(0x1f8)],_0x56b978[_0x55d6f4(0x21e)]=_0x319401,_0x56b978[_0x55d6f4(0x1f2)]=_0x32e28b[_0x55d6f4(0x1f2)],_0x56b978['functionNode']=_0x32e28b[_0x55d6f4(0x1ee)];}_0x3f0085[_0x55d6f4(0x21a)][_0x32e28b[_0x55d6f4(0x1ec)]]=_0x56b978;}
|
|
1
|
+
const a31_0x11b2ce=a31_0x5b21;(function(_0xbed07e,_0x5bde8e){const _0x392537=a31_0x5b21,_0x5396e9=_0xbed07e();while(!![]){try{const _0x9572c=-parseInt(_0x392537(0x140))/0x1*(-parseInt(_0x392537(0x142))/0x2)+-parseInt(_0x392537(0x14b))/0x3*(-parseInt(_0x392537(0x162))/0x4)+-parseInt(_0x392537(0x136))/0x5*(-parseInt(_0x392537(0x165))/0x6)+-parseInt(_0x392537(0x157))/0x7*(parseInt(_0x392537(0x161))/0x8)+-parseInt(_0x392537(0x141))/0x9*(parseInt(_0x392537(0x13c))/0xa)+parseInt(_0x392537(0x139))/0xb*(-parseInt(_0x392537(0x152))/0xc)+parseInt(_0x392537(0x131))/0xd*(parseInt(_0x392537(0x168))/0xe);if(_0x9572c===_0x5bde8e)break;else _0x5396e9['push'](_0x5396e9['shift']());}catch(_0x3aa2b3){_0x5396e9['push'](_0x5396e9['shift']());}}}(a31_0x5939,0x684e1));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets}from'../../core/api-client.js';function a31_0x5939(){const _0x3e3bb3=['Cannot\x20resolve\x20dataset\x20for\x20\x22','aliasToDatasetCode','operationType','message','length','filePath','107136hfqnPD','toISOString','Local\x20function\x20not\x20found:\x20','Run\x20`','create','7mMuEVM','Push\x20complete:\x20','lastSync','Incomplete\x20HOOK\x20path:\x20','\x20skipped,\x20','type','scriptsRoot','version','Push\x20only\x20this\x20script\x20type','has','6831192Faroxr','1991172vvLMAp','boolean','string','472218THrtPV','datasetCode','alias','288204zZcvcF','filter','name','Push\x20local\x20BFF\x20scripts\x20to\x20remote','force','appCode','apiDir','update','validation','datasetId','bff','ENDPOINT',':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.','hash','Would\x20inspect\x20','remoteId','str','functionNode','POST','high-risk-write','HOOK','unchanged','182oxyyCD','would_push','bool','COMMON','lockFilePath','35zffFJJ','description','\x20uploaded,\x20','1045zUrDpu','set','functions','239150CqNbAc','code','datasetCodeToId','get','48017FtqnxF','9bOMwXA','34vMQCdw','map','\x20failed','\x20local\x20BFF\x20script(s)\x20for\x20push','No\x20local\x20BFF\x20functions\x20found.','lockKey','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','push','some','3OQVRru'];a31_0x5939=function(){return _0x3e3bb3;};return a31_0x5939();}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_0x11b2ce(0x125),'command':a31_0x11b2ce(0x149),'description':a31_0x11b2ce(0x11e),'risk':a31_0x11b2ce(0x12e),'flags':[{'name':'type','type':a31_0x11b2ce(0x164),'description':a31_0x11b2ce(0x15f),'enum':[a31_0x11b2ce(0x134),a31_0x11b2ce(0x126),a31_0x11b2ce(0x12f)]},{'name':a31_0x11b2ce(0x11d),'type':'string','description':'Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)'},{'name':a31_0x11b2ce(0x11f),'type':a31_0x11b2ce(0x163),'description':'Force\x20push\x20ignoring\x20hash\x20protection'}],async 'dryRun'(_0x346750){const _0x14e8ed=a31_0x11b2ce,_0x19798a=loadBffProjectConfig(_0x346750[_0x14e8ed(0x120)]),_0x36cacb=await readBffLockFile(_0x19798a[_0x14e8ed(0x135)]),{appLock:_0x40349f}=ensureLockScope(_0x36cacb??createEmptyBffLock(),_0x346750[_0x14e8ed(0x120)],_0x19798a['scriptsRoot'],'push'),_0x4c79ae=await getTargetFunctions(_0x19798a,_0x346750),_0x162c5d=_0x346750[_0x14e8ed(0x133)]('force'),_0x2b3b8f=[];for(const _0x3a1eda of _0x4c79ae){const _0x4d50ba=await computeFileHash(_0x3a1eda[_0x14e8ed(0x151)]),_0x4d36de=_0x40349f[_0x14e8ed(0x13b)][_0x3a1eda[_0x14e8ed(0x147)]],_0x1b2db8=!!_0x4d36de&&_0x4d36de[_0x14e8ed(0x128)]===_0x4d50ba;_0x2b3b8f[_0x14e8ed(0x149)]({'lockKey':_0x3a1eda[_0x14e8ed(0x147)],'filePath':_0x3a1eda[_0x14e8ed(0x151)],'remoteId':_0x4d36de?.[_0x14e8ed(0x12a)]??null,'mode':_0x4d36de?.[_0x14e8ed(0x12a)]?_0x14e8ed(0x122):_0x14e8ed(0x156),'status':!_0x162c5d&&_0x1b2db8?_0x14e8ed(0x130):_0x14e8ed(0x132)});}return{'method':_0x14e8ed(0x12d),'url':'/api/management/library/scripts/save','body':{'appCode':_0x346750['appCode'],'force':_0x162c5d,'files':_0x2b3b8f},'description':_0x14e8ed(0x129)+_0x2b3b8f['length']+_0x14e8ed(0x145)};},async 'execute'(_0x10fb97){const _0x42c6e5=a31_0x11b2ce,_0x27b507=loadBffProjectConfig(_0x10fb97[_0x42c6e5(0x120)]),_0x386598=await readBffLockFile(_0x27b507[_0x42c6e5(0x135)]),{lockData:_0x2a2c4d,appLock:_0x562bbe}=ensureLockScope(_0x386598??createEmptyBffLock(),_0x10fb97['appCode'],_0x27b507[_0x42c6e5(0x15d)],_0x42c6e5(0x149)),_0x13274e=await getTargetFunctions(_0x27b507,_0x10fb97);if(_0x13274e[_0x42c6e5(0x150)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x42c6e5(0x146)};const _0x5b36e6=_0x10fb97[_0x42c6e5(0x133)]('force'),_0x3826ee=await buildHookMaps(_0x10fb97[_0x42c6e5(0x120)],_0x10fb97[_0x42c6e5(0x121)],_0x13274e,_0x562bbe),_0x2e4511=[],_0xf1576c=[],_0xb6b087=[];for(const _0x272ee3 of _0x13274e){const _0x498b98=await computeFileHash(_0x272ee3[_0x42c6e5(0x151)]),_0x2362c3=_0x562bbe[_0x42c6e5(0x13b)][_0x272ee3[_0x42c6e5(0x147)]];if(!_0x5b36e6&&_0x2362c3&&_0x2362c3['hash']===_0x498b98){_0xf1576c[_0x42c6e5(0x149)]({'lockKey':_0x272ee3[_0x42c6e5(0x147)],'reason':_0x42c6e5(0x130)});continue;}try{await uploadSingleFunction(_0x10fb97[_0x42c6e5(0x120)],_0x272ee3,_0x562bbe,_0x3826ee);const _0x3bbf33=_0x562bbe[_0x42c6e5(0x13b)][_0x272ee3['lockKey']];_0x2e4511[_0x42c6e5(0x149)]({'lockKey':_0x272ee3[_0x42c6e5(0x147)],'remoteId':_0x3bbf33?.[_0x42c6e5(0x12a)]??0x0});}catch(_0x46192b){_0xb6b087[_0x42c6e5(0x149)]({'lockKey':_0x272ee3[_0x42c6e5(0x147)],'error':_0x46192b instanceof Error?_0x46192b[_0x42c6e5(0x14f)]:String(_0x46192b)});}}return _0x562bbe[_0x42c6e5(0x159)]=new Date()[_0x42c6e5(0x153)](),await writeBffLockFile(_0x27b507[_0x42c6e5(0x135)],_0x2a2c4d),{'ok':_0xb6b087['length']===0x0,'data':{'uploaded':_0x2e4511,'skipped':_0xf1576c,'failed':_0xb6b087},'message':_0x42c6e5(0x158)+_0x2e4511[_0x42c6e5(0x150)]+_0x42c6e5(0x138)+_0xf1576c[_0x42c6e5(0x150)]+_0x42c6e5(0x15b)+_0xb6b087[_0x42c6e5(0x150)]+_0x42c6e5(0x144)};}};async function getTargetFunctions(_0x3e8ffe,_0xdd2a09){const _0x3f8422=a31_0x11b2ce,_0x713a59=_0xdd2a09['str'](_0x3f8422(0x15c)),_0x42ca8d=_0xdd2a09[_0x3f8422(0x12b)]('name'),_0x4fe330=normalizeBffType(_0x713a59)??undefined;if(_0x42ca8d&&!_0x4fe330)throw CliErrors['validation']('--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.');const _0x59fb5e=await scanLocalBffFunctions(_0x3e8ffe,_0x4fe330);if(_0x42ca8d){const _0x390504=_0x59fb5e[_0x3f8422(0x11c)](_0x216c49=>_0x216c49[_0x3f8422(0x11d)]===_0x42ca8d);if(_0x390504[_0x3f8422(0x150)]===0x0)throw CliErrors[_0x3f8422(0x123)](_0x3f8422(0x154)+_0x4fe330+'/'+_0x42ca8d);return _0x390504;}return _0x59fb5e;}function a31_0x5b21(_0x420e06,_0x4219c3){_0x420e06=_0x420e06-0x11c;const _0x593910=a31_0x5939();let _0x5b2103=_0x593910[_0x420e06];return _0x5b2103;}async function buildHookMaps(_0x7bbfbe,_0x1937aa,_0x349be2,_0x1d296c){const _0x311057=a31_0x11b2ce,_0x12a011=_0x349be2[_0x311057(0x14a)](_0x3845e1=>_0x3845e1['type']==='HOOK');if(!_0x12a011)return{'aliasToDatasetCode':new Map(),'datasetCodeToId':new Map()};const _0x350042=loadAliasMap(_0x1937aa,undefined,resolveApiFilePath(_0x1937aa,_0x7bbfbe)),_0x43362c=new Map(_0x350042[_0x311057(0x143)](_0xeb0b24=>[_0xeb0b24['alias'],_0xeb0b24[_0x311057(0x166)]]));for(const _0x60462a of Object['values'](_0x1d296c[_0x311057(0x13b)])){_0x60462a[_0x311057(0x167)]&&_0x60462a['datasetCode']&&!_0x43362c[_0x311057(0x160)](_0x60462a[_0x311057(0x167)])&&_0x43362c[_0x311057(0x13a)](_0x60462a['alias'],_0x60462a[_0x311057(0x166)]);}const _0x209c50=await listDatasets(_0x7bbfbe),_0x5e5887=new Map(_0x209c50['map'](_0x2efd6f=>[_0x2efd6f[_0x311057(0x13d)],_0x2efd6f['id']]));return{'aliasToDatasetCode':_0x43362c,'datasetCodeToId':_0x5e5887};}async function uploadSingleFunction(_0x379ec5,_0x3b6788,_0x1c5a9d,_0x298ecd){const _0x36b6dd=a31_0x11b2ce,_0x56b648=await readFile(_0x3b6788[_0x36b6dd(0x151)],'utf8'),_0x1580e5=await computeFileHash(_0x3b6788[_0x36b6dd(0x151)]),_0x353346=_0x1c5a9d[_0x36b6dd(0x13b)][_0x3b6788[_0x36b6dd(0x147)]];if(_0x353346?.['remoteId']&&_0x353346[_0x36b6dd(0x15e)]==null)throw CliErrors[_0x36b6dd(0x123)](_0x3b6788[_0x36b6dd(0x147)]+_0x36b6dd(0x127));let _0x3835ed=extractScriptDescription(_0x56b648);if(!_0x3835ed&&_0x353346?.[_0x36b6dd(0x12a)]){const _0x2f590=await getBffScriptInfo(_0x353346[_0x36b6dd(0x12a)]);_0x3835ed=_0x2f590[_0x36b6dd(0x137)]||undefined;}const _0x4216c4={'appCode':_0x379ec5,'functionName':_0x3b6788[_0x36b6dd(0x11d)],'scriptType':_0x3b6788[_0x36b6dd(0x15c)],'scriptContent':_0x56b648};if(_0x353346?.[_0x36b6dd(0x12a)])_0x4216c4['id']=_0x353346[_0x36b6dd(0x12a)];if(_0x353346?.['version']!=null)_0x4216c4[_0x36b6dd(0x15e)]=_0x353346[_0x36b6dd(0x15e)];if(_0x3835ed)_0x4216c4[_0x36b6dd(0x137)]=_0x3835ed;if(_0x3b6788[_0x36b6dd(0x15c)]===_0x36b6dd(0x12f)){const _0x18d676=_0x3b6788[_0x36b6dd(0x167)];if(!_0x18d676||!_0x3b6788[_0x36b6dd(0x14e)]||!_0x3b6788[_0x36b6dd(0x12c)])throw CliErrors[_0x36b6dd(0x123)](_0x36b6dd(0x15a)+_0x3b6788[_0x36b6dd(0x147)]);const _0x25971c=_0x298ecd[_0x36b6dd(0x14d)]['get'](_0x18d676)??_0x353346?.[_0x36b6dd(0x166)]??_0x18d676,_0x1e2209=_0x298ecd[_0x36b6dd(0x13e)][_0x36b6dd(0x13f)](_0x25971c);if(!_0x1e2209)throw CliErrors[_0x36b6dd(0x123)](_0x36b6dd(0x14c)+_0x18d676+'\x22.\x20'+(_0x36b6dd(0x155)+CLI_BIN_NAME+_0x36b6dd(0x148)));_0x4216c4[_0x36b6dd(0x124)]=_0x1e2209,_0x4216c4[_0x36b6dd(0x14e)]=_0x3b6788[_0x36b6dd(0x14e)],_0x4216c4['functionNode']=_0x3b6788[_0x36b6dd(0x12c)];}const _0x2bb8a9=await saveBffScript(_0x4216c4),_0x8cf15d=await getBffScriptInfo(_0x2bb8a9),_0x3ac9b2={'hash':_0x1580e5,'remoteId':_0x2bb8a9,'version':_0x8cf15d[_0x36b6dd(0x15e)]};if(_0x3b6788[_0x36b6dd(0x15c)]===_0x36b6dd(0x12f)){const _0x5f3873=_0x3b6788[_0x36b6dd(0x167)],_0x1cd918=_0x298ecd['aliasToDatasetCode'][_0x36b6dd(0x13f)](_0x5f3873)??_0x353346?.[_0x36b6dd(0x166)]??_0x5f3873;_0x298ecd[_0x36b6dd(0x14d)][_0x36b6dd(0x160)](_0x5f3873)?_0x3ac9b2[_0x36b6dd(0x167)]=_0x5f3873:_0x3ac9b2[_0x36b6dd(0x167)]=_0x353346?.[_0x36b6dd(0x167)],_0x3ac9b2[_0x36b6dd(0x166)]=_0x1cd918,_0x3ac9b2[_0x36b6dd(0x14e)]=_0x3b6788[_0x36b6dd(0x14e)],_0x3ac9b2[_0x36b6dd(0x12c)]=_0x3b6788[_0x36b6dd(0x12c)];}_0x1c5a9d['functions'][_0x3b6788[_0x36b6dd(0x147)]]=_0x3ac9b2;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x4e2b0d=a32_0x2900;(function(_0x16bd4e,_0x277ae7){const _0x842ddf=a32_0x2900,_0x3c179b=_0x16bd4e();while(!![]){try{const _0x2af239=-parseInt(_0x842ddf(0x69))/0x1*(parseInt(_0x842ddf(0x6b))/0x2)+-parseInt(_0x842ddf(0x75))/0x3*(parseInt(_0x842ddf(0x74))/0x4)+parseInt(_0x842ddf(0x78))/0x5*(parseInt(_0x842ddf(0x76))/0x6)+-parseInt(_0x842ddf(0x82))/0x7*(-parseInt(_0x842ddf(0x80))/0x8)+parseInt(_0x842ddf(0x67))/0x9+-parseInt(_0x842ddf(0x79))/0xa+parseInt(_0x842ddf(0x6c))/0xb;if(_0x2af239===_0x277ae7)break;else _0x3c179b['push'](_0x3c179b['shift']());}catch(_0x418e27){_0x3c179b['push'](_0x3c179b['shift']());}}}(a32_0x29e4,0x6db82));import{listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';function a32_0x29e4(){const _0x3a77b2=['14oWStle','push','2034864SGchay','filePath','7243NUiKRG','\x20modified,\x20','66mucnJM','11827552bUmouF','status','appCode','boolean','lockFilePath','functions','bff','datasetCode','4HqrMcm','2174685AtMZzy','114XFhXNc','scriptsRoot','44565TnQcGW','4777850HojslA','length','map','\x20unchanged','read','Check\x20local\x20BFF\x20sync\x20status\x20against\x20lock\x20file','lockKey','1681736OPhJNL','remote'];a32_0x29e4=function(){return _0x3a77b2;};return a32_0x29e4();}function a32_0x2900(_0x23122c,_0x1ee6d4){_0x23122c=_0x23122c-0x67;const _0x29e469=a32_0x29e4();let _0x290044=_0x29e469[_0x23122c];return _0x290044;}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_0x4e2b0d(0x72),'command':a32_0x4e2b0d(0x6d),'description':a32_0x4e2b0d(0x7e),'risk':a32_0x4e2b0d(0x7d),'flags':[{'name':a32_0x4e2b0d(0x81),'type':a32_0x4e2b0d(0x6f),'description':'Also\x20check\x20for\x20remote-only\x20scripts\x20not\x20present\x20locally'}],async 'execute'(_0x3d952a){const _0x38d060=a32_0x4e2b0d,_0x3a9af5=loadBffProjectConfig(_0x3d952a[_0x38d060(0x6e)]),_0x418abe=await readBffLockFile(_0x3a9af5[_0x38d060(0x70)]),{appLock:_0xda6c99}=ensureLockScope(_0x418abe??createEmptyBffLock(),_0x3d952a['appCode'],_0x3a9af5[_0x38d060(0x77)],_0x38d060(0x6d)),_0x2d228c=await scanLocalBffFunctions(_0x3a9af5),_0x3ab716=[],_0x1cba4c=[],_0x4ad3e5=[];for(const _0x1cc9ed of _0x2d228c){const _0x507711=await computeFileHash(_0x1cc9ed[_0x38d060(0x68)]),_0x3e2ce7=_0xda6c99['functions'][_0x1cc9ed[_0x38d060(0x7f)]];if(!_0x3e2ce7)_0x3ab716[_0x38d060(0x83)](_0x1cc9ed['lockKey']);else _0x3e2ce7['hash']!==_0x507711?_0x1cba4c['push'](_0x1cc9ed['lockKey']):_0x4ad3e5['push'](_0x1cc9ed[_0x38d060(0x7f)]);}const _0x490574=[];if(_0x3d952a['bool']('remote')){const _0x39a1d9=loadAliasMap(_0x3d952a['apiDir'],undefined,resolveApiFilePath(_0x3d952a['apiDir'],_0x3d952a[_0x38d060(0x6e)])),_0x48a6bd=new Map(_0x39a1d9[_0x38d060(0x7b)](_0x356c2b=>[_0x356c2b[_0x38d060(0x73)],_0x356c2b['alias']])),[_0x1401e6,_0x20e535]=await Promise['all']([listBffScripts(_0x3d952a[_0x38d060(0x6e)]),getBffScriptStatistics(_0x3d952a['appCode'])]),_0x4593f8=createHookLocationMap(_0x20e535),_0x5b1462=new Set(_0x2d228c[_0x38d060(0x7b)](_0x310119=>_0x310119[_0x38d060(0x7f)]));for(const _0x1e7348 of _0x1401e6){const _0x50bf89=resolveRemoteScriptTarget(_0x3a9af5,_0x1e7348,_0x4593f8,_0xda6c99[_0x38d060(0x71)],_0x48a6bd);_0x50bf89&&!_0x5b1462['has'](_0x50bf89[_0x38d060(0x7f)])&&_0x490574['push'](_0x50bf89['lockKey']);}}const _0x454b0f=_0x3ab716[_0x38d060(0x7a)]===0x0&&_0x1cba4c[_0x38d060(0x7a)]===0x0&&_0x490574[_0x38d060(0x7a)]===0x0;return{'ok':!![],'data':{'added':_0x3ab716,'modified':_0x1cba4c,'unchanged':_0x4ad3e5,'remoteOnly':_0x490574},'message':_0x454b0f?'All\x20BFF\x20scripts\x20are\x20in\x20sync.':_0x3ab716[_0x38d060(0x7a)]+'\x20added,\x20'+_0x1cba4c[_0x38d060(0x7a)]+_0x38d060(0x6a)+_0x4ad3e5[_0x38d060(0x7a)]+_0x38d060(0x7c)+(_0x490574[_0x38d060(0x7a)]>0x0?',\x20'+_0x490574[_0x38d060(0x7a)]+'\x20remote-only':'')};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x10c441=a33_0x3489;(function(_0x16f080,_0x2266f7){const _0x5c2fcc=a33_0x3489,_0x315ab9=_0x16f080();while(!![]){try{const _0x4642a0=parseInt(_0x5c2fcc(0x1ef))/0x1*(parseInt(_0x5c2fcc(0x1be))/0x2)+-parseInt(_0x5c2fcc(0x1d7))/0x3*(parseInt(_0x5c2fcc(0x1d8))/0x4)+-parseInt(_0x5c2fcc(0x1f0))/0x5*(parseInt(_0x5c2fcc(0x1d5))/0x6)+parseInt(_0x5c2fcc(0x1d2))/0x7+-parseInt(_0x5c2fcc(0x1c5))/0x8+parseInt(_0x5c2fcc(0x1c4))/0x9+parseInt(_0x5c2fcc(0x1ce))/0xa*(-parseInt(_0x5c2fcc(0x1de))/0xb);if(_0x4642a0===_0x2266f7)break;else _0x315ab9['push'](_0x315ab9['shift']());}catch(_0x4a32e3){_0x315ab9['push'](_0x315ab9['shift']());}}}(a33_0x1490,0xdb3e1));import a33_0x403ef5 from'chalk';import a33_0x9debc3 from'ora';import a33_0x4d7306 from'semver';function a33_0x1490(){const _0x4b4934=['7002anGSGf','Update\x20available:\x20','3VYoDxc','3972404DnoJfZ','Updating\x20via\x20','run','slice','succeed','message','77VulcGZ','toLowerCase','bun','red','fail','Current\x20version:\x20','Update\x20rabetbase\x20CLI\x20to\x20the\x20latest\x20version','Checking\x20for\x20updates...','timeout','start','...','cli','install','info','log','https://registry.npmjs.org/','Updated\x20to\x20v','551Dlxazd','1810PFnLbu','Unable\x20to\x20check\x20for\x20updates','green','6490BPoOmQ','npm','Update\x20failed','\x20\x20Run\x20manually:\x20npm\x20install\x20-g\x20','\x20\x20Restart\x20your\x20terminal\x20to\x20use\x20the\x20new\x20version.','update','14164092BFAJyY','9355744qNBDJD','json','\x20→\x20','Unable\x20to\x20check\x20for\x20updates\x20(network\x20error)','Version\x20comparison\x20failed','yellow','Already\x20up\x20to\x20date\x20(v','@latest','\x20\x20Try\x20manually:\x20','1400290eOwwfo','coerce','error','version','7710220LRDfCO','stableVersion','gray'];a33_0x1490=function(){return _0x4b4934;};return a33_0x1490();}import{execa}from'execa';import{NPM_PACKAGE_NAME}from'../constant/cli.js';function a33_0x3489(_0x1313dc,_0x5d1091){_0x1313dc=_0x1313dc-0x1be;const _0x14904d=a33_0x1490();let _0x3489cf=_0x14904d[_0x1313dc];return _0x3489cf;}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 _0x4d3469=a33_0x3489;return GIT_COMMIT!=='unknown'?VERSION+'\x20('+GIT_COMMIT+',\x20'+BUILD_TIME[_0x4d3469(0x1db)](0x0,0xa)+')':VERSION;}function detectPackageManager(){const _0x19f763=a33_0x3489,_0x1fb85f=process['execPath'][_0x19f763(0x1df)]();if(_0x1fb85f['includes']('bun'))return _0x19f763(0x1e0);return'npm';}async function fetchLatestNpmVersion(){const _0x157838=a33_0x3489;try{const _0x1e93df=await fetch(_0x157838(0x1ed)+NPM_PACKAGE_NAME+'/latest',{'signal':AbortSignal[_0x157838(0x1e6)](0x2710)});if(!_0x1e93df['ok'])return null;const _0x184447=await _0x1e93df[_0x157838(0x1c6)]();return _0x184447[_0x157838(0x1d1)]??null;}catch{return null;}}async function fetchLatestVersion(){const _0x39bee9=a33_0x3489,_0x36883c=await fetchLatestNpmVersion();if(_0x36883c)return _0x36883c;const _0x49e630=await getCdnConfig();return _0x49e630?.[_0x39bee9(0x1e9)]?.[_0x39bee9(0x1d3)]??null;}async function execute(_0x810edc){const _0x74d9f0=a33_0x3489,_0x300a0b=getCurrentVersion();console[_0x74d9f0(0x1ec)](_0x74d9f0(0x1e3)+_0x300a0b);const _0x4d3e02=a33_0x9debc3(_0x74d9f0(0x1e5))['start'](),_0x34b55a=await fetchLatestVersion();if(!_0x34b55a)return _0x4d3e02[_0x74d9f0(0x1e2)](_0x74d9f0(0x1c8)),console[_0x74d9f0(0x1ec)](a33_0x403ef5[_0x74d9f0(0x1d4)](_0x74d9f0(0x1c1)+NPM_PACKAGE_NAME+_0x74d9f0(0x1cc))),{'ok':![],'message':_0x74d9f0(0x1f1)};const _0xc8ede=a33_0x4d7306[_0x74d9f0(0x1cf)](_0x300a0b),_0x3196f2=a33_0x4d7306[_0x74d9f0(0x1cf)](_0x34b55a);if(!_0xc8ede||!_0x3196f2)return _0x4d3e02[_0x74d9f0(0x1e2)](_0x74d9f0(0x1c9)),{'ok':![],'message':_0x74d9f0(0x1c9)};if(!a33_0x4d7306['lt'](_0xc8ede,_0x3196f2))return _0x4d3e02['succeed'](_0x74d9f0(0x1cb)+_0x34b55a+')'),{'ok':!![]};_0x4d3e02[_0x74d9f0(0x1eb)](_0x74d9f0(0x1d6)+a33_0x403ef5[_0x74d9f0(0x1ca)](_0x300a0b)+_0x74d9f0(0x1c7)+a33_0x403ef5[_0x74d9f0(0x1f2)](_0x34b55a));const _0xe64077=detectPackageManager(),_0x281824=_0xe64077===_0x74d9f0(0x1bf)?resolveNpmBin(_0x74d9f0(0x1bf)):_0xe64077,_0x30008e=a33_0x9debc3(_0x74d9f0(0x1d9)+_0xe64077+_0x74d9f0(0x1e8))[_0x74d9f0(0x1e7)]();try{return await execa(_0x281824,[_0x74d9f0(0x1ea),'-g',NPM_PACKAGE_NAME+_0x74d9f0(0x1cc)],{'stdio':'pipe'}),_0x30008e[_0x74d9f0(0x1dc)](_0x74d9f0(0x1ee)+_0x34b55a),console[_0x74d9f0(0x1ec)](a33_0x403ef5['gray'](_0x74d9f0(0x1c2))),{'ok':!![]};}catch(_0x203914){return _0x30008e['fail'](_0x74d9f0(0x1c0)),console[_0x74d9f0(0x1d0)](a33_0x403ef5[_0x74d9f0(0x1e1)]('\x20\x20'+_0x203914[_0x74d9f0(0x1dd)])),console[_0x74d9f0(0x1ec)](a33_0x403ef5[_0x74d9f0(0x1d4)](_0x74d9f0(0x1cd)+_0xe64077+'\x20install\x20-g\x20'+NPM_PACKAGE_NAME+_0x74d9f0(0x1cc))),{'ok':![],'message':_0x203914[_0x74d9f0(0x1dd)]};}}export const updateDefinition={'service':a33_0x10c441(0x1c3),'command':a33_0x10c441(0x1da),'description':a33_0x10c441(0x1e4),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x30b467,_0x5aa0e6){const _0xf5bfc7=a34_0x5279,_0x57df93=_0x30b467();while(!![]){try{const _0x238bda=-parseInt(_0xf5bfc7(0x11f))/0x1+parseInt(_0xf5bfc7(0x120))/0x2*(parseInt(_0xf5bfc7(0x11a))/0x3)+parseInt(_0xf5bfc7(0x116))/0x4*(parseInt(_0xf5bfc7(0x121))/0x5)+parseInt(_0xf5bfc7(0x119))/0x6*(-parseInt(_0xf5bfc7(0x11c))/0x7)+parseInt(_0xf5bfc7(0x117))/0x8*(parseInt(_0xf5bfc7(0x118))/0x9)+-parseInt(_0xf5bfc7(0x11b))/0xa*(parseInt(_0xf5bfc7(0x11e))/0xb)+parseInt(_0xf5bfc7(0x122))/0xc*(parseInt(_0xf5bfc7(0x11d))/0xd);if(_0x238bda===_0x5aa0e6)break;else _0x57df93['push'](_0x57df93['shift']());}catch(_0x14135e){_0x57df93['push'](_0x57df93['shift']());}}}(a34_0x1bc5,0xb8b5f));import{codegenSdk}from'./sdk.js';import{codegenSql}from'./sql.js';function a34_0x5279(_0x3a246d,_0x4a7e73){_0x3a246d=_0x3a246d-0x116;const _0x1bc5c0=a34_0x1bc5();let _0x52791e=_0x1bc5c0[_0x3a246d];return _0x52791e;}export const codegenDefinitions=[codegenSdk,codegenSql];function a34_0x1bc5(){const _0x43b35f=['336EDsJsG','3364408ySEfka','27UZuJJj','3264036ngbBrI','3CFKVaF','4143110pYQTnc','7bxEuHl','1365gdpxid','22yIbcok','877659hiZNky','529922RDHBrI','18160wIopGP','134304lpUIYp'];a34_0x1bc5=function(){return _0x43b35f;};return a34_0x1bc5();}
|