@lovrabet/rabetbase-cli 2.5.5 → 2.5.6
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/README.md +15 -1
- 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.d.ts +1 -0
- package/lib/commands/dataset/design-context.js +1 -0
- package/lib/commands/dataset/design-start.d.ts +1 -0
- package/lib/commands/dataset/design-start.js +1 -0
- package/lib/commands/dataset/design-status.d.ts +1 -0
- package/lib/commands/dataset/design-status.js +1 -0
- package/lib/commands/dataset/design-sync-retry.d.ts +1 -0
- package/lib/commands/dataset/design-sync-retry.js +1 -0
- package/lib/commands/dataset/design-sync-status.d.ts +1 -0
- package/lib/commands/dataset/design-sync-status.js +1 -0
- package/lib/commands/dataset/design-validate.d.ts +1 -0
- package/lib/commands/dataset/design-validate.js +1 -0
- 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.d.ts +40 -0
- package/lib/commands/db/cross-db-analysis-shared.js +1 -0
- package/lib/commands/db/cross-db-analyze-latest.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-latest.js +1 -0
- package/lib/commands/db/cross-db-analyze-start.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-start.js +1 -0
- package/lib/commands/db/cross-db-analyze-status.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-status.js +1 -0
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +18 -0
- 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.d.ts +17 -0
- package/lib/core/cross-db-analysis.js +1 -0
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.d.ts +17 -0
- package/lib/services/dataset-design/checkpoint.js +1 -0
- package/lib/services/dataset-design/commands.d.ts +6 -0
- package/lib/services/dataset-design/commands.js +1 -0
- package/lib/services/dataset-design/contract.d.ts +7 -0
- package/lib/services/dataset-design/contract.js +1 -0
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +3 -2
- package/skills/rabetbase/SKILL.md +9 -7
- package/skills/rabetbase/guides/database-connection-workflow.md +12 -3
- package/skills/rabetbase/guides/independent-deployment.md +10 -2
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +2 -0
- package/skills/rabetbase/references/rabetbase-dataset-design.md +25 -0
- package/skills/rabetbase/references/rabetbase-dataset-generate.md +2 -255
- package/skills/rabetbase/references/rabetbase-db-analyze.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-cross-analyze.md +78 -0
- package/skills/rabetbase-dataset-generation/SKILL.md +45 -0
- package/skills/rabetbase-dataset-generation/references/workflow.md +60 -0
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a34_0x4e8acc=a34_0xac69;(function(_0x429b46,_0x17ca0c){const _0x552760=a34_0xac69,_0x5a1fc4=_0x429b46();while(!![]){try{const _0x43461d=parseInt(_0x552760(0x1ba))/0x1+parseInt(_0x552760(0x1a1))/0x2+parseInt(_0x552760(0x1b3))/0x3*(parseInt(_0x552760(0x1b5))/0x4)+-parseInt(_0x552760(0x1b1))/0x5+parseInt(_0x552760(0x1ac))/0x6+-parseInt(_0x552760(0x1b2))/0x7*(-parseInt(_0x552760(0x1a2))/0x8)+-parseInt(_0x552760(0x1af))/0x9;if(_0x43461d===_0x17ca0c)break;else _0x5a1fc4['push'](_0x5a1fc4['shift']());}catch(_0x6d772b){_0x5a1fc4['push'](_0x5a1fc4['shift']());}}}(a34_0x4960,0x5b06a));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a34_0x4960(){const _0x27439a=['4708688itgFQX','file','appCode','app-config','number','get',',\x20appCode=','App\x20config\x20server\x20id\x20missing\x20for\x20key=','Created','POST','351438EjlQQF','tags','\x20app\x20config\x20','1369917yIRoZM','update','2972070lDqasK','7Zgzulu','45351YdymOg','isFinite','12AoKIfv','apiError','/smartapi/app-config/update','create','write','269236pxzEdH','set','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','315446JHXTXe'];a34_0x4960=function(){return _0x27439a;};return a34_0x4960();}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_0x4e8acc(0x1b7);function a34_0xac69(_0x293ae8,_0x349d79){_0x293ae8=_0x293ae8-0x19f;const _0x496002=a34_0x4960();let _0xac6940=_0x496002[_0x293ae8];return _0xac6940;}export const appConfigSet={'service':a34_0x4e8acc(0x1a5),'command':a34_0x4e8acc(0x19f),'description':a34_0x4e8acc(0x1a0),'risk':a34_0x4e8acc(0x1b9),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x4e8acc(0x1a3),'type':'string','description':'Read\x20config\x20value\x20from\x20file'}],async 'validate'(_0x2080cc){readKeyArg(_0x2080cc),readOptionalTags(_0x2080cc),assertSingleValueSource(_0x2080cc);},async 'dryRun'(_0x5c6749){const _0xdb5972=a34_0x4e8acc,_0x57423e=readKeyArg(_0x5c6749),_0xb8a7c=readOptionalTags(_0x5c6749),_0x3b4178=assertSingleValueSource(_0x5c6749);await assertValueSourceReadable(_0x3b4178);const _0x2c2a40=await withAppConfigApiBoundary(_0xdb5972(0x1a7),{'appCode':_0x5c6749[_0xdb5972(0x1a4)],'key':_0x57423e},()=>getAppConfigByKey(_0x5c6749[_0xdb5972(0x1a4)],_0x57423e)),_0x1106f0=_0x2c2a40?_0xdb5972(0x1b0):_0xdb5972(0x1b8),_0x5b3807=_0x2c2a40?projectAppConfig(_0x2c2a40):null,_0x309d0c=plannedAppConfig({'appCode':_0x5c6749['appCode'],'key':_0x57423e,'tags':_0xb8a7c??_0x2c2a40?.[_0xdb5972(0x1ad)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x1106f0,'appCode':_0x5c6749['appCode'],'key':_0x57423e,'before':_0x5b3807,'after':_0x309d0c,'dryRun':!![]}),{'method':_0xdb5972(0x1ab),'url':_0x1106f0===_0xdb5972(0x1b0)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x1f015b){const _0x373d21=a34_0x4e8acc,_0x4bc2c8=readKeyArg(_0x1f015b),_0x4fe80c=readOptionalTags(_0x1f015b),_0x3cc44c=await withAppConfigApiBoundary(_0x373d21(0x1a7),{'appCode':_0x1f015b[_0x373d21(0x1a4)],'key':_0x4bc2c8},()=>getAppConfigByKey(_0x1f015b[_0x373d21(0x1a4)],_0x4bc2c8)),_0x4bb5f2=_0x3cc44c?projectAppConfig(_0x3cc44c):null,_0x4504f4=_0x3cc44c?'update':_0x373d21(0x1b8),{value:_0x1ff694,warnings:_0x5e5386}=await readAppConfigValue(_0x1f015b),_0x2aca9c={'appCode':_0x1f015b[_0x373d21(0x1a4)],'key':_0x4bc2c8,'value':_0x1ff694,'tags':_0x4fe80c??_0x3cc44c?.[_0x373d21(0x1ad)]??undefined};await withAppConfigApiBoundary(_0x4504f4,{'appCode':_0x1f015b[_0x373d21(0x1a4)],'key':_0x4bc2c8},async()=>{const _0x11b4cc=_0x373d21;_0x3cc44c?await updateAppConfig({..._0x2aca9c,'id':requireAppConfigId(_0x3cc44c,_0x4bc2c8,_0x1f015b[_0x11b4cc(0x1a4)])}):await createAppConfig(_0x2aca9c);});const _0x1a067d=await withAppConfigApiBoundary(_0x373d21(0x1a7),{'appCode':_0x1f015b[_0x373d21(0x1a4)],'key':_0x4bc2c8},()=>getAppConfigByKey(_0x1f015b[_0x373d21(0x1a4)],_0x4bc2c8)),_0x593b02=_0x1a067d?projectAppConfig(_0x1a067d):plannedAppConfig({'appCode':_0x1f015b['appCode'],'key':_0x4bc2c8,'tags':_0x2aca9c['tags'],'hasValue':_0x1ff694!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x4504f4,'appCode':_0x1f015b['appCode'],'key':_0x4bc2c8,'before':_0x4bb5f2,'after':_0x593b02,'dryRun':![],'warnings':_0x5e5386}),'message':(_0x4504f4===_0x373d21(0x1b0)?'Updated':_0x373d21(0x1aa))+_0x373d21(0x1ae)+_0x4bc2c8};}};function requireAppConfigId(_0x22a426,_0x928df7,_0xb4f53b){const _0xa30685=a34_0x4e8acc;if(typeof _0x22a426['id']===_0xa30685(0x1a6)&&Number[_0xa30685(0x1b4)](_0x22a426['id'])&&_0x22a426['id']>0x0)return _0x22a426['id'];throw CliErrors[_0xa30685(0x1b6)](_0xa30685(0x1a9)+_0x928df7+_0xa30685(0x1a8)+_0xb4f53b);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x31c3b5=a35_0x2715;(function(_0x326378,_0x47691b){const _0x318ac7=a35_0x2715,_0x5e6d04=_0x326378();while(!![]){try{const _0x263559=-parseInt(_0x318ac7(0x1f7))/0x1*(-parseInt(_0x318ac7(0x224))/0x2)+-parseInt(_0x318ac7(0x225))/0x3*(-parseInt(_0x318ac7(0x205))/0x4)+-parseInt(_0x318ac7(0x210))/0x5*(-parseInt(_0x318ac7(0x1fe))/0x6)+parseInt(_0x318ac7(0x206))/0x7+parseInt(_0x318ac7(0x22a))/0x8+parseInt(_0x318ac7(0x21a))/0x9+-parseInt(_0x318ac7(0x1f5))/0xa;if(_0x263559===_0x47691b)break;else _0x5e6d04['push'](_0x5e6d04['shift']());}catch(_0x4274fa){_0x5e6d04['push'](_0x5e6d04['shift']());}}}(a35_0x313b,0x59437));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x31c3b5(0x215),'description':a35_0x31c3b5(0x208),'required':!![]};export const VALUE_ARG={'name':a35_0x31c3b5(0x201),'description':a35_0x31c3b5(0x209),'required':![]};export const TAGS_FLAG={'name':'tags','type':a35_0x31c3b5(0x20c),'description':a35_0x31c3b5(0x226)};export const STDIN_FLAG={'name':a35_0x31c3b5(0x1fd),'type':'boolean','description':a35_0x31c3b5(0x217),'default':![]};export const FROM_ENV_FLAG={'name':'from-env','type':'string','description':a35_0x31c3b5(0x21b)};export const REVEAL_FLAG={'name':a35_0x31c3b5(0x20e),'type':a35_0x31c3b5(0x220),'description':a35_0x31c3b5(0x200),'default':![]};export function readKeyArg(_0x41768f){const _0x30c5f5=a35_0x31c3b5,_0x359fc9=_0x41768f[_0x30c5f5(0x227)][0x0]?.[_0x30c5f5(0x1f6)]()??'';return validateKey(_0x359fc9),_0x359fc9;}export function readOptionalTags(_0x558012){const _0x1ef30d=a35_0x31c3b5,_0x4db935=_0x558012[_0x1ef30d(0x218)](_0x1ef30d(0x21d))[_0x1ef30d(0x1f6)]();if(!_0x4db935)return undefined;if(_0x4db935[_0x1ef30d(0x21c)]>0x20)throw CliErrors[_0x1ef30d(0x212)](_0x1ef30d(0x223));return _0x4db935;}export function validateKey(_0x2ccbbf){const _0x1a4c51=a35_0x31c3b5;if(!_0x2ccbbf)throw CliErrors[_0x1a4c51(0x212)](_0x1a4c51(0x211));if(_0x2ccbbf[_0x1a4c51(0x21c)]>0x100)throw CliErrors[_0x1a4c51(0x212)]('App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.');}function a35_0x313b(){const _0x59b018=['value','gmtCreate','join','push','6164caIcqA','1227723SnaDWz','warnings','Runtime\x20app-config\x20key','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','from-env','data','string','kind','reveal','Failed\x20to\x20','962235cvmpIT','Missing\x20app-config\x20key.','validation','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','path','key','once','Read\x20config\x20value\x20from\x20stdin','str','after','3716523iaNVWq','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','length','tags','argument','Environment\x20variable\x20is\x20not\x20set:\x20','boolean','env','method','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','647728cpWgov','345bbStmj','Config\x20tags\x20for\x20filtering/display\x20metadata','args','App\x20config\x20value\x20source\x20is\x20ambiguous.','slice','1131448QNCdoT','end','appCode','before','url','utf8','error','valueRedacted','name','gmtModified','flag','12501170gExhAl','trim','1kWlhWF','apiError','operation','file','defineProperties','value\x20is\x20redacted','stdin','12zZPapO','appCode:\x20','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key'];a35_0x313b=function(){return _0x59b018;};return a35_0x313b();}export function projectAppConfig(_0x38ceb0,_0x589f14){const _0x2a3675=a35_0x31c3b5,_0x182faf=_0x38ceb0[_0x2a3675(0x201)]!==undefined&&_0x38ceb0[_0x2a3675(0x201)]!==null&&_0x38ceb0['value']!=='',_0x1817bb={'appCode':_0x38ceb0['appCode'],'key':_0x38ceb0['key'],'tags':_0x38ceb0[_0x2a3675(0x21d)]??undefined,'hasValue':_0x182faf,'valueRedacted':_0x182faf&&!_0x589f14?.[_0x2a3675(0x20e)],'gmtCreate':_0x38ceb0[_0x2a3675(0x202)],'gmtModified':_0x38ceb0[_0x2a3675(0x233)]};return _0x589f14?.['reveal']&&(_0x1817bb[_0x2a3675(0x201)]=_0x38ceb0['value']??'',_0x1817bb[_0x2a3675(0x231)]=![]),_0x1817bb;}export function plannedAppConfig(_0x49d883){const _0x520804=a35_0x31c3b5,_0x3672db=_0x49d883['hasValue']??!![];return{'appCode':_0x49d883[_0x520804(0x22c)],'key':_0x49d883[_0x520804(0x215)],'tags':_0x49d883['tags']??undefined,'hasValue':_0x3672db,'valueRedacted':_0x3672db};}export function buildMutationData(_0xe6297f){const _0x2d8101=a35_0x31c3b5;return{'operation':_0xe6297f[_0x2d8101(0x1f9)],'selector':{'appCode':_0xe6297f['appCode'],'key':_0xe6297f[_0x2d8101(0x215)]},'before':_0xe6297f[_0x2d8101(0x22d)],'after':_0xe6297f[_0x2d8101(0x219)],'dryRun':_0xe6297f['dryRun'],'warnings':_0xe6297f[_0x2d8101(0x207)]??[]};}export async function withAppConfigApiBoundary(_0x583038,_0x213a33,_0x23efb2){const _0x4efb03=a35_0x31c3b5;try{return await _0x23efb2();}catch{const _0x4c037f=[_0x4efb03(0x1ff)+_0x213a33['appCode']];if(_0x213a33[_0x4efb03(0x215)])_0x4c037f[_0x4efb03(0x204)]('key:\x20'+_0x213a33['key']);_0x4c037f[_0x4efb03(0x204)](_0x4efb03(0x1fc));throw CliErrors[_0x4efb03(0x1f8)](_0x4efb03(0x20f)+_0x583038+'\x20app\x20config.',_0x4c037f[_0x4efb03(0x203)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x5bfb38,_0x334982){const _0x19042d=a35_0x31c3b5;return Object[_0x19042d(0x1fb)](_0x5bfb38,{'method':{'value':_0x334982[_0x19042d(0x222)],'enumerable':![]},'url':{'value':_0x334982[_0x19042d(0x22e)],'enumerable':![]}});}export function assertSingleValueSource(_0x3dac1a){const _0x593ea3=a35_0x31c3b5,_0x31da3d=[];_0x3dac1a[_0x593ea3(0x227)][_0x593ea3(0x21c)]>0x1&&_0x31da3d[_0x593ea3(0x204)]({'kind':_0x593ea3(0x21e),'value':_0x3dac1a[_0x593ea3(0x227)][_0x593ea3(0x229)](0x1)[_0x593ea3(0x203)]('\x20')});const _0x2ca057=_0x3dac1a[_0x593ea3(0x1f4)](_0x593ea3(0x201));_0x2ca057!==undefined&&_0x2ca057!==null&&_0x31da3d[_0x593ea3(0x204)]({'kind':_0x593ea3(0x21e),'value':String(_0x2ca057)});_0x3dac1a['bool']('stdin')&&_0x31da3d[_0x593ea3(0x204)]({'kind':_0x593ea3(0x1fd)});const _0x5b4ebf=_0x3dac1a[_0x593ea3(0x218)](_0x593ea3(0x20a))[_0x593ea3(0x1f6)]();_0x5b4ebf&&_0x31da3d[_0x593ea3(0x204)]({'kind':_0x593ea3(0x221),'name':_0x5b4ebf});const _0x584cad=_0x3dac1a[_0x593ea3(0x218)](_0x593ea3(0x1fa))[_0x593ea3(0x1f6)]();_0x584cad&&_0x31da3d[_0x593ea3(0x204)]({'kind':_0x593ea3(0x1fa),'path':_0x584cad});if(_0x31da3d[_0x593ea3(0x21c)]===0x0)throw CliErrors['validation']('Missing\x20app-config\x20value\x20source.','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0x31da3d[_0x593ea3(0x21c)]>0x1)throw CliErrors[_0x593ea3(0x212)](_0x593ea3(0x228),_0x593ea3(0x213));return _0x31da3d[0x0];}function a35_0x2715(_0x5e05a2,_0x3b9911){_0x5e05a2=_0x5e05a2-0x1f4;const _0x313bfe=a35_0x313b();let _0x27156b=_0x313bfe[_0x5e05a2];return _0x27156b;}export async function assertValueSourceReadable(_0x3f97dd){const _0x2dd10a=a35_0x31c3b5;if(_0x3f97dd[_0x2dd10a(0x20d)]===_0x2dd10a(0x221)&&!(_0x3f97dd['name']in process.env))throw CliErrors[_0x2dd10a(0x212)](_0x2dd10a(0x21f)+_0x3f97dd[_0x2dd10a(0x232)]);if(_0x3f97dd[_0x2dd10a(0x20d)]===_0x2dd10a(0x1fa))try{await access(_0x3f97dd[_0x2dd10a(0x214)]);}catch{throw CliErrors[_0x2dd10a(0x212)]('Value\x20file\x20is\x20not\x20readable:\x20'+_0x3f97dd[_0x2dd10a(0x214)]);}}export async function readAppConfigValue(_0x9d5eb1){const _0x12c66b=a35_0x31c3b5,_0x13f2de=assertSingleValueSource(_0x9d5eb1),_0xc2f366=[];if(_0x13f2de[_0x12c66b(0x20d)]===_0x12c66b(0x21e))return _0xc2f366[_0x12c66b(0x204)]('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0x13f2de[_0x12c66b(0x201)]??'','source':_0x13f2de['kind'],'warnings':_0xc2f366};if(_0x13f2de['kind']==='stdin')return{'value':await readStdin(),'source':_0x13f2de[_0x12c66b(0x20d)],'warnings':_0xc2f366};if(_0x13f2de[_0x12c66b(0x20d)]===_0x12c66b(0x221)){if(!(_0x13f2de[_0x12c66b(0x232)]in process.env))throw CliErrors['validation'](_0x12c66b(0x21f)+_0x13f2de['name']);return{'value':process.env[_0x13f2de.name]??'','source':_0x13f2de['kind'],'warnings':_0xc2f366};}return{'value':await readFile(_0x13f2de[_0x12c66b(0x214)],_0x12c66b(0x22f)),'source':_0x13f2de[_0x12c66b(0x20d)],'warnings':_0xc2f366};}function readStdin(){return new Promise((_0x2f57bc,_0x1d2918)=>{const _0x31332f=a35_0x2715;let _0x3fabc5='';process['stdin']['setEncoding'](_0x31332f(0x22f)),process[_0x31332f(0x1fd)]['on'](_0x31332f(0x20b),_0x52e33d=>{_0x3fabc5+=_0x52e33d;}),process[_0x31332f(0x1fd)][_0x31332f(0x216)](_0x31332f(0x22b),()=>_0x2f57bc(_0x3fabc5)),process[_0x31332f(0x1fd)]['once'](_0x31332f(0x230),_0x1d2918);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a36_0x451fb6=a36_0x9c06;function a36_0x5848(){const _0x51a5d6=['4FLoQKQ','!\x20Not\x20logged\x20in','10512VzAwtK','134902VqaqIv','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','137776IcmKVN','Clear\x20login\x20session','log','yes','109182eJzzRA','900054xBjYvm','logout','../../auth/auth-server-ui.js','1701QmXBZS','1321550AkdLsN','auth','nonInteractive','login','bool','5687424JvjGfX','write'];a36_0x5848=function(){return _0x51a5d6;};return a36_0x5848();}(function(_0x2a523b,_0x43826d){const _0x51ca3b=a36_0x9c06,_0x281644=_0x2a523b();while(!![]){try{const _0x12061e=-parseInt(_0x51ca3b(0x10a))/0x1+parseInt(_0x51ca3b(0x10c))/0x2+parseInt(_0x51ca3b(0x111))/0x3+-parseInt(_0x51ca3b(0x107))/0x4*(-parseInt(_0x51ca3b(0x115))/0x5)+-parseInt(_0x51ca3b(0x110))/0x6+parseInt(_0x51ca3b(0x114))/0x7*(parseInt(_0x51ca3b(0x109))/0x8)+-parseInt(_0x51ca3b(0x11a))/0x9;if(_0x12061e===_0x43826d)break;else _0x281644['push'](_0x281644['shift']());}catch(_0x2f966a){_0x281644['push'](_0x281644['shift']());}}}(a36_0x5848,0x28e3b));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x9c06(_0x19bd02,_0x5948c1){_0x19bd02=_0x19bd02-0x107;const _0x584821=a36_0x5848();let _0x9c0697=_0x584821[_0x19bd02];return _0x9c0697;}export const authDefinitions=[{'service':a36_0x451fb6(0x116),'command':a36_0x451fb6(0x118),'description':'Login\x20via\x20browser','risk':a36_0x451fb6(0x11b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x451fb6(0x10f),'type':'boolean','description':a36_0x451fb6(0x10b),'default':![]}],async 'execute'(_0xad78f2){const _0x2f8251=a36_0x451fb6,{runAuthServer:_0x1f7139}=await import(_0x2f8251(0x113));return await _0x1f7139({'autoYes':_0xad78f2[_0x2f8251(0x119)](_0x2f8251(0x10f)),'nonInteractive':_0xad78f2[_0x2f8251(0x117)]}),{'ok':!![]};}},{'service':a36_0x451fb6(0x116),'command':a36_0x451fb6(0x112),'description':a36_0x451fb6(0x10d),'risk':a36_0x451fb6(0x11b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x2b2e9d){const _0x555847=a36_0x451fb6;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x555847(0x10e)]('✓\x20Logged\x20out')):console['log'](_0x555847(0x108)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x538221=a37_0x1409;(function(_0xd0a997,_0x543bcf){const _0x2577cb=a37_0x1409,_0x599f6f=_0xd0a997();while(!![]){try{const _0x241624=-parseInt(_0x2577cb(0x104))/0x1*(parseInt(_0x2577cb(0xd4))/0x2)+-parseInt(_0x2577cb(0x119))/0x3+-parseInt(_0x2577cb(0xf5))/0x4+parseInt(_0x2577cb(0x106))/0x5*(parseInt(_0x2577cb(0xf7))/0x6)+-parseInt(_0x2577cb(0xeb))/0x7*(parseInt(_0x2577cb(0xf3))/0x8)+parseInt(_0x2577cb(0xb9))/0x9*(-parseInt(_0x2577cb(0x116))/0xa)+parseInt(_0x2577cb(0xdb))/0xb;if(_0x241624===_0x543bcf)break;else _0x599f6f['push'](_0x599f6f['shift']());}catch(_0x1981b7){_0x599f6f['push'](_0x599f6f['shift']());}}}(a37_0x157c,0xda0c8));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a37_0x1409(_0x20e7f6,_0x4833bb){_0x20e7f6=_0x20e7f6-0xb4;const _0x157c0b=a37_0x157c();let _0x140931=_0x157c0b[_0x20e7f6];return _0x140931;}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':'bff','command':a37_0x538221(0xea),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':'read','flags':[{'name':'type','type':a37_0x538221(0xc6),'required':!![],'enum':['COMMON',a37_0x538221(0xd3),a37_0x538221(0xf9)],'description':a37_0x538221(0xbd)},{'name':a37_0x538221(0x109),'type':a37_0x538221(0xc6),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x538221(0xfe),'type':a37_0x538221(0xc6),'description':a37_0x538221(0x113)},{'name':a37_0x538221(0xe5),'type':a37_0x538221(0xc6),'description':a37_0x538221(0xb7)},{'name':a37_0x538221(0xd0),'type':'string','description':a37_0x538221(0xd9)},{'name':a37_0x538221(0xd8),'type':a37_0x538221(0xc6),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':'string','description':'Trigger\x20node\x20(HOOK\x20only)','enum':['before',a37_0x538221(0xfc)]}],async 'validate'(_0x4f4ec6){const _0xa7c966=a37_0x538221,_0xd7571f=_0x4f4ec6[_0xa7c966(0xe9)]('name');if(!isValidBffFunctionName(_0xd7571f))throw CliErrors['validation'](_0xa7c966(0xed)+_0xd7571f+_0xa7c966(0xde));},async 'execute'(_0x36eb53){const _0x5963d5=a37_0x538221,_0x186ca1=loadBffProjectConfig(_0x36eb53[_0x5963d5(0xdf)]),_0x4d5c7e=_0x36eb53['str'](_0x5963d5(0x10a)),_0x14da7c=_0x36eb53[_0x5963d5(0xe9)](_0x5963d5(0x109)),_0xdaf733=_0x36eb53[_0x5963d5(0xe9)](_0x5963d5(0xfe))||undefined,_0x399d4e=_0x4d5c7e==='HOOK'?await resolveHookOptions(_0x186ca1,_0x36eb53):undefined,_0x2a6857=buildFilePath(_0x186ca1,_0x4d5c7e,_0x14da7c,_0x399d4e);if(await fileExists(_0x2a6857))throw CliErrors[_0x5963d5(0xd6)](_0x5963d5(0xfa)+_0x2a6857);await mkdir(dirname(_0x2a6857),{'recursive':!![]});const _0x26c09d=generateTemplate(_0x4d5c7e,_0x14da7c,_0x36eb53['appCode'],_0xdaf733,_0x399d4e);await writeFile(_0x2a6857,_0x26c09d,'utf8');const _0x92c8df={'type':_0x4d5c7e,'name':_0x14da7c,'path':_0x2a6857};if(_0xdaf733)_0x92c8df['description']=_0xdaf733;if(_0x399d4e){if(_0x399d4e[_0x5963d5(0xe5)])_0x92c8df[_0x5963d5(0xe5)]=_0x399d4e[_0x5963d5(0xe5)];_0x92c8df['datasetCode']=_0x399d4e['datasetCode'],_0x92c8df['operationType']=_0x399d4e[_0x5963d5(0x10b)],_0x92c8df[_0x5963d5(0xc1)]=_0x399d4e[_0x5963d5(0xc1)];}return{'ok':!![],'data':_0x92c8df,'message':_0x5963d5(0x10e)+_0x4d5c7e+_0x5963d5(0xda)+_0x14da7c};}};function a37_0x157c(){const _0x50db7d=['179IpqhDw','code','4865BRycCA','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','datasetId','name','type','operationType','nonInteractive','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Created\x20','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','entries','before','\x20api\x20pull`\x20to\x20refresh.','Script\x20description','trim','mergedCli','70BFrbUM','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','includes','612759VMirnm','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Select\x20dataset:','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','当前请求参数','68868juADRs','profileName','No\x20operation\x20types\x20found\x20for\x20dataset\x20','defaultApp','Script\x20type','Select\x20trigger\x20node:','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','No\x20datasets\x20found\x20for\x20this\x20app.','functionNode','修改后的请求参数','Invalid\x20dataset\x20selection.','keys','datasetCode','string','find','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','COMMON','stderr','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','join','/**\x0a\x20*\x20','apiDir','\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','datasetcode','.js','\x0a\x20*\x20[平台配置]\x20','ENDPOINT','19462RkhPin','当前响应结果','validation','source','operation-type','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x20function:\x20','49392211BpFlcX','.js\x0a','No\x20model\x20aliases\x20found.\x20Run\x20`','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','appCode','function-node','修改后的响应结果','close',']\x20(','UNKNOWN','alias','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','/ENDPOINT/','Available:\x20','str','create','7jvCPYS','\x22,\x20params\x20})\x0a','Invalid\x20function\x20name\x20\x22','/HOOK/','parseInt','selectedAppName','write','currentApp','5966536xJJgRa','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','5017648TcHZie','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','2484oAuHTb','map','HOOK','File\x20already\x20exists:\x20','stdin','after','Dataset\x20not\x20found\x20for\x20code\x20\x22','description','Available\x20aliases:\x20','scriptsRootDir','/COMMON/','length','\x0a\x20*\x20[接口路径]\x20POST\x20/api/'];a37_0x157c=function(){return _0x50db7d;};return a37_0x157c();}async function resolveHookOptions(_0x59f0d7,_0x3920b9){const _0x17a868=a37_0x538221,_0x3266d5=resolveApiModelSource(_0x3920b9[_0x17a868(0xce)],_0x3920b9[_0x17a868(0xdf)],_0x3920b9[_0x17a868(0xf0)]||_0x3920b9[_0x17a868(0x115)]?.[_0x17a868(0xf2)]||_0x3920b9[_0x17a868(0x115)]?.[_0x17a868(0xbc)]),_0x3c3694=loadAliasMap(_0x3920b9[_0x17a868(0xce)],undefined,_0x3266d5['filePath'],_0x3266d5['profileName']),_0x498034=_0x3c3694[_0x17a868(0x102)]>0x0;let _0x30c800,_0x316d8f,_0x2573df;const _0x5e0a2c=_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xe5)),_0x2bd05c=_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xd0));if(_0x5e0a2c){const _0x3e454a=resolveAlias(_0x3920b9[_0x17a868(0xce)],_0x5e0a2c,undefined,_0x3266d5['filePath'],_0x3266d5[_0x17a868(0xba)]);if(!_0x3e454a){const _0x49af84=_0x498034?_0x17a868(0xff)+_0x3c3694['map'](_0x52351a=>_0x52351a['alias'])[_0x17a868(0xcc)](',\x20'):_0x17a868(0xdd)+CLI_BIN_NAME+_0x17a868(0xb6);throw CliErrors['validation']('Alias\x20\x22'+_0x5e0a2c+'\x22\x20not\x20found.\x20'+_0x49af84);}_0x30c800=_0x5e0a2c,_0x316d8f=_0x3e454a;}else{if(_0x2bd05c){_0x316d8f=_0x2bd05c;const _0x18121e=_0x3c3694[_0x17a868(0xc7)](_0x1e597b=>_0x1e597b[_0x17a868(0xc5)]===_0x2bd05c);_0x30c800=_0x18121e?.[_0x17a868(0xe5)];}else{if(_0x3920b9['nonInteractive'])throw CliErrors[_0x17a868(0xd6)]('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x498034){const _0x156aa7=_0x3c3694[_0x17a868(0xf8)](_0x5c2e63=>_0x5c2e63[_0x17a868(0xe5)]+'\x20('+_0x5c2e63['tableName']+')'),_0x402354=await promptSelect(_0x17a868(0xb5),_0x156aa7),_0x1e44f4=_0x3c3694[_0x402354];if(!_0x1e44f4)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xc3));_0x30c800=_0x1e44f4['alias'],_0x316d8f=_0x1e44f4[_0x17a868(0xc5)];}else{const _0x2f537f=await listDatasets(_0x3920b9[_0x17a868(0xdf)]);if(_0x2f537f[_0x17a868(0x102)]===0x0)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xc0));const _0x3d9149=_0x2f537f[_0x17a868(0xf8)](_0x4a17e5=>_0x4a17e5[_0x17a868(0x109)]+'\x20['+(_0x4a17e5[_0x17a868(0xd7)]??_0x17a868(0xe4))+_0x17a868(0xe3)+_0x4a17e5[_0x17a868(0x105)]+')'),_0x245b70=await promptSelect(_0x17a868(0xb5),_0x3d9149),_0x447133=_0x2f537f[_0x245b70];if(!_0x447133)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xc3));_0x316d8f=_0x447133['code'],_0x30c800=undefined;}}}}const _0x2ba811=await listDatasets(_0x3920b9[_0x17a868(0xdf)]),_0xd71cae=_0x2ba811[_0x17a868(0xc7)](_0x4a59ec=>_0x4a59ec[_0x17a868(0x105)]===_0x316d8f);if(!_0xd71cae)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xfd)+_0x316d8f+'\x22.\x20'+(_0x30c800?'The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0x17a868(0x112):''));_0x2573df=_0xd71cae['id'];const _0x23cb08=_0x30c800??_0x316d8f,_0x5a73c1=await listBffDatasetOperations(_0x3920b9[_0x17a868(0xdf)],_0x2573df),_0x2876c8=_0x5a73c1?Object[_0x17a868(0xc4)](_0x5a73c1):[];if(_0x2876c8[_0x17a868(0x102)]===0x0)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xbb)+_0x23cb08+'.');let _0x588f5b;const _0x14ef59=_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xd8));if(_0x14ef59){if(!_0x2876c8[_0x17a868(0x118)](_0x14ef59))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x14ef59+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x23cb08+'.\x20'+(_0x17a868(0xe8)+_0x2876c8[_0x17a868(0xcc)](',\x20')));_0x588f5b=_0x14ef59;}else{if(_0x3920b9[_0x17a868(0x10c)])throw CliErrors['validation']('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x5c0e0=await promptSelect('Select\x20operation\x20type:',_0x2876c8);_0x588f5b=_0x2876c8[_0x5c0e0]??_0x2876c8[0x0];}let _0x2e95c3=normalizeHookFunctionNode(_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xe0)));if(!_0x2e95c3){if(_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xe0)))throw CliErrors[_0x17a868(0xd6)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x3920b9[_0x17a868(0x10c)])throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xf4));const _0xe154aa=await promptSelect(_0x17a868(0xbe),['before',_0x17a868(0xfc)]);_0x2e95c3=[_0x17a868(0x111),_0x17a868(0xfc)][_0xe154aa]??_0x17a868(0x111);}return{'alias':_0x30c800,'datasetCode':_0x316d8f,'datasetId':_0x2573df,'operationType':_0x588f5b,'functionNode':_0x2e95c3};}async function promptSelect(_0xe2c5e4,_0x2249cb){const _0x397a97=a37_0x538221;if(_0x2249cb[_0x397a97(0x102)]===0x1)return 0x0;for(const [_0x2668d2,_0x58561b]of _0x2249cb[_0x397a97(0x110)]()){process[_0x397a97(0xca)][_0x397a97(0xf1)]('\x20\x20'+(_0x2668d2+0x1)+'.\x20'+_0x58561b+'\x0a');}const _0x6c028b=createInterface({'input':process[_0x397a97(0xfb)],'output':process[_0x397a97(0xca)]});while(!![]){const _0x193d29=await new Promise(_0x226ef6=>{_0x6c028b['question'](_0xe2c5e4+'\x20',_0x226ef6);}),_0xdcc614=Number[_0x397a97(0xef)](_0x193d29[_0x397a97(0x114)](),0xa);if(Number['isInteger'](_0xdcc614)&&_0xdcc614>=0x1&&_0xdcc614<=_0x2249cb[_0x397a97(0x102)])return _0x6c028b[_0x397a97(0xe2)](),_0xdcc614-0x1;process['stderr'][_0x397a97(0xf1)](_0x397a97(0x107)+_0x2249cb['length']+'.\x0a');}}function buildFilePath(_0x2f91df,_0x12c3ec,_0x183510,_0xa8cd1c){const _0x148c4f=a37_0x538221;if(_0x12c3ec===_0x148c4f(0xf9)){if(!_0xa8cd1c)throw CliErrors[_0x148c4f(0xd6)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x141267=_0xa8cd1c[_0x148c4f(0xe5)]??_0xa8cd1c[_0x148c4f(0xc5)];return join(_0x2f91df[_0x148c4f(0x100)],_0x148c4f(0xf9),_0x141267,_0xa8cd1c[_0x148c4f(0x10b)],_0xa8cd1c[_0x148c4f(0xc1)],_0x183510+_0x148c4f(0xd1));}return join(_0x2f91df[_0x148c4f(0x100)],_0x12c3ec,_0x183510+'.js');}export function generateTemplate(_0x2708f8,_0xd54088,_0xa0e00e,_0x5b5d62,_0x5bcf71){const _0x503cd8=a37_0x538221,_0x32b284=_0x5b5d62?.[_0x503cd8(0x114)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3397cb=getAppBaseUrl(_0xa0e00e),_0xeb3997=_0x503cd8(0xbf);if(_0x2708f8===_0x503cd8(0xc9))return'/**\x0a\x20*\x20'+_0x32b284+_0x503cd8(0x11a)+_0xd54088+_0x503cd8(0xd2)+_0x3397cb+_0x503cd8(0xe6)+_0xa0e00e+_0x503cd8(0x101)+_0xd54088+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0xd54088+_0x503cd8(0xec)+_0xeb3997+_0x503cd8(0xcf)+_0xd54088+_0x503cd8(0xcb);if(_0x2708f8===_0x503cd8(0xd3))return _0x503cd8(0xcd)+_0x32b284+_0x503cd8(0x10d)+_0xd54088+_0x503cd8(0xc8)+_0xa0e00e+'/'+_0xd54088+_0x503cd8(0xd2)+_0x3397cb+_0x503cd8(0xe6)+_0xa0e00e+_0x503cd8(0xe7)+_0xd54088+_0x503cd8(0xdc)+_0xeb3997+_0x503cd8(0xb4)+_0xd54088+_0x503cd8(0xcb);if(!_0x5bcf71)throw CliErrors[_0x503cd8(0xd6)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x262c67=_0x5bcf71['alias']??_0x5bcf71[_0x503cd8(0xc5)],_0x3262b1=_0x5bcf71['functionNode']===_0x503cd8(0x111)?_0x503cd8(0xb8):_0x503cd8(0xd5),_0x4f8731=_0x5bcf71[_0x503cd8(0xc1)]===_0x503cd8(0x111)?_0x503cd8(0xc2):_0x503cd8(0xe1);return _0x503cd8(0xcd)+_0x32b284+_0x503cd8(0xf6)+_0xd54088+_0x503cd8(0x103)+_0xa0e00e+'/'+_0x5bcf71['datasetCode']+'/'+_0x5bcf71[_0x503cd8(0x10b)]+'\x0a\x20*\x20[平台配置]\x20'+_0x3397cb+'/data/dataset/'+_0x5bcf71[_0x503cd8(0x108)]+_0x503cd8(0x10f)+_0xa0e00e+_0x503cd8(0xee)+_0x262c67+'/'+_0x5bcf71['operationType']+'/'+_0x5bcf71['functionNode']+'/'+_0xd54088+'.js\x0a\x20*\x20[触发节点]\x20'+_0x5bcf71['functionNode']+'\x0a'+_0xeb3997+_0x503cd8(0x11b)+_0x3262b1+_0x503cd8(0x11c)+_0x4f8731+_0x503cd8(0x117)+_0xd54088+_0x503cd8(0xcb);}
|
|
1
|
+
const a37_0x559426=a37_0x432f;(function(_0x49d27a,_0x38206b){const _0x238886=a37_0x432f,_0xfdcf4b=_0x49d27a();while(!![]){try{const _0x1dd317=-parseInt(_0x238886(0xa4))/0x1+parseInt(_0x238886(0xc3))/0x2+parseInt(_0x238886(0x99))/0x3+parseInt(_0x238886(0x8f))/0x4*(parseInt(_0x238886(0xd6))/0x5)+parseInt(_0x238886(0x9c))/0x6+parseInt(_0x238886(0xc2))/0x7*(parseInt(_0x238886(0xa7))/0x8)+parseInt(_0x238886(0xa1))/0x9*(-parseInt(_0x238886(0xa0))/0xa);if(_0x1dd317===_0x38206b)break;else _0xfdcf4b['push'](_0xfdcf4b['shift']());}catch(_0x1d26fc){_0xfdcf4b['push'](_0xfdcf4b['shift']());}}}(a37_0x33cc,0xbe581));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a37_0x33cc(){const _0x341a23=['Function\x20name\x20(valid\x20JS\x20identifier)','description','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','Created\x20','mergedCli',']\x20(','str','.js\x0a\x20*\x20[触发节点]\x20','parseInt','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','2266355iTynGD','2378252KXPtGS','validation','Alias\x20\x22','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Select\x20dataset:','map','Available\x20aliases:\x20','function-node','\x22.\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','scriptsRootDir','profileName','filePath','name','length','operation-type','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','修改后的响应结果','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','883895WaqpAJ','/HOOK/','string','No\x20model\x20aliases\x20found.\x20Run\x20`','当前请求参数','join','No\x20operation\x20types\x20found\x20for\x20dataset\x20','stdin','/data/dataset/','isInteger','Trigger\x20node\x20(HOOK\x20only)','Select\x20operation\x20type:','code','修改后的请求参数','Invalid\x20dataset\x20selection.','/ENDPOINT/','\x0a\x20*\x20[平台配置]\x20','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\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','Operation\x20type\x20\x22','Script\x20type','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','source','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','apiDir','COMMON','.js','Available:\x20','datasetId','datasetcode','UNKNOWN','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','/COMMON/','includes','Operation\x20type\x20(HOOK\x20only)','/**\x0a\x20*\x20','\x22,\x20params\x20})\x0a','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','before','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','8ycZZkL','\x22\x20not\x20found\x20for\x20dataset\x20','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','\x20api\x20pull`\x20to\x20refresh.','.js\x0a','当前响应结果','HOOK','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','alias','1193172XnJyYs','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','3680958XTtCCr','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','currentApp','question','5810ZfCNCr','24435jHRwvM','write','find','520602QMUHTa','appCode','entries','8dgtMZk','tableName','bff','datasetCode','Invalid\x20function\x20name\x20\x22','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','type','\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','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','after','No\x20datasets\x20found\x20for\x20this\x20app.','create','nonInteractive','functionNode','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','operationType'];a37_0x33cc=function(){return _0x341a23;};return a37_0x33cc();}import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';function a37_0x432f(_0x39d544,_0x444f24){_0x39d544=_0x39d544-0x7f;const _0x33ccd1=a37_0x33cc();let _0x432f48=_0x33ccd1[_0x39d544];return _0x432f48;}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_0x559426(0xa9),'command':a37_0x559426(0xb2),'description':a37_0x559426(0x86),'risk':'read','flags':[{'name':'type','type':a37_0x559426(0xd8),'required':!![],'enum':[a37_0x559426(0x80),'ENDPOINT',a37_0x559426(0x95)],'description':a37_0x559426(0xe9)},{'name':'name','type':a37_0x559426(0xd8),'required':!![],'description':a37_0x559426(0xb7)},{'name':a37_0x559426(0xb8),'type':'string','description':'Script\x20description'},{'name':'alias','type':a37_0x559426(0xd8),'description':a37_0x559426(0xec)},{'name':a37_0x559426(0x84),'type':a37_0x559426(0xd8),'description':a37_0x559426(0x97)},{'name':'operation-type','type':a37_0x559426(0xd8),'description':a37_0x559426(0x89)},{'name':a37_0x559426(0xca),'type':'string','description':a37_0x559426(0xe0),'enum':[a37_0x559426(0x8d),'after']}],async 'validate'(_0x387324){const _0x2062fc=a37_0x559426,_0x36d987=_0x387324[_0x2062fc(0xbe)]('name');if(!isValidBffFunctionName(_0x36d987))throw CliErrors[_0x2062fc(0xc4)](_0x2062fc(0xab)+_0x36d987+_0x2062fc(0xd3));},async 'execute'(_0x497bff){const _0x405e70=a37_0x559426,_0x126c5a=loadBffProjectConfig(_0x497bff[_0x405e70(0xa5)]),_0x4da7d1=_0x497bff[_0x405e70(0xbe)](_0x405e70(0xad)),_0x2370b2=_0x497bff[_0x405e70(0xbe)]('name'),_0x53fafe=_0x497bff['str'](_0x405e70(0xb8))||undefined,_0x3d257d=_0x4da7d1===_0x405e70(0x95)?await resolveHookOptions(_0x126c5a,_0x497bff):undefined,_0x552ef3=buildFilePath(_0x126c5a,_0x4da7d1,_0x2370b2,_0x3d257d);if(await fileExists(_0x552ef3))throw CliErrors[_0x405e70(0xc4)]('File\x20already\x20exists:\x20'+_0x552ef3);await mkdir(dirname(_0x552ef3),{'recursive':!![]});const _0x5dfc35=generateTemplate(_0x4da7d1,_0x2370b2,_0x497bff[_0x405e70(0xa5)],_0x53fafe,_0x3d257d);await writeFile(_0x552ef3,_0x5dfc35,'utf8');const _0x2e90fc={'type':_0x4da7d1,'name':_0x2370b2,'path':_0x552ef3};if(_0x53fafe)_0x2e90fc['description']=_0x53fafe;if(_0x3d257d){if(_0x3d257d['alias'])_0x2e90fc[_0x405e70(0x98)]=_0x3d257d[_0x405e70(0x98)];_0x2e90fc[_0x405e70(0xaa)]=_0x3d257d['datasetCode'],_0x2e90fc['operationType']=_0x3d257d[_0x405e70(0xb6)],_0x2e90fc[_0x405e70(0xb4)]=_0x3d257d[_0x405e70(0xb4)];}return{'ok':!![],'data':_0x2e90fc,'message':_0x405e70(0xbb)+_0x4da7d1+'\x20function:\x20'+_0x2370b2};}};async function resolveHookOptions(_0xc85be1,_0x3b7e94){const _0x2dd992=a37_0x559426,_0x1a77f7=resolveApiModelSource(_0x3b7e94['apiDir'],_0x3b7e94[_0x2dd992(0xa5)],_0x3b7e94['selectedAppName']||_0x3b7e94[_0x2dd992(0xbc)]?.[_0x2dd992(0x9e)]||_0x3b7e94[_0x2dd992(0xbc)]?.['defaultApp']),_0x1f7d04=loadAliasMap(_0x3b7e94[_0x2dd992(0x7f)],undefined,_0x1a77f7[_0x2dd992(0xcf)],_0x1a77f7[_0x2dd992(0xce)]),_0xbb82b1=_0x1f7d04[_0x2dd992(0xd1)]>0x0;let _0xb9f666,_0x227a3f,_0x518b22;const _0x5adc91=_0x3b7e94[_0x2dd992(0xbe)](_0x2dd992(0x98)),_0x5ddbf3=_0x3b7e94['str'](_0x2dd992(0x84));if(_0x5adc91){const _0x543fab=resolveAlias(_0x3b7e94[_0x2dd992(0x7f)],_0x5adc91,undefined,_0x1a77f7[_0x2dd992(0xcf)],_0x1a77f7['profileName']);if(!_0x543fab){const _0xd588fa=_0xbb82b1?_0x2dd992(0xc9)+_0x1f7d04['map'](_0x42295a=>_0x42295a[_0x2dd992(0x98)])[_0x2dd992(0xdb)](',\x20'):_0x2dd992(0xd9)+CLI_BIN_NAME+_0x2dd992(0xcc);throw CliErrors[_0x2dd992(0xc4)](_0x2dd992(0xc5)+_0x5adc91+'\x22\x20not\x20found.\x20'+_0xd588fa);}_0xb9f666=_0x5adc91,_0x227a3f=_0x543fab;}else{if(_0x5ddbf3){_0x227a3f=_0x5ddbf3;const _0x30c897=_0x1f7d04[_0x2dd992(0xa3)](_0x2ead33=>_0x2ead33[_0x2dd992(0xaa)]===_0x5ddbf3);_0xb9f666=_0x30c897?.[_0x2dd992(0x98)];}else{if(_0x3b7e94[_0x2dd992(0xb3)])throw CliErrors['validation'](_0x2dd992(0xaf));else{if(_0xbb82b1){const _0x38a2fe=_0x1f7d04[_0x2dd992(0xc8)](_0x1f0f70=>_0x1f0f70['alias']+'\x20('+_0x1f0f70[_0x2dd992(0xa8)]+')'),_0x3f8f78=await promptSelect(_0x2dd992(0xc7),_0x38a2fe),_0x2b7b03=_0x1f7d04[_0x3f8f78];if(!_0x2b7b03)throw CliErrors[_0x2dd992(0xc4)](_0x2dd992(0xe4));_0xb9f666=_0x2b7b03[_0x2dd992(0x98)],_0x227a3f=_0x2b7b03[_0x2dd992(0xaa)];}else{const _0x2dc7ad=await listDatasets(_0x3b7e94[_0x2dd992(0xa5)]);if(_0x2dc7ad[_0x2dd992(0xd1)]===0x0)throw CliErrors[_0x2dd992(0xc4)](_0x2dd992(0xb1));const _0x3710f8=_0x2dc7ad[_0x2dd992(0xc8)](_0x4078d0=>_0x4078d0[_0x2dd992(0xd0)]+'\x20['+(_0x4078d0[_0x2dd992(0xeb)]??_0x2dd992(0x85))+_0x2dd992(0xbd)+_0x4078d0[_0x2dd992(0xe2)]+')'),_0x1647fe=await promptSelect(_0x2dd992(0xc7),_0x3710f8),_0x49ee19=_0x2dc7ad[_0x1647fe];if(!_0x49ee19)throw CliErrors[_0x2dd992(0xc4)]('Invalid\x20dataset\x20selection.');_0x227a3f=_0x49ee19[_0x2dd992(0xe2)],_0xb9f666=undefined;}}}}const _0x102b05=await listDatasets(_0x3b7e94[_0x2dd992(0xa5)]),_0x1aa2e3=_0x102b05['find'](_0x56e317=>_0x56e317[_0x2dd992(0xe2)]===_0x227a3f);if(!_0x1aa2e3)throw CliErrors[_0x2dd992(0xc4)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x227a3f+_0x2dd992(0xcb)+(_0xb9f666?_0x2dd992(0xb9)+CLI_BIN_NAME+_0x2dd992(0x92):''));_0x518b22=_0x1aa2e3['id'];const _0xf6f720=_0xb9f666??_0x227a3f,_0x4f0e90=await listBffDatasetOperations(_0x3b7e94[_0x2dd992(0xa5)],_0x518b22),_0x1996f1=_0x4f0e90?Object['keys'](_0x4f0e90):[];if(_0x1996f1['length']===0x0)throw CliErrors[_0x2dd992(0xc4)](_0x2dd992(0xdc)+_0xf6f720+'.');let _0x23ef38;const _0x1c2cd2=_0x3b7e94['str'](_0x2dd992(0xd2));if(_0x1c2cd2){if(!_0x1996f1[_0x2dd992(0x88)](_0x1c2cd2))throw CliErrors[_0x2dd992(0xc4)](_0x2dd992(0xe8)+_0x1c2cd2+_0x2dd992(0x90)+_0xf6f720+'.\x20'+(_0x2dd992(0x82)+_0x1996f1[_0x2dd992(0xdb)](',\x20')));_0x23ef38=_0x1c2cd2;}else{if(_0x3b7e94[_0x2dd992(0xb3)])throw CliErrors[_0x2dd992(0xc4)](_0x2dd992(0xb5));const _0x410f9d=await promptSelect(_0x2dd992(0xe1),_0x1996f1);_0x23ef38=_0x1996f1[_0x410f9d]??_0x1996f1[0x0];}let _0x473c9a=normalizeHookFunctionNode(_0x3b7e94[_0x2dd992(0xbe)]('function-node'));if(!_0x473c9a){if(_0x3b7e94[_0x2dd992(0xbe)](_0x2dd992(0xca)))throw CliErrors['validation'](_0x2dd992(0xc1));if(_0x3b7e94['nonInteractive'])throw CliErrors['validation'](_0x2dd992(0x8e));const _0x17ccba=await promptSelect('Select\x20trigger\x20node:',[_0x2dd992(0x8d),'after']);_0x473c9a=[_0x2dd992(0x8d),_0x2dd992(0xb0)][_0x17ccba]??'before';}return{'alias':_0xb9f666,'datasetCode':_0x227a3f,'datasetId':_0x518b22,'operationType':_0x23ef38,'functionNode':_0x473c9a};}async function promptSelect(_0x8c4448,_0x1cb0eb){const _0xbf3dff=a37_0x559426;if(_0x1cb0eb[_0xbf3dff(0xd1)]===0x1)return 0x0;for(const [_0x32d3c0,_0x3b58c8]of _0x1cb0eb[_0xbf3dff(0xa6)]()){process['stderr'][_0xbf3dff(0xa2)]('\x20\x20'+(_0x32d3c0+0x1)+'.\x20'+_0x3b58c8+'\x0a');}const _0x3b73c0=createInterface({'input':process[_0xbf3dff(0xdd)],'output':process['stderr']});while(!![]){const _0x44cdfb=await new Promise(_0x56f29f=>{const _0x56d9fa=_0xbf3dff;_0x3b73c0[_0x56d9fa(0x9f)](_0x8c4448+'\x20',_0x56f29f);}),_0x704d46=Number[_0xbf3dff(0xc0)](_0x44cdfb['trim'](),0xa);if(Number[_0xbf3dff(0xdf)](_0x704d46)&&_0x704d46>=0x1&&_0x704d46<=_0x1cb0eb[_0xbf3dff(0xd1)])return _0x3b73c0['close'](),_0x704d46-0x1;process['stderr'][_0xbf3dff(0xa2)](_0xbf3dff(0xac)+_0x1cb0eb[_0xbf3dff(0xd1)]+'.\x0a');}}function buildFilePath(_0xbc0d63,_0x4bc830,_0x9abc9a,_0x5d5f88){const _0x137c52=a37_0x559426;if(_0x4bc830===_0x137c52(0x95)){if(!_0x5d5f88)throw CliErrors['validation']('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x3c64a4=_0x5d5f88['alias']??_0x5d5f88[_0x137c52(0xaa)];return join(_0xbc0d63[_0x137c52(0xcd)],_0x137c52(0x95),_0x3c64a4,_0x5d5f88[_0x137c52(0xb6)],_0x5d5f88[_0x137c52(0xb4)],_0x9abc9a+_0x137c52(0x81));}return join(_0xbc0d63[_0x137c52(0xcd)],_0x4bc830,_0x9abc9a+_0x137c52(0x81));}export function generateTemplate(_0x3b440b,_0x860acc,_0x5a52c6,_0x17bb3a,_0x3470e3){const _0x4758e2=a37_0x559426,_0x3e70ff=_0x17bb3a?.['trim']()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x241f64=getAppBaseUrl(_0x5a52c6),_0x4bb209=_0x4758e2(0x91);if(_0x3b440b==='COMMON')return _0x4758e2(0x8a)+_0x3e70ff+_0x4758e2(0xc6)+_0x860acc+'\x0a\x20*\x20[平台配置]\x20'+_0x241f64+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x5a52c6+_0x4758e2(0x87)+_0x860acc+_0x4758e2(0xd5)+_0x860acc+_0x4758e2(0x8b)+_0x4bb209+_0x4758e2(0xae)+_0x860acc+_0x4758e2(0x9a);if(_0x3b440b==='ENDPOINT')return'/**\x0a\x20*\x20'+_0x3e70ff+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x860acc+_0x4758e2(0x9b)+_0x5a52c6+'/'+_0x860acc+_0x4758e2(0xe6)+_0x241f64+_0x4758e2(0x8c)+_0x5a52c6+_0x4758e2(0xe5)+_0x860acc+_0x4758e2(0x93)+_0x4bb209+_0x4758e2(0xe7)+_0x860acc+_0x4758e2(0x9a);if(!_0x3470e3)throw CliErrors[_0x4758e2(0xc4)](_0x4758e2(0x9d));const _0x25ac30=_0x3470e3['alias']??_0x3470e3[_0x4758e2(0xaa)],_0x4521c3=_0x3470e3['functionNode']===_0x4758e2(0x8d)?_0x4758e2(0xda):_0x4758e2(0x94),_0x25cc9f=_0x3470e3[_0x4758e2(0xb4)]===_0x4758e2(0x8d)?_0x4758e2(0xe3):_0x4758e2(0xd4);return _0x4758e2(0x8a)+_0x3e70ff+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x860acc+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x5a52c6+'/'+_0x3470e3[_0x4758e2(0xaa)]+'/'+_0x3470e3[_0x4758e2(0xb6)]+_0x4758e2(0xe6)+_0x241f64+_0x4758e2(0xde)+_0x3470e3[_0x4758e2(0x83)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x5a52c6+_0x4758e2(0xd7)+_0x25ac30+'/'+_0x3470e3[_0x4758e2(0xb6)]+'/'+_0x3470e3[_0x4758e2(0xb4)]+'/'+_0x860acc+_0x4758e2(0xbf)+_0x3470e3['functionNode']+'\x0a'+_0x4bb209+_0x4758e2(0xba)+_0x4521c3+_0x4758e2(0x96)+_0x25cc9f+_0x4758e2(0xea)+_0x860acc+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x2b74d5=a38_0x2e65;(function(_0x8e4ff,_0x4d674b){const _0x184007=a38_0x2e65,_0xe5738c=_0x8e4ff();while(!![]){try{const _0x4217ce=parseInt(_0x184007(0x15b))/0x1+parseInt(_0x184007(0x15f))/0x2+parseInt(_0x184007(0x15c))/0x3*(-parseInt(_0x184007(0x155))/0x4)+parseInt(_0x184007(0x159))/0x5*(parseInt(_0x184007(0x153))/0x6)+-parseInt(_0x184007(0x145))/0x7*(-parseInt(_0x184007(0x152))/0x8)+parseInt(_0x184007(0x13f))/0x9*(parseInt(_0x184007(0x133))/0xa)+-parseInt(_0x184007(0x143))/0xb*(parseInt(_0x184007(0x13c))/0xc);if(_0x4217ce===_0x4d674b)break;else _0xe5738c['push'](_0xe5738c['shift']());}catch(_0x39c64e){_0xe5738c['push'](_0xe5738c['shift']());}}}(a38_0x47d2,0x97947));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':'bff','command':a38_0x2b74d5(0x13d),'description':a38_0x2b74d5(0x164),'risk':a38_0x2b74d5(0x14f),'flags':[{'name':a38_0x2b74d5(0x163),'type':a38_0x2b74d5(0x136),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0xcf3c7f){const _0x55a50c=a38_0x2b74d5,_0x4202a8=loadBffProjectConfig(_0xcf3c7f[_0x55a50c(0x154)]),_0x4455dd=await readBffLockFile(_0x4202a8[_0x55a50c(0x13b)]);if(!_0x4455dd)throw CliErrors[_0x55a50c(0x140)](_0x55a50c(0x13e));},async 'dryRun'(_0x48ae8c){const _0x276e8f=a38_0x2b74d5,_0x5cd618=loadBffProjectConfig(_0x48ae8c[_0x276e8f(0x154)]),_0x2d910f=await readBffLockFile(_0x5cd618['lockFilePath']);if(!_0x2d910f)throw CliErrors[_0x276e8f(0x140)](_0x276e8f(0x15e));const {appLock:_0x2af871}=ensureLockScope(_0x2d910f,_0x48ae8c[_0x276e8f(0x154)],_0x5cd618[_0x276e8f(0x151)],_0x276e8f(0x13d)),_0x3156b0=_0x48ae8c['str'](_0x276e8f(0x163)),_0x42a35d=Object['keys'](_0x2af871[_0x276e8f(0x142)]),_0x577ad5=resolveDeleteTarget(_0x3156b0,_0x42a35d),_0xab859e=_0x2af871[_0x276e8f(0x142)][_0x577ad5];if(!_0xab859e)throw CliErrors[_0x276e8f(0x140)](_0x276e8f(0x14b)+_0x577ad5+'\x22.');const _0x45370e=resolveLocalFilePathFromLockKey(_0x5cd618,_0x577ad5),_0x1db73c=relative(_0x5cd618['projectRoot'],_0x45370e),_0x17a23d=join(_0x5cd618[_0x276e8f(0x138)],_0x276e8f(0x157),_0x1db73c);return{'method':_0x276e8f(0x14d),'url':_0x276e8f(0x160),'body':{'appCode':_0x48ae8c[_0x276e8f(0x154)],'target':_0x577ad5,'remoteId':_0xab859e[_0x276e8f(0x141)],'localFilePath':_0x45370e,'trashedPath':_0x17a23d},'description':_0x276e8f(0x147)+_0x577ad5+_0x276e8f(0x146)};},async 'execute'(_0x10b829){const _0x5a28cb=a38_0x2b74d5,_0x147a66=loadBffProjectConfig(_0x10b829[_0x5a28cb(0x154)]),_0x55002a=await readBffLockFile(_0x147a66[_0x5a28cb(0x13b)]);if(!_0x55002a)throw CliErrors[_0x5a28cb(0x140)](_0x5a28cb(0x15e));const {lockData:_0x57011c,appLock:_0x123f9b}=ensureLockScope(_0x55002a,_0x10b829[_0x5a28cb(0x154)],_0x147a66[_0x5a28cb(0x151)],_0x5a28cb(0x13d)),_0x1a8180=JSON['parse'](JSON[_0x5a28cb(0x14a)](_0x57011c)),_0x23e883=_0x1a8180[_0x5a28cb(0x162)][_0x10b829[_0x5a28cb(0x154)]];if(!_0x23e883)throw new Error(_0x5a28cb(0x14c)+_0x10b829['appCode']+_0x5a28cb(0x15d));const _0x160863=_0x10b829['str'](_0x5a28cb(0x163)),_0x4b88ba=Object['keys'](_0x23e883[_0x5a28cb(0x142)]),_0x190ee2=resolveDeleteTarget(_0x160863,_0x4b88ba),_0x4252db=_0x23e883['functions'][_0x190ee2];if(!_0x4252db)throw CliErrors[_0x5a28cb(0x140)](_0x5a28cb(0x14b)+_0x190ee2+'\x22.');await deleteBffScript(_0x4252db[_0x5a28cb(0x141)]),delete _0x23e883[_0x5a28cb(0x142)][_0x190ee2],_0x23e883['lastSync']=new Date()[_0x5a28cb(0x149)](),await writeBffLockFile(_0x147a66[_0x5a28cb(0x13b)],_0x1a8180);const _0x90007e=resolveLocalFilePathFromLockKey(_0x147a66,_0x190ee2);let _0xe09fb6;await fileExists(_0x90007e)&&(_0xe09fb6=await moveToTrash(_0x147a66['projectRoot'],_0x147a66[_0x5a28cb(0x138)],_0x90007e),await cleanupEmptyDirectories(dirname(_0x90007e),_0x147a66[_0x5a28cb(0x139)]));await waitForDeleteSettlement(_0x147a66[_0x5a28cb(0x13b)],_0x10b829[_0x5a28cb(0x154)],_0x190ee2,_0x90007e),await sleep(0x96);const _0x288b81={'deleted':_0x190ee2,'remoteId':_0x4252db[_0x5a28cb(0x141)]};if(_0xe09fb6)_0x288b81[_0x5a28cb(0x135)]=_0xe09fb6;return{'ok':!![],'data':_0x288b81,'message':_0x5a28cb(0x15a)+_0x190ee2+(_0xe09fb6?_0x5a28cb(0x131):'')};}};function resolveDeleteTarget(_0x46513b,_0x2f7cb0){const _0x20a4fa=a38_0x2b74d5;if(_0x46513b[_0x20a4fa(0x158)]('/')){const _0x3dc319=_0x2f7cb0[_0x20a4fa(0x14e)](_0x248e2f=>_0x248e2f===_0x46513b);if(!_0x3dc319)throw CliErrors[_0x20a4fa(0x140)](_0x20a4fa(0x134)+_0x46513b);return _0x3dc319;}const _0x5cb45d=_0x2f7cb0[_0x20a4fa(0x148)](_0x56d609=>_0x56d609['split']('/')['at'](-0x1)===_0x46513b);if(_0x5cb45d[_0x20a4fa(0x13a)]===0x0)throw CliErrors[_0x20a4fa(0x140)](_0x20a4fa(0x134)+_0x46513b);if(_0x5cb45d[_0x20a4fa(0x13a)]>0x1)throw CliErrors['validation'](_0x20a4fa(0x165)+_0x46513b+_0x20a4fa(0x150)+_0x5cb45d[_0x20a4fa(0x137)](_0x335529=>'\x20\x20-\x20'+_0x335529)[_0x20a4fa(0x156)]('\x0a'));return _0x5cb45d[0x0];}function a38_0x47d2(){const _0x25f83a=['join','<timestamp>','includes','17505WOkfDl','Deleted\x20','701446lbXmWq','3VTdIJS','\x22\x20not\x20found\x20after\x20ensureLockScope.','Backend\x20Function\x20lock\x20file\x20not\x20found.','1532110zKlqBX','/api/management/library/scripts/delete','Local\x20delete\x20not\x20settled\x20for\x20','apps','target','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','Multiple\x20functions\x20match\x20\x22','\x20(local\x20file\x20moved\x20to\x20trash)','replace','182870XYulcd','Function\x20not\x20found:\x20','trashedTo','string','map','trashDir','scriptsRootDir','length','lockFilePath','24UMFjnd','delete','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','252gmvfMk','validation','remoteId','functions','9907381dAAdcy','startsWith','60662EEGVDP','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','Would\x20delete\x20','filter','toISOString','stringify','No\x20lock\x20entry\x20found\x20for\x20\x22','Lock\x20scope\x20for\x20app\x20\x22','POST','find','high-risk-write','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','scriptsRoot','472AgkMVL','1842vxahTL','appCode','4573700DMOpjM'];a38_0x47d2=function(){return _0x25f83a;};return a38_0x47d2();}async function moveToTrash(_0x353061,_0x56b9a3,_0x1de9c8){const _0x45c159=a38_0x2b74d5,_0x223fd3=new Date()['toISOString']()[_0x45c159(0x132)](/[:.]/g,'-'),_0x1126ed=relative(_0x353061,_0x1de9c8),_0x38feba=join(_0x56b9a3,_0x223fd3,_0x1126ed);return await mkdir(dirname(_0x38feba),{'recursive':!![]}),await rename(_0x1de9c8,_0x38feba),_0x38feba;}async function cleanupEmptyDirectories(_0x50e015,_0x356d27){const _0x402fe2=a38_0x2b74d5;let _0x4829b9=resolve(_0x50e015);const _0x320e66=resolve(_0x356d27);while(_0x4829b9[_0x402fe2(0x144)](''+_0x320e66+sep)||_0x4829b9===_0x320e66){if(_0x4829b9===_0x320e66)return;try{const _0x5e60b0=await readdir(_0x4829b9);if(_0x5e60b0['length']>0x0)return;await rmdir(_0x4829b9);}catch{return;}_0x4829b9=dirname(_0x4829b9);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;function a38_0x2e65(_0x280097,_0x59e336){_0x280097=_0x280097-0x131;const _0x47d260=a38_0x47d2();let _0x2e6502=_0x47d260[_0x280097];return _0x2e6502;}async function waitForDeleteSettlement(_0x566269,_0x5ba7a6,_0x1cd785,_0x4eaaa7){const _0x2ef547=a38_0x2b74d5;for(let _0x11b691=0x0;_0x11b691<DELETE_SETTLE_RETRY_COUNT;_0x11b691+=0x1){const _0x3e881a=await readBffLockFile(_0x566269),_0x6f24ec=!!_0x3e881a?.[_0x2ef547(0x162)]?.[_0x5ba7a6]?.['functions']?.[_0x1cd785],_0x43e380=await fileExists(_0x4eaaa7);if(!_0x6f24ec&&!_0x43e380)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x2ef547(0x161)+_0x1cd785+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a39_0x1078(){const _0x3d8790=['bool','170soGOKd','read','64JncfsM','version','7747138MsAiQu','12ZCJHhc','scriptType','Script\x20ID','number','functionName','boolean','(none)','209OvzUcN','scriptContent','appCode','updateUserName','updatedTime','130164kvRGBj','2165voJktK','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','586864XlsiOt','504264mbVMqg','createdTime','16158vODqqL','13727ZKXWFC','122517BHyQHd','Return\x20full\x20raw\x20script\x20object'];a39_0x1078=function(){return _0x3d8790;};return a39_0x1078();}const a39_0x5c2b2e=a39_0x4db5;function a39_0x4db5(_0x17f12e,_0x2d1f8f){_0x17f12e=_0x17f12e-0x1b2;const _0x1078b8=a39_0x1078();let _0x4db505=_0x1078b8[_0x17f12e];return _0x4db505;}(function(_0x16dd58,_0xea1670){const _0x272b4e=a39_0x4db5,_0x3d3e45=_0x16dd58();while(!![]){try{const _0x46148d=-parseInt(_0x272b4e(0x1c9))/0x1*(parseInt(_0x272b4e(0x1b3))/0x2)+-parseInt(_0x272b4e(0x1b6))/0x3*(-parseInt(_0x272b4e(0x1c6))/0x4)+parseInt(_0x272b4e(0x1c3))/0x5*(parseInt(_0x272b4e(0x1c8))/0x6)+-parseInt(_0x272b4e(0x1b5))/0x7+parseInt(_0x272b4e(0x1c5))/0x8+-parseInt(_0x272b4e(0x1ca))/0x9*(-parseInt(_0x272b4e(0x1cd))/0xa)+-parseInt(_0x272b4e(0x1bd))/0xb*(-parseInt(_0x272b4e(0x1c2))/0xc);if(_0x46148d===_0xea1670)break;else _0x3d3e45['push'](_0x3d3e45['shift']());}catch(_0x291bfd){_0x3d3e45['push'](_0x3d3e45['shift']());}}}(a39_0x1078,0x9b147));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':'detail','description':a39_0x5c2b2e(0x1c4),'risk':a39_0x5c2b2e(0x1b2),'flags':[{'name':'id','type':a39_0x5c2b2e(0x1b9),'required':!![],'description':a39_0x5c2b2e(0x1b8)},{'name':'verbose','type':a39_0x5c2b2e(0x1bb),'description':a39_0x5c2b2e(0x1cb)}],async 'execute'(_0xfe36f0){const _0x2d18f9=a39_0x5c2b2e,_0xdf5fc7=await getBffScriptInfo(_0xfe36f0['num']('id')),_0x403ea5=_0xfe36f0[_0x2d18f9(0x1cc)]('verbose');if(_0x403ea5)return{'ok':!![],'data':_0xdf5fc7};return{'ok':!![],'data':{'id':_0xdf5fc7['id'],'functionName':_0xdf5fc7[_0x2d18f9(0x1ba)]??'','version':_0xdf5fc7[_0x2d18f9(0x1b4)]??'','updateUserName':_0xdf5fc7[_0x2d18f9(0x1c0)]??'','appCode':_0xdf5fc7[_0x2d18f9(0x1bf)],'scriptType':_0xdf5fc7[_0x2d18f9(0x1b7)],'description':_0xdf5fc7['description']||_0x2d18f9(0x1bc),'createdTime':_0xdf5fc7[_0x2d18f9(0x1c7)]??'','updatedTime':_0xdf5fc7[_0x2d18f9(0x1c1)]??'','scriptContent':_0xdf5fc7[_0x2d18f9(0x1be)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2c1864,_0x6853ee){const _0x3a9dca=a40_0x5af8,_0x21a9df=_0x2c1864();while(!![]){try{const _0x195e05=parseInt(_0x3a9dca(0x111))/0x1+parseInt(_0x3a9dca(0x10b))/0x2*(-parseInt(_0x3a9dca(0x10f))/0x3)+parseInt(_0x3a9dca(0x10e))/0x4+parseInt(_0x3a9dca(0x10c))/0x5+parseInt(_0x3a9dca(0x108))/0x6*(parseInt(_0x3a9dca(0x112))/0x7)+parseInt(_0x3a9dca(0x10a))/0x8*(parseInt(_0x3a9dca(0x10d))/0x9)+-parseInt(_0x3a9dca(0x109))/0xa*(parseInt(_0x3a9dca(0x110))/0xb);if(_0x195e05===_0x6853ee)break;else _0x21a9df['push'](_0x21a9df['shift']());}catch(_0x2bb5ba){_0x21a9df['push'](_0x21a9df['shift']());}}}(a40_0x1adc,0xc4973));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';function a40_0x5af8(_0xf58d91,_0x28a47a){_0xf58d91=_0xf58d91-0x108;const _0x1adcf3=a40_0x1adc();let _0x5af8=_0x1adcf3[_0xf58d91];return _0x5af8;}import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';function a40_0x1adc(){const _0x4817a4=['6537LvCxsg','11qapvVg','1560291rvnlqC','707kPlfSt','17598acONrV','25862290VeGbUj','2064VIeiBC','194SGBWZc','3723880Qohnsi','31824eDRWKG','356956MkImHh'];a40_0x1adc=function(){return _0x4817a4;};return a40_0x1adc();}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_0x36c809=a41_0x5681;(function(_0x2bbdb7,_0x1ab025){const _0xc9f999=a41_0x5681,_0x3c6c6b=_0x2bbdb7();while(!![]){try{const _0x1f74e5=-parseInt(_0xc9f999(0x142))/0x1*(-parseInt(_0xc9f999(0x133))/0x2)+parseInt(_0xc9f999(0x140))/0x3*(parseInt(_0xc9f999(0x138))/0x4)+parseInt(_0xc9f999(0x145))/0x5+parseInt(_0xc9f999(0x148))/0x6*(parseInt(_0xc9f999(0x13e))/0x7)+-parseInt(_0xc9f999(0x130))/0x8*(-parseInt(_0xc9f999(0x144))/0x9)+-parseInt(_0xc9f999(0x12d))/0xa+-parseInt(_0xc9f999(0x12f))/0xb;if(_0x1f74e5===_0x1ab025)break;else _0x3c6c6b['push'](_0x3c6c6b['shift']());}catch(_0x21a488){_0x3c6c6b['push'](_0x3c6c6b['shift']());}}}(a41_0x2f11,0xb9847));function a41_0x5681(_0x163123,_0x3e8fff){_0x163123=_0x163123-0x12c;const _0x2f11ce=a41_0x2f11();let _0x5681bd=_0x2f11ce[_0x163123];return _0x5681bd;}import{listBffScripts}from'../../core/api-client.js';function a41_0x2f11(){const _0x2de152=['ENDPOINT','386642dbJQCu','length','functionName','description','verbose','5144ffsmab','appCode','list','No\x20Backend\x20Function\x20scripts\x20found.','(unnamed)','Script\x20type\x20filter','133FhCcHU','read','2826YmpvIA','Return\x20full\x20script\x20objects','5zDJByO','str','27uNnHeJ','6534640oMBhWs','string','bff','189546xFwUVU','bool','name','type','Filter\x20by\x20script\x20name','13346640mFlczr','scriptType','25402102sdEzir','849736bkYUCE','List\x20Backend\x20Function\x20scripts'];a41_0x2f11=function(){return _0x2de152;};return a41_0x2f11();}export const bffList={'service':a41_0x36c809(0x147),'command':a41_0x36c809(0x13a),'description':a41_0x36c809(0x131),'risk':a41_0x36c809(0x13f),'flags':[{'name':a41_0x36c809(0x14b),'type':a41_0x36c809(0x146),'description':a41_0x36c809(0x13d),'default':a41_0x36c809(0x132),'enum':['ENDPOINT','COMMON']},{'name':a41_0x36c809(0x14a),'type':a41_0x36c809(0x146),'description':a41_0x36c809(0x12c)},{'name':a41_0x36c809(0x137),'type':'boolean','description':a41_0x36c809(0x141)}],async 'execute'(_0x13f436){const _0xcf73f=a41_0x36c809,_0x1785e4=await listBffScripts(_0x13f436[_0xcf73f(0x139)],_0x13f436[_0xcf73f(0x143)](_0xcf73f(0x14b)),{'scriptName':_0x13f436['str'](_0xcf73f(0x14a))||undefined}),_0x288091=_0x13f436[_0xcf73f(0x149)](_0xcf73f(0x137));return{'ok':!![],'data':_0x288091?_0x1785e4:_0x1785e4['map'](_0x296c9f=>({'id':_0x296c9f['id'],'functionName':_0x296c9f[_0xcf73f(0x135)]??'','description':_0x296c9f[_0xcf73f(0x136)]||_0xcf73f(0x13c),'scriptType':_0x296c9f[_0xcf73f(0x12e)]})),'message':_0x1785e4[_0xcf73f(0x134)]===0x0?_0xcf73f(0x13b):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x248300=a42_0x17fa;function a42_0x17fa(_0x1beb1a,_0x383b80){_0x1beb1a=_0x1beb1a-0x1a4;const _0xd31792=a42_0xd317();let _0x17fac4=_0xd31792[_0x1beb1a];return _0x17fac4;}(function(_0x201651,_0x514756){const _0x591d25=a42_0x17fa,_0x492d53=_0x201651();while(!![]){try{const _0x4a8263=-parseInt(_0x591d25(0x1ab))/0x1*(parseInt(_0x591d25(0x1b6))/0x2)+-parseInt(_0x591d25(0x1d2))/0x3+-parseInt(_0x591d25(0x1cd))/0x4+-parseInt(_0x591d25(0x1c8))/0x5+parseInt(_0x591d25(0x1b1))/0x6*(parseInt(_0x591d25(0x1c1))/0x7)+parseInt(_0x591d25(0x1b3))/0x8*(parseInt(_0x591d25(0x1d1))/0x9)+parseInt(_0x591d25(0x1b0))/0xa;if(_0x4a8263===_0x514756)break;else _0x492d53['push'](_0x492d53['shift']());}catch(_0x5b9b66){_0x492d53['push'](_0x492d53['shift']());}}}(a42_0xd317,0xf0ee3));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x248300(0x1ac),'INFO',a42_0x248300(0x1c6),a42_0x248300(0x1af)];function a42_0xd317(){const _0x16f8ed=['start-time','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','--since','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','133cqrTao','limit','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','since','str','WARN','string','3153640ZZtRnx','Found\x20','isSafeInteger','end-time','toUpperCase','6794424ecSXGG','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','--limit','--start-time','2547TpNxUG','2727312eEdYCr','flag','keyword','\x20Backend\x20Function\x20log\x20line(s).','\x20must\x20be\x20a\x20positive\x20integer.','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','validation','level','read','now','1CleYOy','DEBUG','length','logs','ERROR','12903550dhiSqT','561684qSXtVw','appCode','46232gYQZYy','Maximum\x20log\x20lines\x20to\x20return\x20(1-','num','958378CgQykT','--limit\x20must\x20be\x20between\x201\x20and\x20','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','number','bff','Filter\x20by\x20log\x20level'];a42_0xd317=function(){return _0x16f8ed;};return a42_0xd317();}export function resolveBffLogQuery(_0x551535,_0x6327dc=Date[a42_0x248300(0x1aa)]()){const _0x5aa2fb=a42_0x248300,_0x3936db=_0x551535[_0x5aa2fb(0x1d3)](_0x5aa2fb(0x1c4)),_0x3e5b05=_0x551535[_0x5aa2fb(0x1d3)](_0x5aa2fb(0x1bc)),_0x2a747a=_0x551535[_0x5aa2fb(0x1d3)](_0x5aa2fb(0x1cb));if(_0x3936db!==undefined&&_0x3e5b05!==undefined)throw CliErrors['validation'](_0x5aa2fb(0x1ce));const _0x11572b=_0x2a747a===undefined?_0x6327dc:readPositiveInteger(_0x551535[_0x5aa2fb(0x1b5)](_0x5aa2fb(0x1cb)),'--end-time'),_0x29de9f=_0x3e5b05===undefined?_0x11572b-readSinceMinutes(_0x551535)*0xea60:readPositiveInteger(_0x551535[_0x5aa2fb(0x1b5)](_0x5aa2fb(0x1bc)),_0x5aa2fb(0x1d0));if(_0x29de9f<=0x0)throw CliErrors[_0x5aa2fb(0x1a7)](_0x5aa2fb(0x1bd));if(_0x29de9f>_0x11572b)throw CliErrors[_0x5aa2fb(0x1a7)](_0x5aa2fb(0x1c0));const _0x4b8c7a=readPositiveInteger(_0x551535[_0x5aa2fb(0x1b5)](_0x5aa2fb(0x1c2),DEFAULT_LIMIT),_0x5aa2fb(0x1cf));if(_0x4b8c7a>MAX_LIMIT)throw CliErrors[_0x5aa2fb(0x1a7)](_0x5aa2fb(0x1b7)+MAX_LIMIT+'.');const _0x4cd8cf=_0x551535[_0x5aa2fb(0x1c5)](_0x5aa2fb(0x1a8))['trim']()[_0x5aa2fb(0x1cc)]()||undefined,_0x1fab7a=_0x551535['str'](_0x5aa2fb(0x1d4))['trim']()||undefined;return{'appCode':_0x551535[_0x5aa2fb(0x1b2)],'startTime':_0x29de9f,'endTime':_0x11572b,..._0x3e5b05===undefined?{'sinceMinutes':readSinceMinutes(_0x551535)}:{},..._0x4cd8cf?{'level':_0x4cd8cf}:{},..._0x1fab7a?{'keyword':_0x1fab7a}:{},'limit':_0x4b8c7a};}function readSinceMinutes(_0x2a5ca9){const _0xaf0227=a42_0x248300;return readPositiveInteger(_0x2a5ca9[_0xaf0227(0x1b5)](_0xaf0227(0x1c4),DEFAULT_SINCE_MINUTES),_0xaf0227(0x1bf));}function readPositiveInteger(_0x48ef36,_0x1e3286){const _0x1509d9=a42_0x248300;if(!Number[_0x1509d9(0x1ca)](_0x48ef36)||_0x48ef36<=0x0)throw CliErrors[_0x1509d9(0x1a7)](_0x1e3286+_0x1509d9(0x1a5));return _0x48ef36;}export const bffLogs={'service':a42_0x248300(0x1ba),'command':a42_0x248300(0x1ae),'description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':a42_0x248300(0x1a9),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':'since','type':a42_0x248300(0x1b9),'description':a42_0x248300(0x1be)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x248300(0x1bc),'type':a42_0x248300(0x1b9),'description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a42_0x248300(0x1cb),'type':'number','description':a42_0x248300(0x1a6)},{'name':a42_0x248300(0x1a8),'type':'string','description':a42_0x248300(0x1bb),'enum':LOG_LEVELS},{'name':a42_0x248300(0x1d4),'type':a42_0x248300(0x1c7),'description':a42_0x248300(0x1c3)},{'name':a42_0x248300(0x1c2),'type':a42_0x248300(0x1b9),'description':a42_0x248300(0x1b4)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x338f8d){resolveBffLogQuery(_0x338f8d);},async 'execute'(_0x39f518){const _0x51bd8e=a42_0x248300,_0x137138=resolveBffLogQuery(_0x39f518),{sinceMinutes:_0x1435a1,..._0xabcc00}=_0x137138,_0x2a4ad3=await searchBffScriptLogs(_0xabcc00);return{'ok':!![],'data':{'query':_0x137138,'count':_0x2a4ad3[_0x51bd8e(0x1ad)],'logs':_0x2a4ad3},'message':_0x2a4ad3[_0x51bd8e(0x1ad)]===0x0?_0x51bd8e(0x1b8):_0x51bd8e(0x1c9)+_0x2a4ad3[_0x51bd8e(0x1ad)]+_0x51bd8e(0x1a4)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x3d35be=a43_0x73b8;(function(_0x4aa9d1,_0x4a3ca4){const _0x5408e2=a43_0x73b8,_0x443e20=_0x4aa9d1();while(!![]){try{const _0x454527=-parseInt(_0x5408e2(0xb6))/0x1+parseInt(_0x5408e2(0x11d))/0x2*(parseInt(_0x5408e2(0xcf))/0x3)+parseInt(_0x5408e2(0x118))/0x4*(-parseInt(_0x5408e2(0x115))/0x5)+parseInt(_0x5408e2(0xc0))/0x6*(-parseInt(_0x5408e2(0xec))/0x7)+parseInt(_0x5408e2(0x10b))/0x8*(parseInt(_0x5408e2(0xcb))/0x9)+-parseInt(_0x5408e2(0x121))/0xa+parseInt(_0x5408e2(0xe6))/0xb;if(_0x454527===_0x4a3ca4)break;else _0x443e20['push'](_0x443e20['shift']());}catch(_0x269244){_0x443e20['push'](_0x443e20['shift']());}}}(a43_0x79aa,0x86908));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';function a43_0x73b8(_0x237e92,_0x209179){_0x237e92=_0x237e92-0xb1;const _0x79aa3e=a43_0x79aa();let _0x73b860=_0x79aa3e[_0x237e92];return _0x73b860;}import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x3d35be(0xe2),'command':a43_0x3d35be(0x108),'description':a43_0x3d35be(0x146),'risk':a43_0x3d35be(0xb3),'structuredErrors':!![],'flags':[{'name':a43_0x3d35be(0x139),'type':a43_0x3d35be(0x12c),'description':a43_0x3d35be(0x102),'enum':['COMMON','ENDPOINT',a43_0x3d35be(0x13f)]},{'name':a43_0x3d35be(0xed),'type':a43_0x3d35be(0xd5),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x1262bc){const _0xf10050=a43_0x3d35be,_0x432ed0=loadBffProjectConfig(_0x1262bc[_0xf10050(0x132)]),_0x105fd7=await readBffLockFile(_0x432ed0[_0xf10050(0xd7)]),{appLock:_0x2feb73}=ensureLockScope(_0x105fd7??createEmptyBffLock(),_0x1262bc[_0xf10050(0x132)],_0x432ed0[_0xf10050(0x111)],'pull'),_0x154cec=normalizeBffType(_0x1262bc[_0xf10050(0xba)]('type'))??undefined,[_0x44f433,_0x2d09fd]=await Promise[_0xf10050(0xbd)]([listBffScripts(_0x1262bc[_0xf10050(0x132)],_0x154cec),getBffScriptStatistics(_0x1262bc['appCode'])]),_0x22afbd=_0x44f433[_0xf10050(0x12f)](_0x48f9e7=>normalizeBffType(_0x48f9e7[_0xf10050(0xb2)])==='HOOK'),_0x4873f3=_0x22afbd?buildDatasetCodeToAliasMap(_0x1262bc[_0xf10050(0x112)],_0x1262bc[_0xf10050(0x132)],_0x1262bc[_0xf10050(0x104)]||_0x1262bc[_0xf10050(0x109)]?.[_0xf10050(0xd9)]||_0x1262bc[_0xf10050(0x109)]?.[_0xf10050(0xca)]):new Map(),_0x55f45f=_0x22afbd?await planHookDirectoryMigration(_0x432ed0,_0x2feb73,_0x4873f3,await scanLocalBffFunctions(_0x432ed0,'HOOK')):undefined,_0x46d321=createHookLocationMap(_0x2d09fd),_0x2e3f00=[];for(const _0x293d23 of _0x44f433){const _0x504de=resolveRemoteScriptTarget(_0x432ed0,_0x293d23,_0x46d321,_0x55f45f?.['projectedFunctions']??_0x2feb73['functions'],_0x4873f3);if(!_0x504de){_0x2e3f00['push']({'scriptType':_0x293d23[_0xf10050(0xb2)],'functionName':_0x293d23[_0xf10050(0x13a)]??'','status':_0xf10050(0x128),'reason':_0xf10050(0x130)});continue;}const _0x40dfc4=(_0x55f45f?.[_0xf10050(0xde)]??_0x2feb73['functions'])[_0x504de['lockKey']],_0x507384=_0x293d23[_0xf10050(0x12d)]!=null?computeContentHash(_0x293d23[_0xf10050(0x12d)]):undefined,_0x580892=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x55f45f,_0x504de)??_0x504de[_0xf10050(0x113)],_0x40dfc4,_0x507384),_0x2c8b12=_0x580892?localUnsyncedConflict(_0x504de,_0x293d23['id']):undefined;_0x2e3f00[_0xf10050(0xce)]({'lockKey':_0x504de[_0xf10050(0x11c)],'filePath':_0x504de[_0xf10050(0x113)],'remoteId':_0x293d23['id']??null,'status':_0x2c8b12?_0xf10050(0x13c):'would_pull',..._0x2c8b12?{'conflict':_0x2c8b12}:{},..._0x504de['hookLocation']?{'alias':_0x504de['hookLocation'][_0xf10050(0xf8)]??null,'datasetCode':_0x504de[_0xf10050(0x125)][_0xf10050(0xef)],'operationType':_0x504de[_0xf10050(0x125)]['operationType'],'functionNode':_0x504de[_0xf10050(0x125)]['functionNode']}:{}});}return{'method':_0xf10050(0x133),'url':_0xf10050(0xdc)+_0x1262bc[_0xf10050(0x132)]+(_0x154cec?_0xf10050(0x131)+_0x154cec:'')+_0xf10050(0x119)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x1262bc[_0xf10050(0x132)],'filterType':_0x154cec??null,..._0x55f45f&&_0x55f45f[_0xf10050(0x110)][_0xf10050(0x10c)]>0x0?{'hookDirectoryMigrations':_0x55f45f[_0xf10050(0x110)][_0xf10050(0xbc)](_0x5ba4a7=>({'from':_0x5ba4a7[_0xf10050(0xfe)],'to':_0x5ba4a7[_0xf10050(0x142)]}))}:{},'files':_0x2e3f00},'description':_0xf10050(0xdf)+_0x2e3f00[_0xf10050(0x10c)]+_0xf10050(0x123)};},async 'execute'(_0x41be60){const _0x309960=a43_0x3d35be,_0x110a84=loadBffProjectConfig(_0x41be60[_0x309960(0x132)]),_0x191d45=await readBffLockFile(_0x110a84['lockFilePath']),{lockData:_0x132958,appLock:_0x53851b}=ensureLockScope(_0x191d45??createEmptyBffLock(),_0x41be60[_0x309960(0x132)],_0x110a84[_0x309960(0x111)],_0x309960(0x108)),_0x182daf=normalizeBffType(_0x41be60[_0x309960(0xba)](_0x309960(0x139)))??undefined;if(_0x41be60[_0x309960(0xba)](_0x309960(0x139))&&!_0x182daf)throw CliErrors[_0x309960(0x10a)](_0x309960(0xdb));const [_0x3610d5,_0x303257]=await Promise['all']([listBffScripts(_0x41be60[_0x309960(0x132)],_0x182daf),getBffScriptStatistics(_0x41be60[_0x309960(0x132)])]);if(_0x3610d5[_0x309960(0x10c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x54a4cd=_0x41be60[_0x309960(0xc1)](_0x309960(0xed));if(_0x54a4cd&&!_0x41be60['nonInteractive']){const _0x15d477=await confirmForce();if(!_0x15d477)throw CliErrors[_0x309960(0xf4)](_0x309960(0xfa));}if(_0x54a4cd&&_0x41be60[_0x309960(0xfc)]){}const _0x3c0e5a=_0x3610d5[_0x309960(0x12f)](_0x199cf6=>normalizeBffType(_0x199cf6[_0x309960(0xb2)])==='HOOK'),_0x439d39=_0x3c0e5a?buildDatasetCodeToAliasMap(_0x41be60[_0x309960(0x112)],_0x41be60['appCode'],_0x41be60[_0x309960(0x104)]||_0x41be60[_0x309960(0x109)]?.[_0x309960(0xd9)]||_0x41be60[_0x309960(0x109)]?.[_0x309960(0xca)]):new Map(),_0x3b4459=createHookLocationMap(_0x303257),_0x42dcba=JSON[_0x309960(0xf2)](JSON[_0x309960(0x129)](_0x132958)),_0x33a04b=_0x41be60[_0x309960(0x132)],_0x4f9909=_0x42dcba[_0x309960(0xd4)][_0x33a04b];if(!_0x4f9909)throw new Error(_0x309960(0xcc)+_0x33a04b+_0x309960(0x12a));const _0x4669f2=_0x3c0e5a?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x110a84,_0x4f9909,_0x439d39,await scanLocalBffFunctions(_0x110a84,_0x309960(0x13f))),_0x4f9909):undefined,_0x3f08e9=createPullFileTransaction(),_0x505331=[],_0x795c8b=[],_0x583dac=[],_0x5596c0=[];for(const _0x4730b9 of _0x3610d5){const _0x4d0aea=resolveRemoteScriptTarget(_0x110a84,_0x4730b9,_0x3b4459,_0x4f9909[_0x309960(0xd8)],_0x439d39);if(!_0x4d0aea){_0x795c8b[_0x309960(0xce)]({'lockKey':_0x4730b9['scriptType']+'/'+_0x4730b9['functionName'],'reason':'unresolvable\x20target\x20path'});continue;}const _0x164084=_0x4f9909['functions'][_0x4d0aea[_0x309960(0x11c)]];try{if(!_0x4730b9['id'])throw new Error(_0x309960(0xd2));if(_0x4730b9[_0x309960(0x12d)]==null)throw new Error(_0x309960(0x120));const _0x249360=_0x4730b9[_0x309960(0x12d)],_0x362b98=computeContentHash(_0x249360);if(!_0x54a4cd){const _0x260d44=await hasUnsyncedLocalChanges(_0x4d0aea[_0x309960(0x113)],_0x164084,_0x362b98);if(_0x260d44){_0x583dac[_0x309960(0xce)](localUnsyncedConflict(_0x4d0aea,_0x4730b9['id']));continue;}}await _0x3f08e9[_0x309960(0x140)](_0x4d0aea['filePath'],_0x249360);const _0x4e5fc3={'hash':_0x362b98,'remoteId':_0x4730b9['id'],'version':_0x4730b9[_0x309960(0xf9)]};_0x4d0aea['type']===_0x309960(0x13f)&&_0x4d0aea[_0x309960(0x125)]&&(_0x4e5fc3[_0x309960(0xf8)]=_0x4d0aea['hookLocation'][_0x309960(0xf8)],_0x4e5fc3[_0x309960(0xef)]=_0x4d0aea[_0x309960(0x125)][_0x309960(0xef)],_0x4e5fc3[_0x309960(0xb5)]=_0x4d0aea[_0x309960(0x125)][_0x309960(0xb5)],_0x4e5fc3[_0x309960(0xe4)]=_0x4d0aea[_0x309960(0x125)][_0x309960(0xe4)]),_0x4f9909[_0x309960(0xd8)][_0x4d0aea[_0x309960(0x11c)]]=_0x4e5fc3,_0x505331[_0x309960(0xce)]({'lockKey':_0x4d0aea['lockKey'],'remoteId':_0x4730b9['id']});}catch(_0x2f3988){_0x5596c0[_0x309960(0xce)]({'lockKey':_0x4d0aea['lockKey'],'error':_0x2f3988 instanceof Error?_0x2f3988[_0x309960(0x145)]:String(_0x2f3988)});}}_0x4f9909['lastSync']=new Date()[_0x309960(0x117)]();try{await writeBffLockFile(_0x110a84[_0x309960(0xd7)],_0x42dcba);}catch(_0x44ad0e){const _0x21215a=[...await _0x3f08e9['rollback'](),...await _0x4669f2?.[_0x309960(0xf1)]()??[]];throw withRollbackErrors(_0x44ad0e,_0x309960(0x10f),_0x21215a);}return{'ok':_0x5596c0[_0x309960(0x10c)]===0x0,'data':{'pulled':_0x505331,'skipped':_0x795c8b,'conflicts':_0x583dac,'failed':_0x5596c0},'message':formatPullMessage(_0x505331[_0x309960(0x10c)],_0x795c8b['length'],_0x583dac[_0x309960(0x10c)],_0x5596c0['length'])};}};function a43_0x79aa(){const _0x25a467=['scriptType','read','set','operationType','492346ywSScI','\x20--name\x20','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','\x22\x20may\x20remain.','str','content','map','all','ino','require','993666AQzaiu','bool','\x20pulled','move','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','entries','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','stdin','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','sourceFilePathByNewLockKey','defaultApp','200493spKYkb','Lock\x20scope\x20for\x20app\x20\x22','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','push','1464591cSaQIn','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','remoteId','Remote\x20script\x20missing\x20id.','Could\x20not\x20restore\x20local\x20script\x20\x22','apps','boolean','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','lockFilePath','functions','currentApp','\x20failed','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','/api/management/library/scripts/list?appCode=','case-rename','projectedFunctions','Would\x20inspect\x20','\x22;\x20temporary\x20directory\x20\x22','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','bff','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','functionNode','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','4617624fSloLF','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.','delete','yes','Failed\x20to\x20write\x20local\x20script\x20\x22','stderr','7iyVyFJ','force','trim','datasetCode','\x20conflict','rollback','parse','toLowerCase','cancelled','requires','ENOENT','\x22\x20to\x20\x22','alias','version','Force\x20pull\x20cancelled.','split','nonInteractive','.hook-directory-migrate-','oldDirectory','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','has','entry','Pull\x20only\x20this\x20script\x20type','\x22:\x20','selectedAppName','oldDirectoryPath','question','Pull\x20complete:\x20','pull','mergedCli','validation','256gKfbSU','length','scriptsRootDir','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','migrations','scriptsRoot','apiDir','filePath','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','603870ULNEkf','get','toISOString','24GFqhhu','¤tPage=1&pageSize=','reverse','HOOK/','lockKey','4tuAzGU','\x22\x20from\x20\x22','newDirectoryPath','Remote\x20script\x20missing\x20content.','1752650BUXvEn','flatMap','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','lastSync','hookLocation','dev','normalize','skipped','stringify','\x22\x20not\x20found\x20after\x20ensureLockScope.','mode','string','scriptContent','newLockKey','some','unresolvable\x20target\x20path','&type=','appCode','GET','sourceDirectoryPathByNewDirectory','keyChanges','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22:\x20both\x20target\x20\x22','join','type','functionName','values','conflict','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','close','HOOK','write','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','newDirectory','push_local','oldLockKey','message','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','code'];a43_0x79aa=function(){return _0x25a467;};return a43_0x79aa();}function localUnsyncedConflict(_0x5684bb,_0x151bba){const _0x4f1b70=a43_0x3d35be,_0x5997b7=_0x5684bb[_0x4f1b70(0x11c)][_0x4f1b70(0xfb)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x5684bb[_0x4f1b70(0x11c)],'filePath':_0x5684bb[_0x4f1b70(0x113)],..._0x151bba!=null?{'remoteId':_0x151bba}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':_0x4f1b70(0x143),'command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x5684bb[_0x4f1b70(0x139)]+_0x4f1b70(0xb7)+_0x5997b7+'\x20--format\x20compress','requiresReview':!![],'message':_0x4f1b70(0xe7)}};}function formatPullMessage(_0x39ba64,_0x2dee51,_0x20ad36,_0x61702c){const _0x48ac2f=a43_0x3d35be,_0x52bf5c=[_0x48ac2f(0x107)+_0x39ba64+_0x48ac2f(0xc2),_0x2dee51+'\x20skipped'];_0x20ad36>0x0&&_0x52bf5c[_0x48ac2f(0xce)](_0x20ad36+_0x48ac2f(0xf0)+(_0x20ad36===0x1?'':'s')+'\x20'+(_0x20ad36===0x1?_0x48ac2f(0xf5):_0x48ac2f(0xbf))+'\x20resolution');if(_0x61702c>0x0)_0x52bf5c[_0x48ac2f(0xce)](_0x61702c+_0x48ac2f(0xda));return _0x52bf5c[_0x48ac2f(0x138)](',\x20');}async function hasUnsyncedLocalChanges(_0x4322ce,_0x46a90d,_0x1c4a86){if(!await fileExists(_0x4322ce))return![];const _0x155273=await computeFileHash(_0x4322ce);if(!_0x46a90d)return _0x1c4a86?_0x155273!==_0x1c4a86:!![];return _0x155273!==_0x46a90d['hash'];}function createPullFileTransaction(){const _0x23c938=new Map(),_0xc6859a=async(_0x1c727f,_0x236bbf)=>{const _0x30743c=a43_0x73b8;try{if(_0x236bbf['existed'])await ensureParentDirectory(_0x1c727f),await writeFile(_0x1c727f,_0x236bbf[_0x30743c(0xbb)]);else try{await unlink(_0x1c727f);}catch(_0x5669fa){if(_0x5669fa[_0x30743c(0xb1)]!==_0x30743c(0xf6))throw _0x5669fa;}return undefined;}catch(_0x228946){return _0x228946 instanceof Error?_0x228946:new Error(String(_0x228946));}};return{async 'write'(_0x448719,_0x274fac){const _0x46ae6b=a43_0x73b8;if(!_0x23c938[_0x46ae6b(0x100)](_0x448719))try{_0x23c938[_0x46ae6b(0xb4)](_0x448719,{'existed':!![],'content':await readFile(_0x448719)});}catch(_0x2f410f){if(_0x2f410f['code']!==_0x46ae6b(0xf6))throw _0x2f410f;_0x23c938['set'](_0x448719,{'existed':![]});}try{await ensureParentDirectory(_0x448719),await writeFile(_0x448719,_0x274fac,'utf8');}catch(_0x2a21dc){const _0x2662be=await _0xc6859a(_0x448719,_0x23c938[_0x46ae6b(0x116)](_0x448719));if(!_0x2662be)_0x23c938[_0x46ae6b(0xe8)](_0x448719);throw withRollbackErrors(_0x2a21dc,_0x46ae6b(0xea)+_0x448719+'\x22.',_0x2662be?[_0x2662be]:[]);}},async 'rollback'(){const _0x11dc36=a43_0x73b8,_0x405c86=[];for(const [_0x4e2650,_0x191860]of[..._0x23c938[_0x11dc36(0xc5)]()]['reverse']()){const _0x4a88cd=await _0xc6859a(_0x4e2650,_0x191860);_0x4a88cd&&_0x405c86[_0x11dc36(0xce)](new Error(_0x11dc36(0xd3)+_0x4e2650+_0x11dc36(0x103)+_0x4a88cd[_0x11dc36(0x145)]));}return _0x405c86;}};}function withRollbackErrors(_0x316f46,_0x177d53,_0xa0f85f){const _0x2a52fc=a43_0x3d35be,_0x5aadcf=_0x316f46 instanceof Error?_0x316f46:new Error(String(_0x316f46));if(_0xa0f85f['length']===0x0)return _0x5aadcf;return new AggregateError([_0x5aadcf,..._0xa0f85f],_0x177d53+'\x20Recovery\x20errors:\x20'+_0xa0f85f[_0x2a52fc(0xbc)](_0x386bd5=>_0x386bd5[_0x2a52fc(0x145)])[_0x2a52fc(0x138)](';\x20'));}function buildDatasetCodeToAliasMap(_0x13cc2e,_0x2ebcdb,_0x2448f7){const _0x5f4703=a43_0x3d35be,_0x5ebc6b=resolveApiModelSource(_0x13cc2e,_0x2ebcdb,_0x2448f7),_0x959d62=loadAliasMap(_0x13cc2e,undefined,_0x5ebc6b['filePath'],_0x5ebc6b['profileName']);return assertUnambiguousHookAliases(_0x959d62),new Map(_0x959d62[_0x5f4703(0xbc)](_0x25dda7=>[_0x25dda7[_0x5f4703(0xef)][_0x5f4703(0xf3)](),_0x25dda7[_0x5f4703(0xf8)]]));}async function planHookDirectoryMigration(_0xd22ca7,_0x4f63fa,_0x221bb1,_0x15b831){const _0x228a1b=a43_0x3d35be,_0x32222a=new Map();for(const [_0x1a730c,_0x4c5822]of Object[_0x228a1b(0xc5)](_0x4f63fa[_0x228a1b(0xd8)])){const [_0x1d73a7,_0x35121a,_0xe6f95c,_0xce39e2,_0x717363,..._0x3193c2]=_0x1a730c[_0x228a1b(0xfb)]('/');if(_0x1d73a7!==_0x228a1b(0x13f)||!_0x35121a||!_0xe6f95c||!_0xce39e2||!_0x717363||_0x3193c2[_0x228a1b(0x10c)]>0x0||!_0x4c5822[_0x228a1b(0xef)])continue;const _0x34c0cd=_0x221bb1['get'](_0x4c5822[_0x228a1b(0xef)][_0x228a1b(0xf3)]()),_0x5999fc=_0x34c0cd??_0x4c5822[_0x228a1b(0xef)];if(!isSafeHookDirectorySegment(_0x35121a))throw CliErrors['validation']('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x35121a+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x5999fc))throw CliErrors['validation'](_0x228a1b(0xd0)+_0x35121a+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x35121a===_0x5999fc)continue;const _0x42e238=_0x32222a[_0x228a1b(0x116)](_0x35121a)??{'datasetCode':_0x4c5822['datasetCode'],'alias':_0x34c0cd,'keyChanges':[]};if(_0x42e238[_0x228a1b(0xef)]!==_0x4c5822[_0x228a1b(0xef)])throw CliErrors['validation'](_0x228a1b(0xd0)+_0x35121a+_0x228a1b(0xcd));const _0x2be28b=_0x228a1b(0x11b)+_0x5999fc+'/'+_0xe6f95c+'/'+_0xce39e2+'/'+_0x717363;try{resolveLocalFilePathFromLockKey(_0xd22ca7,_0x1a730c),resolveLocalFilePathFromLockKey(_0xd22ca7,_0x2be28b);}catch(_0x3149fc){throw CliErrors[_0x228a1b(0x10a)](_0x228a1b(0xb8)+_0x1a730c+_0x228a1b(0x103)+(_0x3149fc instanceof Error?_0x3149fc[_0x228a1b(0x145)]:String(_0x3149fc)));}_0x42e238[_0x228a1b(0x135)][_0x228a1b(0xce)]({'oldLockKey':_0x1a730c,'newLockKey':_0x2be28b,'entry':_0x4c5822}),_0x32222a[_0x228a1b(0xb4)](_0x35121a,_0x42e238);}const _0x4b1702=new Set([..._0x32222a[_0x228a1b(0x13b)]()][_0x228a1b(0x122)](_0x234a0d=>_0x234a0d[_0x228a1b(0x135)][_0x228a1b(0xbc)](_0x416710=>_0x416710['oldLockKey']))),_0x1657a7=new Map(),_0x38ef50=new Map();for(const [_0x5b4b86,_0x4daea5]of _0x32222a){const _0x174e51=_0x4daea5[_0x228a1b(0xf8)]??_0x4daea5[_0x228a1b(0xef)],_0x44a717=hookDirectoryIdentity(_0x174e51),_0x4b0d4e=_0x1657a7[_0x228a1b(0x116)](_0x44a717);if(_0x4b0d4e&&_0x4b0d4e!==_0x5b4b86)throw CliErrors['validation'](_0x228a1b(0x10e)+_0x4b0d4e+'\x22\x20and\x20\x22'+_0x5b4b86+'\x22:\x20both\x20target\x20\x22'+_0x174e51+_0x228a1b(0x141));_0x1657a7[_0x228a1b(0xb4)](_0x44a717,_0x5b4b86);for(const _0x27eb08 of _0x4daea5[_0x228a1b(0x135)]){const _0x19315e=_0x38ef50[_0x228a1b(0x116)](_0x27eb08[_0x228a1b(0x12e)]);if(_0x19315e&&_0x19315e!==_0x27eb08[_0x228a1b(0x144)])throw CliErrors['validation'](_0x228a1b(0xe1)+_0x19315e+'\x22\x20and\x20\x22'+_0x27eb08[_0x228a1b(0x144)]+_0x228a1b(0x137)+_0x27eb08[_0x228a1b(0x12e)]+_0x228a1b(0xc8));if(_0x4b1702[_0x228a1b(0x100)](_0x27eb08[_0x228a1b(0x12e)]))throw CliErrors['validation'](_0x228a1b(0xd6)+_0x27eb08[_0x228a1b(0x144)]+'\x22:\x20its\x20target\x20\x22'+_0x27eb08[_0x228a1b(0x12e)]+'\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');_0x38ef50[_0x228a1b(0xb4)](_0x27eb08[_0x228a1b(0x12e)],_0x27eb08[_0x228a1b(0x144)]);}}const _0x420fca=new Map();for(const [_0x1acbb3,_0x1aa4e6]of _0x221bb1){_0x420fca[_0x228a1b(0xb4)](hookDirectoryIdentity(_0x1aa4e6),_0x1acbb3);}const _0x230ac3=[];for(const [_0x409e7b,_0x4518e8]of _0x32222a){const _0x10564b=_0x4518e8[_0x228a1b(0xf8)]??_0x4518e8['datasetCode'],_0x5790f2=join(_0xd22ca7['scriptsRootDir'],'HOOK',_0x409e7b),_0x31ec6a=join(_0xd22ca7[_0x228a1b(0x10d)],_0x228a1b(0x13f),_0x10564b),_0x1ac286=await directoryExists(_0x5790f2),_0x11a7e5=await directoryExists(_0x31ec6a),_0x5aa88d=_0x1ac286?_0x11a7e5?await sameDirectory(_0x5790f2,_0x31ec6a)?'case-rename':undefined:'move':'rekey';if(!_0x5aa88d)throw CliErrors[_0x228a1b(0x10a)](_0x228a1b(0xd0)+_0x409e7b+_0x228a1b(0xf7)+_0x10564b+_0x228a1b(0x13d));const _0x25d2ca=_0x420fca[_0x228a1b(0x116)](hookDirectoryIdentity(_0x409e7b));if(_0x25d2ca&&_0x25d2ca!==_0x4518e8[_0x228a1b(0xef)][_0x228a1b(0xf3)]()){const _0x111b4c=new Set(_0x4518e8[_0x228a1b(0x135)][_0x228a1b(0xbc)](_0x290ccc=>_0x290ccc[_0x228a1b(0x144)])),_0x5a2f6f=_0x15b831['filter'](_0x266b90=>_0x266b90[_0x228a1b(0x139)]===_0x228a1b(0x13f)&&_0x266b90[_0x228a1b(0xf8)]!=null&&hookDirectoryIdentity(_0x266b90[_0x228a1b(0xf8)])===hookDirectoryIdentity(_0x409e7b)&&!_0x111b4c[_0x228a1b(0x100)](_0x266b90['lockKey']));if(_0x5a2f6f[_0x228a1b(0x10c)]>0x0)throw CliErrors[_0x228a1b(0x10a)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x409e7b+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x5071cd=_0x420fca['get'](hookDirectoryIdentity(_0x10564b));if(_0x5071cd&&_0x5071cd!==_0x4518e8['datasetCode'][_0x228a1b(0xf3)]())throw CliErrors['validation'](_0x228a1b(0xd0)+_0x409e7b+'\x22\x20to\x20\x22'+_0x10564b+_0x228a1b(0xff));for(const _0x5cfcec of _0x4518e8[_0x228a1b(0x135)]){const _0x5cf604=_0x4f63fa[_0x228a1b(0xd8)][_0x5cfcec['newLockKey']];if(_0x5cf604&&!_0x4b1702['has'](_0x5cfcec[_0x228a1b(0x12e)])&&!sameHookIdentity(_0x5cfcec[_0x228a1b(0x101)],_0x5cf604))throw CliErrors['validation'](_0x228a1b(0xd0)+_0x409e7b+_0x228a1b(0xf7)+_0x10564b+_0x228a1b(0xe3));}_0x230ac3[_0x228a1b(0xce)]({'oldDirectory':_0x409e7b,'newDirectory':_0x10564b,'oldDirectoryPath':_0x5790f2,'newDirectoryPath':_0x31ec6a,'mode':_0x5aa88d,'alias':_0x4518e8['alias'],'keyChanges':_0x4518e8[_0x228a1b(0x135)]});}const _0x59283f={..._0x4f63fa['functions']},_0x3867e5=new Map(),_0x139feb=new Map();for(const _0x3cdc31 of _0x230ac3){const _0x40977f=_0x3cdc31['mode']!=='rekey';_0x40977f&&_0x139feb[_0x228a1b(0xb4)](hookDirectoryIdentity(_0x3cdc31[_0x228a1b(0x142)]),_0x3cdc31[_0x228a1b(0x105)]);for(const _0x4a1dbf of _0x3cdc31[_0x228a1b(0x135)]){const _0x1402fc=_0x59283f[_0x4a1dbf[_0x228a1b(0x12e)]],_0x5d7f9c=_0x40977f?_0x4a1dbf[_0x228a1b(0x101)]:_0x1402fc??_0x4a1dbf['entry'];_0x59283f[_0x4a1dbf[_0x228a1b(0x12e)]]=canonicalizeHookEntry(_0x5d7f9c,_0x3cdc31[_0x228a1b(0xf8)]),delete _0x59283f[_0x4a1dbf[_0x228a1b(0x144)]],_0x40977f&&_0x3867e5['set'](_0x4a1dbf[_0x228a1b(0x12e)],resolveLocalFilePathFromLockKey(_0xd22ca7,_0x4a1dbf[_0x228a1b(0x144)]));}}return{'migrations':_0x230ac3,'projectedFunctions':_0x59283f,'sourceFilePathByNewLockKey':_0x3867e5,'sourceDirectoryPathByNewDirectory':_0x139feb};}function resolveMigratedSourceFilePath(_0x4290e4,_0x4d41a5){const _0x1fadb1=a43_0x3d35be;if(!_0x4290e4||!_0x4d41a5)return undefined;const _0x6bf234=_0x4290e4[_0x1fadb1(0xc9)][_0x1fadb1(0x116)](_0x4d41a5[_0x1fadb1(0x11c)]);if(_0x6bf234)return _0x6bf234;if(_0x4d41a5['type']!==_0x1fadb1(0x13f))return undefined;const [,_0x140540,..._0x1a2c8f]=_0x4d41a5[_0x1fadb1(0x11c)][_0x1fadb1(0xfb)]('/');if(!_0x140540||_0x1a2c8f[_0x1fadb1(0x10c)]===0x0)return undefined;const _0x2676bf=_0x4290e4[_0x1fadb1(0x134)]['get'](hookDirectoryIdentity(_0x140540));return _0x2676bf?join(_0x2676bf,..._0x1a2c8f)+'.js':undefined;}function sameHookIdentity(_0x1c78d2,_0x491df3){const _0x1a045b=a43_0x3d35be;return _0x1c78d2[_0x1a045b(0xd1)]===_0x491df3[_0x1a045b(0xd1)]&&_0x1c78d2[_0x1a045b(0xef)]===_0x491df3[_0x1a045b(0xef)]&&_0x1c78d2[_0x1a045b(0xb5)]===_0x491df3[_0x1a045b(0xb5)]&&_0x1c78d2[_0x1a045b(0xe4)]===_0x491df3[_0x1a045b(0xe4)];}function canonicalizeHookEntry(_0x5f4dd9,_0x381b65){const {alias:_0xe31a78,..._0x41cacf}=_0x5f4dd9;return _0x381b65?{..._0x41cacf,'alias':_0x381b65}:_0x41cacf;}function hookDirectoryIdentity(_0x2d51b0){const _0x83b3ec=a43_0x3d35be;return _0x2d51b0[_0x83b3ec(0x127)]('NFC')[_0x83b3ec(0xf3)]();}function isSafeHookDirectorySegment(_0x555a92){return isSafeLockKeySegment(_0x555a92);}async function sameDirectory(_0x540046,_0xf330a3){const _0x3bbfc2=a43_0x3d35be,[_0x3e10f8,_0x238c8b]=await Promise[_0x3bbfc2(0xbd)]([stat(_0x540046),stat(_0xf330a3)]);return _0x3e10f8['dev']===_0x238c8b[_0x3bbfc2(0x126)]&&_0x3e10f8['ino']===_0x238c8b[_0x3bbfc2(0xbe)];}async function applyHookDirectoryMigration(_0x157d97,_0x5a9975){const _0x369835=a43_0x3d35be,_0x58b427=_0x5a9975[_0x369835(0xd8)],_0x2e0c70=_0x5a9975[_0x369835(0x124)],_0x4d74fb=[],_0x119855=async()=>{const _0x5718be=_0x369835,_0x4ace4d=[];_0x5a9975[_0x5718be(0xd8)]=_0x58b427,_0x5a9975[_0x5718be(0x124)]=_0x2e0c70;for(const {migration:_0x3a8462,temporaryPath:_0x3f1ccd}of[..._0x4d74fb][_0x5718be(0x11a)]()){try{_0x3f1ccd?(await rename(_0x3a8462[_0x5718be(0x11f)],_0x3f1ccd),await rename(_0x3f1ccd,_0x3a8462[_0x5718be(0x105)])):await rename(_0x3a8462['newDirectoryPath'],_0x3a8462[_0x5718be(0x105)]);}catch(_0x3849cc){_0x4ace4d['push'](new Error(_0x5718be(0x114)+_0x3a8462['oldDirectory']+_0x5718be(0x11e)+_0x3a8462['newDirectory']+_0x5718be(0x103)+(_0x3849cc instanceof Error?_0x3849cc['message']:String(_0x3849cc))));}}return _0x4ace4d;};try{for(const _0x4bb80f of _0x157d97[_0x369835(0x110)]){if(_0x4bb80f[_0x369835(0x12b)]===_0x369835(0xc3))await ensureParentDirectory(_0x4bb80f[_0x369835(0x11f)]),await rename(_0x4bb80f[_0x369835(0x105)],_0x4bb80f['newDirectoryPath']),_0x4d74fb[_0x369835(0xce)]({'migration':_0x4bb80f});else{if(_0x4bb80f['mode']===_0x369835(0xdd)){const _0x42b9a9=join(dirname(_0x4bb80f[_0x369835(0x105)]),_0x369835(0xfd)+randomUUID());await rename(_0x4bb80f['oldDirectoryPath'],_0x42b9a9);try{await rename(_0x42b9a9,_0x4bb80f['newDirectoryPath']);}catch(_0x436011){try{await rename(_0x42b9a9,_0x4bb80f[_0x369835(0x105)]);}catch(_0x1f95cf){throw withRollbackErrors(_0x436011,_0x369835(0xc6)+_0x4bb80f[_0x369835(0xfe)]+_0x369835(0xf7)+_0x4bb80f[_0x369835(0x142)]+_0x369835(0xe0)+_0x42b9a9+_0x369835(0xb9),[new Error(_0x369835(0x136)+_0x42b9a9+_0x369835(0xf7)+_0x4bb80f[_0x369835(0xfe)]+_0x369835(0x103)+(_0x1f95cf instanceof Error?_0x1f95cf[_0x369835(0x145)]:String(_0x1f95cf)))]);}throw _0x436011;}_0x4d74fb[_0x369835(0xce)]({'migration':_0x4bb80f,'temporaryPath':_0x42b9a9});}}}return _0x5a9975[_0x369835(0xd8)]=_0x157d97[_0x369835(0xde)],{'rollback':_0x119855};}catch(_0x3a134a){const _0x177d01=await _0x119855();throw withRollbackErrors(_0x3a134a,_0x369835(0xe5),_0x177d01);}}async function confirmForce(){const _0xe1ff76=a43_0x3d35be,_0x32ea8d=createInterface({'input':process[_0xe1ff76(0xc7)],'output':process[_0xe1ff76(0xeb)]}),_0x17ac39=await new Promise(_0xbae3d6=>{const _0x123890=_0xe1ff76;_0x32ea8d[_0x123890(0x106)](_0x123890(0xc4),_0xbae3d6);});return _0x32ea8d[_0xe1ff76(0x13e)](),['y',_0xe1ff76(0xe9)]['includes'](_0x17ac39[_0xe1ff76(0xee)]()[_0xe1ff76(0xf3)]());}
|
|
1
|
+
const a43_0x336810=a43_0x3f78;(function(_0x5a167f,_0x2abb72){const _0x2fd66e=a43_0x3f78,_0x5a942e=_0x5a167f();while(!![]){try{const _0x4d62c8=-parseInt(_0x2fd66e(0x19d))/0x1+parseInt(_0x2fd66e(0x1db))/0x2+parseInt(_0x2fd66e(0x219))/0x3*(-parseInt(_0x2fd66e(0x1c6))/0x4)+parseInt(_0x2fd66e(0x1fd))/0x5*(parseInt(_0x2fd66e(0x213))/0x6)+-parseInt(_0x2fd66e(0x20e))/0x7*(parseInt(_0x2fd66e(0x1c2))/0x8)+-parseInt(_0x2fd66e(0x1d3))/0x9*(-parseInt(_0x2fd66e(0x209))/0xa)+parseInt(_0x2fd66e(0x195))/0xb;if(_0x4d62c8===_0x2abb72)break;else _0x5a942e['push'](_0x5a942e['shift']());}catch(_0xcf6388){_0x5a942e['push'](_0x5a942e['shift']());}}}(a43_0x5b8c,0xc80b8));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';function a43_0x3f78(_0x107657,_0x11e15b){_0x107657=_0x107657-0x192;const _0x5b8c09=a43_0x5b8c();let _0x3f781d=_0x5b8c09[_0x107657];return _0x3f781d;}import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':a43_0x336810(0x1ce),'description':a43_0x336810(0x21e),'risk':'read','structuredErrors':!![],'flags':[{'name':'type','type':'string','description':a43_0x336810(0x1f0),'enum':[a43_0x336810(0x1c0),a43_0x336810(0x1d4),a43_0x336810(0x1e6)]},{'name':a43_0x336810(0x1a6),'type':a43_0x336810(0x1c7),'description':a43_0x336810(0x19a)}],async 'dryRun'(_0x3f17d7){const _0xd83b21=a43_0x336810,_0x1687bc=loadBffProjectConfig(_0x3f17d7[_0xd83b21(0x1d1)]),_0x13a53c=await readBffLockFile(_0x1687bc[_0xd83b21(0x1e2)]),{appLock:_0x5ea627}=ensureLockScope(_0x13a53c??createEmptyBffLock(),_0x3f17d7[_0xd83b21(0x1d1)],_0x1687bc[_0xd83b21(0x216)],_0xd83b21(0x1ce)),_0x2007d1=normalizeBffType(_0x3f17d7[_0xd83b21(0x1b5)](_0xd83b21(0x205)))??undefined,[_0x27b467,_0xb3066a]=await Promise[_0xd83b21(0x21b)]([listBffScripts(_0x3f17d7[_0xd83b21(0x1d1)],_0x2007d1),getBffScriptStatistics(_0x3f17d7[_0xd83b21(0x1d1)])]),_0x597e5b=_0x27b467[_0xd83b21(0x198)](_0xcb89dc=>normalizeBffType(_0xcb89dc[_0xd83b21(0x1d9)])==='HOOK'),_0x8c4414=_0x597e5b?buildDatasetCodeToAliasMap(_0x3f17d7[_0xd83b21(0x1a1)],_0x3f17d7[_0xd83b21(0x1d1)],_0x3f17d7[_0xd83b21(0x1d2)]||_0x3f17d7[_0xd83b21(0x196)]?.['currentApp']||_0x3f17d7[_0xd83b21(0x196)]?.[_0xd83b21(0x217)]):new Map(),_0x17a57b=_0x597e5b?await planHookDirectoryMigration(_0x1687bc,_0x5ea627,_0x8c4414,await scanLocalBffFunctions(_0x1687bc,'HOOK')):undefined,_0x5da790=createHookLocationMap(_0xb3066a),_0x37c7ac=[];for(const _0xfbd38b of _0x27b467){const _0x3a8af0=resolveRemoteScriptTarget(_0x1687bc,_0xfbd38b,_0x5da790,_0x17a57b?.[_0xd83b21(0x200)]??_0x5ea627[_0xd83b21(0x199)],_0x8c4414);if(!_0x3a8af0){_0x37c7ac[_0xd83b21(0x1a2)]({'scriptType':_0xfbd38b['scriptType'],'functionName':_0xfbd38b['functionName']??'','status':'skipped','reason':_0xd83b21(0x1de)});continue;}const _0x125aeb=(_0x17a57b?.[_0xd83b21(0x200)]??_0x5ea627['functions'])[_0x3a8af0[_0xd83b21(0x1ed)]],_0x2c91f2=_0xfbd38b[_0xd83b21(0x1e8)]!=null?computeContentHash(_0xfbd38b[_0xd83b21(0x1e8)]):undefined,_0x3575a9=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x17a57b,_0x3a8af0)??_0x3a8af0[_0xd83b21(0x1dd)],_0x125aeb,_0x2c91f2),_0x8d3407=_0x3575a9?localUnsyncedConflict(_0x3a8af0,_0xfbd38b['id']):undefined;_0x37c7ac[_0xd83b21(0x1a2)]({'lockKey':_0x3a8af0[_0xd83b21(0x1ed)],'filePath':_0x3a8af0[_0xd83b21(0x1dd)],'remoteId':_0xfbd38b['id']??null,'status':_0x8d3407?_0xd83b21(0x20c):_0xd83b21(0x1b0),..._0x8d3407?{'conflict':_0x8d3407}:{},..._0x3a8af0[_0xd83b21(0x1f4)]?{'alias':_0x3a8af0['hookLocation']['alias']??null,'datasetCode':_0x3a8af0[_0xd83b21(0x1f4)][_0xd83b21(0x19c)],'operationType':_0x3a8af0[_0xd83b21(0x1f4)][_0xd83b21(0x222)],'functionNode':_0x3a8af0['hookLocation']['functionNode']}:{}});}return{'method':'GET','url':_0xd83b21(0x1f1)+_0x3f17d7['appCode']+(_0x2007d1?_0xd83b21(0x21a)+_0x2007d1:'')+_0xd83b21(0x1c9)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x3f17d7['appCode'],'filterType':_0x2007d1??null,..._0x17a57b&&_0x17a57b[_0xd83b21(0x1ca)][_0xd83b21(0x1ae)]>0x0?{'hookDirectoryMigrations':_0x17a57b[_0xd83b21(0x1ca)][_0xd83b21(0x214)](_0x3326ec=>({'from':_0x3326ec[_0xd83b21(0x1c1)],'to':_0x3326ec[_0xd83b21(0x1bd)]}))}:{},'files':_0x37c7ac},'description':_0xd83b21(0x218)+_0x37c7ac[_0xd83b21(0x1ae)]+_0xd83b21(0x1d0)};},async 'execute'(_0x4d0ae9){const _0x498f90=a43_0x336810,_0x11b497=loadBffProjectConfig(_0x4d0ae9[_0x498f90(0x1d1)]),_0x9c5055=await readBffLockFile(_0x11b497[_0x498f90(0x1e2)]),{lockData:_0x1f3c4d,appLock:_0x1fdc96}=ensureLockScope(_0x9c5055??createEmptyBffLock(),_0x4d0ae9[_0x498f90(0x1d1)],_0x11b497[_0x498f90(0x216)],_0x498f90(0x1ce)),_0x44fa9c=normalizeBffType(_0x4d0ae9[_0x498f90(0x1b5)](_0x498f90(0x205)))??undefined;if(_0x4d0ae9[_0x498f90(0x1b5)](_0x498f90(0x205))&&!_0x44fa9c)throw CliErrors['validation'](_0x498f90(0x20b));const [_0x134353,_0x300b8c]=await Promise[_0x498f90(0x21b)]([listBffScripts(_0x4d0ae9['appCode'],_0x44fa9c),getBffScriptStatistics(_0x4d0ae9[_0x498f90(0x1d1)])]);if(_0x134353[_0x498f90(0x1ae)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x498f90(0x1c8)};const _0x24d91a=_0x4d0ae9['bool']('force');if(_0x24d91a&&!_0x4d0ae9[_0x498f90(0x1e7)]){const _0x1d35a9=await confirmForce();if(!_0x1d35a9)throw CliErrors[_0x498f90(0x1dc)](_0x498f90(0x1a0));}if(_0x24d91a&&_0x4d0ae9[_0x498f90(0x1e7)]){}const _0x1c16cf=_0x134353[_0x498f90(0x198)](_0x146939=>normalizeBffType(_0x146939[_0x498f90(0x1d9)])==='HOOK'),_0x5885dc=_0x1c16cf?buildDatasetCodeToAliasMap(_0x4d0ae9[_0x498f90(0x1a1)],_0x4d0ae9[_0x498f90(0x1d1)],_0x4d0ae9[_0x498f90(0x1d2)]||_0x4d0ae9['mergedCli']?.[_0x498f90(0x1b6)]||_0x4d0ae9['mergedCli']?.['defaultApp']):new Map(),_0x26b6fd=createHookLocationMap(_0x300b8c),_0x416d6=JSON['parse'](JSON[_0x498f90(0x1ef)](_0x1f3c4d)),_0x4b577e=_0x4d0ae9[_0x498f90(0x1d1)],_0x45cd88=_0x416d6['apps'][_0x4b577e];if(!_0x45cd88)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x4b577e+_0x498f90(0x1d8));const _0x38777c=_0x1c16cf?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x11b497,_0x45cd88,_0x5885dc,await scanLocalBffFunctions(_0x11b497,_0x498f90(0x1e6))),_0x45cd88):undefined,_0x4b4509=createPullFileTransaction(),_0x5dcc11=[],_0x39ed4f=[],_0xd25806=[],_0x3bb611=[];for(const _0x3a5ef7 of _0x134353){const _0x1ee4ef=resolveRemoteScriptTarget(_0x11b497,_0x3a5ef7,_0x26b6fd,_0x45cd88[_0x498f90(0x199)],_0x5885dc);if(!_0x1ee4ef){_0x39ed4f[_0x498f90(0x1a2)]({'lockKey':_0x3a5ef7[_0x498f90(0x1d9)]+'/'+_0x3a5ef7['functionName'],'reason':_0x498f90(0x1de)});continue;}const _0x10aa55=_0x45cd88[_0x498f90(0x199)][_0x1ee4ef[_0x498f90(0x1ed)]];try{if(!_0x3a5ef7['id'])throw new Error(_0x498f90(0x1cb));if(_0x3a5ef7[_0x498f90(0x1e8)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x558342=_0x3a5ef7[_0x498f90(0x1e8)],_0x28bd69=computeContentHash(_0x558342);if(!_0x24d91a){const _0x1a70bc=await hasUnsyncedLocalChanges(_0x1ee4ef[_0x498f90(0x1dd)],_0x10aa55,_0x28bd69);if(_0x1a70bc){_0xd25806[_0x498f90(0x1a2)](localUnsyncedConflict(_0x1ee4ef,_0x3a5ef7['id']));continue;}}await _0x4b4509[_0x498f90(0x20a)](_0x1ee4ef[_0x498f90(0x1dd)],_0x558342);const _0x1d3d84={'hash':_0x28bd69,'remoteId':_0x3a5ef7['id'],'version':_0x3a5ef7[_0x498f90(0x1d5)]};_0x1ee4ef[_0x498f90(0x205)]===_0x498f90(0x1e6)&&_0x1ee4ef['hookLocation']&&(_0x1d3d84[_0x498f90(0x1f9)]=_0x1ee4ef['hookLocation']['alias'],_0x1d3d84[_0x498f90(0x19c)]=_0x1ee4ef['hookLocation'][_0x498f90(0x19c)],_0x1d3d84[_0x498f90(0x222)]=_0x1ee4ef['hookLocation'][_0x498f90(0x222)],_0x1d3d84[_0x498f90(0x1ac)]=_0x1ee4ef['hookLocation'][_0x498f90(0x1ac)]),_0x45cd88['functions'][_0x1ee4ef[_0x498f90(0x1ed)]]=_0x1d3d84,_0x5dcc11[_0x498f90(0x1a2)]({'lockKey':_0x1ee4ef['lockKey'],'remoteId':_0x3a5ef7['id']});}catch(_0x3d85e2){_0x3bb611['push']({'lockKey':_0x1ee4ef[_0x498f90(0x1ed)],'error':_0x3d85e2 instanceof Error?_0x3d85e2[_0x498f90(0x1cc)]:String(_0x3d85e2)});}}_0x45cd88[_0x498f90(0x21c)]=new Date()[_0x498f90(0x225)]();try{await writeBffLockFile(_0x11b497[_0x498f90(0x1e2)],_0x416d6);}catch(_0x1f7f17){const _0xdf4bdf=[...await _0x4b4509[_0x498f90(0x1b1)](),...await _0x38777c?.[_0x498f90(0x1b1)]()??[]];throw withRollbackErrors(_0x1f7f17,_0x498f90(0x1d6),_0xdf4bdf);}return{'ok':_0x3bb611[_0x498f90(0x1ae)]===0x0,'data':{'pulled':_0x5dcc11,'skipped':_0x39ed4f,'conflicts':_0xd25806,'failed':_0x3bb611},'message':formatPullMessage(_0x5dcc11[_0x498f90(0x1ae)],_0x39ed4f['length'],_0xd25806[_0x498f90(0x1ae)],_0x3bb611[_0x498f90(0x1ae)])};}};function localUnsyncedConflict(_0x53887c,_0x12eefe){const _0x580d60=a43_0x336810,_0x3897ba=_0x53887c[_0x580d60(0x1ed)]['split']('/')['at'](-0x1);return{'code':_0x580d60(0x1e1),'lockKey':_0x53887c[_0x580d60(0x1ed)],'filePath':_0x53887c[_0x580d60(0x1dd)],..._0x12eefe!=null?{'remoteId':_0x12eefe}:{},'message':_0x580d60(0x1df),'nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x580d60(0x1aa)+_0x53887c[_0x580d60(0x205)]+_0x580d60(0x1f6)+_0x3897ba+_0x580d60(0x1b7),'requiresReview':!![],'message':_0x580d60(0x1ad)}};}function formatPullMessage(_0x2fdbd2,_0x30f566,_0x4bf8e6,_0x3d1355){const _0x4f3e5b=a43_0x336810,_0x351ba8=[_0x4f3e5b(0x1cd)+_0x2fdbd2+_0x4f3e5b(0x1a8),_0x30f566+_0x4f3e5b(0x194)];_0x4bf8e6>0x0&&_0x351ba8[_0x4f3e5b(0x1a2)](_0x4bf8e6+_0x4f3e5b(0x1c5)+(_0x4bf8e6===0x1?'':'s')+'\x20'+(_0x4bf8e6===0x1?'requires':_0x4f3e5b(0x208))+_0x4f3e5b(0x192));if(_0x3d1355>0x0)_0x351ba8[_0x4f3e5b(0x1a2)](_0x3d1355+_0x4f3e5b(0x1fa));return _0x351ba8[_0x4f3e5b(0x20f)](',\x20');}async function hasUnsyncedLocalChanges(_0x21fac0,_0x93958c,_0x3e6efc){if(!await fileExists(_0x21fac0))return![];const _0x28af66=await computeFileHash(_0x21fac0);if(!_0x93958c)return _0x3e6efc?_0x28af66!==_0x3e6efc:!![];return _0x28af66!==_0x93958c['hash'];}function createPullFileTransaction(){const _0x9ad72d=new Map(),_0x6df724=async(_0x280d56,_0x110882)=>{const _0x47201c=a43_0x3f78;try{if(_0x110882[_0x47201c(0x221)])await ensureParentDirectory(_0x280d56),await writeFile(_0x280d56,_0x110882[_0x47201c(0x1ee)]);else try{await unlink(_0x280d56);}catch(_0x132174){if(_0x132174[_0x47201c(0x1fc)]!=='ENOENT')throw _0x132174;}return undefined;}catch(_0x5326a9){return _0x5326a9 instanceof Error?_0x5326a9:new Error(String(_0x5326a9));}};return{async 'write'(_0x34d101,_0x355c00){const _0x5bded2=a43_0x3f78;if(!_0x9ad72d[_0x5bded2(0x1c4)](_0x34d101))try{_0x9ad72d[_0x5bded2(0x1ec)](_0x34d101,{'existed':!![],'content':await readFile(_0x34d101)});}catch(_0x42a7dd){if(_0x42a7dd['code']!=='ENOENT')throw _0x42a7dd;_0x9ad72d[_0x5bded2(0x1ec)](_0x34d101,{'existed':![]});}try{await ensureParentDirectory(_0x34d101),await writeFile(_0x34d101,_0x355c00,'utf8');}catch(_0x226380){const _0x3b9a4f=await _0x6df724(_0x34d101,_0x9ad72d[_0x5bded2(0x1be)](_0x34d101));if(!_0x3b9a4f)_0x9ad72d[_0x5bded2(0x1a9)](_0x34d101);throw withRollbackErrors(_0x226380,_0x5bded2(0x1bb)+_0x34d101+'\x22.',_0x3b9a4f?[_0x3b9a4f]:[]);}},async 'rollback'(){const _0x3f74da=a43_0x3f78,_0x3b0c52=[];for(const [_0x3aec5a,_0x41b5ac]of[..._0x9ad72d[_0x3f74da(0x1f7)]()][_0x3f74da(0x207)]()){const _0x596043=await _0x6df724(_0x3aec5a,_0x41b5ac);_0x596043&&_0x3b0c52[_0x3f74da(0x1a2)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x3aec5a+_0x3f74da(0x1cf)+_0x596043[_0x3f74da(0x1cc)]));}return _0x3b0c52;}};}function a43_0x5b8c(){const _0x3f39c1=['stdin','case-rename','existed','operationType','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','toISOString','oldDirectoryPath','\x20resolution','oldLockKey','\x20skipped','12362702XVXtAk','mergedCli','question','some','functions','Force\x20overwrite\x20local\x20unsynced\x20changes','split','datasetCode','916057YRgrVc','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','includes','Force\x20pull\x20cancelled.','apiDir','push','normalize','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','move','force','remoteId','\x20pulled','delete','\x20bff\x20push\x20--type\x20','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','functionNode','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.','length','\x22\x20may\x20remain.','would_pull','rollback','\x22:\x20its\x20target\x20\x22','\x22\x20and\x20\x22','mode','str','currentApp','\x20--format\x20compress','stderr','keyChanges','ino','Failed\x20to\x20write\x20local\x20script\x20\x22','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','newDirectory','get','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','COMMON','oldDirectory','28968YNmduF','NFC','has','\x20conflict','466268GkMZfu','boolean','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','¤tPage=1&pageSize=','migrations','Remote\x20script\x20missing\x20id.','message','Pull\x20complete:\x20','pull','\x22:\x20','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','appCode','selectedAppName','9mZgDXw','ENDPOINT','version','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','trim','\x22\x20not\x20found\x20after\x20ensureLockScope.','scriptType','.js','1943570uJTZbO','cancelled','filePath','unresolvable\x20target\x20path','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','dev','BFF_LOCAL_UNSYNCED','lockFilePath','filter','HOOK/','rekey','HOOK','nonInteractive','scriptContent','sourceDirectoryPathByNewDirectory','entry','values','set','lockKey','content','stringify','Pull\x20only\x20this\x20script\x20type','/api/management/library/scripts/list?appCode=','newDirectoryPath','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','hookLocation','\x22\x20to\x20\x22','\x20--name\x20','entries','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','alias','\x20failed','\x22:\x20both\x20target\x20\x22','code','90MRViuV','scriptsRootDir','flatMap','projectedFunctions','validation','newLockKey','sourceFilePathByNewLockKey','profileName','type','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','reverse','require','1511170BpxfBT','write','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','conflict','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','2450dUdaBH','join','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','523992MgCzWX','map','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','scriptsRoot','defaultApp','Would\x20inspect\x20','21lWcymR','&type=','all','lastSync','toLowerCase','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local'];a43_0x5b8c=function(){return _0x3f39c1;};return a43_0x5b8c();}function withRollbackErrors(_0x2a30b5,_0x9fe2b8,_0x3f5943){const _0x9ec6d=a43_0x336810,_0x231811=_0x2a30b5 instanceof Error?_0x2a30b5:new Error(String(_0x2a30b5));if(_0x3f5943[_0x9ec6d(0x1ae)]===0x0)return _0x231811;return new AggregateError([_0x231811,..._0x3f5943],_0x9fe2b8+'\x20Recovery\x20errors:\x20'+_0x3f5943[_0x9ec6d(0x214)](_0xa3f7c=>_0xa3f7c[_0x9ec6d(0x1cc)])[_0x9ec6d(0x20f)](';\x20'));}function buildDatasetCodeToAliasMap(_0x3087f4,_0x3ae629,_0x1403c6){const _0xc5087e=a43_0x336810,_0x107ca5=resolveApiModelSource(_0x3087f4,_0x3ae629,_0x1403c6),_0x30e8a3=loadAliasMap(_0x3087f4,undefined,_0x107ca5['filePath'],_0x107ca5[_0xc5087e(0x204)]);return assertUnambiguousHookAliases(_0x30e8a3),new Map(_0x30e8a3[_0xc5087e(0x214)](_0x22ca92=>[_0x22ca92[_0xc5087e(0x19c)][_0xc5087e(0x21d)](),_0x22ca92[_0xc5087e(0x1f9)]]));}async function planHookDirectoryMigration(_0x577739,_0x1a6830,_0xe6ef92,_0x3338d3){const _0x2a13cd=a43_0x336810,_0x5ef1bb=new Map();for(const [_0x483a0a,_0x3f5231]of Object['entries'](_0x1a6830[_0x2a13cd(0x199)])){const [_0x38d156,_0x15a2bb,_0x1cd8da,_0x372eb9,_0x31d5c6,..._0x1fb454]=_0x483a0a[_0x2a13cd(0x19b)]('/');if(_0x38d156!==_0x2a13cd(0x1e6)||!_0x15a2bb||!_0x1cd8da||!_0x372eb9||!_0x31d5c6||_0x1fb454[_0x2a13cd(0x1ae)]>0x0||!_0x3f5231[_0x2a13cd(0x19c)])continue;const _0x5d46f8=_0xe6ef92['get'](_0x3f5231[_0x2a13cd(0x19c)][_0x2a13cd(0x21d)]()),_0x541924=_0x5d46f8??_0x3f5231[_0x2a13cd(0x19c)];if(!isSafeHookDirectorySegment(_0x15a2bb))throw CliErrors[_0x2a13cd(0x201)](_0x2a13cd(0x20d)+_0x15a2bb+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x541924))throw CliErrors[_0x2a13cd(0x201)](_0x2a13cd(0x1bc)+_0x15a2bb+_0x2a13cd(0x1a4));if(_0x15a2bb===_0x541924)continue;const _0x5e0218=_0x5ef1bb[_0x2a13cd(0x1be)](_0x15a2bb)??{'datasetCode':_0x3f5231['datasetCode'],'alias':_0x5d46f8,'keyChanges':[]};if(_0x5e0218['datasetCode']!==_0x3f5231['datasetCode'])throw CliErrors[_0x2a13cd(0x201)](_0x2a13cd(0x1bc)+_0x15a2bb+_0x2a13cd(0x19e));const _0x1aa4a1=_0x2a13cd(0x1e4)+_0x541924+'/'+_0x1cd8da+'/'+_0x372eb9+'/'+_0x31d5c6;try{resolveLocalFilePathFromLockKey(_0x577739,_0x483a0a),resolveLocalFilePathFromLockKey(_0x577739,_0x1aa4a1);}catch(_0x3688e4){throw CliErrors[_0x2a13cd(0x201)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x483a0a+_0x2a13cd(0x1cf)+(_0x3688e4 instanceof Error?_0x3688e4['message']:String(_0x3688e4)));}_0x5e0218[_0x2a13cd(0x1b9)][_0x2a13cd(0x1a2)]({'oldLockKey':_0x483a0a,'newLockKey':_0x1aa4a1,'entry':_0x3f5231}),_0x5ef1bb['set'](_0x15a2bb,_0x5e0218);}const _0x4f6c0b=new Set([..._0x5ef1bb[_0x2a13cd(0x1eb)]()][_0x2a13cd(0x1ff)](_0x312780=>_0x312780[_0x2a13cd(0x1b9)][_0x2a13cd(0x214)](_0x52de1a=>_0x52de1a[_0x2a13cd(0x193)]))),_0x1df6c9=new Map(),_0xeea268=new Map();for(const [_0x43f265,_0x4dccad]of _0x5ef1bb){const _0x599b2e=_0x4dccad['alias']??_0x4dccad['datasetCode'],_0x47ed45=hookDirectoryIdentity(_0x599b2e),_0x589ed3=_0x1df6c9[_0x2a13cd(0x1be)](_0x47ed45);if(_0x589ed3&&_0x589ed3!==_0x43f265)throw CliErrors[_0x2a13cd(0x201)]('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x589ed3+_0x2a13cd(0x1b3)+_0x43f265+_0x2a13cd(0x1fb)+_0x599b2e+_0x2a13cd(0x1ab));_0x1df6c9[_0x2a13cd(0x1ec)](_0x47ed45,_0x43f265);for(const _0x1b15dd of _0x4dccad[_0x2a13cd(0x1b9)]){const _0x4e7635=_0xeea268[_0x2a13cd(0x1be)](_0x1b15dd[_0x2a13cd(0x202)]);if(_0x4e7635&&_0x4e7635!==_0x1b15dd[_0x2a13cd(0x193)])throw CliErrors[_0x2a13cd(0x201)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x4e7635+_0x2a13cd(0x1b3)+_0x1b15dd[_0x2a13cd(0x193)]+'\x22:\x20both\x20target\x20\x22'+_0x1b15dd[_0x2a13cd(0x202)]+_0x2a13cd(0x212));if(_0x4f6c0b[_0x2a13cd(0x1c4)](_0x1b15dd[_0x2a13cd(0x202)]))throw CliErrors[_0x2a13cd(0x201)](_0x2a13cd(0x223)+_0x1b15dd[_0x2a13cd(0x193)]+_0x2a13cd(0x1b2)+_0x1b15dd[_0x2a13cd(0x202)]+'\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');_0xeea268['set'](_0x1b15dd[_0x2a13cd(0x202)],_0x1b15dd[_0x2a13cd(0x193)]);}}const _0x20cd21=new Map();for(const [_0x38c92c,_0x3cee1e]of _0xe6ef92){_0x20cd21[_0x2a13cd(0x1ec)](hookDirectoryIdentity(_0x3cee1e),_0x38c92c);}const _0x2a1060=[];for(const [_0x5035a2,_0x290fcf]of _0x5ef1bb){const _0x346aff=_0x290fcf[_0x2a13cd(0x1f9)]??_0x290fcf['datasetCode'],_0x12c427=join(_0x577739[_0x2a13cd(0x1fe)],_0x2a13cd(0x1e6),_0x5035a2),_0x133d6b=join(_0x577739[_0x2a13cd(0x1fe)],'HOOK',_0x346aff),_0x555df0=await directoryExists(_0x12c427),_0x55a200=await directoryExists(_0x133d6b),_0x212946=_0x555df0?_0x55a200?await sameDirectory(_0x12c427,_0x133d6b)?_0x2a13cd(0x220):undefined:'move':_0x2a13cd(0x1e5);if(!_0x212946)throw CliErrors[_0x2a13cd(0x201)](_0x2a13cd(0x1bc)+_0x5035a2+_0x2a13cd(0x1f5)+_0x346aff+_0x2a13cd(0x224));const _0xa911b2=_0x20cd21['get'](hookDirectoryIdentity(_0x5035a2));if(_0xa911b2&&_0xa911b2!==_0x290fcf[_0x2a13cd(0x19c)][_0x2a13cd(0x21d)]()){const _0xdf15b4=new Set(_0x290fcf['keyChanges']['map'](_0x3da2bf=>_0x3da2bf[_0x2a13cd(0x193)])),_0x5ebb3c=_0x3338d3[_0x2a13cd(0x1e3)](_0x30ffa0=>_0x30ffa0[_0x2a13cd(0x205)]==='HOOK'&&_0x30ffa0['alias']!=null&&hookDirectoryIdentity(_0x30ffa0['alias'])===hookDirectoryIdentity(_0x5035a2)&&!_0xdf15b4[_0x2a13cd(0x1c4)](_0x30ffa0[_0x2a13cd(0x1ed)]));if(_0x5ebb3c[_0x2a13cd(0x1ae)]>0x0)throw CliErrors['validation'](_0x2a13cd(0x1bc)+_0x5035a2+_0x2a13cd(0x211));}const _0xb929fd=_0x20cd21[_0x2a13cd(0x1be)](hookDirectoryIdentity(_0x346aff));if(_0xb929fd&&_0xb929fd!==_0x290fcf['datasetCode'][_0x2a13cd(0x21d)]())throw CliErrors[_0x2a13cd(0x201)](_0x2a13cd(0x1bc)+_0x5035a2+'\x22\x20to\x20\x22'+_0x346aff+_0x2a13cd(0x215));for(const _0x3ac6ee of _0x290fcf[_0x2a13cd(0x1b9)]){const _0x10bcaf=_0x1a6830[_0x2a13cd(0x199)][_0x3ac6ee['newLockKey']];if(_0x10bcaf&&!_0x4f6c0b[_0x2a13cd(0x1c4)](_0x3ac6ee[_0x2a13cd(0x202)])&&!sameHookIdentity(_0x3ac6ee[_0x2a13cd(0x1ea)],_0x10bcaf))throw CliErrors[_0x2a13cd(0x201)](_0x2a13cd(0x1bc)+_0x5035a2+'\x22\x20to\x20\x22'+_0x346aff+_0x2a13cd(0x1f8));}_0x2a1060['push']({'oldDirectory':_0x5035a2,'newDirectory':_0x346aff,'oldDirectoryPath':_0x12c427,'newDirectoryPath':_0x133d6b,'mode':_0x212946,'alias':_0x290fcf['alias'],'keyChanges':_0x290fcf['keyChanges']});}const _0x1b01b7={..._0x1a6830['functions']},_0x9b7417=new Map(),_0xa52126=new Map();for(const _0x3cdf13 of _0x2a1060){const _0x15bf6a=_0x3cdf13[_0x2a13cd(0x1b4)]!=='rekey';_0x15bf6a&&_0xa52126['set'](hookDirectoryIdentity(_0x3cdf13['newDirectory']),_0x3cdf13['oldDirectoryPath']);for(const _0x4080a2 of _0x3cdf13[_0x2a13cd(0x1b9)]){const _0x47fca3=_0x1b01b7[_0x4080a2[_0x2a13cd(0x202)]],_0x4b24dc=_0x15bf6a?_0x4080a2[_0x2a13cd(0x1ea)]:_0x47fca3??_0x4080a2['entry'];_0x1b01b7[_0x4080a2[_0x2a13cd(0x202)]]=canonicalizeHookEntry(_0x4b24dc,_0x3cdf13[_0x2a13cd(0x1f9)]),delete _0x1b01b7[_0x4080a2[_0x2a13cd(0x193)]],_0x15bf6a&&_0x9b7417[_0x2a13cd(0x1ec)](_0x4080a2[_0x2a13cd(0x202)],resolveLocalFilePathFromLockKey(_0x577739,_0x4080a2['oldLockKey']));}}return{'migrations':_0x2a1060,'projectedFunctions':_0x1b01b7,'sourceFilePathByNewLockKey':_0x9b7417,'sourceDirectoryPathByNewDirectory':_0xa52126};}function resolveMigratedSourceFilePath(_0x207465,_0x56e2df){const _0x4557e2=a43_0x336810;if(!_0x207465||!_0x56e2df)return undefined;const _0x535d77=_0x207465[_0x4557e2(0x203)][_0x4557e2(0x1be)](_0x56e2df[_0x4557e2(0x1ed)]);if(_0x535d77)return _0x535d77;if(_0x56e2df['type']!==_0x4557e2(0x1e6))return undefined;const [,_0x36546c,..._0x59d099]=_0x56e2df[_0x4557e2(0x1ed)][_0x4557e2(0x19b)]('/');if(!_0x36546c||_0x59d099[_0x4557e2(0x1ae)]===0x0)return undefined;const _0x4feccd=_0x207465[_0x4557e2(0x1e9)][_0x4557e2(0x1be)](hookDirectoryIdentity(_0x36546c));return _0x4feccd?join(_0x4feccd,..._0x59d099)+_0x4557e2(0x1da):undefined;}function sameHookIdentity(_0x4bb046,_0x47bb99){const _0x6be526=a43_0x336810;return _0x4bb046[_0x6be526(0x1a7)]===_0x47bb99[_0x6be526(0x1a7)]&&_0x4bb046[_0x6be526(0x19c)]===_0x47bb99[_0x6be526(0x19c)]&&_0x4bb046[_0x6be526(0x222)]===_0x47bb99[_0x6be526(0x222)]&&_0x4bb046[_0x6be526(0x1ac)]===_0x47bb99['functionNode'];}function canonicalizeHookEntry(_0x374b5b,_0x50d8a0){const {alias:_0x4ef8a8,..._0x54a0fc}=_0x374b5b;return _0x50d8a0?{..._0x54a0fc,'alias':_0x50d8a0}:_0x54a0fc;}function hookDirectoryIdentity(_0x6b085d){const _0x57f7d7=a43_0x336810;return _0x6b085d[_0x57f7d7(0x1a3)](_0x57f7d7(0x1c3))[_0x57f7d7(0x21d)]();}function isSafeHookDirectorySegment(_0x22ed92){return isSafeLockKeySegment(_0x22ed92);}async function sameDirectory(_0x20f99f,_0x4250f6){const _0x4b0eb1=a43_0x336810,[_0x356f46,_0x40e52e]=await Promise[_0x4b0eb1(0x21b)]([stat(_0x20f99f),stat(_0x4250f6)]);return _0x356f46[_0x4b0eb1(0x1e0)]===_0x40e52e['dev']&&_0x356f46[_0x4b0eb1(0x1ba)]===_0x40e52e['ino'];}async function applyHookDirectoryMigration(_0x3ab8ed,_0x7ae40d){const _0x416601=a43_0x336810,_0x4f6124=_0x7ae40d[_0x416601(0x199)],_0x369dc2=_0x7ae40d['lastSync'],_0x1ff27b=[],_0x207dcc=async()=>{const _0x364f3a=_0x416601,_0x549074=[];_0x7ae40d[_0x364f3a(0x199)]=_0x4f6124,_0x7ae40d[_0x364f3a(0x21c)]=_0x369dc2;for(const {migration:_0x1441cf,temporaryPath:_0x74013f}of[..._0x1ff27b][_0x364f3a(0x207)]()){try{_0x74013f?(await rename(_0x1441cf[_0x364f3a(0x1f2)],_0x74013f),await rename(_0x74013f,_0x1441cf[_0x364f3a(0x226)])):await rename(_0x1441cf['newDirectoryPath'],_0x1441cf[_0x364f3a(0x226)]);}catch(_0x4b74f0){_0x549074[_0x364f3a(0x1a2)](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x1441cf[_0x364f3a(0x1c1)]+'\x22\x20from\x20\x22'+_0x1441cf[_0x364f3a(0x1bd)]+'\x22:\x20'+(_0x4b74f0 instanceof Error?_0x4b74f0['message']:String(_0x4b74f0))));}}return _0x549074;};try{for(const _0x45e2f9 of _0x3ab8ed['migrations']){if(_0x45e2f9['mode']===_0x416601(0x1a5))await ensureParentDirectory(_0x45e2f9[_0x416601(0x1f2)]),await rename(_0x45e2f9['oldDirectoryPath'],_0x45e2f9[_0x416601(0x1f2)]),_0x1ff27b[_0x416601(0x1a2)]({'migration':_0x45e2f9});else{if(_0x45e2f9[_0x416601(0x1b4)]==='case-rename'){const _0x54fbbd=join(dirname(_0x45e2f9[_0x416601(0x226)]),'.hook-directory-migrate-'+randomUUID());await rename(_0x45e2f9[_0x416601(0x226)],_0x54fbbd);try{await rename(_0x54fbbd,_0x45e2f9['newDirectoryPath']);}catch(_0x3388e1){try{await rename(_0x54fbbd,_0x45e2f9[_0x416601(0x226)]);}catch(_0x11e5c4){throw withRollbackErrors(_0x3388e1,_0x416601(0x1bf)+_0x45e2f9[_0x416601(0x1c1)]+_0x416601(0x1f5)+_0x45e2f9[_0x416601(0x1bd)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x54fbbd+_0x416601(0x1af),[new Error(_0x416601(0x210)+_0x54fbbd+'\x22\x20to\x20\x22'+_0x45e2f9[_0x416601(0x1c1)]+_0x416601(0x1cf)+(_0x11e5c4 instanceof Error?_0x11e5c4[_0x416601(0x1cc)]:String(_0x11e5c4)))]);}throw _0x3388e1;}_0x1ff27b[_0x416601(0x1a2)]({'migration':_0x45e2f9,'temporaryPath':_0x54fbbd});}}}return _0x7ae40d[_0x416601(0x199)]=_0x3ab8ed[_0x416601(0x200)],{'rollback':_0x207dcc};}catch(_0x25382f){const _0x1abd49=await _0x207dcc();throw withRollbackErrors(_0x25382f,_0x416601(0x1f3),_0x1abd49);}}async function confirmForce(){const _0x3fefec=a43_0x336810,_0x344e22=createInterface({'input':process[_0x3fefec(0x21f)],'output':process[_0x3fefec(0x1b8)]}),_0x2244e6=await new Promise(_0x28dae4=>{const _0x51bde2=_0x3fefec;_0x344e22[_0x51bde2(0x197)](_0x51bde2(0x206),_0x28dae4);});return _0x344e22['close'](),['y','yes'][_0x3fefec(0x19f)](_0x2244e6[_0x3fefec(0x1d7)]()[_0x3fefec(0x21d)]());}
|