@lovrabet/rabetbase-cli 2.5.10-beta.5 → 2.5.11-beta.1
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/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.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/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.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/page-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/context.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/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-analysis.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/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.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/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.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/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 +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a34_0x41ec(_0x5812bb,_0x285f67){_0x5812bb=_0x5812bb-0x149;const _0x32bc39=a34_0x32bc();let _0x41ec63=_0x32bc39[_0x5812bb];return _0x41ec63;}const a34_0x45afe7=a34_0x41ec;(function(_0x4279f4,_0x447c6f){const _0x1bf120=a34_0x41ec,_0x29bf05=_0x4279f4();while(!![]){try{const _0x2e745d=-parseInt(_0x1bf120(0x14e))/0x1+parseInt(_0x1bf120(0x15e))/0x2+parseInt(_0x1bf120(0x157))/0x3*(-parseInt(_0x1bf120(0x160))/0x4)+parseInt(_0x1bf120(0x165))/0x5*(-parseInt(_0x1bf120(0x15d))/0x6)+-parseInt(_0x1bf120(0x154))/0x7*(-parseInt(_0x1bf120(0x15a))/0x8)+-parseInt(_0x1bf120(0x156))/0x9*(-parseInt(_0x1bf120(0x163))/0xa)+-parseInt(_0x1bf120(0x14b))/0xb;if(_0x2e745d===_0x447c6f)break;else _0x29bf05['push'](_0x29bf05['shift']());}catch(_0x18d27c){_0x29bf05['push'](_0x29bf05['shift']());}}}(a34_0x32bc,0x52575));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';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='/smartapi/app-config/create',UPDATE_PATH=a34_0x45afe7(0x159);export const appConfigSet={'service':a34_0x45afe7(0x162),'command':a34_0x45afe7(0x14d),'description':a34_0x45afe7(0x15f),'risk':'write','args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x45afe7(0x155),'type':'string','description':a34_0x45afe7(0x158)}],async 'validate'(_0x37b375){readKeyArg(_0x37b375),readOptionalTags(_0x37b375),assertSingleValueSource(_0x37b375);},async 'dryRun'(_0x1b9220){const _0x32ca80=a34_0x45afe7,_0x145d76=readKeyArg(_0x1b9220),_0x2f856f=readOptionalTags(_0x1b9220),_0x47e738=assertSingleValueSource(_0x1b9220);await assertValueSourceReadable(_0x47e738);const _0x3d8594=await withAppConfigApiBoundary(_0x32ca80(0x150),{'appCode':_0x1b9220['appCode'],'key':_0x145d76},()=>getAppConfigByKey(_0x1b9220[_0x32ca80(0x152)],_0x145d76)),_0x212151=_0x3d8594?_0x32ca80(0x151):_0x32ca80(0x14f),_0x1f7a40=_0x3d8594?projectAppConfig(_0x3d8594):null,_0x5b935b=plannedAppConfig({'appCode':_0x1b9220['appCode'],'key':_0x145d76,'tags':_0x2f856f??_0x3d8594?.[_0x32ca80(0x166)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x212151,'appCode':_0x1b9220['appCode'],'key':_0x145d76,'before':_0x1f7a40,'after':_0x5b935b,'dryRun':!![]}),{'method':_0x32ca80(0x153),'url':_0x212151===_0x32ca80(0x151)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x4cfdf6){const _0x13607b=a34_0x45afe7,_0x126f1d=readKeyArg(_0x4cfdf6),_0x5e3f1d=readOptionalTags(_0x4cfdf6),_0x437362=await withAppConfigApiBoundary(_0x13607b(0x150),{'appCode':_0x4cfdf6[_0x13607b(0x152)],'key':_0x126f1d},()=>getAppConfigByKey(_0x4cfdf6[_0x13607b(0x152)],_0x126f1d)),_0x1f3464=_0x437362?projectAppConfig(_0x437362):null,_0x4ad129=_0x437362?_0x13607b(0x151):_0x13607b(0x14f),{value:_0x186fa2,warnings:_0x3b7d86}=await readAppConfigValue(_0x4cfdf6),_0x2e9518={'appCode':_0x4cfdf6['appCode'],'key':_0x126f1d,'value':_0x186fa2,'tags':_0x5e3f1d??_0x437362?.[_0x13607b(0x166)]??undefined};await withAppConfigApiBoundary(_0x4ad129,{'appCode':_0x4cfdf6[_0x13607b(0x152)],'key':_0x126f1d},async()=>{const _0x44abb0=_0x13607b;_0x437362?await updateAppConfig({..._0x2e9518,'id':requireAppConfigId(_0x437362,_0x126f1d,_0x4cfdf6[_0x44abb0(0x152)])}):await createAppConfig(_0x2e9518);});const _0x1a7882=await withAppConfigApiBoundary('get',{'appCode':_0x4cfdf6[_0x13607b(0x152)],'key':_0x126f1d},()=>getAppConfigByKey(_0x4cfdf6[_0x13607b(0x152)],_0x126f1d)),_0x1d2c5a=_0x1a7882?projectAppConfig(_0x1a7882):plannedAppConfig({'appCode':_0x4cfdf6[_0x13607b(0x152)],'key':_0x126f1d,'tags':_0x2e9518[_0x13607b(0x166)],'hasValue':_0x186fa2!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x4ad129,'appCode':_0x4cfdf6[_0x13607b(0x152)],'key':_0x126f1d,'before':_0x1f3464,'after':_0x1d2c5a,'dryRun':![],'warnings':_0x3b7d86}),'message':(_0x4ad129===_0x13607b(0x151)?_0x13607b(0x164):_0x13607b(0x149))+'\x20app\x20config\x20'+_0x126f1d};}};function requireAppConfigId(_0x332ce2,_0x4fd1b5,_0x1dcaf8){const _0x5bbcc4=a34_0x45afe7;if(typeof _0x332ce2['id']===_0x5bbcc4(0x14a)&&Number[_0x5bbcc4(0x14c)](_0x332ce2['id'])&&_0x332ce2['id']>0x0)return _0x332ce2['id'];throw CliErrors[_0x5bbcc4(0x161)](_0x5bbcc4(0x15b)+_0x4fd1b5+_0x5bbcc4(0x15c)+_0x1dcaf8);}function a34_0x32bc(){const _0xa3a41=['506194dZyJkN','create','get','update','appCode','POST','7qDybFJ','file','12996chHYsU','6195TdIXvk','Read\x20config\x20value\x20from\x20file','/smartapi/app-config/update','5233368rbnXsz','App\x20config\x20server\x20id\x20missing\x20for\x20key=',',\x20appCode=','654UvoegT','603308utJZZm','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','124cxXJvw','apiError','app-config','3830cVkUia','Updated','26820okJBCC','tags','Created','number','183953xhGZes','isFinite','set'];a34_0x32bc=function(){return _0xa3a41;};return a34_0x32bc();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x5be0ba=a35_0x55c6;function a35_0x55c6(_0x32173f,_0x4b9d2f){_0x32173f=_0x32173f-0x18d;const _0x2f7382=a35_0x2f73();let _0x55c69e=_0x2f7382[_0x32173f];return _0x55c69e;}(function(_0x2c0c7f,_0x523b66){const _0x7f7788=a35_0x55c6,_0x27d037=_0x2c0c7f();while(!![]){try{const _0x1bb0df=parseInt(_0x7f7788(0x19d))/0x1+parseInt(_0x7f7788(0x1aa))/0x2*(parseInt(_0x7f7788(0x191))/0x3)+-parseInt(_0x7f7788(0x19e))/0x4*(-parseInt(_0x7f7788(0x1a1))/0x5)+parseInt(_0x7f7788(0x192))/0x6*(parseInt(_0x7f7788(0x19b))/0x7)+parseInt(_0x7f7788(0x199))/0x8*(parseInt(_0x7f7788(0x1c7))/0x9)+-parseInt(_0x7f7788(0x1c1))/0xa+parseInt(_0x7f7788(0x196))/0xb*(-parseInt(_0x7f7788(0x1b7))/0xc);if(_0x1bb0df===_0x523b66)break;else _0x27d037['push'](_0x27d037['shift']());}catch(_0x3c8eb3){_0x27d037['push'](_0x27d037['shift']());}}}(a35_0x2f73,0xb4f57));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a35_0x5be0ba(0x1a0),'required':!![]};export const VALUE_ARG={'name':a35_0x5be0ba(0x1a6),'description':a35_0x5be0ba(0x1ae),'required':![]};export const TAGS_FLAG={'name':a35_0x5be0ba(0x1b9),'type':'string','description':a35_0x5be0ba(0x1b4)};export const STDIN_FLAG={'name':a35_0x5be0ba(0x1a5),'type':a35_0x5be0ba(0x195),'description':'Read\x20config\x20value\x20from\x20stdin','default':![]};export const FROM_ENV_FLAG={'name':a35_0x5be0ba(0x1cc),'type':a35_0x5be0ba(0x1cf),'description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};export const REVEAL_FLAG={'name':a35_0x5be0ba(0x1bd),'type':a35_0x5be0ba(0x195),'description':'Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','default':![]};export function readKeyArg(_0x3a9cb6){const _0x5b0254=a35_0x5be0ba,_0x30fa93=_0x3a9cb6['args'][0x0]?.[_0x5b0254(0x1b5)]()??'';return validateKey(_0x30fa93),_0x30fa93;}export function readOptionalTags(_0x5ae2ab){const _0x3b0d13=a35_0x5be0ba,_0x316df4=_0x5ae2ab[_0x3b0d13(0x1c5)](_0x3b0d13(0x1b9))[_0x3b0d13(0x1b5)]();if(!_0x316df4)return undefined;if(_0x316df4[_0x3b0d13(0x19f)]>0x20)throw CliErrors[_0x3b0d13(0x1cb)](_0x3b0d13(0x1c0));return _0x316df4;}export function validateKey(_0x162fe9){const _0x54dc8d=a35_0x5be0ba;if(!_0x162fe9)throw CliErrors[_0x54dc8d(0x1cb)](_0x54dc8d(0x1b2));if(_0x162fe9['length']>0x100)throw CliErrors[_0x54dc8d(0x1cb)](_0x54dc8d(0x1a3));}export function projectAppConfig(_0x37fd8a,_0x5b1043){const _0x2b1027=a35_0x5be0ba,_0x25f2f3=_0x37fd8a['value']!==undefined&&_0x37fd8a[_0x2b1027(0x1a6)]!==null&&_0x37fd8a[_0x2b1027(0x1a6)]!=='',_0x1bde5a={'appCode':_0x37fd8a[_0x2b1027(0x1bf)],'key':_0x37fd8a['key'],'tags':_0x37fd8a[_0x2b1027(0x1b9)]??undefined,'hasValue':_0x25f2f3,'valueRedacted':_0x25f2f3&&!_0x5b1043?.['reveal'],'gmtCreate':_0x37fd8a[_0x2b1027(0x1bb)],'gmtModified':_0x37fd8a[_0x2b1027(0x1be)]};return _0x5b1043?.['reveal']&&(_0x1bde5a[_0x2b1027(0x1a6)]=_0x37fd8a[_0x2b1027(0x1a6)]??'',_0x1bde5a[_0x2b1027(0x1ac)]=![]),_0x1bde5a;}export function plannedAppConfig(_0x40eaab){const _0x3d15e6=a35_0x5be0ba,_0x5738cd=_0x40eaab[_0x3d15e6(0x1b0)]??!![];return{'appCode':_0x40eaab['appCode'],'key':_0x40eaab[_0x3d15e6(0x1c3)],'tags':_0x40eaab[_0x3d15e6(0x1b9)]??undefined,'hasValue':_0x5738cd,'valueRedacted':_0x5738cd};}export function buildMutationData(_0x39fe21){const _0x56e506=a35_0x5be0ba;return{'operation':_0x39fe21['operation'],'selector':{'appCode':_0x39fe21[_0x56e506(0x1bf)],'key':_0x39fe21['key']},'before':_0x39fe21[_0x56e506(0x18e)],'after':_0x39fe21[_0x56e506(0x1a2)],'dryRun':_0x39fe21[_0x56e506(0x19c)],'warnings':_0x39fe21[_0x56e506(0x1b3)]??[]};}export async function withAppConfigApiBoundary(_0x356d4a,_0x907b04,_0x75832f){const _0x1971dd=a35_0x5be0ba;try{return await _0x75832f();}catch{const _0x589e6e=[_0x1971dd(0x1a8)+_0x907b04['appCode']];if(_0x907b04[_0x1971dd(0x1c3)])_0x589e6e[_0x1971dd(0x194)](_0x1971dd(0x1a7)+_0x907b04[_0x1971dd(0x1c3)]);_0x589e6e[_0x1971dd(0x194)](_0x1971dd(0x1ba));throw CliErrors['apiError'](_0x1971dd(0x18f)+_0x356d4a+_0x1971dd(0x190),_0x589e6e[_0x1971dd(0x1cd)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x56ec84,_0x309c1c){const _0x19c7c9=a35_0x5be0ba;return Object[_0x19c7c9(0x1ad)](_0x56ec84,{'method':{'value':_0x309c1c['method'],'enumerable':![]},'url':{'value':_0x309c1c['url'],'enumerable':![]}});}export function assertSingleValueSource(_0x357581){const _0x498df3=a35_0x5be0ba,_0x3c0547=[];_0x357581[_0x498df3(0x1c4)][_0x498df3(0x19f)]>0x1&&_0x3c0547['push']({'kind':'argument','value':_0x357581['args'][_0x498df3(0x1ab)](0x1)['join']('\x20')});const _0x52baa2=_0x357581[_0x498df3(0x1c2)]('value');_0x52baa2!==undefined&&_0x52baa2!==null&&_0x3c0547[_0x498df3(0x194)]({'kind':_0x498df3(0x1c8),'value':String(_0x52baa2)});_0x357581[_0x498df3(0x1b1)](_0x498df3(0x1a5))&&_0x3c0547[_0x498df3(0x194)]({'kind':'stdin'});const _0x52bd41=_0x357581[_0x498df3(0x1c5)](_0x498df3(0x1cc))[_0x498df3(0x1b5)]();_0x52bd41&&_0x3c0547[_0x498df3(0x194)]({'kind':_0x498df3(0x1a9),'name':_0x52bd41});const _0x310f8b=_0x357581[_0x498df3(0x1c5)](_0x498df3(0x1ca))[_0x498df3(0x1b5)]();_0x310f8b&&_0x3c0547[_0x498df3(0x194)]({'kind':_0x498df3(0x1ca),'path':_0x310f8b});if(_0x3c0547[_0x498df3(0x19f)]===0x0)throw CliErrors[_0x498df3(0x1cb)](_0x498df3(0x1ce),'Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0x3c0547[_0x498df3(0x19f)]>0x1)throw CliErrors['validation']('App\x20config\x20value\x20source\x20is\x20ambiguous.','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');return _0x3c0547[0x0];}export async function assertValueSourceReadable(_0x3a2be1){const _0x32b2a3=a35_0x5be0ba;if(_0x3a2be1['kind']==='env'&&!(_0x3a2be1['name']in process.env))throw CliErrors[_0x32b2a3(0x1cb)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x3a2be1[_0x32b2a3(0x1bc)]);if(_0x3a2be1[_0x32b2a3(0x1b6)]===_0x32b2a3(0x1ca))try{await access(_0x3a2be1[_0x32b2a3(0x198)]);}catch{throw CliErrors[_0x32b2a3(0x1cb)](_0x32b2a3(0x1a4)+_0x3a2be1[_0x32b2a3(0x198)]);}}export async function readAppConfigValue(_0x2e8e29){const _0x4a76d0=a35_0x5be0ba,_0x5eae20=assertSingleValueSource(_0x2e8e29),_0x171ead=[];if(_0x5eae20[_0x4a76d0(0x1b6)]===_0x4a76d0(0x1c8))return _0x171ead[_0x4a76d0(0x194)](_0x4a76d0(0x197)),{'value':_0x5eae20[_0x4a76d0(0x1a6)]??'','source':_0x5eae20[_0x4a76d0(0x1b6)],'warnings':_0x171ead};if(_0x5eae20[_0x4a76d0(0x1b6)]===_0x4a76d0(0x1a5))return{'value':await readStdin(),'source':_0x5eae20['kind'],'warnings':_0x171ead};if(_0x5eae20['kind']===_0x4a76d0(0x1a9)){if(!(_0x5eae20[_0x4a76d0(0x1bc)]in process.env))throw CliErrors['validation'](_0x4a76d0(0x19a)+_0x5eae20[_0x4a76d0(0x1bc)]);return{'value':process.env[_0x5eae20.name]??'','source':_0x5eae20['kind'],'warnings':_0x171ead};}return{'value':await readFile(_0x5eae20[_0x4a76d0(0x198)],'utf8'),'source':_0x5eae20['kind'],'warnings':_0x171ead};}function a35_0x2f73(){const _0x2ced6f=['end','push','boolean','11cHzTPU','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','path','17768xHVqQO','Environment\x20variable\x20is\x20not\x20set:\x20','4011FdRuSm','dryRun','87006LAwpVx','2224etufNX','length','Runtime\x20app-config\x20key','865XQgRPk','after','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','Value\x20file\x20is\x20not\x20readable:\x20','stdin','value','key:\x20','appCode:\x20','env','85688bOBHlF','slice','valueRedacted','defineProperties','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','setEncoding','hasValue','bool','Missing\x20app-config\x20key.','warnings','Config\x20tags\x20for\x20filtering/display\x20metadata','trim','kind','10920540emiWDt','once','tags','value\x20is\x20redacted','gmtCreate','name','reveal','gmtModified','appCode','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','3083960GraLyY','flag','key','args','str','error','1431BMiwhj','argument','data','file','validation','from-env','join','Missing\x20app-config\x20value\x20source.','string','utf8','before','Failed\x20to\x20','\x20app\x20config.','66mmWbJS','5034GzyWoL'];a35_0x2f73=function(){return _0x2ced6f;};return a35_0x2f73();}function readStdin(){return new Promise((_0x243f85,_0x1da2ac)=>{const _0x14fb03=a35_0x55c6;let _0x5acddc='';process[_0x14fb03(0x1a5)][_0x14fb03(0x1af)](_0x14fb03(0x18d)),process[_0x14fb03(0x1a5)]['on'](_0x14fb03(0x1c9),_0x494a7b=>{_0x5acddc+=_0x494a7b;}),process[_0x14fb03(0x1a5)]['once'](_0x14fb03(0x193),()=>_0x243f85(_0x5acddc)),process[_0x14fb03(0x1a5)][_0x14fb03(0x1b8)](_0x14fb03(0x1c6),_0x1da2ac);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a36_0x4dc632=a36_0x3270;(function(_0x9bda72,_0x934050){const _0x4b3efb=a36_0x3270,_0x4d28e8=_0x9bda72();while(!![]){try{const _0x77655a=-parseInt(_0x4b3efb(0x199))/0x1*(parseInt(_0x4b3efb(0x19e))/0x2)+-parseInt(_0x4b3efb(0x193))/0x3*(-parseInt(_0x4b3efb(0x191))/0x4)+parseInt(_0x4b3efb(0x1a5))/0x5*(-parseInt(_0x4b3efb(0x197))/0x6)+parseInt(_0x4b3efb(0x19b))/0x7*(parseInt(_0x4b3efb(0x19f))/0x8)+-parseInt(_0x4b3efb(0x1a0))/0x9+-parseInt(_0x4b3efb(0x195))/0xa*(parseInt(_0x4b3efb(0x18d))/0xb)+-parseInt(_0x4b3efb(0x19c))/0xc*(-parseInt(_0x4b3efb(0x19d))/0xd);if(_0x77655a===_0x934050)break;else _0x4d28e8['push'](_0x4d28e8['shift']());}catch(_0x1b962c){_0x4d28e8['push'](_0x4d28e8['shift']());}}}(a36_0x8d3d,0xc1c66));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x3270(_0x3194e0,_0x113088){_0x3194e0=_0x3194e0-0x18d;const _0x8d3db8=a36_0x8d3d();let _0x3270c1=_0x8d3db8[_0x3194e0];return _0x3270c1;}export const authDefinitions=[{'service':a36_0x4dc632(0x18e),'command':a36_0x4dc632(0x1a1),'description':a36_0x4dc632(0x194),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x4dc632(0x1a6),'type':a36_0x4dc632(0x190),'description':'Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','default':![]}],async 'execute'(_0x2ced57){const _0x5d80af=a36_0x4dc632,{runAuthServer:_0x25e867}=await import('../../auth/auth-server-ui.js');return await _0x25e867({'autoYes':_0x2ced57[_0x5d80af(0x1a4)](_0x5d80af(0x1a6)),'nonInteractive':_0x2ced57[_0x5d80af(0x196)]}),{'ok':!![]};}},{'service':a36_0x4dc632(0x18e),'command':a36_0x4dc632(0x1a3),'description':a36_0x4dc632(0x19a),'risk':a36_0x4dc632(0x192),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x3b14de){const _0x1e8091=a36_0x4dc632;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x1e8091(0x1a2)](_0x1e8091(0x198))):console[_0x1e8091(0x1a2)](_0x1e8091(0x18f)),{'ok':!![]};}}];function a36_0x8d3d(){const _0x1aaa26=['logout','bool','35TLkiBD','yes','33cWBOZH','auth','!\x20Not\x20logged\x20in','boolean','2092jvMHCO','write','633SfXRTq','Login\x20via\x20browser','76630NCXeTn','nonInteractive','415356xTyHUR','✓\x20Logged\x20out','1402jUfnMs','Clear\x20login\x20session','378763DZEgXP','694236ORwsKj','247cfUpUW','1732ryQagR','200ibEjQa','421920KdXibR','login','log'];a36_0x8d3d=function(){return _0x1aaa26;};return a36_0x8d3d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a37_0x3eef(){const _0x419761=['90FLbSEy','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','/HOOK/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Created\x20','Alias\x20\x22','Dataset\x20not\x20found\x20for\x20code\x20\x22','datasetcode','3249336VEeseM','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','entries','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','currentApp','function-node','2206425HlgWyZ','alias','\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.','operationType','6525FiAiKs','Trigger\x20node\x20(HOOK\x20only)','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Script\x20type','Available:\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','209hCsRzh','/ENDPOINT/','datasetCode','修改后的响应结果','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','map','str','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','write','keys','isInteger','length','operation-type','\x0a\x20*\x20[平台配置]\x20','functionNode','73409RdUPXE','type','/data/dataset/','/**\x0a\x20*\x20','33amuQPv','scriptsRootDir','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','after','before','string','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','description','parseInt','selectedAppName','COMMON','bff','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','.js\x0a\x20*\x20[触发节点]\x20','8ClaZIT','filePath','\x22.\x20','join','tableName','UNKNOWN','appCode','read','Invalid\x20function\x20name\x20\x22','Operation\x20type\x20\x22','\x20function:\x20','name','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20',']\x20(','Script\x20description','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','create','No\x20datasets\x20found\x20for\x20this\x20app.','code','Operation\x20type\x20(HOOK\x20only)','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Select\x20operation\x20type:','修改后的请求参数','ENDPOINT','datasetId','nonInteractive','validation','stderr','679330HgNFaJ','apiDir','source','HOOK\x20requires\x20alias/operation/node\x20options.','316326jhFBcn','mergedCli','当前响应结果','/COMMON/','HOOK','\x22,\x20params\x20})\x0a','find','profileName','3484pUGhPJ','trim','utf8','.js','File\x20already\x20exists:\x20','7568yjTnyX','Select\x20dataset:'];a37_0x3eef=function(){return _0x419761;};return a37_0x3eef();}const a37_0x16b259=a37_0x663e;(function(_0x3e407b,_0x353b9c){const _0x2b2846=a37_0x663e,_0x20b18e=_0x3e407b();while(!![]){try{const _0x30dddd=parseInt(_0x2b2846(0x1a9))/0x1*(parseInt(_0x2b2846(0x1f4))/0x2)+-parseInt(_0x2b2846(0x1ec))/0x3*(-parseInt(_0x2b2846(0x1ca))/0x4)+parseInt(_0x2b2846(0x19e))/0x5+-parseInt(_0x2b2846(0x1fb))/0x6*(-parseInt(_0x2b2846(0x1b8))/0x7)+parseInt(_0x2b2846(0x1f9))/0x8*(-parseInt(_0x2b2846(0x1a3))/0x9)+parseInt(_0x2b2846(0x1e8))/0xa*(parseInt(_0x2b2846(0x1bc))/0xb)+-parseInt(_0x2b2846(0x198))/0xc;if(_0x30dddd===_0x353b9c)break;else _0x20b18e['push'](_0x20b18e['shift']());}catch(_0x84d5a3){_0x20b18e['push'](_0x20b18e['shift']());}}}(a37_0x3eef,0x66b73));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';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_0x663e(_0xb995ac,_0x1af432){_0xb995ac=_0xb995ac-0x192;const _0x3eefc9=a37_0x3eef();let _0x663e22=_0x3eefc9[_0xb995ac];return _0x663e22;}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x16b259(0x1c7),'command':a37_0x16b259(0x1da),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0x16b259(0x1d1),'flags':[{'name':a37_0x16b259(0x1b9),'type':a37_0x16b259(0x1c1),'required':!![],'enum':[a37_0x16b259(0x1c6),'ENDPOINT',a37_0x16b259(0x1f0)],'description':a37_0x16b259(0x1a6)},{'name':a37_0x16b259(0x1d5),'type':a37_0x16b259(0x1c1),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x16b259(0x1c3),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1d8)},{'name':'alias','type':a37_0x16b259(0x1c1),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x16b259(0x197),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1d9)},{'name':'operation-type','type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1dd)},{'name':a37_0x16b259(0x19d),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1a4),'enum':[a37_0x16b259(0x1c0),a37_0x16b259(0x1bf)]}],async 'validate'(_0x7098ad){const _0x4cbb09=a37_0x16b259,_0x2e4ae1=_0x7098ad[_0x4cbb09(0x1af)]('name');if(!isValidBffFunctionName(_0x2e4ae1))throw CliErrors[_0x4cbb09(0x1e6)](_0x4cbb09(0x1d2)+_0x2e4ae1+_0x4cbb09(0x1fc));},async 'execute'(_0x5331cd){const _0x11f538=a37_0x16b259,_0x33d36c=loadBffProjectConfig(_0x5331cd['appCode']),_0x3727bb=_0x5331cd[_0x11f538(0x1af)]('type'),_0x1a6da1=_0x5331cd[_0x11f538(0x1af)](_0x11f538(0x1d5)),_0x45e66d=_0x5331cd[_0x11f538(0x1af)](_0x11f538(0x1c3))||undefined,_0x22c3c5=_0x3727bb===_0x11f538(0x1f0)?await resolveHookOptions(_0x33d36c,_0x5331cd):undefined,_0x35a5b5=buildFilePath(_0x33d36c,_0x3727bb,_0x1a6da1,_0x22c3c5);if(await fileExists(_0x35a5b5))throw CliErrors['validation'](_0x11f538(0x1f8)+_0x35a5b5);await mkdir(dirname(_0x35a5b5),{'recursive':!![]});const _0x30f73f=generateTemplate(_0x3727bb,_0x1a6da1,_0x5331cd['appCode'],_0x45e66d,_0x22c3c5);await writeFile(_0x35a5b5,_0x30f73f,_0x11f538(0x1f6));const _0x2d1ea4={'type':_0x3727bb,'name':_0x1a6da1,'path':_0x35a5b5};if(_0x45e66d)_0x2d1ea4[_0x11f538(0x1c3)]=_0x45e66d;if(_0x22c3c5){if(_0x22c3c5[_0x11f538(0x19f)])_0x2d1ea4[_0x11f538(0x19f)]=_0x22c3c5[_0x11f538(0x19f)];_0x2d1ea4[_0x11f538(0x1ab)]=_0x22c3c5[_0x11f538(0x1ab)],_0x2d1ea4['operationType']=_0x22c3c5['operationType'],_0x2d1ea4['functionNode']=_0x22c3c5['functionNode'];}return{'ok':!![],'data':_0x2d1ea4,'message':_0x11f538(0x194)+_0x3727bb+_0x11f538(0x1d4)+_0x1a6da1};}};async function resolveHookOptions(_0x345396,_0x5bed8f){const _0x146675=a37_0x16b259,_0xf4bbd7=resolveApiModelSource(_0x5bed8f[_0x146675(0x1e9)],_0x5bed8f[_0x146675(0x1d0)],_0x5bed8f[_0x146675(0x1c5)]||_0x5bed8f[_0x146675(0x1ed)]?.[_0x146675(0x19c)]||_0x5bed8f['mergedCli']?.['defaultApp']),_0x379f5c=loadAliasMap(_0x5bed8f[_0x146675(0x1e9)],undefined,_0xf4bbd7[_0x146675(0x1cb)],_0xf4bbd7['profileName']),_0x2263dd=_0x379f5c[_0x146675(0x1b4)]>0x0;let _0x116ab4,_0x34b2e7,_0xf63863;const _0x3dfd0a=_0x5bed8f[_0x146675(0x1af)](_0x146675(0x19f)),_0x2ac7d7=_0x5bed8f[_0x146675(0x1af)](_0x146675(0x197));if(_0x3dfd0a){const _0x1544f1=resolveAlias(_0x5bed8f['apiDir'],_0x3dfd0a,undefined,_0xf4bbd7[_0x146675(0x1cb)],_0xf4bbd7[_0x146675(0x1f3)]);if(!_0x1544f1){const _0x298249=_0x2263dd?'Available\x20aliases:\x20'+_0x379f5c[_0x146675(0x1ae)](_0x5111ed=>_0x5111ed[_0x146675(0x19f)])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x146675(0x1a5);throw CliErrors['validation'](_0x146675(0x195)+_0x3dfd0a+'\x22\x20not\x20found.\x20'+_0x298249);}_0x116ab4=_0x3dfd0a,_0x34b2e7=_0x1544f1;}else{if(_0x2ac7d7){_0x34b2e7=_0x2ac7d7;const _0x59b148=_0x379f5c[_0x146675(0x1f2)](_0x553a45=>_0x553a45[_0x146675(0x1ab)]===_0x2ac7d7);_0x116ab4=_0x59b148?.[_0x146675(0x19f)];}else{if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1de));else{if(_0x2263dd){const _0x4757cc=_0x379f5c[_0x146675(0x1ae)](_0x5eed00=>_0x5eed00[_0x146675(0x19f)]+'\x20('+_0x5eed00[_0x146675(0x1ce)]+')'),_0xc1c6d5=await promptSelect(_0x146675(0x1fa),_0x4757cc),_0x4e5579=_0x379f5c[_0xc1c6d5];if(!_0x4e5579)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1a1));_0x116ab4=_0x4e5579[_0x146675(0x19f)],_0x34b2e7=_0x4e5579[_0x146675(0x1ab)];}else{const _0x521514=await listDatasets(_0x5bed8f[_0x146675(0x1d0)]);if(_0x521514[_0x146675(0x1b4)]===0x0)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1db));const _0x16c3bb=_0x521514[_0x146675(0x1ae)](_0x170e32=>_0x170e32['name']+'\x20['+(_0x170e32[_0x146675(0x1ea)]??_0x146675(0x1cf))+_0x146675(0x1d7)+_0x170e32[_0x146675(0x1dc)]+')'),_0x2e6789=await promptSelect(_0x146675(0x1fa),_0x16c3bb),_0x55d227=_0x521514[_0x2e6789];if(!_0x55d227)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1a1));_0x34b2e7=_0x55d227['code'],_0x116ab4=undefined;}}}}const _0x333524=await listDatasets(_0x5bed8f[_0x146675(0x1d0)]),_0x1c041f=_0x333524[_0x146675(0x1f2)](_0x18f386=>_0x18f386[_0x146675(0x1dc)]===_0x34b2e7);if(!_0x1c041f)throw CliErrors['validation'](_0x146675(0x196)+_0x34b2e7+_0x146675(0x1cc)+(_0x116ab4?_0x146675(0x1df)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0xf63863=_0x1c041f['id'];const _0x55e1c2=_0x116ab4??_0x34b2e7,_0x1ee03d=await listBffDatasetOperations(_0x5bed8f['appCode'],_0xf63863),_0x452439=_0x1ee03d?Object[_0x146675(0x1b2)](_0x1ee03d):[];if(_0x452439[_0x146675(0x1b4)]===0x0)throw CliErrors[_0x146675(0x1e6)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x55e1c2+'.');let _0x28356b;const _0x9e607a=_0x5bed8f['str'](_0x146675(0x1b5));if(_0x9e607a){if(!_0x452439['includes'](_0x9e607a))throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1d3)+_0x9e607a+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x55e1c2+'.\x20'+(_0x146675(0x1a7)+_0x452439[_0x146675(0x1cd)](',\x20')));_0x28356b=_0x9e607a;}else{if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1be));const _0x4b6a31=await promptSelect(_0x146675(0x1e1),_0x452439);_0x28356b=_0x452439[_0x4b6a31]??_0x452439[0x0];}let _0x3fbd4f=normalizeHookFunctionNode(_0x5bed8f[_0x146675(0x1af)]('function-node'));if(!_0x3fbd4f){if(_0x5bed8f[_0x146675(0x1af)](_0x146675(0x19d)))throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1e0));if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1b0));const _0x7647be=await promptSelect('Select\x20trigger\x20node:',[_0x146675(0x1c0),_0x146675(0x1bf)]);_0x3fbd4f=[_0x146675(0x1c0),_0x146675(0x1bf)][_0x7647be]??_0x146675(0x1c0);}return{'alias':_0x116ab4,'datasetCode':_0x34b2e7,'datasetId':_0xf63863,'operationType':_0x28356b,'functionNode':_0x3fbd4f};}async function promptSelect(_0x3362ac,_0x472466){const _0x30d236=a37_0x16b259;if(_0x472466['length']===0x1)return 0x0;for(const [_0x2645c7,_0x5da07e]of _0x472466[_0x30d236(0x19a)]()){process[_0x30d236(0x1e7)]['write']('\x20\x20'+(_0x2645c7+0x1)+'.\x20'+_0x5da07e+'\x0a');}const _0x3bdb3c=createInterface({'input':process['stdin'],'output':process[_0x30d236(0x1e7)]});while(!![]){const _0x2f195b=await new Promise(_0x2ad028=>{_0x3bdb3c['question'](_0x3362ac+'\x20',_0x2ad028);}),_0x1ab56f=Number[_0x30d236(0x1c4)](_0x2f195b['trim'](),0xa);if(Number[_0x30d236(0x1b3)](_0x1ab56f)&&_0x1ab56f>=0x1&&_0x1ab56f<=_0x472466[_0x30d236(0x1b4)])return _0x3bdb3c['close'](),_0x1ab56f-0x1;process[_0x30d236(0x1e7)][_0x30d236(0x1b1)](_0x30d236(0x1c2)+_0x472466[_0x30d236(0x1b4)]+'.\x0a');}}function buildFilePath(_0x3e585e,_0x381d84,_0x541416,_0x827ae8){const _0x4170b5=a37_0x16b259;if(_0x381d84==='HOOK'){if(!_0x827ae8)throw CliErrors[_0x4170b5(0x1e6)](_0x4170b5(0x1eb));const _0x6daf29=_0x827ae8[_0x4170b5(0x19f)]??_0x827ae8[_0x4170b5(0x1ab)];return join(_0x3e585e[_0x4170b5(0x1bd)],_0x4170b5(0x1f0),_0x6daf29,_0x827ae8[_0x4170b5(0x1a2)],_0x827ae8[_0x4170b5(0x1b7)],_0x541416+_0x4170b5(0x1f7));}return join(_0x3e585e['scriptsRootDir'],_0x381d84,_0x541416+_0x4170b5(0x1f7));}export function generateTemplate(_0x71ce88,_0x3d87e7,_0x2ff443,_0x26535a,_0x555129){const _0x24c493=a37_0x16b259,_0x7b6472=_0x26535a?.[_0x24c493(0x1f5)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3b9e88=getAppBaseUrl(_0x2ff443),_0x25c06d='\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(_0x71ce88==='COMMON')return _0x24c493(0x1bb)+_0x7b6472+_0x24c493(0x193)+_0x3d87e7+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x199)+_0x2ff443+_0x24c493(0x1ef)+_0x3d87e7+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x3d87e7+_0x24c493(0x1f1)+_0x25c06d+_0x24c493(0x1a0)+_0x3d87e7+_0x24c493(0x19b);if(_0x71ce88===_0x24c493(0x1e3))return _0x24c493(0x1bb)+_0x7b6472+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x3d87e7+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x2ff443+'/'+_0x3d87e7+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x199)+_0x2ff443+_0x24c493(0x1aa)+_0x3d87e7+'.js\x0a'+_0x25c06d+'\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'+_0x3d87e7+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x555129)throw CliErrors['validation']('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x28e266=_0x555129[_0x24c493(0x19f)]??_0x555129[_0x24c493(0x1ab)],_0x10e072=_0x555129[_0x24c493(0x1b7)]===_0x24c493(0x1c0)?'当前请求参数':_0x24c493(0x1ee),_0x336c4c=_0x555129[_0x24c493(0x1b7)]===_0x24c493(0x1c0)?_0x24c493(0x1e2):_0x24c493(0x1ac);return'/**\x0a\x20*\x20'+_0x7b6472+_0x24c493(0x192)+_0x3d87e7+_0x24c493(0x1ad)+_0x2ff443+'/'+_0x555129[_0x24c493(0x1ab)]+'/'+_0x555129[_0x24c493(0x1a2)]+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x1ba)+_0x555129[_0x24c493(0x1e4)]+_0x24c493(0x1c8)+_0x2ff443+_0x24c493(0x1fd)+_0x28e266+'/'+_0x555129[_0x24c493(0x1a2)]+'/'+_0x555129['functionNode']+'/'+_0x3d87e7+_0x24c493(0x1c9)+_0x555129[_0x24c493(0x1b7)]+'\x0a'+_0x25c06d+_0x24c493(0x1a8)+_0x10e072+_0x24c493(0x1d6)+_0x336c4c+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x3d87e7+_0x24c493(0x19b);}
|
|
1
|
+
function a37_0x5859(){const _0x51e10a=['/HOOK/','COMMON','datasetId','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','stdin','\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','当前响应结果','alias','isInteger','write','修改后的请求参数','\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','/data/dataset/','nonInteractive','length','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Available\x20aliases:\x20','ENDPOINT','当前请求参数','Script\x20description','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','entries','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','Invalid\x20function\x20name\x20\x22','functionNode','currentApp','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','No\x20datasets\x20found\x20for\x20this\x20app.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','\x22\x20not\x20found.\x20','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','\x0a\x20*\x20[平台配置]\x20','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','close','965132ghHtDU','Alias\x20\x22','\x20function:\x20','Select\x20operation\x20type:','str','Select\x20dataset:','after','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x22\x20not\x20found\x20for\x20dataset\x20','File\x20already\x20exists:\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','/**\x0a\x20*\x20','No\x20model\x20aliases\x20found.\x20Run\x20`','\x22,\x20params\x20})\x0a','question','trim','map','description','datasetcode','Created\x20','2221065oHGEfy','string','1278498WXuwtK','validation','6093488uMqsID','profileName','.js','filePath','type','datasetCode','before','2ykqmPu','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','mergedCli','operationType','defaultApp','Script\x20type','scriptsRootDir','UNKNOWN','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Select\x20trigger\x20node:','operation-type','19316zedoGE','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','HOOK\x20requires\x20alias/operation/node\x20options.','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','read','修改后的响应结果','source','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Function\x20name\x20(valid\x20JS\x20identifier)','stderr','11707206CCSJDb','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','1905qHlKPy','tableName','selectedAppName','HOOK',']\x20(','bff','Invalid\x20dataset\x20selection.','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','2627199RmPKet','appCode','.js\x0a','code','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','/ENDPOINT/','apiDir','name','find','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','/COMMON/'];a37_0x5859=function(){return _0x51e10a;};return a37_0x5859();}const a37_0x30e755=a37_0x29ed;(function(_0x274b5a,_0x3f6be2){const _0x11a53e=a37_0x29ed,_0x2b0a61=_0x274b5a();while(!![]){try{const _0x2ca9ce=-parseInt(_0x11a53e(0x19c))/0x1*(-parseInt(_0x11a53e(0x1bb))/0x2)+parseInt(_0x11a53e(0x16f))/0x3+-parseInt(_0x11a53e(0x15b))/0x4*(parseInt(_0x11a53e(0x167))/0x5)+-parseInt(_0x11a53e(0x1b2))/0x6+parseInt(_0x11a53e(0x165))/0x7+-parseInt(_0x11a53e(0x1b4))/0x8+parseInt(_0x11a53e(0x1b0))/0x9;if(_0x2ca9ce===_0x3f6be2)break;else _0x2b0a61['push'](_0x2b0a61['shift']());}catch(_0x565526){_0x2b0a61['push'](_0x2b0a61['shift']());}}}(a37_0x5859,0xe6d52));function a37_0x29ed(_0x2c14f2,_0xa4e469){_0x2c14f2=_0x2c14f2-0x155;const _0x5859f3=a37_0x5859();let _0x29ed56=_0x5859f3[_0x2c14f2];return _0x29ed56;}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';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';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x30e755(0x16c),'command':'create','description':a37_0x30e755(0x15e),'risk':a37_0x30e755(0x15f),'flags':[{'name':a37_0x30e755(0x1b8),'type':a37_0x30e755(0x1b1),'required':!![],'enum':['COMMON','ENDPOINT',a37_0x30e755(0x16a)],'description':a37_0x30e755(0x155)},{'name':a37_0x30e755(0x176),'type':a37_0x30e755(0x1b1),'required':!![],'description':a37_0x30e755(0x163)},{'name':a37_0x30e755(0x1ad),'type':'string','description':a37_0x30e755(0x18d)},{'name':a37_0x30e755(0x181),'type':a37_0x30e755(0x1b1),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x30e755(0x1ae),'type':'string','description':a37_0x30e755(0x1a6)},{'name':a37_0x30e755(0x15a),'type':'string','description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a37_0x30e755(0x1b1),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a37_0x30e755(0x1ba),a37_0x30e755(0x1a2)]}],async 'validate'(_0x111a67){const _0x3babaa=a37_0x30e755,_0x3d7c6a=_0x111a67[_0x3babaa(0x1a0)]('name');if(!isValidBffFunctionName(_0x3d7c6a))throw CliErrors[_0x3babaa(0x1b3)](_0x3babaa(0x191)+_0x3d7c6a+_0x3babaa(0x178));},async 'execute'(_0x745064){const _0x386af9=a37_0x30e755,_0x3bf740=loadBffProjectConfig(_0x745064[_0x386af9(0x170)]),_0x5aef45=_0x745064['str'](_0x386af9(0x1b8)),_0x3b81b5=_0x745064['str'](_0x386af9(0x176)),_0x5c1a24=_0x745064[_0x386af9(0x1a0)](_0x386af9(0x1ad))||undefined,_0x4ae82f=_0x5aef45==='HOOK'?await resolveHookOptions(_0x3bf740,_0x745064):undefined,_0x1e3253=buildFilePath(_0x3bf740,_0x5aef45,_0x3b81b5,_0x4ae82f);if(await fileExists(_0x1e3253))throw CliErrors[_0x386af9(0x1b3)](_0x386af9(0x1a5)+_0x1e3253);await mkdir(dirname(_0x1e3253),{'recursive':!![]});const _0x224563=generateTemplate(_0x5aef45,_0x3b81b5,_0x745064[_0x386af9(0x170)],_0x5c1a24,_0x4ae82f);await writeFile(_0x1e3253,_0x224563,'utf8');const _0x3cb251={'type':_0x5aef45,'name':_0x3b81b5,'path':_0x1e3253};if(_0x5c1a24)_0x3cb251['description']=_0x5c1a24;if(_0x4ae82f){if(_0x4ae82f['alias'])_0x3cb251[_0x386af9(0x181)]=_0x4ae82f[_0x386af9(0x181)];_0x3cb251[_0x386af9(0x1b9)]=_0x4ae82f[_0x386af9(0x1b9)],_0x3cb251[_0x386af9(0x1be)]=_0x4ae82f[_0x386af9(0x1be)],_0x3cb251['functionNode']=_0x4ae82f[_0x386af9(0x192)];}return{'ok':!![],'data':_0x3cb251,'message':_0x386af9(0x1af)+_0x5aef45+_0x386af9(0x19e)+_0x3b81b5};}};async function resolveHookOptions(_0x4bd916,_0x457a79){const _0xe227bd=a37_0x30e755,_0x5c5753=resolveApiModelSource(_0x457a79[_0xe227bd(0x175)],_0x457a79[_0xe227bd(0x170)],_0x457a79[_0xe227bd(0x169)]||_0x457a79['mergedCli']?.[_0xe227bd(0x193)]||_0x457a79[_0xe227bd(0x1bd)]?.[_0xe227bd(0x1bf)]),_0x3461ec=loadAliasMap(_0x457a79['apiDir'],undefined,_0x5c5753[_0xe227bd(0x1b7)],_0x5c5753[_0xe227bd(0x1b5)]),_0x5808a8=_0x3461ec['length']>0x0;let _0x132175,_0x529a38,_0x313442;const _0x20b693=_0x457a79[_0xe227bd(0x1a0)](_0xe227bd(0x181)),_0x5ab6f7=_0x457a79[_0xe227bd(0x1a0)](_0xe227bd(0x1ae));if(_0x20b693){const _0x4ddd8e=resolveAlias(_0x457a79['apiDir'],_0x20b693,undefined,_0x5c5753['filePath'],_0x5c5753[_0xe227bd(0x1b5)]);if(!_0x4ddd8e){const _0x4861e5=_0x5808a8?_0xe227bd(0x18a)+_0x3461ec[_0xe227bd(0x1ac)](_0x96fe93=>_0x96fe93[_0xe227bd(0x181)])['join'](',\x20'):_0xe227bd(0x1a8)+CLI_BIN_NAME+_0xe227bd(0x18e);throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x19d)+_0x20b693+_0xe227bd(0x197)+_0x4861e5);}_0x132175=_0x20b693,_0x529a38=_0x4ddd8e;}else{if(_0x5ab6f7){_0x529a38=_0x5ab6f7;const _0x1a1b0d=_0x3461ec[_0xe227bd(0x177)](_0x5d65ee=>_0x5d65ee['datasetCode']===_0x5ab6f7);_0x132175=_0x1a1b0d?.[_0xe227bd(0x181)];}else{if(_0x457a79[_0xe227bd(0x187)])throw CliErrors['validation']('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x5808a8){const _0xf6cc6=_0x3461ec[_0xe227bd(0x1ac)](_0xfae18f=>_0xfae18f[_0xe227bd(0x181)]+'\x20('+_0xfae18f[_0xe227bd(0x168)]+')'),_0x2fe9ce=await promptSelect(_0xe227bd(0x1a1),_0xf6cc6),_0x4b82a9=_0x3461ec[_0x2fe9ce];if(!_0x4b82a9)throw CliErrors['validation']('Invalid\x20dataset\x20selection.');_0x132175=_0x4b82a9[_0xe227bd(0x181)],_0x529a38=_0x4b82a9['datasetCode'];}else{const _0x27ad0c=await listDatasets(_0x457a79[_0xe227bd(0x170)]);if(_0x27ad0c[_0xe227bd(0x188)]===0x0)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x195));const _0x4fdc26=_0x27ad0c[_0xe227bd(0x1ac)](_0x8a9c47=>_0x8a9c47[_0xe227bd(0x176)]+'\x20['+(_0x8a9c47[_0xe227bd(0x161)]??_0xe227bd(0x157))+_0xe227bd(0x16b)+_0x8a9c47[_0xe227bd(0x172)]+')'),_0x610c6=await promptSelect(_0xe227bd(0x1a1),_0x4fdc26),_0x371907=_0x27ad0c[_0x610c6];if(!_0x371907)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x16d));_0x529a38=_0x371907[_0xe227bd(0x172)],_0x132175=undefined;}}}}const _0x580930=await listDatasets(_0x457a79[_0xe227bd(0x170)]),_0x358d66=_0x580930[_0xe227bd(0x177)](_0x4ca104=>_0x4ca104[_0xe227bd(0x172)]===_0x529a38);if(!_0x358d66)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x1a3)+_0x529a38+'\x22.\x20'+(_0x132175?_0xe227bd(0x16e)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x313442=_0x358d66['id'];const _0x16c433=_0x132175??_0x529a38,_0x173cf6=await listBffDatasetOperations(_0x457a79[_0xe227bd(0x170)],_0x313442),_0x35fb27=_0x173cf6?Object['keys'](_0x173cf6):[];if(_0x35fb27[_0xe227bd(0x188)]===0x0)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x189)+_0x16c433+'.');let _0x3f5b39;const _0x20ca1f=_0x457a79[_0xe227bd(0x1a0)]('operation-type');if(_0x20ca1f){if(!_0x35fb27['includes'](_0x20ca1f))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x20ca1f+_0xe227bd(0x1a4)+_0x16c433+'.\x20'+('Available:\x20'+_0x35fb27['join'](',\x20')));_0x3f5b39=_0x20ca1f;}else{if(_0x457a79[_0xe227bd(0x187)])throw CliErrors['validation'](_0xe227bd(0x166));const _0x472395=await promptSelect(_0xe227bd(0x19f),_0x35fb27);_0x3f5b39=_0x35fb27[_0x472395]??_0x35fb27[0x0];}let _0x1fc388=normalizeHookFunctionNode(_0x457a79[_0xe227bd(0x1a0)]('function-node'));if(!_0x1fc388){if(_0x457a79['str']('function-node'))throw CliErrors[_0xe227bd(0x1b3)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x457a79[_0xe227bd(0x187)])throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x162));const _0x174169=await promptSelect(_0xe227bd(0x159),[_0xe227bd(0x1ba),_0xe227bd(0x1a2)]);_0x1fc388=[_0xe227bd(0x1ba),_0xe227bd(0x1a2)][_0x174169]??_0xe227bd(0x1ba);}return{'alias':_0x132175,'datasetCode':_0x529a38,'datasetId':_0x313442,'operationType':_0x3f5b39,'functionNode':_0x1fc388};}async function promptSelect(_0x2153e2,_0x448d8a){const _0x1c8838=a37_0x30e755;if(_0x448d8a[_0x1c8838(0x188)]===0x1)return 0x0;for(const [_0x30579f,_0x2e5e36]of _0x448d8a[_0x1c8838(0x18f)]()){process['stderr'][_0x1c8838(0x183)]('\x20\x20'+(_0x30579f+0x1)+'.\x20'+_0x2e5e36+'\x0a');}const _0x288f88=createInterface({'input':process[_0x1c8838(0x17e)],'output':process[_0x1c8838(0x164)]});while(!![]){const _0x128f24=await new Promise(_0x59f3c0=>{const _0x3cbf66=_0x1c8838;_0x288f88[_0x3cbf66(0x1aa)](_0x2153e2+'\x20',_0x59f3c0);}),_0x30bf5d=Number['parseInt'](_0x128f24[_0x1c8838(0x1ab)](),0xa);if(Number[_0x1c8838(0x182)](_0x30bf5d)&&_0x30bf5d>=0x1&&_0x30bf5d<=_0x448d8a[_0x1c8838(0x188)])return _0x288f88[_0x1c8838(0x19b)](),_0x30bf5d-0x1;process[_0x1c8838(0x164)]['write']('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x448d8a[_0x1c8838(0x188)]+'.\x0a');}}function buildFilePath(_0x63fc68,_0x578d7e,_0x1bd4c1,_0x4d3f7d){const _0x5d950a=a37_0x30e755;if(_0x578d7e===_0x5d950a(0x16a)){if(!_0x4d3f7d)throw CliErrors['validation'](_0x5d950a(0x15d));const _0x1148a4=_0x4d3f7d[_0x5d950a(0x181)]??_0x4d3f7d[_0x5d950a(0x1b9)];return join(_0x63fc68[_0x5d950a(0x156)],_0x5d950a(0x16a),_0x1148a4,_0x4d3f7d[_0x5d950a(0x1be)],_0x4d3f7d[_0x5d950a(0x192)],_0x1bd4c1+_0x5d950a(0x1b6));}return join(_0x63fc68[_0x5d950a(0x156)],_0x578d7e,_0x1bd4c1+'.js');}export function generateTemplate(_0x4c5ad1,_0x7cc6b3,_0x512973,_0x4b4557,_0x245b0e){const _0x46ecd0=a37_0x30e755,_0x154497=_0x4b4557?.[_0x46ecd0(0x1ab)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x9d72ca=getAppBaseUrl(_0x512973),_0x2b6ef5=_0x46ecd0(0x173);if(_0x4c5ad1===_0x46ecd0(0x17b))return _0x46ecd0(0x1a7)+_0x154497+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x7cc6b3+_0x46ecd0(0x199)+_0x9d72ca+_0x46ecd0(0x194)+_0x512973+_0x46ecd0(0x179)+_0x7cc6b3+_0x46ecd0(0x19a)+_0x7cc6b3+_0x46ecd0(0x1a9)+_0x2b6ef5+_0x46ecd0(0x185)+_0x7cc6b3+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x4c5ad1===_0x46ecd0(0x18b))return _0x46ecd0(0x1a7)+_0x154497+_0x46ecd0(0x196)+_0x7cc6b3+_0x46ecd0(0x15c)+_0x512973+'/'+_0x7cc6b3+_0x46ecd0(0x199)+_0x9d72ca+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x512973+_0x46ecd0(0x174)+_0x7cc6b3+_0x46ecd0(0x171)+_0x2b6ef5+_0x46ecd0(0x17f)+_0x7cc6b3+_0x46ecd0(0x17d);if(!_0x245b0e)throw CliErrors[_0x46ecd0(0x1b3)](_0x46ecd0(0x190));const _0x1ea3ca=_0x245b0e[_0x46ecd0(0x181)]??_0x245b0e['datasetCode'],_0x542b00=_0x245b0e[_0x46ecd0(0x192)]===_0x46ecd0(0x1ba)?_0x46ecd0(0x18c):_0x46ecd0(0x180),_0xe9ca03=_0x245b0e[_0x46ecd0(0x192)]===_0x46ecd0(0x1ba)?_0x46ecd0(0x184):_0x46ecd0(0x160);return _0x46ecd0(0x1a7)+_0x154497+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x7cc6b3+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x512973+'/'+_0x245b0e[_0x46ecd0(0x1b9)]+'/'+_0x245b0e[_0x46ecd0(0x1be)]+_0x46ecd0(0x199)+_0x9d72ca+_0x46ecd0(0x186)+_0x245b0e[_0x46ecd0(0x17c)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x512973+_0x46ecd0(0x17a)+_0x1ea3ca+'/'+_0x245b0e[_0x46ecd0(0x1be)]+'/'+_0x245b0e[_0x46ecd0(0x192)]+'/'+_0x7cc6b3+'.js\x0a\x20*\x20[触发节点]\x20'+_0x245b0e[_0x46ecd0(0x192)]+'\x0a'+_0x2b6ef5+_0x46ecd0(0x1bc)+_0x542b00+_0x46ecd0(0x198)+_0xe9ca03+_0x46ecd0(0x158)+_0x7cc6b3+_0x46ecd0(0x17d);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x5db290=a38_0x4573;(function(_0x141b79,_0x2e148a){const _0x3aa86b=a38_0x4573,_0x16bc57=_0x141b79();while(!![]){try{const _0x26143e=-parseInt(_0x3aa86b(0x194))/0x1+parseInt(_0x3aa86b(0x195))/0x2*(parseInt(_0x3aa86b(0x171))/0x3)+-parseInt(_0x3aa86b(0x183))/0x4+-parseInt(_0x3aa86b(0x17b))/0x5*(parseInt(_0x3aa86b(0x172))/0x6)+-parseInt(_0x3aa86b(0x17e))/0x7+-parseInt(_0x3aa86b(0x197))/0x8*(parseInt(_0x3aa86b(0x18b))/0x9)+parseInt(_0x3aa86b(0x174))/0xa*(parseInt(_0x3aa86b(0x177))/0xb);if(_0x26143e===_0x2e148a)break;else _0x16bc57['push'](_0x16bc57['shift']());}catch(_0x3bb230){_0x16bc57['push'](_0x16bc57['shift']());}}}(a38_0x329f,0x8bce0));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';function a38_0x329f(){const _0x1c950e=['map','3832368ycYTmq','filter','scriptsRoot','Deleted\x20','target','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','trashDir','Backend\x20Function\x20lock\x20file\x20not\x20found.','toISOString','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','validation','appCode','6jNzJuU','560778MTbhXL','high-risk-write','10yoBdWz','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','38314870WTRngq','apps','replace','stringify','55QhDaDQ','POST','functions','5056660KPWcMK','Lock\x20scope\x20for\x20app\x20\x22','Function\x20not\x20found:\x20','Would\x20delete\x20','No\x20lock\x20entry\x20found\x20for\x20\x22','1743612RmuEru','projectRoot','Local\x20delete\x20not\x20settled\x20for\x20','string','lockFilePath','delete','Multiple\x20functions\x20match\x20\x22','remoteId','18skVsQz','includes','split','length','lastSync','scriptsRootDir','parse','\x20\x20-\x20','startsWith','145998CJgXix','379936SvmTzF'];a38_0x329f=function(){return _0x1c950e;};return a38_0x329f();}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':'bff','command':'delete','description':a38_0x5db290(0x16e),'risk':a38_0x5db290(0x173),'flags':[{'name':a38_0x5db290(0x169),'type':a38_0x5db290(0x186),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x19ac31){const _0x52c18a=a38_0x5db290,_0x423790=loadBffProjectConfig(_0x19ac31[_0x52c18a(0x170)]),_0x1ccd56=await readBffLockFile(_0x423790[_0x52c18a(0x187)]);if(!_0x1ccd56)throw CliErrors[_0x52c18a(0x16f)](_0x52c18a(0x176));},async 'dryRun'(_0x8d4712){const _0x439aa6=a38_0x5db290,_0x49cbc2=loadBffProjectConfig(_0x8d4712[_0x439aa6(0x170)]),_0x19cf92=await readBffLockFile(_0x49cbc2[_0x439aa6(0x187)]);if(!_0x19cf92)throw CliErrors[_0x439aa6(0x16f)](_0x439aa6(0x16c));const {appLock:_0x27da0a}=ensureLockScope(_0x19cf92,_0x8d4712[_0x439aa6(0x170)],_0x49cbc2[_0x439aa6(0x199)],_0x439aa6(0x188)),_0x3099f5=_0x8d4712['str']('target'),_0x2022a3=Object['keys'](_0x27da0a[_0x439aa6(0x17d)]),_0x5b921b=resolveDeleteTarget(_0x3099f5,_0x2022a3),_0x553a2b=_0x27da0a[_0x439aa6(0x17d)][_0x5b921b];if(!_0x553a2b)throw CliErrors[_0x439aa6(0x16f)](_0x439aa6(0x182)+_0x5b921b+'\x22.');const _0x370aa2=resolveLocalFilePathFromLockKey(_0x49cbc2,_0x5b921b),_0x2db96f=relative(_0x49cbc2[_0x439aa6(0x184)],_0x370aa2),_0x2b4a25=join(_0x49cbc2['trashDir'],'<timestamp>',_0x2db96f);return{'method':_0x439aa6(0x17c),'url':'/api/management/library/scripts/delete','body':{'appCode':_0x8d4712[_0x439aa6(0x170)],'target':_0x5b921b,'remoteId':_0x553a2b[_0x439aa6(0x18a)],'localFilePath':_0x370aa2,'trashedPath':_0x2b4a25},'description':_0x439aa6(0x181)+_0x5b921b+_0x439aa6(0x16a)};},async 'execute'(_0x420431){const _0x5dad94=a38_0x5db290,_0x52c44a=loadBffProjectConfig(_0x420431[_0x5dad94(0x170)]),_0x3031f3=await readBffLockFile(_0x52c44a[_0x5dad94(0x187)]);if(!_0x3031f3)throw CliErrors['validation'](_0x5dad94(0x16c));const {lockData:_0xc0778c,appLock:_0x3f8837}=ensureLockScope(_0x3031f3,_0x420431['appCode'],_0x52c44a['scriptsRoot'],_0x5dad94(0x188)),_0x3d9b76=JSON[_0x5dad94(0x191)](JSON[_0x5dad94(0x17a)](_0xc0778c)),_0x44bf59=_0x3d9b76[_0x5dad94(0x178)][_0x420431[_0x5dad94(0x170)]];if(!_0x44bf59)throw new Error(_0x5dad94(0x17f)+_0x420431[_0x5dad94(0x170)]+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x25f126=_0x420431['str'](_0x5dad94(0x169)),_0x977841=Object['keys'](_0x44bf59[_0x5dad94(0x17d)]),_0x57ec5a=resolveDeleteTarget(_0x25f126,_0x977841),_0x478f3f=_0x44bf59[_0x5dad94(0x17d)][_0x57ec5a];if(!_0x478f3f)throw CliErrors[_0x5dad94(0x16f)](_0x5dad94(0x182)+_0x57ec5a+'\x22.');await deleteBffScript(_0x478f3f[_0x5dad94(0x18a)]),delete _0x44bf59['functions'][_0x57ec5a],_0x44bf59[_0x5dad94(0x18f)]=new Date()[_0x5dad94(0x16d)](),await writeBffLockFile(_0x52c44a['lockFilePath'],_0x3d9b76);const _0x3aab11=resolveLocalFilePathFromLockKey(_0x52c44a,_0x57ec5a);let _0x5e0fb9;await fileExists(_0x3aab11)&&(_0x5e0fb9=await moveToTrash(_0x52c44a['projectRoot'],_0x52c44a[_0x5dad94(0x16b)],_0x3aab11),await cleanupEmptyDirectories(dirname(_0x3aab11),_0x52c44a[_0x5dad94(0x190)]));await waitForDeleteSettlement(_0x52c44a[_0x5dad94(0x187)],_0x420431[_0x5dad94(0x170)],_0x57ec5a,_0x3aab11),await sleep(0x96);const _0x8e299e={'deleted':_0x57ec5a,'remoteId':_0x478f3f['remoteId']};if(_0x5e0fb9)_0x8e299e['trashedTo']=_0x5e0fb9;return{'ok':!![],'data':_0x8e299e,'message':_0x5dad94(0x19a)+_0x57ec5a+(_0x5e0fb9?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a38_0x4573(_0x3ea50e,_0x56ecde){_0x3ea50e=_0x3ea50e-0x169;const _0x329ff2=a38_0x329f();let _0x4573b1=_0x329ff2[_0x3ea50e];return _0x4573b1;}function resolveDeleteTarget(_0x44347a,_0x35ac68){const _0x5d62bf=a38_0x5db290;if(_0x44347a[_0x5d62bf(0x18c)]('/')){const _0x4c2d15=_0x35ac68['find'](_0x1ed08e=>_0x1ed08e===_0x44347a);if(!_0x4c2d15)throw CliErrors['validation'](_0x5d62bf(0x180)+_0x44347a);return _0x4c2d15;}const _0x401b5e=_0x35ac68[_0x5d62bf(0x198)](_0x3be6a3=>_0x3be6a3[_0x5d62bf(0x18d)]('/')['at'](-0x1)===_0x44347a);if(_0x401b5e[_0x5d62bf(0x18e)]===0x0)throw CliErrors['validation'](_0x5d62bf(0x180)+_0x44347a);if(_0x401b5e[_0x5d62bf(0x18e)]>0x1)throw CliErrors['validation'](_0x5d62bf(0x189)+_0x44347a+_0x5d62bf(0x175)+_0x401b5e[_0x5d62bf(0x196)](_0x478efa=>_0x5d62bf(0x192)+_0x478efa)['join']('\x0a'));return _0x401b5e[0x0];}async function moveToTrash(_0x236485,_0x580f03,_0x447a48){const _0x2b2804=a38_0x5db290,_0x362420=new Date()[_0x2b2804(0x16d)]()[_0x2b2804(0x179)](/[:.]/g,'-'),_0x52cb6d=relative(_0x236485,_0x447a48),_0x46514f=join(_0x580f03,_0x362420,_0x52cb6d);return await mkdir(dirname(_0x46514f),{'recursive':!![]}),await rename(_0x447a48,_0x46514f),_0x46514f;}async function cleanupEmptyDirectories(_0x187149,_0x2ce1f9){const _0x249618=a38_0x5db290;let _0x31cad8=resolve(_0x187149);const _0x2cfd21=resolve(_0x2ce1f9);while(_0x31cad8[_0x249618(0x193)](''+_0x2cfd21+sep)||_0x31cad8===_0x2cfd21){if(_0x31cad8===_0x2cfd21)return;try{const _0xbdb9f0=await readdir(_0x31cad8);if(_0xbdb9f0['length']>0x0)return;await rmdir(_0x31cad8);}catch{return;}_0x31cad8=dirname(_0x31cad8);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x3fb12e,_0x9898b5,_0x311e47,_0x9a78c7){const _0xb5fa79=a38_0x5db290;for(let _0x286bd3=0x0;_0x286bd3<DELETE_SETTLE_RETRY_COUNT;_0x286bd3+=0x1){const _0x5bcbe4=await readBffLockFile(_0x3fb12e),_0x37798d=!!_0x5bcbe4?.['apps']?.[_0x9898b5]?.[_0xb5fa79(0x17d)]?.[_0x311e47],_0x1969d6=await fileExists(_0x9a78c7);if(!_0x37798d&&!_0x1969d6)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0xb5fa79(0x185)+_0x311e47+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x249099=a39_0x12d7;function a39_0x12d7(_0x53977f,_0x22adc8){_0x53977f=_0x53977f-0x129;const _0xdb648a=a39_0xdb64();let _0x12d7a1=_0xdb648a[_0x53977f];return _0x12d7a1;}function a39_0xdb64(){const _0x1a92d1=['updatedTime','scriptType','15084390IzSekB','2387403WOtlVC','bff','updateUserName','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','read','number','368466tPmqOG','4314QZfkDR','scriptContent','46014MzsPDQ','590ZodyfY','145wuWdll','version','1655556bNSZDv','functionName','boolean','(none)','detail','184RrrAHd','128807bVtIWc','Return\x20full\x20raw\x20script\x20object','description','appCode','verbose','Script\x20ID'];a39_0xdb64=function(){return _0x1a92d1;};return a39_0xdb64();}(function(_0x4063ce,_0x289cf5){const _0x403f98=a39_0x12d7,_0x1f012d=_0x4063ce();while(!![]){try{const _0x29cd0b=-parseInt(_0x403f98(0x12d))/0x1+parseInt(_0x403f98(0x131))/0x2*(-parseInt(_0x403f98(0x12e))/0x3)+parseInt(_0x403f98(0x134))/0x4+-parseInt(_0x403f98(0x132))/0x5*(parseInt(_0x403f98(0x130))/0x6)+parseInt(_0x403f98(0x13a))/0x7*(-parseInt(_0x403f98(0x139))/0x8)+-parseInt(_0x403f98(0x143))/0x9+parseInt(_0x403f98(0x142))/0xa;if(_0x29cd0b===_0x289cf5)break;else _0x1f012d['push'](_0x1f012d['shift']());}catch(_0x2a1f54){_0x1f012d['push'](_0x1f012d['shift']());}}}(a39_0xdb64,0x35689));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x249099(0x144),'command':a39_0x249099(0x138),'description':a39_0x249099(0x12a),'risk':a39_0x249099(0x12b),'flags':[{'name':'id','type':a39_0x249099(0x12c),'required':!![],'description':a39_0x249099(0x13f)},{'name':'verbose','type':a39_0x249099(0x136),'description':a39_0x249099(0x13b)}],async 'execute'(_0x122cc0){const _0x3bd92c=a39_0x249099,_0x49cebd=await getBffScriptInfo(_0x122cc0['num']('id')),_0x293d7e=_0x122cc0['bool'](_0x3bd92c(0x13e));if(_0x293d7e)return{'ok':!![],'data':_0x49cebd};return{'ok':!![],'data':{'id':_0x49cebd['id'],'functionName':_0x49cebd[_0x3bd92c(0x135)]??'','version':_0x49cebd[_0x3bd92c(0x133)]??'','updateUserName':_0x49cebd[_0x3bd92c(0x129)]??'','appCode':_0x49cebd[_0x3bd92c(0x13d)],'scriptType':_0x49cebd[_0x3bd92c(0x141)],'description':_0x49cebd[_0x3bd92c(0x13c)]||_0x3bd92c(0x137),'createdTime':_0x49cebd['createdTime']??'','updatedTime':_0x49cebd[_0x3bd92c(0x140)]??'','scriptContent':_0x49cebd[_0x3bd92c(0x12f)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a40_0x1a60(_0x5cea25,_0x5c5558){_0x5cea25=_0x5cea25-0x15f;const _0x47ae5f=a40_0x47ae();let _0x1a6019=_0x47ae5f[_0x5cea25];return _0x1a6019;}(function(_0x4c652c,_0x4df5e9){const _0x3f05b4=a40_0x1a60,_0x454321=_0x4c652c();while(!![]){try{const _0x38e264=-parseInt(_0x3f05b4(0x162))/0x1*(parseInt(_0x3f05b4(0x16b))/0x2)+parseInt(_0x3f05b4(0x164))/0x3*(parseInt(_0x3f05b4(0x167))/0x4)+parseInt(_0x3f05b4(0x15f))/0x5*(-parseInt(_0x3f05b4(0x169))/0x6)+parseInt(_0x3f05b4(0x166))/0x7*(parseInt(_0x3f05b4(0x161))/0x8)+-parseInt(_0x3f05b4(0x165))/0x9*(parseInt(_0x3f05b4(0x160))/0xa)+parseInt(_0x3f05b4(0x163))/0xb*(parseInt(_0x3f05b4(0x16a))/0xc)+-parseInt(_0x3f05b4(0x168))/0xd;if(_0x38e264===_0x4df5e9)break;else _0x454321['push'](_0x454321['shift']());}catch(_0x40ddd6){_0x454321['push'](_0x454321['shift']());}}}(a40_0x47ae,0xea88f));import{bffList}from'../../commands/bff/list.js';function a40_0x47ae(){const _0x4d23a2=['112YkFroN','1021fxfCPr','4939HofMTg','108OGxrSG','1106883LQEfOq','954086NqpHhL','179016nKhzce','12331475rMieWk','180cOwXvT','46452Urpttr','2434DKhMlT','63965PfGptr','140EaEndR'];a40_0x47ae=function(){return _0x4d23a2;};return a40_0x47ae();}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';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x25f38e=a41_0x210e;function a41_0x210e(_0x1b4df8,_0x23f51f){_0x1b4df8=_0x1b4df8-0xaa;const _0x35fc16=a41_0x35fc();let _0x210ece=_0x35fc16[_0x1b4df8];return _0x210ece;}function a41_0x35fc(){const _0x1982b1=['name','read','bff','list','No\x20Backend\x20Function\x20scripts\x20found.','318Zizxie','type','5071599ihITKE','2933679QujeMf','6647424RLYCKG','2869390DMRmAF','Return\x20full\x20script\x20objects','1188406gzLMAT','string','2PLSuLD','11221lzrQDz','List\x20Backend\x20Function\x20scripts','boolean','appCode','(unnamed)','1386248GNWKhw','Filter\x20by\x20script\x20name','str','description','verbose','ENDPOINT','map'];a41_0x35fc=function(){return _0x1982b1;};return a41_0x35fc();}(function(_0x1e01fc,_0x184e06){const _0x531abb=a41_0x210e,_0x3309ea=_0x1e01fc();while(!![]){try{const _0x5a1965=parseInt(_0x531abb(0xb2))/0x1*(-parseInt(_0x531abb(0xb4))/0x2)+parseInt(_0x531abb(0xae))/0x3+parseInt(_0x531abb(0xba))/0x4+parseInt(_0x531abb(0xb0))/0x5+parseInt(_0x531abb(0xab))/0x6*(-parseInt(_0x531abb(0xb5))/0x7)+parseInt(_0x531abb(0xaf))/0x8+-parseInt(_0x531abb(0xad))/0x9;if(_0x5a1965===_0x184e06)break;else _0x3309ea['push'](_0x3309ea['shift']());}catch(_0x3895d2){_0x3309ea['push'](_0x3309ea['shift']());}}}(a41_0x35fc,0xd9de1));import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x25f38e(0xc3),'command':a41_0x25f38e(0xc4),'description':a41_0x25f38e(0xb6),'risk':a41_0x25f38e(0xc2),'flags':[{'name':a41_0x25f38e(0xac),'type':a41_0x25f38e(0xb3),'description':'Script\x20type\x20filter','default':a41_0x25f38e(0xbf),'enum':[a41_0x25f38e(0xbf),'COMMON']},{'name':a41_0x25f38e(0xc1),'type':'string','description':a41_0x25f38e(0xbb)},{'name':a41_0x25f38e(0xbe),'type':a41_0x25f38e(0xb7),'description':a41_0x25f38e(0xb1)}],async 'execute'(_0x2600b9){const _0x56fc58=a41_0x25f38e,_0x4e9169=await listBffScripts(_0x2600b9[_0x56fc58(0xb8)],_0x2600b9[_0x56fc58(0xbc)]('type'),{'scriptName':_0x2600b9['str']('name')||undefined}),_0x2f3265=_0x2600b9['bool'](_0x56fc58(0xbe));return{'ok':!![],'data':_0x2f3265?_0x4e9169:_0x4e9169[_0x56fc58(0xc0)](_0x24b1ac=>({'id':_0x24b1ac['id'],'functionName':_0x24b1ac['functionName']??'','description':_0x24b1ac[_0x56fc58(0xbd)]||_0x56fc58(0xb9),'scriptType':_0x24b1ac['scriptType']})),'message':_0x4e9169['length']===0x0?_0x56fc58(0xaa):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x1798b1=a42_0x3218;(function(_0x49d68f,_0xc17aa4){const _0x2e334f=a42_0x3218,_0x4c7686=_0x49d68f();while(!![]){try{const _0x429c5c=-parseInt(_0x2e334f(0x85))/0x1*(parseInt(_0x2e334f(0x8c))/0x2)+parseInt(_0x2e334f(0x9b))/0x3+parseInt(_0x2e334f(0x92))/0x4+-parseInt(_0x2e334f(0x76))/0x5*(-parseInt(_0x2e334f(0x94))/0x6)+-parseInt(_0x2e334f(0x79))/0x7+-parseInt(_0x2e334f(0x74))/0x8+parseInt(_0x2e334f(0x87))/0x9;if(_0x429c5c===_0xc17aa4)break;else _0x4c7686['push'](_0x4c7686['shift']());}catch(_0xd93458){_0x4c7686['push'](_0x4c7686['shift']());}}}(a42_0x51c1,0x71b39));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';function a42_0x3218(_0x265aa9,_0x1f15d8){_0x265aa9=_0x265aa9-0x74;const _0x51c1e6=a42_0x51c1();let _0x32185b=_0x51c1e6[_0x265aa9];return _0x32185b;}import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x1798b1(0x9a),'INFO',a42_0x1798b1(0x8d),a42_0x1798b1(0x7d)];export function resolveBffLogQuery(_0x34d16d,_0x132654=Date[a42_0x1798b1(0x9c)]()){const _0x200650=a42_0x1798b1,_0x44a65e=_0x34d16d[_0x200650(0x84)](_0x200650(0x91)),_0x5183fa=_0x34d16d[_0x200650(0x84)](_0x200650(0x90)),_0x5a5f4e=_0x34d16d[_0x200650(0x84)](_0x200650(0x77));if(_0x44a65e!==undefined&&_0x5183fa!==undefined)throw CliErrors['validation']('--since\x20cannot\x20be\x20combined\x20with\x20--start-time.');const _0x1206de=_0x5a5f4e===undefined?_0x132654:readPositiveInteger(_0x34d16d[_0x200650(0x78)]('end-time'),_0x200650(0x7a)),_0x2160db=_0x5183fa===undefined?_0x1206de-readSinceMinutes(_0x34d16d)*0xea60:readPositiveInteger(_0x34d16d[_0x200650(0x78)](_0x200650(0x90)),_0x200650(0x95));if(_0x2160db<=0x0)throw CliErrors[_0x200650(0x8a)]('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x2160db>_0x1206de)throw CliErrors[_0x200650(0x8a)](_0x200650(0x93));const _0x172677=readPositiveInteger(_0x34d16d['num'](_0x200650(0x96),DEFAULT_LIMIT),'--limit');if(_0x172677>MAX_LIMIT)throw CliErrors[_0x200650(0x8a)](_0x200650(0x97)+MAX_LIMIT+'.');const _0x5c87b5=_0x34d16d[_0x200650(0x7f)](_0x200650(0x89))['trim']()[_0x200650(0x81)]()||undefined,_0x367841=_0x34d16d[_0x200650(0x7f)](_0x200650(0x98))[_0x200650(0x7c)]()||undefined;return{'appCode':_0x34d16d[_0x200650(0x8e)],'startTime':_0x2160db,'endTime':_0x1206de,..._0x5183fa===undefined?{'sinceMinutes':readSinceMinutes(_0x34d16d)}:{},..._0x5c87b5?{'level':_0x5c87b5}:{},..._0x367841?{'keyword':_0x367841}:{},'limit':_0x172677};}function a42_0x51c1(){const _0x3d8769=['level','validation','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','1855890zsXlMb','WARN','appCode','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','start-time','since','515528zZNtzn','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','1460946DeRTJG','--start-time','limit','--limit\x20must\x20be\x20between\x201\x20and\x20','keyword','Filter\x20by\x20log\x20level','DEBUG','842091tKfbIS','now','7359432pXxEfX','isSafeInteger','10lmoinI','end-time','num','1864100gGkWJy','--end-time','\x20must\x20be\x20a\x20positive\x20integer.','trim','ERROR','length','str','number','toUpperCase','string','\x20Backend\x20Function\x20log\x20line(s).','flag','1gKkTSI','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','15150006PPJScP','--since'];a42_0x51c1=function(){return _0x3d8769;};return a42_0x51c1();}function readSinceMinutes(_0x18cb60){const _0x52a291=a42_0x1798b1;return readPositiveInteger(_0x18cb60[_0x52a291(0x78)](_0x52a291(0x91),DEFAULT_SINCE_MINUTES),_0x52a291(0x88));}function readPositiveInteger(_0x1c4f1d,_0x2546a3){const _0x49386b=a42_0x1798b1;if(!Number[_0x49386b(0x75)](_0x1c4f1d)||_0x1c4f1d<=0x0)throw CliErrors[_0x49386b(0x8a)](_0x2546a3+_0x49386b(0x7b));return _0x1c4f1d;}export const bffLogs={'service':'bff','command':'logs','description':a42_0x1798b1(0x8b),'risk':'read','structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x1798b1(0x91),'type':'number','description':'Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20'+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x1798b1(0x90),'type':a42_0x1798b1(0x80),'description':a42_0x1798b1(0x86)},{'name':a42_0x1798b1(0x77),'type':'number','description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0x1798b1(0x89),'type':'string','description':a42_0x1798b1(0x99),'enum':LOG_LEVELS},{'name':'keyword','type':a42_0x1798b1(0x82),'description':a42_0x1798b1(0x8f)},{'name':a42_0x1798b1(0x96),'type':a42_0x1798b1(0x80),'description':'Maximum\x20log\x20lines\x20to\x20return\x20(1-'+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x517393){resolveBffLogQuery(_0x517393);},async 'execute'(_0x3019dc){const _0x1972e4=a42_0x1798b1,_0x33fb58=resolveBffLogQuery(_0x3019dc),{sinceMinutes:_0x3ae0b4,..._0x116148}=_0x33fb58,_0x8726a5=await searchBffScriptLogs(_0x116148);return{'ok':!![],'data':{'query':_0x33fb58,'count':_0x8726a5[_0x1972e4(0x7e)],'logs':_0x8726a5},'message':_0x8726a5[_0x1972e4(0x7e)]===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':'Found\x20'+_0x8726a5[_0x1972e4(0x7e)]+_0x1972e4(0x83)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x4d5031=a43_0x1a84;(function(_0xf7319c,_0x4e959b){const _0x5b6823=a43_0x1a84,_0x419645=_0xf7319c();while(!![]){try{const _0x21fe1c=-parseInt(_0x5b6823(0x1b6))/0x1+-parseInt(_0x5b6823(0x1c1))/0x2*(-parseInt(_0x5b6823(0x1ba))/0x3)+-parseInt(_0x5b6823(0x1d4))/0x4+-parseInt(_0x5b6823(0x1c7))/0x5*(parseInt(_0x5b6823(0x1cb))/0x6)+parseInt(_0x5b6823(0x1e4))/0x7+parseInt(_0x5b6823(0x1d9))/0x8*(parseInt(_0x5b6823(0x1fe))/0x9)+parseInt(_0x5b6823(0x1b4))/0xa;if(_0x21fe1c===_0x4e959b)break;else _0x419645['push'](_0x419645['shift']());}catch(_0x2ab385){_0x419645['push'](_0x419645['shift']());}}}(a43_0x1ae3,0x8bd26));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';function a43_0x1a84(_0x1f6c96,_0x57a0ef){_0x1f6c96=_0x1f6c96-0x179;const _0x1ae37e=a43_0x1ae3();let _0x1a84c2=_0x1ae37e[_0x1f6c96];return _0x1a84c2;}import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';function a43_0x1ae3(){const _0x1d0585=['\x22:\x20','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','str','\x20skipped','mergedCli','Remote\x20script\x20missing\x20id.','stderr','selectedAppName','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','skipped','case-rename','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x20bff\x20push\x20--type\x20','scriptType','stringify','utf8','alias','COMMON','.js','ENDPOINT','\x22\x20to\x20\x22','map','write','operationType','45ggQuQh','HOOK','Remote\x20script\x20missing\x20content.','\x20Recovery\x20errors:\x20','code','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','requires','hookLocation','Pull\x20only\x20this\x20script\x20type','functions','BFF_LOCAL_UNSYNCED','entry','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','string','some','GET','newDirectoryPath','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','newDirectory','cancelled','set','lastSync','values','boolean','/api/management/library/scripts/list?appCode=','apiDir','migrations','profileName','\x20pulled','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','\x20resolution','version','dev','force','\x20failed','Force\x20pull\x20cancelled.','&type=','includes','push_local','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x20--format\x20compress','bool','\x22\x20may\x20remain.','.hook-directory-migrate-','pull','lockKey','\x22\x20and\x20\x22','Failed\x20to\x20write\x20local\x20script\x20\x22','\x22:\x20its\x20target\x20\x22','sourceDirectoryPathByNewDirectory','defaultApp','entries','scriptsRootDir','rollback','rekey','datasetCode','conflict','newLockKey','\x22:\x20both\x20target\x20\x22','scriptContent','ENOENT','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x22\x20from\x20\x22','split','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','functionName','scriptsRoot','toLowerCase','message','oldDirectory','4332070AUxwNW','\x22;\x20temporary\x20directory\x20\x22','420602ShBpOA','reverse','oldDirectoryPath','question','21309rydajq','nonInteractive','length','toISOString','normalize','delete','content','112eTYbcp','\x22\x20from\x20the\x20lock\x20file.','get','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','all','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','5zxNlkK','\x22\x20not\x20found\x20after\x20ensureLockScope.','move','type','2524260cbDtFR','oldLockKey','has','ino','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','lockFilePath','projectedFunctions','3140672cqrLGc','¤tPage=1&pageSize=','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.','functionNode','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','609608tZnjdb','mode','filePath','trim','keyChanges','unresolvable\x20target\x20path','validation','NFC','appCode','push','require','6910470IVlAam'];a43_0x1ae3=function(){return _0x1d0585;};return a43_0x1ae3();}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_0x4d5031(0x19a),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':'read','structuredErrors':!![],'flags':[{'name':a43_0x4d5031(0x1ca),'type':a43_0x4d5031(0x17b),'description':a43_0x4d5031(0x206),'enum':[a43_0x4d5031(0x1f7),a43_0x4d5031(0x1f9),a43_0x4d5031(0x1ff)]},{'name':a43_0x4d5031(0x18f),'type':a43_0x4d5031(0x185),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x24fb81){const _0x3f4790=a43_0x4d5031,_0x3394a1=loadBffProjectConfig(_0x24fb81['appCode']),_0x729e2c=await readBffLockFile(_0x3394a1[_0x3f4790(0x1d2)]),{appLock:_0x504b24}=ensureLockScope(_0x729e2c??createEmptyBffLock(),_0x24fb81['appCode'],_0x3394a1[_0x3f4790(0x1b0)],_0x3f4790(0x19a)),_0x579805=normalizeBffType(_0x24fb81['str'](_0x3f4790(0x1ca)))??undefined,[_0x327173,_0x49796e]=await Promise['all']([listBffScripts(_0x24fb81['appCode'],_0x579805),getBffScriptStatistics(_0x24fb81['appCode'])]),_0xfb7866=_0x327173['some'](_0x51958d=>normalizeBffType(_0x51958d[_0x3f4790(0x1f3)])==='HOOK'),_0x35ba94=_0xfb7866?buildDatasetCodeToAliasMap(_0x24fb81[_0x3f4790(0x187)],_0x24fb81['appCode'],_0x24fb81['selectedAppName']||_0x24fb81[_0x3f4790(0x1e9)]?.['currentApp']||_0x24fb81[_0x3f4790(0x1e9)]?.['defaultApp']):new Map(),_0xcf831e=_0xfb7866?await planHookDirectoryMigration(_0x3394a1,_0x504b24,_0x35ba94,await scanLocalBffFunctions(_0x3394a1,_0x3f4790(0x1ff))):undefined,_0x4df1a7=createHookLocationMap(_0x49796e),_0x439675=[];for(const _0x5eea18 of _0x327173){const _0x11cbae=resolveRemoteScriptTarget(_0x3394a1,_0x5eea18,_0x4df1a7,_0xcf831e?.[_0x3f4790(0x1d3)]??_0x504b24['functions'],_0x35ba94);if(!_0x11cbae){_0x439675[_0x3f4790(0x1e2)]({'scriptType':_0x5eea18[_0x3f4790(0x1f3)],'functionName':_0x5eea18[_0x3f4790(0x1af)]??'','status':_0x3f4790(0x1ee),'reason':'unresolvable\x20target\x20path'});continue;}const _0x18b61e=(_0xcf831e?.['projectedFunctions']??_0x504b24[_0x3f4790(0x207)])[_0x11cbae[_0x3f4790(0x19b)]],_0x493da9=_0x5eea18[_0x3f4790(0x1a9)]!=null?computeContentHash(_0x5eea18[_0x3f4790(0x1a9)]):undefined,_0x426351=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0xcf831e,_0x11cbae)??_0x11cbae[_0x3f4790(0x1db)],_0x18b61e,_0x493da9),_0x442d50=_0x426351?localUnsyncedConflict(_0x11cbae,_0x5eea18['id']):undefined;_0x439675[_0x3f4790(0x1e2)]({'lockKey':_0x11cbae[_0x3f4790(0x19b)],'filePath':_0x11cbae['filePath'],'remoteId':_0x5eea18['id']??null,'status':_0x442d50?_0x3f4790(0x1a6):'would_pull',..._0x442d50?{'conflict':_0x442d50}:{},..._0x11cbae[_0x3f4790(0x205)]?{'alias':_0x11cbae[_0x3f4790(0x205)]['alias']??null,'datasetCode':_0x11cbae[_0x3f4790(0x205)][_0x3f4790(0x1a5)],'operationType':_0x11cbae[_0x3f4790(0x205)][_0x3f4790(0x1fd)],'functionNode':_0x11cbae[_0x3f4790(0x205)]['functionNode']}:{}});}return{'method':_0x3f4790(0x17d),'url':_0x3f4790(0x186)+_0x24fb81[_0x3f4790(0x1e1)]+(_0x579805?_0x3f4790(0x192)+_0x579805:'')+_0x3f4790(0x1d5)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x24fb81[_0x3f4790(0x1e1)],'filterType':_0x579805??null,..._0xcf831e&&_0xcf831e[_0x3f4790(0x188)]['length']>0x0?{'hookDirectoryMigrations':_0xcf831e[_0x3f4790(0x188)][_0x3f4790(0x1fb)](_0x2fb1d6=>({'from':_0x2fb1d6[_0x3f4790(0x1b3)],'to':_0x2fb1d6[_0x3f4790(0x180)]}))}:{},'files':_0x439675},'description':'Would\x20inspect\x20'+_0x439675[_0x3f4790(0x1bc)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x237ade){const _0x4f9bb4=a43_0x4d5031,_0x3563a3=loadBffProjectConfig(_0x237ade[_0x4f9bb4(0x1e1)]),_0x22c256=await readBffLockFile(_0x3563a3[_0x4f9bb4(0x1d2)]),{lockData:_0x4ec4c9,appLock:_0x33202b}=ensureLockScope(_0x22c256??createEmptyBffLock(),_0x237ade[_0x4f9bb4(0x1e1)],_0x3563a3['scriptsRoot'],_0x4f9bb4(0x19a)),_0x4ddb5f=normalizeBffType(_0x237ade[_0x4f9bb4(0x1e7)]('type'))??undefined;if(_0x237ade[_0x4f9bb4(0x1e7)](_0x4f9bb4(0x1ca))&&!_0x4ddb5f)throw CliErrors['validation'](_0x4f9bb4(0x1cf));const [_0x9848b6,_0xf4be6a]=await Promise[_0x4f9bb4(0x1c5)]([listBffScripts(_0x237ade[_0x4f9bb4(0x1e1)],_0x4ddb5f),getBffScriptStatistics(_0x237ade[_0x4f9bb4(0x1e1)])]);if(_0x9848b6[_0x4f9bb4(0x1bc)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x4f9bb4(0x1f1)};const _0x4edfe4=_0x237ade[_0x4f9bb4(0x197)](_0x4f9bb4(0x18f));if(_0x4edfe4&&!_0x237ade[_0x4f9bb4(0x1bb)]){const _0x1a69aa=await confirmForce();if(!_0x1a69aa)throw CliErrors[_0x4f9bb4(0x181)](_0x4f9bb4(0x191));}if(_0x4edfe4&&_0x237ade[_0x4f9bb4(0x1bb)]){}const _0x5b5603=_0x9848b6[_0x4f9bb4(0x17c)](_0x194e21=>normalizeBffType(_0x194e21[_0x4f9bb4(0x1f3)])===_0x4f9bb4(0x1ff)),_0x5cf257=_0x5b5603?buildDatasetCodeToAliasMap(_0x237ade[_0x4f9bb4(0x187)],_0x237ade[_0x4f9bb4(0x1e1)],_0x237ade[_0x4f9bb4(0x1ec)]||_0x237ade[_0x4f9bb4(0x1e9)]?.['currentApp']||_0x237ade[_0x4f9bb4(0x1e9)]?.[_0x4f9bb4(0x1a0)]):new Map(),_0xb042d=createHookLocationMap(_0xf4be6a),_0x487bc1=JSON['parse'](JSON[_0x4f9bb4(0x1f4)](_0x4ec4c9)),_0x507ba0=_0x237ade[_0x4f9bb4(0x1e1)],_0x51281f=_0x487bc1['apps'][_0x507ba0];if(!_0x51281f)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x507ba0+_0x4f9bb4(0x1c8));const _0x5bfa67=_0x5b5603?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x3563a3,_0x51281f,_0x5cf257,await scanLocalBffFunctions(_0x3563a3,_0x4f9bb4(0x1ff))),_0x51281f):undefined,_0x435967=createPullFileTransaction(),_0x44b17a=[],_0x33cacc=[],_0x3c6f44=[],_0x46bdfa=[];for(const _0x562079 of _0x9848b6){const _0x34d8b0=resolveRemoteScriptTarget(_0x3563a3,_0x562079,_0xb042d,_0x51281f[_0x4f9bb4(0x207)],_0x5cf257);if(!_0x34d8b0){_0x33cacc[_0x4f9bb4(0x1e2)]({'lockKey':_0x562079[_0x4f9bb4(0x1f3)]+'/'+_0x562079[_0x4f9bb4(0x1af)],'reason':_0x4f9bb4(0x1de)});continue;}const _0x222ad2=_0x51281f['functions'][_0x34d8b0['lockKey']];try{if(!_0x562079['id'])throw new Error(_0x4f9bb4(0x1ea));if(_0x562079['scriptContent']==null)throw new Error(_0x4f9bb4(0x200));const _0x47f06a=_0x562079['scriptContent'],_0x4e20f6=computeContentHash(_0x47f06a);if(!_0x4edfe4){const _0x39b19c=await hasUnsyncedLocalChanges(_0x34d8b0[_0x4f9bb4(0x1db)],_0x222ad2,_0x4e20f6);if(_0x39b19c){_0x3c6f44[_0x4f9bb4(0x1e2)](localUnsyncedConflict(_0x34d8b0,_0x562079['id']));continue;}}await _0x435967[_0x4f9bb4(0x1fc)](_0x34d8b0[_0x4f9bb4(0x1db)],_0x47f06a);const _0x42809c={'hash':_0x4e20f6,'remoteId':_0x562079['id'],'version':_0x562079[_0x4f9bb4(0x18d)]};_0x34d8b0[_0x4f9bb4(0x1ca)]===_0x4f9bb4(0x1ff)&&_0x34d8b0[_0x4f9bb4(0x205)]&&(_0x42809c[_0x4f9bb4(0x1f6)]=_0x34d8b0['hookLocation']['alias'],_0x42809c[_0x4f9bb4(0x1a5)]=_0x34d8b0['hookLocation'][_0x4f9bb4(0x1a5)],_0x42809c['operationType']=_0x34d8b0['hookLocation']['operationType'],_0x42809c['functionNode']=_0x34d8b0[_0x4f9bb4(0x205)][_0x4f9bb4(0x1d7)]),_0x51281f[_0x4f9bb4(0x207)][_0x34d8b0['lockKey']]=_0x42809c,_0x44b17a[_0x4f9bb4(0x1e2)]({'lockKey':_0x34d8b0[_0x4f9bb4(0x19b)],'remoteId':_0x562079['id']});}catch(_0x1cb533){_0x46bdfa[_0x4f9bb4(0x1e2)]({'lockKey':_0x34d8b0[_0x4f9bb4(0x19b)],'error':_0x1cb533 instanceof Error?_0x1cb533[_0x4f9bb4(0x1b2)]:String(_0x1cb533)});}}_0x51281f[_0x4f9bb4(0x183)]=new Date()[_0x4f9bb4(0x1bd)]();try{await writeBffLockFile(_0x3563a3[_0x4f9bb4(0x1d2)],_0x487bc1);}catch(_0x370dc4){const _0x8bfb04=[...await _0x435967['rollback'](),...await _0x5bfa67?.[_0x4f9bb4(0x1a3)]()??[]];throw withRollbackErrors(_0x370dc4,_0x4f9bb4(0x17a),_0x8bfb04);}return{'ok':_0x46bdfa[_0x4f9bb4(0x1bc)]===0x0,'data':{'pulled':_0x44b17a,'skipped':_0x33cacc,'conflicts':_0x3c6f44,'failed':_0x46bdfa},'message':formatPullMessage(_0x44b17a[_0x4f9bb4(0x1bc)],_0x33cacc['length'],_0x3c6f44['length'],_0x46bdfa[_0x4f9bb4(0x1bc)])};}};function localUnsyncedConflict(_0x219241,_0x18e852){const _0x421ae4=a43_0x4d5031,_0x4894c7=_0x219241['lockKey']['split']('/')['at'](-0x1);return{'code':_0x421ae4(0x208),'lockKey':_0x219241[_0x421ae4(0x19b)],'filePath':_0x219241[_0x421ae4(0x1db)],..._0x18e852!=null?{'remoteId':_0x18e852}:{},'message':_0x421ae4(0x18b),'nextAction':{'action':_0x421ae4(0x194),'command':CLI_BIN_NAME+_0x421ae4(0x1f2)+_0x219241['type']+'\x20--name\x20'+_0x4894c7+_0x421ae4(0x196),'requiresReview':!![],'message':_0x421ae4(0x1d6)}};}function formatPullMessage(_0x108efd,_0x5c0020,_0x2f4504,_0x2d5986){const _0x28c865=a43_0x4d5031,_0x447d18=['Pull\x20complete:\x20'+_0x108efd+_0x28c865(0x18a),_0x5c0020+_0x28c865(0x1e8)];_0x2f4504>0x0&&_0x447d18['push'](_0x2f4504+'\x20conflict'+(_0x2f4504===0x1?'':'s')+'\x20'+(_0x2f4504===0x1?_0x28c865(0x204):_0x28c865(0x1e3))+_0x28c865(0x18c));if(_0x2d5986>0x0)_0x447d18[_0x28c865(0x1e2)](_0x2d5986+_0x28c865(0x190));return _0x447d18['join'](',\x20');}async function hasUnsyncedLocalChanges(_0xf97c74,_0x16abe1,_0x2fa2b6){if(!await fileExists(_0xf97c74))return![];const _0x378c2f=await computeFileHash(_0xf97c74);if(!_0x16abe1)return _0x2fa2b6?_0x378c2f!==_0x2fa2b6:!![];return _0x378c2f!==_0x16abe1['hash'];}function createPullFileTransaction(){const _0x443751=new Map(),_0xdad84b=async(_0x4835cd,_0x409fd4)=>{const _0x4d814b=a43_0x1a84;try{if(_0x409fd4['existed'])await ensureParentDirectory(_0x4835cd),await writeFile(_0x4835cd,_0x409fd4[_0x4d814b(0x1c0)]);else try{await unlink(_0x4835cd);}catch(_0x35e471){if(_0x35e471['code']!=='ENOENT')throw _0x35e471;}return undefined;}catch(_0x45fa84){return _0x45fa84 instanceof Error?_0x45fa84:new Error(String(_0x45fa84));}};return{async 'write'(_0x5370dc,_0x16f9a0){const _0x34541f=a43_0x1a84;if(!_0x443751[_0x34541f(0x1cd)](_0x5370dc))try{_0x443751['set'](_0x5370dc,{'existed':!![],'content':await readFile(_0x5370dc)});}catch(_0x5db3e5){if(_0x5db3e5[_0x34541f(0x202)]!==_0x34541f(0x1aa))throw _0x5db3e5;_0x443751[_0x34541f(0x182)](_0x5370dc,{'existed':![]});}try{await ensureParentDirectory(_0x5370dc),await writeFile(_0x5370dc,_0x16f9a0,_0x34541f(0x1f5));}catch(_0x4ffea7){const _0x23ecce=await _0xdad84b(_0x5370dc,_0x443751[_0x34541f(0x1c3)](_0x5370dc));if(!_0x23ecce)_0x443751[_0x34541f(0x1bf)](_0x5370dc);throw withRollbackErrors(_0x4ffea7,_0x34541f(0x19d)+_0x5370dc+'\x22.',_0x23ecce?[_0x23ecce]:[]);}},async 'rollback'(){const _0x2b7d38=a43_0x1a84,_0x1b38d5=[];for(const [_0x3581fc,_0x3d3765]of[..._0x443751[_0x2b7d38(0x1a1)]()][_0x2b7d38(0x1b7)]()){const _0x11191b=await _0xdad84b(_0x3581fc,_0x3d3765);_0x11191b&&_0x1b38d5[_0x2b7d38(0x1e2)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x3581fc+_0x2b7d38(0x1e5)+_0x11191b[_0x2b7d38(0x1b2)]));}return _0x1b38d5;}};}function withRollbackErrors(_0x31fa14,_0x13dac8,_0x3b6466){const _0x4fcf7f=a43_0x4d5031,_0x5b193b=_0x31fa14 instanceof Error?_0x31fa14:new Error(String(_0x31fa14));if(_0x3b6466[_0x4fcf7f(0x1bc)]===0x0)return _0x5b193b;return new AggregateError([_0x5b193b,..._0x3b6466],_0x13dac8+_0x4fcf7f(0x201)+_0x3b6466[_0x4fcf7f(0x1fb)](_0x394fe6=>_0x394fe6[_0x4fcf7f(0x1b2)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x321afd,_0x5912c0,_0x50ceaf){const _0x5d8f73=a43_0x4d5031,_0x6787d3=resolveApiModelSource(_0x321afd,_0x5912c0,_0x50ceaf),_0x3dc457=loadAliasMap(_0x321afd,undefined,_0x6787d3[_0x5d8f73(0x1db)],_0x6787d3[_0x5d8f73(0x189)]);return assertUnambiguousHookAliases(_0x3dc457),new Map(_0x3dc457[_0x5d8f73(0x1fb)](_0x4bce66=>[_0x4bce66['datasetCode'][_0x5d8f73(0x1b1)](),_0x4bce66[_0x5d8f73(0x1f6)]]));}async function planHookDirectoryMigration(_0x3cc375,_0x41c776,_0x25a712,_0x1f112f){const _0x407a04=a43_0x4d5031,_0x4153be=new Map();for(const [_0x2be8e7,_0x4af453]of Object[_0x407a04(0x1a1)](_0x41c776[_0x407a04(0x207)])){const [_0x4da008,_0x53ef7f,_0x295187,_0x346f99,_0x1ddd4b,..._0x349d69]=_0x2be8e7[_0x407a04(0x1ad)]('/');if(_0x4da008!==_0x407a04(0x1ff)||!_0x53ef7f||!_0x295187||!_0x346f99||!_0x1ddd4b||_0x349d69[_0x407a04(0x1bc)]>0x0||!_0x4af453[_0x407a04(0x1a5)])continue;const _0x4c7c1a=_0x25a712[_0x407a04(0x1c3)](_0x4af453[_0x407a04(0x1a5)][_0x407a04(0x1b1)]()),_0x321fb0=_0x4c7c1a??_0x4af453[_0x407a04(0x1a5)];if(!isSafeHookDirectorySegment(_0x53ef7f))throw CliErrors['validation'](_0x407a04(0x1d1)+_0x53ef7f+_0x407a04(0x1c2));if(!isSafeHookDirectorySegment(_0x321fb0))throw CliErrors['validation'](_0x407a04(0x1ab)+_0x53ef7f+_0x407a04(0x203));if(_0x53ef7f===_0x321fb0)continue;const _0x310728=_0x4153be[_0x407a04(0x1c3)](_0x53ef7f)??{'datasetCode':_0x4af453['datasetCode'],'alias':_0x4c7c1a,'keyChanges':[]};if(_0x310728[_0x407a04(0x1a5)]!==_0x4af453[_0x407a04(0x1a5)])throw CliErrors['validation'](_0x407a04(0x1ab)+_0x53ef7f+_0x407a04(0x1d8));const _0x2d7f1a='HOOK/'+_0x321fb0+'/'+_0x295187+'/'+_0x346f99+'/'+_0x1ddd4b;try{resolveLocalFilePathFromLockKey(_0x3cc375,_0x2be8e7),resolveLocalFilePathFromLockKey(_0x3cc375,_0x2d7f1a);}catch(_0x39128b){throw CliErrors[_0x407a04(0x1df)](_0x407a04(0x1d0)+_0x2be8e7+_0x407a04(0x1e5)+(_0x39128b instanceof Error?_0x39128b[_0x407a04(0x1b2)]:String(_0x39128b)));}_0x310728[_0x407a04(0x1dd)][_0x407a04(0x1e2)]({'oldLockKey':_0x2be8e7,'newLockKey':_0x2d7f1a,'entry':_0x4af453}),_0x4153be['set'](_0x53ef7f,_0x310728);}const _0x597fbc=new Set([..._0x4153be[_0x407a04(0x184)]()]['flatMap'](_0x2e64e8=>_0x2e64e8[_0x407a04(0x1dd)]['map'](_0x2b0a12=>_0x2b0a12[_0x407a04(0x1cc)]))),_0x32c5c6=new Map(),_0x281a50=new Map();for(const [_0xaf5444,_0x201413]of _0x4153be){const _0x77d14f=_0x201413[_0x407a04(0x1f6)]??_0x201413['datasetCode'],_0x4873c7=hookDirectoryIdentity(_0x77d14f),_0x24b928=_0x32c5c6[_0x407a04(0x1c3)](_0x4873c7);if(_0x24b928&&_0x24b928!==_0xaf5444)throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x24b928+_0x407a04(0x19c)+_0xaf5444+'\x22:\x20both\x20target\x20\x22'+_0x77d14f+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x32c5c6[_0x407a04(0x182)](_0x4873c7,_0xaf5444);for(const _0x11818f of _0x201413['keyChanges']){const _0x2dbce1=_0x281a50[_0x407a04(0x1c3)](_0x11818f['newLockKey']);if(_0x2dbce1&&_0x2dbce1!==_0x11818f['oldLockKey'])throw CliErrors[_0x407a04(0x1df)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x2dbce1+'\x22\x20and\x20\x22'+_0x11818f[_0x407a04(0x1cc)]+_0x407a04(0x1a8)+_0x11818f[_0x407a04(0x1a7)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x597fbc[_0x407a04(0x1cd)](_0x11818f[_0x407a04(0x1a7)]))throw CliErrors[_0x407a04(0x1df)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x11818f[_0x407a04(0x1cc)]+_0x407a04(0x19e)+_0x11818f[_0x407a04(0x1a7)]+_0x407a04(0x1ae));_0x281a50[_0x407a04(0x182)](_0x11818f[_0x407a04(0x1a7)],_0x11818f[_0x407a04(0x1cc)]);}}const _0x4e8389=new Map();for(const [_0x3feabf,_0x8f28b7]of _0x25a712){_0x4e8389[_0x407a04(0x182)](hookDirectoryIdentity(_0x8f28b7),_0x3feabf);}const _0x3e78f7=[];for(const [_0x44a22f,_0x43cf61]of _0x4153be){const _0x553956=_0x43cf61[_0x407a04(0x1f6)]??_0x43cf61['datasetCode'],_0x595fb6=join(_0x3cc375[_0x407a04(0x1a2)],'HOOK',_0x44a22f),_0x2ea5da=join(_0x3cc375[_0x407a04(0x1a2)],_0x407a04(0x1ff),_0x553956),_0xd5d1ca=await directoryExists(_0x595fb6),_0x222258=await directoryExists(_0x2ea5da),_0x5280e5=_0xd5d1ca?_0x222258?await sameDirectory(_0x595fb6,_0x2ea5da)?'case-rename':undefined:_0x407a04(0x1c9):'rekey';if(!_0x5280e5)throw CliErrors[_0x407a04(0x1df)](_0x407a04(0x1ab)+_0x44a22f+_0x407a04(0x1fa)+_0x553956+_0x407a04(0x1ed));const _0x1fa73f=_0x4e8389[_0x407a04(0x1c3)](hookDirectoryIdentity(_0x44a22f));if(_0x1fa73f&&_0x1fa73f!==_0x43cf61[_0x407a04(0x1a5)][_0x407a04(0x1b1)]()){const _0x144344=new Set(_0x43cf61[_0x407a04(0x1dd)][_0x407a04(0x1fb)](_0x454690=>_0x454690[_0x407a04(0x1cc)])),_0x184262=_0x1f112f['filter'](_0x428c17=>_0x428c17[_0x407a04(0x1ca)]===_0x407a04(0x1ff)&&_0x428c17['alias']!=null&&hookDirectoryIdentity(_0x428c17['alias'])===hookDirectoryIdentity(_0x44a22f)&&!_0x144344[_0x407a04(0x1cd)](_0x428c17[_0x407a04(0x19b)]));if(_0x184262['length']>0x0)throw CliErrors['validation'](_0x407a04(0x1ab)+_0x44a22f+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x51f3d1=_0x4e8389[_0x407a04(0x1c3)](hookDirectoryIdentity(_0x553956));if(_0x51f3d1&&_0x51f3d1!==_0x43cf61['datasetCode'][_0x407a04(0x1b1)]())throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x44a22f+'\x22\x20to\x20\x22'+_0x553956+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x354dd8 of _0x43cf61[_0x407a04(0x1dd)]){const _0x1d8572=_0x41c776[_0x407a04(0x207)][_0x354dd8['newLockKey']];if(_0x1d8572&&!_0x597fbc[_0x407a04(0x1cd)](_0x354dd8['newLockKey'])&&!sameHookIdentity(_0x354dd8[_0x407a04(0x179)],_0x1d8572))throw CliErrors['validation'](_0x407a04(0x1ab)+_0x44a22f+_0x407a04(0x1fa)+_0x553956+_0x407a04(0x17f));}_0x3e78f7[_0x407a04(0x1e2)]({'oldDirectory':_0x44a22f,'newDirectory':_0x553956,'oldDirectoryPath':_0x595fb6,'newDirectoryPath':_0x2ea5da,'mode':_0x5280e5,'alias':_0x43cf61[_0x407a04(0x1f6)],'keyChanges':_0x43cf61[_0x407a04(0x1dd)]});}const _0x76675d={..._0x41c776[_0x407a04(0x207)]},_0x5e3bea=new Map(),_0x1c3585=new Map();for(const _0x31b91e of _0x3e78f7){const _0x373d5a=_0x31b91e[_0x407a04(0x1da)]!==_0x407a04(0x1a4);_0x373d5a&&_0x1c3585[_0x407a04(0x182)](hookDirectoryIdentity(_0x31b91e[_0x407a04(0x180)]),_0x31b91e[_0x407a04(0x1b8)]);for(const _0x54a53d of _0x31b91e[_0x407a04(0x1dd)]){const _0x19ec6d=_0x76675d[_0x54a53d['newLockKey']],_0x56d8d0=_0x373d5a?_0x54a53d[_0x407a04(0x179)]:_0x19ec6d??_0x54a53d[_0x407a04(0x179)];_0x76675d[_0x54a53d[_0x407a04(0x1a7)]]=canonicalizeHookEntry(_0x56d8d0,_0x31b91e[_0x407a04(0x1f6)]),delete _0x76675d[_0x54a53d['oldLockKey']],_0x373d5a&&_0x5e3bea[_0x407a04(0x182)](_0x54a53d['newLockKey'],resolveLocalFilePathFromLockKey(_0x3cc375,_0x54a53d['oldLockKey']));}}return{'migrations':_0x3e78f7,'projectedFunctions':_0x76675d,'sourceFilePathByNewLockKey':_0x5e3bea,'sourceDirectoryPathByNewDirectory':_0x1c3585};}function resolveMigratedSourceFilePath(_0xa6c5e,_0x1273b7){const _0x8265bc=a43_0x4d5031;if(!_0xa6c5e||!_0x1273b7)return undefined;const _0x443980=_0xa6c5e['sourceFilePathByNewLockKey'][_0x8265bc(0x1c3)](_0x1273b7['lockKey']);if(_0x443980)return _0x443980;if(_0x1273b7[_0x8265bc(0x1ca)]!=='HOOK')return undefined;const [,_0xa6081f,..._0x24d465]=_0x1273b7[_0x8265bc(0x19b)][_0x8265bc(0x1ad)]('/');if(!_0xa6081f||_0x24d465[_0x8265bc(0x1bc)]===0x0)return undefined;const _0x48cf55=_0xa6c5e[_0x8265bc(0x19f)]['get'](hookDirectoryIdentity(_0xa6081f));return _0x48cf55?join(_0x48cf55,..._0x24d465)+_0x8265bc(0x1f8):undefined;}function sameHookIdentity(_0x27c371,_0x557a82){const _0x8fa0ca=a43_0x4d5031;return _0x27c371['remoteId']===_0x557a82['remoteId']&&_0x27c371[_0x8fa0ca(0x1a5)]===_0x557a82[_0x8fa0ca(0x1a5)]&&_0x27c371[_0x8fa0ca(0x1fd)]===_0x557a82[_0x8fa0ca(0x1fd)]&&_0x27c371['functionNode']===_0x557a82[_0x8fa0ca(0x1d7)];}function canonicalizeHookEntry(_0x32481d,_0x599812){const {alias:_0xea534,..._0x4cfb8b}=_0x32481d;return _0x599812?{..._0x4cfb8b,'alias':_0x599812}:_0x4cfb8b;}function hookDirectoryIdentity(_0xd8bd31){const _0x168221=a43_0x4d5031;return _0xd8bd31[_0x168221(0x1be)](_0x168221(0x1e0))[_0x168221(0x1b1)]();}function isSafeHookDirectorySegment(_0x2f68cc){return isSafeLockKeySegment(_0x2f68cc);}async function sameDirectory(_0x56dbed,_0x8eda8f){const _0x1a3f87=a43_0x4d5031,[_0x1d752a,_0x619a08]=await Promise[_0x1a3f87(0x1c5)]([stat(_0x56dbed),stat(_0x8eda8f)]);return _0x1d752a[_0x1a3f87(0x18e)]===_0x619a08['dev']&&_0x1d752a[_0x1a3f87(0x1ce)]===_0x619a08[_0x1a3f87(0x1ce)];}async function applyHookDirectoryMigration(_0x294a25,_0x4bb9df){const _0x130123=a43_0x4d5031,_0x1bcc7d=_0x4bb9df['functions'],_0x46c531=_0x4bb9df['lastSync'],_0x42acaa=[],_0x907faf=async()=>{const _0x62f458=a43_0x1a84,_0x55cc94=[];_0x4bb9df[_0x62f458(0x207)]=_0x1bcc7d,_0x4bb9df[_0x62f458(0x183)]=_0x46c531;for(const {migration:_0x4d3601,temporaryPath:_0x4cd6f7}of[..._0x42acaa]['reverse']()){try{_0x4cd6f7?(await rename(_0x4d3601['newDirectoryPath'],_0x4cd6f7),await rename(_0x4cd6f7,_0x4d3601[_0x62f458(0x1b8)])):await rename(_0x4d3601['newDirectoryPath'],_0x4d3601[_0x62f458(0x1b8)]);}catch(_0x14a739){_0x55cc94[_0x62f458(0x1e2)](new Error(_0x62f458(0x1c4)+_0x4d3601[_0x62f458(0x1b3)]+_0x62f458(0x1ac)+_0x4d3601['newDirectory']+_0x62f458(0x1e5)+(_0x14a739 instanceof Error?_0x14a739['message']:String(_0x14a739))));}}return _0x55cc94;};try{for(const _0x134e83 of _0x294a25[_0x130123(0x188)]){if(_0x134e83['mode']==='move')await ensureParentDirectory(_0x134e83[_0x130123(0x17e)]),await rename(_0x134e83[_0x130123(0x1b8)],_0x134e83[_0x130123(0x17e)]),_0x42acaa[_0x130123(0x1e2)]({'migration':_0x134e83});else{if(_0x134e83['mode']===_0x130123(0x1ef)){const _0x54c0cb=join(dirname(_0x134e83[_0x130123(0x1b8)]),_0x130123(0x199)+randomUUID());await rename(_0x134e83[_0x130123(0x1b8)],_0x54c0cb);try{await rename(_0x54c0cb,_0x134e83[_0x130123(0x17e)]);}catch(_0x4a4630){try{await rename(_0x54c0cb,_0x134e83[_0x130123(0x1b8)]);}catch(_0x5a0ec6){throw withRollbackErrors(_0x4a4630,_0x130123(0x195)+_0x134e83['oldDirectory']+_0x130123(0x1fa)+_0x134e83[_0x130123(0x180)]+_0x130123(0x1b5)+_0x54c0cb+_0x130123(0x198),[new Error(_0x130123(0x1c6)+_0x54c0cb+_0x130123(0x1fa)+_0x134e83['oldDirectory']+_0x130123(0x1e5)+(_0x5a0ec6 instanceof Error?_0x5a0ec6[_0x130123(0x1b2)]:String(_0x5a0ec6)))]);}throw _0x4a4630;}_0x42acaa['push']({'migration':_0x134e83,'temporaryPath':_0x54c0cb});}}}return _0x4bb9df[_0x130123(0x207)]=_0x294a25['projectedFunctions'],{'rollback':_0x907faf};}catch(_0x152841){const _0x5bff65=await _0x907faf();throw withRollbackErrors(_0x152841,_0x130123(0x1e6),_0x5bff65);}}async function confirmForce(){const _0x42054d=a43_0x4d5031,_0x117669=createInterface({'input':process['stdin'],'output':process[_0x42054d(0x1eb)]}),_0x5758f0=await new Promise(_0x424aa5=>{const _0x1d8e57=_0x42054d;_0x117669[_0x1d8e57(0x1b9)](_0x1d8e57(0x1f0),_0x424aa5);});return _0x117669['close'](),['y','yes'][_0x42054d(0x193)](_0x5758f0[_0x42054d(0x1dc)]()[_0x42054d(0x1b1)]());}
|
|
1
|
+
const a43_0x43b08b=a43_0x35f6;(function(_0x5c41de,_0x486d9a){const _0x57c4a9=a43_0x35f6,_0x408509=_0x5c41de();while(!![]){try{const _0x5ad49c=parseInt(_0x57c4a9(0x147))/0x1*(parseInt(_0x57c4a9(0x137))/0x2)+parseInt(_0x57c4a9(0x10c))/0x3+parseInt(_0x57c4a9(0x108))/0x4+parseInt(_0x57c4a9(0x169))/0x5*(parseInt(_0x57c4a9(0x143))/0x6)+-parseInt(_0x57c4a9(0x10a))/0x7*(parseInt(_0x57c4a9(0x15f))/0x8)+-parseInt(_0x57c4a9(0x15c))/0x9+-parseInt(_0x57c4a9(0x142))/0xa;if(_0x5ad49c===_0x486d9a)break;else _0x408509['push'](_0x408509['shift']());}catch(_0x1daf60){_0x408509['push'](_0x408509['shift']());}}}(a43_0x4def,0xd1f6a));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';function a43_0x4def(){const _0x34b905=['version','flatMap','cancelled','boolean','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','stringify','alias','HOOK/','functions','\x22:\x20','length','mode','message','2959716GpFyzT','toLowerCase','26985Sgehlr','newDirectory','1741626ZmMnUr','remoteId','lastSync','profileName','push','some','Pull\x20only\x20this\x20script\x20type','str','operationType','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','content','stdin','scriptType','includes','scriptContent','code','join','requires','conflict','datasetCode','get','/api/management/library/scripts/list?appCode=','.hook-directory-migrate-','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','\x20failed','entry','appCode','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','\x20--format\x20compress','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','entries','oldDirectoryPath','pull','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','nonInteractive','set','values','skipped','validation','dev','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','mergedCli','34sBMiRT','currentApp','Force\x20overwrite\x20local\x20unsynced\x20changes','split','question','yes','Pull\x20complete:\x20','sourceDirectoryPathByNewDirectory','string','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','type','14565020uhUzrZ','90YCfldH','functionNode','lockKey','close','34789KQOuCw','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','has','\x20conflict','\x22\x20to\x20\x22','lockFilePath','keyChanges','newDirectoryPath','.js','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','HOOK','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','GET','trim','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','oldLockKey','&type=','Force\x20pull\x20cancelled.','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Failed\x20to\x20write\x20local\x20script\x20\x22','7133373mnOOuG','\x20skipped','require','248LRupKI','hookLocation','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','write','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','newLockKey','existed','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Would\x20inspect\x20','rollback','438910JwKUUs','read','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','BFF_LOCAL_UNSYNCED','reverse','\x22;\x20temporary\x20directory\x20\x22','ino','oldDirectory','filter','bool','projectedFunctions','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','scriptsRootDir','push_local','unresolvable\x20target\x20path','scriptsRoot','defaultApp','would_pull','normalize','ENDPOINT','\x22\x20may\x20remain.','rekey','selectedAppName','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','COMMON','stderr','sourceFilePathByNewLockKey','ENOENT','\x20--name\x20','map','Could\x20not\x20restore\x20local\x20script\x20\x22','\x22:\x20both\x20target\x20\x22','\x20pulled','Lock\x20scope\x20for\x20app\x20\x22','force','filePath','Remote\x20script\x20missing\x20id.','migrations','apiDir','Cannot\x20migrate\x20HOOK\x20directory\x20\x22'];a43_0x4def=function(){return _0x34b905;};return a43_0x4def();}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_0x43b08b(0x12c),'description':a43_0x43b08b(0x15a),'risk':a43_0x43b08b(0x16a),'structuredErrors':!![],'flags':[{'name':a43_0x43b08b(0x141),'type':a43_0x43b08b(0x13f),'description':a43_0x43b08b(0x112),'enum':[a43_0x43b08b(0xeb),a43_0x43b08b(0xe6),'HOOK']},{'name':a43_0x43b08b(0xf5),'type':a43_0x43b08b(0xfe),'description':a43_0x43b08b(0x139)}],async 'dryRun'(_0x20dd77){const _0x475ea1=a43_0x43b08b,_0xf2e646=loadBffProjectConfig(_0x20dd77['appCode']),_0x1d0a83=await readBffLockFile(_0xf2e646[_0x475ea1(0x14c)]),{appLock:_0x16d7b4}=ensureLockScope(_0x1d0a83??createEmptyBffLock(),_0x20dd77[_0x475ea1(0x126)],_0xf2e646[_0x475ea1(0xe2)],'pull'),_0x57c231=normalizeBffType(_0x20dd77[_0x475ea1(0x113)](_0x475ea1(0x141)))??undefined,[_0x1c0d27,_0x539a11]=await Promise['all']([listBffScripts(_0x20dd77[_0x475ea1(0x126)],_0x57c231),getBffScriptStatistics(_0x20dd77[_0x475ea1(0x126)])]),_0x370ef4=_0x1c0d27[_0x475ea1(0x111)](_0x550e70=>normalizeBffType(_0x550e70[_0x475ea1(0x118)])===_0x475ea1(0x151)),_0x57e4fb=_0x370ef4?buildDatasetCodeToAliasMap(_0x20dd77[_0x475ea1(0xf9)],_0x20dd77[_0x475ea1(0x126)],_0x20dd77[_0x475ea1(0xe9)]||_0x20dd77[_0x475ea1(0x136)]?.[_0x475ea1(0x138)]||_0x20dd77[_0x475ea1(0x136)]?.[_0x475ea1(0xe3)]):new Map(),_0x5683b9=_0x370ef4?await planHookDirectoryMigration(_0xf2e646,_0x16d7b4,_0x57e4fb,await scanLocalBffFunctions(_0xf2e646,_0x475ea1(0x151))):undefined,_0x51eadf=createHookLocationMap(_0x539a11),_0x48f82f=[];for(const _0xdd5dc7 of _0x1c0d27){const _0x3dd6a9=resolveRemoteScriptTarget(_0xf2e646,_0xdd5dc7,_0x51eadf,_0x5683b9?.[_0x475ea1(0xdd)]??_0x16d7b4[_0x475ea1(0x103)],_0x57e4fb);if(!_0x3dd6a9){_0x48f82f['push']({'scriptType':_0xdd5dc7['scriptType'],'functionName':_0xdd5dc7['functionName']??'','status':_0x475ea1(0x132),'reason':_0x475ea1(0xe1)});continue;}const _0x13aa39=(_0x5683b9?.[_0x475ea1(0xdd)]??_0x16d7b4[_0x475ea1(0x103)])[_0x3dd6a9[_0x475ea1(0x145)]],_0x922e4=_0xdd5dc7[_0x475ea1(0x11a)]!=null?computeContentHash(_0xdd5dc7[_0x475ea1(0x11a)]):undefined,_0x5b6e58=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x5683b9,_0x3dd6a9)??_0x3dd6a9[_0x475ea1(0xf6)],_0x13aa39,_0x922e4),_0x28e73f=_0x5b6e58?localUnsyncedConflict(_0x3dd6a9,_0xdd5dc7['id']):undefined;_0x48f82f[_0x475ea1(0x110)]({'lockKey':_0x3dd6a9['lockKey'],'filePath':_0x3dd6a9[_0x475ea1(0xf6)],'remoteId':_0xdd5dc7['id']??null,'status':_0x28e73f?_0x475ea1(0x11e):_0x475ea1(0xe4),..._0x28e73f?{'conflict':_0x28e73f}:{},..._0x3dd6a9[_0x475ea1(0x160)]?{'alias':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x101)]??null,'datasetCode':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x11f)],'operationType':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x114)],'functionNode':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x144)]}:{}});}return{'method':_0x475ea1(0x154),'url':_0x475ea1(0x121)+_0x20dd77[_0x475ea1(0x126)]+(_0x57c231?_0x475ea1(0x158)+_0x57c231:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x20dd77['appCode'],'filterType':_0x57c231??null,..._0x5683b9&&_0x5683b9[_0x475ea1(0xf8)][_0x475ea1(0x105)]>0x0?{'hookDirectoryMigrations':_0x5683b9[_0x475ea1(0xf8)][_0x475ea1(0xf0)](_0x3f3809=>({'from':_0x3f3809['oldDirectory'],'to':_0x3f3809[_0x475ea1(0x10b)]}))}:{},'files':_0x48f82f},'description':_0x475ea1(0x167)+_0x48f82f[_0x475ea1(0x105)]+_0x475ea1(0x135)};},async 'execute'(_0x586e2a){const _0x383817=a43_0x43b08b,_0x2e6338=loadBffProjectConfig(_0x586e2a[_0x383817(0x126)]),_0x4ed4c7=await readBffLockFile(_0x2e6338['lockFilePath']),{lockData:_0x12af0b,appLock:_0xa95aa9}=ensureLockScope(_0x4ed4c7??createEmptyBffLock(),_0x586e2a[_0x383817(0x126)],_0x2e6338[_0x383817(0xe2)],_0x383817(0x12c)),_0x858031=normalizeBffType(_0x586e2a[_0x383817(0x113)](_0x383817(0x141)))??undefined;if(_0x586e2a[_0x383817(0x113)](_0x383817(0x141))&&!_0x858031)throw CliErrors[_0x383817(0x133)](_0x383817(0x12d));const [_0x2e1db6,_0x301d5d]=await Promise['all']([listBffScripts(_0x586e2a[_0x383817(0x126)],_0x858031),getBffScriptStatistics(_0x586e2a['appCode'])]);if(_0x2e1db6[_0x383817(0x105)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x383817(0xea)};const _0x4da893=_0x586e2a[_0x383817(0xdc)](_0x383817(0xf5));if(_0x4da893&&!_0x586e2a[_0x383817(0x12f)]){const _0x539935=await confirmForce();if(!_0x539935)throw CliErrors[_0x383817(0xfd)](_0x383817(0x159));}if(_0x4da893&&_0x586e2a[_0x383817(0x12f)]){}const _0x2e8489=_0x2e1db6[_0x383817(0x111)](_0x47f83e=>normalizeBffType(_0x47f83e[_0x383817(0x118)])===_0x383817(0x151)),_0xee4bbc=_0x2e8489?buildDatasetCodeToAliasMap(_0x586e2a[_0x383817(0xf9)],_0x586e2a[_0x383817(0x126)],_0x586e2a[_0x383817(0xe9)]||_0x586e2a[_0x383817(0x136)]?.[_0x383817(0x138)]||_0x586e2a[_0x383817(0x136)]?.[_0x383817(0xe3)]):new Map(),_0x340a95=createHookLocationMap(_0x301d5d),_0x63fa27=JSON['parse'](JSON[_0x383817(0x100)](_0x12af0b)),_0x14b735=_0x586e2a[_0x383817(0x126)],_0xad6be3=_0x63fa27['apps'][_0x14b735];if(!_0xad6be3)throw new Error(_0x383817(0xf4)+_0x14b735+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x3b48ca=_0x2e8489?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x2e6338,_0xad6be3,_0xee4bbc,await scanLocalBffFunctions(_0x2e6338,_0x383817(0x151))),_0xad6be3):undefined,_0x14e4b4=createPullFileTransaction(),_0x43709e=[],_0x1831a4=[],_0x193d8d=[],_0x38b54e=[];for(const _0x3b9675 of _0x2e1db6){const _0x36899c=resolveRemoteScriptTarget(_0x2e6338,_0x3b9675,_0x340a95,_0xad6be3[_0x383817(0x103)],_0xee4bbc);if(!_0x36899c){_0x1831a4['push']({'lockKey':_0x3b9675['scriptType']+'/'+_0x3b9675['functionName'],'reason':_0x383817(0xe1)});continue;}const _0x14f9b5=_0xad6be3['functions'][_0x36899c[_0x383817(0x145)]];try{if(!_0x3b9675['id'])throw new Error(_0x383817(0xf7));if(_0x3b9675[_0x383817(0x11a)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x229b3c=_0x3b9675[_0x383817(0x11a)],_0x488b57=computeContentHash(_0x229b3c);if(!_0x4da893){const _0x45de7a=await hasUnsyncedLocalChanges(_0x36899c[_0x383817(0xf6)],_0x14f9b5,_0x488b57);if(_0x45de7a){_0x193d8d[_0x383817(0x110)](localUnsyncedConflict(_0x36899c,_0x3b9675['id']));continue;}}await _0x14e4b4[_0x383817(0x162)](_0x36899c[_0x383817(0xf6)],_0x229b3c);const _0x5d443b={'hash':_0x488b57,'remoteId':_0x3b9675['id'],'version':_0x3b9675[_0x383817(0xfb)]};_0x36899c[_0x383817(0x141)]===_0x383817(0x151)&&_0x36899c['hookLocation']&&(_0x5d443b[_0x383817(0x101)]=_0x36899c[_0x383817(0x160)][_0x383817(0x101)],_0x5d443b[_0x383817(0x11f)]=_0x36899c[_0x383817(0x160)]['datasetCode'],_0x5d443b[_0x383817(0x114)]=_0x36899c[_0x383817(0x160)][_0x383817(0x114)],_0x5d443b[_0x383817(0x144)]=_0x36899c[_0x383817(0x160)][_0x383817(0x144)]),_0xad6be3['functions'][_0x36899c[_0x383817(0x145)]]=_0x5d443b,_0x43709e[_0x383817(0x110)]({'lockKey':_0x36899c[_0x383817(0x145)],'remoteId':_0x3b9675['id']});}catch(_0x216f03){_0x38b54e['push']({'lockKey':_0x36899c['lockKey'],'error':_0x216f03 instanceof Error?_0x216f03[_0x383817(0x107)]:String(_0x216f03)});}}_0xad6be3['lastSync']=new Date()['toISOString']();try{await writeBffLockFile(_0x2e6338[_0x383817(0x14c)],_0x63fa27);}catch(_0x5b4f57){const _0x31185c=[...await _0x14e4b4['rollback'](),...await _0x3b48ca?.[_0x383817(0x168)]()??[]];throw withRollbackErrors(_0x5b4f57,_0x383817(0x16b),_0x31185c);}return{'ok':_0x38b54e[_0x383817(0x105)]===0x0,'data':{'pulled':_0x43709e,'skipped':_0x1831a4,'conflicts':_0x193d8d,'failed':_0x38b54e},'message':formatPullMessage(_0x43709e[_0x383817(0x105)],_0x1831a4[_0x383817(0x105)],_0x193d8d[_0x383817(0x105)],_0x38b54e[_0x383817(0x105)])};}};function localUnsyncedConflict(_0x16eda9,_0x4f340c){const _0x52c39b=a43_0x43b08b,_0x483f78=_0x16eda9[_0x52c39b(0x145)]['split']('/')['at'](-0x1);return{'code':_0x52c39b(0x16c),'lockKey':_0x16eda9[_0x52c39b(0x145)],'filePath':_0x16eda9[_0x52c39b(0xf6)],..._0x4f340c!=null?{'remoteId':_0x4f340c}:{},'message':_0x52c39b(0x161),'nextAction':{'action':_0x52c39b(0xe0),'command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x16eda9[_0x52c39b(0x141)]+_0x52c39b(0xef)+_0x483f78+_0x52c39b(0x128),'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 formatPullMessage(_0x48ea72,_0x150890,_0x1befdd,_0x419c7e){const _0x13f259=a43_0x43b08b,_0x3e7e1c=[_0x13f259(0x13d)+_0x48ea72+_0x13f259(0xf3),_0x150890+_0x13f259(0x15d)];_0x1befdd>0x0&&_0x3e7e1c['push'](_0x1befdd+_0x13f259(0x14a)+(_0x1befdd===0x1?'':'s')+'\x20'+(_0x1befdd===0x1?_0x13f259(0x11d):_0x13f259(0x15e))+'\x20resolution');if(_0x419c7e>0x0)_0x3e7e1c['push'](_0x419c7e+_0x13f259(0x124));return _0x3e7e1c[_0x13f259(0x11c)](',\x20');}function a43_0x35f6(_0x1d02e1,_0x384ed5){_0x1d02e1=_0x1d02e1-0xda;const _0x4def8a=a43_0x4def();let _0x35f6f2=_0x4def8a[_0x1d02e1];return _0x35f6f2;}async function hasUnsyncedLocalChanges(_0x4ba554,_0xc613cc,_0x8d3c6b){if(!await fileExists(_0x4ba554))return![];const _0x2f1905=await computeFileHash(_0x4ba554);if(!_0xc613cc)return _0x8d3c6b?_0x2f1905!==_0x8d3c6b:!![];return _0x2f1905!==_0xc613cc['hash'];}function createPullFileTransaction(){const _0xf6ebeb=new Map(),_0x466851=async(_0x51f56b,_0x284626)=>{const _0x12b850=a43_0x35f6;try{if(_0x284626[_0x12b850(0x165)])await ensureParentDirectory(_0x51f56b),await writeFile(_0x51f56b,_0x284626[_0x12b850(0x116)]);else try{await unlink(_0x51f56b);}catch(_0x3e9217){if(_0x3e9217[_0x12b850(0x11b)]!==_0x12b850(0xee))throw _0x3e9217;}return undefined;}catch(_0x4e1604){return _0x4e1604 instanceof Error?_0x4e1604:new Error(String(_0x4e1604));}};return{async 'write'(_0x418b1a,_0xcf5af1){const _0x5135ea=a43_0x35f6;if(!_0xf6ebeb[_0x5135ea(0x149)](_0x418b1a))try{_0xf6ebeb[_0x5135ea(0x130)](_0x418b1a,{'existed':!![],'content':await readFile(_0x418b1a)});}catch(_0x4808de){if(_0x4808de[_0x5135ea(0x11b)]!=='ENOENT')throw _0x4808de;_0xf6ebeb[_0x5135ea(0x130)](_0x418b1a,{'existed':![]});}try{await ensureParentDirectory(_0x418b1a),await writeFile(_0x418b1a,_0xcf5af1,'utf8');}catch(_0x2dd1b3){const _0x2e3e12=await _0x466851(_0x418b1a,_0xf6ebeb[_0x5135ea(0x120)](_0x418b1a));if(!_0x2e3e12)_0xf6ebeb['delete'](_0x418b1a);throw withRollbackErrors(_0x2dd1b3,_0x5135ea(0x15b)+_0x418b1a+'\x22.',_0x2e3e12?[_0x2e3e12]:[]);}},async 'rollback'(){const _0x2e90ca=a43_0x35f6,_0x12f8c7=[];for(const [_0x72f6b9,_0x5d318f]of[..._0xf6ebeb[_0x2e90ca(0x12a)]()][_0x2e90ca(0x16d)]()){const _0x230d83=await _0x466851(_0x72f6b9,_0x5d318f);_0x230d83&&_0x12f8c7['push'](new Error(_0x2e90ca(0xf1)+_0x72f6b9+'\x22:\x20'+_0x230d83[_0x2e90ca(0x107)]));}return _0x12f8c7;}};}function withRollbackErrors(_0x46a7d2,_0x3d00ac,_0x2b0bbc){const _0x324400=a43_0x43b08b,_0x13bf94=_0x46a7d2 instanceof Error?_0x46a7d2:new Error(String(_0x46a7d2));if(_0x2b0bbc['length']===0x0)return _0x13bf94;return new AggregateError([_0x13bf94,..._0x2b0bbc],_0x3d00ac+'\x20Recovery\x20errors:\x20'+_0x2b0bbc[_0x324400(0xf0)](_0x1558db=>_0x1558db['message'])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x5e1a6f,_0x2bdc4e,_0x4ad510){const _0x177194=a43_0x43b08b,_0x29da15=resolveApiModelSource(_0x5e1a6f,_0x2bdc4e,_0x4ad510),_0x39ec33=loadAliasMap(_0x5e1a6f,undefined,_0x29da15[_0x177194(0xf6)],_0x29da15[_0x177194(0x10f)]);return assertUnambiguousHookAliases(_0x39ec33),new Map(_0x39ec33[_0x177194(0xf0)](_0x21ef19=>[_0x21ef19[_0x177194(0x11f)][_0x177194(0x109)](),_0x21ef19['alias']]));}async function planHookDirectoryMigration(_0x1f8ba8,_0xbc4ef3,_0x5b6b1f,_0xc93b7f){const _0x168528=a43_0x43b08b,_0x2959d8=new Map();for(const [_0x462440,_0x166ec9]of Object[_0x168528(0x12a)](_0xbc4ef3[_0x168528(0x103)])){const [_0x242e16,_0x55d6df,_0x2e2492,_0x4f698d,_0x40dfea,..._0x13c5ff]=_0x462440[_0x168528(0x13a)]('/');if(_0x242e16!=='HOOK'||!_0x55d6df||!_0x2e2492||!_0x4f698d||!_0x40dfea||_0x13c5ff[_0x168528(0x105)]>0x0||!_0x166ec9[_0x168528(0x11f)])continue;const _0x3b37aa=_0x5b6b1f[_0x168528(0x120)](_0x166ec9[_0x168528(0x11f)][_0x168528(0x109)]()),_0x2db6de=_0x3b37aa??_0x166ec9[_0x168528(0x11f)];if(!isSafeHookDirectorySegment(_0x55d6df))throw CliErrors['validation']('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x55d6df+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x2db6de))throw CliErrors['validation'](_0x168528(0xfa)+_0x55d6df+_0x168528(0x115));if(_0x55d6df===_0x2db6de)continue;const _0x22936a=_0x2959d8[_0x168528(0x120)](_0x55d6df)??{'datasetCode':_0x166ec9[_0x168528(0x11f)],'alias':_0x3b37aa,'keyChanges':[]};if(_0x22936a[_0x168528(0x11f)]!==_0x166ec9[_0x168528(0x11f)])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x55d6df+_0x168528(0xde));const _0x182a6a=_0x168528(0x102)+_0x2db6de+'/'+_0x2e2492+'/'+_0x4f698d+'/'+_0x40dfea;try{resolveLocalFilePathFromLockKey(_0x1f8ba8,_0x462440),resolveLocalFilePathFromLockKey(_0x1f8ba8,_0x182a6a);}catch(_0x180dc8){throw CliErrors[_0x168528(0x133)](_0x168528(0x148)+_0x462440+_0x168528(0x104)+(_0x180dc8 instanceof Error?_0x180dc8[_0x168528(0x107)]:String(_0x180dc8)));}_0x22936a[_0x168528(0x14d)][_0x168528(0x110)]({'oldLockKey':_0x462440,'newLockKey':_0x182a6a,'entry':_0x166ec9}),_0x2959d8[_0x168528(0x130)](_0x55d6df,_0x22936a);}const _0x323344=new Set([..._0x2959d8[_0x168528(0x131)]()][_0x168528(0xfc)](_0x5d1e2c=>_0x5d1e2c[_0x168528(0x14d)][_0x168528(0xf0)](_0x5e6d9f=>_0x5e6d9f[_0x168528(0x157)]))),_0x38280b=new Map(),_0x24243b=new Map();for(const [_0x328d7b,_0x36bef7]of _0x2959d8){const _0x5a1a92=_0x36bef7['alias']??_0x36bef7['datasetCode'],_0x325cf5=hookDirectoryIdentity(_0x5a1a92),_0x2daeac=_0x38280b[_0x168528(0x120)](_0x325cf5);if(_0x2daeac&&_0x2daeac!==_0x328d7b)throw CliErrors[_0x168528(0x133)](_0x168528(0x150)+_0x2daeac+'\x22\x20and\x20\x22'+_0x328d7b+'\x22:\x20both\x20target\x20\x22'+_0x5a1a92+_0x168528(0x140));_0x38280b[_0x168528(0x130)](_0x325cf5,_0x328d7b);for(const _0x5a1763 of _0x36bef7['keyChanges']){const _0x171c75=_0x24243b[_0x168528(0x120)](_0x5a1763['newLockKey']);if(_0x171c75&&_0x171c75!==_0x5a1763[_0x168528(0x157)])throw CliErrors[_0x168528(0x133)](_0x168528(0x129)+_0x171c75+'\x22\x20and\x20\x22'+_0x5a1763[_0x168528(0x157)]+_0x168528(0xf2)+_0x5a1763[_0x168528(0x164)]+_0x168528(0x12e));if(_0x323344['has'](_0x5a1763['newLockKey']))throw CliErrors[_0x168528(0x133)](_0x168528(0x152)+_0x5a1763[_0x168528(0x157)]+'\x22:\x20its\x20target\x20\x22'+_0x5a1763[_0x168528(0x164)]+'\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');_0x24243b[_0x168528(0x130)](_0x5a1763[_0x168528(0x164)],_0x5a1763['oldLockKey']);}}const _0x451dfe=new Map();for(const [_0x210381,_0x145b2e]of _0x5b6b1f){_0x451dfe['set'](hookDirectoryIdentity(_0x145b2e),_0x210381);}const _0x115519=[];for(const [_0x21017e,_0x44cabd]of _0x2959d8){const _0x16b346=_0x44cabd[_0x168528(0x101)]??_0x44cabd[_0x168528(0x11f)],_0xd84c5=join(_0x1f8ba8[_0x168528(0xdf)],_0x168528(0x151),_0x21017e),_0x5d5fb5=join(_0x1f8ba8[_0x168528(0xdf)],'HOOK',_0x16b346),_0xdcb96e=await directoryExists(_0xd84c5),_0x201372=await directoryExists(_0x5d5fb5),_0x175960=_0xdcb96e?_0x201372?await sameDirectory(_0xd84c5,_0x5d5fb5)?'case-rename':undefined:'move':'rekey';if(!_0x175960)throw CliErrors[_0x168528(0x133)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x21017e+'\x22\x20to\x20\x22'+_0x16b346+_0x168528(0x127));const _0xcc062c=_0x451dfe[_0x168528(0x120)](hookDirectoryIdentity(_0x21017e));if(_0xcc062c&&_0xcc062c!==_0x44cabd[_0x168528(0x11f)][_0x168528(0x109)]()){const _0x3ec37d=new Set(_0x44cabd[_0x168528(0x14d)][_0x168528(0xf0)](_0x52ab8b=>_0x52ab8b['oldLockKey'])),_0x12b62c=_0xc93b7f[_0x168528(0xdb)](_0x5768a5=>_0x5768a5[_0x168528(0x141)]===_0x168528(0x151)&&_0x5768a5['alias']!=null&&hookDirectoryIdentity(_0x5768a5[_0x168528(0x101)])===hookDirectoryIdentity(_0x21017e)&&!_0x3ec37d[_0x168528(0x149)](_0x5768a5[_0x168528(0x145)]));if(_0x12b62c[_0x168528(0x105)]>0x0)throw CliErrors['validation'](_0x168528(0xfa)+_0x21017e+_0x168528(0x163));}const _0x268e6c=_0x451dfe[_0x168528(0x120)](hookDirectoryIdentity(_0x16b346));if(_0x268e6c&&_0x268e6c!==_0x44cabd[_0x168528(0x11f)][_0x168528(0x109)]())throw CliErrors[_0x168528(0x133)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x21017e+'\x22\x20to\x20\x22'+_0x16b346+_0x168528(0x153));for(const _0x52f992 of _0x44cabd[_0x168528(0x14d)]){const _0x1f2517=_0xbc4ef3[_0x168528(0x103)][_0x52f992[_0x168528(0x164)]];if(_0x1f2517&&!_0x323344[_0x168528(0x149)](_0x52f992[_0x168528(0x164)])&&!sameHookIdentity(_0x52f992[_0x168528(0x125)],_0x1f2517))throw CliErrors[_0x168528(0x133)](_0x168528(0xfa)+_0x21017e+_0x168528(0x14b)+_0x16b346+_0x168528(0xff));}_0x115519[_0x168528(0x110)]({'oldDirectory':_0x21017e,'newDirectory':_0x16b346,'oldDirectoryPath':_0xd84c5,'newDirectoryPath':_0x5d5fb5,'mode':_0x175960,'alias':_0x44cabd[_0x168528(0x101)],'keyChanges':_0x44cabd[_0x168528(0x14d)]});}const _0x2b922e={..._0xbc4ef3[_0x168528(0x103)]},_0x3893ad=new Map(),_0x11c2a4=new Map();for(const _0x3b1cc9 of _0x115519){const _0x1bf130=_0x3b1cc9['mode']!==_0x168528(0xe8);_0x1bf130&&_0x11c2a4[_0x168528(0x130)](hookDirectoryIdentity(_0x3b1cc9['newDirectory']),_0x3b1cc9[_0x168528(0x12b)]);for(const _0x3f9601 of _0x3b1cc9['keyChanges']){const _0x8d7456=_0x2b922e[_0x3f9601[_0x168528(0x164)]],_0x1c4698=_0x1bf130?_0x3f9601[_0x168528(0x125)]:_0x8d7456??_0x3f9601[_0x168528(0x125)];_0x2b922e[_0x3f9601['newLockKey']]=canonicalizeHookEntry(_0x1c4698,_0x3b1cc9['alias']),delete _0x2b922e[_0x3f9601[_0x168528(0x157)]],_0x1bf130&&_0x3893ad[_0x168528(0x130)](_0x3f9601[_0x168528(0x164)],resolveLocalFilePathFromLockKey(_0x1f8ba8,_0x3f9601[_0x168528(0x157)]));}}return{'migrations':_0x115519,'projectedFunctions':_0x2b922e,'sourceFilePathByNewLockKey':_0x3893ad,'sourceDirectoryPathByNewDirectory':_0x11c2a4};}function resolveMigratedSourceFilePath(_0x566827,_0x529907){const _0x15d5ee=a43_0x43b08b;if(!_0x566827||!_0x529907)return undefined;const _0x323b8e=_0x566827[_0x15d5ee(0xed)][_0x15d5ee(0x120)](_0x529907['lockKey']);if(_0x323b8e)return _0x323b8e;if(_0x529907['type']!=='HOOK')return undefined;const [,_0x1ae5bd,..._0xe325cf]=_0x529907['lockKey'][_0x15d5ee(0x13a)]('/');if(!_0x1ae5bd||_0xe325cf[_0x15d5ee(0x105)]===0x0)return undefined;const _0x3a07f9=_0x566827[_0x15d5ee(0x13e)][_0x15d5ee(0x120)](hookDirectoryIdentity(_0x1ae5bd));return _0x3a07f9?join(_0x3a07f9,..._0xe325cf)+_0x15d5ee(0x14f):undefined;}function sameHookIdentity(_0xf94da4,_0x372208){const _0x323ad6=a43_0x43b08b;return _0xf94da4[_0x323ad6(0x10d)]===_0x372208[_0x323ad6(0x10d)]&&_0xf94da4[_0x323ad6(0x11f)]===_0x372208[_0x323ad6(0x11f)]&&_0xf94da4[_0x323ad6(0x114)]===_0x372208[_0x323ad6(0x114)]&&_0xf94da4['functionNode']===_0x372208[_0x323ad6(0x144)];}function canonicalizeHookEntry(_0x357ef5,_0x200581){const {alias:_0x7cb840,..._0x5744e7}=_0x357ef5;return _0x200581?{..._0x5744e7,'alias':_0x200581}:_0x5744e7;}function hookDirectoryIdentity(_0x2f1784){const _0x1d9dd0=a43_0x43b08b;return _0x2f1784[_0x1d9dd0(0xe5)]('NFC')[_0x1d9dd0(0x109)]();}function isSafeHookDirectorySegment(_0xe03fe2){return isSafeLockKeySegment(_0xe03fe2);}async function sameDirectory(_0x3e745a,_0x4ab009){const _0x1805ec=a43_0x43b08b,[_0x14732e,_0xd0f1ba]=await Promise['all']([stat(_0x3e745a),stat(_0x4ab009)]);return _0x14732e[_0x1805ec(0x134)]===_0xd0f1ba[_0x1805ec(0x134)]&&_0x14732e['ino']===_0xd0f1ba[_0x1805ec(0x16f)];}async function applyHookDirectoryMigration(_0x26926e,_0x3de425){const _0x4efb6a=a43_0x43b08b,_0x4176e2=_0x3de425[_0x4efb6a(0x103)],_0x5372fe=_0x3de425[_0x4efb6a(0x10e)],_0x3d314d=[],_0x107dde=async()=>{const _0x14d566=_0x4efb6a,_0x3bcf13=[];_0x3de425['functions']=_0x4176e2,_0x3de425[_0x14d566(0x10e)]=_0x5372fe;for(const {migration:_0x407fa2,temporaryPath:_0x4902d8}of[..._0x3d314d]['reverse']()){try{_0x4902d8?(await rename(_0x407fa2[_0x14d566(0x14e)],_0x4902d8),await rename(_0x4902d8,_0x407fa2[_0x14d566(0x12b)])):await rename(_0x407fa2[_0x14d566(0x14e)],_0x407fa2[_0x14d566(0x12b)]);}catch(_0x555f2a){_0x3bcf13['push'](new Error(_0x14d566(0x123)+_0x407fa2[_0x14d566(0xda)]+'\x22\x20from\x20\x22'+_0x407fa2[_0x14d566(0x10b)]+'\x22:\x20'+(_0x555f2a instanceof Error?_0x555f2a[_0x14d566(0x107)]:String(_0x555f2a))));}}return _0x3bcf13;};try{for(const _0x185e89 of _0x26926e[_0x4efb6a(0xf8)]){if(_0x185e89[_0x4efb6a(0x106)]==='move')await ensureParentDirectory(_0x185e89[_0x4efb6a(0x14e)]),await rename(_0x185e89[_0x4efb6a(0x12b)],_0x185e89[_0x4efb6a(0x14e)]),_0x3d314d[_0x4efb6a(0x110)]({'migration':_0x185e89});else{if(_0x185e89[_0x4efb6a(0x106)]==='case-rename'){const _0x2ccd57=join(dirname(_0x185e89[_0x4efb6a(0x12b)]),_0x4efb6a(0x122)+randomUUID());await rename(_0x185e89[_0x4efb6a(0x12b)],_0x2ccd57);try{await rename(_0x2ccd57,_0x185e89[_0x4efb6a(0x14e)]);}catch(_0x572bb8){try{await rename(_0x2ccd57,_0x185e89[_0x4efb6a(0x12b)]);}catch(_0x2fda1f){throw withRollbackErrors(_0x572bb8,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x185e89[_0x4efb6a(0xda)]+'\x22\x20to\x20\x22'+_0x185e89[_0x4efb6a(0x10b)]+_0x4efb6a(0x16e)+_0x2ccd57+_0x4efb6a(0xe7),[new Error('Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22'+_0x2ccd57+'\x22\x20to\x20\x22'+_0x185e89[_0x4efb6a(0xda)]+_0x4efb6a(0x104)+(_0x2fda1f instanceof Error?_0x2fda1f[_0x4efb6a(0x107)]:String(_0x2fda1f)))]);}throw _0x572bb8;}_0x3d314d[_0x4efb6a(0x110)]({'migration':_0x185e89,'temporaryPath':_0x2ccd57});}}}return _0x3de425['functions']=_0x26926e[_0x4efb6a(0xdd)],{'rollback':_0x107dde};}catch(_0xbfbb2c){const _0x587dd5=await _0x107dde();throw withRollbackErrors(_0xbfbb2c,_0x4efb6a(0x166),_0x587dd5);}}async function confirmForce(){const _0x58bd66=a43_0x43b08b,_0x2080b8=createInterface({'input':process[_0x58bd66(0x117)],'output':process[_0x58bd66(0xec)]}),_0x23fcd7=await new Promise(_0xfc74a4=>{const _0x22fdcf=_0x58bd66;_0x2080b8[_0x22fdcf(0x13b)](_0x22fdcf(0x156),_0xfc74a4);});return _0x2080b8[_0x58bd66(0x146)](),['y',_0x58bd66(0x13c)][_0x58bd66(0x119)](_0x23fcd7[_0x58bd66(0x155)]()[_0x58bd66(0x109)]());}
|