@lovrabet/rabetbase-cli 2.5.5-beta.2 → 2.5.5-beta.3
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/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.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/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.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/logs.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-skill/index.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-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.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-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.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-audit.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/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.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-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.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/table-diff-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/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.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/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.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/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.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/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.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/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.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/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.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/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.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/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.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/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.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/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.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/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.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/error-output.js +1 -1
- package/lib/framework/explicit-yes.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/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.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/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/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
- package/skills/rabetbase/SKILL.md +3 -3
- package/skills/rabetbase/guides/independent-deployment.md +11 -1
- package/skills/rabetbase/references/rabetbase-config.md +16 -19
- package/skills/rabetbase/references/rabetbase-menu-visibility-update.md +5 -4
- package/skills/rabetbase/references/rabetbase-workspace.md +3 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x2e34b2=a34_0x31b8;function a34_0x233c(){const _0x1bacbd=['/smartapi/app-config/update','set','7481mMTeNw','3882164lyedUu','app-config','file','number','936486gmVGcy','apiError','/smartapi/app-config/create','Updated','739977mSYUBq','\x20app\x20config\x20','5505036VWXZfA','143532xWUDnE','Read\x20config\x20value\x20from\x20file','12QnurMW','tags','get','18OJqlWM','appCode','update','40jlmRjy','Created','write','POST','2106035YmKhtl','10mGvBnu','create','26AVPwZQ'];a34_0x233c=function(){return _0x1bacbd;};return a34_0x233c();}(function(_0x22c422,_0xe8e869){const _0xb76b96=a34_0x31b8,_0x4f94c3=_0x22c422();while(!![]){try{const _0x5a8ef0=-parseInt(_0xb76b96(0xcf))/0x1*(parseInt(_0xb76b96(0xcc))/0x2)+-parseInt(_0xb76b96(0xdd))/0x3*(parseInt(_0xb76b96(0xdb))/0x4)+parseInt(_0xb76b96(0xc9))/0x5+parseInt(_0xb76b96(0xc2))/0x6*(-parseInt(_0xb76b96(0xd8))/0x7)+parseInt(_0xb76b96(0xc5))/0x8*(parseInt(_0xb76b96(0xd4))/0x9)+-parseInt(_0xb76b96(0xca))/0xa*(-parseInt(_0xb76b96(0xd0))/0xb)+-parseInt(_0xb76b96(0xda))/0xc;if(_0x5a8ef0===_0xe8e869)break;else _0x4f94c3['push'](_0x4f94c3['shift']());}catch(_0x1b6cdc){_0x4f94c3['push'](_0x4f94c3['shift']());}}}(a34_0x233c,0x43ce2));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a34_0x31b8(_0x2970cd,_0x501167){_0x2970cd=_0x2970cd-0xc2;const _0x233c87=a34_0x233c();let _0x31b804=_0x233c87[_0x2970cd];return _0x31b804;}import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';const CREATE_PATH=a34_0x2e34b2(0xd6),UPDATE_PATH=a34_0x2e34b2(0xcd);export const appConfigSet={'service':a34_0x2e34b2(0xd1),'command':a34_0x2e34b2(0xce),'description':'Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','risk':a34_0x2e34b2(0xc7),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x2e34b2(0xd2),'type':'string','description':a34_0x2e34b2(0xdc)}],async 'validate'(_0x1da956){readKeyArg(_0x1da956),readOptionalTags(_0x1da956),assertSingleValueSource(_0x1da956);},async 'dryRun'(_0xac6e39){const _0x30abc9=a34_0x2e34b2,_0x3c9a70=readKeyArg(_0xac6e39),_0x378ff9=readOptionalTags(_0xac6e39),_0x5a684a=assertSingleValueSource(_0xac6e39);await assertValueSourceReadable(_0x5a684a);const _0x2289d2=await withAppConfigApiBoundary(_0x30abc9(0xdf),{'appCode':_0xac6e39[_0x30abc9(0xc3)],'key':_0x3c9a70},()=>getAppConfigByKey(_0xac6e39['appCode'],_0x3c9a70)),_0xc050f0=_0x2289d2?_0x30abc9(0xc4):_0x30abc9(0xcb),_0x4a407f=_0x2289d2?projectAppConfig(_0x2289d2):null,_0x27caa8=plannedAppConfig({'appCode':_0xac6e39[_0x30abc9(0xc3)],'key':_0x3c9a70,'tags':_0x378ff9??_0x2289d2?.[_0x30abc9(0xde)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0xc050f0,'appCode':_0xac6e39[_0x30abc9(0xc3)],'key':_0x3c9a70,'before':_0x4a407f,'after':_0x27caa8,'dryRun':!![]}),{'method':_0x30abc9(0xc8),'url':_0xc050f0===_0x30abc9(0xc4)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x2de9d4){const _0x1b3322=a34_0x2e34b2,_0x122fdd=readKeyArg(_0x2de9d4),_0x23bb1c=readOptionalTags(_0x2de9d4),_0x5eb91f=await withAppConfigApiBoundary(_0x1b3322(0xdf),{'appCode':_0x2de9d4['appCode'],'key':_0x122fdd},()=>getAppConfigByKey(_0x2de9d4[_0x1b3322(0xc3)],_0x122fdd)),_0x4f0fea=_0x5eb91f?projectAppConfig(_0x5eb91f):null,_0x27bae3=_0x5eb91f?_0x1b3322(0xc4):_0x1b3322(0xcb),{value:_0x4e1bfb,warnings:_0x28e104}=await readAppConfigValue(_0x2de9d4),_0x463506={'appCode':_0x2de9d4[_0x1b3322(0xc3)],'key':_0x122fdd,'value':_0x4e1bfb,'tags':_0x23bb1c??_0x5eb91f?.[_0x1b3322(0xde)]??undefined};await withAppConfigApiBoundary(_0x27bae3,{'appCode':_0x2de9d4[_0x1b3322(0xc3)],'key':_0x122fdd},async()=>{const _0x5d8c66=_0x1b3322;_0x5eb91f?await updateAppConfig({..._0x463506,'id':requireAppConfigId(_0x5eb91f,_0x122fdd,_0x2de9d4[_0x5d8c66(0xc3)])}):await createAppConfig(_0x463506);});const _0x586469=await withAppConfigApiBoundary(_0x1b3322(0xdf),{'appCode':_0x2de9d4[_0x1b3322(0xc3)],'key':_0x122fdd},()=>getAppConfigByKey(_0x2de9d4['appCode'],_0x122fdd)),_0x2c39ab=_0x586469?projectAppConfig(_0x586469):plannedAppConfig({'appCode':_0x2de9d4[_0x1b3322(0xc3)],'key':_0x122fdd,'tags':_0x463506[_0x1b3322(0xde)],'hasValue':_0x4e1bfb!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x27bae3,'appCode':_0x2de9d4['appCode'],'key':_0x122fdd,'before':_0x4f0fea,'after':_0x2c39ab,'dryRun':![],'warnings':_0x28e104}),'message':(_0x27bae3===_0x1b3322(0xc4)?_0x1b3322(0xd7):_0x1b3322(0xc6))+_0x1b3322(0xd9)+_0x122fdd};}};function requireAppConfigId(_0x109ad5,_0x1951ff,_0xcc520f){const _0x264ee5=a34_0x2e34b2;if(typeof _0x109ad5['id']===_0x264ee5(0xd3)&&Number['isFinite'](_0x109ad5['id'])&&_0x109ad5['id']>0x0)return _0x109ad5['id'];throw CliErrors[_0x264ee5(0xd5)]('App\x20config\x20server\x20id\x20missing\x20for\x20key='+_0x1951ff+',\x20appCode='+_0xcc520f);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x5d24a1=a35_0x1817;(function(_0x13250c,_0x4475f6){const _0x433694=a35_0x1817,_0x4eee48=_0x13250c();while(!![]){try{const _0x12d948=-parseInt(_0x433694(0xf4))/0x1*(-parseInt(_0x433694(0xeb))/0x2)+-parseInt(_0x433694(0xdf))/0x3+parseInt(_0x433694(0xd7))/0x4*(parseInt(_0x433694(0x101))/0x5)+parseInt(_0x433694(0x102))/0x6*(parseInt(_0x433694(0xf7))/0x7)+parseInt(_0x433694(0xf0))/0x8*(parseInt(_0x433694(0xec))/0x9)+parseInt(_0x433694(0xfe))/0xa+-parseInt(_0x433694(0xe7))/0xb;if(_0x12d948===_0x4475f6)break;else _0x4eee48['push'](_0x4eee48['shift']());}catch(_0x45659d){_0x4eee48['push'](_0x4eee48['shift']());}}}(a35_0x42f4,0x72f4c));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x5d24a1(0x10b),'description':a35_0x5d24a1(0xd8),'required':!![]};function a35_0x1817(_0x25702c,_0x55cb10){_0x25702c=_0x25702c-0xd5;const _0x42f484=a35_0x42f4();let _0x1817a4=_0x42f484[_0x25702c];return _0x1817a4;}export const VALUE_ARG={'name':'value','description':a35_0x5d24a1(0xe4),'required':![]};export const TAGS_FLAG={'name':a35_0x5d24a1(0x10a),'type':a35_0x5d24a1(0x106),'description':a35_0x5d24a1(0xd5)};export const STDIN_FLAG={'name':a35_0x5d24a1(0xd6),'type':'boolean','description':a35_0x5d24a1(0xf9),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x5d24a1(0x107),'type':a35_0x5d24a1(0x106),'description':a35_0x5d24a1(0x105)};export const REVEAL_FLAG={'name':a35_0x5d24a1(0xfc),'type':'boolean','description':'Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','default':![]};export function readKeyArg(_0x4b0d5f){const _0x32b5aa=a35_0x5d24a1,_0x6abccb=_0x4b0d5f[_0x32b5aa(0x104)][0x0]?.[_0x32b5aa(0xe3)]()??'';return validateKey(_0x6abccb),_0x6abccb;}export function readOptionalTags(_0x48a975){const _0x5ca9c4=a35_0x5d24a1,_0x96fb99=_0x48a975[_0x5ca9c4(0xf2)](_0x5ca9c4(0x10a))[_0x5ca9c4(0xe3)]();if(!_0x96fb99)return undefined;if(_0x96fb99[_0x5ca9c4(0x111)]>0x20)throw CliErrors[_0x5ca9c4(0xe1)](_0x5ca9c4(0xf1));return _0x96fb99;}export function validateKey(_0x100962){const _0x19b7cb=a35_0x5d24a1;if(!_0x100962)throw CliErrors[_0x19b7cb(0xe1)]('Missing\x20app-config\x20key.');if(_0x100962[_0x19b7cb(0x111)]>0x100)throw CliErrors[_0x19b7cb(0xe1)](_0x19b7cb(0xe8));}export function projectAppConfig(_0x5412b9,_0x1dc444){const _0x35f5fd=a35_0x5d24a1,_0x1392f9=_0x5412b9[_0x35f5fd(0x10e)]!==undefined&&_0x5412b9[_0x35f5fd(0x10e)]!==null&&_0x5412b9['value']!=='',_0x44e8f4={'appCode':_0x5412b9['appCode'],'key':_0x5412b9['key'],'tags':_0x5412b9[_0x35f5fd(0x10a)]??undefined,'hasValue':_0x1392f9,'valueRedacted':_0x1392f9&&!_0x1dc444?.['reveal'],'gmtCreate':_0x5412b9[_0x35f5fd(0xe9)],'gmtModified':_0x5412b9[_0x35f5fd(0xf5)]};return _0x1dc444?.[_0x35f5fd(0xfc)]&&(_0x44e8f4[_0x35f5fd(0x10e)]=_0x5412b9['value']??'',_0x44e8f4['valueRedacted']=![]),_0x44e8f4;}export function plannedAppConfig(_0xd42ea4){const _0xc09e7f=_0xd42ea4['hasValue']??!![];return{'appCode':_0xd42ea4['appCode'],'key':_0xd42ea4['key'],'tags':_0xd42ea4['tags']??undefined,'hasValue':_0xc09e7f,'valueRedacted':_0xc09e7f};}export function buildMutationData(_0x4c6ceb){const _0x5d8ea7=a35_0x5d24a1;return{'operation':_0x4c6ceb[_0x5d8ea7(0xf8)],'selector':{'appCode':_0x4c6ceb['appCode'],'key':_0x4c6ceb['key']},'before':_0x4c6ceb['before'],'after':_0x4c6ceb[_0x5d8ea7(0xea)],'dryRun':_0x4c6ceb[_0x5d8ea7(0xe6)],'warnings':_0x4c6ceb[_0x5d8ea7(0xd9)]??[]};}export async function withAppConfigApiBoundary(_0x3029ab,_0x4ef6c6,_0x5044ff){const _0x2174fd=a35_0x5d24a1;try{return await _0x5044ff();}catch{const _0x2de214=['appCode:\x20'+_0x4ef6c6[_0x2174fd(0xf6)]];if(_0x4ef6c6[_0x2174fd(0x10b)])_0x2de214[_0x2174fd(0xde)](_0x2174fd(0xe2)+_0x4ef6c6[_0x2174fd(0x10b)]);_0x2de214['push']('value\x20is\x20redacted');throw CliErrors[_0x2174fd(0xfa)](_0x2174fd(0xda)+_0x3029ab+_0x2174fd(0xfb),_0x2de214[_0x2174fd(0x103)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x44c1ba,_0x4060b6){const _0xc16b0d=a35_0x5d24a1;return Object['defineProperties'](_0x44c1ba,{'method':{'value':_0x4060b6['method'],'enumerable':![]},'url':{'value':_0x4060b6[_0xc16b0d(0xdc)],'enumerable':![]}});}export function assertSingleValueSource(_0x2c92b3){const _0x4d57f3=a35_0x5d24a1,_0x14fc23=[];_0x2c92b3[_0x4d57f3(0x104)]['length']>0x1&&_0x14fc23[_0x4d57f3(0xde)]({'kind':'argument','value':_0x2c92b3['args'][_0x4d57f3(0x100)](0x1)['join']('\x20')});const _0xb2aa7e=_0x2c92b3['flag'](_0x4d57f3(0x10e));_0xb2aa7e!==undefined&&_0xb2aa7e!==null&&_0x14fc23[_0x4d57f3(0xde)]({'kind':'argument','value':String(_0xb2aa7e)});_0x2c92b3[_0x4d57f3(0x109)](_0x4d57f3(0xd6))&&_0x14fc23[_0x4d57f3(0xde)]({'kind':_0x4d57f3(0xd6)});const _0x449421=_0x2c92b3[_0x4d57f3(0xf2)](_0x4d57f3(0x107))[_0x4d57f3(0xe3)]();_0x449421&&_0x14fc23[_0x4d57f3(0xde)]({'kind':'env','name':_0x449421});const _0x4b0669=_0x2c92b3['str'](_0x4d57f3(0xe5))[_0x4d57f3(0xe3)]();_0x4b0669&&_0x14fc23[_0x4d57f3(0xde)]({'kind':'file','path':_0x4b0669});if(_0x14fc23['length']===0x0)throw CliErrors[_0x4d57f3(0xe1)](_0x4d57f3(0xef),_0x4d57f3(0xed));if(_0x14fc23[_0x4d57f3(0x111)]>0x1)throw CliErrors[_0x4d57f3(0xe1)]('App\x20config\x20value\x20source\x20is\x20ambiguous.',_0x4d57f3(0x10f));return _0x14fc23[0x0];}export async function assertValueSourceReadable(_0x1efba2){const _0x496b0f=a35_0x5d24a1;if(_0x1efba2['kind']==='env'&&!(_0x1efba2[_0x496b0f(0x10d)]in process.env))throw CliErrors[_0x496b0f(0xe1)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x1efba2[_0x496b0f(0x10d)]);if(_0x1efba2['kind']==='file')try{await access(_0x1efba2[_0x496b0f(0x108)]);}catch{throw CliErrors['validation'](_0x496b0f(0xdb)+_0x1efba2[_0x496b0f(0x108)]);}}export async function readAppConfigValue(_0x4034e7){const _0x27bf4a=a35_0x5d24a1,_0xaf655=assertSingleValueSource(_0x4034e7),_0x2cdf2f=[];if(_0xaf655[_0x27bf4a(0xe0)]===_0x27bf4a(0xff))return _0x2cdf2f['push']('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0xaf655[_0x27bf4a(0x10e)]??'','source':_0xaf655['kind'],'warnings':_0x2cdf2f};if(_0xaf655['kind']==='stdin')return{'value':await readStdin(),'source':_0xaf655[_0x27bf4a(0xe0)],'warnings':_0x2cdf2f};if(_0xaf655[_0x27bf4a(0xe0)]===_0x27bf4a(0xfd)){if(!(_0xaf655[_0x27bf4a(0x10d)]in process.env))throw CliErrors[_0x27bf4a(0xe1)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0xaf655[_0x27bf4a(0x10d)]);return{'value':process.env[_0xaf655.name]??'','source':_0xaf655[_0x27bf4a(0xe0)],'warnings':_0x2cdf2f};}return{'value':await readFile(_0xaf655['path'],_0x27bf4a(0xf3)),'source':_0xaf655[_0x27bf4a(0xe0)],'warnings':_0x2cdf2f};}function readStdin(){return new Promise((_0x2ffa80,_0x4b3caa)=>{const _0x3618d6=a35_0x1817;let _0x301de1='';process[_0x3618d6(0xd6)][_0x3618d6(0x10c)](_0x3618d6(0xf3)),process[_0x3618d6(0xd6)]['on']('data',_0x536254=>{_0x301de1+=_0x536254;}),process[_0x3618d6(0xd6)][_0x3618d6(0xee)](_0x3618d6(0x110),()=>_0x2ffa80(_0x301de1)),process[_0x3618d6(0xd6)][_0x3618d6(0xee)](_0x3618d6(0xdd),_0x4b3caa);});}function a35_0x42f4(){const _0x8a9ee8=['16522033JxiVvq','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','gmtCreate','after','1248AEJdLD','2376sKYHHp','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','once','Missing\x20app-config\x20value\x20source.','21544xgWGSd','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','str','utf8','56RicsBx','gmtModified','appCode','2384011EmytdK','operation','Read\x20config\x20value\x20from\x20stdin','apiError','\x20app\x20config.','reveal','env','7658200aOfoeo','argument','slice','236845gnCRHc','6gmRSCB','join','args','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','string','from-env','path','bool','tags','key','setEncoding','name','value','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','end','length','Config\x20tags\x20for\x20filtering/display\x20metadata','stdin','44flShwT','Runtime\x20app-config\x20key','warnings','Failed\x20to\x20','Value\x20file\x20is\x20not\x20readable:\x20','url','error','push','1201455aSVrbb','kind','validation','key:\x20','trim','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','file','dryRun'];a35_0x42f4=function(){return _0x8a9ee8;};return a35_0x42f4();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x54d16c=a36_0x3c37;(function(_0x308a37,_0xe7d6fd){const _0x344b21=a36_0x3c37,_0xd620b7=_0x308a37();while(!![]){try{const _0x1a49cf=parseInt(_0x344b21(0x14e))/0x1+parseInt(_0x344b21(0x153))/0x2+parseInt(_0x344b21(0x15f))/0x3*(-parseInt(_0x344b21(0x15d))/0x4)+-parseInt(_0x344b21(0x15a))/0x5+parseInt(_0x344b21(0x159))/0x6*(parseInt(_0x344b21(0x158))/0x7)+-parseInt(_0x344b21(0x156))/0x8+parseInt(_0x344b21(0x14f))/0x9;if(_0x1a49cf===_0xe7d6fd)break;else _0xd620b7['push'](_0xd620b7['shift']());}catch(_0x31bdf2){_0xd620b7['push'](_0xd620b7['shift']());}}}(a36_0x261e,0xa335e));import{unlinkSync,existsSync}from'node:fs';function a36_0x3c37(_0x1b6d1c,_0x254a34){_0x1b6d1c=_0x1b6d1c-0x14b;const _0x261e2c=a36_0x261e();let _0x3c37a8=_0x261e2c[_0x1b6d1c];return _0x3c37a8;}import{cookieFile}from'../../auth/constant.js';function a36_0x261e(){const _0x2d212b=['2259568dNUFQh','logout','6DnTBZQ','boolean','log','Clear\x20login\x20session','666667tZrQBq','15188130dLxvLf','auth','login','write','1498376ViKaYa','nonInteractive','yes','5609880AvTXGk','Login\x20via\x20browser','14TKdNJI','1237764qHChaJ','5082420OzAFTZ','✓\x20Logged\x20out','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately'];a36_0x261e=function(){return _0x2d212b;};return a36_0x261e();}export const authDefinitions=[{'service':a36_0x54d16c(0x150),'command':a36_0x54d16c(0x151),'description':a36_0x54d16c(0x157),'risk':a36_0x54d16c(0x152),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x54d16c(0x155),'type':a36_0x54d16c(0x14b),'description':a36_0x54d16c(0x15c),'default':![]}],async 'execute'(_0x3dd42e){const _0x504c76=a36_0x54d16c,{runAuthServer:_0x5c1f13}=await import('../../auth/auth-server-ui.js');return await _0x5c1f13({'autoYes':_0x3dd42e['bool'](_0x504c76(0x155)),'nonInteractive':_0x3dd42e[_0x504c76(0x154)]}),{'ok':!![]};}},{'service':a36_0x54d16c(0x150),'command':a36_0x54d16c(0x15e),'description':a36_0x54d16c(0x14d),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x502876){const _0x2b6250=a36_0x54d16c;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x2b6250(0x14c)](_0x2b6250(0x15b))):console['log']('!\x20Not\x20logged\x20in'),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x64b9f2=a37_0x506d;(function(_0x1868e1,_0x3ee78a){const _0x24e302=a37_0x506d,_0x2ad185=_0x1868e1();while(!![]){try{const _0x27c26e=-parseInt(_0x24e302(0xc8))/0x1*(parseInt(_0x24e302(0xa0))/0x2)+parseInt(_0x24e302(0x73))/0x3+parseInt(_0x24e302(0x97))/0x4*(parseInt(_0x24e302(0x85))/0x5)+-parseInt(_0x24e302(0xaa))/0x6+-parseInt(_0x24e302(0xab))/0x7*(parseInt(_0x24e302(0x92))/0x8)+parseInt(_0x24e302(0xad))/0x9+parseInt(_0x24e302(0xcc))/0xa;if(_0x27c26e===_0x3ee78a)break;else _0x2ad185['push'](_0x2ad185['shift']());}catch(_0x1d11f7){_0x2ad185['push'](_0x2ad185['shift']());}}}(a37_0x5768,0x8c896));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a37_0x506d(_0x4fd697,_0x571178){_0x4fd697=_0x4fd697-0x6b;const _0x576847=a37_0x5768();let _0x506d02=_0x576847[_0x4fd697];return _0x506d02;}import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x5768(){const _0x1a5a29=['description','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Operation\x20type\x20(HOOK\x20only)','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','close','function-node','bff','No\x20datasets\x20found\x20for\x20this\x20app.','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','scriptsRootDir','HOOK\x20requires\x20alias/operation/node\x20options.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','join','profileName','parseInt','string','524637AdubeM','read','stderr','ENDPOINT','\x22\x20not\x20found\x20for\x20dataset\x20','.js\x0a\x20*\x20[触发节点]\x20','当前请求参数','nonInteractive','.js\x0a','alias','UNKNOWN','length','datasetId','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Trigger\x20node\x20(HOOK\x20only)','Select\x20dataset:','entries','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','35HiWTVv','operationType','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','operation-type','/**\x0a\x20*\x20','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Created\x20','keys','HOOK','Dataset\x20not\x20found\x20for\x20code\x20\x22','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','Operation\x20type\x20\x22','selectedAppName','2213528oXckTq','create','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','currentApp','Select\x20trigger\x20node:','465204zTHQiW','map','\x22\x20not\x20found.\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','mergedCli','.js','datasetCode','Invalid\x20function\x20name\x20\x22','validation','2XCsuoS','Select\x20operation\x20type:','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','Function\x20name\x20(valid\x20JS\x20identifier)','isInteger','当前响应结果','question','before','COMMON','str','2831526YqeGFP','28iUlvTv','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','3850839qBhZmB','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','name','修改后的响应结果','filePath','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x20function:\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','File\x20already\x20exists:\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x0a\x20*\x20[平台配置]\x20','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','defaultApp','code','tableName','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','apiDir','type','\x22.\x20','functionNode','Available\x20aliases:\x20','appCode','write','after','/ENDPOINT/','1131848QBEZJD','find','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','No\x20operation\x20types\x20found\x20for\x20dataset\x20','18693140yPamPV','Invalid\x20dataset\x20selection.','datasetcode','trim'];a37_0x5768=function(){return _0x1a5a29;};return a37_0x5768();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x64b9f2(0xd7),'command':a37_0x64b9f2(0x93),'description':a37_0x64b9f2(0xbe),'risk':a37_0x64b9f2(0x74),'flags':[{'name':a37_0x64b9f2(0xc0),'type':a37_0x64b9f2(0x72),'required':!![],'enum':[a37_0x64b9f2(0xa8),a37_0x64b9f2(0x76),a37_0x64b9f2(0x8d)],'description':'Script\x20type'},{'name':a37_0x64b9f2(0xb0),'type':a37_0x64b9f2(0x72),'required':!![],'description':a37_0x64b9f2(0xa3)},{'name':a37_0x64b9f2(0xd0),'type':'string','description':'Script\x20description'},{'name':'alias','type':a37_0x64b9f2(0x72),'description':a37_0x64b9f2(0x9a)},{'name':a37_0x64b9f2(0xce),'type':'string','description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a37_0x64b9f2(0x88),'type':a37_0x64b9f2(0x72),'description':a37_0x64b9f2(0xd3)},{'name':a37_0x64b9f2(0xd6),'type':a37_0x64b9f2(0x72),'description':a37_0x64b9f2(0x81),'enum':[a37_0x64b9f2(0xa7),a37_0x64b9f2(0xc6)]}],async 'validate'(_0x163cc){const _0x2d297f=a37_0x64b9f2,_0x5c8d5c=_0x163cc['str'](_0x2d297f(0xb0));if(!isValidBffFunctionName(_0x5c8d5c))throw CliErrors[_0x2d297f(0x9f)](_0x2d297f(0x9e)+_0x5c8d5c+_0x2d297f(0xb5));},async 'execute'(_0x5984f5){const _0x3251c4=a37_0x64b9f2,_0x432eb5=loadBffProjectConfig(_0x5984f5[_0x3251c4(0xc4)]),_0x557c66=_0x5984f5[_0x3251c4(0xa9)](_0x3251c4(0xc0)),_0x296a40=_0x5984f5[_0x3251c4(0xa9)](_0x3251c4(0xb0)),_0xa318ea=_0x5984f5[_0x3251c4(0xa9)](_0x3251c4(0xd0))||undefined,_0x2807ed=_0x557c66==='HOOK'?await resolveHookOptions(_0x432eb5,_0x5984f5):undefined,_0x33cc1d=buildFilePath(_0x432eb5,_0x557c66,_0x296a40,_0x2807ed);if(await fileExists(_0x33cc1d))throw CliErrors[_0x3251c4(0x9f)](_0x3251c4(0xb6)+_0x33cc1d);await mkdir(dirname(_0x33cc1d),{'recursive':!![]});const _0x2afacd=generateTemplate(_0x557c66,_0x296a40,_0x5984f5[_0x3251c4(0xc4)],_0xa318ea,_0x2807ed);await writeFile(_0x33cc1d,_0x2afacd,'utf8');const _0x4161e7={'type':_0x557c66,'name':_0x296a40,'path':_0x33cc1d};if(_0xa318ea)_0x4161e7['description']=_0xa318ea;if(_0x2807ed){if(_0x2807ed[_0x3251c4(0x7c)])_0x4161e7[_0x3251c4(0x7c)]=_0x2807ed[_0x3251c4(0x7c)];_0x4161e7[_0x3251c4(0x9d)]=_0x2807ed[_0x3251c4(0x9d)],_0x4161e7['operationType']=_0x2807ed[_0x3251c4(0x86)],_0x4161e7[_0x3251c4(0xc2)]=_0x2807ed['functionNode'];}return{'ok':!![],'data':_0x4161e7,'message':_0x3251c4(0x8b)+_0x557c66+_0x3251c4(0xb4)+_0x296a40};}};async function resolveHookOptions(_0x563572,_0x3a2b55){const _0x193492=a37_0x64b9f2,_0xf6e2ff=resolveApiModelSource(_0x3a2b55['apiDir'],_0x3a2b55['appCode'],_0x3a2b55[_0x193492(0x91)]||_0x3a2b55['mergedCli']?.[_0x193492(0x95)]||_0x3a2b55[_0x193492(0x9b)]?.[_0x193492(0xbb)]),_0x5c5130=loadAliasMap(_0x3a2b55[_0x193492(0xbf)],undefined,_0xf6e2ff[_0x193492(0xb2)],_0xf6e2ff[_0x193492(0x70)]),_0x319730=_0x5c5130[_0x193492(0x7e)]>0x0;let _0x3a0b9f,_0x24346b,_0x1f7310;const _0x52ff15=_0x3a2b55['str'](_0x193492(0x7c)),_0x3023ce=_0x3a2b55['str'](_0x193492(0xce));if(_0x52ff15){const _0x17fa53=resolveAlias(_0x3a2b55['apiDir'],_0x52ff15,undefined,_0xf6e2ff['filePath'],_0xf6e2ff[_0x193492(0x70)]);if(!_0x17fa53){const _0x36402a=_0x319730?_0x193492(0xc3)+_0x5c5130[_0x193492(0x98)](_0x444091=>_0x444091[_0x193492(0x7c)])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x193492(0x9f)]('Alias\x20\x22'+_0x52ff15+_0x193492(0x99)+_0x36402a);}_0x3a0b9f=_0x52ff15,_0x24346b=_0x17fa53;}else{if(_0x3023ce){_0x24346b=_0x3023ce;const _0x4e5204=_0x5c5130[_0x193492(0xc9)](_0x5742a4=>_0x5742a4[_0x193492(0x9d)]===_0x3023ce);_0x3a0b9f=_0x4e5204?.[_0x193492(0x7c)];}else{if(_0x3a2b55[_0x193492(0x7a)])throw CliErrors[_0x193492(0x9f)](_0x193492(0x80));else{if(_0x319730){const _0x34ec80=_0x5c5130[_0x193492(0x98)](_0x1efce9=>_0x1efce9[_0x193492(0x7c)]+'\x20('+_0x1efce9[_0x193492(0xbd)]+')'),_0xd6547f=await promptSelect(_0x193492(0x82),_0x34ec80),_0xe8e0fa=_0x5c5130[_0xd6547f];if(!_0xe8e0fa)throw CliErrors[_0x193492(0x9f)]('Invalid\x20dataset\x20selection.');_0x3a0b9f=_0xe8e0fa['alias'],_0x24346b=_0xe8e0fa[_0x193492(0x9d)];}else{const _0x4e2d4c=await listDatasets(_0x3a2b55['appCode']);if(_0x4e2d4c[_0x193492(0x7e)]===0x0)throw CliErrors[_0x193492(0x9f)](_0x193492(0xd8));const _0x265438=_0x4e2d4c[_0x193492(0x98)](_0x4171a7=>_0x4171a7[_0x193492(0xb0)]+'\x20['+(_0x4171a7['source']??_0x193492(0x7d))+']\x20('+_0x4171a7[_0x193492(0xbc)]+')'),_0x2fec4e=await promptSelect(_0x193492(0x82),_0x265438),_0x599493=_0x4e2d4c[_0x2fec4e];if(!_0x599493)throw CliErrors[_0x193492(0x9f)](_0x193492(0xcd));_0x24346b=_0x599493[_0x193492(0xbc)],_0x3a0b9f=undefined;}}}}const _0x741f46=await listDatasets(_0x3a2b55[_0x193492(0xc4)]),_0x391f81=_0x741f46[_0x193492(0xc9)](_0x7f7d59=>_0x7f7d59[_0x193492(0xbc)]===_0x24346b);if(!_0x391f81)throw CliErrors['validation'](_0x193492(0x8e)+_0x24346b+_0x193492(0xc1)+(_0x3a0b9f?_0x193492(0x94)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x1f7310=_0x391f81['id'];const _0x36c9a6=_0x3a0b9f??_0x24346b,_0x3acaeb=await listBffDatasetOperations(_0x3a2b55['appCode'],_0x1f7310),_0x3fa512=_0x3acaeb?Object[_0x193492(0x8c)](_0x3acaeb):[];if(_0x3fa512[_0x193492(0x7e)]===0x0)throw CliErrors[_0x193492(0x9f)](_0x193492(0xcb)+_0x36c9a6+'.');let _0x2212d9;const _0x2fe76b=_0x3a2b55[_0x193492(0xa9)](_0x193492(0x88));if(_0x2fe76b){if(!_0x3fa512['includes'](_0x2fe76b))throw CliErrors['validation'](_0x193492(0x90)+_0x2fe76b+_0x193492(0x77)+_0x36c9a6+'.\x20'+('Available:\x20'+_0x3fa512[_0x193492(0x6f)](',\x20')));_0x2212d9=_0x2fe76b;}else{if(_0x3a2b55[_0x193492(0x7a)])throw CliErrors[_0x193492(0x9f)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0xb51575=await promptSelect(_0x193492(0xa1),_0x3fa512);_0x2212d9=_0x3fa512[_0xb51575]??_0x3fa512[0x0];}let _0x32b648=normalizeHookFunctionNode(_0x3a2b55[_0x193492(0xa9)]('function-node'));if(!_0x32b648){if(_0x3a2b55[_0x193492(0xa9)]('function-node'))throw CliErrors['validation'](_0x193492(0xaf));if(_0x3a2b55[_0x193492(0x7a)])throw CliErrors['validation'](_0x193492(0xd1));const _0x439e90=await promptSelect(_0x193492(0x96),[_0x193492(0xa7),'after']);_0x32b648=['before','after'][_0x439e90]??_0x193492(0xa7);}return{'alias':_0x3a0b9f,'datasetCode':_0x24346b,'datasetId':_0x1f7310,'operationType':_0x2212d9,'functionNode':_0x32b648};}async function promptSelect(_0x19c5a8,_0x5c5b9b){const _0x441469=a37_0x64b9f2;if(_0x5c5b9b[_0x441469(0x7e)]===0x1)return 0x0;for(const [_0x35ffaf,_0x48cc91]of _0x5c5b9b[_0x441469(0x83)]()){process[_0x441469(0x75)][_0x441469(0xc5)]('\x20\x20'+(_0x35ffaf+0x1)+'.\x20'+_0x48cc91+'\x0a');}const _0x371d48=createInterface({'input':process['stdin'],'output':process['stderr']});while(!![]){const _0x4f2c8c=await new Promise(_0x462a3a=>{const _0x82f042=_0x441469;_0x371d48[_0x82f042(0xa6)](_0x19c5a8+'\x20',_0x462a3a);}),_0x4b3503=Number[_0x441469(0x71)](_0x4f2c8c['trim'](),0xa);if(Number[_0x441469(0xa4)](_0x4b3503)&&_0x4b3503>=0x1&&_0x4b3503<=_0x5c5b9b['length'])return _0x371d48[_0x441469(0xd5)](),_0x4b3503-0x1;process[_0x441469(0x75)][_0x441469(0xc5)](_0x441469(0x84)+_0x5c5b9b[_0x441469(0x7e)]+'.\x0a');}}function buildFilePath(_0x83f117,_0x59b490,_0xaf577c,_0x21d43e){const _0x3d1020=a37_0x64b9f2;if(_0x59b490===_0x3d1020(0x8d)){if(!_0x21d43e)throw CliErrors['validation'](_0x3d1020(0x6d));const _0xbe3a2f=_0x21d43e['alias']??_0x21d43e[_0x3d1020(0x9d)];return join(_0x83f117[_0x3d1020(0x6c)],'HOOK',_0xbe3a2f,_0x21d43e[_0x3d1020(0x86)],_0x21d43e[_0x3d1020(0xc2)],_0xaf577c+'.js');}return join(_0x83f117[_0x3d1020(0x6c)],_0x59b490,_0xaf577c+_0x3d1020(0x9c));}export function generateTemplate(_0x14677f,_0x4c07e4,_0x1b3495,_0x3f7662,_0x360541){const _0x4fb349=a37_0x64b9f2,_0x4c90c8=_0x3f7662?.[_0x4fb349(0xcf)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x5e3dd4=getAppBaseUrl(_0x1b3495),_0x841654=_0x4fb349(0xba);if(_0x14677f==='COMMON')return'/**\x0a\x20*\x20'+_0x4c90c8+_0x4fb349(0x6e)+_0x4c07e4+'\x0a\x20*\x20[平台配置]\x20'+_0x5e3dd4+_0x4fb349(0x6b)+_0x1b3495+'/COMMON/'+_0x4c07e4+_0x4fb349(0xa2)+_0x4c07e4+'\x22,\x20params\x20})\x0a'+_0x841654+_0x4fb349(0xb7)+_0x4c07e4+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x14677f===_0x4fb349(0x76))return _0x4fb349(0x89)+_0x4c90c8+_0x4fb349(0xae)+_0x4c07e4+_0x4fb349(0xca)+_0x1b3495+'/'+_0x4c07e4+_0x4fb349(0xb9)+_0x5e3dd4+_0x4fb349(0x6b)+_0x1b3495+_0x4fb349(0xc7)+_0x4c07e4+_0x4fb349(0x7b)+_0x841654+_0x4fb349(0x8a)+_0x4c07e4+_0x4fb349(0xac);if(!_0x360541)throw CliErrors['validation'](_0x4fb349(0x8f));const _0x4b15c2=_0x360541['alias']??_0x360541[_0x4fb349(0x9d)],_0x45434b=_0x360541['functionNode']==='before'?_0x4fb349(0x79):_0x4fb349(0xa5),_0x299857=_0x360541[_0x4fb349(0xc2)]===_0x4fb349(0xa7)?'修改后的请求参数':_0x4fb349(0xb1);return'/**\x0a\x20*\x20'+_0x4c90c8+_0x4fb349(0xb3)+_0x4c07e4+_0x4fb349(0x87)+_0x1b3495+'/'+_0x360541['datasetCode']+'/'+_0x360541['operationType']+_0x4fb349(0xb9)+_0x5e3dd4+'/data/dataset/'+_0x360541[_0x4fb349(0x7f)]+_0x4fb349(0xb8)+_0x1b3495+'/HOOK/'+_0x4b15c2+'/'+_0x360541['operationType']+'/'+_0x360541[_0x4fb349(0xc2)]+'/'+_0x4c07e4+_0x4fb349(0x78)+_0x360541[_0x4fb349(0xc2)]+'\x0a'+_0x841654+_0x4fb349(0xd4)+_0x45434b+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x299857+_0x4fb349(0xd2)+_0x4c07e4+_0x4fb349(0xac);}
|
|
1
|
+
const a37_0x1f9f96=a37_0x2587;(function(_0x5832ef,_0x1227f2){const _0x440bc5=a37_0x2587,_0x57d67c=_0x5832ef();while(!![]){try{const _0x4941d2=-parseInt(_0x440bc5(0x134))/0x1+parseInt(_0x440bc5(0x121))/0x2+-parseInt(_0x440bc5(0xf6))/0x3*(parseInt(_0x440bc5(0xe3))/0x4)+parseInt(_0x440bc5(0x13a))/0x5*(-parseInt(_0x440bc5(0xfb))/0x6)+parseInt(_0x440bc5(0x12d))/0x7*(-parseInt(_0x440bc5(0x123))/0x8)+-parseInt(_0x440bc5(0x141))/0x9+parseInt(_0x440bc5(0xe8))/0xa;if(_0x4941d2===_0x1227f2)break;else _0x57d67c['push'](_0x57d67c['shift']());}catch(_0x2c4f52){_0x57d67c['push'](_0x57d67c['shift']());}}}(a37_0x7166,0x19b89));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 a37_0x2587(_0x7acaac,_0x2e7074){_0x7acaac=_0x7acaac-0xe0;const _0x716600=a37_0x7166();let _0x25875b=_0x716600[_0x7acaac];return _0x25875b;}import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x7166(){const _0x172514=['Operation\x20type\x20\x22','datasetCode','Trigger\x20node\x20(HOOK\x20only)','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','operation-type','before','write','当前请求参数','COMMON','string','parseInt','/data/dataset/','join','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','Script\x20type','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','datasetcode','修改后的响应结果','\x20function:\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','333856ZAQlqV','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','1297192LAxBzs','apiDir','Created\x20','close','length','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','find','name','/**\x0a\x20*\x20','trim','7FRkSuE','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x22\x20not\x20found.\x20','HOOK\x20requires\x20alias/operation/node\x20options.','tableName','description','code','14270LrkBfY','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','stdin','\x0a\x20*\x20[平台配置]\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','profileName','10TlOJko','scriptsRootDir','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','mergedCli','Operation\x20type\x20(HOOK\x20only)','修改后的请求参数','\x20api\x20pull`\x20to\x20refresh.','363024AsesYk','filePath','read','HOOK','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','478980wTRTmT','Select\x20dataset:','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','nonInteractive','Script\x20description','4102830OXBdkF','after','No\x20datasets\x20found\x20for\x20this\x20app.','currentApp','当前响应结果','appCode','validation','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','str','stderr','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','.js','map','/HOOK/','3GRsxaW','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','/ENDPOINT/',']\x20(','406074hLnsXj','alias','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Function\x20name\x20(valid\x20JS\x20identifier)','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','source','question','operationType','ENDPOINT','functionNode','datasetId','Select\x20trigger\x20node:','.js\x0a\x20*\x20[触发节点]\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Invalid\x20dataset\x20selection.'];a37_0x7166=function(){return _0x172514;};return a37_0x7166();}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':'create','description':a37_0x1f9f96(0x119),'risk':a37_0x1f9f96(0xe0),'flags':[{'name':'type','type':a37_0x1f9f96(0x115),'required':!![],'enum':[a37_0x1f9f96(0x114),'ENDPOINT',a37_0x1f9f96(0xe1)],'description':a37_0x1f9f96(0x11b)},{'name':a37_0x1f9f96(0x12a),'type':a37_0x1f9f96(0x115),'required':!![],'description':a37_0x1f9f96(0x100)},{'name':'description','type':a37_0x1f9f96(0x115),'description':a37_0x1f9f96(0xe7)},{'name':a37_0x1f9f96(0xfc),'type':a37_0x1f9f96(0x115),'description':a37_0x1f9f96(0xff)},{'name':a37_0x1f9f96(0x11d),'type':a37_0x1f9f96(0x115),'description':a37_0x1f9f96(0x11a)},{'name':'operation-type','type':a37_0x1f9f96(0x115),'description':a37_0x1f9f96(0x13e)},{'name':'function-node','type':a37_0x1f9f96(0x115),'description':a37_0x1f9f96(0x10e),'enum':['before',a37_0x1f9f96(0xe9)]}],async 'validate'(_0x558338){const _0x2a07f4=a37_0x1f9f96,_0x2e7688=_0x558338[_0x2a07f4(0xf0)]('name');if(!isValidBffFunctionName(_0x2e7688))throw CliErrors[_0x2a07f4(0xee)]('Invalid\x20function\x20name\x20\x22'+_0x2e7688+_0x2a07f4(0x135));},async 'execute'(_0xf3bb2a){const _0x2cc3d5=a37_0x1f9f96,_0x18a4e9=loadBffProjectConfig(_0xf3bb2a[_0x2cc3d5(0xed)]),_0x71f342=_0xf3bb2a[_0x2cc3d5(0xf0)]('type'),_0x5f2a4a=_0xf3bb2a[_0x2cc3d5(0xf0)](_0x2cc3d5(0x12a)),_0x25d373=_0xf3bb2a[_0x2cc3d5(0xf0)](_0x2cc3d5(0x132))||undefined,_0x3080ac=_0x71f342==='HOOK'?await resolveHookOptions(_0x18a4e9,_0xf3bb2a):undefined,_0x718e69=buildFilePath(_0x18a4e9,_0x71f342,_0x5f2a4a,_0x3080ac);if(await fileExists(_0x718e69))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x718e69);await mkdir(dirname(_0x718e69),{'recursive':!![]});const _0x5ef80f=generateTemplate(_0x71f342,_0x5f2a4a,_0xf3bb2a[_0x2cc3d5(0xed)],_0x25d373,_0x3080ac);await writeFile(_0x718e69,_0x5ef80f,'utf8');const _0x51a97d={'type':_0x71f342,'name':_0x5f2a4a,'path':_0x718e69};if(_0x25d373)_0x51a97d[_0x2cc3d5(0x132)]=_0x25d373;if(_0x3080ac){if(_0x3080ac['alias'])_0x51a97d[_0x2cc3d5(0xfc)]=_0x3080ac['alias'];_0x51a97d['datasetCode']=_0x3080ac['datasetCode'],_0x51a97d['operationType']=_0x3080ac[_0x2cc3d5(0x104)],_0x51a97d[_0x2cc3d5(0x106)]=_0x3080ac[_0x2cc3d5(0x106)];}return{'ok':!![],'data':_0x51a97d,'message':_0x2cc3d5(0x125)+_0x71f342+_0x2cc3d5(0x11f)+_0x5f2a4a};}};async function resolveHookOptions(_0x17ba31,_0x35e704){const _0x561c20=a37_0x1f9f96,_0x4111b3=resolveApiModelSource(_0x35e704['apiDir'],_0x35e704['appCode'],_0x35e704['selectedAppName']||_0x35e704[_0x561c20(0x13d)]?.[_0x561c20(0xeb)]||_0x35e704['mergedCli']?.['defaultApp']),_0xeafa54=loadAliasMap(_0x35e704[_0x561c20(0x124)],undefined,_0x4111b3[_0x561c20(0x142)],_0x4111b3[_0x561c20(0x139)]),_0x411fe4=_0xeafa54[_0x561c20(0x127)]>0x0;let _0x47a393,_0x3b6a77,_0x442981;const _0x589f2a=_0x35e704['str'](_0x561c20(0xfc)),_0xa8f03d=_0x35e704['str']('datasetcode');if(_0x589f2a){const _0x2acef1=resolveAlias(_0x35e704['apiDir'],_0x589f2a,undefined,_0x4111b3[_0x561c20(0x142)],_0x4111b3[_0x561c20(0x139)]);if(!_0x2acef1){const _0x5ac60f=_0x411fe4?'Available\x20aliases:\x20'+_0xeafa54[_0x561c20(0xf4)](_0x1b59fe=>_0x1b59fe['alias'])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x561c20(0xf2);throw CliErrors[_0x561c20(0xee)]('Alias\x20\x22'+_0x589f2a+_0x561c20(0x12f)+_0x5ac60f);}_0x47a393=_0x589f2a,_0x3b6a77=_0x2acef1;}else{if(_0xa8f03d){_0x3b6a77=_0xa8f03d;const _0x18babb=_0xeafa54[_0x561c20(0x129)](_0x4dcb1e=>_0x4dcb1e['datasetCode']===_0xa8f03d);_0x47a393=_0x18babb?.[_0x561c20(0xfc)];}else{if(_0x35e704[_0x561c20(0xe6)])throw CliErrors[_0x561c20(0xee)](_0x561c20(0x12e));else{if(_0x411fe4){const _0x44430d=_0xeafa54['map'](_0x30fe18=>_0x30fe18[_0x561c20(0xfc)]+'\x20('+_0x30fe18[_0x561c20(0x131)]+')'),_0xfea620=await promptSelect(_0x561c20(0xe4),_0x44430d),_0x4c1caa=_0xeafa54[_0xfea620];if(!_0x4c1caa)throw CliErrors[_0x561c20(0xee)](_0x561c20(0x10b));_0x47a393=_0x4c1caa[_0x561c20(0xfc)],_0x3b6a77=_0x4c1caa[_0x561c20(0x10d)];}else{const _0x1628c5=await listDatasets(_0x35e704[_0x561c20(0xed)]);if(_0x1628c5[_0x561c20(0x127)]===0x0)throw CliErrors[_0x561c20(0xee)](_0x561c20(0xea));const _0x398854=_0x1628c5[_0x561c20(0xf4)](_0x1f0260=>_0x1f0260[_0x561c20(0x12a)]+'\x20['+(_0x1f0260[_0x561c20(0x102)]??'UNKNOWN')+_0x561c20(0xfa)+_0x1f0260[_0x561c20(0x133)]+')'),_0x1363b3=await promptSelect(_0x561c20(0xe4),_0x398854),_0x431455=_0x1628c5[_0x1363b3];if(!_0x431455)throw CliErrors[_0x561c20(0xee)](_0x561c20(0x10b));_0x3b6a77=_0x431455[_0x561c20(0x133)],_0x47a393=undefined;}}}}const _0x13bf09=await listDatasets(_0x35e704[_0x561c20(0xed)]),_0x5bc449=_0x13bf09['find'](_0x1f464a=>_0x1f464a['code']===_0x3b6a77);if(!_0x5bc449)throw CliErrors[_0x561c20(0xee)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x3b6a77+'\x22.\x20'+(_0x47a393?_0x561c20(0x13c)+CLI_BIN_NAME+_0x561c20(0x140):''));_0x442981=_0x5bc449['id'];const _0x2bb9e5=_0x47a393??_0x3b6a77,_0x9cc38c=await listBffDatasetOperations(_0x35e704[_0x561c20(0xed)],_0x442981),_0x5f464a=_0x9cc38c?Object['keys'](_0x9cc38c):[];if(_0x5f464a[_0x561c20(0x127)]===0x0)throw CliErrors[_0x561c20(0xee)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x2bb9e5+'.');let _0xeca1c0;const _0x299f3a=_0x35e704[_0x561c20(0xf0)](_0x561c20(0x110));if(_0x299f3a){if(!_0x5f464a['includes'](_0x299f3a))throw CliErrors[_0x561c20(0xee)](_0x561c20(0x10c)+_0x299f3a+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x2bb9e5+'.\x20'+('Available:\x20'+_0x5f464a[_0x561c20(0x118)](',\x20')));_0xeca1c0=_0x299f3a;}else{if(_0x35e704[_0x561c20(0xe6)])throw CliErrors['validation'](_0x561c20(0xfd));const _0x1b98d2=await promptSelect('Select\x20operation\x20type:',_0x5f464a);_0xeca1c0=_0x5f464a[_0x1b98d2]??_0x5f464a[0x0];}let _0x555be5=normalizeHookFunctionNode(_0x35e704[_0x561c20(0xf0)]('function-node'));if(!_0x555be5){if(_0x35e704[_0x561c20(0xf0)]('function-node'))throw CliErrors[_0x561c20(0xee)](_0x561c20(0xef));if(_0x35e704[_0x561c20(0xe6)])throw CliErrors[_0x561c20(0xee)](_0x561c20(0x122));const _0x329375=await promptSelect(_0x561c20(0x108),[_0x561c20(0x111),_0x561c20(0xe9)]);_0x555be5=[_0x561c20(0x111),'after'][_0x329375]??'before';}return{'alias':_0x47a393,'datasetCode':_0x3b6a77,'datasetId':_0x442981,'operationType':_0xeca1c0,'functionNode':_0x555be5};}async function promptSelect(_0x40bf74,_0x5d83ed){const _0x418c9b=a37_0x1f9f96;if(_0x5d83ed[_0x418c9b(0x127)]===0x1)return 0x0;for(const [_0x484d21,_0x5b2e29]of _0x5d83ed['entries']()){process[_0x418c9b(0xf1)][_0x418c9b(0x112)]('\x20\x20'+(_0x484d21+0x1)+'.\x20'+_0x5b2e29+'\x0a');}const _0xdf7d94=createInterface({'input':process[_0x418c9b(0x136)],'output':process[_0x418c9b(0xf1)]});while(!![]){const _0x59fd94=await new Promise(_0x482915=>{const _0x385bd1=_0x418c9b;_0xdf7d94[_0x385bd1(0x103)](_0x40bf74+'\x20',_0x482915);}),_0x6c5fe6=Number[_0x418c9b(0x116)](_0x59fd94[_0x418c9b(0x12c)](),0xa);if(Number['isInteger'](_0x6c5fe6)&&_0x6c5fe6>=0x1&&_0x6c5fe6<=_0x5d83ed['length'])return _0xdf7d94[_0x418c9b(0x126)](),_0x6c5fe6-0x1;process[_0x418c9b(0xf1)][_0x418c9b(0x112)](_0x418c9b(0x128)+_0x5d83ed[_0x418c9b(0x127)]+'.\x0a');}}function buildFilePath(_0x3eb6af,_0x1b9aa0,_0x44bb67,_0x2b6724){const _0x1f8d5f=a37_0x1f9f96;if(_0x1b9aa0===_0x1f8d5f(0xe1)){if(!_0x2b6724)throw CliErrors[_0x1f8d5f(0xee)](_0x1f8d5f(0x130));const _0x3e80f5=_0x2b6724['alias']??_0x2b6724['datasetCode'];return join(_0x3eb6af['scriptsRootDir'],'HOOK',_0x3e80f5,_0x2b6724['operationType'],_0x2b6724[_0x1f8d5f(0x106)],_0x44bb67+'.js');}return join(_0x3eb6af[_0x1f8d5f(0x13b)],_0x1b9aa0,_0x44bb67+_0x1f8d5f(0xf3));}export function generateTemplate(_0x18250f,_0x37281e,_0x41d34b,_0x255a72,_0x4dc217){const _0x4347fe=a37_0x1f9f96,_0xec3331=_0x255a72?.['trim']()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xd6c9a3=getAppBaseUrl(_0x41d34b),_0x328cc6='\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)';if(_0x18250f===_0x4347fe(0x114))return _0x4347fe(0x12b)+_0xec3331+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x37281e+_0x4347fe(0x137)+_0xd6c9a3+_0x4347fe(0x138)+_0x41d34b+'/COMMON/'+_0x37281e+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x37281e+'\x22,\x20params\x20})\x0a'+_0x328cc6+_0x4347fe(0x10a)+_0x37281e+_0x4347fe(0x11c);if(_0x18250f===_0x4347fe(0x105))return _0x4347fe(0x12b)+_0xec3331+_0x4347fe(0xf8)+_0x37281e+_0x4347fe(0x120)+_0x41d34b+'/'+_0x37281e+'\x0a\x20*\x20[平台配置]\x20'+_0xd6c9a3+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x41d34b+_0x4347fe(0xf9)+_0x37281e+'.js\x0a'+_0x328cc6+_0x4347fe(0xe5)+_0x37281e+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x4dc217)throw CliErrors[_0x4347fe(0xee)](_0x4347fe(0xf7));const _0x161dde=_0x4dc217['alias']??_0x4dc217[_0x4347fe(0x10d)],_0x262ac3=_0x4dc217[_0x4347fe(0x106)]===_0x4347fe(0x111)?_0x4347fe(0x113):_0x4347fe(0xec),_0xa2188a=_0x4dc217[_0x4347fe(0x106)]===_0x4347fe(0x111)?_0x4347fe(0x13f):_0x4347fe(0x11e);return _0x4347fe(0x12b)+_0xec3331+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x37281e+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x41d34b+'/'+_0x4dc217['datasetCode']+'/'+_0x4dc217[_0x4347fe(0x104)]+_0x4347fe(0x137)+_0xd6c9a3+_0x4347fe(0x117)+_0x4dc217[_0x4347fe(0x107)]+_0x4347fe(0x101)+_0x41d34b+_0x4347fe(0xf5)+_0x161dde+'/'+_0x4dc217[_0x4347fe(0x104)]+'/'+_0x4dc217[_0x4347fe(0x106)]+'/'+_0x37281e+_0x4347fe(0x109)+_0x4dc217['functionNode']+'\x0a'+_0x328cc6+_0x4347fe(0x10f)+_0x262ac3+_0x4347fe(0xfe)+_0xa2188a+_0x4347fe(0xe2)+_0x37281e+_0x4347fe(0x11c);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x1d7627=a38_0x79bb;(function(_0x45df16,_0x370466){const _0x4b84e6=a38_0x79bb,_0x3a6e68=_0x45df16();while(!![]){try{const _0x196397=-parseInt(_0x4b84e6(0x1d8))/0x1*(parseInt(_0x4b84e6(0x1db))/0x2)+-parseInt(_0x4b84e6(0x1cf))/0x3+-parseInt(_0x4b84e6(0x1e8))/0x4+-parseInt(_0x4b84e6(0x1b4))/0x5*(-parseInt(_0x4b84e6(0x1ec))/0x6)+parseInt(_0x4b84e6(0x1e6))/0x7*(-parseInt(_0x4b84e6(0x1cc))/0x8)+parseInt(_0x4b84e6(0x1eb))/0x9+-parseInt(_0x4b84e6(0x1c8))/0xa*(-parseInt(_0x4b84e6(0x1d1))/0xb);if(_0x196397===_0x370466)break;else _0x3a6e68['push'](_0x3a6e68['shift']());}catch(_0x221169){_0x3a6e68['push'](_0x3a6e68['shift']());}}}(a38_0x1a69,0x93937));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x1d7627(0x1e7),'command':'delete','description':a38_0x1d7627(0x1bf),'risk':'high-risk-write','flags':[{'name':a38_0x1d7627(0x1d3),'type':'string','required':!![],'description':a38_0x1d7627(0x1d9)}],async 'validate'(_0x349d57){const _0x1172e0=a38_0x1d7627,_0x3c15fe=loadBffProjectConfig(_0x349d57[_0x1172e0(0x1b5)]),_0x5d57fc=await readBffLockFile(_0x3c15fe['lockFilePath']);if(!_0x5d57fc)throw CliErrors[_0x1172e0(0x1dc)](_0x1172e0(0x1e5));},async 'dryRun'(_0x1ae98e){const _0x201835=a38_0x1d7627,_0x19ba21=loadBffProjectConfig(_0x1ae98e[_0x201835(0x1b5)]),_0x2257be=await readBffLockFile(_0x19ba21[_0x201835(0x1ba)]);if(!_0x2257be)throw CliErrors[_0x201835(0x1dc)](_0x201835(0x1d7));const {appLock:_0x42899d}=ensureLockScope(_0x2257be,_0x1ae98e[_0x201835(0x1b5)],_0x19ba21[_0x201835(0x1d0)],'delete'),_0x2ac76f=_0x1ae98e[_0x201835(0x1c7)](_0x201835(0x1d3)),_0x4a303f=Object[_0x201835(0x1e1)](_0x42899d[_0x201835(0x1ce)]),_0x1c7887=resolveDeleteTarget(_0x2ac76f,_0x4a303f),_0x4feef5=_0x42899d[_0x201835(0x1ce)][_0x1c7887];if(!_0x4feef5)throw CliErrors[_0x201835(0x1dc)](_0x201835(0x1e9)+_0x1c7887+'\x22.');const _0x2de59d=resolveLocalFilePathFromLockKey(_0x19ba21,_0x1c7887),_0x2bef56=relative(_0x19ba21['projectRoot'],_0x2de59d),_0x2a07cf=join(_0x19ba21[_0x201835(0x1d6)],_0x201835(0x1b7),_0x2bef56);return{'method':_0x201835(0x1e3),'url':_0x201835(0x1c2),'body':{'appCode':_0x1ae98e[_0x201835(0x1b5)],'target':_0x1c7887,'remoteId':_0x4feef5['remoteId'],'localFilePath':_0x2de59d,'trashedPath':_0x2a07cf},'description':_0x201835(0x1cd)+_0x1c7887+_0x201835(0x1c9)};},async 'execute'(_0x533c4a){const _0x2259c3=a38_0x1d7627,_0xf6e63b=loadBffProjectConfig(_0x533c4a[_0x2259c3(0x1b5)]),_0x5e1c41=await readBffLockFile(_0xf6e63b[_0x2259c3(0x1ba)]);if(!_0x5e1c41)throw CliErrors[_0x2259c3(0x1dc)](_0x2259c3(0x1d7));const {lockData:_0x1067a6,appLock:_0x18423f}=ensureLockScope(_0x5e1c41,_0x533c4a[_0x2259c3(0x1b5)],_0xf6e63b[_0x2259c3(0x1d0)],_0x2259c3(0x1be)),_0x28a8fe=JSON[_0x2259c3(0x1d4)](JSON[_0x2259c3(0x1c1)](_0x1067a6)),_0xa265b2=_0x28a8fe['apps'][_0x533c4a[_0x2259c3(0x1b5)]];if(!_0xa265b2)throw new Error(_0x2259c3(0x1dd)+_0x533c4a[_0x2259c3(0x1b5)]+_0x2259c3(0x1c0));const _0x59aaf7=_0x533c4a[_0x2259c3(0x1c7)](_0x2259c3(0x1d3)),_0x3ec637=Object[_0x2259c3(0x1e1)](_0xa265b2[_0x2259c3(0x1ce)]),_0x1c69a4=resolveDeleteTarget(_0x59aaf7,_0x3ec637),_0x302932=_0xa265b2['functions'][_0x1c69a4];if(!_0x302932)throw CliErrors[_0x2259c3(0x1dc)](_0x2259c3(0x1e9)+_0x1c69a4+'\x22.');await deleteBffScript(_0x302932[_0x2259c3(0x1de)]),delete _0xa265b2[_0x2259c3(0x1ce)][_0x1c69a4],_0xa265b2[_0x2259c3(0x1ea)]=new Date()[_0x2259c3(0x1e0)](),await writeBffLockFile(_0xf6e63b[_0x2259c3(0x1ba)],_0x28a8fe);const _0x26466b=resolveLocalFilePathFromLockKey(_0xf6e63b,_0x1c69a4);let _0x4588cf;await fileExists(_0x26466b)&&(_0x4588cf=await moveToTrash(_0xf6e63b[_0x2259c3(0x1df)],_0xf6e63b[_0x2259c3(0x1d6)],_0x26466b),await cleanupEmptyDirectories(dirname(_0x26466b),_0xf6e63b[_0x2259c3(0x1d2)]));await waitForDeleteSettlement(_0xf6e63b[_0x2259c3(0x1ba)],_0x533c4a[_0x2259c3(0x1b5)],_0x1c69a4,_0x26466b),await sleep(0x96);const _0x547107={'deleted':_0x1c69a4,'remoteId':_0x302932[_0x2259c3(0x1de)]};if(_0x4588cf)_0x547107[_0x2259c3(0x1b9)]=_0x4588cf;return{'ok':!![],'data':_0x547107,'message':_0x2259c3(0x1da)+_0x1c69a4+(_0x4588cf?_0x2259c3(0x1c6):'')};}};function a38_0x79bb(_0x471ecc,_0x5f08c7){_0x471ecc=_0x471ecc-0x1b4;const _0x1a69d4=a38_0x1a69();let _0x79bbe8=_0x1a69d4[_0x471ecc];return _0x79bbe8;}function resolveDeleteTarget(_0x4db95b,_0x265556){const _0xf58483=a38_0x1d7627;if(_0x4db95b[_0xf58483(0x1c4)]('/')){const _0x3e54fd=_0x265556[_0xf58483(0x1cb)](_0x57df54=>_0x57df54===_0x4db95b);if(!_0x3e54fd)throw CliErrors[_0xf58483(0x1dc)](_0xf58483(0x1c3)+_0x4db95b);return _0x3e54fd;}const _0x104de8=_0x265556[_0xf58483(0x1e4)](_0x325396=>_0x325396[_0xf58483(0x1c5)]('/')['at'](-0x1)===_0x4db95b);if(_0x104de8[_0xf58483(0x1b6)]===0x0)throw CliErrors[_0xf58483(0x1dc)](_0xf58483(0x1c3)+_0x4db95b);if(_0x104de8[_0xf58483(0x1b6)]>0x1)throw CliErrors['validation'](_0xf58483(0x1ca)+_0x4db95b+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x104de8[_0xf58483(0x1e2)](_0x1c7114=>_0xf58483(0x1bd)+_0x1c7114)[_0xf58483(0x1bc)]('\x0a'));return _0x104de8[0x0];}async function moveToTrash(_0x362874,_0x3b6323,_0x23034d){const _0xfa9fb6=a38_0x1d7627,_0x6a91a4=new Date()[_0xfa9fb6(0x1e0)]()[_0xfa9fb6(0x1d5)](/[:.]/g,'-'),_0x273aff=relative(_0x362874,_0x23034d),_0x4c3358=join(_0x3b6323,_0x6a91a4,_0x273aff);return await mkdir(dirname(_0x4c3358),{'recursive':!![]}),await rename(_0x23034d,_0x4c3358),_0x4c3358;}function a38_0x1a69(){const _0x40b889=['1447498uFntMx','validation','Lock\x20scope\x20for\x20app\x20\x22','remoteId','projectRoot','toISOString','keys','map','POST','filter','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','7SOfMyy','bff','2460564dWqvXm','No\x20lock\x20entry\x20found\x20for\x20\x22','lastSync','8550720cxRNGE','696wEaoVb','apps','27695itpHZn','appCode','length','<timestamp>','Local\x20delete\x20not\x20settled\x20for\x20','trashedTo','lockFilePath','startsWith','join','\x20\x20-\x20','delete','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','\x22\x20not\x20found\x20after\x20ensureLockScope.','stringify','/api/management/library/scripts/delete','Function\x20not\x20found:\x20','includes','split','\x20(local\x20file\x20moved\x20to\x20trash)','str','4110ZIEQED','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','Multiple\x20functions\x20match\x20\x22','find','9148440zsKXGJ','Would\x20delete\x20','functions','82863DxEFwP','scriptsRoot','40733YgzUzS','scriptsRootDir','target','parse','replace','trashDir','Backend\x20Function\x20lock\x20file\x20not\x20found.','1JkjgsC','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','Deleted\x20'];a38_0x1a69=function(){return _0x40b889;};return a38_0x1a69();}async function cleanupEmptyDirectories(_0xf4adbb,_0x31a475){const _0x29f88c=a38_0x1d7627;let _0x431b0a=resolve(_0xf4adbb);const _0x58337d=resolve(_0x31a475);while(_0x431b0a[_0x29f88c(0x1bb)](''+_0x58337d+sep)||_0x431b0a===_0x58337d){if(_0x431b0a===_0x58337d)return;try{const _0x31613e=await readdir(_0x431b0a);if(_0x31613e[_0x29f88c(0x1b6)]>0x0)return;await rmdir(_0x431b0a);}catch{return;}_0x431b0a=dirname(_0x431b0a);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x1c1fcb,_0x3f7a36,_0x4e9c97,_0x9e7604){const _0x39a4d2=a38_0x1d7627;for(let _0x483fe7=0x0;_0x483fe7<DELETE_SETTLE_RETRY_COUNT;_0x483fe7+=0x1){const _0x343350=await readBffLockFile(_0x1c1fcb),_0x287a06=!!_0x343350?.[_0x39a4d2(0x1ed)]?.[_0x3f7a36]?.[_0x39a4d2(0x1ce)]?.[_0x4e9c97],_0x588977=await fileExists(_0x9e7604);if(!_0x287a06&&!_0x588977)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x39a4d2(0x1b8)+_0x4e9c97+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a39_0x1db97f=a39_0x7800;(function(_0x59c03d,_0x5ca7a4){const _0xdeb30=a39_0x7800,_0x9ad393=_0x59c03d();while(!![]){try{const _0x45084c=parseInt(_0xdeb30(0x17b))/0x1+parseInt(_0xdeb30(0x186))/0x2*(parseInt(_0xdeb30(0x180))/0x3)+parseInt(_0xdeb30(0x17c))/0x4*(-parseInt(_0xdeb30(0x17f))/0x5)+parseInt(_0xdeb30(0x176))/0x6+-parseInt(_0xdeb30(0x177))/0x7*(-parseInt(_0xdeb30(0x181))/0x8)+parseInt(_0xdeb30(0x182))/0x9*(parseInt(_0xdeb30(0x17a))/0xa)+parseInt(_0xdeb30(0x178))/0xb*(parseInt(_0xdeb30(0x18b))/0xc);if(_0x45084c===_0x5ca7a4)break;else _0x9ad393['push'](_0x9ad393['shift']());}catch(_0x172b19){_0x9ad393['push'](_0x9ad393['shift']());}}}(a39_0x24b7,0xda097));import{getBffScriptInfo}from'../../core/api-client.js';function a39_0x24b7(){const _0xe1a0bd=['49459sZGRGO','8OBjtWM','Script\x20ID','num','3687485qFbLJz','159nHwetU','1801112kDXiVf','1454733mbIVBw','boolean','scriptType','updateUserName','9622ywhCdD','version','appCode','detail','bool','209928UJKCCi','verbose','bff','updatedTime','read','Return\x20full\x20raw\x20script\x20object','description','3927306IYAmXt','7hrNPKn','33KLQRnq','number','70docVJY'];a39_0x24b7=function(){return _0xe1a0bd;};return a39_0x24b7();}function a39_0x7800(_0xc9a65c,_0x395fd1){_0xc9a65c=_0xc9a65c-0x175;const _0x24b72c=a39_0x24b7();let _0x7800e=_0x24b72c[_0xc9a65c];return _0x7800e;}export const bffDetail={'service':a39_0x1db97f(0x18d),'command':a39_0x1db97f(0x189),'description':'Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','risk':a39_0x1db97f(0x18f),'flags':[{'name':'id','type':a39_0x1db97f(0x179),'required':!![],'description':a39_0x1db97f(0x17d)},{'name':'verbose','type':a39_0x1db97f(0x183),'description':a39_0x1db97f(0x190)}],async 'execute'(_0x491c9b){const _0x57a7d0=a39_0x1db97f,_0x2c0bce=await getBffScriptInfo(_0x491c9b[_0x57a7d0(0x17e)]('id')),_0x369133=_0x491c9b[_0x57a7d0(0x18a)](_0x57a7d0(0x18c));if(_0x369133)return{'ok':!![],'data':_0x2c0bce};return{'ok':!![],'data':{'id':_0x2c0bce['id'],'functionName':_0x2c0bce['functionName']??'','version':_0x2c0bce[_0x57a7d0(0x187)]??'','updateUserName':_0x2c0bce[_0x57a7d0(0x185)]??'','appCode':_0x2c0bce[_0x57a7d0(0x188)],'scriptType':_0x2c0bce[_0x57a7d0(0x184)],'description':_0x2c0bce[_0x57a7d0(0x175)]||'(none)','createdTime':_0x2c0bce['createdTime']??'','updatedTime':_0x2c0bce[_0x57a7d0(0x18e)]??'','scriptContent':_0x2c0bce['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x125054,_0x40f65e){const _0x5e0bce=a40_0x4033,_0x463dac=_0x125054();while(!![]){try{const _0x1fe280=-parseInt(_0x5e0bce(0x8b))/0x1*(-parseInt(_0x5e0bce(0x88))/0x2)+-parseInt(_0x5e0bce(0x82))/0x3+-parseInt(_0x5e0bce(0x89))/0x4*(-parseInt(_0x5e0bce(0x84))/0x5)+parseInt(_0x5e0bce(0x83))/0x6*(parseInt(_0x5e0bce(0x85))/0x7)+-parseInt(_0x5e0bce(0x8c))/0x8+-parseInt(_0x5e0bce(0x87))/0x9*(parseInt(_0x5e0bce(0x8a))/0xa)+parseInt(_0x5e0bce(0x86))/0xb;if(_0x1fe280===_0x40f65e)break;else _0x463dac['push'](_0x463dac['shift']());}catch(_0x72d206){_0x463dac['push'](_0x463dac['shift']());}}}(a40_0x5df8,0x44f0d));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';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';import{bffLogs}from'../../commands/bff/logs.js';function a40_0x4033(_0x111c89,_0x1df26c){_0x111c89=_0x111c89-0x82;const _0x5df868=a40_0x5df8();let _0x4033c8=_0x5df868[_0x111c89];return _0x4033c8;}function a40_0x5df8(){const _0xd567e0=['4161464ZJAHhF','874659MNbjGp','12PzSsgJ','10vRwLGV','159593QYrRxD','4150300qULcHi','3225942EWBTFl','1466KNdaGF','1069764GdgLyt','10jnTKGQ','675vOyCzk'];a40_0x5df8=function(){return _0xd567e0;};return a40_0x5df8();}export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a41_0x58b9(_0x290202,_0x3dfdf8){_0x290202=_0x290202-0x67;const _0x395676=a41_0x3956();let _0x58b96f=_0x395676[_0x290202];return _0x58b96f;}const a41_0x188585=a41_0x58b9;(function(_0x562343,_0x21ab36){const _0x458a76=a41_0x58b9,_0x40079e=_0x562343();while(!![]){try{const _0x43312d=-parseInt(_0x458a76(0x74))/0x1*(parseInt(_0x458a76(0x84))/0x2)+parseInt(_0x458a76(0x6b))/0x3*(-parseInt(_0x458a76(0x69))/0x4)+parseInt(_0x458a76(0x82))/0x5+-parseInt(_0x458a76(0x70))/0x6*(parseInt(_0x458a76(0x7d))/0x7)+parseInt(_0x458a76(0x83))/0x8*(parseInt(_0x458a76(0x80))/0x9)+parseInt(_0x458a76(0x73))/0xa+parseInt(_0x458a76(0x68))/0xb;if(_0x43312d===_0x21ab36)break;else _0x40079e['push'](_0x40079e['shift']());}catch(_0x331512){_0x40079e['push'](_0x40079e['shift']());}}}(a41_0x3956,0x44505));import{listBffScripts}from'../../core/api-client.js';function a41_0x3956(){const _0x59042b=['(unnamed)','5243540DXeBGY','11111bxNfpP','functionName','read','appCode','length','bool','map','bff','name','21MLmvOn','Filter\x20by\x20script\x20name','verbose','27fzOlRj','type','1182430zhDIPp','514616WXNimE','28wbrxeX','ENDPOINT','scriptType','description','1691481mislkJ','1070376IlkNfo','str','6nJhitC','No\x20Backend\x20Function\x20scripts\x20found.','Script\x20type\x20filter','list','List\x20Backend\x20Function\x20scripts','274074PDLQYy','string'];a41_0x3956=function(){return _0x59042b;};return a41_0x3956();}export const bffList={'service':a41_0x188585(0x7b),'command':a41_0x188585(0x6e),'description':a41_0x188585(0x6f),'risk':a41_0x188585(0x76),'flags':[{'name':a41_0x188585(0x81),'type':a41_0x188585(0x71),'description':a41_0x188585(0x6d),'default':a41_0x188585(0x85),'enum':[a41_0x188585(0x85),'COMMON']},{'name':a41_0x188585(0x7c),'type':a41_0x188585(0x71),'description':a41_0x188585(0x7e)},{'name':a41_0x188585(0x7f),'type':'boolean','description':'Return\x20full\x20script\x20objects'}],async 'execute'(_0x136b84){const _0x39fa32=a41_0x188585,_0x435b2d=await listBffScripts(_0x136b84[_0x39fa32(0x77)],_0x136b84[_0x39fa32(0x6a)](_0x39fa32(0x81)),{'scriptName':_0x136b84[_0x39fa32(0x6a)](_0x39fa32(0x7c))||undefined}),_0x48ee48=_0x136b84[_0x39fa32(0x79)](_0x39fa32(0x7f));return{'ok':!![],'data':_0x48ee48?_0x435b2d:_0x435b2d[_0x39fa32(0x7a)](_0x257d48=>({'id':_0x257d48['id'],'functionName':_0x257d48[_0x39fa32(0x75)]??'','description':_0x257d48[_0x39fa32(0x67)]||_0x39fa32(0x72),'scriptType':_0x257d48[_0x39fa32(0x86)]})),'message':_0x435b2d[_0x39fa32(0x78)]===0x0?_0x39fa32(0x6c):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x1a71a6=a42_0x292d;function a42_0xf84e(){const _0x18f73a=['\x20must\x20be\x20a\x20positive\x20integer.','limit','number','INFO','635341nWyONs','toUpperCase','--end-time','--start-time','start-time','1557303CYqUmp','536045aQfuxj','--limit\x20must\x20be\x20between\x201\x20and\x20','719916OEVqUy','num','ERROR','889903NediAd','length','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','1720HqQnyj','WARN','40AkYjmZ','logs','str','level','since','keyword','Maximum\x20log\x20lines\x20to\x20return\x20(1-','\x20Backend\x20Function\x20log\x20line(s).','159jpJacL','20tZKmTp','10XVrEhO','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','string','end-time','validation','Filter\x20by\x20log\x20level','132xSFjrY','trim','flag','7975863pNUwaX','isSafeInteger','--limit','DEBUG','read'];a42_0xf84e=function(){return _0x18f73a;};return a42_0xf84e();}(function(_0x1c09d3,_0x38141c){const _0x59bbd5=a42_0x292d,_0x3ab242=_0x1c09d3();while(!![]){try{const _0x57704c=-parseInt(_0x59bbd5(0x78))/0x1+-parseInt(_0x59bbd5(0x86))/0x2*(parseInt(_0x59bbd5(0x90))/0x3)+-parseInt(_0x59bbd5(0x91))/0x4*(parseInt(_0x59bbd5(0x7e))/0x5)+-parseInt(_0x59bbd5(0x80))/0x6+-parseInt(_0x59bbd5(0x83))/0x7*(parseInt(_0x59bbd5(0x88))/0x8)+parseInt(_0x59bbd5(0x6f))/0x9*(parseInt(_0x59bbd5(0x92))/0xa)+parseInt(_0x59bbd5(0x7d))/0xb*(parseInt(_0x59bbd5(0x6c))/0xc);if(_0x57704c===_0x38141c)break;else _0x3ab242['push'](_0x3ab242['shift']());}catch(_0x205230){_0x3ab242['push'](_0x3ab242['shift']());}}}(a42_0xf84e,0x72f81));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x1a71a6(0x72),a42_0x1a71a6(0x77),a42_0x1a71a6(0x87),a42_0x1a71a6(0x82)];export function resolveBffLogQuery(_0x514c98,_0x389276=Date['now']()){const _0x17a046=a42_0x1a71a6,_0x15407=_0x514c98[_0x17a046(0x6e)]('since'),_0x3832e1=_0x514c98[_0x17a046(0x6e)](_0x17a046(0x7c)),_0x2283d0=_0x514c98[_0x17a046(0x6e)](_0x17a046(0x96));if(_0x15407!==undefined&&_0x3832e1!==undefined)throw CliErrors[_0x17a046(0x97)](_0x17a046(0x93));const _0x4c949f=_0x2283d0===undefined?_0x389276:readPositiveInteger(_0x514c98['num']('end-time'),_0x17a046(0x7a)),_0x2607f3=_0x3832e1===undefined?_0x4c949f-readSinceMinutes(_0x514c98)*0xea60:readPositiveInteger(_0x514c98[_0x17a046(0x81)](_0x17a046(0x7c)),_0x17a046(0x7b));if(_0x2607f3<=0x0)throw CliErrors[_0x17a046(0x97)]('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x2607f3>_0x4c949f)throw CliErrors[_0x17a046(0x97)]('--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.');const _0x8498db=readPositiveInteger(_0x514c98['num']('limit',DEFAULT_LIMIT),_0x17a046(0x71));if(_0x8498db>MAX_LIMIT)throw CliErrors[_0x17a046(0x97)](_0x17a046(0x7f)+MAX_LIMIT+'.');const _0x5398b6=_0x514c98[_0x17a046(0x8a)](_0x17a046(0x8b))[_0x17a046(0x6d)]()[_0x17a046(0x79)]()||undefined,_0x2d213d=_0x514c98[_0x17a046(0x8a)](_0x17a046(0x8d))[_0x17a046(0x6d)]()||undefined;return{'appCode':_0x514c98['appCode'],'startTime':_0x2607f3,'endTime':_0x4c949f,..._0x3832e1===undefined?{'sinceMinutes':readSinceMinutes(_0x514c98)}:{},..._0x5398b6?{'level':_0x5398b6}:{},..._0x2d213d?{'keyword':_0x2d213d}:{},'limit':_0x8498db};}function readSinceMinutes(_0x4fa2d4){const _0x33525d=a42_0x1a71a6;return readPositiveInteger(_0x4fa2d4[_0x33525d(0x81)](_0x33525d(0x8c),DEFAULT_SINCE_MINUTES),'--since');}function readPositiveInteger(_0x950a47,_0x29dbe2){const _0x3ac63b=a42_0x1a71a6;if(!Number[_0x3ac63b(0x70)](_0x950a47)||_0x950a47<=0x0)throw CliErrors['validation'](_0x29dbe2+_0x3ac63b(0x74));return _0x950a47;}function a42_0x292d(_0x2f31e4,_0xfa09f2){_0x2f31e4=_0x2f31e4-0x6b;const _0xf84e42=a42_0xf84e();let _0x292d41=_0xf84e42[_0x2f31e4];return _0x292d41;}export const bffLogs={'service':'bff','command':a42_0x1a71a6(0x89),'description':a42_0x1a71a6(0x85),'risk':a42_0x1a71a6(0x73),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x1a71a6(0x8c),'type':a42_0x1a71a6(0x76),'description':'Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20'+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x1a71a6(0x7c),'type':'number','description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':'end-time','type':'number','description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0x1a71a6(0x8b),'type':a42_0x1a71a6(0x95),'description':a42_0x1a71a6(0x6b),'enum':LOG_LEVELS},{'name':a42_0x1a71a6(0x8d),'type':a42_0x1a71a6(0x95),'description':a42_0x1a71a6(0x94)},{'name':a42_0x1a71a6(0x75),'type':a42_0x1a71a6(0x76),'description':a42_0x1a71a6(0x8e)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x4d8c81){resolveBffLogQuery(_0x4d8c81);},async 'execute'(_0x18dc59){const _0x18d80d=a42_0x1a71a6,_0x392cc4=resolveBffLogQuery(_0x18dc59),{sinceMinutes:_0x1ca7e9,..._0x212a84}=_0x392cc4,_0xf1dcb8=await searchBffScriptLogs(_0x212a84);return{'ok':!![],'data':{'query':_0x392cc4,'count':_0xf1dcb8['length'],'logs':_0xf1dcb8},'message':_0xf1dcb8[_0x18d80d(0x84)]===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':'Found\x20'+_0xf1dcb8['length']+_0x18d80d(0x8f)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x1c3654=a43_0x1da4;(function(_0xa6b30d,_0x34f9b2){const _0xb79229=a43_0x1da4,_0x599d83=_0xa6b30d();while(!![]){try{const _0x261c94=-parseInt(_0xb79229(0x1c2))/0x1+-parseInt(_0xb79229(0x20d))/0x2*(parseInt(_0xb79229(0x1f6))/0x3)+-parseInt(_0xb79229(0x1dd))/0x4+parseInt(_0xb79229(0x1dc))/0x5*(parseInt(_0xb79229(0x1f3))/0x6)+-parseInt(_0xb79229(0x22d))/0x7+-parseInt(_0xb79229(0x22f))/0x8*(-parseInt(_0xb79229(0x1ef))/0x9)+parseInt(_0xb79229(0x256))/0xa;if(_0x261c94===_0x34f9b2)break;else _0x599d83['push'](_0x599d83['shift']());}catch(_0x264225){_0x599d83['push'](_0x599d83['shift']());}}}(a43_0x1f25,0xc23c5));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a43_0x1f25(){const _0x1d1a38=['oldDirectory','apiDir','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','would_pull','normalize','Remote\x20script\x20missing\x20content.','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x22:\x20both\x20target\x20\x22','¤tPage=1&pageSize=','move','\x20Recovery\x20errors:\x20','push_local','functionName','trim','toLowerCase','toISOString','keyChanges','3348415DQBgSq','6099636qdhJgr','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','values','bool','entry','\x22\x20and\x20\x22','\x22\x20may\x20remain.','dev','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','read','conflict','hookLocation','unresolvable\x20target\x20path','split','all','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','ENOENT','\x22\x20from\x20the\x20lock\x20file.','135981aZkkKP','migrations','delete','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','6gwRHuq','NFC','\x20resolution','36888NirMCJ','\x22;\x20temporary\x20directory\x20\x22','mode','selectedAppName','type','\x20failed','ENDPOINT','lockKey','Force\x20overwrite\x20local\x20unsynced\x20changes','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','some','\x20bff\x20push\x20--type\x20','defaultApp','get','.js','case-rename','BFF_LOCAL_UNSYNCED','code','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','HOOK','stderr','filter','requires','220TBHEWe','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','bff','newDirectoryPath','ino','includes','version','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','scriptsRootDir','write','pull','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','join','oldLockKey','\x20conflict','message','\x22:\x20its\x20target\x20\x22','rollback','currentApp','scriptContent','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','lastSync','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','.hook-directory-migrate-','profileName','newLockKey','stdin','COMMON','functionNode','\x22\x20not\x20found\x20after\x20ensureLockScope.','Remote\x20script\x20missing\x20id.','map','2992171MpgknX','string','664IMHxsC','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','oldDirectoryPath','reverse','scriptType','flatMap','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','Pull\x20only\x20this\x20script\x20type','has','datasetCode','Could\x20not\x20restore\x20local\x20script\x20\x22','Would\x20inspect\x20','newDirectory','alias','operationType','functions','filePath','sourceFilePathByNewLockKey','set','/api/management/library/scripts/list?appCode=','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x22\x20to\x20\x22','question','projectedFunctions','cancelled','length','\x22\x20from\x20\x22','hash','lockFilePath','push','GET','content','mergedCli','validation','boolean','parse','str','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','26033800XYQMAo','force','remoteId','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22:\x20','426599NQOILQ','nonInteractive','rekey','Lock\x20scope\x20for\x20app\x20\x22','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x20pulled','&type=','appCode'];a43_0x1f25=function(){return _0x1d1a38;};return a43_0x1f25();}export const bffPull={'service':a43_0x1c3654(0x20f),'command':a43_0x1c3654(0x217),'description':a43_0x1c3654(0x1ec),'risk':a43_0x1c3654(0x1e6),'structuredErrors':!![],'flags':[{'name':a43_0x1c3654(0x1fa),'type':a43_0x1c3654(0x22e),'description':a43_0x1c3654(0x236),'enum':[a43_0x1c3654(0x228),a43_0x1c3654(0x1fc),a43_0x1c3654(0x209)]},{'name':a43_0x1c3654(0x257),'type':a43_0x1c3654(0x251),'description':a43_0x1c3654(0x1fe)}],async 'dryRun'(_0x3d1365){const _0xee76e5=a43_0x1c3654,_0x4b3dad=loadBffProjectConfig(_0x3d1365[_0xee76e5(0x1c9)]),_0x223ad6=await readBffLockFile(_0x4b3dad[_0xee76e5(0x24b)]),{appLock:_0x35d109}=ensureLockScope(_0x223ad6??createEmptyBffLock(),_0x3d1365[_0xee76e5(0x1c9)],_0x4b3dad['scriptsRoot'],'pull'),_0x432768=normalizeBffType(_0x3d1365['str']('type'))??undefined,[_0x2333dd,_0x360a2a]=await Promise['all']([listBffScripts(_0x3d1365['appCode'],_0x432768),getBffScriptStatistics(_0x3d1365[_0xee76e5(0x1c9)])]),_0x2566f7=_0x2333dd['some'](_0x2d88d1=>normalizeBffType(_0x2d88d1[_0xee76e5(0x233)])===_0xee76e5(0x209)),_0x26de0b=_0x2566f7?buildDatasetCodeToAliasMap(_0x3d1365[_0xee76e5(0x1cb)],_0x3d1365['appCode'],_0x3d1365[_0xee76e5(0x1f9)]||_0x3d1365['mergedCli']?.[_0xee76e5(0x21f)]||_0x3d1365[_0xee76e5(0x24f)]?.['defaultApp']):new Map(),_0x40b653=_0x2566f7?await planHookDirectoryMigration(_0x4b3dad,_0x35d109,_0x26de0b,await scanLocalBffFunctions(_0x4b3dad,_0xee76e5(0x209))):undefined,_0x10e7cc=createHookLocationMap(_0x360a2a),_0x3f9aca=[];for(const _0x1e4c0a of _0x2333dd){const _0x380ea6=resolveRemoteScriptTarget(_0x4b3dad,_0x1e4c0a,_0x10e7cc,_0x40b653?.[_0xee76e5(0x246)]??_0x35d109[_0xee76e5(0x23e)],_0x26de0b);if(!_0x380ea6){_0x3f9aca[_0xee76e5(0x24c)]({'scriptType':_0x1e4c0a[_0xee76e5(0x233)],'functionName':_0x1e4c0a[_0xee76e5(0x1d7)]??'','status':'skipped','reason':_0xee76e5(0x1e9)});continue;}const _0x4dbd24=(_0x40b653?.[_0xee76e5(0x246)]??_0x35d109[_0xee76e5(0x23e)])[_0x380ea6[_0xee76e5(0x1fd)]],_0x388f35=_0x1e4c0a[_0xee76e5(0x220)]!=null?computeContentHash(_0x1e4c0a[_0xee76e5(0x220)]):undefined,_0x20c2ff=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x40b653,_0x380ea6)??_0x380ea6['filePath'],_0x4dbd24,_0x388f35),_0x6a53e6=_0x20c2ff?localUnsyncedConflict(_0x380ea6,_0x1e4c0a['id']):undefined;_0x3f9aca[_0xee76e5(0x24c)]({'lockKey':_0x380ea6[_0xee76e5(0x1fd)],'filePath':_0x380ea6[_0xee76e5(0x23f)],'remoteId':_0x1e4c0a['id']??null,'status':_0x6a53e6?_0xee76e5(0x1e7):_0xee76e5(0x1ce),..._0x6a53e6?{'conflict':_0x6a53e6}:{},..._0x380ea6[_0xee76e5(0x1e8)]?{'alias':_0x380ea6[_0xee76e5(0x1e8)]['alias']??null,'datasetCode':_0x380ea6['hookLocation'][_0xee76e5(0x238)],'operationType':_0x380ea6['hookLocation'][_0xee76e5(0x23d)],'functionNode':_0x380ea6[_0xee76e5(0x1e8)][_0xee76e5(0x229)]}:{}});}return{'method':_0xee76e5(0x24d),'url':_0xee76e5(0x242)+_0x3d1365[_0xee76e5(0x1c9)]+(_0x432768?_0xee76e5(0x1c8)+_0x432768:'')+_0xee76e5(0x1d3)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x3d1365[_0xee76e5(0x1c9)],'filterType':_0x432768??null,..._0x40b653&&_0x40b653[_0xee76e5(0x1f0)][_0xee76e5(0x248)]>0x0?{'hookDirectoryMigrations':_0x40b653[_0xee76e5(0x1f0)][_0xee76e5(0x22c)](_0x2ef9ac=>({'from':_0x2ef9ac['oldDirectory'],'to':_0x2ef9ac['newDirectory']}))}:{},'files':_0x3f9aca},'description':_0xee76e5(0x23a)+_0x3f9aca[_0xee76e5(0x248)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4eb194){const _0x1cc277=a43_0x1c3654,_0x32033f=loadBffProjectConfig(_0x4eb194[_0x1cc277(0x1c9)]),_0x40217b=await readBffLockFile(_0x32033f[_0x1cc277(0x24b)]),{lockData:_0x153b87,appLock:_0x15e587}=ensureLockScope(_0x40217b??createEmptyBffLock(),_0x4eb194[_0x1cc277(0x1c9)],_0x32033f['scriptsRoot'],'pull'),_0x5b82bb=normalizeBffType(_0x4eb194['str'](_0x1cc277(0x1fa)))??undefined;if(_0x4eb194[_0x1cc277(0x253)](_0x1cc277(0x1fa))&&!_0x5b82bb)throw CliErrors['validation'](_0x1cc277(0x1de));const [_0x131f44,_0x2f31ac]=await Promise['all']([listBffScripts(_0x4eb194[_0x1cc277(0x1c9)],_0x5b82bb),getBffScriptStatistics(_0x4eb194[_0x1cc277(0x1c9)])]);if(_0x131f44[_0x1cc277(0x248)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x1cc277(0x1d1)};const _0x241196=_0x4eb194[_0x1cc277(0x1e0)]('force');if(_0x241196&&!_0x4eb194[_0x1cc277(0x1c3)]){const _0x3b1a18=await confirmForce();if(!_0x3b1a18)throw CliErrors[_0x1cc277(0x247)]('Force\x20pull\x20cancelled.');}if(_0x241196&&_0x4eb194[_0x1cc277(0x1c3)]){}const _0x2dd2f3=_0x131f44[_0x1cc277(0x200)](_0x343101=>normalizeBffType(_0x343101[_0x1cc277(0x233)])==='HOOK'),_0x12330a=_0x2dd2f3?buildDatasetCodeToAliasMap(_0x4eb194['apiDir'],_0x4eb194['appCode'],_0x4eb194['selectedAppName']||_0x4eb194['mergedCli']?.[_0x1cc277(0x21f)]||_0x4eb194[_0x1cc277(0x24f)]?.[_0x1cc277(0x202)]):new Map(),_0x2f77b5=createHookLocationMap(_0x2f31ac),_0x195a92=JSON[_0x1cc277(0x252)](JSON['stringify'](_0x153b87)),_0xed4686=_0x4eb194[_0x1cc277(0x1c9)],_0x41179b=_0x195a92['apps'][_0xed4686];if(!_0x41179b)throw new Error(_0x1cc277(0x1c5)+_0xed4686+_0x1cc277(0x22a));const _0x305ec5=_0x2dd2f3?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x32033f,_0x41179b,_0x12330a,await scanLocalBffFunctions(_0x32033f,_0x1cc277(0x209))),_0x41179b):undefined,_0x1777a4=createPullFileTransaction(),_0x202215=[],_0x7a9803=[],_0x49804c=[],_0x5ea391=[];for(const _0x4491cc of _0x131f44){const _0x29746c=resolveRemoteScriptTarget(_0x32033f,_0x4491cc,_0x2f77b5,_0x41179b['functions'],_0x12330a);if(!_0x29746c){_0x7a9803[_0x1cc277(0x24c)]({'lockKey':_0x4491cc[_0x1cc277(0x233)]+'/'+_0x4491cc[_0x1cc277(0x1d7)],'reason':'unresolvable\x20target\x20path'});continue;}const _0x231d23=_0x41179b[_0x1cc277(0x23e)][_0x29746c[_0x1cc277(0x1fd)]];try{if(!_0x4491cc['id'])throw new Error(_0x1cc277(0x22b));if(_0x4491cc[_0x1cc277(0x220)]==null)throw new Error(_0x1cc277(0x1d0));const _0x5be011=_0x4491cc[_0x1cc277(0x220)],_0x726622=computeContentHash(_0x5be011);if(!_0x241196){const _0x208fcd=await hasUnsyncedLocalChanges(_0x29746c[_0x1cc277(0x23f)],_0x231d23,_0x726622);if(_0x208fcd){_0x49804c['push'](localUnsyncedConflict(_0x29746c,_0x4491cc['id']));continue;}}await _0x1777a4[_0x1cc277(0x216)](_0x29746c[_0x1cc277(0x23f)],_0x5be011);const _0x35b62e={'hash':_0x726622,'remoteId':_0x4491cc['id'],'version':_0x4491cc[_0x1cc277(0x213)]};_0x29746c[_0x1cc277(0x1fa)]===_0x1cc277(0x209)&&_0x29746c['hookLocation']&&(_0x35b62e[_0x1cc277(0x23c)]=_0x29746c[_0x1cc277(0x1e8)][_0x1cc277(0x23c)],_0x35b62e[_0x1cc277(0x238)]=_0x29746c[_0x1cc277(0x1e8)]['datasetCode'],_0x35b62e['operationType']=_0x29746c[_0x1cc277(0x1e8)][_0x1cc277(0x23d)],_0x35b62e[_0x1cc277(0x229)]=_0x29746c[_0x1cc277(0x1e8)][_0x1cc277(0x229)]),_0x41179b[_0x1cc277(0x23e)][_0x29746c[_0x1cc277(0x1fd)]]=_0x35b62e,_0x202215[_0x1cc277(0x24c)]({'lockKey':_0x29746c[_0x1cc277(0x1fd)],'remoteId':_0x4491cc['id']});}catch(_0x1b8448){_0x5ea391[_0x1cc277(0x24c)]({'lockKey':_0x29746c['lockKey'],'error':_0x1b8448 instanceof Error?_0x1b8448[_0x1cc277(0x21c)]:String(_0x1b8448)});}}_0x41179b['lastSync']=new Date()[_0x1cc277(0x1da)]();try{await writeBffLockFile(_0x32033f[_0x1cc277(0x24b)],_0x195a92);}catch(_0x5533be){const _0x564fb9=[...await _0x1777a4[_0x1cc277(0x21e)](),...await _0x305ec5?.[_0x1cc277(0x21e)]()??[]];throw withRollbackErrors(_0x5533be,_0x1cc277(0x208),_0x564fb9);}return{'ok':_0x5ea391[_0x1cc277(0x248)]===0x0,'data':{'pulled':_0x202215,'skipped':_0x7a9803,'conflicts':_0x49804c,'failed':_0x5ea391},'message':formatPullMessage(_0x202215[_0x1cc277(0x248)],_0x7a9803[_0x1cc277(0x248)],_0x49804c['length'],_0x5ea391[_0x1cc277(0x248)])};}};function localUnsyncedConflict(_0x13f490,_0x40841c){const _0x539297=a43_0x1c3654,_0x138aac=_0x13f490[_0x539297(0x1fd)]['split']('/')['at'](-0x1);return{'code':_0x539297(0x206),'lockKey':_0x13f490[_0x539297(0x1fd)],'filePath':_0x13f490[_0x539297(0x23f)],..._0x40841c!=null?{'remoteId':_0x40841c}:{},'message':_0x539297(0x218),'nextAction':{'action':_0x539297(0x1d6),'command':CLI_BIN_NAME+_0x539297(0x201)+_0x13f490[_0x539297(0x1fa)]+'\x20--name\x20'+_0x138aac+'\x20--format\x20compress','requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function a43_0x1da4(_0x334c1c,_0x133499){_0x334c1c=_0x334c1c-0x1c2;const _0x1f253b=a43_0x1f25();let _0x1da4f3=_0x1f253b[_0x334c1c];return _0x1da4f3;}function formatPullMessage(_0x46dd15,_0x2500d1,_0x531d6a,_0x3a18d4){const _0x4ce93d=a43_0x1c3654,_0x1202ec=['Pull\x20complete:\x20'+_0x46dd15+_0x4ce93d(0x1c7),_0x2500d1+'\x20skipped'];_0x531d6a>0x0&&_0x1202ec['push'](_0x531d6a+_0x4ce93d(0x21b)+(_0x531d6a===0x1?'':'s')+'\x20'+(_0x531d6a===0x1?_0x4ce93d(0x20c):'require')+_0x4ce93d(0x1f5));if(_0x3a18d4>0x0)_0x1202ec[_0x4ce93d(0x24c)](_0x3a18d4+_0x4ce93d(0x1fb));return _0x1202ec[_0x4ce93d(0x219)](',\x20');}async function hasUnsyncedLocalChanges(_0x497ec8,_0x96ac7c,_0x1f7693){const _0x544482=a43_0x1c3654;if(!await fileExists(_0x497ec8))return![];const _0x3892eb=await computeFileHash(_0x497ec8);if(!_0x96ac7c)return _0x1f7693?_0x3892eb!==_0x1f7693:!![];return _0x3892eb!==_0x96ac7c[_0x544482(0x24a)];}function createPullFileTransaction(){const _0x5b58fd=new Map(),_0x94881e=async(_0x42b64e,_0x3b5e2c)=>{const _0x4dbb05=a43_0x1da4;try{if(_0x3b5e2c['existed'])await ensureParentDirectory(_0x42b64e),await writeFile(_0x42b64e,_0x3b5e2c[_0x4dbb05(0x24e)]);else try{await unlink(_0x42b64e);}catch(_0x17beeb){if(_0x17beeb['code']!=='ENOENT')throw _0x17beeb;}return undefined;}catch(_0x596a7d){return _0x596a7d instanceof Error?_0x596a7d:new Error(String(_0x596a7d));}};return{async 'write'(_0x3382a2,_0x1f8241){const _0x1410f3=a43_0x1da4;if(!_0x5b58fd['has'](_0x3382a2))try{_0x5b58fd[_0x1410f3(0x241)](_0x3382a2,{'existed':!![],'content':await readFile(_0x3382a2)});}catch(_0x4b54db){if(_0x4b54db[_0x1410f3(0x207)]!==_0x1410f3(0x1ed))throw _0x4b54db;_0x5b58fd['set'](_0x3382a2,{'existed':![]});}try{await ensureParentDirectory(_0x3382a2),await writeFile(_0x3382a2,_0x1f8241,'utf8');}catch(_0x318824){const _0x13fede=await _0x94881e(_0x3382a2,_0x5b58fd[_0x1410f3(0x203)](_0x3382a2));if(!_0x13fede)_0x5b58fd[_0x1410f3(0x1f1)](_0x3382a2);throw withRollbackErrors(_0x318824,'Failed\x20to\x20write\x20local\x20script\x20\x22'+_0x3382a2+'\x22.',_0x13fede?[_0x13fede]:[]);}},async 'rollback'(){const _0x1167e8=a43_0x1da4,_0x25727b=[];for(const [_0x443352,_0x2a1fcd]of[..._0x5b58fd['entries']()][_0x1167e8(0x232)]()){const _0x2b83ac=await _0x94881e(_0x443352,_0x2a1fcd);_0x2b83ac&&_0x25727b['push'](new Error(_0x1167e8(0x239)+_0x443352+_0x1167e8(0x25b)+_0x2b83ac[_0x1167e8(0x21c)]));}return _0x25727b;}};}function withRollbackErrors(_0x3481fb,_0x4a268f,_0x502801){const _0x4c9716=a43_0x1c3654,_0x200090=_0x3481fb instanceof Error?_0x3481fb:new Error(String(_0x3481fb));if(_0x502801[_0x4c9716(0x248)]===0x0)return _0x200090;return new AggregateError([_0x200090,..._0x502801],_0x4a268f+_0x4c9716(0x1d5)+_0x502801[_0x4c9716(0x22c)](_0x5a0e90=>_0x5a0e90[_0x4c9716(0x21c)])[_0x4c9716(0x219)](';\x20'));}function buildDatasetCodeToAliasMap(_0x13a4d1,_0xb4003,_0x10aed5){const _0x3043f9=a43_0x1c3654,_0x465c62=resolveApiModelSource(_0x13a4d1,_0xb4003,_0x10aed5),_0x323a62=loadAliasMap(_0x13a4d1,undefined,_0x465c62[_0x3043f9(0x23f)],_0x465c62[_0x3043f9(0x225)]);return assertUnambiguousHookAliases(_0x323a62),new Map(_0x323a62[_0x3043f9(0x22c)](_0xe07cb=>[_0xe07cb[_0x3043f9(0x238)][_0x3043f9(0x1d9)](),_0xe07cb['alias']]));}async function planHookDirectoryMigration(_0x1c5cc3,_0x129f6c,_0xdf2ad3,_0xac8e8a){const _0x693d1f=a43_0x1c3654,_0x57dc20=new Map();for(const [_0x14e4e0,_0x26c282]of Object['entries'](_0x129f6c['functions'])){const [_0x55bd18,_0x19a866,_0x10b64e,_0x13554a,_0x1843fe,..._0x1a19ad]=_0x14e4e0[_0x693d1f(0x1ea)]('/');if(_0x55bd18!==_0x693d1f(0x209)||!_0x19a866||!_0x10b64e||!_0x13554a||!_0x1843fe||_0x1a19ad[_0x693d1f(0x248)]>0x0||!_0x26c282[_0x693d1f(0x238)])continue;const _0x55c374=_0xdf2ad3[_0x693d1f(0x203)](_0x26c282[_0x693d1f(0x238)][_0x693d1f(0x1d9)]()),_0x1294db=_0x55c374??_0x26c282[_0x693d1f(0x238)];if(!isSafeHookDirectorySegment(_0x19a866))throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x254)+_0x19a866+_0x693d1f(0x1ee));if(!isSafeHookDirectorySegment(_0x1294db))throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x1c6)+_0x19a866+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x19a866===_0x1294db)continue;const _0x497d47=_0x57dc20[_0x693d1f(0x203)](_0x19a866)??{'datasetCode':_0x26c282[_0x693d1f(0x238)],'alias':_0x55c374,'keyChanges':[]};if(_0x497d47[_0x693d1f(0x238)]!==_0x26c282['datasetCode'])throw CliErrors[_0x693d1f(0x250)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x19a866+_0x693d1f(0x214));const _0xda0eb9='HOOK/'+_0x1294db+'/'+_0x10b64e+'/'+_0x13554a+'/'+_0x1843fe;try{resolveLocalFilePathFromLockKey(_0x1c5cc3,_0x14e4e0),resolveLocalFilePathFromLockKey(_0x1c5cc3,_0xda0eb9);}catch(_0x34e0cb){throw CliErrors['validation'](_0x693d1f(0x1cc)+_0x14e4e0+'\x22:\x20'+(_0x34e0cb instanceof Error?_0x34e0cb[_0x693d1f(0x21c)]:String(_0x34e0cb)));}_0x497d47[_0x693d1f(0x1db)][_0x693d1f(0x24c)]({'oldLockKey':_0x14e4e0,'newLockKey':_0xda0eb9,'entry':_0x26c282}),_0x57dc20[_0x693d1f(0x241)](_0x19a866,_0x497d47);}const _0x4efd39=new Set([..._0x57dc20[_0x693d1f(0x1df)]()][_0x693d1f(0x234)](_0x588f8f=>_0x588f8f[_0x693d1f(0x1db)][_0x693d1f(0x22c)](_0x2c2cde=>_0x2c2cde[_0x693d1f(0x21a)]))),_0x4973fc=new Map(),_0x2cd365=new Map();for(const [_0x55dc5d,_0x50cb5]of _0x57dc20){const _0x2ccd1e=_0x50cb5[_0x693d1f(0x23c)]??_0x50cb5['datasetCode'],_0x4320b1=hookDirectoryIdentity(_0x2ccd1e),_0x4162b8=_0x4973fc[_0x693d1f(0x203)](_0x4320b1);if(_0x4162b8&&_0x4162b8!==_0x55dc5d)throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x235)+_0x4162b8+_0x693d1f(0x1e2)+_0x55dc5d+_0x693d1f(0x1d2)+_0x2ccd1e+_0x693d1f(0x1ff));_0x4973fc['set'](_0x4320b1,_0x55dc5d);for(const _0x326ba2 of _0x50cb5[_0x693d1f(0x1db)]){const _0x52fcbb=_0x2cd365[_0x693d1f(0x203)](_0x326ba2[_0x693d1f(0x226)]);if(_0x52fcbb&&_0x52fcbb!==_0x326ba2[_0x693d1f(0x21a)])throw CliErrors['validation'](_0x693d1f(0x223)+_0x52fcbb+_0x693d1f(0x1e2)+_0x326ba2[_0x693d1f(0x21a)]+_0x693d1f(0x1d2)+_0x326ba2[_0x693d1f(0x226)]+_0x693d1f(0x1e5));if(_0x4efd39['has'](_0x326ba2[_0x693d1f(0x226)]))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x326ba2['oldLockKey']+_0x693d1f(0x21d)+_0x326ba2[_0x693d1f(0x226)]+_0x693d1f(0x1cd));_0x2cd365['set'](_0x326ba2[_0x693d1f(0x226)],_0x326ba2[_0x693d1f(0x21a)]);}}const _0x276c57=new Map();for(const [_0x414a7b,_0x355289]of _0xdf2ad3){_0x276c57['set'](hookDirectoryIdentity(_0x355289),_0x414a7b);}const _0x240b44=[];for(const [_0x401da0,_0x3b71b4]of _0x57dc20){const _0x1f8dd2=_0x3b71b4['alias']??_0x3b71b4['datasetCode'],_0x2487e9=join(_0x1c5cc3[_0x693d1f(0x215)],'HOOK',_0x401da0),_0x15cf01=join(_0x1c5cc3[_0x693d1f(0x215)],_0x693d1f(0x209),_0x1f8dd2),_0xec51cc=await directoryExists(_0x2487e9),_0x3618a5=await directoryExists(_0x15cf01),_0x2bf801=_0xec51cc?_0x3618a5?await sameDirectory(_0x2487e9,_0x15cf01)?_0x693d1f(0x205):undefined:_0x693d1f(0x1d4):_0x693d1f(0x1c4);if(!_0x2bf801)throw CliErrors['validation'](_0x693d1f(0x1c6)+_0x401da0+_0x693d1f(0x244)+_0x1f8dd2+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x1a031b=_0x276c57[_0x693d1f(0x203)](hookDirectoryIdentity(_0x401da0));if(_0x1a031b&&_0x1a031b!==_0x3b71b4[_0x693d1f(0x238)][_0x693d1f(0x1d9)]()){const _0xeb6e78=new Set(_0x3b71b4[_0x693d1f(0x1db)][_0x693d1f(0x22c)](_0x191bcd=>_0x191bcd[_0x693d1f(0x21a)])),_0x2beabe=_0xac8e8a[_0x693d1f(0x20b)](_0x2d38ad=>_0x2d38ad['type']==='HOOK'&&_0x2d38ad[_0x693d1f(0x23c)]!=null&&hookDirectoryIdentity(_0x2d38ad[_0x693d1f(0x23c)])===hookDirectoryIdentity(_0x401da0)&&!_0xeb6e78[_0x693d1f(0x237)](_0x2d38ad['lockKey']));if(_0x2beabe['length']>0x0)throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x1c6)+_0x401da0+_0x693d1f(0x230));}const _0x453822=_0x276c57[_0x693d1f(0x203)](hookDirectoryIdentity(_0x1f8dd2));if(_0x453822&&_0x453822!==_0x3b71b4[_0x693d1f(0x238)][_0x693d1f(0x1d9)]())throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x1c6)+_0x401da0+_0x693d1f(0x244)+_0x1f8dd2+_0x693d1f(0x259));for(const _0x4016e1 of _0x3b71b4['keyChanges']){const _0x13aeec=_0x129f6c[_0x693d1f(0x23e)][_0x4016e1[_0x693d1f(0x226)]];if(_0x13aeec&&!_0x4efd39[_0x693d1f(0x237)](_0x4016e1[_0x693d1f(0x226)])&&!sameHookIdentity(_0x4016e1['entry'],_0x13aeec))throw CliErrors[_0x693d1f(0x250)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x401da0+_0x693d1f(0x244)+_0x1f8dd2+_0x693d1f(0x221));}_0x240b44[_0x693d1f(0x24c)]({'oldDirectory':_0x401da0,'newDirectory':_0x1f8dd2,'oldDirectoryPath':_0x2487e9,'newDirectoryPath':_0x15cf01,'mode':_0x2bf801,'alias':_0x3b71b4[_0x693d1f(0x23c)],'keyChanges':_0x3b71b4[_0x693d1f(0x1db)]});}const _0x191e04={..._0x129f6c['functions']},_0x3f6b21=new Map(),_0x83a8ce=new Map();for(const _0x51e971 of _0x240b44){const _0x38e0c7=_0x51e971[_0x693d1f(0x1f8)]!==_0x693d1f(0x1c4);_0x38e0c7&&_0x83a8ce[_0x693d1f(0x241)](hookDirectoryIdentity(_0x51e971[_0x693d1f(0x23b)]),_0x51e971[_0x693d1f(0x231)]);for(const _0x4a433f of _0x51e971[_0x693d1f(0x1db)]){const _0x189ffb=_0x191e04[_0x4a433f[_0x693d1f(0x226)]],_0x31e357=_0x38e0c7?_0x4a433f[_0x693d1f(0x1e1)]:_0x189ffb??_0x4a433f['entry'];_0x191e04[_0x4a433f[_0x693d1f(0x226)]]=canonicalizeHookEntry(_0x31e357,_0x51e971['alias']),delete _0x191e04[_0x4a433f[_0x693d1f(0x21a)]],_0x38e0c7&&_0x3f6b21[_0x693d1f(0x241)](_0x4a433f[_0x693d1f(0x226)],resolveLocalFilePathFromLockKey(_0x1c5cc3,_0x4a433f[_0x693d1f(0x21a)]));}}return{'migrations':_0x240b44,'projectedFunctions':_0x191e04,'sourceFilePathByNewLockKey':_0x3f6b21,'sourceDirectoryPathByNewDirectory':_0x83a8ce};}function resolveMigratedSourceFilePath(_0x1d48d1,_0x39aa7a){const _0x646ca7=a43_0x1c3654;if(!_0x1d48d1||!_0x39aa7a)return undefined;const _0x131232=_0x1d48d1[_0x646ca7(0x240)][_0x646ca7(0x203)](_0x39aa7a['lockKey']);if(_0x131232)return _0x131232;if(_0x39aa7a[_0x646ca7(0x1fa)]!==_0x646ca7(0x209))return undefined;const [,_0x592dd0,..._0x4b22ec]=_0x39aa7a[_0x646ca7(0x1fd)][_0x646ca7(0x1ea)]('/');if(!_0x592dd0||_0x4b22ec[_0x646ca7(0x248)]===0x0)return undefined;const _0x408565=_0x1d48d1['sourceDirectoryPathByNewDirectory'][_0x646ca7(0x203)](hookDirectoryIdentity(_0x592dd0));return _0x408565?join(_0x408565,..._0x4b22ec)+_0x646ca7(0x204):undefined;}function sameHookIdentity(_0x47f1b0,_0x519dda){const _0x1e42fb=a43_0x1c3654;return _0x47f1b0[_0x1e42fb(0x258)]===_0x519dda[_0x1e42fb(0x258)]&&_0x47f1b0[_0x1e42fb(0x238)]===_0x519dda[_0x1e42fb(0x238)]&&_0x47f1b0[_0x1e42fb(0x23d)]===_0x519dda[_0x1e42fb(0x23d)]&&_0x47f1b0[_0x1e42fb(0x229)]===_0x519dda['functionNode'];}function canonicalizeHookEntry(_0x1a61cd,_0x2b800b){const {alias:_0x43a919,..._0x120375}=_0x1a61cd;return _0x2b800b?{..._0x120375,'alias':_0x2b800b}:_0x120375;}function hookDirectoryIdentity(_0x338dff){const _0x1ce4c8=a43_0x1c3654;return _0x338dff[_0x1ce4c8(0x1cf)](_0x1ce4c8(0x1f4))['toLowerCase']();}function isSafeHookDirectorySegment(_0x324c96){return isSafeLockKeySegment(_0x324c96);}async function sameDirectory(_0x1f6fbf,_0x4891a4){const _0x22f76b=a43_0x1c3654,[_0x1625d9,_0x35960f]=await Promise[_0x22f76b(0x1eb)]([stat(_0x1f6fbf),stat(_0x4891a4)]);return _0x1625d9[_0x22f76b(0x1e4)]===_0x35960f[_0x22f76b(0x1e4)]&&_0x1625d9['ino']===_0x35960f[_0x22f76b(0x211)];}async function applyHookDirectoryMigration(_0x1cba2e,_0x88163b){const _0x488e6a=a43_0x1c3654,_0x42ce40=_0x88163b['functions'],_0x5b6780=_0x88163b[_0x488e6a(0x222)],_0x291646=[],_0xc4ab7c=async()=>{const _0x15f89d=_0x488e6a,_0x3fca0c=[];_0x88163b[_0x15f89d(0x23e)]=_0x42ce40,_0x88163b[_0x15f89d(0x222)]=_0x5b6780;for(const {migration:_0x1a658d,temporaryPath:_0x2dae7b}of[..._0x291646][_0x15f89d(0x232)]()){try{_0x2dae7b?(await rename(_0x1a658d['newDirectoryPath'],_0x2dae7b),await rename(_0x2dae7b,_0x1a658d['oldDirectoryPath'])):await rename(_0x1a658d['newDirectoryPath'],_0x1a658d[_0x15f89d(0x231)]);}catch(_0x45e6be){_0x3fca0c[_0x15f89d(0x24c)](new Error(_0x15f89d(0x20e)+_0x1a658d[_0x15f89d(0x1ca)]+_0x15f89d(0x249)+_0x1a658d['newDirectory']+'\x22:\x20'+(_0x45e6be instanceof Error?_0x45e6be[_0x15f89d(0x21c)]:String(_0x45e6be))));}}return _0x3fca0c;};try{for(const _0x2dc727 of _0x1cba2e['migrations']){if(_0x2dc727[_0x488e6a(0x1f8)]===_0x488e6a(0x1d4))await ensureParentDirectory(_0x2dc727['newDirectoryPath']),await rename(_0x2dc727[_0x488e6a(0x231)],_0x2dc727[_0x488e6a(0x210)]),_0x291646[_0x488e6a(0x24c)]({'migration':_0x2dc727});else{if(_0x2dc727[_0x488e6a(0x1f8)]===_0x488e6a(0x205)){const _0x484d07=join(dirname(_0x2dc727[_0x488e6a(0x231)]),_0x488e6a(0x224)+randomUUID());await rename(_0x2dc727[_0x488e6a(0x231)],_0x484d07);try{await rename(_0x484d07,_0x2dc727[_0x488e6a(0x210)]);}catch(_0x191ed4){try{await rename(_0x484d07,_0x2dc727[_0x488e6a(0x231)]);}catch(_0x5c4c79){throw withRollbackErrors(_0x191ed4,_0x488e6a(0x255)+_0x2dc727[_0x488e6a(0x1ca)]+_0x488e6a(0x244)+_0x2dc727[_0x488e6a(0x23b)]+_0x488e6a(0x1f7)+_0x484d07+_0x488e6a(0x1e3),[new Error(_0x488e6a(0x25a)+_0x484d07+'\x22\x20to\x20\x22'+_0x2dc727['oldDirectory']+_0x488e6a(0x25b)+(_0x5c4c79 instanceof Error?_0x5c4c79[_0x488e6a(0x21c)]:String(_0x5c4c79)))]);}throw _0x191ed4;}_0x291646[_0x488e6a(0x24c)]({'migration':_0x2dc727,'temporaryPath':_0x484d07});}}}return _0x88163b[_0x488e6a(0x23e)]=_0x1cba2e[_0x488e6a(0x246)],{'rollback':_0xc4ab7c};}catch(_0x425b69){const _0x2fc7a7=await _0xc4ab7c();throw withRollbackErrors(_0x425b69,_0x488e6a(0x243),_0x2fc7a7);}}async function confirmForce(){const _0x458b1f=a43_0x1c3654,_0x42b064=createInterface({'input':process[_0x458b1f(0x227)],'output':process[_0x458b1f(0x20a)]}),_0x57188b=await new Promise(_0x53a7ad=>{const _0x4d2f79=_0x458b1f;_0x42b064[_0x4d2f79(0x245)](_0x4d2f79(0x1f2),_0x53a7ad);});return _0x42b064['close'](),['y','yes'][_0x458b1f(0x212)](_0x57188b[_0x458b1f(0x1d8)]()['toLowerCase']());}
|
|
1
|
+
const a43_0x24931b=a43_0x1c53;(function(_0x345143,_0x2024df){const _0x3a77d7=a43_0x1c53,_0xbabe16=_0x345143();while(!![]){try{const _0x2f54d8=parseInt(_0x3a77d7(0x150))/0x1+parseInt(_0x3a77d7(0x154))/0x2+parseInt(_0x3a77d7(0x134))/0x3*(-parseInt(_0x3a77d7(0x14f))/0x4)+parseInt(_0x3a77d7(0x14e))/0x5*(-parseInt(_0x3a77d7(0x192))/0x6)+parseInt(_0x3a77d7(0x184))/0x7+parseInt(_0x3a77d7(0x13d))/0x8*(-parseInt(_0x3a77d7(0x17a))/0x9)+parseInt(_0x3a77d7(0x1a4))/0xa*(parseInt(_0x3a77d7(0x1b1))/0xb);if(_0x2f54d8===_0x2024df)break;else _0xbabe16['push'](_0xbabe16['shift']());}catch(_0x2c8005){_0xbabe16['push'](_0xbabe16['shift']());}}}(a43_0x3d31,0xd5357));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':a43_0x24931b(0x173),'description':a43_0x24931b(0x17d),'risk':a43_0x24931b(0x18e),'structuredErrors':!![],'flags':[{'name':'type','type':a43_0x24931b(0x13a),'description':a43_0x24931b(0x15c),'enum':[a43_0x24931b(0x199),a43_0x24931b(0x1be),'HOOK']},{'name':'force','type':a43_0x24931b(0x151),'description':a43_0x24931b(0x1c3)}],async 'dryRun'(_0x11fc01){const _0x2ae861=a43_0x24931b,_0x400bbc=loadBffProjectConfig(_0x11fc01[_0x2ae861(0x158)]),_0x3b79cd=await readBffLockFile(_0x400bbc[_0x2ae861(0x18f)]),{appLock:_0xb2bc6a}=ensureLockScope(_0x3b79cd??createEmptyBffLock(),_0x11fc01[_0x2ae861(0x158)],_0x400bbc[_0x2ae861(0x1b5)],_0x2ae861(0x173)),_0x4dfc5c=normalizeBffType(_0x11fc01[_0x2ae861(0x12e)]('type'))??undefined,[_0x41ae8f,_0x521fc0]=await Promise['all']([listBffScripts(_0x11fc01['appCode'],_0x4dfc5c),getBffScriptStatistics(_0x11fc01[_0x2ae861(0x158)])]),_0x3153dd=_0x41ae8f[_0x2ae861(0x196)](_0x34a9a6=>normalizeBffType(_0x34a9a6['scriptType'])===_0x2ae861(0x178)),_0x3c962f=_0x3153dd?buildDatasetCodeToAliasMap(_0x11fc01[_0x2ae861(0x182)],_0x11fc01['appCode'],_0x11fc01[_0x2ae861(0x191)]||_0x11fc01['mergedCli']?.['currentApp']||_0x11fc01[_0x2ae861(0x185)]?.[_0x2ae861(0x16b)]):new Map(),_0x392d57=_0x3153dd?await planHookDirectoryMigration(_0x400bbc,_0xb2bc6a,_0x3c962f,await scanLocalBffFunctions(_0x400bbc,_0x2ae861(0x178))):undefined,_0x1b4fbe=createHookLocationMap(_0x521fc0),_0xc8d4c5=[];for(const _0x4fb349 of _0x41ae8f){const _0x3ddd63=resolveRemoteScriptTarget(_0x400bbc,_0x4fb349,_0x1b4fbe,_0x392d57?.[_0x2ae861(0x1b7)]??_0xb2bc6a[_0x2ae861(0x1c2)],_0x3c962f);if(!_0x3ddd63){_0xc8d4c5[_0x2ae861(0x15b)]({'scriptType':_0x4fb349[_0x2ae861(0x15e)],'functionName':_0x4fb349['functionName']??'','status':_0x2ae861(0x1af),'reason':_0x2ae861(0x1bd)});continue;}const _0x34f395=(_0x392d57?.['projectedFunctions']??_0xb2bc6a[_0x2ae861(0x1c2)])[_0x3ddd63[_0x2ae861(0x19a)]],_0x995a18=_0x4fb349[_0x2ae861(0x161)]!=null?computeContentHash(_0x4fb349[_0x2ae861(0x161)]):undefined,_0x1bbd13=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x392d57,_0x3ddd63)??_0x3ddd63['filePath'],_0x34f395,_0x995a18),_0x46151d=_0x1bbd13?localUnsyncedConflict(_0x3ddd63,_0x4fb349['id']):undefined;_0xc8d4c5['push']({'lockKey':_0x3ddd63[_0x2ae861(0x19a)],'filePath':_0x3ddd63['filePath'],'remoteId':_0x4fb349['id']??null,'status':_0x46151d?_0x2ae861(0x145):_0x2ae861(0x130),..._0x46151d?{'conflict':_0x46151d}:{},..._0x3ddd63[_0x2ae861(0x136)]?{'alias':_0x3ddd63[_0x2ae861(0x136)][_0x2ae861(0x15a)]??null,'datasetCode':_0x3ddd63[_0x2ae861(0x136)][_0x2ae861(0x1a7)],'operationType':_0x3ddd63[_0x2ae861(0x136)][_0x2ae861(0x140)],'functionNode':_0x3ddd63[_0x2ae861(0x136)]['functionNode']}:{}});}return{'method':_0x2ae861(0x1b4),'url':_0x2ae861(0x13c)+_0x11fc01[_0x2ae861(0x158)]+(_0x4dfc5c?'&type='+_0x4dfc5c:'')+_0x2ae861(0x146)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x11fc01[_0x2ae861(0x158)],'filterType':_0x4dfc5c??null,..._0x392d57&&_0x392d57[_0x2ae861(0x1c1)][_0x2ae861(0x1a8)]>0x0?{'hookDirectoryMigrations':_0x392d57[_0x2ae861(0x1c1)][_0x2ae861(0x155)](_0x2915b7=>({'from':_0x2915b7[_0x2ae861(0x17e)],'to':_0x2915b7[_0x2ae861(0x177)]}))}:{},'files':_0xc8d4c5},'description':_0x2ae861(0x17c)+_0xc8d4c5[_0x2ae861(0x1a8)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x2e7ee5){const _0x31cf21=a43_0x24931b,_0x4d07d5=loadBffProjectConfig(_0x2e7ee5[_0x31cf21(0x158)]),_0x659386=await readBffLockFile(_0x4d07d5[_0x31cf21(0x18f)]),{lockData:_0x1aecd1,appLock:_0x451733}=ensureLockScope(_0x659386??createEmptyBffLock(),_0x2e7ee5[_0x31cf21(0x158)],_0x4d07d5[_0x31cf21(0x1b5)],_0x31cf21(0x173)),_0xe6221=normalizeBffType(_0x2e7ee5[_0x31cf21(0x12e)](_0x31cf21(0x1a2)))??undefined;if(_0x2e7ee5[_0x31cf21(0x12e)](_0x31cf21(0x1a2))&&!_0xe6221)throw CliErrors[_0x31cf21(0x1b3)](_0x31cf21(0x179));const [_0x2a0a4f,_0x53f432]=await Promise[_0x31cf21(0x16d)]([listBffScripts(_0x2e7ee5['appCode'],_0xe6221),getBffScriptStatistics(_0x2e7ee5[_0x31cf21(0x158)])]);if(_0x2a0a4f['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x31cf21(0x143)};const _0x120c69=_0x2e7ee5[_0x31cf21(0x19b)](_0x31cf21(0x1a0));if(_0x120c69&&!_0x2e7ee5['nonInteractive']){const _0x504c69=await confirmForce();if(!_0x504c69)throw CliErrors[_0x31cf21(0x166)]('Force\x20pull\x20cancelled.');}if(_0x120c69&&_0x2e7ee5['nonInteractive']){}const _0x5bf8f5=_0x2a0a4f[_0x31cf21(0x196)](_0x3e140f=>normalizeBffType(_0x3e140f[_0x31cf21(0x15e)])===_0x31cf21(0x178)),_0x470dce=_0x5bf8f5?buildDatasetCodeToAliasMap(_0x2e7ee5[_0x31cf21(0x182)],_0x2e7ee5['appCode'],_0x2e7ee5['selectedAppName']||_0x2e7ee5[_0x31cf21(0x185)]?.[_0x31cf21(0x1aa)]||_0x2e7ee5['mergedCli']?.[_0x31cf21(0x16b)]):new Map(),_0x3bd529=createHookLocationMap(_0x53f432),_0x9fd600=JSON[_0x31cf21(0x162)](JSON[_0x31cf21(0x14b)](_0x1aecd1)),_0x2fc625=_0x2e7ee5['appCode'],_0x33d4a1=_0x9fd600['apps'][_0x2fc625];if(!_0x33d4a1)throw new Error(_0x31cf21(0x171)+_0x2fc625+_0x31cf21(0x157));const _0x1d2e24=_0x5bf8f5?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4d07d5,_0x33d4a1,_0x470dce,await scanLocalBffFunctions(_0x4d07d5,_0x31cf21(0x178))),_0x33d4a1):undefined,_0xe0299c=createPullFileTransaction(),_0xbfc9f3=[],_0xe69fcb=[],_0x54ff2a=[],_0x5c14aa=[];for(const _0x356bfb of _0x2a0a4f){const _0x19e0cd=resolveRemoteScriptTarget(_0x4d07d5,_0x356bfb,_0x3bd529,_0x33d4a1['functions'],_0x470dce);if(!_0x19e0cd){_0xe69fcb[_0x31cf21(0x15b)]({'lockKey':_0x356bfb[_0x31cf21(0x15e)]+'/'+_0x356bfb['functionName'],'reason':_0x31cf21(0x1bd)});continue;}const _0x5b38ba=_0x33d4a1['functions'][_0x19e0cd[_0x31cf21(0x19a)]];try{if(!_0x356bfb['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x356bfb[_0x31cf21(0x161)]==null)throw new Error(_0x31cf21(0x1b2));const _0x4fac7c=_0x356bfb['scriptContent'],_0x3e6cf8=computeContentHash(_0x4fac7c);if(!_0x120c69){const _0x2a99b4=await hasUnsyncedLocalChanges(_0x19e0cd[_0x31cf21(0x1a3)],_0x5b38ba,_0x3e6cf8);if(_0x2a99b4){_0x54ff2a[_0x31cf21(0x15b)](localUnsyncedConflict(_0x19e0cd,_0x356bfb['id']));continue;}}await _0xe0299c['write'](_0x19e0cd[_0x31cf21(0x1a3)],_0x4fac7c);const _0x39f943={'hash':_0x3e6cf8,'remoteId':_0x356bfb['id'],'version':_0x356bfb[_0x31cf21(0x167)]};_0x19e0cd['type']===_0x31cf21(0x178)&&_0x19e0cd['hookLocation']&&(_0x39f943[_0x31cf21(0x15a)]=_0x19e0cd[_0x31cf21(0x136)]['alias'],_0x39f943[_0x31cf21(0x1a7)]=_0x19e0cd[_0x31cf21(0x136)][_0x31cf21(0x1a7)],_0x39f943[_0x31cf21(0x140)]=_0x19e0cd[_0x31cf21(0x136)][_0x31cf21(0x140)],_0x39f943['functionNode']=_0x19e0cd[_0x31cf21(0x136)][_0x31cf21(0x18b)]),_0x33d4a1[_0x31cf21(0x1c2)][_0x19e0cd['lockKey']]=_0x39f943,_0xbfc9f3[_0x31cf21(0x15b)]({'lockKey':_0x19e0cd[_0x31cf21(0x19a)],'remoteId':_0x356bfb['id']});}catch(_0x2b96a9){_0x5c14aa[_0x31cf21(0x15b)]({'lockKey':_0x19e0cd[_0x31cf21(0x19a)],'error':_0x2b96a9 instanceof Error?_0x2b96a9[_0x31cf21(0x144)]:String(_0x2b96a9)});}}_0x33d4a1[_0x31cf21(0x12f)]=new Date()[_0x31cf21(0x149)]();try{await writeBffLockFile(_0x4d07d5['lockFilePath'],_0x9fd600);}catch(_0x38bf0c){const _0x37ca74=[...await _0xe0299c[_0x31cf21(0x19d)](),...await _0x1d2e24?.[_0x31cf21(0x19d)]()??[]];throw withRollbackErrors(_0x38bf0c,_0x31cf21(0x169),_0x37ca74);}return{'ok':_0x5c14aa[_0x31cf21(0x1a8)]===0x0,'data':{'pulled':_0xbfc9f3,'skipped':_0xe69fcb,'conflicts':_0x54ff2a,'failed':_0x5c14aa},'message':formatPullMessage(_0xbfc9f3['length'],_0xe69fcb[_0x31cf21(0x1a8)],_0x54ff2a[_0x31cf21(0x1a8)],_0x5c14aa[_0x31cf21(0x1a8)])};}};function localUnsyncedConflict(_0x4cf330,_0x5f36c3){const _0x41ee1a=a43_0x24931b,_0x32c903=_0x4cf330['lockKey'][_0x41ee1a(0x13b)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x4cf330['lockKey'],'filePath':_0x4cf330['filePath'],..._0x5f36c3!=null?{'remoteId':_0x5f36c3}:{},'message':_0x41ee1a(0x195),'nextAction':{'action':_0x41ee1a(0x160),'command':CLI_BIN_NAME+_0x41ee1a(0x1bb)+_0x4cf330[_0x41ee1a(0x1a2)]+_0x41ee1a(0x180)+_0x32c903+_0x41ee1a(0x190),'requiresReview':!![],'message':_0x41ee1a(0x19e)}};}function formatPullMessage(_0x11b697,_0x2ed6ed,_0x467014,_0x5efeb0){const _0x5b7926=a43_0x24931b,_0x4c23f8=['Pull\x20complete:\x20'+_0x11b697+_0x5b7926(0x1ae),_0x2ed6ed+_0x5b7926(0x139)];_0x467014>0x0&&_0x4c23f8[_0x5b7926(0x15b)](_0x467014+'\x20conflict'+(_0x467014===0x1?'':'s')+'\x20'+(_0x467014===0x1?_0x5b7926(0x135):_0x5b7926(0x1a6))+_0x5b7926(0x186));if(_0x5efeb0>0x0)_0x4c23f8['push'](_0x5efeb0+_0x5b7926(0x165));return _0x4c23f8[_0x5b7926(0x18d)](',\x20');}function a43_0x3d31(){const _0x1445eb=['Lock\x20scope\x20for\x20app\x20\x22','question','pull','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','delete','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','newDirectory','HOOK','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','603423MtSDeV','newDirectoryPath','Would\x20inspect\x20','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','oldDirectory','hash','\x20--name\x20','dev','apiDir','\x22\x20from\x20\x22','2808050oKsCja','mergedCli','\x20resolution','\x22:\x20its\x20target\x20\x22','ino','entry','reverse','functionNode','stdin','join','read','lockFilePath','\x20--format\x20compress','selectedAppName','635118GxZEaz','.hook-directory-migrate-','\x22:\x20both\x20target\x20\x22','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','some','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','newLockKey','COMMON','lockKey','bool','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','rollback','If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.','oldLockKey','force','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','type','filePath','18323950OUzjDs','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','require','datasetCode','length','sourceFilePathByNewLockKey','currentApp','\x20Recovery\x20errors:\x20','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','ENOENT','\x20pulled','skipped','get','11skoxYi','Remote\x20script\x20missing\x20content.','validation','GET','scriptsRoot','.js','projectedFunctions','close','entries','existed','\x20bff\x20push\x20--type\x20','oldDirectoryPath','unresolvable\x20target\x20path','ENDPOINT','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','scriptsRootDir','migrations','functions','Force\x20overwrite\x20local\x20unsynced\x20changes','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','str','lastSync','would_pull','sourceDirectoryPathByNewDirectory','trim','rekey','2320314LuPEfc','requires','hookLocation','toLowerCase','profileName','\x20skipped','string','split','/api/management/library/scripts/list?appCode=','88lBvqUZ','case-rename','keyChanges','operationType','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','has','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','message','conflict','¤tPage=1&pageSize=','NFC','\x22\x20and\x20\x22','toISOString','includes','stringify','\x22\x20may\x20remain.','content','5VkyJZH','8yTaOTI','435368PGlsxe','boolean','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x22\x20to\x20\x22','1189272BwOvOB','map','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','appCode','move','alias','push','Pull\x20only\x20this\x20script\x20type','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','scriptType','\x22\x20from\x20the\x20lock\x20file.','push_local','scriptContent','parse','code','Failed\x20to\x20write\x20local\x20script\x20\x22','\x20failed','cancelled','version','remoteId','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','defaultApp','\x22:\x20','all','set','mode','filter'];a43_0x3d31=function(){return _0x1445eb;};return a43_0x3d31();}async function hasUnsyncedLocalChanges(_0x5b7217,_0x29cd6c,_0x333232){const _0x5140cf=a43_0x24931b;if(!await fileExists(_0x5b7217))return![];const _0x5e90c3=await computeFileHash(_0x5b7217);if(!_0x29cd6c)return _0x333232?_0x5e90c3!==_0x333232:!![];return _0x5e90c3!==_0x29cd6c[_0x5140cf(0x17f)];}function a43_0x1c53(_0x17d6c9,_0x1c7ce8){_0x17d6c9=_0x17d6c9-0x12d;const _0x3d318b=a43_0x3d31();let _0x1c5317=_0x3d318b[_0x17d6c9];return _0x1c5317;}function createPullFileTransaction(){const _0x430bea=new Map(),_0x11b305=async(_0x328795,_0x36d659)=>{const _0x1273f9=a43_0x1c53;try{if(_0x36d659[_0x1273f9(0x1ba)])await ensureParentDirectory(_0x328795),await writeFile(_0x328795,_0x36d659[_0x1273f9(0x14d)]);else try{await unlink(_0x328795);}catch(_0x3c9592){if(_0x3c9592[_0x1273f9(0x163)]!==_0x1273f9(0x1ad))throw _0x3c9592;}return undefined;}catch(_0x219a9a){return _0x219a9a instanceof Error?_0x219a9a:new Error(String(_0x219a9a));}};return{async 'write'(_0x230627,_0x49b5c5){const _0xf86015=a43_0x1c53;if(!_0x430bea[_0xf86015(0x142)](_0x230627))try{_0x430bea[_0xf86015(0x16e)](_0x230627,{'existed':!![],'content':await readFile(_0x230627)});}catch(_0x2cf0c7){if(_0x2cf0c7[_0xf86015(0x163)]!==_0xf86015(0x1ad))throw _0x2cf0c7;_0x430bea[_0xf86015(0x16e)](_0x230627,{'existed':![]});}try{await ensureParentDirectory(_0x230627),await writeFile(_0x230627,_0x49b5c5,'utf8');}catch(_0x372c62){const _0x2c1faf=await _0x11b305(_0x230627,_0x430bea['get'](_0x230627));if(!_0x2c1faf)_0x430bea[_0xf86015(0x175)](_0x230627);throw withRollbackErrors(_0x372c62,_0xf86015(0x164)+_0x230627+'\x22.',_0x2c1faf?[_0x2c1faf]:[]);}},async 'rollback'(){const _0xb13fe9=a43_0x1c53,_0x5d6053=[];for(const [_0x435612,_0x33e5ea]of[..._0x430bea[_0xb13fe9(0x1b9)]()][_0xb13fe9(0x18a)]()){const _0xa7103c=await _0x11b305(_0x435612,_0x33e5ea);_0xa7103c&&_0x5d6053[_0xb13fe9(0x15b)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x435612+_0xb13fe9(0x16c)+_0xa7103c[_0xb13fe9(0x144)]));}return _0x5d6053;}};}function withRollbackErrors(_0x29802f,_0x4b9994,_0x4cc174){const _0x285d78=a43_0x24931b,_0x5c400a=_0x29802f instanceof Error?_0x29802f:new Error(String(_0x29802f));if(_0x4cc174[_0x285d78(0x1a8)]===0x0)return _0x5c400a;return new AggregateError([_0x5c400a,..._0x4cc174],_0x4b9994+_0x285d78(0x1ab)+_0x4cc174['map'](_0x3cacef=>_0x3cacef[_0x285d78(0x144)])[_0x285d78(0x18d)](';\x20'));}function buildDatasetCodeToAliasMap(_0x3f59c4,_0x51ce40,_0xb732cb){const _0x196d90=a43_0x24931b,_0x11995e=resolveApiModelSource(_0x3f59c4,_0x51ce40,_0xb732cb),_0x3d2688=loadAliasMap(_0x3f59c4,undefined,_0x11995e[_0x196d90(0x1a3)],_0x11995e[_0x196d90(0x138)]);return assertUnambiguousHookAliases(_0x3d2688),new Map(_0x3d2688[_0x196d90(0x155)](_0x2c8db4=>[_0x2c8db4[_0x196d90(0x1a7)]['toLowerCase'](),_0x2c8db4[_0x196d90(0x15a)]]));}async function planHookDirectoryMigration(_0x13a586,_0x5cdf2f,_0x3656e4,_0x5832af){const _0x31834b=a43_0x24931b,_0xc87570=new Map();for(const [_0x3f8a39,_0x534a76]of Object['entries'](_0x5cdf2f[_0x31834b(0x1c2)])){const [_0x3b4026,_0x28e98a,_0x386c9c,_0x523d1b,_0x2e1078,..._0x4948aa]=_0x3f8a39[_0x31834b(0x13b)]('/');if(_0x3b4026!==_0x31834b(0x178)||!_0x28e98a||!_0x386c9c||!_0x523d1b||!_0x2e1078||_0x4948aa[_0x31834b(0x1a8)]>0x0||!_0x534a76['datasetCode'])continue;const _0x48546d=_0x3656e4[_0x31834b(0x1b0)](_0x534a76['datasetCode'][_0x31834b(0x137)]()),_0xb26d32=_0x48546d??_0x534a76['datasetCode'];if(!isSafeHookDirectorySegment(_0x28e98a))throw CliErrors['validation'](_0x31834b(0x15d)+_0x28e98a+_0x31834b(0x15f));if(!isSafeHookDirectorySegment(_0xb26d32))throw CliErrors[_0x31834b(0x1b3)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x28e98a+_0x31834b(0x1a1));if(_0x28e98a===_0xb26d32)continue;const _0x44af37=_0xc87570[_0x31834b(0x1b0)](_0x28e98a)??{'datasetCode':_0x534a76[_0x31834b(0x1a7)],'alias':_0x48546d,'keyChanges':[]};if(_0x44af37[_0x31834b(0x1a7)]!==_0x534a76[_0x31834b(0x1a7)])throw CliErrors[_0x31834b(0x1b3)](_0x31834b(0x197)+_0x28e98a+_0x31834b(0x141));const _0x1c42a3='HOOK/'+_0xb26d32+'/'+_0x386c9c+'/'+_0x523d1b+'/'+_0x2e1078;try{resolveLocalFilePathFromLockKey(_0x13a586,_0x3f8a39),resolveLocalFilePathFromLockKey(_0x13a586,_0x1c42a3);}catch(_0x5bd3a5){throw CliErrors['validation']('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x3f8a39+_0x31834b(0x16c)+(_0x5bd3a5 instanceof Error?_0x5bd3a5[_0x31834b(0x144)]:String(_0x5bd3a5)));}_0x44af37[_0x31834b(0x13f)][_0x31834b(0x15b)]({'oldLockKey':_0x3f8a39,'newLockKey':_0x1c42a3,'entry':_0x534a76}),_0xc87570[_0x31834b(0x16e)](_0x28e98a,_0x44af37);}const _0x26730d=new Set([..._0xc87570['values']()]['flatMap'](_0x27aafa=>_0x27aafa[_0x31834b(0x13f)]['map'](_0x23f4c8=>_0x23f4c8['oldLockKey']))),_0x2a0cd3=new Map(),_0x5f504b=new Map();for(const [_0x5c2ca4,_0x40bd11]of _0xc87570){const _0x2dd0ae=_0x40bd11[_0x31834b(0x15a)]??_0x40bd11[_0x31834b(0x1a7)],_0x4b5d59=hookDirectoryIdentity(_0x2dd0ae),_0x27b5f6=_0x2a0cd3[_0x31834b(0x1b0)](_0x4b5d59);if(_0x27b5f6&&_0x27b5f6!==_0x5c2ca4)throw CliErrors[_0x31834b(0x1b3)]('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x27b5f6+_0x31834b(0x148)+_0x5c2ca4+'\x22:\x20both\x20target\x20\x22'+_0x2dd0ae+_0x31834b(0x174));_0x2a0cd3['set'](_0x4b5d59,_0x5c2ca4);for(const _0x561e97 of _0x40bd11[_0x31834b(0x13f)]){const _0x402d4c=_0x5f504b[_0x31834b(0x1b0)](_0x561e97[_0x31834b(0x198)]);if(_0x402d4c&&_0x402d4c!==_0x561e97[_0x31834b(0x19f)])throw CliErrors[_0x31834b(0x1b3)](_0x31834b(0x12d)+_0x402d4c+_0x31834b(0x148)+_0x561e97[_0x31834b(0x19f)]+_0x31834b(0x194)+_0x561e97['newLockKey']+_0x31834b(0x176));if(_0x26730d['has'](_0x561e97[_0x31834b(0x198)]))throw CliErrors[_0x31834b(0x1b3)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x561e97[_0x31834b(0x19f)]+_0x31834b(0x187)+_0x561e97[_0x31834b(0x198)]+_0x31834b(0x1ac));_0x5f504b[_0x31834b(0x16e)](_0x561e97[_0x31834b(0x198)],_0x561e97[_0x31834b(0x19f)]);}}const _0x31fdc1=new Map();for(const [_0x583420,_0x125599]of _0x3656e4){_0x31fdc1[_0x31834b(0x16e)](hookDirectoryIdentity(_0x125599),_0x583420);}const _0x3c897d=[];for(const [_0x24904d,_0x2d2bb0]of _0xc87570){const _0x58fb5b=_0x2d2bb0[_0x31834b(0x15a)]??_0x2d2bb0[_0x31834b(0x1a7)],_0x5f2ca8=join(_0x13a586[_0x31834b(0x1c0)],'HOOK',_0x24904d),_0x23a1e7=join(_0x13a586['scriptsRootDir'],_0x31834b(0x178),_0x58fb5b),_0x47eddf=await directoryExists(_0x5f2ca8),_0x2046de=await directoryExists(_0x23a1e7),_0x281e0b=_0x47eddf?_0x2046de?await sameDirectory(_0x5f2ca8,_0x23a1e7)?_0x31834b(0x13e):undefined:_0x31834b(0x159):_0x31834b(0x133);if(!_0x281e0b)throw CliErrors[_0x31834b(0x1b3)](_0x31834b(0x197)+_0x24904d+_0x31834b(0x153)+_0x58fb5b+_0x31834b(0x16a));const _0xf8a4c8=_0x31fdc1[_0x31834b(0x1b0)](hookDirectoryIdentity(_0x24904d));if(_0xf8a4c8&&_0xf8a4c8!==_0x2d2bb0[_0x31834b(0x1a7)][_0x31834b(0x137)]()){const _0x1e7555=new Set(_0x2d2bb0[_0x31834b(0x13f)][_0x31834b(0x155)](_0x357a24=>_0x357a24[_0x31834b(0x19f)])),_0x16ab13=_0x5832af[_0x31834b(0x170)](_0x640f4c=>_0x640f4c[_0x31834b(0x1a2)]===_0x31834b(0x178)&&_0x640f4c[_0x31834b(0x15a)]!=null&&hookDirectoryIdentity(_0x640f4c[_0x31834b(0x15a)])===hookDirectoryIdentity(_0x24904d)&&!_0x1e7555[_0x31834b(0x142)](_0x640f4c['lockKey']));if(_0x16ab13['length']>0x0)throw CliErrors[_0x31834b(0x1b3)](_0x31834b(0x197)+_0x24904d+_0x31834b(0x19c));}const _0xefa526=_0x31fdc1[_0x31834b(0x1b0)](hookDirectoryIdentity(_0x58fb5b));if(_0xefa526&&_0xefa526!==_0x2d2bb0[_0x31834b(0x1a7)][_0x31834b(0x137)]())throw CliErrors['validation'](_0x31834b(0x197)+_0x24904d+_0x31834b(0x153)+_0x58fb5b+_0x31834b(0x1a5));for(const _0xa706d2 of _0x2d2bb0[_0x31834b(0x13f)]){const _0x41adf3=_0x5cdf2f['functions'][_0xa706d2[_0x31834b(0x198)]];if(_0x41adf3&&!_0x26730d[_0x31834b(0x142)](_0xa706d2[_0x31834b(0x198)])&&!sameHookIdentity(_0xa706d2[_0x31834b(0x189)],_0x41adf3))throw CliErrors[_0x31834b(0x1b3)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x24904d+_0x31834b(0x153)+_0x58fb5b+_0x31834b(0x152));}_0x3c897d[_0x31834b(0x15b)]({'oldDirectory':_0x24904d,'newDirectory':_0x58fb5b,'oldDirectoryPath':_0x5f2ca8,'newDirectoryPath':_0x23a1e7,'mode':_0x281e0b,'alias':_0x2d2bb0[_0x31834b(0x15a)],'keyChanges':_0x2d2bb0[_0x31834b(0x13f)]});}const _0x496a0d={..._0x5cdf2f[_0x31834b(0x1c2)]},_0x33a27c=new Map(),_0x389b90=new Map();for(const _0x210164 of _0x3c897d){const _0x580cb9=_0x210164['mode']!==_0x31834b(0x133);_0x580cb9&&_0x389b90[_0x31834b(0x16e)](hookDirectoryIdentity(_0x210164[_0x31834b(0x177)]),_0x210164[_0x31834b(0x1bc)]);for(const _0x27426b of _0x210164[_0x31834b(0x13f)]){const _0x3c8f6b=_0x496a0d[_0x27426b[_0x31834b(0x198)]],_0x362585=_0x580cb9?_0x27426b[_0x31834b(0x189)]:_0x3c8f6b??_0x27426b[_0x31834b(0x189)];_0x496a0d[_0x27426b['newLockKey']]=canonicalizeHookEntry(_0x362585,_0x210164[_0x31834b(0x15a)]),delete _0x496a0d[_0x27426b['oldLockKey']],_0x580cb9&&_0x33a27c[_0x31834b(0x16e)](_0x27426b[_0x31834b(0x198)],resolveLocalFilePathFromLockKey(_0x13a586,_0x27426b['oldLockKey']));}}return{'migrations':_0x3c897d,'projectedFunctions':_0x496a0d,'sourceFilePathByNewLockKey':_0x33a27c,'sourceDirectoryPathByNewDirectory':_0x389b90};}function resolveMigratedSourceFilePath(_0xdc9b3b,_0x2c8ff1){const _0x411685=a43_0x24931b;if(!_0xdc9b3b||!_0x2c8ff1)return undefined;const _0x7d0ecb=_0xdc9b3b[_0x411685(0x1a9)]['get'](_0x2c8ff1['lockKey']);if(_0x7d0ecb)return _0x7d0ecb;if(_0x2c8ff1['type']!==_0x411685(0x178))return undefined;const [,_0x538283,..._0x2d0dd9]=_0x2c8ff1[_0x411685(0x19a)][_0x411685(0x13b)]('/');if(!_0x538283||_0x2d0dd9[_0x411685(0x1a8)]===0x0)return undefined;const _0x1c6695=_0xdc9b3b[_0x411685(0x131)]['get'](hookDirectoryIdentity(_0x538283));return _0x1c6695?join(_0x1c6695,..._0x2d0dd9)+_0x411685(0x1b6):undefined;}function sameHookIdentity(_0x4e1220,_0x255139){const _0x314367=a43_0x24931b;return _0x4e1220[_0x314367(0x168)]===_0x255139[_0x314367(0x168)]&&_0x4e1220[_0x314367(0x1a7)]===_0x255139['datasetCode']&&_0x4e1220[_0x314367(0x140)]===_0x255139[_0x314367(0x140)]&&_0x4e1220[_0x314367(0x18b)]===_0x255139['functionNode'];}function canonicalizeHookEntry(_0x57418a,_0x30e430){const {alias:_0x3c34df,..._0x519bd5}=_0x57418a;return _0x30e430?{..._0x519bd5,'alias':_0x30e430}:_0x519bd5;}function hookDirectoryIdentity(_0x3e1f9c){const _0x500dc4=a43_0x24931b;return _0x3e1f9c['normalize'](_0x500dc4(0x147))[_0x500dc4(0x137)]();}function isSafeHookDirectorySegment(_0x3c5c5c){return isSafeLockKeySegment(_0x3c5c5c);}async function sameDirectory(_0xcf3a5e,_0x2c9ca6){const _0x5d96e0=a43_0x24931b,[_0x589e4f,_0x37b295]=await Promise[_0x5d96e0(0x16d)]([stat(_0xcf3a5e),stat(_0x2c9ca6)]);return _0x589e4f[_0x5d96e0(0x181)]===_0x37b295[_0x5d96e0(0x181)]&&_0x589e4f['ino']===_0x37b295[_0x5d96e0(0x188)];}async function applyHookDirectoryMigration(_0x38a731,_0x51a5d8){const _0x15a1ae=a43_0x24931b,_0x4938b4=_0x51a5d8[_0x15a1ae(0x1c2)],_0x1059ca=_0x51a5d8[_0x15a1ae(0x12f)],_0x5d4b9e=[],_0x494612=async()=>{const _0x2acb31=_0x15a1ae,_0x370a47=[];_0x51a5d8[_0x2acb31(0x1c2)]=_0x4938b4,_0x51a5d8[_0x2acb31(0x12f)]=_0x1059ca;for(const {migration:_0x1ecb78,temporaryPath:_0x392215}of[..._0x5d4b9e][_0x2acb31(0x18a)]()){try{_0x392215?(await rename(_0x1ecb78[_0x2acb31(0x17b)],_0x392215),await rename(_0x392215,_0x1ecb78[_0x2acb31(0x1bc)])):await rename(_0x1ecb78[_0x2acb31(0x17b)],_0x1ecb78[_0x2acb31(0x1bc)]);}catch(_0x1ea17a){_0x370a47[_0x2acb31(0x15b)](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x1ecb78['oldDirectory']+_0x2acb31(0x183)+_0x1ecb78['newDirectory']+_0x2acb31(0x16c)+(_0x1ea17a instanceof Error?_0x1ea17a[_0x2acb31(0x144)]:String(_0x1ea17a))));}}return _0x370a47;};try{for(const _0x29b3f7 of _0x38a731['migrations']){if(_0x29b3f7['mode']===_0x15a1ae(0x159))await ensureParentDirectory(_0x29b3f7[_0x15a1ae(0x17b)]),await rename(_0x29b3f7[_0x15a1ae(0x1bc)],_0x29b3f7[_0x15a1ae(0x17b)]),_0x5d4b9e[_0x15a1ae(0x15b)]({'migration':_0x29b3f7});else{if(_0x29b3f7[_0x15a1ae(0x16f)]===_0x15a1ae(0x13e)){const _0x4489e9=join(dirname(_0x29b3f7[_0x15a1ae(0x1bc)]),_0x15a1ae(0x193)+randomUUID());await rename(_0x29b3f7[_0x15a1ae(0x1bc)],_0x4489e9);try{await rename(_0x4489e9,_0x29b3f7[_0x15a1ae(0x17b)]);}catch(_0x38b0c1){try{await rename(_0x4489e9,_0x29b3f7[_0x15a1ae(0x1bc)]);}catch(_0x3ea809){throw withRollbackErrors(_0x38b0c1,_0x15a1ae(0x156)+_0x29b3f7['oldDirectory']+_0x15a1ae(0x153)+_0x29b3f7[_0x15a1ae(0x177)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x4489e9+_0x15a1ae(0x14c),[new Error('Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22'+_0x4489e9+_0x15a1ae(0x153)+_0x29b3f7[_0x15a1ae(0x17e)]+'\x22:\x20'+(_0x3ea809 instanceof Error?_0x3ea809[_0x15a1ae(0x144)]:String(_0x3ea809)))]);}throw _0x38b0c1;}_0x5d4b9e[_0x15a1ae(0x15b)]({'migration':_0x29b3f7,'temporaryPath':_0x4489e9});}}}return _0x51a5d8[_0x15a1ae(0x1c2)]=_0x38a731[_0x15a1ae(0x1b7)],{'rollback':_0x494612};}catch(_0x8c45a1){const _0x3bd0d4=await _0x494612();throw withRollbackErrors(_0x8c45a1,_0x15a1ae(0x1bf),_0x3bd0d4);}}async function confirmForce(){const _0x55ade6=a43_0x24931b,_0x37a9cb=createInterface({'input':process[_0x55ade6(0x18c)],'output':process['stderr']}),_0x3fe47c=await new Promise(_0x45c4f3=>{const _0x3a15b1=_0x55ade6;_0x37a9cb[_0x3a15b1(0x172)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x45c4f3);});return _0x37a9cb[_0x55ade6(0x1b8)](),['y','yes'][_0x55ade6(0x14a)](_0x3fe47c[_0x55ade6(0x132)]()[_0x55ade6(0x137)]());}
|