@lovrabet/rabetbase-cli 2.0.6 → 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 -0
- package/lib/commands/project/create/format-elapsed.js +1 -0
- package/lib/commands/project/create/main.js +1 -0
- package/lib/commands/project/create/non-interactive.js +1 -0
- package/lib/commands/project/create/project-template-path.js +1 -0
- package/lib/commands/project/create/use-copy-project-template.js +1 -0
- package/lib/commands/project/create/use-format-code.js +1 -0
- package/lib/commands/project/create/use-install-dependencies.js +1 -0
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -0
- package/lib/commands/project/upgrade.js +1 -0
- 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
- package/lib/commands/build.js +0 -1
- package/lib/commands/preview.js +0 -1
- package/lib/commands/project-upgrade.js +0 -1
- package/lib/commands/start.js +0 -1
- package/lib/create-app/enhanced-guided-create.js +0 -1
- package/lib/create-app/format-elapsed.js +0 -1
- package/lib/create-app/main.js +0 -1
- package/lib/create-app/non-interactive.js +0 -1
- package/lib/create-app/use-copy-project-template.js +0 -1
- package/lib/create-app/use-format-code.js +0 -1
- package/lib/create-app/use-install-dependencies.js +0 -1
- package/lib/init/main.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
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
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
function a29_0x3501(_0x5bdba3,_0x36d238){_0x5bdba3=_0x5bdba3-0x72;const _0x869290=a29_0x8692();let _0x3501e5=_0x869290[_0x5bdba3];return _0x3501e5;}const a29_0x166eee=a29_0x3501;(function(_0x186b17,_0x36f113){const _0x3c0699=a29_0x3501,_0x271a45=_0x186b17();while(!![]){try{const _0xe3f100=-parseInt(_0x3c0699(0xb8))/0x1*(parseInt(_0x3c0699(0xbf))/0x2)+parseInt(_0x3c0699(0x84))/0x3*(parseInt(_0x3c0699(0x88))/0x4)+-parseInt(_0x3c0699(0xa5))/0x5+parseInt(_0x3c0699(0x98))/0x6+-parseInt(_0x3c0699(0x96))/0x7*(parseInt(_0x3c0699(0xb3))/0x8)+parseInt(_0x3c0699(0x99))/0x9*(parseInt(_0x3c0699(0xbc))/0xa)+parseInt(_0x3c0699(0xad))/0xb;if(_0xe3f100===_0x36f113)break;else _0x271a45['push'](_0x271a45['shift']());}catch(_0x2715f7){_0x271a45['push'](_0x271a45['shift']());}}}(a29_0x8692,0x57969));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a29_0x8692(){const _0x556b1f=['No\x20api.ts\x20found.\x20Run\x20`','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','trim','stderr','\x0a\x20*\x20[触发节点]\x20','54527YUQgXX','\x22.\x20','validation','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','alias','75536oPAEKO','scriptsRootDir','ENDPOINT','function-node','includes','141787aWSALw','\x20function:\x20','/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','nonInteractive','4710QHeLMk','HOOK','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','4hKhIaw','Script\x20type','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x0a\x20*\x20[脚本名称]\x20','description','datasetCode','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','code','appCode','No\x20datasets\x20found\x20for\x20this\x20app.','stdin','before','map','keys','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','length','Created\x20','Available\x20aliases:\x20','apiDir','string','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','name','join','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','Invalid\x20function\x20name\x20\x22','bff','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','/endpoint/','856230qBpPKP','question','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','4ARnlOR','File\x20already\x20exists:\x20','after','Function\x20name\x20(valid\x20JS\x20identifier)','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Request\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Business\x20result\x20(wrapped\x20in\x20response.data).\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Invalid\x20dataset\x20selection.','Script\x20description','operation-type','\x22\x20not\x20found\x20for\x20dataset\x20','close','operationType','datasetcode','find','write','259NrojLE','Alias\x20\x22','3387978XmTyIh','2619GVSxEG','Operation\x20type\x20\x22','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Current\x20request\x20params\x20or\x20response\x20result.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Modified\x20params\x20object.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','type','tableName','Select\x20dataset:','.js\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Input\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Processing\x20result.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','COMMON','functionNode','2010oXEbZx','str','new'];a29_0x8692=function(){return _0x556b1f;};return a29_0x8692();}import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffNew={'service':a29_0x166eee(0x81),'command':a29_0x166eee(0xa7),'description':a29_0x166eee(0xa9),'risk':a29_0x166eee(0x95),'flags':[{'name':a29_0x166eee(0x9d),'type':'string','required':!![],'enum':[a29_0x166eee(0xa3),a29_0x166eee(0xb5),a29_0x166eee(0xbd)],'description':a29_0x166eee(0xc0)},{'name':a29_0x166eee(0x7d),'type':a29_0x166eee(0x7b),'required':!![],'description':a29_0x166eee(0x8b)},{'name':a29_0x166eee(0xc3),'type':'string','description':a29_0x166eee(0x8e)},{'name':'alias','type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a29_0x166eee(0x93),'type':a29_0x166eee(0x7b),'description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a29_0x166eee(0x8f),'type':a29_0x166eee(0x7b),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a29_0x166eee(0xb6),'type':'string','description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a29_0x166eee(0x73),'after']}],async 'validate'(_0x1f6ab5){const _0x5dc447=a29_0x166eee,_0x4c0e39=_0x1f6ab5[_0x5dc447(0xa6)](_0x5dc447(0x7d));if(!isValidBffFunctionName(_0x4c0e39))throw CliErrors[_0x5dc447(0xaf)](_0x5dc447(0x80)+_0x4c0e39+_0x5dc447(0x7f));},async 'execute'(_0x579fd1){const _0x1310fe=a29_0x166eee,_0x5772be=loadBffProjectConfig(_0x579fd1[_0x1310fe(0xc7)]),_0x2b78ab=_0x579fd1[_0x1310fe(0xa6)](_0x1310fe(0x9d)),_0x2aee08=_0x579fd1['str'](_0x1310fe(0x7d)),_0x55e3cd=_0x579fd1[_0x1310fe(0xa6)](_0x1310fe(0xc3))||undefined,_0x30af0d=_0x2b78ab===_0x1310fe(0xbd)?await resolveHookOptions(_0x5772be,_0x579fd1):undefined,_0x156946=buildFilePath(_0x5772be,_0x2b78ab,_0x2aee08,_0x30af0d);if(await fileExists(_0x156946))throw CliErrors[_0x1310fe(0xaf)](_0x1310fe(0x89)+_0x156946);await mkdir(dirname(_0x156946),{'recursive':!![]});const _0x581b8c=generateTemplate(_0x2b78ab,_0x2aee08,_0x579fd1['appCode'],_0x55e3cd,_0x30af0d);await writeFile(_0x156946,_0x581b8c,'utf8');const _0x5b6131={'type':_0x2b78ab,'name':_0x2aee08,'path':_0x156946};if(_0x55e3cd)_0x5b6131[_0x1310fe(0xc3)]=_0x55e3cd;if(_0x30af0d){if(_0x30af0d['alias'])_0x5b6131[_0x1310fe(0xb2)]=_0x30af0d['alias'];_0x5b6131[_0x1310fe(0xc4)]=_0x30af0d[_0x1310fe(0xc4)],_0x5b6131['operationType']=_0x30af0d[_0x1310fe(0x92)],_0x5b6131[_0x1310fe(0xa4)]=_0x30af0d['functionNode'];}return{'ok':!![],'data':_0x5b6131,'message':_0x1310fe(0x78)+_0x2b78ab+_0x1310fe(0xb9)+_0x2aee08};}};async function resolveHookOptions(_0x54ecc1,_0x92cff8){const _0xe2717=a29_0x166eee,_0x573142=loadAliasMap(_0x92cff8['apiDir'],undefined,resolveApiFilePath(_0x92cff8[_0xe2717(0x7a)],_0x92cff8[_0xe2717(0xc7)])),_0x7e07f0=_0x573142[_0xe2717(0x77)]>0x0;let _0x5e81ed,_0x28ab6b,_0x9885fc;const _0x56b610=_0x92cff8[_0xe2717(0xa6)](_0xe2717(0xb2)),_0x33ad0f=_0x92cff8[_0xe2717(0xa6)]('datasetcode');if(_0x56b610){const _0x130575=resolveAlias(_0x92cff8[_0xe2717(0x7a)],_0x56b610,undefined,resolveApiFilePath(_0x92cff8[_0xe2717(0x7a)],_0x92cff8[_0xe2717(0xc7)]));if(!_0x130575){const _0x5f509e=_0x7e07f0?_0xe2717(0x79)+_0x573142[_0xe2717(0x74)](_0x30b7b6=>_0x30b7b6['alias'])[_0xe2717(0x7e)](',\x20'):_0xe2717(0xa8)+CLI_BIN_NAME+_0xe2717(0x9c);throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x97)+_0x56b610+'\x22\x20not\x20found.\x20'+_0x5f509e);}_0x5e81ed=_0x56b610,_0x28ab6b=_0x130575;}else{if(_0x33ad0f){_0x28ab6b=_0x33ad0f;const _0x2d64f2=_0x573142[_0xe2717(0x94)](_0x45c1ff=>_0x45c1ff['datasetCode']===_0x33ad0f);_0x5e81ed=_0x2d64f2?.['alias'];}else{if(_0x92cff8[_0xe2717(0xbb)])throw CliErrors[_0xe2717(0xaf)](_0xe2717(0xb1));else{if(_0x7e07f0){const _0x293070=_0x573142[_0xe2717(0x74)](_0x1045cd=>_0x1045cd[_0xe2717(0xb2)]+'\x20('+_0x1045cd[_0xe2717(0x9e)]+')'),_0x4541b4=await promptSelect(_0xe2717(0x9f),_0x293070),_0xa90fcd=_0x573142[_0x4541b4];if(!_0xa90fcd)throw CliErrors[_0xe2717(0xaf)]('Invalid\x20dataset\x20selection.');_0x5e81ed=_0xa90fcd['alias'],_0x28ab6b=_0xa90fcd[_0xe2717(0xc4)];}else{const _0x5aa09e=await listDatasets(_0x92cff8[_0xe2717(0xc7)]);if(_0x5aa09e[_0xe2717(0x77)]===0x0)throw CliErrors['validation'](_0xe2717(0xc8));const _0x16a82b=_0x5aa09e['map'](_0x201b3a=>_0x201b3a['name']+'\x20('+_0x201b3a[_0xe2717(0xc6)]+')'),_0x56767d=await promptSelect('Select\x20dataset:',_0x16a82b),_0x5c3ed2=_0x5aa09e[_0x56767d];if(!_0x5c3ed2)throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x8d));_0x28ab6b=_0x5c3ed2[_0xe2717(0xc6)],_0x5e81ed=undefined;}}}}const _0x468135=await listDatasets(_0x92cff8['appCode']),_0x421801=_0x468135[_0xe2717(0x94)](_0x19b58e=>_0x19b58e[_0xe2717(0xc6)]===_0x28ab6b);if(!_0x421801)throw CliErrors[_0xe2717(0xaf)](_0xe2717(0xc1)+_0x28ab6b+_0xe2717(0xae)+(_0x5e81ed?_0xe2717(0xb0)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x9885fc=_0x421801['id'];const _0x27b158=_0x5e81ed??_0x28ab6b,_0x217a55=await listBffDatasetOperations(_0x92cff8[_0xe2717(0xc7)],_0x9885fc),_0x134939=_0x217a55?Object[_0xe2717(0x75)](_0x217a55):[];if(_0x134939[_0xe2717(0x77)]===0x0)throw CliErrors['validation']('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x27b158+'.');let _0xeb6729;const _0x3fdc43=_0x92cff8[_0xe2717(0xa6)](_0xe2717(0x8f));if(_0x3fdc43){if(!_0x134939[_0xe2717(0xb7)](_0x3fdc43))throw CliErrors['validation'](_0xe2717(0x9a)+_0x3fdc43+_0xe2717(0x90)+_0x27b158+'.\x20'+('Available:\x20'+_0x134939[_0xe2717(0x7e)](',\x20')));_0xeb6729=_0x3fdc43;}else{if(_0x92cff8[_0xe2717(0xbb)])throw CliErrors['validation'](_0xe2717(0x7c));const _0x152806=await promptSelect('Select\x20operation\x20type:',_0x134939);_0xeb6729=_0x134939[_0x152806]??_0x134939[0x0];}let _0x46d930=normalizeHookFunctionNode(_0x92cff8[_0xe2717(0xa6)]('function-node'));if(!_0x46d930){if(_0x92cff8[_0xe2717(0xa6)](_0xe2717(0xb6)))throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x76));if(_0x92cff8[_0xe2717(0xbb)])throw CliErrors[_0xe2717(0xaf)](_0xe2717(0x87));const _0x2d659c=await promptSelect('Select\x20trigger\x20node:',['before',_0xe2717(0x8a)]);_0x46d930=['before',_0xe2717(0x8a)][_0x2d659c]??_0xe2717(0x73);}return{'alias':_0x5e81ed,'datasetCode':_0x28ab6b,'datasetId':_0x9885fc,'operationType':_0xeb6729,'functionNode':_0x46d930};}async function promptSelect(_0x4d2bcd,_0x2d9fbb){const _0x10eafd=a29_0x166eee;if(_0x2d9fbb[_0x10eafd(0x77)]===0x1)return 0x0;for(const [_0x198216,_0x2c6ca3]of _0x2d9fbb['entries']()){process['stderr'][_0x10eafd(0x95)]('\x20\x20'+(_0x198216+0x1)+'.\x20'+_0x2c6ca3+'\x0a');}const _0x3f2008=createInterface({'input':process[_0x10eafd(0x72)],'output':process[_0x10eafd(0xab)]});while(!![]){const _0x21fbda=await new Promise(_0x54cd1e=>{const _0x455b67=_0x10eafd;_0x3f2008[_0x455b67(0x85)](_0x4d2bcd+'\x20',_0x54cd1e);}),_0x339b0c=Number['parseInt'](_0x21fbda['trim'](),0xa);if(Number['isInteger'](_0x339b0c)&&_0x339b0c>=0x1&&_0x339b0c<=_0x2d9fbb[_0x10eafd(0x77)])return _0x3f2008[_0x10eafd(0x91)](),_0x339b0c-0x1;process[_0x10eafd(0xab)]['write'](_0x10eafd(0x82)+_0x2d9fbb[_0x10eafd(0x77)]+'.\x0a');}}function buildFilePath(_0x1a7b34,_0x34768c,_0x5c52ca,_0x5940f5){const _0x132f0b=a29_0x166eee;if(_0x34768c==='HOOK'){if(!_0x5940f5)throw CliErrors['validation']('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x532e2c=_0x5940f5[_0x132f0b(0xb2)]??_0x5940f5[_0x132f0b(0xc4)];return join(_0x1a7b34['scriptsRootDir'],_0x132f0b(0xbd),_0x532e2c,_0x5940f5[_0x132f0b(0x92)],_0x5940f5['functionNode'],_0x5c52ca+'.js');}return join(_0x1a7b34[_0x132f0b(0xb4)],_0x34768c,_0x5c52ca+'.js');}export function generateTemplate(_0x1cf6d3,_0x40262a,_0x157c1b,_0x58bb5a,_0x360ce6){const _0x40645b=a29_0x166eee,_0x554e29=_0x58bb5a?.[_0x40645b(0xaa)]()||'TODO:\x20add\x20script\x20description';if(_0x1cf6d3===_0x40645b(0xa3))return _0x40645b(0xba)+_0x554e29+_0x40645b(0xc2)+_0x40262a+_0x40645b(0xa2)+_0x40262a+_0x40645b(0xa0)+_0x40262a+_0x40645b(0xbe);if(_0x1cf6d3===_0x40645b(0xb5))return _0x40645b(0xc5)+_0x554e29+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x157c1b+_0x40645b(0x83)+_0x40262a+_0x40645b(0x8c)+_0x40262a+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x360ce6)throw CliErrors[_0x40645b(0xaf)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');return _0x40645b(0x86)+_0x554e29+_0x40645b(0xa1)+_0x157c1b+'/'+_0x360ce6['datasetCode']+'/'+_0x360ce6[_0x40645b(0x92)]+_0x40645b(0xac)+_0x360ce6[_0x40645b(0xa4)]+_0x40645b(0x9b)+_0x40262a+_0x40645b(0xbe);}
|
|
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_0x1e5aee=a31_0x1453;(function(_0x359e57,_0x1369fa){const _0x3c7204=a31_0x1453,_0x294598=_0x359e57();while(!![]){try{const _0xf81189=parseInt(_0x3c7204(0x173))/0x1+-parseInt(_0x3c7204(0x172))/0x2+parseInt(_0x3c7204(0x167))/0x3*(parseInt(_0x3c7204(0x183))/0x4)+-parseInt(_0x3c7204(0x16d))/0x5*(parseInt(_0x3c7204(0x15e))/0x6)+-parseInt(_0x3c7204(0x149))/0x7+parseInt(_0x3c7204(0x182))/0x8+parseInt(_0x3c7204(0x178))/0x9;if(_0xf81189===_0x1369fa)break;else _0x294598['push'](_0x294598['shift']());}catch(_0x47c48e){_0x294598['push'](_0x294598['shift']());}}}(a31_0x9fe3,0x48509));function a31_0x1453(_0x4091da,_0x40fb8a){_0x4091da=_0x4091da-0x147;const _0x9fe353=a31_0x9fe3();let _0x145316=_0x9fe353[_0x4091da];return _0x145316;}import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{normalizeBffType,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{extractScriptDescription}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a31_0x9fe3(){const _0x314bbf=['apiDir','aliasToDatasetCode','remoteId','scriptsRoot','bool','159051TWQOws','unchanged','\x20failed','Local\x20function\x20not\x20found:\x20','ENDPOINT','force','558185UyYDQS','No\x20local\x20BFF\x20functions\x20found.','Push\x20local\x20BFF\x20scripts\x20to\x20remote','\x20local\x20BFF\x20script(s)\x20for\x20push','get','677150HUFMGg','77356tUFbXM','create','operationType','code','Would\x20inspect\x20','12116565HAQhUM','\x20uploaded,\x20','bff','type','\x20skipped,\x20','update','/api/management/library/scripts/save','validation','alias','length','584856RAobMk','4PxlrQi','lastSync','POST','Run\x20`','functionNode','name','push','Push\x20only\x20this\x20script\x20type','HOOK','version','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','2497628oPYfpt','Push\x20complete:\x20','description','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','values','has','filePath','lockFilePath','string','Cannot\x20resolve\x20dataset\x20for\x20\x22','utf8','some','datasetCodeToId','appCode','lockKey','high-risk-write','hash','message','set','str','datasetCode','30pasQny','filter','functions','map'];a31_0x9fe3=function(){return _0x314bbf;};return a31_0x9fe3();}export const bffPush={'service':a31_0x1e5aee(0x17a),'command':a31_0x1e5aee(0x189),'description':a31_0x1e5aee(0x16f),'risk':a31_0x1e5aee(0x158),'flags':[{'name':'type','type':'string','description':a31_0x1e5aee(0x18a),'enum':['COMMON',a31_0x1e5aee(0x16b),'HOOK']},{'name':a31_0x1e5aee(0x188),'type':a31_0x1e5aee(0x151),'description':a31_0x1e5aee(0x14c)},{'name':a31_0x1e5aee(0x16c),'type':'boolean','description':'Force\x20push\x20ignoring\x20hash\x20protection'}],async 'dryRun'(_0x33e869){const _0x4708b0=a31_0x1e5aee,_0x2c15d7=loadBffProjectConfig(_0x33e869[_0x4708b0(0x156)]),_0x3c20af=await readBffLockFile(_0x2c15d7[_0x4708b0(0x150)]),{appLock:_0x5bef30}=ensureLockScope(_0x3c20af??createEmptyBffLock(),_0x33e869[_0x4708b0(0x156)],_0x2c15d7[_0x4708b0(0x165)],_0x4708b0(0x189)),_0x7fcf08=await getTargetFunctions(_0x2c15d7,_0x33e869),_0x4a370b=_0x33e869['bool'](_0x4708b0(0x16c)),_0x8324b6=[];for(const _0x2d2522 of _0x7fcf08){const _0x569472=await computeFileHash(_0x2d2522[_0x4708b0(0x14f)]),_0x345f9f=_0x5bef30['functions'][_0x2d2522['lockKey']],_0x39a183=!!_0x345f9f&&_0x345f9f[_0x4708b0(0x159)]===_0x569472;_0x8324b6[_0x4708b0(0x189)]({'lockKey':_0x2d2522[_0x4708b0(0x157)],'filePath':_0x2d2522[_0x4708b0(0x14f)],'remoteId':_0x345f9f?.[_0x4708b0(0x164)]??null,'mode':_0x345f9f?.['remoteId']?_0x4708b0(0x17d):_0x4708b0(0x174),'status':!_0x4a370b&&_0x39a183?_0x4708b0(0x168):'would_push'});}return{'method':_0x4708b0(0x185),'url':_0x4708b0(0x17e),'body':{'appCode':_0x33e869['appCode'],'force':_0x4a370b,'files':_0x8324b6},'description':_0x4708b0(0x177)+_0x8324b6[_0x4708b0(0x181)]+_0x4708b0(0x170)};},async 'execute'(_0x10ad24){const _0x4c5240=a31_0x1e5aee,_0x3782e3=loadBffProjectConfig(_0x10ad24[_0x4c5240(0x156)]),_0x4efe49=await readBffLockFile(_0x3782e3[_0x4c5240(0x150)]),{lockData:_0x4304a4,appLock:_0x4e748a}=ensureLockScope(_0x4efe49??createEmptyBffLock(),_0x10ad24[_0x4c5240(0x156)],_0x3782e3[_0x4c5240(0x165)],_0x4c5240(0x189)),_0x3c271e=await getTargetFunctions(_0x3782e3,_0x10ad24);if(_0x3c271e[_0x4c5240(0x181)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x4c5240(0x16e)};const _0x40e229=_0x10ad24[_0x4c5240(0x166)](_0x4c5240(0x16c)),_0x8133ca=await buildHookMaps(_0x10ad24['appCode'],_0x10ad24[_0x4c5240(0x162)],_0x3c271e,_0x4e748a),_0x5ece4c=[],_0x5b0de4=[],_0x26e999=[];for(const _0x5aa655 of _0x3c271e){const _0xbd5c40=await computeFileHash(_0x5aa655[_0x4c5240(0x14f)]),_0x16c3af=_0x4e748a[_0x4c5240(0x160)][_0x5aa655[_0x4c5240(0x157)]];if(!_0x40e229&&_0x16c3af&&_0x16c3af[_0x4c5240(0x159)]===_0xbd5c40){_0x5b0de4[_0x4c5240(0x189)]({'lockKey':_0x5aa655[_0x4c5240(0x157)],'reason':_0x4c5240(0x168)});continue;}try{await uploadSingleFunction(_0x10ad24[_0x4c5240(0x156)],_0x5aa655,_0x4e748a,_0x8133ca);const _0xad56bb=_0x4e748a[_0x4c5240(0x160)][_0x5aa655[_0x4c5240(0x157)]];_0x5ece4c[_0x4c5240(0x189)]({'lockKey':_0x5aa655[_0x4c5240(0x157)],'remoteId':_0xad56bb?.[_0x4c5240(0x164)]??0x0});}catch(_0xa210ce){_0x26e999[_0x4c5240(0x189)]({'lockKey':_0x5aa655[_0x4c5240(0x157)],'error':_0xa210ce instanceof Error?_0xa210ce[_0x4c5240(0x15a)]:String(_0xa210ce)});}}return _0x4e748a[_0x4c5240(0x184)]=new Date()['toISOString'](),await writeBffLockFile(_0x3782e3[_0x4c5240(0x150)],_0x4304a4),{'ok':_0x26e999[_0x4c5240(0x181)]===0x0,'data':{'uploaded':_0x5ece4c,'skipped':_0x5b0de4,'failed':_0x26e999},'message':_0x4c5240(0x14a)+_0x5ece4c[_0x4c5240(0x181)]+_0x4c5240(0x179)+_0x5b0de4[_0x4c5240(0x181)]+_0x4c5240(0x17c)+_0x26e999[_0x4c5240(0x181)]+_0x4c5240(0x169)};}};async function getTargetFunctions(_0x283a5e,_0x265192){const _0x40db79=a31_0x1e5aee,_0x24a79a=_0x265192[_0x40db79(0x15c)]('type'),_0x2d8f57=_0x265192['str'](_0x40db79(0x188)),_0x448c3c=normalizeBffType(_0x24a79a)??undefined;if(_0x2d8f57&&!_0x448c3c)throw CliErrors[_0x40db79(0x17f)]('--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.');const _0x4cd7a0=await scanLocalBffFunctions(_0x283a5e,_0x448c3c);if(_0x2d8f57){const _0x505eaf=_0x4cd7a0[_0x40db79(0x15f)](_0x1afe82=>_0x1afe82[_0x40db79(0x188)]===_0x2d8f57);if(_0x505eaf[_0x40db79(0x181)]===0x0)throw CliErrors['validation'](_0x40db79(0x16a)+_0x448c3c+'/'+_0x2d8f57);return _0x505eaf;}return _0x4cd7a0;}async function buildHookMaps(_0x53722a,_0x4cddab,_0x3bbeb2,_0xf2f169){const _0x3d612f=a31_0x1e5aee,_0x126803=_0x3bbeb2[_0x3d612f(0x154)](_0x38e559=>_0x38e559[_0x3d612f(0x17b)]==='HOOK');if(!_0x126803)return{'aliasToDatasetCode':new Map(),'datasetCodeToId':new Map()};const _0x2121aa=loadAliasMap(_0x4cddab,undefined,resolveApiFilePath(_0x4cddab,_0x53722a)),_0x16eab3=new Map(_0x2121aa[_0x3d612f(0x161)](_0x4f7533=>[_0x4f7533[_0x3d612f(0x180)],_0x4f7533[_0x3d612f(0x15d)]]));for(const _0x114a4a of Object[_0x3d612f(0x14d)](_0xf2f169[_0x3d612f(0x160)])){_0x114a4a['alias']&&_0x114a4a[_0x3d612f(0x15d)]&&!_0x16eab3[_0x3d612f(0x14e)](_0x114a4a['alias'])&&_0x16eab3[_0x3d612f(0x15b)](_0x114a4a[_0x3d612f(0x180)],_0x114a4a[_0x3d612f(0x15d)]);}const _0x41b7e7=await listDatasets(_0x53722a),_0x33c661=new Map(_0x41b7e7[_0x3d612f(0x161)](_0x1c440b=>[_0x1c440b[_0x3d612f(0x176)],_0x1c440b['id']]));return{'aliasToDatasetCode':_0x16eab3,'datasetCodeToId':_0x33c661};}async function uploadSingleFunction(_0x53b66a,_0x2632c9,_0x5bc058,_0x367b6d){const _0x4a14e8=a31_0x1e5aee,_0x43df12=await readFile(_0x2632c9[_0x4a14e8(0x14f)],_0x4a14e8(0x153)),_0x51cae0=await computeFileHash(_0x2632c9[_0x4a14e8(0x14f)]),_0xe84e0b=_0x5bc058[_0x4a14e8(0x160)][_0x2632c9[_0x4a14e8(0x157)]];if(_0xe84e0b?.[_0x4a14e8(0x164)]&&_0xe84e0b[_0x4a14e8(0x147)]==null)throw CliErrors[_0x4a14e8(0x17f)](_0x2632c9[_0x4a14e8(0x157)]+':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.');let _0x2cb1d1=extractScriptDescription(_0x43df12);if(!_0x2cb1d1&&_0xe84e0b?.['remoteId']){const _0x1f0b57=await getBffScriptInfo(_0xe84e0b[_0x4a14e8(0x164)]);_0x2cb1d1=_0x1f0b57[_0x4a14e8(0x14b)]||undefined;}const _0x4aa874={'appCode':_0x53b66a,'functionName':_0x2632c9[_0x4a14e8(0x188)],'scriptType':_0x2632c9['type'],'scriptContent':_0x43df12};if(_0xe84e0b?.[_0x4a14e8(0x164)])_0x4aa874['id']=_0xe84e0b[_0x4a14e8(0x164)];if(_0xe84e0b?.[_0x4a14e8(0x147)]!=null)_0x4aa874['version']=_0xe84e0b[_0x4a14e8(0x147)];if(_0x2cb1d1)_0x4aa874[_0x4a14e8(0x14b)]=_0x2cb1d1;if(_0x2632c9[_0x4a14e8(0x17b)]===_0x4a14e8(0x18b)){const _0x146cf1=_0x2632c9[_0x4a14e8(0x180)];if(!_0x146cf1||!_0x2632c9[_0x4a14e8(0x175)]||!_0x2632c9[_0x4a14e8(0x187)])throw CliErrors[_0x4a14e8(0x17f)]('Incomplete\x20HOOK\x20path:\x20'+_0x2632c9['lockKey']);const _0x2b8e28=_0x367b6d[_0x4a14e8(0x163)]['get'](_0x146cf1)??_0xe84e0b?.[_0x4a14e8(0x15d)]??_0x146cf1,_0x5c7c6b=_0x367b6d[_0x4a14e8(0x155)]['get'](_0x2b8e28);if(!_0x5c7c6b)throw CliErrors['validation'](_0x4a14e8(0x152)+_0x146cf1+'\x22.\x20'+(_0x4a14e8(0x186)+CLI_BIN_NAME+_0x4a14e8(0x148)));_0x4aa874['datasetId']=_0x5c7c6b,_0x4aa874[_0x4a14e8(0x175)]=_0x2632c9['operationType'],_0x4aa874[_0x4a14e8(0x187)]=_0x2632c9[_0x4a14e8(0x187)];}const _0xcbafa3=await saveBffScript(_0x4aa874),_0x108651=await getBffScriptInfo(_0xcbafa3),_0x13d31b={'hash':_0x51cae0,'remoteId':_0xcbafa3,'version':_0x108651[_0x4a14e8(0x147)]};if(_0x2632c9[_0x4a14e8(0x17b)]===_0x4a14e8(0x18b)){const _0x3b1b9a=_0x2632c9[_0x4a14e8(0x180)],_0x16b879=_0x367b6d['aliasToDatasetCode'][_0x4a14e8(0x171)](_0x3b1b9a)??_0xe84e0b?.[_0x4a14e8(0x15d)]??_0x3b1b9a;_0x367b6d[_0x4a14e8(0x163)][_0x4a14e8(0x14e)](_0x3b1b9a)?_0x13d31b[_0x4a14e8(0x180)]=_0x3b1b9a:_0x13d31b[_0x4a14e8(0x180)]=_0xe84e0b?.['alias'],_0x13d31b['datasetCode']=_0x16b879,_0x13d31b['operationType']=_0x2632c9[_0x4a14e8(0x175)],_0x13d31b[_0x4a14e8(0x187)]=_0x2632c9['functionNode'];}_0x5bc058[_0x4a14e8(0x160)][_0x2632c9[_0x4a14e8(0x157)]]=_0x13d31b;}
|
|
1
|
+
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
|
-
|
|
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();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a35_0xf70f(){const _0x15be36=['sdk','3152268LBsImv','155352LLDQqH','skip-imports','tableName','operation','appCode','40dooFUZ','436462lLuMYa','Generate\x20TypeScript\x20SDK\x20code\x20for\x20a\x20dataset\x20operation','1340805ieEuiD','796sontra','read','code','boolean','alias','8370RyXmsg','56RIgGll','Omit\x20import\x20statements\x20from\x20generated\x20code','2eszwiX','1872891osZuhU','2644840lJdybc','string','name','str'];a35_0xf70f=function(){return _0x15be36;};return a35_0xf70f();}const a35_0x3bb73b=a35_0x3f6c;function a35_0x3f6c(_0x51f0b9,_0x8dd3fc){_0x51f0b9=_0x51f0b9-0xac;const _0xf70fd7=a35_0xf70f();let _0x3f6ce6=_0xf70fd7[_0x51f0b9];return _0x3f6ce6;}(function(_0x21a0bf,_0xf6ee64){const _0x50ff63=a35_0x3f6c,_0x142cc3=_0x21a0bf();while(!![]){try{const _0x1787b4=-parseInt(_0x50ff63(0xb8))/0x1+parseInt(_0x50ff63(0xc3))/0x2*(-parseInt(_0x50ff63(0xba))/0x3)+parseInt(_0x50ff63(0xbb))/0x4*(-parseInt(_0x50ff63(0xc0))/0x5)+parseInt(_0x50ff63(0xb1))/0x6+parseInt(_0x50ff63(0xc1))/0x7*(-parseInt(_0x50ff63(0xb2))/0x8)+parseInt(_0x50ff63(0xc4))/0x9+parseInt(_0x50ff63(0xb7))/0xa*(parseInt(_0x50ff63(0xac))/0xb);if(_0x1787b4===_0xf6ee64)break;else _0x142cc3['push'](_0x142cc3['shift']());}catch(_0x270929){_0x142cc3['push'](_0x142cc3['shift']());}}}(a35_0xf70f,0x4ef22));import{getOperationDetail,generateSdkCode}from'../../core/api-client.js';import{CODE_FLAG_OPTIONAL}from'../common/flags.js';export const codegenSdk={'service':'codegen','command':a35_0x3bb73b(0xb0),'description':a35_0x3bb73b(0xb9),'risk':a35_0x3bb73b(0xbc),'flags':[CODE_FLAG_OPTIONAL,{'name':a35_0x3bb73b(0xbf),'type':a35_0x3bb73b(0xad),'description':'Dataset\x20alias\x20defined\x20in\x20api.ts\x20(e.g.\x20order,\x20coupon)'},{'name':a35_0x3bb73b(0xb5),'type':a35_0x3bb73b(0xad),'required':!![],'description':'Operation\x20name\x20(e.g.\x20filter,\x20getOne,\x20create,\x20update)'},{'name':'skip-imports','type':a35_0x3bb73b(0xbe),'description':a35_0x3bb73b(0xc2)}],async 'execute'(_0x1f16f0){const _0x5c661e=a35_0x3bb73b,{dataset:_0x45f543,operation:_0x21fd30}=await getOperationDetail(_0x1f16f0[_0x5c661e(0xb6)],_0x1f16f0['str'](_0x5c661e(0xbd)),_0x1f16f0['str'](_0x5c661e(0xb5))),_0x5b95cd=generateSdkCode(_0x45f543,_0x21fd30,{'includeImports':!_0x1f16f0['bool'](_0x5c661e(0xb3))});return{'ok':!![],'data':{'dataset':{'name':_0x45f543[_0x5c661e(0xae)],'code':_0x45f543[_0x5c661e(0xbd)],'tableName':_0x45f543[_0x5c661e(0xb4)]},'operation':_0x1f16f0[_0x5c661e(0xaf)](_0x5c661e(0xb5)),'code':_0x5b95cd}};}};
|