@lovrabet/rabetbase-cli 2.2.1 → 2.2.2
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/login-success-html.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/generate.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/discover.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.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/create.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/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/data/filter.js +1 -1
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.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/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/init.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.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/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/save.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.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/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.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 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.js +1 -1
- package/lib/help.js +1 -1
- package/lib/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/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.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/params.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/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a19_0x17033=a19_0x3b47;(function(_0x1cd135,_0x510b3d){const _0x176101=a19_0x3b47,_0x54cd84=_0x1cd135();while(!![]){try{const _0x28ee81=-parseInt(_0x176101(0xc4))/0x1+parseInt(_0x176101(0xc0))/0x2*(-parseInt(_0x176101(0xbc))/0x3)+-parseInt(_0x176101(0xbb))/0x4+-parseInt(_0x176101(0xc3))/0x5*(parseInt(_0x176101(0xbe))/0x6)+-parseInt(_0x176101(0xc7))/0x7+parseInt(_0x176101(0xc1))/0x8+-parseInt(_0x176101(0xc8))/0x9*(-parseInt(_0x176101(0xbf))/0xa);if(_0x28ee81===_0x510b3d)break;else _0x54cd84['push'](_0x54cd84['shift']());}catch(_0x5c8b44){_0x54cd84['push'](_0x54cd84['shift']());}}}(a19_0x4e19,0x3e6a4));import{listRemoteApps}from'../../core/api-client.js';function a19_0x3b47(_0x212bd2,_0x597e8e){_0x212bd2=_0x212bd2-0xb9;const _0x4e19ff=a19_0x4e19();let _0x3b471f=_0x4e19ff[_0x212bd2];return _0x3b471f;}function a19_0x4e19(){const _0x4ebf2a=['read','5ngEZqb','90891sMVPDJ','../../core/api-client.js','app','3061107OfSFLJ','19134LtMKqa','appDesc','appName','map','remote','1429888MBdEvr','9FnhYQq','cookie','369690Vztcrw','6100OeLXRn','328246wlZIkT','3187520hTFwTu'];a19_0x4e19=function(){return _0x4ebf2a;};return a19_0x4e19();}async function execute(_0x3800fd){const _0x5c1e40=a19_0x3b47,{setActiveCookie:_0x32eb0d}=await import(_0x5c1e40(0xc5));_0x32eb0d(_0x3800fd[_0x5c1e40(0xbd)]);const _0x541d79=await listRemoteApps();return{'ok':!![],'data':{'items':_0x541d79[_0x5c1e40(0xb9)](_0x571953=>({..._0x571953['id']!=null?{'id':_0x571953['id']}:{},'appCode':_0x571953['appCode'],'appName':_0x571953[_0x5c1e40(0xca)],..._0x571953[_0x5c1e40(0xc9)]!=null?{'appDesc':_0x571953[_0x5c1e40(0xc9)]}:{}})),'meta':{'source':'platform'}}};}export const appRemoteDefinition={'service':a19_0x17033(0xc6),'command':a19_0x17033(0xba),'description':'List\x20apps\x20available\x20on\x20the\x20platform\x20for\x20the\x20current\x20login','risk':a19_0x17033(0xc2),'requiresAuth':!![],'requiresAppCode':![],'flags':[],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a20_0x450c(_0x572689,_0x271b0b){_0x572689=_0x572689-0xf7;const _0x160ddb=a20_0x160d();let _0x450c1c=_0x160ddb[_0x572689];return _0x450c1c;}(function(_0x2b405f,_0x3ecc9a){const _0x563c17=a20_0x450c,_0x42e2bc=_0x2b405f();while(!![]){try{const _0x806992=-parseInt(_0x563c17(0x101))/0x1*(parseInt(_0x563c17(0x100))/0x2)+parseInt(_0x563c17(0xfb))/0x3+parseInt(_0x563c17(0xf9))/0x4+parseInt(_0x563c17(0xfe))/0x5*(parseInt(_0x563c17(0xf8))/0x6)+-parseInt(_0x563c17(0xff))/0x7+-parseInt(_0x563c17(0xfa))/0x8*(-parseInt(_0x563c17(0xf7))/0x9)+parseInt(_0x563c17(0xfc))/0xa*(-parseInt(_0x563c17(0xfd))/0xb);if(_0x806992===_0x3ecc9a)break;else _0x42e2bc['push'](_0x42e2bc['shift']());}catch(_0x551119){_0x42e2bc['push'](_0x42e2bc['shift']());}}}(a20_0x160d,0x7168a));import{appListDefinition}from'../../commands/app/list.js';import{appRemoteDefinition}from'../../commands/app/discover.js';import{appUseDefinition}from'../../commands/app/use.js';import{appAddDefinition}from'../../commands/app/add.js';import{appRemoveDefinition}from'../../commands/app/remove.js';function a20_0x160d(){const _0x161567=['8CwZDPi','971247PhOcdK','46890YWrutj','2409SMXnBm','5VmSSYk','1548953YsmXrl','284868omQTtx','5WJcIvy','6247845ulIZiS','4250478KiPIXk','2793980Wmwmko'];a20_0x160d=function(){return _0x161567;};return a20_0x160d();}export const appDefinitions=[appListDefinition,appRemoteDefinition,appUseDefinition,appAddDefinition,appRemoveDefinition];
|
package/lib/commands/app/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a21_0x254189=a21_0x378b;(function(_0x44aad2,_0x1dd4ba){const _0x2bef50=a21_0x378b,_0x37c713=_0x44aad2();while(!![]){try{const _0x4c4582=parseInt(_0x2bef50(0x73))/0x1*(parseInt(_0x2bef50(0x79))/0x2)+parseInt(_0x2bef50(0x89))/0x3*(parseInt(_0x2bef50(0x71))/0x4)+parseInt(_0x2bef50(0x8c))/0x5*(parseInt(_0x2bef50(0x84))/0x6)+-parseInt(_0x2bef50(0x8b))/0x7+parseInt(_0x2bef50(0x87))/0x8*(-parseInt(_0x2bef50(0x8f))/0x9)+parseInt(_0x2bef50(0x7b))/0xa+-parseInt(_0x2bef50(0x8d))/0xb;if(_0x4c4582===_0x1dd4ba)break;else _0x37c713['push'](_0x37c713['shift']());}catch(_0x57e233){_0x37c713['push'](_0x37c713['shift']());}}}(a21_0x5075,0x3f675));function a21_0x5075(){const _0x1fc295=['1816WyRbys','projectPath','1845EUVmpd','globalPath','1209117WHEWHX','19085NuTeWD','11888030tiixtf','push','5778lwEqvr','projectConfig','object','\x20config','map','2276KuTjAS','globalConfig','6qBpSEh','appcode','isCurrent','length','\x20app\x20add\x20<name>\x20--appcode\x20<code>`\x20to\x20add\x20one.','list','129938HovCVk','Show\x20only\x20apps\x20from\x20project\x20.rabetbase.json','5145450UaHoHp','merged','global','apps','boolean','project','bool','No\x20apps\x20configured','entries','636Lqexup','\x20in\x20','inherit'];a21_0x5075=function(){return _0x1fc295;};return a21_0x5075();}import{readRawConfigWithLayers}from'../../context.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{buildAppProfileListFields}from'../../config/schema.js';import{appDefinedIn,enrichAppListItemsWithMergedSelection,resolveDefaultAppSource}from'../../commands/app/shared.js';function buildItemsFromLayer(_0x23471a,_0x12fe5e){const _0x4a4098=a21_0x378b,_0x672b8f=[],_0x3361bc=_0x23471a[_0x4a4098(0x7e)]&&typeof _0x23471a[_0x4a4098(0x7e)]===_0x4a4098(0x6e)?_0x23471a[_0x4a4098(0x7e)]:{},_0x40c6e1=_0x23471a['defaultApp']||undefined;for(const [_0x46295d,_0x256985]of Object[_0x4a4098(0x83)](_0x3361bc)){if(!_0x256985||typeof _0x256985!==_0x4a4098(0x6e)||!_0x256985[_0x4a4098(0x74)])continue;_0x672b8f[_0x4a4098(0x8e)]({'name':_0x46295d,'appcode':_0x256985[_0x4a4098(0x74)],'named':!![],'definedIn':_0x12fe5e,'isDefault':_0x46295d===_0x40c6e1,...buildAppProfileListFields(_0x256985)});}return _0x672b8f;}function buildMergedItems(_0x35b13c,_0x187f42){const _0x3a764f=a21_0x378b,{apps:apps={},defaultApp:_0x2be619}=_0x35b13c,_0x3ec87d=_0x187f42['globalConfig']['apps']&&typeof _0x187f42[_0x3a764f(0x72)][_0x3a764f(0x7e)]===_0x3a764f(0x6e)?_0x187f42[_0x3a764f(0x72)]['apps']:{},_0x48ef34=_0x187f42[_0x3a764f(0x6d)]['apps']&&typeof _0x187f42[_0x3a764f(0x6d)]['apps']==='object'?_0x187f42[_0x3a764f(0x6d)][_0x3a764f(0x7e)]:{},_0x5f0221=_0x187f42[_0x3a764f(0x6d)][_0x3a764f(0x86)]===![],_0x41f1b0=Object[_0x3a764f(0x83)](apps),_0x26ca89=_0x41f1b0[_0x3a764f(0x70)](([_0xaf3fd7,_0x191d71])=>({'name':_0xaf3fd7,'appcode':_0x191d71[_0x3a764f(0x74)],'named':!![],'definedIn':appDefinedIn(_0xaf3fd7,_0x3ec87d,_0x48ef34,_0x5f0221),'isDefault':_0xaf3fd7===_0x2be619,...buildAppProfileListFields(_0x191d71)}));return _0x26ca89;}function a21_0x378b(_0x315a96,_0x1a11e2){_0x315a96=_0x315a96-0x6d;const _0x5075ab=a21_0x5075();let _0x378b2c=_0x5075ab[_0x315a96];return _0x378b2c;}async function execute(_0x2fc865){const _0x37c15a=a21_0x378b,_0x3b92e6=_0x2fc865['bool'](_0x37c15a(0x7d)),_0x456821=_0x2fc865[_0x37c15a(0x81)](_0x37c15a(0x80)),_0x4edd81=_0x3b92e6?_0x37c15a(0x7d):_0x456821?_0x37c15a(0x80):_0x37c15a(0x7c),{config:_0x55fa3a,layers:_0x12b2c3}=readRawConfigWithLayers(),_0x1fd898=resolveDefaultAppSource(_0x12b2c3),{defaultApp:_0x155c64}=_0x55fa3a;let _0x5c4465,_0x15b947;switch(_0x4edd81){case _0x37c15a(0x7d):_0x5c4465=buildItemsFromLayer(_0x12b2c3['globalConfig'],_0x37c15a(0x7d)),_0x15b947=_0x12b2c3[_0x37c15a(0x8a)];break;case _0x37c15a(0x80):_0x5c4465=buildItemsFromLayer(_0x12b2c3[_0x37c15a(0x6d)],'project'),_0x15b947=_0x12b2c3[_0x37c15a(0x88)];break;default:_0x5c4465=buildMergedItems(_0x55fa3a,_0x12b2c3);break;}enrichAppListItemsWithMergedSelection(_0x5c4465,_0x2fc865['mergedCli']);if(_0x5c4465[_0x37c15a(0x76)]===0x0){const _0x2366ef=_0x4edd81===_0x37c15a(0x7c)?'':_0x37c15a(0x85)+_0x4edd81+_0x37c15a(0x6f);return{'ok':!![],'data':[],'message':_0x37c15a(0x82)+_0x2366ef+'.\x20Use\x20`'+CLI_BIN_NAME+_0x37c15a(0x77)};}const _0x215b1c=_0x5c4465['find'](_0x36f4ff=>_0x36f4ff[_0x37c15a(0x75)]===!![]),_0x21777a=_0x155c64??_0x215b1c?.['appcode']??null,_0x1fa4bc=_0x4edd81==='merged'?{'globalPath':_0x12b2c3[_0x37c15a(0x8a)]??null,'projectPath':_0x12b2c3[_0x37c15a(0x88)]??null,'defaultApp':_0x21777a,'defaultAppSource':_0x155c64!=null?_0x1fd898:null}:{'scope':_0x4edd81,'configPath':_0x15b947??null};return{'ok':!![],'data':{'items':_0x5c4465,'meta':_0x1fa4bc}};}export const appListDefinition={'service':'app','command':a21_0x254189(0x78),'description':'List\x20all\x20configured\x20apps','risk':'read','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a21_0x254189(0x7d),'type':a21_0x254189(0x7f),'description':'Show\x20only\x20apps\x20from\x20global\x20~/.rabetbase.json','default':![]},{'name':a21_0x254189(0x80),'type':a21_0x254189(0x7f),'description':a21_0x254189(0x7a),'default':![]}],'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a22_0x51d8(_0x5a2d27,_0x4f3880){_0x5a2d27=_0x5a2d27-0x16e;const _0xc0dd2a=a22_0xc0dd();let _0x51d83c=_0xc0dd2a[_0x5a2d27];return _0x51d83c;}const a22_0x425a57=a22_0x51d8;function a22_0xc0dd(){const _0x134c6b=['6613710nLndTS','global','70SFotPm','App\x20profile\x20name\x20to\x20remove','remove','boolean','both','trim','342138qqRacF','Usage:\x20','2938920PPJZdr','\x20Note:\x20app\x20\x22','keys','Missing\x20app\x20name.','object','Use\x20global\x20config\x20scope','Removed\x20app\x20\x22','args','validation','27YmYOPC','\x22\x20not\x20found.','\x20app\x20remove\x20<name>\x20[--global]','244563rYwzOM','project','apps','App\x20\x22','187075fdqZow','256806sksWJT','length','inherit','app','defaultApp','88zbDwPY','high-risk-write','globalConfig','\x22\x20still\x20defined\x20in\x20','396834vPkWhQ','projectConfig','\x20Default\x20app\x20changed\x20to\x20\x22'];a22_0xc0dd=function(){return _0x134c6b;};return a22_0xc0dd();}(function(_0xacd262,_0x1ae554){const _0x180762=a22_0x51d8,_0x29a55e=_0xacd262();while(!![]){try{const _0x6b1d26=parseInt(_0x180762(0x183))/0x1+-parseInt(_0x180762(0x178))/0x2+parseInt(_0x180762(0x191))/0x3+parseInt(_0x180762(0x174))/0x4*(-parseInt(_0x180762(0x16e))/0x5)+parseInt(_0x180762(0x16f))/0x6*(-parseInt(_0x180762(0x17d))/0x7)+-parseInt(_0x180762(0x185))/0x8+parseInt(_0x180762(0x18e))/0x9*(parseInt(_0x180762(0x17b))/0xa);if(_0x6b1d26===_0x1ae554)break;else _0x29a55e['push'](_0x29a55e['shift']());}catch(_0x280dd1){_0x29a55e['push'](_0x29a55e['shift']());}}}(a22_0xc0dd,0x90402));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{readRawConfigWithLayers}from'../../context.js';import{readConfig,writeConfig,scopeLabel,resolveAppScopeForWrite,appDefinedIn}from'../../commands/app/shared.js';async function validateArgs(_0x1c7a8b){const _0x444e36=a22_0x51d8,_0x10607c=_0x1c7a8b[_0x444e36(0x18c)][0x0]?.[_0x444e36(0x182)]();if(!_0x10607c)throw CliErrors[_0x444e36(0x18d)]('Missing\x20app\x20name.',_0x444e36(0x184)+CLI_BIN_NAME+_0x444e36(0x190));}async function execute(_0x2a2af3){const _0x4a5ede=a22_0x51d8,_0x2dcc79=_0x2a2af3[_0x4a5ede(0x18c)][0x0]?.[_0x4a5ede(0x182)]();if(!_0x2dcc79)throw CliErrors[_0x4a5ede(0x18d)](_0x4a5ede(0x188),'Usage:\x20'+CLI_BIN_NAME+_0x4a5ede(0x190));const _0x5dc79e=_0x2a2af3['bool'](_0x4a5ede(0x17c)),{config:_0x30b169,layers:_0x300736}=readRawConfigWithLayers(),_0x44c275=_0x30b169[_0x4a5ede(0x193)]??{};if(!_0x44c275[_0x2dcc79])throw CliErrors[_0x4a5ede(0x18d)](_0x4a5ede(0x194)+_0x2dcc79+_0x4a5ede(0x18f));const _0x20da12=_0x300736[_0x4a5ede(0x176)][_0x4a5ede(0x193)]&&typeof _0x300736[_0x4a5ede(0x176)]['apps']==='object'?_0x300736[_0x4a5ede(0x176)][_0x4a5ede(0x193)]:{},_0x390839=_0x300736[_0x4a5ede(0x179)][_0x4a5ede(0x193)]&&typeof _0x300736[_0x4a5ede(0x179)][_0x4a5ede(0x193)]===_0x4a5ede(0x189)?_0x300736[_0x4a5ede(0x179)]['apps']:{},_0x3d2bf6=appDefinedIn(_0x2dcc79,_0x20da12,_0x390839,_0x300736[_0x4a5ede(0x179)][_0x4a5ede(0x171)]===![]),_0x366edb=resolveAppScopeForWrite(_0x2dcc79,_0x5dc79e,_0x300736),_0x111d3e={'global':_0x366edb===_0x4a5ede(0x17c)},_0x11e2f0=readConfig(_0x111d3e),_0x4d7cfb=_0x11e2f0[_0x4a5ede(0x193)];if(!_0x4d7cfb||!_0x4d7cfb[_0x2dcc79])throw CliErrors['validation']('App\x20\x22'+_0x2dcc79+'\x22\x20not\x20found.');delete _0x4d7cfb[_0x2dcc79];let _0x7e1345='';if(_0x11e2f0[_0x4a5ede(0x173)]===_0x2dcc79){const _0x45dc37=Object[_0x4a5ede(0x187)](_0x4d7cfb);_0x11e2f0[_0x4a5ede(0x173)]=_0x45dc37[_0x4a5ede(0x170)]>0x0?_0x45dc37[0x0]:undefined,_0x11e2f0['defaultApp']?_0x7e1345=_0x4a5ede(0x17a)+_0x11e2f0[_0x4a5ede(0x173)]+'\x22.':delete _0x11e2f0[_0x4a5ede(0x173)];}Object[_0x4a5ede(0x187)](_0x4d7cfb)[_0x4a5ede(0x170)]===0x0&&(delete _0x11e2f0[_0x4a5ede(0x193)],delete _0x11e2f0[_0x4a5ede(0x173)]);writeConfig(_0x11e2f0,_0x111d3e);const _0x320bb4=_0x3d2bf6===_0x4a5ede(0x181)?_0x4a5ede(0x186)+_0x2dcc79+_0x4a5ede(0x177)+(_0x366edb==='project'?_0x4a5ede(0x17c):_0x4a5ede(0x192))+'\x20config.':'';return{'ok':!![],'message':_0x4a5ede(0x18b)+_0x2dcc79+'\x22'+scopeLabel(_0x111d3e)+'.'+_0x7e1345+_0x320bb4};}export const appRemoveDefinition={'service':a22_0x425a57(0x172),'command':a22_0x425a57(0x17f),'description':'Remove\x20an\x20app\x20from\x20config','risk':a22_0x425a57(0x175),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a22_0x425a57(0x17e),'required':!![]}],'flags':[{'name':a22_0x425a57(0x17c),'type':a22_0x425a57(0x180),'description':a22_0x425a57(0x18a),'default':![]}],'validate':validateArgs,'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4d7ed3,_0x4b925a){const _0x4d08bc=a23_0x4fbf,_0x3990f0=_0x4d7ed3();while(!![]){try{const _0x39e7c3=parseInt(_0x4d08bc(0x113))/0x1*(parseInt(_0x4d08bc(0x10d))/0x2)+parseInt(_0x4d08bc(0x106))/0x3+-parseInt(_0x4d08bc(0x105))/0x4+parseInt(_0x4d08bc(0xff))/0x5*(parseInt(_0x4d08bc(0x101))/0x6)+parseInt(_0x4d08bc(0x10f))/0x7+parseInt(_0x4d08bc(0xfe))/0x8+-parseInt(_0x4d08bc(0xfd))/0x9;if(_0x39e7c3===_0x4b925a)break;else _0x3990f0['push'](_0x3990f0['shift']());}catch(_0x42faf8){_0x3990f0['push'](_0x3990f0['shift']());}}}(a23_0x33fa,0xd8694));import{resolveWriteConfigPath,readConfigFile,writeConfigFile}from'../../context.js';export function enrichAppListItemsWithMergedSelection(_0x3edd95,_0x313553){const _0x5d3978=a23_0x4fbf;if(!_0x313553)return;const _0x145424=_0x313553[_0x5d3978(0x111)]&&typeof _0x313553[_0x5d3978(0x111)]===_0x5d3978(0x10b)?_0x313553[_0x5d3978(0x111)]:{},_0x20b450=Object['keys'](_0x145424)[_0x5d3978(0x109)]>0x0;for(const _0x3d5fba of _0x3edd95){_0x3d5fba[_0x5d3978(0x117)]=![];}const _0x235067=_0x313553[_0x5d3978(0x102)]!=null?String(_0x313553['appCode'])['trim']():'';if(_0x20b450){const _0x5d5434=_0x313553[_0x5d3978(0x118)]??_0x313553[_0x5d3978(0x112)];if(_0x5d5434)for(const _0x571a9f of _0x3edd95){_0x571a9f[_0x5d3978(0x11a)]===!![]&&_0x571a9f[_0x5d3978(0x103)]===_0x5d5434&&(_0x571a9f[_0x5d3978(0x117)]=!![]);}for(const _0x42c18d of _0x3edd95){if(_0x42c18d[_0x5d3978(0x11a)]!==![])continue;if(_0x313553[_0x5d3978(0x112)])continue;_0x235067&&String(_0x42c18d[_0x5d3978(0x10e)]??'')[_0x5d3978(0x114)]()===_0x235067&&(_0x42c18d['isCurrent']=!![]);}return;}if(!_0x235067)return;for(const _0x1618e4 of _0x3edd95){String(_0x1618e4[_0x5d3978(0x10e)]??'')[_0x5d3978(0x114)]()===_0x235067&&(_0x1618e4[_0x5d3978(0x117)]=!![]);}}export function resolveAppScopeForWrite(_0x2455a4,_0x300c18,_0x4754d5){const _0x5970a8=a23_0x4fbf;if(_0x300c18)return _0x5970a8(0x100);const _0x100a85=_0x4754d5['projectConfig']['apps']&&typeof _0x4754d5[_0x5970a8(0x115)][_0x5970a8(0x111)]===_0x5970a8(0x10b)?_0x4754d5['projectConfig'][_0x5970a8(0x111)]:{},_0x4a1baa=_0x4754d5['globalConfig'][_0x5970a8(0x111)]&&typeof _0x4754d5[_0x5970a8(0x10c)][_0x5970a8(0x111)]===_0x5970a8(0x10b)?_0x4754d5[_0x5970a8(0x10c)][_0x5970a8(0x111)]:{};if(Object['prototype'][_0x5970a8(0x10a)][_0x5970a8(0x107)](_0x100a85,_0x2455a4))return _0x5970a8(0x104);if(Object[_0x5970a8(0x110)][_0x5970a8(0x10a)][_0x5970a8(0x107)](_0x4a1baa,_0x2455a4))return'global';return _0x5970a8(0x104);}export function appDefinedIn(_0x47ad5f,_0x3f239f,_0x5d110b,_0xf76a6f){const _0x1169b3=a23_0x4fbf;if(_0xf76a6f)return Object[_0x1169b3(0x110)]['hasOwnProperty'][_0x1169b3(0x107)](_0x5d110b,_0x47ad5f)?_0x1169b3(0x104):_0x1169b3(0x100);const _0x41439c=Object['prototype'][_0x1169b3(0x10a)][_0x1169b3(0x107)](_0x3f239f,_0x47ad5f),_0x151847=Object[_0x1169b3(0x110)][_0x1169b3(0x10a)][_0x1169b3(0x107)](_0x5d110b,_0x47ad5f);if(_0x41439c&&_0x151847)return _0x1169b3(0x119);if(_0x151847)return'project';return'global';}export function resolveDefaultAppSource(_0x2045f3){const _0xaf372b=a23_0x4fbf,_0x3bb2e7=_0x2045f3[_0xaf372b(0x115)][_0xaf372b(0x111)]&&typeof _0x2045f3[_0xaf372b(0x115)][_0xaf372b(0x111)]==='object'?_0x2045f3[_0xaf372b(0x115)][_0xaf372b(0x111)]:{};if(_0xaf372b(0x112)in _0x2045f3[_0xaf372b(0x115)])return _0xaf372b(0x104);if(Object[_0xaf372b(0xfc)](_0x3bb2e7)['length']>0x0)return _0xaf372b(0x104);if(_0x2045f3[_0xaf372b(0x115)][_0xaf372b(0x108)]===![])return null;if(_0x2045f3[_0xaf372b(0x10c)][_0xaf372b(0x112)])return _0xaf372b(0x100);return null;}function a23_0x4fbf(_0x3a4e10,_0x2de20c){_0x3a4e10=_0x3a4e10-0xfc;const _0x33fa4d=a23_0x33fa();let _0x4fbf41=_0x33fa4d[_0x3a4e10];return _0x4fbf41;}export function getConfigPath(_0x44135a={}){const _0x4a3673=a23_0x4fbf,_0x571748=_0x44135a[_0x4a3673(0x100)]?'global':_0x4a3673(0x104);return resolveWriteConfigPath(_0x571748);}export function readConfig(_0x26805b={}){return readConfigFile(getConfigPath(_0x26805b));}export function writeConfig(_0x384945,_0x2067d1={}){writeConfigFile(getConfigPath(_0x2067d1),_0x384945);}export function scopeLabel(_0x3bc0c7){const _0x187c93=a23_0x4fbf;return _0x3bc0c7[_0x187c93(0x100)]?_0x187c93(0x116):'';}function a23_0x33fa(){const _0x5f2a46=['21410055jrDriC','3896984RyHJyx','25qCTcLG','global','1400958MCgYXr','appCode','name','project','1308292QrCAZs','981621OOKYga','call','inherit','length','hasOwnProperty','object','globalConfig','82kyGxuR','appcode','715134kIhImH','prototype','apps','defaultApp','36791xkUKqc','trim','projectConfig','\x20(global)','isCurrent','currentApp','both','named','keys'];a23_0x33fa=function(){return _0x5f2a46;};return a23_0x33fa();}
|
package/lib/commands/app/use.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x5e864c=a24_0xb8e4;function a24_0xb8e4(_0x3f7c34,_0x2f1118){_0x3f7c34=_0x3f7c34-0x10d;const _0x58caf4=a24_0x58ca();let _0xb8e4fc=_0x58caf4[_0x3f7c34];return _0xb8e4fc;}(function(_0x1e6f27,_0x3511c2){const _0xc76e18=a24_0xb8e4,_0x4c3de0=_0x1e6f27();while(!![]){try{const _0x757698=-parseInt(_0xc76e18(0x113))/0x1+-parseInt(_0xc76e18(0x11f))/0x2+-parseInt(_0xc76e18(0x129))/0x3*(-parseInt(_0xc76e18(0x131))/0x4)+-parseInt(_0xc76e18(0x116))/0x5+-parseInt(_0xc76e18(0x119))/0x6+-parseInt(_0xc76e18(0x114))/0x7*(parseInt(_0xc76e18(0x12f))/0x8)+-parseInt(_0xc76e18(0x12a))/0x9*(-parseInt(_0xc76e18(0x133))/0xa);if(_0x757698===_0x3511c2)break;else _0x4c3de0['push'](_0x4c3de0['shift']());}catch(_0x41c62d){_0x4c3de0['push'](_0x4c3de0['shift']());}}}(a24_0x58ca,0x4a8eb));import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{readRawConfigWithLayers,isInProject}from'../../context.js';import{readConfig,writeConfig,scopeLabel}from'../../commands/app/shared.js';async function validateArgs(_0x2a80e5){const _0x4f18d6=a24_0xb8e4,_0x52a83e=_0x2a80e5[_0x4f18d6(0x11c)][0x0]?.[_0x4f18d6(0x128)]();if(!_0x52a83e)throw CliErrors[_0x4f18d6(0x130)](_0x4f18d6(0x11e),_0x4f18d6(0x111)+CLI_BIN_NAME+_0x4f18d6(0x125));}async function execute(_0x5ec41b){const _0xab0c64=a24_0xb8e4,_0x28505b=_0x5ec41b[_0xab0c64(0x11c)][0x0]?.[_0xab0c64(0x128)]();if(!_0x28505b)throw CliErrors['validation'](_0xab0c64(0x11e),_0xab0c64(0x111)+CLI_BIN_NAME+_0xab0c64(0x125));const _0x5f1a42=_0x5ec41b[_0xab0c64(0x12d)]('global'),{config:_0x253445,layers:_0x144f65}=readRawConfigWithLayers(),_0x93507b=_0x253445[_0xab0c64(0x126)]??{},_0x15acd9=_0x144f65['globalConfig'][_0xab0c64(0x126)]&&typeof _0x144f65[_0xab0c64(0x118)][_0xab0c64(0x126)]===_0xab0c64(0x134)?_0x144f65[_0xab0c64(0x118)][_0xab0c64(0x126)]:{},_0x4b266d={..._0x15acd9,..._0x93507b};if(!_0x4b266d[_0x28505b]){const _0x288551=Object[_0xab0c64(0x11d)](_0x4b266d),_0x2163f9=_0x288551[_0xab0c64(0x11a)]===0x0?_0xab0c64(0x123)+CLI_BIN_NAME+_0xab0c64(0x10e)+_0x28505b+'\x20--appcode\x20<code>`\x20first.':'Available:\x20'+_0x288551['join'](',\x20');throw CliErrors[_0xab0c64(0x130)](_0xab0c64(0x117)+_0x28505b+_0xab0c64(0x10d),_0x2163f9);}let _0x644628,_0x1b40d8='';if(_0x5f1a42)_0x644628={'global':!![]};else{const _0x3f43b8=isInProject()&&!!_0x144f65['projectPath'];_0x644628={'global':!_0x3f43b8};}const _0x104edf=readConfig(_0x644628);_0x104edf['defaultApp']=_0x28505b;if(!_0x644628[_0xab0c64(0x115)]){const _0x401b34=_0x104edf[_0xab0c64(0x126)]&&typeof _0x104edf[_0xab0c64(0x126)]===_0xab0c64(0x134)?_0x104edf[_0xab0c64(0x126)]:{};!Object[_0xab0c64(0x11b)][_0xab0c64(0x10f)]['call'](_0x401b34,_0x28505b)&&(_0x104edf[_0xab0c64(0x126)]={..._0x401b34,[_0x28505b]:_0x4b266d[_0x28505b]},_0x1b40d8='\x0aNote:\x20\x22'+_0x28505b+_0xab0c64(0x127));}return writeConfig(_0x104edf,_0x644628),{'ok':!![],'message':_0xab0c64(0x124)+_0x28505b+_0xab0c64(0x12e)+_0x4b266d[_0x28505b][_0xab0c64(0x121)]+')'+scopeLabel(_0x644628)+_0x1b40d8};}function a24_0x58ca(){const _0x443a2c=['Use\x20`','Default\x20app\x20set\x20to\x20\x22','\x20app\x20use\x20<name>\x20[--global]','apps','\x22\x20was\x20defined\x20in\x20global\x20config;\x20profile\x20copied\x20into\x20project\x20so\x20the\x20project\x20config\x20self-resolves\x20under\x20the\x20default\x20project-first\x20inherit\x20policy.','trim','3CPoggr','9shJeeW','boolean','app','bool','\x22\x20(appcode:\x20','24HlLmBG','validation','1005892niEIvR','Switch\x20the\x20default\x20app','18673190Edjiou','object','\x22\x20not\x20found.','\x20app\x20add\x20','hasOwnProperty','Use\x20global\x20config\x20scope','Usage:\x20','App\x20profile\x20name\x20to\x20activate','125464klHwFf','393078cAHIfj','global','1944535lncjzF','App\x20\x22','globalConfig','3510420KGSxqD','length','prototype','args','keys','Missing\x20app\x20name.','1091004CFLEhI','write','appcode','use'];a24_0x58ca=function(){return _0x443a2c;};return a24_0x58ca();}export const appUseDefinition={'service':a24_0x5e864c(0x12c),'command':a24_0x5e864c(0x122),'description':a24_0x5e864c(0x132),'risk':a24_0x5e864c(0x120),'requiresAuth':![],'requiresAppCode':![],'args':[{'name':'name','description':a24_0x5e864c(0x112),'required':!![]}],'flags':[{'name':a24_0x5e864c(0x115),'type':a24_0x5e864c(0x12b),'description':a24_0x5e864c(0x110),'default':![]}],'validate':validateArgs,'execute':execute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a25_0x5c7418=a25_0x1134;(function(_0x239345,_0x13dbb1){const _0x2b5943=a25_0x1134,_0xd80752=_0x239345();while(!![]){try{const _0x13336d=parseInt(_0x2b5943(0x10d))/0x1+-parseInt(_0x2b5943(0x108))/0x2*(parseInt(_0x2b5943(0x10a))/0x3)+parseInt(_0x2b5943(0x101))/0x4*(parseInt(_0x2b5943(0xff))/0x5)+parseInt(_0x2b5943(0x10b))/0x6*(-parseInt(_0x2b5943(0x112))/0x7)+parseInt(_0x2b5943(0xfb))/0x8+-parseInt(_0x2b5943(0x10e))/0x9*(parseInt(_0x2b5943(0x111))/0xa)+parseInt(_0x2b5943(0xfa))/0xb;if(_0x13336d===_0x13dbb1)break;else _0xd80752['push'](_0xd80752['shift']());}catch(_0x278264){_0xd80752['push'](_0xd80752['shift']());}}}(a25_0x2ad8,0xcd7c2));function a25_0x2ad8(){const _0x3549e2=['../../auth/auth-server-ui.js','boolean','nonInteractive','log','6peZdtA','read','1500837YzjfpT','18GIXojS','!\x20Not\x20logged\x20in','500697WWyBlh','18opZruT','✓\x20Logged\x20out','login','7595770eTUkai','3387783Vdzact','bool','28644550cePeyf','7946344irhlUe','yes','Login\x20via\x20browser','Clear\x20login\x20session','10JhHluF','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','2431048PjPsLI','logout','write'];a25_0x2ad8=function(){return _0x3549e2;};return a25_0x2ad8();}import{unlinkSync,existsSync}from'node:fs';function a25_0x1134(_0x58dee6,_0x2e9e01){_0x58dee6=_0x58dee6-0xfa;const _0x2ad86b=a25_0x2ad8();let _0x1134da=_0x2ad86b[_0x58dee6];return _0x1134da;}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':a25_0x5c7418(0x110),'description':a25_0x5c7418(0xfd),'risk':a25_0x5c7418(0x109),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a25_0x5c7418(0xfc),'type':a25_0x5c7418(0x105),'description':a25_0x5c7418(0x100),'default':![]}],async 'execute'(_0x370f96){const _0x152c18=a25_0x5c7418,{runAuthServer:_0x1ed06a}=await import(_0x152c18(0x104));return await _0x1ed06a({'autoYes':_0x370f96[_0x152c18(0x113)](_0x152c18(0xfc)),'nonInteractive':_0x370f96[_0x152c18(0x106)]}),{'ok':!![]};}},{'service':'auth','command':a25_0x5c7418(0x102),'description':a25_0x5c7418(0xfe),'risk':a25_0x5c7418(0x103),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x1184d3){const _0x14d517=a25_0x5c7418;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x14d517(0x107)](_0x14d517(0x10f))):console[_0x14d517(0x107)](_0x14d517(0x10c)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a26_0x310a98=a26_0x198a;(function(_0x174dda,_0xe189ee){const _0x1373d7=a26_0x198a,_0x1f5f3c=_0x174dda();while(!![]){try{const _0x4046f9=-parseInt(_0x1373d7(0x196))/0x1+parseInt(_0x1373d7(0x162))/0x2+-parseInt(_0x1373d7(0x186))/0x3+parseInt(_0x1373d7(0x181))/0x4+-parseInt(_0x1373d7(0x174))/0x5*(parseInt(_0x1373d7(0x164))/0x6)+-parseInt(_0x1373d7(0x15b))/0x7+-parseInt(_0x1373d7(0x15e))/0x8*(-parseInt(_0x1373d7(0x1a1))/0x9);if(_0x4046f9===_0xe189ee)break;else _0x1f5f3c['push'](_0x1f5f3c['shift']());}catch(_0x3272c8){_0x1f5f3c['push'](_0x1f5f3c['shift']());}}}(a26_0x1b3f,0x3f6f1));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';function a26_0x198a(_0x5b7f00,_0x37105a){_0x5b7f00=_0x5b7f00-0x15b;const _0x1b3f17=a26_0x1b3f();let _0x198a30=_0x1b3f17[_0x5b7f00];return _0x198a30;}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 bffCreate={'service':a26_0x310a98(0x17e),'command':'create','description':a26_0x310a98(0x179),'risk':a26_0x310a98(0x165),'flags':[{'name':a26_0x310a98(0x185),'type':a26_0x310a98(0x18c),'required':!![],'enum':['COMMON',a26_0x310a98(0x160),a26_0x310a98(0x1b4)],'description':'Script\x20type'},{'name':'name','type':a26_0x310a98(0x18c),'required':!![],'description':a26_0x310a98(0x1b1)},{'name':a26_0x310a98(0x18e),'type':a26_0x310a98(0x18c),'description':a26_0x310a98(0x17f)},{'name':a26_0x310a98(0x1b0),'type':a26_0x310a98(0x18c),'description':a26_0x310a98(0x1b7)},{'name':a26_0x310a98(0x16b),'type':'string','description':a26_0x310a98(0x18b)},{'name':'operation-type','type':'string','description':a26_0x310a98(0x19f)},{'name':'function-node','type':a26_0x310a98(0x18c),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a26_0x310a98(0x183),a26_0x310a98(0x1a5)]}],async 'validate'(_0x596e52){const _0x4ed957=a26_0x310a98,_0x5d0a5e=_0x596e52[_0x4ed957(0x189)](_0x4ed957(0x16c));if(!isValidBffFunctionName(_0x5d0a5e))throw CliErrors[_0x4ed957(0x16a)](_0x4ed957(0x170)+_0x5d0a5e+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x553bfb){const _0x29e6d7=a26_0x310a98,_0x237ef3=loadBffProjectConfig(_0x553bfb[_0x29e6d7(0x1b3)]),_0x4a538e=_0x553bfb['str'](_0x29e6d7(0x185)),_0x88479b=_0x553bfb[_0x29e6d7(0x189)]('name'),_0x1ce98f=_0x553bfb[_0x29e6d7(0x189)](_0x29e6d7(0x18e))||undefined,_0x522eae=_0x4a538e===_0x29e6d7(0x1b4)?await resolveHookOptions(_0x237ef3,_0x553bfb):undefined,_0x2319cc=buildFilePath(_0x237ef3,_0x4a538e,_0x88479b,_0x522eae);if(await fileExists(_0x2319cc))throw CliErrors[_0x29e6d7(0x16a)](_0x29e6d7(0x1b8)+_0x2319cc);await mkdir(dirname(_0x2319cc),{'recursive':!![]});const _0x13c40b=generateTemplate(_0x4a538e,_0x88479b,_0x553bfb[_0x29e6d7(0x1b3)],_0x1ce98f,_0x522eae);await writeFile(_0x2319cc,_0x13c40b,_0x29e6d7(0x17a));const _0x11034f={'type':_0x4a538e,'name':_0x88479b,'path':_0x2319cc};if(_0x1ce98f)_0x11034f[_0x29e6d7(0x18e)]=_0x1ce98f;if(_0x522eae){if(_0x522eae[_0x29e6d7(0x1b0)])_0x11034f['alias']=_0x522eae[_0x29e6d7(0x1b0)];_0x11034f[_0x29e6d7(0x18d)]=_0x522eae[_0x29e6d7(0x18d)],_0x11034f[_0x29e6d7(0x19b)]=_0x522eae['operationType'],_0x11034f['functionNode']=_0x522eae[_0x29e6d7(0x195)];}return{'ok':!![],'data':_0x11034f,'message':_0x29e6d7(0x17c)+_0x4a538e+'\x20function:\x20'+_0x88479b};}};async function resolveHookOptions(_0x13c684,_0x47c028){const _0x4e279a=a26_0x310a98,_0x5e5e06=loadAliasMap(_0x47c028['apiDir'],undefined,resolveApiFilePath(_0x47c028[_0x4e279a(0x1a8)],_0x47c028['appCode'])),_0x27d785=_0x5e5e06[_0x4e279a(0x191)]>0x0;let _0x5a1c91,_0x4a674f,_0x4d35a5;const _0x563fa9=_0x47c028['str'](_0x4e279a(0x1b0)),_0x2ff793=_0x47c028['str'](_0x4e279a(0x16b));if(_0x563fa9){const _0x331800=resolveAlias(_0x47c028[_0x4e279a(0x1a8)],_0x563fa9,undefined,resolveApiFilePath(_0x47c028[_0x4e279a(0x1a8)],_0x47c028[_0x4e279a(0x1b3)]));if(!_0x331800){const _0x5f0417=_0x27d785?_0x4e279a(0x178)+_0x5e5e06[_0x4e279a(0x1a4)](_0x515997=>_0x515997[_0x4e279a(0x1b0)])[_0x4e279a(0x194)](',\x20'):'No\x20api.ts\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x4e279a(0x1ac);throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x190)+_0x563fa9+_0x4e279a(0x1a7)+_0x5f0417);}_0x5a1c91=_0x563fa9,_0x4a674f=_0x331800;}else{if(_0x2ff793){_0x4a674f=_0x2ff793;const _0x14f7ac=_0x5e5e06[_0x4e279a(0x1a0)](_0x429d55=>_0x429d55[_0x4e279a(0x18d)]===_0x2ff793);_0x5a1c91=_0x14f7ac?.[_0x4e279a(0x1b0)];}else{if(_0x47c028[_0x4e279a(0x19c)])throw CliErrors['validation'](_0x4e279a(0x15d));else{if(_0x27d785){const _0x3a5f55=_0x5e5e06['map'](_0x3ec8af=>_0x3ec8af[_0x4e279a(0x1b0)]+'\x20('+_0x3ec8af['tableName']+')'),_0x23d9f4=await promptSelect(_0x4e279a(0x1a3),_0x3a5f55),_0x1ae19d=_0x5e5e06[_0x23d9f4];if(!_0x1ae19d)throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x1a2));_0x5a1c91=_0x1ae19d[_0x4e279a(0x1b0)],_0x4a674f=_0x1ae19d[_0x4e279a(0x18d)];}else{const _0x2f031a=await listDatasets(_0x47c028[_0x4e279a(0x1b3)]);if(_0x2f031a[_0x4e279a(0x191)]===0x0)throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x184));const _0x3419af=_0x2f031a[_0x4e279a(0x1a4)](_0xcfb637=>_0xcfb637[_0x4e279a(0x16c)]+'\x20['+(_0xcfb637[_0x4e279a(0x18f)]??_0x4e279a(0x163))+_0x4e279a(0x1aa)+_0xcfb637[_0x4e279a(0x198)]+')'),_0x2856c8=await promptSelect(_0x4e279a(0x1a3),_0x3419af),_0x201652=_0x2f031a[_0x2856c8];if(!_0x201652)throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x1a2));_0x4a674f=_0x201652[_0x4e279a(0x198)],_0x5a1c91=undefined;}}}}const _0x23f85c=await listDatasets(_0x47c028[_0x4e279a(0x1b3)]),_0x37495d=_0x23f85c[_0x4e279a(0x1a0)](_0x3c3208=>_0x3c3208[_0x4e279a(0x198)]===_0x4a674f);if(!_0x37495d)throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x197)+_0x4a674f+_0x4e279a(0x1a9)+(_0x5a1c91?_0x4e279a(0x187)+CLI_BIN_NAME+_0x4e279a(0x17b):''));_0x4d35a5=_0x37495d['id'];const _0x5d9389=_0x5a1c91??_0x4a674f,_0x1d5695=await listBffDatasetOperations(_0x47c028['appCode'],_0x4d35a5),_0x314f11=_0x1d5695?Object['keys'](_0x1d5695):[];if(_0x314f11['length']===0x0)throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x17d)+_0x5d9389+'.');let _0x531b80;const _0x25aa45=_0x47c028[_0x4e279a(0x189)](_0x4e279a(0x1af));if(_0x25aa45){if(!_0x314f11[_0x4e279a(0x168)](_0x25aa45))throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x15c)+_0x25aa45+_0x4e279a(0x177)+_0x5d9389+'.\x20'+(_0x4e279a(0x1ab)+_0x314f11[_0x4e279a(0x194)](',\x20')));_0x531b80=_0x25aa45;}else{if(_0x47c028[_0x4e279a(0x19c)])throw CliErrors[_0x4e279a(0x16a)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x1aebab=await promptSelect(_0x4e279a(0x171),_0x314f11);_0x531b80=_0x314f11[_0x1aebab]??_0x314f11[0x0];}let _0xaa70bd=normalizeHookFunctionNode(_0x47c028[_0x4e279a(0x189)](_0x4e279a(0x199)));if(!_0xaa70bd){if(_0x47c028[_0x4e279a(0x189)]('function-node'))throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x16f));if(_0x47c028['nonInteractive'])throw CliErrors[_0x4e279a(0x16a)](_0x4e279a(0x169));const _0x4deeec=await promptSelect(_0x4e279a(0x18a),[_0x4e279a(0x183),'after']);_0xaa70bd=[_0x4e279a(0x183),_0x4e279a(0x1a5)][_0x4deeec]??_0x4e279a(0x183);}return{'alias':_0x5a1c91,'datasetCode':_0x4a674f,'datasetId':_0x4d35a5,'operationType':_0x531b80,'functionNode':_0xaa70bd};}async function promptSelect(_0xb5b746,_0x3f45d2){const _0x16e6fd=a26_0x310a98;if(_0x3f45d2[_0x16e6fd(0x191)]===0x1)return 0x0;for(const [_0x241ed7,_0x274815]of _0x3f45d2[_0x16e6fd(0x15f)]()){process['stderr'][_0x16e6fd(0x165)]('\x20\x20'+(_0x241ed7+0x1)+'.\x20'+_0x274815+'\x0a');}const _0x484477=createInterface({'input':process[_0x16e6fd(0x19d)],'output':process[_0x16e6fd(0x16d)]});while(!![]){const _0x50770b=await new Promise(_0x508c50=>{const _0x63abf6=_0x16e6fd;_0x484477[_0x63abf6(0x192)](_0xb5b746+'\x20',_0x508c50);}),_0xc265dd=Number[_0x16e6fd(0x1b2)](_0x50770b[_0x16e6fd(0x1b6)](),0xa);if(Number[_0x16e6fd(0x166)](_0xc265dd)&&_0xc265dd>=0x1&&_0xc265dd<=_0x3f45d2[_0x16e6fd(0x191)])return _0x484477['close'](),_0xc265dd-0x1;process[_0x16e6fd(0x16d)][_0x16e6fd(0x165)](_0x16e6fd(0x167)+_0x3f45d2[_0x16e6fd(0x191)]+'.\x0a');}}function a26_0x1b3f(){const _0x34261d=['643809SUwhEK','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','str','Select\x20trigger\x20node:','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','string','datasetCode','description','source','Alias\x20\x22','length','question','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','join','functionNode','435395UXsjbv','Dataset\x20not\x20found\x20for\x20code\x20\x22','code','function-node','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','operationType','nonInteractive','stdin','\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','Operation\x20type\x20(HOOK\x20only)','find','2904786GEPshM','Invalid\x20dataset\x20selection.','Select\x20dataset:','map','after','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','\x22\x20not\x20found.\x20','apiDir','\x22.\x20',']\x20(','Available:\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','\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','\x0a\x20*\x20[脚本名称]\x20','operation-type','alias','Function\x20name\x20(valid\x20JS\x20identifier)','parseInt','appCode','HOOK','scriptsRootDir','trim','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','File\x20already\x20exists:\x20','232470pNfjVB','Operation\x20type\x20\x22','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','16GwyHbf','entries','ENDPOINT','.js','576304wVCzuZ','UNKNOWN','102FnZWOJ','write','isInteger','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','includes','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','validation','datasetcode','name','stderr','HOOK\x20requires\x20alias/operation/node\x20options.','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Invalid\x20function\x20name\x20\x22','Select\x20operation\x20type:','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','84395PMOGww','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','TODO:\x20add\x20script\x20description','\x22\x20not\x20found\x20for\x20dataset\x20','Available\x20aliases:\x20','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','utf8','\x20api\x20pull`\x20to\x20refresh.','Created\x20','No\x20operation\x20types\x20found\x20for\x20dataset\x20','bff','Script\x20description','.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','1185264AKPMvz','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/{appCode}/{scriptName}\x0a\x20*\x20[当前示例]\x20POST\x20/api/endpoint/','before','No\x20datasets\x20found\x20for\x20this\x20app.','type'];a26_0x1b3f=function(){return _0x34261d;};return a26_0x1b3f();}function buildFilePath(_0x5a2091,_0x525428,_0x243537,_0x3c2ac0){const _0x4d959a=a26_0x310a98;if(_0x525428===_0x4d959a(0x1b4)){if(!_0x3c2ac0)throw CliErrors['validation'](_0x4d959a(0x16e));const _0x4df474=_0x3c2ac0[_0x4d959a(0x1b0)]??_0x3c2ac0[_0x4d959a(0x18d)];return join(_0x5a2091[_0x4d959a(0x1b5)],_0x4d959a(0x1b4),_0x4df474,_0x3c2ac0[_0x4d959a(0x19b)],_0x3c2ac0['functionNode'],_0x243537+_0x4d959a(0x161));}return join(_0x5a2091[_0x4d959a(0x1b5)],_0x525428,_0x243537+_0x4d959a(0x161));}export function generateTemplate(_0x2199ee,_0x3b8e25,_0x34bc47,_0x3d67bb,_0x5628ce){const _0x202afa=a26_0x310a98,_0xaa803=_0x3d67bb?.['trim']()||_0x202afa(0x176);if(_0x2199ee==='COMMON')return _0x202afa(0x188)+_0xaa803+_0x202afa(0x1ae)+_0x3b8e25+_0x202afa(0x19a)+_0x3b8e25+_0x202afa(0x180)+_0x3b8e25+_0x202afa(0x1a6);if(_0x2199ee===_0x202afa(0x160))return _0x202afa(0x175)+_0xaa803+_0x202afa(0x182)+_0x34bc47+'/'+_0x3b8e25+_0x202afa(0x19e)+_0x3b8e25+_0x202afa(0x1a6);if(!_0x5628ce)throw CliErrors[_0x202afa(0x16a)](_0x202afa(0x173));return _0x202afa(0x193)+_0xaa803+_0x202afa(0x172)+_0x34bc47+'/'+_0x5628ce[_0x202afa(0x18d)]+'/'+_0x5628ce[_0x202afa(0x19b)]+'\x0a\x20*\x20[触发节点]\x20'+_0x5628ce[_0x202afa(0x195)]+_0x202afa(0x1ad)+_0x3b8e25+_0x202afa(0x1a6);}
|
|
1
|
+
const a26_0x1dee6e=a26_0x59dd;(function(_0x317d1c,_0x43f1f5){const _0x3dee3d=a26_0x59dd,_0x2739f2=_0x317d1c();while(!![]){try{const _0x183953=-parseInt(_0x3dee3d(0x212))/0x1+-parseInt(_0x3dee3d(0x1f9))/0x2+parseInt(_0x3dee3d(0x22c))/0x3*(parseInt(_0x3dee3d(0x1db))/0x4)+parseInt(_0x3dee3d(0x1f1))/0x5+-parseInt(_0x3dee3d(0x1e2))/0x6*(parseInt(_0x3dee3d(0x219))/0x7)+parseInt(_0x3dee3d(0x1fa))/0x8+parseInt(_0x3dee3d(0x1e5))/0x9;if(_0x183953===_0x43f1f5)break;else _0x2739f2['push'](_0x2739f2['shift']());}catch(_0x3d30d9){_0x2739f2['push'](_0x2739f2['shift']());}}}(a26_0x97b0,0x5d6ec));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';function a26_0x97b0(){const _0x3625bd=['Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','question','string','alias','close','Available:\x20','No\x20api.ts\x20found.\x20Run\x20`','after','Invalid\x20dataset\x20selection.','datasetCode','Available\x20aliases:\x20','validation','300318QjFyQG','Operation\x20type\x20(HOOK\x20only)','datasetcode','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','function-node','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','4cHXqkw','Trigger\x20node\x20(HOOK\x20only)','\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','operation-type','map','Select\x20dataset:','before','59172kkrjPJ','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','Function\x20name\x20(valid\x20JS\x20identifier)','2514843UMVXoK','.js','description','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','UNKNOWN','create','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Select\x20trigger\x20node:','Invalid\x20function\x20name\x20\x22','Dataset\x20not\x20found\x20for\x20code\x20\x22','stderr','Select\x20operation\x20type:','2506285QLlkPe','HOOK',']\x20(','code','apiDir','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','str','utf8','57142UvNsOR','2065088THgnew','ENDPOINT','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','find','scriptsRootDir','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/{appCode}/{scriptName}\x0a\x20*\x20[当前示例]\x20POST\x20/api/endpoint/','No\x20datasets\x20found\x20for\x20this\x20app.','\x20function:\x20','Script\x20description','length','appCode','trim','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','stdin','operationType','entries','write','\x0a\x20*\x20[触发节点]\x20','source','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','TODO:\x20add\x20script\x20description','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','Created\x20','\x0a\x20*\x20[脚本名称]\x20','717793TiKlIz','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','join','functionNode','type','.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*\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','7zGgvMv','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','includes','nonInteractive','name','COMMON','bff'];a26_0x97b0=function(){return _0x3625bd;};return a26_0x97b0();}import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';function a26_0x59dd(_0x387974,_0x4c8544){_0x387974=_0x387974-0x1d7;const _0x97b007=a26_0x97b0();let _0x59ddea=_0x97b007[_0x387974];return _0x59ddea;}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 bffCreate={'service':a26_0x1dee6e(0x21f),'command':a26_0x1dee6e(0x1ea),'description':'Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','risk':a26_0x1dee6e(0x20a),'flags':[{'name':'type','type':'string','required':!![],'enum':[a26_0x1dee6e(0x21e),a26_0x1dee6e(0x1fb),a26_0x1dee6e(0x1f2)],'description':'Script\x20type'},{'name':a26_0x1dee6e(0x21d),'type':a26_0x1dee6e(0x222),'required':!![],'description':a26_0x1dee6e(0x1e4)},{'name':a26_0x1dee6e(0x1e7),'type':a26_0x1dee6e(0x222),'description':a26_0x1dee6e(0x202)},{'name':'alias','type':a26_0x1dee6e(0x222),'description':a26_0x1dee6e(0x1eb)},{'name':a26_0x1dee6e(0x1d7),'type':a26_0x1dee6e(0x222),'description':a26_0x1dee6e(0x220)},{'name':a26_0x1dee6e(0x1de),'type':a26_0x1dee6e(0x222),'description':a26_0x1dee6e(0x22d)},{'name':'function-node','type':a26_0x1dee6e(0x222),'description':a26_0x1dee6e(0x1dc),'enum':[a26_0x1dee6e(0x1e1),a26_0x1dee6e(0x227)]}],async 'validate'(_0x1b693f){const _0xe64294=a26_0x1dee6e,_0x15dc16=_0x1b693f[_0xe64294(0x1f7)](_0xe64294(0x21d));if(!isValidBffFunctionName(_0x15dc16))throw CliErrors['validation'](_0xe64294(0x1ed)+_0x15dc16+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x3337bd){const _0x50bc45=a26_0x1dee6e,_0xdfba5f=loadBffProjectConfig(_0x3337bd['appCode']),_0x346aa8=_0x3337bd[_0x50bc45(0x1f7)](_0x50bc45(0x216)),_0x699754=_0x3337bd[_0x50bc45(0x1f7)](_0x50bc45(0x21d)),_0x2db7ca=_0x3337bd[_0x50bc45(0x1f7)]('description')||undefined,_0x2642df=_0x346aa8==='HOOK'?await resolveHookOptions(_0xdfba5f,_0x3337bd):undefined,_0x4c10d7=buildFilePath(_0xdfba5f,_0x346aa8,_0x699754,_0x2642df);if(await fileExists(_0x4c10d7))throw CliErrors[_0x50bc45(0x22b)]('File\x20already\x20exists:\x20'+_0x4c10d7);await mkdir(dirname(_0x4c10d7),{'recursive':!![]});const _0x22ddcc=generateTemplate(_0x346aa8,_0x699754,_0x3337bd[_0x50bc45(0x204)],_0x2db7ca,_0x2642df);await writeFile(_0x4c10d7,_0x22ddcc,_0x50bc45(0x1f8));const _0x3df093={'type':_0x346aa8,'name':_0x699754,'path':_0x4c10d7};if(_0x2db7ca)_0x3df093[_0x50bc45(0x1e7)]=_0x2db7ca;if(_0x2642df){if(_0x2642df[_0x50bc45(0x223)])_0x3df093[_0x50bc45(0x223)]=_0x2642df['alias'];_0x3df093[_0x50bc45(0x229)]=_0x2642df[_0x50bc45(0x229)],_0x3df093[_0x50bc45(0x208)]=_0x2642df[_0x50bc45(0x208)],_0x3df093[_0x50bc45(0x215)]=_0x2642df[_0x50bc45(0x215)];}return{'ok':!![],'data':_0x3df093,'message':_0x50bc45(0x210)+_0x346aa8+_0x50bc45(0x201)+_0x699754};}};async function resolveHookOptions(_0x2c524b,_0x2f4e91){const _0x1c7285=a26_0x1dee6e,_0x566cb0=loadAliasMap(_0x2f4e91[_0x1c7285(0x1f5)],undefined,resolveApiFilePath(_0x2f4e91['apiDir'],_0x2f4e91[_0x1c7285(0x204)])),_0x49f9e9=_0x566cb0[_0x1c7285(0x203)]>0x0;let _0x3a9021,_0xbcd9cf,_0x5c3dba;const _0x4dc243=_0x2f4e91[_0x1c7285(0x1f7)](_0x1c7285(0x223)),_0x4e6050=_0x2f4e91[_0x1c7285(0x1f7)]('datasetcode');if(_0x4dc243){const _0x1d4cd3=resolveAlias(_0x2f4e91['apiDir'],_0x4dc243,undefined,resolveApiFilePath(_0x2f4e91[_0x1c7285(0x1f5)],_0x2f4e91[_0x1c7285(0x204)]));if(!_0x1d4cd3){const _0x2088d6=_0x49f9e9?_0x1c7285(0x22a)+_0x566cb0[_0x1c7285(0x1df)](_0x44d668=>_0x44d668[_0x1c7285(0x223)])['join'](',\x20'):_0x1c7285(0x226)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x1c7285(0x22b)]('Alias\x20\x22'+_0x4dc243+'\x22\x20not\x20found.\x20'+_0x2088d6);}_0x3a9021=_0x4dc243,_0xbcd9cf=_0x1d4cd3;}else{if(_0x4e6050){_0xbcd9cf=_0x4e6050;const _0x193862=_0x566cb0[_0x1c7285(0x1fd)](_0x4feba1=>_0x4feba1['datasetCode']===_0x4e6050);_0x3a9021=_0x193862?.['alias'];}else{if(_0x2f4e91['nonInteractive'])throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x206));else{if(_0x49f9e9){const _0x480f1e=_0x566cb0[_0x1c7285(0x1df)](_0x81880e=>_0x81880e[_0x1c7285(0x223)]+'\x20('+_0x81880e['tableName']+')'),_0x2acfe4=await promptSelect(_0x1c7285(0x1e0),_0x480f1e),_0x32f3f4=_0x566cb0[_0x2acfe4];if(!_0x32f3f4)throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x228));_0x3a9021=_0x32f3f4['alias'],_0xbcd9cf=_0x32f3f4[_0x1c7285(0x229)];}else{const _0x2c6d69=await listDatasets(_0x2f4e91[_0x1c7285(0x204)]);if(_0x2c6d69['length']===0x0)throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x200));const _0x2456df=_0x2c6d69['map'](_0x32fc18=>_0x32fc18['name']+'\x20['+(_0x32fc18[_0x1c7285(0x20c)]??_0x1c7285(0x1e9))+_0x1c7285(0x1f3)+_0x32fc18[_0x1c7285(0x1f4)]+')'),_0x5cbe17=await promptSelect(_0x1c7285(0x1e0),_0x2456df),_0x25941c=_0x2c6d69[_0x5cbe17];if(!_0x25941c)throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x228));_0xbcd9cf=_0x25941c[_0x1c7285(0x1f4)],_0x3a9021=undefined;}}}}const _0x205902=await listDatasets(_0x2f4e91[_0x1c7285(0x204)]),_0x2591b8=_0x205902[_0x1c7285(0x1fd)](_0x5cb4f6=>_0x5cb4f6[_0x1c7285(0x1f4)]===_0xbcd9cf);if(!_0x2591b8)throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x1ee)+_0xbcd9cf+'\x22.\x20'+(_0x3a9021?_0x1c7285(0x1da)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x5c3dba=_0x2591b8['id'];const _0x1c3ba2=_0x3a9021??_0xbcd9cf,_0x37caaf=await listBffDatasetOperations(_0x2f4e91[_0x1c7285(0x204)],_0x5c3dba),_0x466464=_0x37caaf?Object['keys'](_0x37caaf):[];if(_0x466464[_0x1c7285(0x203)]===0x0)throw CliErrors['validation']('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x1c3ba2+'.');let _0x26c053;const _0x3070ae=_0x2f4e91[_0x1c7285(0x1f7)](_0x1c7285(0x1de));if(_0x3070ae){if(!_0x466464[_0x1c7285(0x21b)](_0x3070ae))throw CliErrors[_0x1c7285(0x22b)]('Operation\x20type\x20\x22'+_0x3070ae+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x1c3ba2+'.\x20'+(_0x1c7285(0x225)+_0x466464[_0x1c7285(0x214)](',\x20')));_0x26c053=_0x3070ae;}else{if(_0x2f4e91[_0x1c7285(0x21c)])throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x1e8));const _0x4c0891=await promptSelect(_0x1c7285(0x1f0),_0x466464);_0x26c053=_0x466464[_0x4c0891]??_0x466464[0x0];}let _0x1d9426=normalizeHookFunctionNode(_0x2f4e91[_0x1c7285(0x1f7)]('function-node'));if(!_0x1d9426){if(_0x2f4e91['str'](_0x1c7285(0x1d9)))throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x21a));if(_0x2f4e91[_0x1c7285(0x21c)])throw CliErrors[_0x1c7285(0x22b)](_0x1c7285(0x213));const _0x3eb25d=await promptSelect(_0x1c7285(0x1ec),['before',_0x1c7285(0x227)]);_0x1d9426=[_0x1c7285(0x1e1),_0x1c7285(0x227)][_0x3eb25d]??_0x1c7285(0x1e1);}return{'alias':_0x3a9021,'datasetCode':_0xbcd9cf,'datasetId':_0x5c3dba,'operationType':_0x26c053,'functionNode':_0x1d9426};}async function promptSelect(_0x54061c,_0x1ac805){const _0x352cf5=a26_0x1dee6e;if(_0x1ac805[_0x352cf5(0x203)]===0x1)return 0x0;for(const [_0x390d47,_0x508d4d]of _0x1ac805[_0x352cf5(0x209)]()){process[_0x352cf5(0x1ef)]['write']('\x20\x20'+(_0x390d47+0x1)+'.\x20'+_0x508d4d+'\x0a');}const _0x1319f6=createInterface({'input':process[_0x352cf5(0x207)],'output':process[_0x352cf5(0x1ef)]});while(!![]){const _0x50deb1=await new Promise(_0x1d5303=>{const _0x5ac6f7=_0x352cf5;_0x1319f6[_0x5ac6f7(0x221)](_0x54061c+'\x20',_0x1d5303);}),_0xb37311=Number['parseInt'](_0x50deb1[_0x352cf5(0x205)](),0xa);if(Number['isInteger'](_0xb37311)&&_0xb37311>=0x1&&_0xb37311<=_0x1ac805[_0x352cf5(0x203)])return _0x1319f6[_0x352cf5(0x224)](),_0xb37311-0x1;process[_0x352cf5(0x1ef)]['write'](_0x352cf5(0x1e3)+_0x1ac805['length']+'.\x0a');}}function buildFilePath(_0x499f7c,_0x44c85f,_0x17065d,_0x20e1a4){const _0x37fd95=a26_0x1dee6e;if(_0x44c85f===_0x37fd95(0x1f2)){if(!_0x20e1a4)throw CliErrors[_0x37fd95(0x22b)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x2af754=_0x20e1a4[_0x37fd95(0x223)]??_0x20e1a4[_0x37fd95(0x229)];return join(_0x499f7c[_0x37fd95(0x1fe)],'HOOK',_0x2af754,_0x20e1a4[_0x37fd95(0x208)],_0x20e1a4[_0x37fd95(0x215)],_0x17065d+_0x37fd95(0x1e6));}return join(_0x499f7c['scriptsRootDir'],_0x44c85f,_0x17065d+_0x37fd95(0x1e6));}export function generateTemplate(_0x5c4e75,_0xba4242,_0x3e621a,_0x31a8e5,_0x83717f){const _0x49584d=a26_0x1dee6e,_0x21a569=_0x31a8e5?.[_0x49584d(0x205)]()||_0x49584d(0x20e);if(_0x5c4e75===_0x49584d(0x21e))return'/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20'+_0x21a569+_0x49584d(0x211)+_0xba4242+_0x49584d(0x20f)+_0xba4242+_0x49584d(0x217)+_0xba4242+_0x49584d(0x1f6);if(_0x5c4e75===_0x49584d(0x1fb))return _0x49584d(0x1fc)+_0x21a569+_0x49584d(0x1ff)+_0x3e621a+'/'+_0xba4242+_0x49584d(0x218)+_0xba4242+_0x49584d(0x1f6);if(!_0x83717f)throw CliErrors[_0x49584d(0x22b)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');return _0x49584d(0x20d)+_0x21a569+_0x49584d(0x1d8)+_0x3e621a+'/'+_0x83717f[_0x49584d(0x229)]+'/'+_0x83717f[_0x49584d(0x208)]+_0x49584d(0x20b)+_0x83717f[_0x49584d(0x215)]+_0x49584d(0x1dd)+_0xba4242+_0x49584d(0x1f6);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a27_0x3a9f2e=a27_0xd83f;(function(_0x3313ae,_0x4aaab4){const _0x1bf0f3=a27_0xd83f,_0x40db89=_0x3313ae();while(!![]){try{const _0x2097ac=-parseInt(_0x1bf0f3(0x8a))/0x1+-parseInt(_0x1bf0f3(0x97))/0x2+-parseInt(_0x1bf0f3(0x8d))/0x3*(-parseInt(_0x1bf0f3(0xa6))/0x4)+parseInt(_0x1bf0f3(0x88))/0x5*(-parseInt(_0x1bf0f3(0xb2))/0x6)+parseInt(_0x1bf0f3(0x82))/0x7*(parseInt(_0x1bf0f3(0x90))/0x8)+-parseInt(_0x1bf0f3(0xb3))/0x9+parseInt(_0x1bf0f3(0x9a))/0xa*(parseInt(_0x1bf0f3(0xa9))/0xb);if(_0x2097ac===_0x4aaab4)break;else _0x40db89['push'](_0x40db89['shift']());}catch(_0x44d0bd){_0x40db89['push'](_0x40db89['shift']());}}}(a27_0x5e6a,0x950c5));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a27_0xd83f(_0x273a00,_0x94557c){_0x273a00=_0x273a00-0x81;const _0x5e6a8e=a27_0x5e6a();let _0xd83ff5=_0x5e6a8e[_0x273a00];return _0xd83ff5;}import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a27_0x3a9f2e(0x85),'command':a27_0x3a9f2e(0x9f),'description':a27_0x3a9f2e(0x9e),'risk':a27_0x3a9f2e(0xa8),'flags':[{'name':a27_0x3a9f2e(0xa1),'type':a27_0x3a9f2e(0xae),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x29c1d3){const _0x2edb3d=a27_0x3a9f2e,_0x26c325=loadBffProjectConfig(_0x29c1d3[_0x2edb3d(0xaf)]),_0x1630b1=await readBffLockFile(_0x26c325[_0x2edb3d(0xa7)]);if(!_0x1630b1)throw CliErrors[_0x2edb3d(0xb0)](_0x2edb3d(0xab));},async 'dryRun'(_0x54436c){const _0x18f25a=a27_0x3a9f2e,_0x4e9e12=loadBffProjectConfig(_0x54436c[_0x18f25a(0xaf)]),_0x3776fe=await readBffLockFile(_0x4e9e12[_0x18f25a(0xa7)]);if(!_0x3776fe)throw CliErrors[_0x18f25a(0xb0)](_0x18f25a(0x86));const {appLock:_0x1a3bfe}=ensureLockScope(_0x3776fe,_0x54436c[_0x18f25a(0xaf)],_0x4e9e12[_0x18f25a(0x98)],'delete'),_0x265f44=_0x54436c[_0x18f25a(0x95)](_0x18f25a(0xa1)),_0x589163=Object[_0x18f25a(0xa0)](_0x1a3bfe['functions']),_0x3218c5=resolveDeleteTarget(_0x265f44,_0x589163),_0x1271aa=_0x1a3bfe[_0x18f25a(0x91)][_0x3218c5];if(!_0x1271aa)throw CliErrors[_0x18f25a(0xb0)](_0x18f25a(0xa4)+_0x3218c5+'\x22.');const _0x4dc60f=resolveLocalFilePathFromLockKey(_0x4e9e12,_0x3218c5),_0x2c2e70=relative(_0x4e9e12[_0x18f25a(0x96)],_0x4dc60f),_0x373897=join(_0x4e9e12[_0x18f25a(0x8b)],'<timestamp>',_0x2c2e70);return{'method':'POST','url':_0x18f25a(0xa5),'body':{'appCode':_0x54436c['appCode'],'target':_0x3218c5,'remoteId':_0x1271aa[_0x18f25a(0x92)],'localFilePath':_0x4dc60f,'trashedPath':_0x373897},'description':_0x18f25a(0xac)+_0x3218c5+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash'};},async 'execute'(_0x40563f){const _0x314e10=a27_0x3a9f2e,_0x5bcefd=loadBffProjectConfig(_0x40563f[_0x314e10(0xaf)]),_0x4aafd0=await readBffLockFile(_0x5bcefd[_0x314e10(0xa7)]);if(!_0x4aafd0)throw CliErrors[_0x314e10(0xb0)](_0x314e10(0x86));const {lockData:_0x2c56bc,appLock:_0x5506a6}=ensureLockScope(_0x4aafd0,_0x40563f[_0x314e10(0xaf)],_0x5bcefd[_0x314e10(0x98)],_0x314e10(0x9f)),_0x5e9daf=JSON[_0x314e10(0x84)](JSON['stringify'](_0x2c56bc)),_0x29a3ab=_0x5e9daf['apps'][_0x40563f[_0x314e10(0xaf)]];if(!_0x29a3ab)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x40563f['appCode']+_0x314e10(0x9b));const _0x1a0948=_0x40563f[_0x314e10(0x95)]('target'),_0x387b62=Object[_0x314e10(0xa0)](_0x29a3ab[_0x314e10(0x91)]),_0x5903eb=resolveDeleteTarget(_0x1a0948,_0x387b62),_0x313a4c=_0x29a3ab[_0x314e10(0x91)][_0x5903eb];if(!_0x313a4c)throw CliErrors['validation']('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x5903eb+'\x22.');await deleteBffScript(_0x313a4c[_0x314e10(0x92)]),delete _0x29a3ab[_0x314e10(0x91)][_0x5903eb],_0x29a3ab[_0x314e10(0x8c)]=new Date()[_0x314e10(0x94)](),await writeBffLockFile(_0x5bcefd['lockFilePath'],_0x5e9daf);const _0x4f9399=resolveLocalFilePathFromLockKey(_0x5bcefd,_0x5903eb);let _0xb6039c;await fileExists(_0x4f9399)&&(_0xb6039c=await moveToTrash(_0x5bcefd[_0x314e10(0x96)],_0x5bcefd[_0x314e10(0x8b)],_0x4f9399),await cleanupEmptyDirectories(dirname(_0x4f9399),_0x5bcefd[_0x314e10(0x8f)]));await waitForDeleteSettlement(_0x5bcefd['lockFilePath'],_0x40563f[_0x314e10(0xaf)],_0x5903eb,_0x4f9399),await sleep(0x96);const _0xe28a3a={'deleted':_0x5903eb,'remoteId':_0x313a4c[_0x314e10(0x92)]};if(_0xb6039c)_0xe28a3a['trashedTo']=_0xb6039c;return{'ok':!![],'data':_0xe28a3a,'message':_0x314e10(0x89)+_0x5903eb+(_0xb6039c?_0x314e10(0xb1):'')};}};function a27_0x5e6a(){const _0x14708e=['59269DjvyeZ','Multiple\x20functions\x20match\x20\x22','parse','bff','BFF\x20lock\x20file\x20not\x20found.','startsWith','4300gjRSZs','Deleted\x20','817229nwTBnW','trashDir','lastSync','12sodBFo','length','scriptsRootDir','184XyVODD','functions','remoteId','join','toISOString','str','projectRoot','313342iJXePn','scriptsRoot','\x20\x20-\x20','10FaNbvo','\x22\x20not\x20found\x20after\x20ensureLockScope.','split','replace','Delete\x20a\x20BFF\x20script\x20from\x20remote\x20and\x20local','delete','keys','target','filter','includes','No\x20lock\x20entry\x20found\x20for\x20\x22','/api/management/library/scripts/delete','404252Csiine','lockFilePath','high-risk-write','21834857ZcszWL','Function\x20not\x20found:\x20','BFF\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','Would\x20delete\x20','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','string','appCode','validation','\x20(local\x20file\x20moved\x20to\x20trash)','2748YCdEMT','5451291hFFjpK','apps'];a27_0x5e6a=function(){return _0x14708e;};return a27_0x5e6a();}function resolveDeleteTarget(_0x11fa20,_0x5c791a){const _0x51f963=a27_0x3a9f2e;if(_0x11fa20[_0x51f963(0xa3)]('/')){const _0x303d32=_0x5c791a['find'](_0x39e02e=>_0x39e02e===_0x11fa20);if(!_0x303d32)throw CliErrors[_0x51f963(0xb0)](_0x51f963(0xaa)+_0x11fa20);return _0x303d32;}const _0x2bf4e1=_0x5c791a[_0x51f963(0xa2)](_0x396c2f=>_0x396c2f[_0x51f963(0x9c)]('/')['at'](-0x1)===_0x11fa20);if(_0x2bf4e1[_0x51f963(0x8e)]===0x0)throw CliErrors[_0x51f963(0xb0)]('Function\x20not\x20found:\x20'+_0x11fa20);if(_0x2bf4e1[_0x51f963(0x8e)]>0x1)throw CliErrors[_0x51f963(0xb0)](_0x51f963(0x83)+_0x11fa20+_0x51f963(0xad)+_0x2bf4e1['map'](_0x331529=>_0x51f963(0x99)+_0x331529)[_0x51f963(0x93)]('\x0a'));return _0x2bf4e1[0x0];}async function moveToTrash(_0x531c7d,_0x269144,_0x200916){const _0x314ccb=a27_0x3a9f2e,_0x46fb95=new Date()[_0x314ccb(0x94)]()[_0x314ccb(0x9d)](/[:.]/g,'-'),_0x4f55ce=relative(_0x531c7d,_0x200916),_0x290ccb=join(_0x269144,_0x46fb95,_0x4f55ce);return await mkdir(dirname(_0x290ccb),{'recursive':!![]}),await rename(_0x200916,_0x290ccb),_0x290ccb;}async function cleanupEmptyDirectories(_0x26ac5c,_0x34f818){const _0x407ffa=a27_0x3a9f2e;let _0x1b8a39=resolve(_0x26ac5c);const _0xbd9d9a=resolve(_0x34f818);while(_0x1b8a39[_0x407ffa(0x87)](''+_0xbd9d9a+sep)||_0x1b8a39===_0xbd9d9a){if(_0x1b8a39===_0xbd9d9a)return;try{const _0xb43234=await readdir(_0x1b8a39);if(_0xb43234[_0x407ffa(0x8e)]>0x0)return;await rmdir(_0x1b8a39);}catch{return;}_0x1b8a39=dirname(_0x1b8a39);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x21c256,_0x374fea,_0x1d97f1,_0x48962a){const _0x261f92=a27_0x3a9f2e;for(let _0x59162e=0x0;_0x59162e<DELETE_SETTLE_RETRY_COUNT;_0x59162e+=0x1){const _0x220c84=await readBffLockFile(_0x21c256),_0x1e1864=!!_0x220c84?.[_0x261f92(0x81)]?.[_0x374fea]?.[_0x261f92(0x91)]?.[_0x1d97f1],_0x296f57=await fileExists(_0x48962a);if(!_0x1e1864&&!_0x296f57)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x1d97f1+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0xecc43b=a28_0x1bf7;(function(_0x4b79c9,_0x51d51d){const _0x454fdc=a28_0x1bf7,_0x48b7c2=_0x4b79c9();while(!![]){try{const _0x5174ea=-parseInt(_0x454fdc(0x1f6))/0x1+-parseInt(_0x454fdc(0x207))/0x2+parseInt(_0x454fdc(0x208))/0x3*(-parseInt(_0x454fdc(0x1fc))/0x4)+-parseInt(_0x454fdc(0x1ff))/0x5*(parseInt(_0x454fdc(0x209))/0x6)+-parseInt(_0x454fdc(0x20b))/0x7*(parseInt(_0x454fdc(0x20a))/0x8)+-parseInt(_0x454fdc(0x1fb))/0x9*(-parseInt(_0x454fdc(0x1f8))/0xa)+parseInt(_0x454fdc(0x1fe))/0xb*(parseInt(_0x454fdc(0x1fd))/0xc);if(_0x5174ea===_0x51d51d)break;else _0x48b7c2['push'](_0x48b7c2['shift']());}catch(_0xb9ec3f){_0x48b7c2['push'](_0x48b7c2['shift']());}}}(a28_0x384f,0x7c079));function a28_0x1bf7(_0x4a7615,_0x32e431){_0x4a7615=_0x4a7615-0x1f4;const _0x384f07=a28_0x384f();let _0x1bf755=_0x384f07[_0x4a7615];return _0x1bf755;}import{getBffScriptInfo}from'../../core/api-client.js';function a28_0x384f(){const _0x1c29f6=['91197PTgUiu','159066DDRIGB','8nHADLC','3807601cEsBwl','(none)','num','description','verbose','bool','read','345579lzmdbU','detail','10YHRuJf','boolean','Script\x20ID','4558887RtpfBf','4qSvUFT','8004060URMOwI','33sBwqcL','110KpHyUP','Get\x20BFF\x20script\x20details\x20by\x20ID','scriptContent','createdTime','bff','updatedTime','appCode','scriptType','992740MtwIur'];a28_0x384f=function(){return _0x1c29f6;};return a28_0x384f();}export const bffDetail={'service':a28_0xecc43b(0x203),'command':a28_0xecc43b(0x1f7),'description':a28_0xecc43b(0x200),'risk':a28_0xecc43b(0x1f5),'flags':[{'name':'id','type':'number','required':!![],'description':a28_0xecc43b(0x1fa)},{'name':a28_0xecc43b(0x20f),'type':a28_0xecc43b(0x1f9),'description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x5d6484){const _0x4aef04=a28_0xecc43b,_0x12554b=await getBffScriptInfo(_0x5d6484[_0x4aef04(0x20d)]('id')),_0x59162a=_0x5d6484[_0x4aef04(0x1f4)]('verbose');if(_0x59162a)return{'ok':!![],'data':_0x12554b};return{'ok':!![],'data':{'id':_0x12554b['id'],'appCode':_0x12554b[_0x4aef04(0x205)],'scriptType':_0x12554b[_0x4aef04(0x206)],'description':_0x12554b[_0x4aef04(0x20e)]||_0x4aef04(0x20c),'createdTime':_0x12554b[_0x4aef04(0x202)]??'','updatedTime':_0x12554b[_0x4aef04(0x204)]??'','scriptContent':_0x12554b[_0x4aef04(0x201)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a29_0x58d1(){const _0x4ec41c=['81489UydNuk','1240lyPHpa','685404sZaiba','2110AWveIJ','7470YcLIgu','707824FlRRVX','26096lSrxng','306orVrAa','424244Cdiwsk'];a29_0x58d1=function(){return _0x4ec41c;};return a29_0x58d1();}(function(_0x3d7094,_0x3cfa8f){const _0x14ecb0=a29_0x3568,_0x5d55ed=_0x3d7094();while(!![]){try{const _0x4d91b9=parseInt(_0x14ecb0(0xef))/0x1+-parseInt(_0x14ecb0(0xf7))/0x2+parseInt(_0x14ecb0(0xf1))/0x3+parseInt(_0x14ecb0(0xf4))/0x4+-parseInt(_0x14ecb0(0xf2))/0x5*(parseInt(_0x14ecb0(0xf6))/0x6)+parseInt(_0x14ecb0(0xf5))/0x7+-parseInt(_0x14ecb0(0xf0))/0x8*(parseInt(_0x14ecb0(0xf3))/0x9);if(_0x4d91b9===_0x3cfa8f)break;else _0x5d55ed['push'](_0x5d55ed['shift']());}catch(_0xf35580){_0x5d55ed['push'](_0x5d55ed['shift']());}}}(a29_0x58d1,0x1f55b));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';function a29_0x3568(_0x31b802,_0xef2ce5){_0x31b802=_0x31b802-0xef;const _0x58d1c2=a29_0x58d1();let _0x35688a=_0x58d1c2[_0x31b802];return _0x35688a;}import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';export const bffDefinitions=[bffList,bffDetail,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x2ff7f3=a30_0x2460;(function(_0x4fef9f,_0x1a6c93){const _0x16aefb=a30_0x2460,_0x310422=_0x4fef9f();while(!![]){try{const _0x5aac75=parseInt(_0x16aefb(0xc3))/0x1+-parseInt(_0x16aefb(0xcb))/0x2+-parseInt(_0x16aefb(0xd3))/0x3+-parseInt(_0x16aefb(0xca))/0x4+parseInt(_0x16aefb(0xcc))/0x5+-parseInt(_0x16aefb(0xc6))/0x6+parseInt(_0x16aefb(0xc0))/0x7;if(_0x5aac75===_0x1a6c93)break;else _0x310422['push'](_0x310422['shift']());}catch(_0x477b67){_0x310422['push'](_0x310422['shift']());}}}(a30_0x4859,0xb6564));function a30_0x4859(){const _0xcc2df4=['map','name','712749SzwfvZ','appCode','read','bff','description','list','bool','(unnamed)','verbose','functionName','8432620MLwzfq','boolean','COMMON','206797FoSZvz','Return\x20full\x20script\x20objects','string','2232072OdqEzL','ENDPOINT','No\x20BFF\x20scripts\x20found.','Filter\x20by\x20script\x20name','4520352StQSPu','78160QhLwYB','5570790BJHoIG','str','type','scriptType','List\x20BFF\x20scripts'];a30_0x4859=function(){return _0xcc2df4;};return a30_0x4859();}function a30_0x2460(_0xb002bd,_0x537f8b){_0xb002bd=_0xb002bd-0xbe;const _0x485951=a30_0x4859();let _0x24604b=_0x485951[_0xb002bd];return _0x24604b;}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a30_0x2ff7f3(0xd6),'command':a30_0x2ff7f3(0xd8),'description':a30_0x2ff7f3(0xd0),'risk':a30_0x2ff7f3(0xd5),'flags':[{'name':a30_0x2ff7f3(0xce),'type':a30_0x2ff7f3(0xc5),'description':'Script\x20type\x20filter','default':'ENDPOINT','enum':[a30_0x2ff7f3(0xc7),a30_0x2ff7f3(0xc2)]},{'name':'name','type':'string','description':a30_0x2ff7f3(0xc9)},{'name':a30_0x2ff7f3(0xbe),'type':a30_0x2ff7f3(0xc1),'description':a30_0x2ff7f3(0xc4)}],async 'execute'(_0x3c08a6){const _0x418962=a30_0x2ff7f3,_0x40b017=await listBffScripts(_0x3c08a6[_0x418962(0xd4)],_0x3c08a6[_0x418962(0xcd)](_0x418962(0xce)),{'scriptName':_0x3c08a6[_0x418962(0xcd)](_0x418962(0xd2))||undefined}),_0x18608f=_0x3c08a6[_0x418962(0xd9)](_0x418962(0xbe));return{'ok':!![],'data':_0x18608f?_0x40b017:_0x40b017[_0x418962(0xd1)](_0x2d0dca=>({'id':_0x2d0dca['id'],'functionName':_0x2d0dca[_0x418962(0xbf)]??'','description':_0x2d0dca[_0x418962(0xd7)]||_0x418962(0xda),'scriptType':_0x2d0dca[_0x418962(0xcf)]})),'message':_0x40b017['length']===0x0?_0x418962(0xc8):undefined};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x24f116=a31_0x1028;(function(_0x494a1b,_0x153f9d){const _0x134c73=a31_0x1028,_0xd2014b=_0x494a1b();while(!![]){try{const _0x42ce40=parseInt(_0x134c73(0x141))/0x1+-parseInt(_0x134c73(0x13a))/0x2+-parseInt(_0x134c73(0x12c))/0x3+parseInt(_0x134c73(0x101))/0x4*(-parseInt(_0x134c73(0x11d))/0x5)+parseInt(_0x134c73(0x10f))/0x6+-parseInt(_0x134c73(0x127))/0x7+parseInt(_0x134c73(0x114))/0x8;if(_0x42ce40===_0x153f9d)break;else _0xd2014b['push'](_0xd2014b['shift']());}catch(_0x3e9260){_0xd2014b['push'](_0xd2014b['shift']());}}}(a31_0x2312,0xca64e));import{createInterface}from'node:readline';import{writeFile}from'node:fs/promises';import{listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';function a31_0x2312(){const _0x396dac=['str','map','all','No\x20remote\x20BFF\x20scripts\x20found.','type','2875128KyhrrW','stringify','close','includes','functionName','lockFilePath','Pull\x20complete:\x20','551813XnhVmH','write','filePath','ENDPOINT','boolean','string','5732Sjwgmb','functionNode','push','operationType','hookLocation','scriptsRoot','\x20failed','\x20skipped,\x20','apiDir','scriptContent','Pull\x20remote\x20BFF\x20scripts\x20to\x20local','toLowerCase','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','conflict','3900270dhRizd','force','lockKey','validation','Force\x20pull\x20cancelled.','24662896VwzUcz','scriptType','bff','stderr','&type=','apps','COMMON','alias','datasetCode','170HwAQpr','local\x20unsynced\x20changes','Pull\x20only\x20this\x20script\x20type','Lock\x20scope\x20for\x20app\x20\x22','stdin','yes','toISOString','bool','unresolvable\x20target\x20path','skipped','4426352emIhPw','HOOK','trim','\x22\x20not\x20found\x20after\x20ensureLockScope.','pull','4011276xmGFQG','appCode','Force\x20overwrite\x20local\x20unsynced\x20changes','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','functions','Remote\x20script\x20missing\x20id.','/api/management/library/scripts/list?appCode=','nonInteractive','length'];a31_0x2312=function(){return _0x396dac;};return a31_0x2312();}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';function a31_0x1028(_0x131e6b,_0x53f002){_0x131e6b=_0x131e6b-0x100;const _0x2312b2=a31_0x2312();let _0x10284a=_0x2312b2[_0x131e6b];return _0x10284a;}import{CliErrors}from'../../errors.js';export const bffPull={'service':a31_0x24f116(0x116),'command':a31_0x24f116(0x12b),'description':a31_0x24f116(0x10b),'risk':a31_0x24f116(0x142),'flags':[{'name':a31_0x24f116(0x139),'type':a31_0x24f116(0x100),'description':a31_0x24f116(0x11f),'enum':[a31_0x24f116(0x11a),a31_0x24f116(0x144),'HOOK']},{'name':a31_0x24f116(0x110),'type':a31_0x24f116(0x145),'description':a31_0x24f116(0x12e)}],async 'dryRun'(_0x3def72){const _0x36b8e2=a31_0x24f116,_0x4bcf5c=loadBffProjectConfig(_0x3def72['appCode']),_0x1213f7=await readBffLockFile(_0x4bcf5c[_0x36b8e2(0x13f)]),{appLock:_0x375e9f}=ensureLockScope(_0x1213f7??createEmptyBffLock(),_0x3def72[_0x36b8e2(0x12d)],_0x4bcf5c[_0x36b8e2(0x106)],_0x36b8e2(0x12b)),_0x4449ab=normalizeBffType(_0x3def72['str'](_0x36b8e2(0x139)))??undefined,_0x4ecb69=buildDatasetCodeToAliasMap(_0x3def72[_0x36b8e2(0x109)],_0x3def72['appCode']),[_0x4f1c1d,_0x488bfc]=await Promise['all']([listBffScripts(_0x3def72[_0x36b8e2(0x12d)],_0x4449ab),getBffScriptStatistics(_0x3def72['appCode'])]),_0x114cb8=createHookLocationMap(_0x488bfc),_0x4f551a=[];for(const _0x5de91c of _0x4f1c1d){const _0x59f168=resolveRemoteScriptTarget(_0x4bcf5c,_0x5de91c,_0x114cb8,_0x375e9f['functions'],_0x4ecb69);if(!_0x59f168){_0x4f551a[_0x36b8e2(0x103)]({'scriptType':_0x5de91c['scriptType'],'functionName':_0x5de91c['functionName']??'','status':_0x36b8e2(0x126),'reason':_0x36b8e2(0x125)});continue;}const _0x246e30=_0x375e9f['functions'][_0x59f168[_0x36b8e2(0x111)]],_0x13a84a=_0x5de91c[_0x36b8e2(0x10a)]!=null?computeContentHash(_0x5de91c['scriptContent']):undefined,_0x5b9c7f=await hasUnsyncedLocalChanges(_0x59f168[_0x36b8e2(0x143)],_0x246e30,_0x13a84a);_0x4f551a[_0x36b8e2(0x103)]({'lockKey':_0x59f168[_0x36b8e2(0x111)],'filePath':_0x59f168[_0x36b8e2(0x143)],'remoteId':_0x5de91c['id']??null,'status':_0x5b9c7f?_0x36b8e2(0x10e):'would_pull'});}return{'method':'GET','url':_0x36b8e2(0x132)+_0x3def72[_0x36b8e2(0x12d)]+(_0x4449ab?_0x36b8e2(0x118)+_0x4449ab:''),'body':{'appCode':_0x3def72[_0x36b8e2(0x12d)],'filterType':_0x4449ab??null,'files':_0x4f551a},'description':'Would\x20inspect\x20'+_0x4f551a[_0x36b8e2(0x134)]+'\x20remote\x20BFF\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4cf03e){const _0x10436e=a31_0x24f116,_0x2cdc48=loadBffProjectConfig(_0x4cf03e[_0x10436e(0x12d)]),_0x4b7d78=await readBffLockFile(_0x2cdc48[_0x10436e(0x13f)]),{lockData:_0x98d88c,appLock:_0xfdb0d3}=ensureLockScope(_0x4b7d78??createEmptyBffLock(),_0x4cf03e['appCode'],_0x2cdc48[_0x10436e(0x106)],_0x10436e(0x12b)),_0x770dd=normalizeBffType(_0x4cf03e['str']('type'))??undefined;if(_0x4cf03e[_0x10436e(0x135)](_0x10436e(0x139))&&!_0x770dd)throw CliErrors[_0x10436e(0x112)](_0x10436e(0x12f));const [_0x103ddc,_0x12c787]=await Promise[_0x10436e(0x137)]([listBffScripts(_0x4cf03e[_0x10436e(0x12d)],_0x770dd),getBffScriptStatistics(_0x4cf03e['appCode'])]);if(_0x103ddc[_0x10436e(0x134)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x10436e(0x138)};const _0x5cf376=_0x4cf03e[_0x10436e(0x124)](_0x10436e(0x110));if(_0x5cf376&&!_0x4cf03e[_0x10436e(0x133)]){const _0x45d59b=await confirmForce();if(!_0x45d59b)throw CliErrors['cancelled'](_0x10436e(0x113));}if(_0x5cf376&&_0x4cf03e[_0x10436e(0x133)]){}const _0x21d067=buildDatasetCodeToAliasMap(_0x4cf03e[_0x10436e(0x109)],_0x4cf03e[_0x10436e(0x12d)]),_0x36b483=createHookLocationMap(_0x12c787),_0x35e6fb=JSON['parse'](JSON[_0x10436e(0x13b)](_0x98d88c)),_0x2e56ae=_0x4cf03e['appCode'],_0x321383=_0x35e6fb[_0x10436e(0x119)][_0x2e56ae];if(!_0x321383)throw new Error(_0x10436e(0x120)+_0x2e56ae+_0x10436e(0x12a));const _0x5721f7=[],_0x24a4dc=[],_0x1cc813=[];for(const _0x335b8e of _0x103ddc){const _0x1b8b3f=resolveRemoteScriptTarget(_0x2cdc48,_0x335b8e,_0x36b483,_0xfdb0d3[_0x10436e(0x130)],_0x21d067);if(!_0x1b8b3f){_0x24a4dc[_0x10436e(0x103)]({'lockKey':_0x335b8e[_0x10436e(0x115)]+'/'+_0x335b8e[_0x10436e(0x13e)],'reason':_0x10436e(0x125)});continue;}const _0x324734=_0xfdb0d3[_0x10436e(0x130)][_0x1b8b3f[_0x10436e(0x111)]];try{if(!_0x335b8e['id'])throw new Error(_0x10436e(0x131));if(_0x335b8e['scriptContent']==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x4c3542=_0x335b8e[_0x10436e(0x10a)],_0x1f4679=computeContentHash(_0x4c3542);if(!_0x5cf376){const _0x752419=await hasUnsyncedLocalChanges(_0x1b8b3f[_0x10436e(0x143)],_0x324734,_0x1f4679);if(_0x752419){_0x24a4dc[_0x10436e(0x103)]({'lockKey':_0x1b8b3f['lockKey'],'reason':_0x10436e(0x11e)});continue;}}await ensureParentDirectory(_0x1b8b3f[_0x10436e(0x143)]),await writeFile(_0x1b8b3f[_0x10436e(0x143)],_0x4c3542,'utf8');const _0xc80b7={'hash':_0x1f4679,'remoteId':_0x335b8e['id'],'version':_0x335b8e['version']};_0x1b8b3f['type']===_0x10436e(0x128)&&_0x1b8b3f[_0x10436e(0x105)]&&(_0xc80b7[_0x10436e(0x11b)]=_0x1b8b3f['hookLocation']['alias'],_0xc80b7['datasetCode']=_0x1b8b3f[_0x10436e(0x105)][_0x10436e(0x11c)],_0xc80b7[_0x10436e(0x104)]=_0x1b8b3f[_0x10436e(0x105)][_0x10436e(0x104)],_0xc80b7[_0x10436e(0x102)]=_0x1b8b3f[_0x10436e(0x105)][_0x10436e(0x102)]),_0x321383[_0x10436e(0x130)][_0x1b8b3f[_0x10436e(0x111)]]=_0xc80b7,_0x5721f7[_0x10436e(0x103)]({'lockKey':_0x1b8b3f[_0x10436e(0x111)],'remoteId':_0x335b8e['id']});}catch(_0x47736a){_0x1cc813['push']({'lockKey':_0x1b8b3f['lockKey'],'error':_0x47736a instanceof Error?_0x47736a['message']:String(_0x47736a)});}}return _0x321383['lastSync']=new Date()[_0x10436e(0x123)](),await writeBffLockFile(_0x2cdc48[_0x10436e(0x13f)],_0x35e6fb),{'ok':_0x1cc813['length']===0x0,'data':{'pulled':_0x5721f7,'skipped':_0x24a4dc,'failed':_0x1cc813},'message':_0x10436e(0x140)+_0x5721f7[_0x10436e(0x134)]+'\x20pulled,\x20'+_0x24a4dc[_0x10436e(0x134)]+_0x10436e(0x108)+_0x1cc813[_0x10436e(0x134)]+_0x10436e(0x107)};}};async function hasUnsyncedLocalChanges(_0x5010d0,_0x3e9126,_0x13ec00){if(!await fileExists(_0x5010d0))return![];const _0x130c0f=await computeFileHash(_0x5010d0);if(!_0x3e9126)return _0x13ec00?_0x130c0f!==_0x13ec00:!![];return _0x130c0f!==_0x3e9126['hash'];}function buildDatasetCodeToAliasMap(_0x17df57,_0x555cbe){const _0x40183b=a31_0x24f116,_0x13e885=loadAliasMap(_0x17df57,undefined,resolveApiFilePath(_0x17df57,_0x555cbe));return new Map(_0x13e885[_0x40183b(0x136)](_0x2efbde=>[_0x2efbde[_0x40183b(0x11c)],_0x2efbde[_0x40183b(0x11b)]]));}async function confirmForce(){const _0x14af6e=a31_0x24f116,_0x2ee88a=createInterface({'input':process[_0x14af6e(0x121)],'output':process[_0x14af6e(0x117)]}),_0x3e22b8=await new Promise(_0x1c7427=>{const _0x1ecd4b=_0x14af6e;_0x2ee88a['question'](_0x1ecd4b(0x10d),_0x1c7427);});return _0x2ee88a[_0x14af6e(0x13c)](),['y',_0x14af6e(0x122)][_0x14af6e(0x13d)](_0x3e22b8[_0x14af6e(0x129)]()[_0x14af6e(0x10c)]());}
|
package/lib/commands/bff/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x4762c2=a32_0x1345;(function(_0x2f606b,_0x16ef17){const _0x1b7f14=a32_0x1345,_0xa04f1a=_0x2f606b();while(!![]){try{const _0x4484e6=parseInt(_0x1b7f14(0xa5))/0x1*(-parseInt(_0x1b7f14(0x83))/0x2)+-parseInt(_0x1b7f14(0x8d))/0x3+-parseInt(_0x1b7f14(0xa9))/0x4*(-parseInt(_0x1b7f14(0xa1))/0x5)+-parseInt(_0x1b7f14(0x88))/0x6*(-parseInt(_0x1b7f14(0xa0))/0x7)+-parseInt(_0x1b7f14(0xc0))/0x8*(-parseInt(_0x1b7f14(0x97))/0x9)+parseInt(_0x1b7f14(0x99))/0xa*(parseInt(_0x1b7f14(0xcf))/0xb)+-parseInt(_0x1b7f14(0xbc))/0xc;if(_0x4484e6===_0x16ef17)break;else _0xa04f1a['push'](_0xa04f1a['shift']());}catch(_0x5d0956){_0xa04f1a['push'](_0xa04f1a['shift']());}}}(a32_0x5236,0x99caf));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets,clearBffScriptCache}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.js';function a32_0x5236(){const _0x6ba5ca=['lockFilePath','No\x20local\x20BFF\x20functions\x20found.','2VagJuq','high-risk-write','\x20uploaded,\x20','Push\x20only\x20this\x20script\x20type','bool','5030778zrAmgt','Would\x20inspect\x20','message','Force\x20push\x20ignoring\x20hash\x20protection','\x20skipped,\x20','1080291RFHyux','\x22.\x20','attempted','scriptsRoot','set','datasetCode','Local\x20function\x20not\x20found:\x20','would_push','datasetId','\x20failed,\x20','1127142ndOEBV','get','249440vwusLL','type','apiDir','alias','str',':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.','force','7HTWcbn','671665CjrEPL','operationType','map','stringify','628400GWpsrv','push','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','/api/management/library/scripts/save','16kJqzOZ','\x22\x20not\x20found\x20after\x20ensureLockScope.','some','appCode','HOOK','Lock\x20file\x20not\x20settled\x20after\x20push\x20for\x20','functions','Push\x20complete:\x20','values','toISOString','string','Cannot\x20resolve\x20dataset\x20for\x20\x22','lockKey','datasetCodeToDataset','join','boolean','functionNode','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','version','5793732UgyxUI','code','aliasToDatasetCode','utf8','32KRKDDF','parse','COMMON','ENDPOINT','length','name','cleared','hash','apps','remoteId','filePath','validation','status','description','script','99vYADnc','runtime\x20cache\x20clear\x20failed','bff','Runtime\x20script\x20cache\x20cleared.','every'];a32_0x5236=function(){return _0x6ba5ca;};return a32_0x5236();}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{sleep}from'../../utils/sleep.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';const CACHE_CLEAR_ATTEMPTS=0x2,CACHE_CLEAR_INTERVAL_MS=0x12c;export const bffPush={'service':a32_0x4762c2(0xd1),'command':a32_0x4762c2(0xa6),'description':'Push\x20local\x20BFF\x20scripts\x20to\x20remote','risk':a32_0x4762c2(0x84),'flags':[{'name':a32_0x4762c2(0x9a),'type':a32_0x4762c2(0xb3),'description':a32_0x4762c2(0x86),'enum':[a32_0x4762c2(0xc2),a32_0x4762c2(0xc3),a32_0x4762c2(0xad)]},{'name':a32_0x4762c2(0xc5),'type':a32_0x4762c2(0xb3),'description':a32_0x4762c2(0xa7)},{'name':a32_0x4762c2(0x9f),'type':a32_0x4762c2(0xb8),'description':a32_0x4762c2(0x8b)}],async 'dryRun'(_0x15df05){const _0x3776ad=a32_0x4762c2,_0x12084b=loadBffProjectConfig(_0x15df05[_0x3776ad(0xac)]),_0x14477a=await readBffLockFile(_0x12084b[_0x3776ad(0x81)]),{appLock:_0x26b1f0}=ensureLockScope(_0x14477a??createEmptyBffLock(),_0x15df05[_0x3776ad(0xac)],_0x12084b[_0x3776ad(0x90)],_0x3776ad(0xa6)),_0x8915e9=await getTargetFunctions(_0x12084b,_0x15df05),_0x4c145c=_0x15df05[_0x3776ad(0x87)](_0x3776ad(0x9f)),_0x237170=[];for(const _0x582dfd of _0x8915e9){const _0x2ac493=await computeFileHash(_0x582dfd[_0x3776ad(0xca)]),_0x5923b3=_0x26b1f0[_0x3776ad(0xaf)][_0x582dfd[_0x3776ad(0xb5)]],_0x1a34a4=!!_0x5923b3&&_0x5923b3[_0x3776ad(0xc7)]===_0x2ac493;_0x237170[_0x3776ad(0xa6)]({'lockKey':_0x582dfd[_0x3776ad(0xb5)],'filePath':_0x582dfd[_0x3776ad(0xca)],'remoteId':_0x5923b3?.[_0x3776ad(0xc9)]??null,'mode':_0x5923b3?.['remoteId']?'update':'create','status':!_0x4c145c&&_0x1a34a4?'unchanged':_0x3776ad(0x94)});}return{'method':'POST','url':_0x3776ad(0xa8),'body':{'appCode':_0x15df05[_0x3776ad(0xac)],'force':_0x4c145c,'files':_0x237170,'cacheClearAtRuntime':_0x237170['some'](_0x4da7d0=>_0x4da7d0[_0x3776ad(0xcc)]==='would_push'),'cacheClearAtRuntimeTimes':_0x237170[_0x3776ad(0xab)](_0x3e4deb=>_0x3e4deb[_0x3776ad(0xcc)]===_0x3776ad(0x94))?CACHE_CLEAR_ATTEMPTS:0x0},'description':_0x3776ad(0x89)+_0x237170[_0x3776ad(0xc4)]+'\x20local\x20BFF\x20script(s)\x20for\x20push\x20and\x20clear\x20runtime\x20cache\x20if\x20files\x20are\x20uploaded'};},async 'execute'(_0x47cf65){const _0x3d2f24=a32_0x4762c2,_0x20c6ce=loadBffProjectConfig(_0x47cf65[_0x3d2f24(0xac)]),_0x445405=await readBffLockFile(_0x20c6ce['lockFilePath']),{lockData:_0x1073cb,appLock:_0xab6197}=ensureLockScope(_0x445405??createEmptyBffLock(),_0x47cf65[_0x3d2f24(0xac)],_0x20c6ce[_0x3d2f24(0x90)],'push'),_0x480311=await getTargetFunctions(_0x20c6ce,_0x47cf65);if(_0x480311[_0x3d2f24(0xc4)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x3d2f24(0x82)};const _0x2197bb=_0x47cf65[_0x3d2f24(0x87)](_0x3d2f24(0x9f)),_0x30ae33=JSON[_0x3d2f24(0xc1)](JSON[_0x3d2f24(0xa4)](_0x1073cb)),_0x4e3f18=_0x30ae33[_0x3d2f24(0xc8)][_0x47cf65['appCode']];if(!_0x4e3f18)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x47cf65[_0x3d2f24(0xac)]+_0x3d2f24(0xaa));const _0x22eb8c=await buildHookMaps(_0x47cf65[_0x3d2f24(0xac)],_0x47cf65[_0x3d2f24(0x9b)],_0x480311,_0x4e3f18),_0x311f39=[],_0x2e2023=[],_0x11bd5f=[];for(const _0x4aea95 of _0x480311){const _0x1dd78c=await computeFileHash(_0x4aea95[_0x3d2f24(0xca)]),_0x526da1=_0x4e3f18[_0x3d2f24(0xaf)][_0x4aea95['lockKey']];if(!_0x2197bb&&_0x526da1&&_0x526da1[_0x3d2f24(0xc7)]===_0x1dd78c){_0x2e2023[_0x3d2f24(0xa6)]({'lockKey':_0x4aea95['lockKey'],'reason':'unchanged'});continue;}try{await uploadSingleFunction(_0x47cf65[_0x3d2f24(0xac)],_0x4aea95,_0x4e3f18,_0x22eb8c);const _0x55180c=_0x4e3f18[_0x3d2f24(0xaf)][_0x4aea95[_0x3d2f24(0xb5)]];_0x311f39[_0x3d2f24(0xa6)]({'lockKey':_0x4aea95[_0x3d2f24(0xb5)],'remoteId':_0x55180c?.[_0x3d2f24(0xc9)]??0x0});}catch(_0x48f91d){_0x11bd5f[_0x3d2f24(0xa6)]({'lockKey':_0x4aea95[_0x3d2f24(0xb5)],'error':_0x48f91d instanceof Error?_0x48f91d['message']:String(_0x48f91d)});}}_0x4e3f18['lastSync']=new Date()[_0x3d2f24(0xb2)](),await writeBffLockFile(_0x20c6ce[_0x3d2f24(0x81)],_0x30ae33),await waitForUploadedLockEntries(_0x20c6ce[_0x3d2f24(0x81)],_0x47cf65['appCode'],_0x311f39['map'](_0x523f3b=>_0x523f3b[_0x3d2f24(0xb5)]));let _0x1c0e12={'attempted':![],'cleared':![]};if(_0x311f39[_0x3d2f24(0xc4)]>0x0)try{let _0x8b72f4='';for(let _0x14d50e=0x0;_0x14d50e<CACHE_CLEAR_ATTEMPTS;_0x14d50e+=0x1){_0x8b72f4=await clearBffScriptCache(),_0x14d50e<CACHE_CLEAR_ATTEMPTS-0x1&&await sleep(CACHE_CLEAR_INTERVAL_MS);}_0x1c0e12={'attempted':!![],'cleared':!![],'message':_0x8b72f4||_0x3d2f24(0xd2)};}catch(_0x52f7e2){_0x1c0e12={'attempted':!![],'cleared':![],'error':_0x52f7e2 instanceof Error?_0x52f7e2[_0x3d2f24(0x8a)]:String(_0x52f7e2)};}const _0x282e21=_0x11bd5f[_0x3d2f24(0xc4)]===0x0&&(_0x1c0e12[_0x3d2f24(0x8f)]?_0x1c0e12['cleared']:!![]),_0x419370=_0x1c0e12[_0x3d2f24(0x8f)]?_0x1c0e12[_0x3d2f24(0xc6)]?'runtime\x20cache\x20cleared':_0x3d2f24(0xd0):'runtime\x20cache\x20not\x20needed';return{'ok':_0x282e21,'data':{'uploaded':_0x311f39,'skipped':_0x2e2023,'failed':_0x11bd5f,'cacheClear':_0x1c0e12},'message':_0x3d2f24(0xb0)+_0x311f39[_0x3d2f24(0xc4)]+_0x3d2f24(0x85)+_0x2e2023['length']+_0x3d2f24(0x8c)+_0x11bd5f[_0x3d2f24(0xc4)]+_0x3d2f24(0x96)+_0x419370};}};async function getTargetFunctions(_0x9bd5f7,_0x5329b8){const _0x18b04c=a32_0x4762c2,_0x1415eb=_0x5329b8[_0x18b04c(0x9d)]('type'),_0x39bcb6=_0x5329b8[_0x18b04c(0x9d)](_0x18b04c(0xc5)),_0x5ecafd=normalizeBffType(_0x1415eb)??undefined;if(_0x39bcb6&&!_0x5ecafd)throw CliErrors[_0x18b04c(0xcb)]('--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.');const _0x1f9e06=await scanLocalBffFunctions(_0x9bd5f7,_0x5ecafd);if(_0x39bcb6){const _0x196886=_0x1f9e06['filter'](_0x4dd677=>_0x4dd677[_0x18b04c(0xc5)]===_0x39bcb6);if(_0x196886['length']===0x0)throw CliErrors[_0x18b04c(0xcb)](_0x18b04c(0x93)+_0x5ecafd+'/'+_0x39bcb6);return _0x196886;}return _0x1f9e06;}function a32_0x1345(_0x500e73,_0x48302b){_0x500e73=_0x500e73-0x81;const _0x523638=a32_0x5236();let _0x1345c8=_0x523638[_0x500e73];return _0x1345c8;}async function buildHookMaps(_0x43f7b7,_0x3c2f27,_0x2e37b7,_0xa0aaf4){const _0x5d1724=a32_0x4762c2,_0x1d6028=_0x2e37b7['some'](_0x3cd943=>_0x3cd943['type']===_0x5d1724(0xad));if(!_0x1d6028)return{'aliasToDatasetCode':new Map(),'datasetCodeToDataset':new Map()};const _0x31e7a1=loadAliasMap(_0x3c2f27,undefined,resolveApiFilePath(_0x3c2f27,_0x43f7b7)),_0x1c34d6=new Map(_0x31e7a1['map'](_0x6021b9=>[_0x6021b9[_0x5d1724(0x9c)],_0x6021b9[_0x5d1724(0x92)]]));for(const _0x515cd4 of Object[_0x5d1724(0xb1)](_0xa0aaf4[_0x5d1724(0xaf)])){_0x515cd4[_0x5d1724(0x9c)]&&_0x515cd4[_0x5d1724(0x92)]&&!_0x1c34d6['has'](_0x515cd4[_0x5d1724(0x9c)])&&_0x1c34d6[_0x5d1724(0x91)](_0x515cd4[_0x5d1724(0x9c)],_0x515cd4[_0x5d1724(0x92)]);}const _0x1bac75=await listDatasets(_0x43f7b7),_0x19fcf2=new Map(_0x1bac75[_0x5d1724(0xa3)](_0x309730=>[_0x309730[_0x5d1724(0xbd)],_0x309730]));return{'aliasToDatasetCode':_0x1c34d6,'datasetCodeToDataset':_0x19fcf2};}async function uploadSingleFunction(_0xd6a1e2,_0x54e1da,_0x14bb0e,_0xca4551){const _0xe6f78c=a32_0x4762c2,_0x41a6af=await readFile(_0x54e1da[_0xe6f78c(0xca)],_0xe6f78c(0xbf)),_0x569cca=await computeFileHash(_0x54e1da['filePath']),_0x58b7eb=_0x14bb0e[_0xe6f78c(0xaf)][_0x54e1da[_0xe6f78c(0xb5)]];if(_0x58b7eb?.[_0xe6f78c(0xc9)]&&_0x58b7eb[_0xe6f78c(0xbb)]==null)throw CliErrors['validation'](_0x54e1da['lockKey']+_0xe6f78c(0x9e));let _0x6fdc34=extractScriptDescription(_0x41a6af);if(!_0x6fdc34&&_0x58b7eb?.[_0xe6f78c(0xc9)]){const _0x55faa9=await getBffScriptInfo(_0x58b7eb['remoteId']);_0x6fdc34=_0x55faa9[_0xe6f78c(0xcd)]||undefined;}const _0x451780={'appCode':_0xd6a1e2,'functionName':_0x54e1da[_0xe6f78c(0xc5)],'scriptType':_0x54e1da[_0xe6f78c(0x9a)],'scriptContent':_0x41a6af};if(_0x58b7eb?.[_0xe6f78c(0xc9)])_0x451780['id']=_0x58b7eb['remoteId'];if(_0x58b7eb?.[_0xe6f78c(0xbb)]!=null)_0x451780[_0xe6f78c(0xbb)]=_0x58b7eb[_0xe6f78c(0xbb)];if(_0x6fdc34)_0x451780['description']=_0x6fdc34;if(_0x54e1da[_0xe6f78c(0x9a)]===_0xe6f78c(0xad)){const _0x4bbbbd=_0x54e1da[_0xe6f78c(0x9c)];if(!_0x4bbbbd||!_0x54e1da[_0xe6f78c(0xa2)]||!_0x54e1da['functionNode'])throw CliErrors[_0xe6f78c(0xcb)]('Incomplete\x20HOOK\x20path:\x20'+_0x54e1da[_0xe6f78c(0xb5)]);const _0x2a41fe=_0xca4551[_0xe6f78c(0xbe)][_0xe6f78c(0x98)](_0x4bbbbd)??_0x58b7eb?.['datasetCode']??_0x4bbbbd,_0x5c843b=_0xca4551[_0xe6f78c(0xb6)][_0xe6f78c(0x98)](_0x2a41fe);if(!_0x5c843b)throw CliErrors[_0xe6f78c(0xcb)](_0xe6f78c(0xb4)+_0x4bbbbd+_0xe6f78c(0x8e)+('Run\x20`'+CLI_BIN_NAME+_0xe6f78c(0xba)));_0x451780[_0xe6f78c(0x95)]=_0x5c843b['id'],_0x451780[_0xe6f78c(0xa2)]=_0x54e1da[_0xe6f78c(0xa2)],_0x451780[_0xe6f78c(0xb9)]=_0x54e1da[_0xe6f78c(0xb9)];}const _0x24081d=await saveBffScript(_0x451780),_0x4d1bae=_0x24081d['id'],_0x4b2193=_0x24081d[_0xe6f78c(0xce)]??await getBffScriptInfo(_0x4d1bae),_0x5dc98f={'hash':_0x569cca,'remoteId':_0x4d1bae,'version':_0x4b2193['version']};if(_0x54e1da[_0xe6f78c(0x9a)]===_0xe6f78c(0xad)){const _0x402b4a=_0x54e1da['alias'],_0x130ca4=_0xca4551[_0xe6f78c(0xbe)][_0xe6f78c(0x98)](_0x402b4a)??_0x58b7eb?.['datasetCode']??_0x402b4a;_0xca4551['aliasToDatasetCode']['has'](_0x402b4a)?_0x5dc98f['alias']=_0x402b4a:_0x5dc98f[_0xe6f78c(0x9c)]=_0x58b7eb?.['alias'],_0x5dc98f[_0xe6f78c(0x92)]=_0x130ca4,_0x5dc98f['operationType']=_0x54e1da['operationType'],_0x5dc98f[_0xe6f78c(0xb9)]=_0x54e1da[_0xe6f78c(0xb9)];}_0x14bb0e[_0xe6f78c(0xaf)][_0x54e1da[_0xe6f78c(0xb5)]]=_0x5dc98f;}const LOCK_SETTLE_RETRY_COUNT=0x14,LOCK_SETTLE_DELAY_MS=0x64;async function waitForUploadedLockEntries(_0x23153b,_0x5bc600,_0x56cca2){const _0x32cd8c=a32_0x4762c2;if(_0x56cca2['length']===0x0)return;for(let _0xac6d3f=0x0;_0xac6d3f<LOCK_SETTLE_RETRY_COUNT;_0xac6d3f+=0x1){const _0x4e60d4=await readBffLockFile(_0x23153b),_0x35b57c=_0x4e60d4?.[_0x32cd8c(0xc8)]?.[_0x5bc600]?.['functions']??{},_0x138d7c=_0x56cca2[_0x32cd8c(0xd3)](_0x5ee5d7=>!!_0x35b57c[_0x5ee5d7]?.['remoteId']);if(_0x138d7c)return;await sleep(LOCK_SETTLE_DELAY_MS);}throw new Error(_0x32cd8c(0xae)+_0x56cca2[_0x32cd8c(0xb7)](',\x20')+'.');}
|
|
1
|
+
const a32_0x20d575=a32_0x2777;(function(_0x827cc1,_0x396314){const _0x16dec1=a32_0x2777,_0x11f428=_0x827cc1();while(!![]){try{const _0x3b44a0=parseInt(_0x16dec1(0xbd))/0x1+parseInt(_0x16dec1(0xc2))/0x2+parseInt(_0x16dec1(0xe9))/0x3*(-parseInt(_0x16dec1(0xc4))/0x4)+parseInt(_0x16dec1(0xb8))/0x5+-parseInt(_0x16dec1(0xe1))/0x6*(parseInt(_0x16dec1(0xec))/0x7)+parseInt(_0x16dec1(0xd7))/0x8+-parseInt(_0x16dec1(0xb6))/0x9;if(_0x3b44a0===_0x396314)break;else _0x11f428['push'](_0x11f428['shift']());}catch(_0x2d53e3){_0x11f428['push'](_0x11f428['shift']());}}}(a32_0x2d40,0xde2ae));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets,clearBffScriptCache}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';function a32_0x2d40(){const _0x348922=['apps','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','map','bff','scriptsRoot','operationType','appCode','boolean','9782576CcUixO','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.','hash','would_push',':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.','high-risk-write','\x22.\x20','code','\x22\x20not\x20found\x20after\x20ensureLockScope.','bool','2083182edNmNN','description','Run\x20`','has','Push\x20only\x20this\x20script\x20type','datasetCodeToDataset','parse','update','1898766gRYHAw','cleared','lockFilePath','21FNcRIa','Cannot\x20resolve\x20dataset\x20for\x20\x22','type','\x20failed,\x20','alias','No\x20local\x20BFF\x20functions\x20found.','script','version','name','lockKey','some','runtime\x20cache\x20cleared','Local\x20function\x20not\x20found:\x20','status','HOOK','Push\x20complete:\x20','Runtime\x20script\x20cache\x20cleared.','get','length','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','stringify','validation','string','POST','\x20uploaded,\x20','Lock\x20file\x20not\x20settled\x20after\x20push\x20for\x20','3747708jKTrkQ','datasetCode','2425840jwSQUU','str','force','functions','unchanged','845866OwxspN','remoteId','set','COMMON','/api/management/library/scripts/save','894134qodIPj','create','4jawdIB','runtime\x20cache\x20not\x20needed','\x20skipped,\x20','filter','\x20local\x20BFF\x20script(s)\x20for\x20push\x20and\x20clear\x20runtime\x20cache\x20if\x20files\x20are\x20uploaded','push','functionNode','attempted','aliasToDatasetCode','filePath','Push\x20local\x20BFF\x20scripts\x20to\x20remote'];a32_0x2d40=function(){return _0x348922;};return a32_0x2d40();}import{sleep}from'../../utils/sleep.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';const CACHE_CLEAR_ATTEMPTS=0x2,CACHE_CLEAR_INTERVAL_MS=0x12c;export const bffPush={'service':a32_0x20d575(0xd2),'command':'push','description':a32_0x20d575(0xce),'risk':a32_0x20d575(0xdc),'flags':[{'name':a32_0x20d575(0xee),'type':a32_0x20d575(0xb2),'description':a32_0x20d575(0xe5),'enum':[a32_0x20d575(0xc0),'ENDPOINT',a32_0x20d575(0xaa)]},{'name':a32_0x20d575(0xf4),'type':a32_0x20d575(0xb2),'description':a32_0x20d575(0xd0)},{'name':a32_0x20d575(0xba),'type':a32_0x20d575(0xd6),'description':'Force\x20push\x20ignoring\x20hash\x20protection'}],async 'dryRun'(_0x131f3f){const _0x3e064c=a32_0x20d575,_0x3781d6=loadBffProjectConfig(_0x131f3f[_0x3e064c(0xd5)]),_0x11a08a=await readBffLockFile(_0x3781d6[_0x3e064c(0xeb)]),{appLock:_0x1d371d}=ensureLockScope(_0x11a08a??createEmptyBffLock(),_0x131f3f[_0x3e064c(0xd5)],_0x3781d6[_0x3e064c(0xd3)],_0x3e064c(0xc9)),_0x4be56c=await getTargetFunctions(_0x3781d6,_0x131f3f),_0x30f3f7=_0x131f3f[_0x3e064c(0xe0)]('force'),_0x2089d1=[];for(const _0x5697a2 of _0x4be56c){const _0x436c91=await computeFileHash(_0x5697a2[_0x3e064c(0xcd)]),_0x13c5a3=_0x1d371d[_0x3e064c(0xbb)][_0x5697a2[_0x3e064c(0xf5)]],_0x25dcd7=!!_0x13c5a3&&_0x13c5a3[_0x3e064c(0xd9)]===_0x436c91;_0x2089d1['push']({'lockKey':_0x5697a2[_0x3e064c(0xf5)],'filePath':_0x5697a2[_0x3e064c(0xcd)],'remoteId':_0x13c5a3?.[_0x3e064c(0xbe)]??null,'mode':_0x13c5a3?.[_0x3e064c(0xbe)]?_0x3e064c(0xe8):_0x3e064c(0xc3),'status':!_0x30f3f7&&_0x25dcd7?_0x3e064c(0xbc):_0x3e064c(0xda)});}return{'method':_0x3e064c(0xb3),'url':_0x3e064c(0xc1),'body':{'appCode':_0x131f3f[_0x3e064c(0xd5)],'force':_0x30f3f7,'files':_0x2089d1,'cacheClearAtRuntime':_0x2089d1[_0x3e064c(0xa6)](_0x3a4eda=>_0x3a4eda[_0x3e064c(0xa9)]===_0x3e064c(0xda)),'cacheClearAtRuntimeTimes':_0x2089d1[_0x3e064c(0xa6)](_0x52224c=>_0x52224c[_0x3e064c(0xa9)]===_0x3e064c(0xda))?CACHE_CLEAR_ATTEMPTS:0x0},'description':'Would\x20inspect\x20'+_0x2089d1[_0x3e064c(0xae)]+_0x3e064c(0xc8)};},async 'execute'(_0x39837e){const _0x14ab67=a32_0x20d575,_0x248783=loadBffProjectConfig(_0x39837e[_0x14ab67(0xd5)]),_0x4f60ed=await readBffLockFile(_0x248783[_0x14ab67(0xeb)]),{lockData:_0x3329df,appLock:_0x3afd76}=ensureLockScope(_0x4f60ed??createEmptyBffLock(),_0x39837e['appCode'],_0x248783[_0x14ab67(0xd3)],_0x14ab67(0xc9)),_0x1d23f3=await getTargetFunctions(_0x248783,_0x39837e);if(_0x1d23f3['length']===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x14ab67(0xf1)};const _0x35a5df=_0x39837e[_0x14ab67(0xe0)](_0x14ab67(0xba)),_0x35028b=JSON[_0x14ab67(0xe7)](JSON[_0x14ab67(0xb0)](_0x3329df)),_0x4b6529=_0x35028b[_0x14ab67(0xcf)][_0x39837e['appCode']];if(!_0x4b6529)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x39837e[_0x14ab67(0xd5)]+_0x14ab67(0xdf));const _0x1fd313=await buildHookMaps(_0x39837e[_0x14ab67(0xd5)],_0x39837e['apiDir'],_0x1d23f3,_0x4b6529),_0x7c341b=[],_0x5ebbe7=[],_0x4de336=[];for(const _0x472271 of _0x1d23f3){const _0x1155a6=await computeFileHash(_0x472271['filePath']),_0x35fb52=_0x4b6529[_0x14ab67(0xbb)][_0x472271[_0x14ab67(0xf5)]];if(!_0x35a5df&&_0x35fb52&&_0x35fb52['hash']===_0x1155a6){_0x5ebbe7[_0x14ab67(0xc9)]({'lockKey':_0x472271[_0x14ab67(0xf5)],'reason':_0x14ab67(0xbc)});continue;}try{await uploadSingleFunction(_0x39837e[_0x14ab67(0xd5)],_0x472271,_0x4b6529,_0x1fd313);const _0x5cd5e8=_0x4b6529[_0x14ab67(0xbb)][_0x472271[_0x14ab67(0xf5)]];_0x7c341b[_0x14ab67(0xc9)]({'lockKey':_0x472271[_0x14ab67(0xf5)],'remoteId':_0x5cd5e8?.[_0x14ab67(0xbe)]??0x0});}catch(_0x58e8c6){_0x4de336[_0x14ab67(0xc9)]({'lockKey':_0x472271['lockKey'],'error':_0x58e8c6 instanceof Error?_0x58e8c6['message']:String(_0x58e8c6)});}}_0x4b6529['lastSync']=new Date()['toISOString'](),await writeBffLockFile(_0x248783[_0x14ab67(0xeb)],_0x35028b),await waitForUploadedLockEntries(_0x248783[_0x14ab67(0xeb)],_0x39837e['appCode'],_0x7c341b[_0x14ab67(0xd1)](_0x59276e=>_0x59276e['lockKey']));let _0x508d96={'attempted':![],'cleared':![]};if(_0x7c341b[_0x14ab67(0xae)]>0x0)try{let _0x657330='';for(let _0xffc9c4=0x0;_0xffc9c4<CACHE_CLEAR_ATTEMPTS;_0xffc9c4+=0x1){_0x657330=await clearBffScriptCache(),_0xffc9c4<CACHE_CLEAR_ATTEMPTS-0x1&&await sleep(CACHE_CLEAR_INTERVAL_MS);}_0x508d96={'attempted':!![],'cleared':!![],'message':_0x657330||_0x14ab67(0xac)};}catch(_0x528acc){_0x508d96={'attempted':!![],'cleared':![],'error':_0x528acc instanceof Error?_0x528acc['message']:String(_0x528acc)};}const _0x3ad6e5=_0x4de336['length']===0x0&&(_0x508d96[_0x14ab67(0xcb)]?_0x508d96[_0x14ab67(0xea)]:!![]),_0x4b1a60=_0x508d96[_0x14ab67(0xcb)]?_0x508d96[_0x14ab67(0xea)]?_0x14ab67(0xa7):'runtime\x20cache\x20clear\x20failed':_0x14ab67(0xc5);return{'ok':_0x3ad6e5,'data':{'uploaded':_0x7c341b,'skipped':_0x5ebbe7,'failed':_0x4de336,'cacheClear':_0x508d96},'message':_0x14ab67(0xab)+_0x7c341b[_0x14ab67(0xae)]+_0x14ab67(0xb4)+_0x5ebbe7['length']+_0x14ab67(0xc6)+_0x4de336[_0x14ab67(0xae)]+_0x14ab67(0xef)+_0x4b1a60};}};async function getTargetFunctions(_0x3a8bc5,_0x544c35){const _0x19355d=a32_0x20d575,_0x215842=_0x544c35[_0x19355d(0xb9)](_0x19355d(0xee)),_0xa859bd=_0x544c35['str'](_0x19355d(0xf4)),_0xb4f7d3=normalizeBffType(_0x215842)??undefined;if(_0xa859bd&&!_0xb4f7d3)throw CliErrors[_0x19355d(0xb1)](_0x19355d(0xd8));const _0x57df21=await scanLocalBffFunctions(_0x3a8bc5,_0xb4f7d3);if(_0xa859bd){const _0x1cdda3=_0x57df21[_0x19355d(0xc7)](_0x5d4ccc=>_0x5d4ccc[_0x19355d(0xf4)]===_0xa859bd);if(_0x1cdda3['length']===0x0)throw CliErrors[_0x19355d(0xb1)](_0x19355d(0xa8)+_0xb4f7d3+'/'+_0xa859bd);return _0x1cdda3;}return _0x57df21;}async function buildHookMaps(_0x28bc91,_0x3d60f4,_0x44c9a7,_0x1be5a9){const _0x52d0f8=a32_0x20d575,_0x4d1a1c=_0x44c9a7[_0x52d0f8(0xa6)](_0x827e8b=>_0x827e8b[_0x52d0f8(0xee)]===_0x52d0f8(0xaa));if(!_0x4d1a1c)return{'aliasToDatasetCode':new Map(),'datasetCodeToDataset':new Map()};const _0x12694b=loadAliasMap(_0x3d60f4,undefined,resolveApiFilePath(_0x3d60f4,_0x28bc91)),_0x5981f3=new Map(_0x12694b[_0x52d0f8(0xd1)](_0xacd65a=>[_0xacd65a['alias'],_0xacd65a[_0x52d0f8(0xb7)]]));for(const _0x1c08fc of Object['values'](_0x1be5a9[_0x52d0f8(0xbb)])){_0x1c08fc[_0x52d0f8(0xf0)]&&_0x1c08fc['datasetCode']&&!_0x5981f3['has'](_0x1c08fc[_0x52d0f8(0xf0)])&&_0x5981f3[_0x52d0f8(0xbf)](_0x1c08fc[_0x52d0f8(0xf0)],_0x1c08fc['datasetCode']);}const _0x21d000=await listDatasets(_0x28bc91),_0xb669b2=new Map(_0x21d000[_0x52d0f8(0xd1)](_0x2de6b8=>[_0x2de6b8[_0x52d0f8(0xde)],_0x2de6b8]));return{'aliasToDatasetCode':_0x5981f3,'datasetCodeToDataset':_0xb669b2};}function a32_0x2777(_0x487f87,_0x512fad){_0x487f87=_0x487f87-0xa6;const _0x2d40a3=a32_0x2d40();let _0x2777b5=_0x2d40a3[_0x487f87];return _0x2777b5;}async function uploadSingleFunction(_0x34db29,_0x3f0fc9,_0x3e3602,_0x10c01c){const _0x17a42d=a32_0x20d575,_0x5e78b4=await readFile(_0x3f0fc9['filePath'],'utf8'),_0x6c5d44=await computeFileHash(_0x3f0fc9['filePath']),_0x3adf03=_0x3e3602[_0x17a42d(0xbb)][_0x3f0fc9[_0x17a42d(0xf5)]];if(_0x3adf03?.[_0x17a42d(0xbe)]&&_0x3adf03[_0x17a42d(0xf3)]==null)throw CliErrors[_0x17a42d(0xb1)](_0x3f0fc9[_0x17a42d(0xf5)]+_0x17a42d(0xdb));let _0x3c2ad2=extractScriptDescription(_0x5e78b4);if(!_0x3c2ad2&&_0x3adf03?.['remoteId']){const _0x496e56=await getBffScriptInfo(_0x3adf03[_0x17a42d(0xbe)]);_0x3c2ad2=_0x496e56['description']||undefined;}const _0x3de87e={'appCode':_0x34db29,'functionName':_0x3f0fc9['name'],'scriptType':_0x3f0fc9[_0x17a42d(0xee)],'scriptContent':_0x5e78b4};if(_0x3adf03?.[_0x17a42d(0xbe)])_0x3de87e['id']=_0x3adf03[_0x17a42d(0xbe)];if(_0x3adf03?.[_0x17a42d(0xf3)]!=null)_0x3de87e[_0x17a42d(0xf3)]=_0x3adf03[_0x17a42d(0xf3)];if(_0x3c2ad2)_0x3de87e[_0x17a42d(0xe2)]=_0x3c2ad2;if(_0x3f0fc9['type']===_0x17a42d(0xaa)){const _0x2c05a9=_0x3f0fc9[_0x17a42d(0xf0)];if(!_0x2c05a9||!_0x3f0fc9[_0x17a42d(0xd4)]||!_0x3f0fc9[_0x17a42d(0xca)])throw CliErrors[_0x17a42d(0xb1)]('Incomplete\x20HOOK\x20path:\x20'+_0x3f0fc9[_0x17a42d(0xf5)]);const _0x5d8a98=_0x10c01c[_0x17a42d(0xcc)]['get'](_0x2c05a9)??_0x3adf03?.[_0x17a42d(0xb7)]??_0x2c05a9,_0xe65752=_0x10c01c[_0x17a42d(0xe6)]['get'](_0x5d8a98);if(!_0xe65752)throw CliErrors[_0x17a42d(0xb1)](_0x17a42d(0xed)+_0x2c05a9+_0x17a42d(0xdd)+(_0x17a42d(0xe3)+CLI_BIN_NAME+_0x17a42d(0xaf)));_0x3de87e['datasetId']=_0xe65752['id'],_0x3de87e[_0x17a42d(0xd4)]=_0x3f0fc9[_0x17a42d(0xd4)],_0x3de87e[_0x17a42d(0xca)]=_0x3f0fc9['functionNode'];}const _0x36d60d=await saveBffScript(_0x3de87e),_0x26b980=_0x36d60d['id'],_0x19867c=_0x36d60d[_0x17a42d(0xf2)]??await getBffScriptInfo(_0x26b980),_0x1fcc0e={'hash':_0x6c5d44,'remoteId':_0x26b980,'version':_0x19867c[_0x17a42d(0xf3)]};if(_0x3f0fc9[_0x17a42d(0xee)]===_0x17a42d(0xaa)){const _0x54c955=_0x3f0fc9[_0x17a42d(0xf0)],_0x508dc8=_0x10c01c[_0x17a42d(0xcc)][_0x17a42d(0xad)](_0x54c955)??_0x3adf03?.[_0x17a42d(0xb7)]??_0x54c955;_0x10c01c['aliasToDatasetCode'][_0x17a42d(0xe4)](_0x54c955)?_0x1fcc0e['alias']=_0x54c955:_0x1fcc0e[_0x17a42d(0xf0)]=_0x3adf03?.['alias'],_0x1fcc0e['datasetCode']=_0x508dc8,_0x1fcc0e[_0x17a42d(0xd4)]=_0x3f0fc9[_0x17a42d(0xd4)],_0x1fcc0e[_0x17a42d(0xca)]=_0x3f0fc9[_0x17a42d(0xca)];}_0x3e3602['functions'][_0x3f0fc9[_0x17a42d(0xf5)]]=_0x1fcc0e;}const LOCK_SETTLE_RETRY_COUNT=0x14,LOCK_SETTLE_DELAY_MS=0x64;async function waitForUploadedLockEntries(_0xb0d9f,_0x9086ae,_0x4ea158){const _0x176b6c=a32_0x20d575;if(_0x4ea158[_0x176b6c(0xae)]===0x0)return;for(let _0x57b58d=0x0;_0x57b58d<LOCK_SETTLE_RETRY_COUNT;_0x57b58d+=0x1){const _0x49ea2f=await readBffLockFile(_0xb0d9f),_0x5ed6c1=_0x49ea2f?.['apps']?.[_0x9086ae]?.['functions']??{},_0x1dd7c6=_0x4ea158['every'](_0x4b6c8e=>!!_0x5ed6c1[_0x4b6c8e]?.['remoteId']);if(_0x1dd7c6)return;await sleep(LOCK_SETTLE_DELAY_MS);}throw new Error(_0x176b6c(0xb5)+_0x4ea158['join'](',\x20')+'.');}
|