@lovrabet/rabetbase-cli 2.5.6-beta.1 → 2.5.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.d.ts +2 -0
- package/lib/commands/flow/page-list.js +1 -0
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.d.ts +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.d.ts +6 -2
- 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 +37 -6
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.d.ts +12 -0
- 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 +11 -7
- package/skills/rabetbase/guides/approval-flow-development-workflow.md +52 -13
- package/skills/rabetbase/guides/backend-function.md +26 -4
- package/skills/rabetbase/guides/bff-creation-workflow.md +9 -0
- package/skills/rabetbase/guides/cross-database-bff.md +1 -0
- package/skills/rabetbase/guides/custom-page-flow-sdk.md +2 -0
- package/skills/rabetbase/guides/data-api-guidelines.md +2 -0
- package/skills/rabetbase/guides/flow-config-examples.md +75 -0
- package/skills/rabetbase/guides/form-flow-start.md +61 -0
- package/skills/rabetbase/guides/typescript-sdk.md +1 -1
- package/skills/rabetbase/knowledge/approval-flow/config-json-schema.md +18 -4
- package/skills/rabetbase/references/rabetbase-codegen-sdk.md +5 -4
- 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-flow-commands.md +21 -2
- package/skills/rabetbase/references/rabetbase-flow-resources.md +21 -3
- package/skills/rabetbase/references/rabetbase-flow-runtime-boundary.md +6 -2
- package/skills/rabetbase/references/rabetbase-kb.md +4 -1
- 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 +6 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x18d6f7=a34_0x40eb;(function(_0x183fad,_0x3d6f83){const _0x580746=a34_0x40eb,_0x4862bb=_0x183fad();while(!![]){try{const _0x1fa3fe=-parseInt(_0x580746(0x183))/0x1*(-parseInt(_0x580746(0x171))/0x2)+parseInt(_0x580746(0x186))/0x3+-parseInt(_0x580746(0x189))/0x4+parseInt(_0x580746(0x18a))/0x5+parseInt(_0x580746(0x18b))/0x6*(parseInt(_0x580746(0x185))/0x7)+parseInt(_0x580746(0x18e))/0x8+parseInt(_0x580746(0x17d))/0x9*(-parseInt(_0x580746(0x17f))/0xa);if(_0x1fa3fe===_0x3d6f83)break;else _0x4862bb['push'](_0x4862bb['shift']());}catch(_0x171d84){_0x4862bb['push'](_0x4862bb['shift']());}}}(a34_0x37c7,0x9858b));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a34_0x40eb(_0x42a909,_0xd77c9a){_0x42a909=_0x42a909-0x171;const _0x37c779=a34_0x37c7();let _0x40ebec=_0x37c779[_0x42a909];return _0x40ebec;}const CREATE_PATH=a34_0x18d6f7(0x180),UPDATE_PATH=a34_0x18d6f7(0x182);function a34_0x37c7(){const _0x38712c=['/smartapi/app-config/create','App\x20config\x20server\x20id\x20missing\x20for\x20key=','/smartapi/app-config/update','173797bKxJLP','string','1988cKMWRn','703329TCzngl','Updated','\x20app\x20config\x20','3324264NhvhTd','4572595MCoMoJ','17676aIsvzY','number','update','4308384UGmsNU','2gKHvYq','POST','create','isFinite','get','appCode','app-config','apiError','tags','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','Created',',\x20appCode=','3186qVZTvi','Read\x20config\x20value\x20from\x20file','35110PzHaQd'];a34_0x37c7=function(){return _0x38712c;};return a34_0x37c7();}export const appConfigSet={'service':a34_0x18d6f7(0x177),'command':'set','description':a34_0x18d6f7(0x17a),'risk':'write','args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':'file','type':a34_0x18d6f7(0x184),'description':a34_0x18d6f7(0x17e)}],async 'validate'(_0x57b0c5){readKeyArg(_0x57b0c5),readOptionalTags(_0x57b0c5),assertSingleValueSource(_0x57b0c5);},async 'dryRun'(_0x412bd9){const _0x1482b5=a34_0x18d6f7,_0x59f346=readKeyArg(_0x412bd9),_0x2a4af0=readOptionalTags(_0x412bd9),_0x3e74b9=assertSingleValueSource(_0x412bd9);await assertValueSourceReadable(_0x3e74b9);const _0x2ffa79=await withAppConfigApiBoundary('get',{'appCode':_0x412bd9[_0x1482b5(0x176)],'key':_0x59f346},()=>getAppConfigByKey(_0x412bd9[_0x1482b5(0x176)],_0x59f346)),_0x132214=_0x2ffa79?_0x1482b5(0x18d):_0x1482b5(0x173),_0x3ce4e9=_0x2ffa79?projectAppConfig(_0x2ffa79):null,_0x1dd184=plannedAppConfig({'appCode':_0x412bd9[_0x1482b5(0x176)],'key':_0x59f346,'tags':_0x2a4af0??_0x2ffa79?.[_0x1482b5(0x179)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x132214,'appCode':_0x412bd9[_0x1482b5(0x176)],'key':_0x59f346,'before':_0x3ce4e9,'after':_0x1dd184,'dryRun':!![]}),{'method':_0x1482b5(0x172),'url':_0x132214==='update'?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x303016){const _0x441305=a34_0x18d6f7,_0x49ecc5=readKeyArg(_0x303016),_0x157ed5=readOptionalTags(_0x303016),_0xd29b80=await withAppConfigApiBoundary(_0x441305(0x175),{'appCode':_0x303016[_0x441305(0x176)],'key':_0x49ecc5},()=>getAppConfigByKey(_0x303016[_0x441305(0x176)],_0x49ecc5)),_0x31b26f=_0xd29b80?projectAppConfig(_0xd29b80):null,_0x34e11e=_0xd29b80?_0x441305(0x18d):_0x441305(0x173),{value:_0x91953,warnings:_0x2b2dc1}=await readAppConfigValue(_0x303016),_0x55ecbd={'appCode':_0x303016[_0x441305(0x176)],'key':_0x49ecc5,'value':_0x91953,'tags':_0x157ed5??_0xd29b80?.[_0x441305(0x179)]??undefined};await withAppConfigApiBoundary(_0x34e11e,{'appCode':_0x303016['appCode'],'key':_0x49ecc5},async()=>{const _0x51580d=_0x441305;_0xd29b80?await updateAppConfig({..._0x55ecbd,'id':requireAppConfigId(_0xd29b80,_0x49ecc5,_0x303016[_0x51580d(0x176)])}):await createAppConfig(_0x55ecbd);});const _0x166f3d=await withAppConfigApiBoundary(_0x441305(0x175),{'appCode':_0x303016[_0x441305(0x176)],'key':_0x49ecc5},()=>getAppConfigByKey(_0x303016[_0x441305(0x176)],_0x49ecc5)),_0x400878=_0x166f3d?projectAppConfig(_0x166f3d):plannedAppConfig({'appCode':_0x303016[_0x441305(0x176)],'key':_0x49ecc5,'tags':_0x55ecbd[_0x441305(0x179)],'hasValue':_0x91953!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x34e11e,'appCode':_0x303016[_0x441305(0x176)],'key':_0x49ecc5,'before':_0x31b26f,'after':_0x400878,'dryRun':![],'warnings':_0x2b2dc1}),'message':(_0x34e11e==='update'?_0x441305(0x187):_0x441305(0x17b))+_0x441305(0x188)+_0x49ecc5};}};function requireAppConfigId(_0xa67d,_0x40a2c7,_0x47ec29){const _0x5d51a7=a34_0x18d6f7;if(typeof _0xa67d['id']===_0x5d51a7(0x18c)&&Number[_0x5d51a7(0x174)](_0xa67d['id'])&&_0xa67d['id']>0x0)return _0xa67d['id'];throw CliErrors[_0x5d51a7(0x178)](_0x5d51a7(0x181)+_0x40a2c7+_0x5d51a7(0x17c)+_0x47ec29);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x170930=a35_0x5d08;(function(_0x2ffd8b,_0x5d6471){const _0x754cfa=a35_0x5d08,_0xa18092=_0x2ffd8b();while(!![]){try{const _0x18f018=parseInt(_0x754cfa(0x21a))/0x1*(-parseInt(_0x754cfa(0x211))/0x2)+parseInt(_0x754cfa(0x1f9))/0x3+parseInt(_0x754cfa(0x20f))/0x4*(parseInt(_0x754cfa(0x203))/0x5)+parseInt(_0x754cfa(0x233))/0x6+-parseInt(_0x754cfa(0x220))/0x7+parseInt(_0x754cfa(0x214))/0x8*(parseInt(_0x754cfa(0x209))/0x9)+parseInt(_0x754cfa(0x21c))/0xa*(-parseInt(_0x754cfa(0x212))/0xb);if(_0x18f018===_0x5d6471)break;else _0xa18092['push'](_0xa18092['shift']());}catch(_0x437c12){_0xa18092['push'](_0xa18092['shift']());}}}(a35_0x36ae,0x6b639));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x170930(0x201),'description':a35_0x170930(0x225),'required':!![]};export const VALUE_ARG={'name':'value','description':a35_0x170930(0x22b),'required':![]};export const TAGS_FLAG={'name':a35_0x170930(0x22e),'type':a35_0x170930(0x200),'description':a35_0x170930(0x207)};export const STDIN_FLAG={'name':a35_0x170930(0x21f),'type':'boolean','description':a35_0x170930(0x1f6),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x170930(0x22f),'type':'string','description':a35_0x170930(0x236)};export const REVEAL_FLAG={'name':a35_0x170930(0x206),'type':a35_0x170930(0x224),'description':'Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','default':![]};export function readKeyArg(_0x3f2c1b){const _0x8a6fc7=a35_0x170930,_0x49a3b0=_0x3f2c1b[_0x8a6fc7(0x21d)][0x0]?.[_0x8a6fc7(0x20a)]()??'';return validateKey(_0x49a3b0),_0x49a3b0;}function a35_0x36ae(){const _0x386053=['121POqmhY','Missing\x20app-config\x20value\x20source.','408136tpNmVn','flag','url','error','appCode','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','129009JBhQUk','apiError','297460HYnVae','args','once','stdin','2296112nxTOvw','gmtCreate','App\x20config\x20value\x20source\x20is\x20ambiguous.','bool','boolean','Runtime\x20app-config\x20key','end','value\x20is\x20redacted','\x20app\x20config.','join','utf8','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','value','dryRun','tags','from-env','env','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','argument','1725534VAnQIK','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','name','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','appCode:\x20','method','length','push','Read\x20config\x20value\x20from\x20stdin','valueRedacted','str','615258eNgIme','defineProperties','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','operation','key:\x20','validation','hasValue','string','key','Value\x20file\x20is\x20not\x20readable:\x20','5ptzTdO','data','gmtModified','reveal','Config\x20tags\x20for\x20filtering/display\x20metadata','Environment\x20variable\x20is\x20not\x20set:\x20','153JUsUfs','trim','after','path','kind','setEncoding','1004636vRyLoo','file','8xoIpCC'];a35_0x36ae=function(){return _0x386053;};return a35_0x36ae();}export function readOptionalTags(_0x20ad69){const _0x4a080f=a35_0x170930,_0x1dca8c=_0x20ad69[_0x4a080f(0x1f8)](_0x4a080f(0x22e))[_0x4a080f(0x20a)]();if(!_0x1dca8c)return undefined;if(_0x1dca8c['length']>0x20)throw CliErrors['validation'](_0x4a080f(0x234));return _0x1dca8c;}export function validateKey(_0x5163c2){const _0x8dbc7=a35_0x170930;if(!_0x5163c2)throw CliErrors[_0x8dbc7(0x1fe)]('Missing\x20app-config\x20key.');if(_0x5163c2[_0x8dbc7(0x1f4)]>0x100)throw CliErrors[_0x8dbc7(0x1fe)](_0x8dbc7(0x231));}export function projectAppConfig(_0x25a79f,_0x22693b){const _0x1d4ec6=a35_0x170930,_0x31154e=_0x25a79f[_0x1d4ec6(0x22c)]!==undefined&&_0x25a79f[_0x1d4ec6(0x22c)]!==null&&_0x25a79f['value']!=='',_0x31ecae={'appCode':_0x25a79f[_0x1d4ec6(0x218)],'key':_0x25a79f[_0x1d4ec6(0x201)],'tags':_0x25a79f[_0x1d4ec6(0x22e)]??undefined,'hasValue':_0x31154e,'valueRedacted':_0x31154e&&!_0x22693b?.['reveal'],'gmtCreate':_0x25a79f[_0x1d4ec6(0x221)],'gmtModified':_0x25a79f[_0x1d4ec6(0x205)]};return _0x22693b?.[_0x1d4ec6(0x206)]&&(_0x31ecae[_0x1d4ec6(0x22c)]=_0x25a79f[_0x1d4ec6(0x22c)]??'',_0x31ecae[_0x1d4ec6(0x1f7)]=![]),_0x31ecae;}export function plannedAppConfig(_0x341bf1){const _0x410e52=a35_0x170930,_0x5046cc=_0x341bf1[_0x410e52(0x1ff)]??!![];return{'appCode':_0x341bf1[_0x410e52(0x218)],'key':_0x341bf1[_0x410e52(0x201)],'tags':_0x341bf1[_0x410e52(0x22e)]??undefined,'hasValue':_0x5046cc,'valueRedacted':_0x5046cc};}export function buildMutationData(_0x1b2799){const _0x5d9860=a35_0x170930;return{'operation':_0x1b2799[_0x5d9860(0x1fc)],'selector':{'appCode':_0x1b2799[_0x5d9860(0x218)],'key':_0x1b2799[_0x5d9860(0x201)]},'before':_0x1b2799['before'],'after':_0x1b2799[_0x5d9860(0x20b)],'dryRun':_0x1b2799[_0x5d9860(0x22d)],'warnings':_0x1b2799['warnings']??[]};}export async function withAppConfigApiBoundary(_0x58cdd1,_0x871b22,_0xb3ba6a){const _0x2c5393=a35_0x170930;try{return await _0xb3ba6a();}catch{const _0x283db2=[_0x2c5393(0x237)+_0x871b22['appCode']];if(_0x871b22['key'])_0x283db2['push'](_0x2c5393(0x1fd)+_0x871b22['key']);_0x283db2[_0x2c5393(0x1f5)](_0x2c5393(0x227));throw CliErrors[_0x2c5393(0x21b)]('Failed\x20to\x20'+_0x58cdd1+_0x2c5393(0x228),_0x283db2[_0x2c5393(0x229)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x8fcd10,_0x53ea2e){const _0x3745db=a35_0x170930;return Object[_0x3745db(0x1fa)](_0x8fcd10,{'method':{'value':_0x53ea2e[_0x3745db(0x1f3)],'enumerable':![]},'url':{'value':_0x53ea2e[_0x3745db(0x216)],'enumerable':![]}});}export function assertSingleValueSource(_0x1b3a64){const _0x1e3125=a35_0x170930,_0x37dda1=[];_0x1b3a64[_0x1e3125(0x21d)][_0x1e3125(0x1f4)]>0x1&&_0x37dda1[_0x1e3125(0x1f5)]({'kind':_0x1e3125(0x232),'value':_0x1b3a64[_0x1e3125(0x21d)]['slice'](0x1)[_0x1e3125(0x229)]('\x20')});const _0x28a221=_0x1b3a64[_0x1e3125(0x215)]('value');_0x28a221!==undefined&&_0x28a221!==null&&_0x37dda1[_0x1e3125(0x1f5)]({'kind':_0x1e3125(0x232),'value':String(_0x28a221)});_0x1b3a64[_0x1e3125(0x223)]('stdin')&&_0x37dda1[_0x1e3125(0x1f5)]({'kind':_0x1e3125(0x21f)});const _0x37b6fb=_0x1b3a64[_0x1e3125(0x1f8)]('from-env')[_0x1e3125(0x20a)]();_0x37b6fb&&_0x37dda1[_0x1e3125(0x1f5)]({'kind':_0x1e3125(0x230),'name':_0x37b6fb});const _0x30f0bd=_0x1b3a64[_0x1e3125(0x1f8)](_0x1e3125(0x210))['trim']();_0x30f0bd&&_0x37dda1[_0x1e3125(0x1f5)]({'kind':_0x1e3125(0x210),'path':_0x30f0bd});if(_0x37dda1[_0x1e3125(0x1f4)]===0x0)throw CliErrors[_0x1e3125(0x1fe)](_0x1e3125(0x213),_0x1e3125(0x219));if(_0x37dda1[_0x1e3125(0x1f4)]>0x1)throw CliErrors[_0x1e3125(0x1fe)](_0x1e3125(0x222),'Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');return _0x37dda1[0x0];}export async function assertValueSourceReadable(_0x4fdc91){const _0x2bddcd=a35_0x170930;if(_0x4fdc91[_0x2bddcd(0x20d)]==='env'&&!(_0x4fdc91[_0x2bddcd(0x235)]in process.env))throw CliErrors[_0x2bddcd(0x1fe)](_0x2bddcd(0x208)+_0x4fdc91['name']);if(_0x4fdc91[_0x2bddcd(0x20d)]==='file')try{await access(_0x4fdc91[_0x2bddcd(0x20c)]);}catch{throw CliErrors['validation'](_0x2bddcd(0x202)+_0x4fdc91[_0x2bddcd(0x20c)]);}}export async function readAppConfigValue(_0x594133){const _0x552adc=a35_0x170930,_0x4ca667=assertSingleValueSource(_0x594133),_0x4dacd9=[];if(_0x4ca667[_0x552adc(0x20d)]===_0x552adc(0x232))return _0x4dacd9[_0x552adc(0x1f5)](_0x552adc(0x1fb)),{'value':_0x4ca667['value']??'','source':_0x4ca667[_0x552adc(0x20d)],'warnings':_0x4dacd9};if(_0x4ca667[_0x552adc(0x20d)]==='stdin')return{'value':await readStdin(),'source':_0x4ca667['kind'],'warnings':_0x4dacd9};if(_0x4ca667['kind']===_0x552adc(0x230)){if(!(_0x4ca667[_0x552adc(0x235)]in process.env))throw CliErrors[_0x552adc(0x1fe)](_0x552adc(0x208)+_0x4ca667['name']);return{'value':process.env[_0x4ca667.name]??'','source':_0x4ca667['kind'],'warnings':_0x4dacd9};}return{'value':await readFile(_0x4ca667['path'],_0x552adc(0x22a)),'source':_0x4ca667[_0x552adc(0x20d)],'warnings':_0x4dacd9};}function a35_0x5d08(_0x2d8759,_0x56c0e7){_0x2d8759=_0x2d8759-0x1f3;const _0x36ae4d=a35_0x36ae();let _0x5d0894=_0x36ae4d[_0x2d8759];return _0x5d0894;}function readStdin(){return new Promise((_0x2be454,_0x362b84)=>{const _0x2285b1=a35_0x5d08;let _0x447e8e='';process[_0x2285b1(0x21f)][_0x2285b1(0x20e)](_0x2285b1(0x22a)),process[_0x2285b1(0x21f)]['on'](_0x2285b1(0x204),_0x101174=>{_0x447e8e+=_0x101174;}),process['stdin'][_0x2285b1(0x21e)](_0x2285b1(0x226),()=>_0x2be454(_0x447e8e)),process[_0x2285b1(0x21f)]['once'](_0x2285b1(0x217),_0x362b84);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a36_0x4bbd(_0x52070c,_0xda9e0b){_0x52070c=_0x52070c-0xf7;const _0x310dca=a36_0x310d();let _0x4bbdfc=_0x310dca[_0x52070c];return _0x4bbdfc;}const a36_0x35de7b=a36_0x4bbd;(function(_0x1acbff,_0x34227e){const _0x5686f8=a36_0x4bbd,_0x1c2d8c=_0x1acbff();while(!![]){try{const _0xd0396a=parseInt(_0x5686f8(0x10f))/0x1+-parseInt(_0x5686f8(0xfa))/0x2+-parseInt(_0x5686f8(0x10c))/0x3*(parseInt(_0x5686f8(0xf9))/0x4)+parseInt(_0x5686f8(0xfc))/0x5*(-parseInt(_0x5686f8(0xfb))/0x6)+-parseInt(_0x5686f8(0xfe))/0x7*(-parseInt(_0x5686f8(0x109))/0x8)+parseInt(_0x5686f8(0x106))/0x9*(parseInt(_0x5686f8(0x10b))/0xa)+parseInt(_0x5686f8(0x105))/0xb;if(_0xd0396a===_0x34227e)break;else _0x1c2d8c['push'](_0x1c2d8c['shift']());}catch(_0x28deff){_0x1c2d8c['push'](_0x1c2d8c['shift']());}}}(a36_0x310d,0xebe8b));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x310d(){const _0x474657=['Login\x20via\x20browser','auth','bool','nonInteractive','../../auth/auth-server-ui.js','9563246kKnCit','108396BCkRfN','Clear\x20login\x20session','write','404848aXSwYW','logout','1470xJPALF','15pgZwKx','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','log','1180595kjjxue','!\x20Not\x20logged\x20in','login','1454128NoHWsM','2211636wkhGLm','1310244CJszci','10yEVIye','yes','70zwgjHY','boolean'];a36_0x310d=function(){return _0x474657;};return a36_0x310d();}export const authDefinitions=[{'service':a36_0x35de7b(0x101),'command':a36_0x35de7b(0xf8),'description':a36_0x35de7b(0x100),'risk':a36_0x35de7b(0x108),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x35de7b(0xfd),'type':a36_0x35de7b(0xff),'description':a36_0x35de7b(0x10d),'default':![]}],async 'execute'(_0xbe2bc2){const _0x4dbd57=a36_0x35de7b,{runAuthServer:_0xe14f82}=await import(_0x4dbd57(0x104));return await _0xe14f82({'autoYes':_0xbe2bc2[_0x4dbd57(0x102)](_0x4dbd57(0xfd)),'nonInteractive':_0xbe2bc2[_0x4dbd57(0x103)]}),{'ok':!![]};}},{'service':a36_0x35de7b(0x101),'command':a36_0x35de7b(0x10a),'description':a36_0x35de7b(0x107),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x25c455){const _0x5794f5=a36_0x35de7b;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x5794f5(0x10e)]('✓\x20Logged\x20out')):console[_0x5794f5(0x10e)](_0x5794f5(0xf7)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x6f81a6=a37_0x18a8;(function(_0x3dd742,_0x2caaea){const _0x40796e=a37_0x18a8,_0x354dfa=_0x3dd742();while(!![]){try{const _0x512934=-parseInt(_0x40796e(0x1e4))/0x1*(parseInt(_0x40796e(0x1d4))/0x2)+parseInt(_0x40796e(0x232))/0x3*(parseInt(_0x40796e(0x1ce))/0x4)+parseInt(_0x40796e(0x22f))/0x5*(parseInt(_0x40796e(0x1f1))/0x6)+-parseInt(_0x40796e(0x231))/0x7+-parseInt(_0x40796e(0x224))/0x8*(-parseInt(_0x40796e(0x1d3))/0x9)+-parseInt(_0x40796e(0x20f))/0xa+parseInt(_0x40796e(0x22a))/0xb;if(_0x512934===_0x2caaea)break;else _0x354dfa['push'](_0x354dfa['shift']());}catch(_0x40c29e){_0x354dfa['push'](_0x354dfa['shift']());}}}(a37_0x2eed,0x26b05));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';function a37_0x2eed(){const _0x1adf5a=['521997KrXnhJ','17409KiscHZ','File\x20already\x20exists:\x20','Script\x20description','stderr','\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','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','HOOK','Invalid\x20function\x20name\x20\x22','close','ENDPOINT','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','string','No\x20operation\x20types\x20found\x20for\x20dataset\x20','scriptsRootDir','Function\x20name\x20(valid\x20JS\x20identifier)','COMMON','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','88GPmCZK','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','apiDir','Select\x20dataset:','\x20api\x20pull`\x20to\x20refresh.','8694ycdScT','4ghcOmB','profileName','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','operation-type','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','name','validation','write','/HOOK/','\x22\x20not\x20found\x20for\x20dataset\x20','before','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','.js\x0a','\x0a\x20*\x20[平台配置]\x20','mergedCli','117805DbTMup','selectedAppName','functionNode','修改后的响应结果','Dataset\x20not\x20found\x20for\x20code\x20\x22','/data/dataset/','code','datasetCode','parseInt','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','find','description','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','132kiJKOH','trim','function-node','datasetId','entries','\x22\x20not\x20found.\x20','source','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','datasetcode','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','create','after','Select\x20trigger\x20node:','.js','Operation\x20type\x20\x22','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','UNKNOWN','Available\x20aliases:\x20','\x20function:\x20','nonInteractive','length','keys','str','map','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','/COMMON/','currentApp','3059490klTcTi','/**\x0a\x20*\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','includes','Created\x20','defaultApp','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','join','appCode','No\x20datasets\x20found\x20for\x20this\x20app.','Select\x20operation\x20type:','Invalid\x20dataset\x20selection.','operationType','type','filePath','\x22.\x20','/ENDPOINT/','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','No\x20model\x20aliases\x20found.\x20Run\x20`','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','1192unnHOJ','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','alias','.js\x0a\x20*\x20[触发节点]\x20','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Trigger\x20node\x20(HOOK\x20only)','4969371pdIpaI','question','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Available:\x20','utf8','11645MeAxqI','修改后的请求参数'];a37_0x2eed=function(){return _0x1adf5a;};return a37_0x2eed();}import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x18a8(_0x15f958,_0x174e48){_0x15f958=_0x15f958-0x1c0;const _0x2eed2e=a37_0x2eed();let _0x18a846=_0x2eed2e[_0x15f958];return _0x18a846;}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_0x6f81a6(0x1fb),'description':a37_0x6f81a6(0x1f0),'risk':'read','flags':[{'name':a37_0x6f81a6(0x21d),'type':a37_0x6f81a6(0x1c8),'required':!![],'enum':[a37_0x6f81a6(0x1cc),a37_0x6f81a6(0x1c6),a37_0x6f81a6(0x1c3)],'description':'Script\x20type'},{'name':a37_0x6f81a6(0x1da),'type':a37_0x6f81a6(0x1c8),'required':!![],'description':a37_0x6f81a6(0x1cb)},{'name':a37_0x6f81a6(0x1ef),'type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x234)},{'name':'alias','type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x221)},{'name':a37_0x6f81a6(0x1f9),'type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x1fa)},{'name':a37_0x6f81a6(0x1d8),'type':a37_0x6f81a6(0x1c8),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a37_0x6f81a6(0x1f3),'type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x229),'enum':['before','after']}],async 'validate'(_0x31c80b){const _0x3f4982=a37_0x6f81a6,_0x551383=_0x31c80b['str']('name');if(!isValidBffFunctionName(_0x551383))throw CliErrors[_0x3f4982(0x1db)](_0x3f4982(0x1c4)+_0x551383+_0x3f4982(0x1d7));},async 'execute'(_0x3e707d){const _0x2f057d=a37_0x6f81a6,_0x1144f3=loadBffProjectConfig(_0x3e707d['appCode']),_0x572bb4=_0x3e707d[_0x2f057d(0x207)](_0x2f057d(0x21d)),_0x5c4f47=_0x3e707d[_0x2f057d(0x207)](_0x2f057d(0x1da)),_0x324521=_0x3e707d[_0x2f057d(0x207)]('description')||undefined,_0x14461c=_0x572bb4===_0x2f057d(0x1c3)?await resolveHookOptions(_0x1144f3,_0x3e707d):undefined,_0x21df5e=buildFilePath(_0x1144f3,_0x572bb4,_0x5c4f47,_0x14461c);if(await fileExists(_0x21df5e))throw CliErrors[_0x2f057d(0x1db)](_0x2f057d(0x233)+_0x21df5e);await mkdir(dirname(_0x21df5e),{'recursive':!![]});const _0x10be28=generateTemplate(_0x572bb4,_0x5c4f47,_0x3e707d[_0x2f057d(0x218)],_0x324521,_0x14461c);await writeFile(_0x21df5e,_0x10be28,_0x2f057d(0x22e));const _0xacc30c={'type':_0x572bb4,'name':_0x5c4f47,'path':_0x21df5e};if(_0x324521)_0xacc30c[_0x2f057d(0x1ef)]=_0x324521;if(_0x14461c){if(_0x14461c[_0x2f057d(0x226)])_0xacc30c[_0x2f057d(0x226)]=_0x14461c[_0x2f057d(0x226)];_0xacc30c['datasetCode']=_0x14461c[_0x2f057d(0x1eb)],_0xacc30c['operationType']=_0x14461c[_0x2f057d(0x21c)],_0xacc30c[_0x2f057d(0x1e6)]=_0x14461c['functionNode'];}return{'ok':!![],'data':_0xacc30c,'message':_0x2f057d(0x213)+_0x572bb4+_0x2f057d(0x203)+_0x5c4f47};}};async function resolveHookOptions(_0x39f610,_0x1581f1){const _0x287e34=a37_0x6f81a6,_0x4d09db=resolveApiModelSource(_0x1581f1[_0x287e34(0x1d0)],_0x1581f1['appCode'],_0x1581f1[_0x287e34(0x1e5)]||_0x1581f1['mergedCli']?.[_0x287e34(0x20e)]||_0x1581f1[_0x287e34(0x1e3)]?.[_0x287e34(0x214)]),_0x355da1=loadAliasMap(_0x1581f1[_0x287e34(0x1d0)],undefined,_0x4d09db[_0x287e34(0x21e)],_0x4d09db['profileName']),_0x331529=_0x355da1['length']>0x0;let _0x26ee28,_0x1d030b,_0x135ee0;const _0x58e317=_0x1581f1[_0x287e34(0x207)]('alias'),_0x2550fd=_0x1581f1[_0x287e34(0x207)](_0x287e34(0x1f9));if(_0x58e317){const _0x3b2ef4=resolveAlias(_0x1581f1[_0x287e34(0x1d0)],_0x58e317,undefined,_0x4d09db[_0x287e34(0x21e)],_0x4d09db[_0x287e34(0x1d5)]);if(!_0x3b2ef4){const _0x29f6f3=_0x331529?_0x287e34(0x202)+_0x355da1[_0x287e34(0x208)](_0x10ee6c=>_0x10ee6c[_0x287e34(0x226)])[_0x287e34(0x217)](',\x20'):_0x287e34(0x222)+CLI_BIN_NAME+_0x287e34(0x1cf);throw CliErrors['validation']('Alias\x20\x22'+_0x58e317+_0x287e34(0x1f6)+_0x29f6f3);}_0x26ee28=_0x58e317,_0x1d030b=_0x3b2ef4;}else{if(_0x2550fd){_0x1d030b=_0x2550fd;const _0x757dbd=_0x355da1[_0x287e34(0x1ee)](_0x480c10=>_0x480c10[_0x287e34(0x1eb)]===_0x2550fd);_0x26ee28=_0x757dbd?.['alias'];}else{if(_0x1581f1[_0x287e34(0x204)])throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x200));else{if(_0x331529){const _0x416a31=_0x355da1['map'](_0x43c65d=>_0x43c65d['alias']+'\x20('+_0x43c65d['tableName']+')'),_0x10ffce=await promptSelect(_0x287e34(0x1d1),_0x416a31),_0x4046cd=_0x355da1[_0x10ffce];if(!_0x4046cd)throw CliErrors['validation'](_0x287e34(0x21b));_0x26ee28=_0x4046cd[_0x287e34(0x226)],_0x1d030b=_0x4046cd['datasetCode'];}else{const _0x3c96e7=await listDatasets(_0x1581f1[_0x287e34(0x218)]);if(_0x3c96e7[_0x287e34(0x205)]===0x0)throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x219));const _0x4a34c3=_0x3c96e7[_0x287e34(0x208)](_0x152f7f=>_0x152f7f[_0x287e34(0x1da)]+'\x20['+(_0x152f7f[_0x287e34(0x1f7)]??_0x287e34(0x201))+']\x20('+_0x152f7f[_0x287e34(0x1ea)]+')'),_0x3ed633=await promptSelect(_0x287e34(0x1d1),_0x4a34c3),_0x520bcb=_0x3c96e7[_0x3ed633];if(!_0x520bcb)throw CliErrors['validation'](_0x287e34(0x21b));_0x1d030b=_0x520bcb[_0x287e34(0x1ea)],_0x26ee28=undefined;}}}}const _0x1335bb=await listDatasets(_0x1581f1[_0x287e34(0x218)]),_0x36ec12=_0x1335bb[_0x287e34(0x1ee)](_0x305bcf=>_0x305bcf[_0x287e34(0x1ea)]===_0x1d030b);if(!_0x36ec12)throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x1e8)+_0x1d030b+_0x287e34(0x21f)+(_0x26ee28?_0x287e34(0x1ed)+CLI_BIN_NAME+_0x287e34(0x1d2):''));_0x135ee0=_0x36ec12['id'];const _0x5794c4=_0x26ee28??_0x1d030b,_0x4510fd=await listBffDatasetOperations(_0x1581f1[_0x287e34(0x218)],_0x135ee0),_0x4c39df=_0x4510fd?Object[_0x287e34(0x206)](_0x4510fd):[];if(_0x4c39df[_0x287e34(0x205)]===0x0)throw CliErrors['validation'](_0x287e34(0x1c9)+_0x5794c4+'.');let _0x70cb3b;const _0x1b246f=_0x1581f1[_0x287e34(0x207)]('operation-type');if(_0x1b246f){if(!_0x4c39df[_0x287e34(0x212)](_0x1b246f))throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x1ff)+_0x1b246f+_0x287e34(0x1de)+_0x5794c4+'.\x20'+(_0x287e34(0x22d)+_0x4c39df[_0x287e34(0x217)](',\x20')));_0x70cb3b=_0x1b246f;}else{if(_0x1581f1[_0x287e34(0x204)])throw CliErrors['validation'](_0x287e34(0x20c));const _0x158e46=await promptSelect(_0x287e34(0x21a),_0x4c39df);_0x70cb3b=_0x4c39df[_0x158e46]??_0x4c39df[0x0];}let _0x4c68df=normalizeHookFunctionNode(_0x1581f1[_0x287e34(0x207)]('function-node'));if(!_0x4c68df){if(_0x1581f1['str']('function-node'))throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x1d6));if(_0x1581f1['nonInteractive'])throw CliErrors['validation'](_0x287e34(0x1f8));const _0xdb3b78=await promptSelect(_0x287e34(0x1fd),[_0x287e34(0x1df),_0x287e34(0x1fc)]);_0x4c68df=[_0x287e34(0x1df),_0x287e34(0x1fc)][_0xdb3b78]??'before';}return{'alias':_0x26ee28,'datasetCode':_0x1d030b,'datasetId':_0x135ee0,'operationType':_0x70cb3b,'functionNode':_0x4c68df};}async function promptSelect(_0x13eab8,_0x4c4bf3){const _0x3632d2=a37_0x6f81a6;if(_0x4c4bf3[_0x3632d2(0x205)]===0x1)return 0x0;for(const [_0x2d7cfb,_0x2e887e]of _0x4c4bf3[_0x3632d2(0x1f5)]()){process[_0x3632d2(0x1c0)]['write']('\x20\x20'+(_0x2d7cfb+0x1)+'.\x20'+_0x2e887e+'\x0a');}const _0x1c6e80=createInterface({'input':process['stdin'],'output':process[_0x3632d2(0x1c0)]});while(!![]){const _0x45bafe=await new Promise(_0x5310ad=>{const _0x508c71=_0x3632d2;_0x1c6e80[_0x508c71(0x22b)](_0x13eab8+'\x20',_0x5310ad);}),_0x42f2fd=Number[_0x3632d2(0x1ec)](_0x45bafe[_0x3632d2(0x1f2)](),0xa);if(Number['isInteger'](_0x42f2fd)&&_0x42f2fd>=0x1&&_0x42f2fd<=_0x4c4bf3[_0x3632d2(0x205)])return _0x1c6e80[_0x3632d2(0x1c5)](),_0x42f2fd-0x1;process[_0x3632d2(0x1c0)][_0x3632d2(0x1dc)](_0x3632d2(0x223)+_0x4c4bf3['length']+'.\x0a');}}function buildFilePath(_0x42c563,_0x10ef68,_0x12a605,_0x5f4189){const _0x1539ac=a37_0x6f81a6;if(_0x10ef68===_0x1539ac(0x1c3)){if(!_0x5f4189)throw CliErrors[_0x1539ac(0x1db)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x36477e=_0x5f4189['alias']??_0x5f4189[_0x1539ac(0x1eb)];return join(_0x42c563[_0x1539ac(0x1ca)],_0x1539ac(0x1c3),_0x36477e,_0x5f4189[_0x1539ac(0x21c)],_0x5f4189[_0x1539ac(0x1e6)],_0x12a605+_0x1539ac(0x1fe));}return join(_0x42c563[_0x1539ac(0x1ca)],_0x10ef68,_0x12a605+_0x1539ac(0x1fe));}export function generateTemplate(_0x527172,_0x158061,_0x46d2b1,_0xe874e6,_0x474809){const _0x2fe1bc=a37_0x6f81a6,_0x12cb5b=_0xe874e6?.[_0x2fe1bc(0x1f2)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3fb0da=getAppBaseUrl(_0x46d2b1),_0x1c4c54=_0x2fe1bc(0x215);if(_0x527172===_0x2fe1bc(0x1cc))return'/**\x0a\x20*\x20'+_0x12cb5b+_0x2fe1bc(0x1c2)+_0x158061+_0x2fe1bc(0x1e2)+_0x3fb0da+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x46d2b1+_0x2fe1bc(0x20d)+_0x158061+_0x2fe1bc(0x216)+_0x158061+'\x22,\x20params\x20})\x0a'+_0x1c4c54+_0x2fe1bc(0x211)+_0x158061+_0x2fe1bc(0x228);if(_0x527172===_0x2fe1bc(0x1c6))return _0x2fe1bc(0x210)+_0x12cb5b+_0x2fe1bc(0x225)+_0x158061+_0x2fe1bc(0x209)+_0x46d2b1+'/'+_0x158061+'\x0a\x20*\x20[平台配置]\x20'+_0x3fb0da+_0x2fe1bc(0x20a)+_0x46d2b1+_0x2fe1bc(0x220)+_0x158061+_0x2fe1bc(0x1e1)+_0x1c4c54+_0x2fe1bc(0x1c1)+_0x158061+_0x2fe1bc(0x228);if(!_0x474809)throw CliErrors[_0x2fe1bc(0x1db)](_0x2fe1bc(0x20b));const _0x3ae318=_0x474809['alias']??_0x474809['datasetCode'],_0x38722b=_0x474809[_0x2fe1bc(0x1e6)]===_0x2fe1bc(0x1df)?'当前请求参数':'当前响应结果',_0x47c57c=_0x474809[_0x2fe1bc(0x1e6)]===_0x2fe1bc(0x1df)?_0x2fe1bc(0x230):_0x2fe1bc(0x1e7);return _0x2fe1bc(0x210)+_0x12cb5b+_0x2fe1bc(0x22c)+_0x158061+_0x2fe1bc(0x1c7)+_0x46d2b1+'/'+_0x474809[_0x2fe1bc(0x1eb)]+'/'+_0x474809[_0x2fe1bc(0x21c)]+_0x2fe1bc(0x1e2)+_0x3fb0da+_0x2fe1bc(0x1e9)+_0x474809[_0x2fe1bc(0x1f4)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x46d2b1+_0x2fe1bc(0x1dd)+_0x3ae318+'/'+_0x474809['operationType']+'/'+_0x474809[_0x2fe1bc(0x1e6)]+'/'+_0x158061+_0x2fe1bc(0x227)+_0x474809[_0x2fe1bc(0x1e6)]+'\x0a'+_0x1c4c54+_0x2fe1bc(0x1d9)+_0x38722b+_0x2fe1bc(0x1cd)+_0x47c57c+_0x2fe1bc(0x1e0)+_0x158061+_0x2fe1bc(0x228);}
|
|
1
|
+
const a37_0x3adf60=a37_0x46ca;(function(_0x58ed8b,_0x328f09){const _0x420bdd=a37_0x46ca,_0xa82d3e=_0x58ed8b();while(!![]){try{const _0x52458e=parseInt(_0x420bdd(0x189))/0x1+parseInt(_0x420bdd(0x16c))/0x2*(parseInt(_0x420bdd(0x16d))/0x3)+-parseInt(_0x420bdd(0x16f))/0x4*(parseInt(_0x420bdd(0x191))/0x5)+parseInt(_0x420bdd(0x16b))/0x6*(-parseInt(_0x420bdd(0x162))/0x7)+-parseInt(_0x420bdd(0x177))/0x8*(parseInt(_0x420bdd(0x18a))/0x9)+parseInt(_0x420bdd(0x15c))/0xa+-parseInt(_0x420bdd(0x152))/0xb;if(_0x52458e===_0x328f09)break;else _0xa82d3e['push'](_0xa82d3e['shift']());}catch(_0x41ab89){_0xa82d3e['push'](_0xa82d3e['shift']());}}}(a37_0x342a,0xd3bb7));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';function a37_0x46ca(_0x1d2004,_0x49261e){_0x1d2004=_0x1d2004-0x137;const _0x342a0c=a37_0x342a();let _0x46ca68=_0x342a0c[_0x1d2004];return _0x46ca68;}export const bffCreate={'service':a37_0x3adf60(0x157),'command':a37_0x3adf60(0x170),'description':a37_0x3adf60(0x14b),'risk':a37_0x3adf60(0x16a),'flags':[{'name':a37_0x3adf60(0x166),'type':a37_0x3adf60(0x180),'required':!![],'enum':['COMMON',a37_0x3adf60(0x147),a37_0x3adf60(0x198)],'description':'Script\x20type'},{'name':'name','type':a37_0x3adf60(0x180),'required':!![],'description':a37_0x3adf60(0x138)},{'name':'description','type':'string','description':a37_0x3adf60(0x156)},{'name':a37_0x3adf60(0x182),'type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x3adf60(0x190),'type':a37_0x3adf60(0x180),'description':a37_0x3adf60(0x193)},{'name':a37_0x3adf60(0x151),'type':a37_0x3adf60(0x180),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a37_0x3adf60(0x19b),'type':a37_0x3adf60(0x180),'description':a37_0x3adf60(0x174),'enum':['before',a37_0x3adf60(0x13a)]}],async 'validate'(_0x35612f){const _0x19d3d9=a37_0x3adf60,_0x229096=_0x35612f[_0x19d3d9(0x144)](_0x19d3d9(0x17a));if(!isValidBffFunctionName(_0x229096))throw CliErrors[_0x19d3d9(0x148)](_0x19d3d9(0x15a)+_0x229096+_0x19d3d9(0x139));},async 'execute'(_0xbf0f00){const _0xf1f532=a37_0x3adf60,_0x59a09a=loadBffProjectConfig(_0xbf0f00['appCode']),_0x1458d0=_0xbf0f00[_0xf1f532(0x144)](_0xf1f532(0x166)),_0x130708=_0xbf0f00[_0xf1f532(0x144)]('name'),_0x22e3d6=_0xbf0f00[_0xf1f532(0x144)](_0xf1f532(0x13f))||undefined,_0x2f12af=_0x1458d0===_0xf1f532(0x198)?await resolveHookOptions(_0x59a09a,_0xbf0f00):undefined,_0x1bbbbb=buildFilePath(_0x59a09a,_0x1458d0,_0x130708,_0x2f12af);if(await fileExists(_0x1bbbbb))throw CliErrors['validation'](_0xf1f532(0x14c)+_0x1bbbbb);await mkdir(dirname(_0x1bbbbb),{'recursive':!![]});const _0x2c98ac=generateTemplate(_0x1458d0,_0x130708,_0xbf0f00[_0xf1f532(0x14d)],_0x22e3d6,_0x2f12af);await writeFile(_0x1bbbbb,_0x2c98ac,_0xf1f532(0x164));const _0x26d3d1={'type':_0x1458d0,'name':_0x130708,'path':_0x1bbbbb};if(_0x22e3d6)_0x26d3d1[_0xf1f532(0x13f)]=_0x22e3d6;if(_0x2f12af){if(_0x2f12af[_0xf1f532(0x182)])_0x26d3d1[_0xf1f532(0x182)]=_0x2f12af[_0xf1f532(0x182)];_0x26d3d1[_0xf1f532(0x18c)]=_0x2f12af['datasetCode'],_0x26d3d1[_0xf1f532(0x187)]=_0x2f12af[_0xf1f532(0x187)],_0x26d3d1[_0xf1f532(0x13b)]=_0x2f12af[_0xf1f532(0x13b)];}return{'ok':!![],'data':_0x26d3d1,'message':'Created\x20'+_0x1458d0+'\x20function:\x20'+_0x130708};}};function a37_0x342a(){const _0x364715=['entries','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\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无(如有通知或外部调用,说明影响与失败策略)','datasetcode','914610yyRgHK','\x0a\x20*\x20[平台配置]\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','filePath','\x22\x20not\x20found.\x20','question','HOOK','defaultApp','\x22\x20not\x20found\x20for\x20dataset\x20','function-node','close','before','\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','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','COMMON','Function\x20name\x20(valid\x20JS\x20identifier)','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','after','functionNode','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','No\x20model\x20aliases\x20found.\x20Run\x20`','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','description','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Invalid\x20dataset\x20selection.','Select\x20dataset:','Available\x20aliases:\x20','str','nonInteractive','/COMMON/','ENDPOINT','validation','profileName','Operation\x20type\x20\x22','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','File\x20already\x20exists:\x20','appCode','trim','当前请求参数','/HOOK/','operation-type','13833259QkSDvW','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','.js','code','Script\x20description','bff','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','/ENDPOINT/','Invalid\x20function\x20name\x20\x22','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','15233110MaJeLT','Select\x20trigger\x20node:','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','map','/data/dataset/','apiDir','1393qzropn','HOOK\x20requires\x20alias/operation/node\x20options.','utf8','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','type',']\x20(','scriptsRootDir','/**\x0a\x20*\x20','read','45174oLPoSW','2749616eRTdFQ','3HyoHbl','mergedCli','8DidTpv','create','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Available:\x20','find','Trigger\x20node\x20(HOOK\x20only)','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','UNKNOWN','224LwOVym','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','name','isInteger','includes','join','length','当前响应结果','string','\x20api\x20pull`\x20to\x20refresh.','alias','stdin','source','修改后的请求参数','.js\x0a\x20*\x20[触发节点]\x20','operationType','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','1437432lWxViA','111411ARecPs','stderr','datasetCode'];a37_0x342a=function(){return _0x364715;};return a37_0x342a();}async function resolveHookOptions(_0x58a9aa,_0x2d6d00){const _0x51c59e=a37_0x3adf60,_0x51ffbf=resolveApiModelSource(_0x2d6d00[_0x51c59e(0x161)],_0x2d6d00[_0x51c59e(0x14d)],_0x2d6d00['selectedAppName']||_0x2d6d00[_0x51c59e(0x16e)]?.['currentApp']||_0x2d6d00[_0x51c59e(0x16e)]?.[_0x51c59e(0x199)]),_0x6cc96a=loadAliasMap(_0x2d6d00[_0x51c59e(0x161)],undefined,_0x51ffbf[_0x51c59e(0x195)],_0x51ffbf[_0x51c59e(0x149)]),_0x1e6ebb=_0x6cc96a[_0x51c59e(0x17e)]>0x0;let _0x9adaa0,_0x4efe6a,_0x4ed208;const _0x16af6b=_0x2d6d00[_0x51c59e(0x144)](_0x51c59e(0x182)),_0x496db7=_0x2d6d00[_0x51c59e(0x144)](_0x51c59e(0x190));if(_0x16af6b){const _0x2ac369=resolveAlias(_0x2d6d00[_0x51c59e(0x161)],_0x16af6b,undefined,_0x51ffbf[_0x51c59e(0x195)],_0x51ffbf[_0x51c59e(0x149)]);if(!_0x2ac369){const _0x59856c=_0x1e6ebb?_0x51c59e(0x143)+_0x6cc96a['map'](_0x73f77b=>_0x73f77b['alias'])[_0x51c59e(0x17d)](',\x20'):_0x51c59e(0x13d)+CLI_BIN_NAME+_0x51c59e(0x158);throw CliErrors[_0x51c59e(0x148)]('Alias\x20\x22'+_0x16af6b+_0x51c59e(0x196)+_0x59856c);}_0x9adaa0=_0x16af6b,_0x4efe6a=_0x2ac369;}else{if(_0x496db7){_0x4efe6a=_0x496db7;const _0x23a73f=_0x6cc96a['find'](_0x94ced=>_0x94ced[_0x51c59e(0x18c)]===_0x496db7);_0x9adaa0=_0x23a73f?.['alias'];}else{if(_0x2d6d00[_0x51c59e(0x145)])throw CliErrors['validation'](_0x51c59e(0x15e));else{if(_0x1e6ebb){const _0x35d9d2=_0x6cc96a[_0x51c59e(0x15f)](_0x40f2b0=>_0x40f2b0[_0x51c59e(0x182)]+'\x20('+_0x40f2b0['tableName']+')'),_0x244cea=await promptSelect('Select\x20dataset:',_0x35d9d2),_0x5192a3=_0x6cc96a[_0x244cea];if(!_0x5192a3)throw CliErrors[_0x51c59e(0x148)](_0x51c59e(0x141));_0x9adaa0=_0x5192a3[_0x51c59e(0x182)],_0x4efe6a=_0x5192a3[_0x51c59e(0x18c)];}else{const _0x11711f=await listDatasets(_0x2d6d00['appCode']);if(_0x11711f['length']===0x0)throw CliErrors['validation']('No\x20datasets\x20found\x20for\x20this\x20app.');const _0x1cdeb7=_0x11711f[_0x51c59e(0x15f)](_0x27ea97=>_0x27ea97[_0x51c59e(0x17a)]+'\x20['+(_0x27ea97[_0x51c59e(0x184)]??_0x51c59e(0x176))+_0x51c59e(0x167)+_0x27ea97[_0x51c59e(0x155)]+')'),_0x2e100=await promptSelect(_0x51c59e(0x142),_0x1cdeb7),_0x33d55a=_0x11711f[_0x2e100];if(!_0x33d55a)throw CliErrors[_0x51c59e(0x148)](_0x51c59e(0x141));_0x4efe6a=_0x33d55a[_0x51c59e(0x155)],_0x9adaa0=undefined;}}}}const _0x4336f6=await listDatasets(_0x2d6d00[_0x51c59e(0x14d)]),_0x533ee4=_0x4336f6[_0x51c59e(0x173)](_0x5539fc=>_0x5539fc['code']===_0x4efe6a);if(!_0x533ee4)throw CliErrors[_0x51c59e(0x148)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x4efe6a+'\x22.\x20'+(_0x9adaa0?_0x51c59e(0x188)+CLI_BIN_NAME+_0x51c59e(0x181):''));_0x4ed208=_0x533ee4['id'];const _0x3a1cd8=_0x9adaa0??_0x4efe6a,_0x99b1e3=await listBffDatasetOperations(_0x2d6d00[_0x51c59e(0x14d)],_0x4ed208),_0x5cda73=_0x99b1e3?Object['keys'](_0x99b1e3):[];if(_0x5cda73[_0x51c59e(0x17e)]===0x0)throw CliErrors[_0x51c59e(0x148)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x3a1cd8+'.');let _0x241508;const _0x4f66a8=_0x2d6d00[_0x51c59e(0x144)](_0x51c59e(0x151));if(_0x4f66a8){if(!_0x5cda73[_0x51c59e(0x17c)](_0x4f66a8))throw CliErrors[_0x51c59e(0x148)](_0x51c59e(0x14a)+_0x4f66a8+_0x51c59e(0x19a)+_0x3a1cd8+'.\x20'+(_0x51c59e(0x172)+_0x5cda73[_0x51c59e(0x17d)](',\x20')));_0x241508=_0x4f66a8;}else{if(_0x2d6d00['nonInteractive'])throw CliErrors[_0x51c59e(0x148)](_0x51c59e(0x171));const _0x520f9e=await promptSelect('Select\x20operation\x20type:',_0x5cda73);_0x241508=_0x5cda73[_0x520f9e]??_0x5cda73[0x0];}let _0x49b221=normalizeHookFunctionNode(_0x2d6d00[_0x51c59e(0x144)](_0x51c59e(0x19b)));if(!_0x49b221){if(_0x2d6d00[_0x51c59e(0x144)](_0x51c59e(0x19b)))throw CliErrors[_0x51c59e(0x148)](_0x51c59e(0x15b));if(_0x2d6d00[_0x51c59e(0x145)])throw CliErrors[_0x51c59e(0x148)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x5cf0ba=await promptSelect(_0x51c59e(0x15d),[_0x51c59e(0x19d),_0x51c59e(0x13a)]);_0x49b221=[_0x51c59e(0x19d),_0x51c59e(0x13a)][_0x5cf0ba]??_0x51c59e(0x19d);}return{'alias':_0x9adaa0,'datasetCode':_0x4efe6a,'datasetId':_0x4ed208,'operationType':_0x241508,'functionNode':_0x49b221};}async function promptSelect(_0x47fbee,_0x866636){const _0x13c31f=a37_0x3adf60;if(_0x866636[_0x13c31f(0x17e)]===0x1)return 0x0;for(const [_0x534c3e,_0x414116]of _0x866636[_0x13c31f(0x18d)]()){process['stderr']['write']('\x20\x20'+(_0x534c3e+0x1)+'.\x20'+_0x414116+'\x0a');}const _0x3620fa=createInterface({'input':process[_0x13c31f(0x183)],'output':process[_0x13c31f(0x18b)]});while(!![]){const _0x53aa6f=await new Promise(_0x2ccb59=>{const _0x4a0a17=_0x13c31f;_0x3620fa[_0x4a0a17(0x197)](_0x47fbee+'\x20',_0x2ccb59);}),_0x58a421=Number['parseInt'](_0x53aa6f['trim'](),0xa);if(Number[_0x13c31f(0x17b)](_0x58a421)&&_0x58a421>=0x1&&_0x58a421<=_0x866636['length'])return _0x3620fa[_0x13c31f(0x19c)](),_0x58a421-0x1;process[_0x13c31f(0x18b)]['write'](_0x13c31f(0x18e)+_0x866636[_0x13c31f(0x17e)]+'.\x0a');}}function buildFilePath(_0x61b653,_0x2f6e7e,_0xf09ac7,_0x147ae7){const _0x246298=a37_0x3adf60;if(_0x2f6e7e===_0x246298(0x198)){if(!_0x147ae7)throw CliErrors[_0x246298(0x148)](_0x246298(0x163));const _0x26eedc=_0x147ae7['alias']??_0x147ae7[_0x246298(0x18c)];return join(_0x61b653[_0x246298(0x168)],_0x246298(0x198),_0x26eedc,_0x147ae7[_0x246298(0x187)],_0x147ae7[_0x246298(0x13b)],_0xf09ac7+'.js');}return join(_0x61b653[_0x246298(0x168)],_0x2f6e7e,_0xf09ac7+_0x246298(0x154));}export function generateTemplate(_0x32a703,_0x4d3a5b,_0x1fc168,_0x71cabd,_0x53d481){const _0x1593ca=a37_0x3adf60,_0x4643fd=_0x71cabd?.[_0x1593ca(0x14e)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x529bce=getAppBaseUrl(_0x1fc168),_0xb23a86=_0x1593ca(0x18f);if(_0x32a703===_0x1593ca(0x137))return _0x1593ca(0x169)+_0x4643fd+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x4d3a5b+_0x1593ca(0x192)+_0x529bce+_0x1593ca(0x178)+_0x1fc168+_0x1593ca(0x146)+_0x4d3a5b+_0x1593ca(0x165)+_0x4d3a5b+'\x22,\x20params\x20})\x0a'+_0xb23a86+_0x1593ca(0x19e)+_0x4d3a5b+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x32a703===_0x1593ca(0x147))return _0x1593ca(0x169)+_0x4643fd+_0x1593ca(0x194)+_0x4d3a5b+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x1fc168+'/'+_0x4d3a5b+_0x1593ca(0x192)+_0x529bce+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x1fc168+_0x1593ca(0x159)+_0x4d3a5b+'.js\x0a'+_0xb23a86+'\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'+_0x4d3a5b+_0x1593ca(0x179);if(!_0x53d481)throw CliErrors[_0x1593ca(0x148)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x185a81=_0x53d481[_0x1593ca(0x182)]??_0x53d481[_0x1593ca(0x18c)],_0xfdac50=_0x53d481[_0x1593ca(0x13b)]===_0x1593ca(0x19d)?_0x1593ca(0x14f):_0x1593ca(0x17f),_0x355665=_0x53d481[_0x1593ca(0x13b)]===_0x1593ca(0x19d)?_0x1593ca(0x185):'修改后的响应结果';return'/**\x0a\x20*\x20'+_0x4643fd+_0x1593ca(0x140)+_0x4d3a5b+_0x1593ca(0x13e)+_0x1fc168+'/'+_0x53d481[_0x1593ca(0x18c)]+'/'+_0x53d481[_0x1593ca(0x187)]+_0x1593ca(0x192)+_0x529bce+_0x1593ca(0x160)+_0x53d481['datasetId']+_0x1593ca(0x175)+_0x1fc168+_0x1593ca(0x150)+_0x185a81+'/'+_0x53d481[_0x1593ca(0x187)]+'/'+_0x53d481[_0x1593ca(0x13b)]+'/'+_0x4d3a5b+_0x1593ca(0x186)+_0x53d481['functionNode']+'\x0a'+_0xb23a86+_0x1593ca(0x19f)+_0xfdac50+_0x1593ca(0x13c)+_0x355665+_0x1593ca(0x153)+_0x4d3a5b+_0x1593ca(0x179);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x283763=a38_0x15ad;(function(_0x3fd0aa,_0x107642){const _0x5aee72=a38_0x15ad,_0x482f48=_0x3fd0aa();while(!![]){try{const _0x529a96=-parseInt(_0x5aee72(0x1aa))/0x1*(parseInt(_0x5aee72(0x193))/0x2)+parseInt(_0x5aee72(0x1b3))/0x3+parseInt(_0x5aee72(0x1b0))/0x4*(parseInt(_0x5aee72(0x19e))/0x5)+parseInt(_0x5aee72(0x19a))/0x6+-parseInt(_0x5aee72(0x19b))/0x7*(-parseInt(_0x5aee72(0x1b2))/0x8)+parseInt(_0x5aee72(0x1bd))/0x9*(-parseInt(_0x5aee72(0x1ac))/0xa)+-parseInt(_0x5aee72(0x197))/0xb*(parseInt(_0x5aee72(0x1a8))/0xc);if(_0x529a96===_0x107642)break;else _0x482f48['push'](_0x482f48['shift']());}catch(_0x47d9c3){_0x482f48['push'](_0x482f48['shift']());}}}(a38_0x1bcf,0xdc6ef));function a38_0x15ad(_0xc3300b,_0x32c0fa){_0xc3300b=_0xc3300b-0x193;const _0x1bcf02=a38_0x1bcf();let _0x15ad30=_0x1bcf02[_0xc3300b];return _0x15ad30;}import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';function a38_0x1bcf(){const _0x30d8d8=['Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','appCode','scriptsRootDir','No\x20lock\x20entry\x20found\x20for\x20\x22','functions','3627mZUjSw','delete','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','\x20(local\x20file\x20moved\x20to\x20trash)','lockFilePath','trashedTo','lastSync','apps','\x20\x20-\x20','scriptsRoot','58KNYPmU','remoteId','Backend\x20Function\x20lock\x20file\x20not\x20found.','projectRoot','512963tynCtN','startsWith','split','10778352icoczy','14DNaYKT','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','Deleted\x20','534740KrQcVO','includes','trashDir','high-risk-write','/api/management/library/scripts/delete','POST','target','Lock\x20scope\x20for\x20app\x20\x22','keys','replace','588WKFzAi','bff','29171BjJZPY','Multiple\x20functions\x20match\x20\x22','4090OBpNXx','join','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','Function\x20not\x20found:\x20','8SLMaCm','toISOString','5036792mibKvO','2787636RyPUZH','length','validation','<timestamp>','str'];a38_0x1bcf=function(){return _0x30d8d8;};return a38_0x1bcf();}import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x283763(0x1a9),'command':a38_0x283763(0x1be),'description':a38_0x283763(0x1bf),'risk':a38_0x283763(0x1a1),'flags':[{'name':'target','type':'string','required':!![],'description':a38_0x283763(0x1b8)}],async 'validate'(_0x15e7e5){const _0x4e7b50=a38_0x283763,_0xfe5a35=loadBffProjectConfig(_0x15e7e5[_0x4e7b50(0x1b9)]),_0x440102=await readBffLockFile(_0xfe5a35[_0x4e7b50(0x1c1)]);if(!_0x440102)throw CliErrors['validation']('Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.');},async 'dryRun'(_0x2e2321){const _0x5254d3=a38_0x283763,_0x393660=loadBffProjectConfig(_0x2e2321['appCode']),_0x15cdf3=await readBffLockFile(_0x393660[_0x5254d3(0x1c1)]);if(!_0x15cdf3)throw CliErrors['validation'](_0x5254d3(0x195));const {appLock:_0x9105b0}=ensureLockScope(_0x15cdf3,_0x2e2321[_0x5254d3(0x1b9)],_0x393660[_0x5254d3(0x1c6)],_0x5254d3(0x1be)),_0x4b5c94=_0x2e2321['str'](_0x5254d3(0x1a4)),_0x105981=Object[_0x5254d3(0x1a6)](_0x9105b0[_0x5254d3(0x1bc)]),_0x2b0682=resolveDeleteTarget(_0x4b5c94,_0x105981),_0x214876=_0x9105b0[_0x5254d3(0x1bc)][_0x2b0682];if(!_0x214876)throw CliErrors[_0x5254d3(0x1b5)]('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x2b0682+'\x22.');const _0x45d1b0=resolveLocalFilePathFromLockKey(_0x393660,_0x2b0682),_0x2ba68b=relative(_0x393660[_0x5254d3(0x196)],_0x45d1b0),_0x18c2a4=join(_0x393660['trashDir'],_0x5254d3(0x1b6),_0x2ba68b);return{'method':_0x5254d3(0x1a3),'url':_0x5254d3(0x1a2),'body':{'appCode':_0x2e2321[_0x5254d3(0x1b9)],'target':_0x2b0682,'remoteId':_0x214876['remoteId'],'localFilePath':_0x45d1b0,'trashedPath':_0x18c2a4},'description':'Would\x20delete\x20'+_0x2b0682+_0x5254d3(0x19c)};},async 'execute'(_0xe23038){const _0x4d5fa1=a38_0x283763,_0x5523dd=loadBffProjectConfig(_0xe23038['appCode']),_0x5485d5=await readBffLockFile(_0x5523dd[_0x4d5fa1(0x1c1)]);if(!_0x5485d5)throw CliErrors[_0x4d5fa1(0x1b5)](_0x4d5fa1(0x195));const {lockData:_0x58324f,appLock:_0x17b48b}=ensureLockScope(_0x5485d5,_0xe23038[_0x4d5fa1(0x1b9)],_0x5523dd[_0x4d5fa1(0x1c6)],_0x4d5fa1(0x1be)),_0x1c6988=JSON['parse'](JSON['stringify'](_0x58324f)),_0x1ca3b2=_0x1c6988[_0x4d5fa1(0x1c4)][_0xe23038[_0x4d5fa1(0x1b9)]];if(!_0x1ca3b2)throw new Error(_0x4d5fa1(0x1a5)+_0xe23038[_0x4d5fa1(0x1b9)]+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x251279=_0xe23038[_0x4d5fa1(0x1b7)](_0x4d5fa1(0x1a4)),_0x46d183=Object[_0x4d5fa1(0x1a6)](_0x1ca3b2[_0x4d5fa1(0x1bc)]),_0x5e1712=resolveDeleteTarget(_0x251279,_0x46d183),_0x5e5ee4=_0x1ca3b2['functions'][_0x5e1712];if(!_0x5e5ee4)throw CliErrors[_0x4d5fa1(0x1b5)](_0x4d5fa1(0x1bb)+_0x5e1712+'\x22.');await deleteBffScript(_0x5e5ee4[_0x4d5fa1(0x194)]),delete _0x1ca3b2[_0x4d5fa1(0x1bc)][_0x5e1712],_0x1ca3b2[_0x4d5fa1(0x1c3)]=new Date()[_0x4d5fa1(0x1b1)](),await writeBffLockFile(_0x5523dd[_0x4d5fa1(0x1c1)],_0x1c6988);const _0x6e8ac4=resolveLocalFilePathFromLockKey(_0x5523dd,_0x5e1712);let _0x23ad84;await fileExists(_0x6e8ac4)&&(_0x23ad84=await moveToTrash(_0x5523dd[_0x4d5fa1(0x196)],_0x5523dd[_0x4d5fa1(0x1a0)],_0x6e8ac4),await cleanupEmptyDirectories(dirname(_0x6e8ac4),_0x5523dd[_0x4d5fa1(0x1ba)]));await waitForDeleteSettlement(_0x5523dd['lockFilePath'],_0xe23038['appCode'],_0x5e1712,_0x6e8ac4),await sleep(0x96);const _0x22bc95={'deleted':_0x5e1712,'remoteId':_0x5e5ee4['remoteId']};if(_0x23ad84)_0x22bc95[_0x4d5fa1(0x1c2)]=_0x23ad84;return{'ok':!![],'data':_0x22bc95,'message':_0x4d5fa1(0x19d)+_0x5e1712+(_0x23ad84?_0x4d5fa1(0x1c0):'')};}};function resolveDeleteTarget(_0x5a072d,_0x2bbee6){const _0x1376bf=a38_0x283763;if(_0x5a072d[_0x1376bf(0x19f)]('/')){const _0x583dad=_0x2bbee6['find'](_0xc440f8=>_0xc440f8===_0x5a072d);if(!_0x583dad)throw CliErrors[_0x1376bf(0x1b5)](_0x1376bf(0x1af)+_0x5a072d);return _0x583dad;}const _0x12e58b=_0x2bbee6['filter'](_0x4450ab=>_0x4450ab[_0x1376bf(0x199)]('/')['at'](-0x1)===_0x5a072d);if(_0x12e58b[_0x1376bf(0x1b4)]===0x0)throw CliErrors[_0x1376bf(0x1b5)]('Function\x20not\x20found:\x20'+_0x5a072d);if(_0x12e58b[_0x1376bf(0x1b4)]>0x1)throw CliErrors[_0x1376bf(0x1b5)](_0x1376bf(0x1ab)+_0x5a072d+_0x1376bf(0x1ae)+_0x12e58b['map'](_0x16f50e=>_0x1376bf(0x1c5)+_0x16f50e)[_0x1376bf(0x1ad)]('\x0a'));return _0x12e58b[0x0];}async function moveToTrash(_0x308cac,_0x404403,_0x360ac4){const _0x3c5725=a38_0x283763,_0x4e62a6=new Date()[_0x3c5725(0x1b1)]()[_0x3c5725(0x1a7)](/[:.]/g,'-'),_0x3b0e78=relative(_0x308cac,_0x360ac4),_0x316e74=join(_0x404403,_0x4e62a6,_0x3b0e78);return await mkdir(dirname(_0x316e74),{'recursive':!![]}),await rename(_0x360ac4,_0x316e74),_0x316e74;}async function cleanupEmptyDirectories(_0x33810a,_0xc2be8e){const _0x2f7ce1=a38_0x283763;let _0x579fb8=resolve(_0x33810a);const _0x33c60e=resolve(_0xc2be8e);while(_0x579fb8[_0x2f7ce1(0x198)](''+_0x33c60e+sep)||_0x579fb8===_0x33c60e){if(_0x579fb8===_0x33c60e)return;try{const _0x208ded=await readdir(_0x579fb8);if(_0x208ded['length']>0x0)return;await rmdir(_0x579fb8);}catch{return;}_0x579fb8=dirname(_0x579fb8);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x17d503,_0x5b5db3,_0x55ff43,_0x598de5){const _0x419446=a38_0x283763;for(let _0x142aa6=0x0;_0x142aa6<DELETE_SETTLE_RETRY_COUNT;_0x142aa6+=0x1){const _0x2ec149=await readBffLockFile(_0x17d503),_0x122875=!!_0x2ec149?.[_0x419446(0x1c4)]?.[_0x5b5db3]?.[_0x419446(0x1bc)]?.[_0x55ff43],_0x5044c9=await fileExists(_0x598de5);if(!_0x122875&&!_0x5044c9)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x55ff43+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x5201e6=a39_0x28ae;function a39_0x28ae(_0x4f25e5,_0x516231){_0x4f25e5=_0x4f25e5-0x9c;const _0x726a=a39_0x726a();let _0x28ae86=_0x726a[_0x4f25e5];return _0x28ae86;}(function(_0x2d8a40,_0x3fb4f4){const _0x4db589=a39_0x28ae,_0x50aaba=_0x2d8a40();while(!![]){try{const _0x35ffb1=parseInt(_0x4db589(0xad))/0x1+-parseInt(_0x4db589(0xa5))/0x2*(-parseInt(_0x4db589(0xa8))/0x3)+-parseInt(_0x4db589(0x9e))/0x4*(parseInt(_0x4db589(0xa2))/0x5)+parseInt(_0x4db589(0xb0))/0x6*(parseInt(_0x4db589(0xa0))/0x7)+parseInt(_0x4db589(0xa4))/0x8+parseInt(_0x4db589(0xb2))/0x9+parseInt(_0x4db589(0xae))/0xa*(-parseInt(_0x4db589(0xa9))/0xb);if(_0x35ffb1===_0x3fb4f4)break;else _0x50aaba['push'](_0x50aaba['shift']());}catch(_0x454c76){_0x50aaba['push'](_0x50aaba['shift']());}}}(a39_0x726a,0x3f8d0));function a39_0x726a(){const _0x287743=['read','4585nGSLIn','version','32056oZUfcF','892EHBwDn','scriptType','num','552eyMtjE','187pXOZhq','createdTime','appCode','verbose','259972WzwDMv','97810CMmQBl','updateUserName','6XgfVQe','functionName','1501020igClVA','scriptContent','boolean','1148HpCbBX','detail','1238559IdgpdZ'];a39_0x726a=function(){return _0x287743;};return a39_0x726a();}import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':a39_0x5201e6(0x9f),'description':'Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','risk':a39_0x5201e6(0xa1),'flags':[{'name':'id','type':'number','required':!![],'description':'Script\x20ID'},{'name':a39_0x5201e6(0xac),'type':a39_0x5201e6(0x9d),'description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x597e52){const _0x2d8f69=a39_0x5201e6,_0x3a4095=await getBffScriptInfo(_0x597e52[_0x2d8f69(0xa7)]('id')),_0x482bea=_0x597e52['bool']('verbose');if(_0x482bea)return{'ok':!![],'data':_0x3a4095};return{'ok':!![],'data':{'id':_0x3a4095['id'],'functionName':_0x3a4095[_0x2d8f69(0xb1)]??'','version':_0x3a4095[_0x2d8f69(0xa3)]??'','updateUserName':_0x3a4095[_0x2d8f69(0xaf)]??'','appCode':_0x3a4095[_0x2d8f69(0xab)],'scriptType':_0x3a4095[_0x2d8f69(0xa6)],'description':_0x3a4095['description']||'(none)','createdTime':_0x3a4095[_0x2d8f69(0xaa)]??'','updatedTime':_0x3a4095['updatedTime']??'','scriptContent':_0x3a4095[_0x2d8f69(0x9c)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xa23849,_0x418397){const _0x1cef36=a40_0x2ec7,_0x11ec0c=_0xa23849();while(!![]){try{const _0x9a88fe=parseInt(_0x1cef36(0x1a7))/0x1+-parseInt(_0x1cef36(0x1a6))/0x2+-parseInt(_0x1cef36(0x1ab))/0x3+parseInt(_0x1cef36(0x1a8))/0x4+-parseInt(_0x1cef36(0x1aa))/0x5*(-parseInt(_0x1cef36(0x1a9))/0x6)+-parseInt(_0x1cef36(0x1a5))/0x7+parseInt(_0x1cef36(0x1a4))/0x8;if(_0x9a88fe===_0x418397)break;else _0x11ec0c['push'](_0x11ec0c['shift']());}catch(_0x885815){_0x11ec0c['push'](_0x11ec0c['shift']());}}}(a40_0x3080,0x69287));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';function a40_0x2ec7(_0x5de655,_0x244fd5){_0x5de655=_0x5de655-0x1a4;const _0x308095=a40_0x3080();let _0x2ec7f4=_0x308095[_0x5de655];return _0x2ec7f4;}function a40_0x3080(){const _0x463bdb=['67770nlEFDW','74475FDKqlh','1782592TlHmgS','3730762hcrtXT','1511518KRzJLi','659075ZqdAQx','1443520yAFNxO','222bTiKWL'];a40_0x3080=function(){return _0x463bdb;};return a40_0x3080();}import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a41_0x5a04(_0x26e38b,_0x59f08c){_0x26e38b=_0x26e38b-0x14d;const _0x38899e=a41_0x3889();let _0x5a04d1=_0x38899e[_0x26e38b];return _0x5a04d1;}const a41_0x2b2bf7=a41_0x5a04;(function(_0x27f555,_0x541add){const _0x593e8c=a41_0x5a04,_0x48cff4=_0x27f555();while(!![]){try{const _0x49c7c9=-parseInt(_0x593e8c(0x165))/0x1*(-parseInt(_0x593e8c(0x160))/0x2)+parseInt(_0x593e8c(0x154))/0x3*(parseInt(_0x593e8c(0x15c))/0x4)+parseInt(_0x593e8c(0x14d))/0x5+parseInt(_0x593e8c(0x164))/0x6+-parseInt(_0x593e8c(0x151))/0x7+parseInt(_0x593e8c(0x15f))/0x8*(-parseInt(_0x593e8c(0x16a))/0x9)+parseInt(_0x593e8c(0x15a))/0xa*(parseInt(_0x593e8c(0x161))/0xb);if(_0x49c7c9===_0x541add)break;else _0x48cff4['push'](_0x48cff4['shift']());}catch(_0x54fd9f){_0x48cff4['push'](_0x48cff4['shift']());}}}(a41_0x3889,0xa09ba));function a41_0x3889(){const _0x2cd9a4=['description','124EycKRO','type','Return\x20full\x20script\x20objects','8wSkozW','2GENkWk','1138841yRgRBs','name','verbose','3076824qWqmSG','649969DFXIih','Script\x20type\x20filter','str','bff','functionName','9260523BIyzbY','length','1110595ByGAHj','bool','COMMON','ENDPOINT','7371826EWGJqK','string','read','111093BCJNOI','(unnamed)','List\x20Backend\x20Function\x20scripts','map','list','scriptType','20HULNfc'];a41_0x3889=function(){return _0x2cd9a4;};return a41_0x3889();}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x2b2bf7(0x168),'command':a41_0x2b2bf7(0x158),'description':a41_0x2b2bf7(0x156),'risk':a41_0x2b2bf7(0x153),'flags':[{'name':a41_0x2b2bf7(0x15d),'type':a41_0x2b2bf7(0x152),'description':a41_0x2b2bf7(0x166),'default':'ENDPOINT','enum':[a41_0x2b2bf7(0x150),a41_0x2b2bf7(0x14f)]},{'name':a41_0x2b2bf7(0x162),'type':'string','description':'Filter\x20by\x20script\x20name'},{'name':a41_0x2b2bf7(0x163),'type':'boolean','description':a41_0x2b2bf7(0x15e)}],async 'execute'(_0x23153e){const _0x14272d=a41_0x2b2bf7,_0x2e5b0b=await listBffScripts(_0x23153e['appCode'],_0x23153e[_0x14272d(0x167)]('type'),{'scriptName':_0x23153e[_0x14272d(0x167)]('name')||undefined}),_0x305f96=_0x23153e[_0x14272d(0x14e)](_0x14272d(0x163));return{'ok':!![],'data':_0x305f96?_0x2e5b0b:_0x2e5b0b[_0x14272d(0x157)](_0x4ae340=>({'id':_0x4ae340['id'],'functionName':_0x4ae340[_0x14272d(0x169)]??'','description':_0x4ae340[_0x14272d(0x15b)]||_0x14272d(0x155),'scriptType':_0x4ae340[_0x14272d(0x159)]})),'message':_0x2e5b0b[_0x14272d(0x16b)]===0x0?'No\x20Backend\x20Function\x20scripts\x20found.':undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a42_0x54fa29=a42_0x159d;(function(_0x4c0811,_0x31d691){const _0x566da1=a42_0x159d,_0x3f97ce=_0x4c0811();while(!![]){try{const _0x50b833=-parseInt(_0x566da1(0x167))/0x1+parseInt(_0x566da1(0x173))/0x2*(parseInt(_0x566da1(0x15d))/0x3)+parseInt(_0x566da1(0x158))/0x4+-parseInt(_0x566da1(0x177))/0x5+parseInt(_0x566da1(0x14b))/0x6+-parseInt(_0x566da1(0x161))/0x7+-parseInt(_0x566da1(0x171))/0x8*(-parseInt(_0x566da1(0x16d))/0x9);if(_0x50b833===_0x31d691)break;else _0x3f97ce['push'](_0x3f97ce['shift']());}catch(_0x3fd15c){_0x3f97ce['push'](_0x3f97ce['shift']());}}}(a42_0x5270,0xeabcd));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a42_0x5270(){const _0x10c7d1=['6CTAYVk','end-time','\x20Backend\x20Function\x20log\x20line(s).','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','4027044wyHtDO','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','num','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','bff','level','895813prvkCh','since','validation','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','isSafeInteger','45AxSgZR','now','--end-time','--limit\x20must\x20be\x20between\x201\x20and\x20','289752QMMdNe','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','801574sovZAg','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','--limit','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','2813940FGSPEd','DEBUG','ERROR','Filter\x20by\x20log\x20level','number','5013660cmqlXj','string','flag','toUpperCase','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','keyword','length','start-time','logs','trim','--since','\x20must\x20be\x20a\x20positive\x20integer.','--start-time','4708396LMneUD','Maximum\x20log\x20lines\x20to\x20return\x20(1-','Found\x20','read','limit'];a42_0x5270=function(){return _0x10c7d1;};return a42_0x5270();}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_0x54fa29(0x178),'INFO','WARN',a42_0x54fa29(0x148)];export function resolveBffLogQuery(_0x5bdd9e,_0x4aba5e=Date[a42_0x54fa29(0x16e)]()){const _0x183aa6=a42_0x54fa29,_0xa8cd9a=_0x5bdd9e[_0x183aa6(0x14d)]('since'),_0x43f7a4=_0x5bdd9e['flag'](_0x183aa6(0x152)),_0x21d530=_0x5bdd9e[_0x183aa6(0x14d)]('end-time');if(_0xa8cd9a!==undefined&&_0x43f7a4!==undefined)throw CliErrors[_0x183aa6(0x169)](_0x183aa6(0x160));const _0x470257=_0x21d530===undefined?_0x4aba5e:readPositiveInteger(_0x5bdd9e[_0x183aa6(0x163)](_0x183aa6(0x15e)),_0x183aa6(0x16f)),_0x4e8f14=_0x43f7a4===undefined?_0x470257-readSinceMinutes(_0x5bdd9e)*0xea60:readPositiveInteger(_0x5bdd9e[_0x183aa6(0x163)]('start-time'),_0x183aa6(0x157));if(_0x4e8f14<=0x0)throw CliErrors[_0x183aa6(0x169)](_0x183aa6(0x162));if(_0x4e8f14>_0x470257)throw CliErrors['validation'](_0x183aa6(0x14f));const _0x3a3ac0=readPositiveInteger(_0x5bdd9e['num'](_0x183aa6(0x15c),DEFAULT_LIMIT),_0x183aa6(0x175));if(_0x3a3ac0>MAX_LIMIT)throw CliErrors[_0x183aa6(0x169)](_0x183aa6(0x170)+MAX_LIMIT+'.');const _0x1ccf9c=_0x5bdd9e['str']('level')[_0x183aa6(0x154)]()[_0x183aa6(0x14e)]()||undefined,_0x84bb6a=_0x5bdd9e['str'](_0x183aa6(0x150))[_0x183aa6(0x154)]()||undefined;return{'appCode':_0x5bdd9e['appCode'],'startTime':_0x4e8f14,'endTime':_0x470257,..._0x43f7a4===undefined?{'sinceMinutes':readSinceMinutes(_0x5bdd9e)}:{},..._0x1ccf9c?{'level':_0x1ccf9c}:{},..._0x84bb6a?{'keyword':_0x84bb6a}:{},'limit':_0x3a3ac0};}function readSinceMinutes(_0x2f91d7){const _0x26d037=a42_0x54fa29;return readPositiveInteger(_0x2f91d7[_0x26d037(0x163)](_0x26d037(0x168),DEFAULT_SINCE_MINUTES),_0x26d037(0x155));}function readPositiveInteger(_0x2eacf0,_0x4e7101){const _0x593419=a42_0x54fa29;if(!Number[_0x593419(0x16c)](_0x2eacf0)||_0x2eacf0<=0x0)throw CliErrors[_0x593419(0x169)](_0x4e7101+_0x593419(0x156));return _0x2eacf0;}function a42_0x159d(_0x3039ba,_0x355fbb){_0x3039ba=_0x3039ba-0x148;const _0x527073=a42_0x5270();let _0x159d7f=_0x527073[_0x3039ba];return _0x159d7f;}export const bffLogs={'service':a42_0x54fa29(0x165),'command':a42_0x54fa29(0x153),'description':a42_0x54fa29(0x164),'risk':a42_0x54fa29(0x15b),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':'since','type':a42_0x54fa29(0x14a),'description':a42_0x54fa29(0x172)+DEFAULT_SINCE_MINUTES+')'},{'name':'start-time','type':a42_0x54fa29(0x14a),'description':a42_0x54fa29(0x176)},{'name':'end-time','type':a42_0x54fa29(0x14a),'description':a42_0x54fa29(0x174)},{'name':a42_0x54fa29(0x166),'type':a42_0x54fa29(0x14c),'description':a42_0x54fa29(0x149),'enum':LOG_LEVELS},{'name':a42_0x54fa29(0x150),'type':a42_0x54fa29(0x14c),'description':a42_0x54fa29(0x16a)},{'name':'limit','type':a42_0x54fa29(0x14a),'description':a42_0x54fa29(0x159)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0xf4615a){resolveBffLogQuery(_0xf4615a);},async 'execute'(_0x54ce4b){const _0x8476fa=a42_0x54fa29,_0x13d0bb=resolveBffLogQuery(_0x54ce4b),{sinceMinutes:_0x5aadb3,..._0x440cf2}=_0x13d0bb,_0x2b9f33=await searchBffScriptLogs(_0x440cf2);return{'ok':!![],'data':{'query':_0x13d0bb,'count':_0x2b9f33[_0x8476fa(0x151)],'logs':_0x2b9f33},'message':_0x2b9f33[_0x8476fa(0x151)]===0x0?_0x8476fa(0x16b):_0x8476fa(0x15a)+_0x2b9f33['length']+_0x8476fa(0x15f)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x212d3a=a43_0x27bf;(function(_0x12a9b6,_0x167b49){const _0x49f0d1=a43_0x27bf,_0x430087=_0x12a9b6();while(!![]){try{const _0x22d5b0=parseInt(_0x49f0d1(0xbf))/0x1+-parseInt(_0x49f0d1(0x11a))/0x2+-parseInt(_0x49f0d1(0xfa))/0x3*(-parseInt(_0x49f0d1(0xca))/0x4)+-parseInt(_0x49f0d1(0xaf))/0x5*(parseInt(_0x49f0d1(0xc4))/0x6)+parseInt(_0x49f0d1(0x95))/0x7*(parseInt(_0x49f0d1(0xe6))/0x8)+parseInt(_0x49f0d1(0xd5))/0x9+parseInt(_0x49f0d1(0x9c))/0xa*(-parseInt(_0x49f0d1(0x9f))/0xb);if(_0x22d5b0===_0x167b49)break;else _0x430087['push'](_0x430087['shift']());}catch(_0x21981a){_0x430087['push'](_0x430087['shift']());}}}(a43_0x4d9a,0x2566b));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x212d3a(0x98),'command':'pull','description':a43_0x212d3a(0xe4),'risk':a43_0x212d3a(0xa2),'structuredErrors':!![],'flags':[{'name':'type','type':a43_0x212d3a(0x11b),'description':a43_0x212d3a(0xe8),'enum':[a43_0x212d3a(0xbe),'ENDPOINT','HOOK']},{'name':a43_0x212d3a(0xe7),'type':a43_0x212d3a(0xe1),'description':a43_0x212d3a(0xa1)}],async 'dryRun'(_0x546329){const _0x29e3ca=a43_0x212d3a,_0x5d1c10=loadBffProjectConfig(_0x546329[_0x29e3ca(0xf7)]),_0x1d9829=await readBffLockFile(_0x5d1c10[_0x29e3ca(0x10c)]),{appLock:_0x289d39}=ensureLockScope(_0x1d9829??createEmptyBffLock(),_0x546329[_0x29e3ca(0xf7)],_0x5d1c10[_0x29e3ca(0x11c)],_0x29e3ca(0xaa)),_0x26103d=normalizeBffType(_0x546329['str'](_0x29e3ca(0xfd)))??undefined,[_0x1619de,_0x14534a]=await Promise[_0x29e3ca(0xa6)]([listBffScripts(_0x546329[_0x29e3ca(0xf7)],_0x26103d),getBffScriptStatistics(_0x546329[_0x29e3ca(0xf7)])]),_0x1d8ee3=_0x1619de[_0x29e3ca(0x9a)](_0x15002b=>normalizeBffType(_0x15002b[_0x29e3ca(0x11d)])==='HOOK'),_0x647919=_0x1d8ee3?buildDatasetCodeToAliasMap(_0x546329['apiDir'],_0x546329[_0x29e3ca(0xf7)],_0x546329[_0x29e3ca(0xd6)]||_0x546329[_0x29e3ca(0xde)]?.[_0x29e3ca(0x118)]||_0x546329['mergedCli']?.['defaultApp']):new Map(),_0x50888d=_0x1d8ee3?await planHookDirectoryMigration(_0x5d1c10,_0x289d39,_0x647919,await scanLocalBffFunctions(_0x5d1c10,_0x29e3ca(0xb1))):undefined,_0x4d710a=createHookLocationMap(_0x14534a),_0x226ede=[];for(const _0x48f375 of _0x1619de){const _0x193efe=resolveRemoteScriptTarget(_0x5d1c10,_0x48f375,_0x4d710a,_0x50888d?.[_0x29e3ca(0xeb)]??_0x289d39[_0x29e3ca(0xb2)],_0x647919);if(!_0x193efe){_0x226ede[_0x29e3ca(0x107)]({'scriptType':_0x48f375[_0x29e3ca(0x11d)],'functionName':_0x48f375['functionName']??'','status':_0x29e3ca(0x9d),'reason':_0x29e3ca(0x104)});continue;}const _0x52bfe8=(_0x50888d?.[_0x29e3ca(0xeb)]??_0x289d39[_0x29e3ca(0xb2)])[_0x193efe['lockKey']],_0x36d663=_0x48f375[_0x29e3ca(0xfc)]!=null?computeContentHash(_0x48f375['scriptContent']):undefined,_0x332597=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x50888d,_0x193efe)??_0x193efe['filePath'],_0x52bfe8,_0x36d663),_0x1b537e=_0x332597?localUnsyncedConflict(_0x193efe,_0x48f375['id']):undefined;_0x226ede[_0x29e3ca(0x107)]({'lockKey':_0x193efe[_0x29e3ca(0xbc)],'filePath':_0x193efe['filePath'],'remoteId':_0x48f375['id']??null,'status':_0x1b537e?_0x29e3ca(0x93):'would_pull',..._0x1b537e?{'conflict':_0x1b537e}:{},..._0x193efe[_0x29e3ca(0xb4)]?{'alias':_0x193efe[_0x29e3ca(0xb4)][_0x29e3ca(0xc7)]??null,'datasetCode':_0x193efe[_0x29e3ca(0xb4)][_0x29e3ca(0xd1)],'operationType':_0x193efe[_0x29e3ca(0xb4)]['operationType'],'functionNode':_0x193efe[_0x29e3ca(0xb4)]['functionNode']}:{}});}return{'method':'GET','url':_0x29e3ca(0xdf)+_0x546329[_0x29e3ca(0xf7)]+(_0x26103d?_0x29e3ca(0xea)+_0x26103d:'')+_0x29e3ca(0xec)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x546329[_0x29e3ca(0xf7)],'filterType':_0x26103d??null,..._0x50888d&&_0x50888d[_0x29e3ca(0x9e)][_0x29e3ca(0x10a)]>0x0?{'hookDirectoryMigrations':_0x50888d['migrations'][_0x29e3ca(0x111)](_0x5c0983=>({'from':_0x5c0983['oldDirectory'],'to':_0x5c0983[_0x29e3ca(0xa9)]}))}:{},'files':_0x226ede},'description':_0x29e3ca(0x119)+_0x226ede[_0x29e3ca(0x10a)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4a6311){const _0x345897=a43_0x212d3a,_0x10b6db=loadBffProjectConfig(_0x4a6311[_0x345897(0xf7)]),_0x1e4312=await readBffLockFile(_0x10b6db[_0x345897(0x10c)]),{lockData:_0x3a4a70,appLock:_0x1c5976}=ensureLockScope(_0x1e4312??createEmptyBffLock(),_0x4a6311[_0x345897(0xf7)],_0x10b6db[_0x345897(0x11c)],_0x345897(0xaa)),_0x4e4576=normalizeBffType(_0x4a6311[_0x345897(0xbd)](_0x345897(0xfd)))??undefined;if(_0x4a6311[_0x345897(0xbd)](_0x345897(0xfd))&&!_0x4e4576)throw CliErrors[_0x345897(0xf2)](_0x345897(0x121));const [_0x2b7574,_0x146320]=await Promise['all']([listBffScripts(_0x4a6311[_0x345897(0xf7)],_0x4e4576),getBffScriptStatistics(_0x4a6311['appCode'])]);if(_0x2b7574[_0x345897(0x10a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x58142d=_0x4a6311[_0x345897(0x10e)](_0x345897(0xe7));if(_0x58142d&&!_0x4a6311[_0x345897(0xcb)]){const _0x54d5e0=await confirmForce();if(!_0x54d5e0)throw CliErrors[_0x345897(0xad)](_0x345897(0x123));}if(_0x58142d&&_0x4a6311[_0x345897(0xcb)]){}const _0x31c8dc=_0x2b7574['some'](_0x410a10=>normalizeBffType(_0x410a10[_0x345897(0x11d)])===_0x345897(0xb1)),_0x1ac434=_0x31c8dc?buildDatasetCodeToAliasMap(_0x4a6311[_0x345897(0x9b)],_0x4a6311[_0x345897(0xf7)],_0x4a6311['selectedAppName']||_0x4a6311[_0x345897(0xde)]?.[_0x345897(0x118)]||_0x4a6311[_0x345897(0xde)]?.[_0x345897(0x99)]):new Map(),_0x17f61b=createHookLocationMap(_0x146320),_0x57e061=JSON[_0x345897(0xac)](JSON[_0x345897(0xf1)](_0x3a4a70)),_0x5663aa=_0x4a6311['appCode'],_0x518e06=_0x57e061[_0x345897(0x91)][_0x5663aa];if(!_0x518e06)throw new Error(_0x345897(0x94)+_0x5663aa+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x369eb1=_0x31c8dc?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x10b6db,_0x518e06,_0x1ac434,await scanLocalBffFunctions(_0x10b6db,'HOOK')),_0x518e06):undefined,_0x24aa3b=createPullFileTransaction(),_0x2c5e3a=[],_0x426357=[],_0xd22fa7=[],_0x4ea248=[];for(const _0x408fad of _0x2b7574){const _0x257e70=resolveRemoteScriptTarget(_0x10b6db,_0x408fad,_0x17f61b,_0x518e06[_0x345897(0xb2)],_0x1ac434);if(!_0x257e70){_0x426357[_0x345897(0x107)]({'lockKey':_0x408fad[_0x345897(0x11d)]+'/'+_0x408fad[_0x345897(0x10b)],'reason':_0x345897(0x104)});continue;}const _0x227c8d=_0x518e06['functions'][_0x257e70[_0x345897(0xbc)]];try{if(!_0x408fad['id'])throw new Error(_0x345897(0xda));if(_0x408fad[_0x345897(0xfc)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x2167f6=_0x408fad['scriptContent'],_0x493bd4=computeContentHash(_0x2167f6);if(!_0x58142d){const _0x26f036=await hasUnsyncedLocalChanges(_0x257e70[_0x345897(0x114)],_0x227c8d,_0x493bd4);if(_0x26f036){_0xd22fa7['push'](localUnsyncedConflict(_0x257e70,_0x408fad['id']));continue;}}await _0x24aa3b[_0x345897(0xdb)](_0x257e70[_0x345897(0x114)],_0x2167f6);const _0x591093={'hash':_0x493bd4,'remoteId':_0x408fad['id'],'version':_0x408fad[_0x345897(0xd7)]};_0x257e70['type']===_0x345897(0xb1)&&_0x257e70['hookLocation']&&(_0x591093['alias']=_0x257e70[_0x345897(0xb4)][_0x345897(0xc7)],_0x591093[_0x345897(0xd1)]=_0x257e70[_0x345897(0xb4)][_0x345897(0xd1)],_0x591093[_0x345897(0xbb)]=_0x257e70[_0x345897(0xb4)][_0x345897(0xbb)],_0x591093[_0x345897(0xa8)]=_0x257e70[_0x345897(0xb4)][_0x345897(0xa8)]),_0x518e06[_0x345897(0xb2)][_0x257e70[_0x345897(0xbc)]]=_0x591093,_0x2c5e3a['push']({'lockKey':_0x257e70['lockKey'],'remoteId':_0x408fad['id']});}catch(_0x86deae){_0x4ea248[_0x345897(0x107)]({'lockKey':_0x257e70['lockKey'],'error':_0x86deae instanceof Error?_0x86deae['message']:String(_0x86deae)});}}_0x518e06[_0x345897(0xf5)]=new Date()['toISOString']();try{await writeBffLockFile(_0x10b6db[_0x345897(0x10c)],_0x57e061);}catch(_0x1b1cbd){const _0x197692=[...await _0x24aa3b[_0x345897(0xed)](),...await _0x369eb1?.[_0x345897(0xed)]()??[]];throw withRollbackErrors(_0x1b1cbd,_0x345897(0xf8),_0x197692);}return{'ok':_0x4ea248[_0x345897(0x10a)]===0x0,'data':{'pulled':_0x2c5e3a,'skipped':_0x426357,'conflicts':_0xd22fa7,'failed':_0x4ea248},'message':formatPullMessage(_0x2c5e3a['length'],_0x426357[_0x345897(0x10a)],_0xd22fa7[_0x345897(0x10a)],_0x4ea248[_0x345897(0x10a)])};}};function localUnsyncedConflict(_0x3b3886,_0xa7b8f9){const _0x54c803=a43_0x212d3a,_0x29b52a=_0x3b3886['lockKey'][_0x54c803(0x117)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x3b3886[_0x54c803(0xbc)],'filePath':_0x3b3886[_0x54c803(0x114)],..._0xa7b8f9!=null?{'remoteId':_0xa7b8f9}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x54c803(0xf9)+_0x3b3886[_0x54c803(0xfd)]+_0x54c803(0x11e)+_0x29b52a+_0x54c803(0xce),'requiresReview':!![],'message':_0x54c803(0xa4)}};}function formatPullMessage(_0x408be5,_0x31bf11,_0x5457ae,_0x186d70){const _0x273a3c=a43_0x212d3a,_0x5c51ee=[_0x273a3c(0xf4)+_0x408be5+_0x273a3c(0x129),_0x31bf11+_0x273a3c(0x113)];_0x5457ae>0x0&&_0x5c51ee[_0x273a3c(0x107)](_0x5457ae+'\x20conflict'+(_0x5457ae===0x1?'':'s')+'\x20'+(_0x5457ae===0x1?_0x273a3c(0xe2):'require')+_0x273a3c(0xa5));if(_0x186d70>0x0)_0x5c51ee['push'](_0x186d70+_0x273a3c(0xc8));return _0x5c51ee[_0x273a3c(0xfe)](',\x20');}async function hasUnsyncedLocalChanges(_0x573614,_0x5df793,_0x12ca8e){const _0x322e1a=a43_0x212d3a;if(!await fileExists(_0x573614))return![];const _0x1f7c30=await computeFileHash(_0x573614);if(!_0x5df793)return _0x12ca8e?_0x1f7c30!==_0x12ca8e:!![];return _0x1f7c30!==_0x5df793[_0x322e1a(0xcc)];}function createPullFileTransaction(){const _0x971428=new Map(),_0x597cb6=async(_0x480ffe,_0x15af9d)=>{const _0x4dbb5f=a43_0x27bf;try{if(_0x15af9d[_0x4dbb5f(0x96)])await ensureParentDirectory(_0x480ffe),await writeFile(_0x480ffe,_0x15af9d[_0x4dbb5f(0xae)]);else try{await unlink(_0x480ffe);}catch(_0x228c66){if(_0x228c66[_0x4dbb5f(0x127)]!=='ENOENT')throw _0x228c66;}return undefined;}catch(_0x27d1f6){return _0x27d1f6 instanceof Error?_0x27d1f6:new Error(String(_0x27d1f6));}};return{async 'write'(_0x2610ec,_0x250a21){const _0x20aec2=a43_0x27bf;if(!_0x971428[_0x20aec2(0xd2)](_0x2610ec))try{_0x971428[_0x20aec2(0xd3)](_0x2610ec,{'existed':!![],'content':await readFile(_0x2610ec)});}catch(_0x3b7d46){if(_0x3b7d46[_0x20aec2(0x127)]!==_0x20aec2(0xb8))throw _0x3b7d46;_0x971428[_0x20aec2(0xd3)](_0x2610ec,{'existed':![]});}try{await ensureParentDirectory(_0x2610ec),await writeFile(_0x2610ec,_0x250a21,_0x20aec2(0x120));}catch(_0x31950d){const _0x1d8752=await _0x597cb6(_0x2610ec,_0x971428[_0x20aec2(0x97)](_0x2610ec));if(!_0x1d8752)_0x971428[_0x20aec2(0xf0)](_0x2610ec);throw withRollbackErrors(_0x31950d,_0x20aec2(0x115)+_0x2610ec+'\x22.',_0x1d8752?[_0x1d8752]:[]);}},async 'rollback'(){const _0x3a43d4=a43_0x27bf,_0x43d874=[];for(const [_0x4ec47b,_0x2c5a8f]of[..._0x971428['entries']()][_0x3a43d4(0x110)]()){const _0x540c4a=await _0x597cb6(_0x4ec47b,_0x2c5a8f);_0x540c4a&&_0x43d874[_0x3a43d4(0x107)](new Error(_0x3a43d4(0xb7)+_0x4ec47b+_0x3a43d4(0x103)+_0x540c4a[_0x3a43d4(0xb0)]));}return _0x43d874;}};}function withRollbackErrors(_0x2cba30,_0x363c23,_0x51c6a0){const _0x5303d6=a43_0x212d3a,_0x47694d=_0x2cba30 instanceof Error?_0x2cba30:new Error(String(_0x2cba30));if(_0x51c6a0[_0x5303d6(0x10a)]===0x0)return _0x47694d;return new AggregateError([_0x47694d,..._0x51c6a0],_0x363c23+'\x20Recovery\x20errors:\x20'+_0x51c6a0[_0x5303d6(0x111)](_0x367117=>_0x367117[_0x5303d6(0xb0)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x39df03,_0x1b8811,_0x479a48){const _0x9b04b8=a43_0x212d3a,_0x10a60c=resolveApiModelSource(_0x39df03,_0x1b8811,_0x479a48),_0x5eeda6=loadAliasMap(_0x39df03,undefined,_0x10a60c[_0x9b04b8(0x114)],_0x10a60c['profileName']);return assertUnambiguousHookAliases(_0x5eeda6),new Map(_0x5eeda6[_0x9b04b8(0x111)](_0x412a98=>[_0x412a98[_0x9b04b8(0xd1)][_0x9b04b8(0xe9)](),_0x412a98[_0x9b04b8(0xc7)]]));}function a43_0x4d9a(){const _0x1c5488=['.js','parse','cancelled','content','15JImXqc','message','HOOK','functions','.hook-directory-migrate-','hookLocation','sourceDirectoryPathByNewDirectory','\x22\x20to\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','ENOENT','trim','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','operationType','lockKey','str','COMMON','229722QsRWRh','\x22:\x20both\x20target\x20\x22','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','case-rename','scriptsRootDir','147222LjThOJ','oldDirectory','\x22\x20may\x20remain.','alias','\x20failed','\x22\x20from\x20the\x20lock\x20file.','25888VbUKko','nonInteractive','hash','dev','\x20--format\x20compress','NFC','entries','datasetCode','has','set','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','2331378bPpfMD','selectedAppName','version','values','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Remote\x20script\x20missing\x20id.','write','close','newLockKey','mergedCli','/api/management/library/scripts/list?appCode=','normalize','boolean','requires','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','328sChocA','force','Pull\x20only\x20this\x20script\x20type','toLowerCase','&type=','projectedFunctions','¤tPage=1&pageSize=','rollback','flatMap','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','delete','stringify','validation','oldDirectoryPath','Pull\x20complete:\x20','lastSync','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','appCode','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x20bff\x20push\x20--type\x20','60spahKY','entry','scriptContent','type','join','sourceFilePathByNewLockKey','mode','stdin','newDirectoryPath','\x22:\x20','unresolvable\x20target\x20path','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','rekey','push','remoteId','HOOK/','length','functionName','lockFilePath','stderr','bool','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','reverse','map','filter','\x20skipped','filePath','Failed\x20to\x20write\x20local\x20script\x20\x22','yes','split','currentApp','Would\x20inspect\x20','413720Nxfbis','string','scriptsRoot','scriptType','\x20--name\x20','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','utf8','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Force\x20pull\x20cancelled.','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','oldLockKey','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','code','\x22;\x20temporary\x20directory\x20\x22','\x20pulled','keyChanges','move','apps','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','conflict','Lock\x20scope\x20for\x20app\x20\x22','42721MuJzaC','existed','get','bff','defaultApp','some','apiDir','10YRRHph','skipped','migrations','4782371WblIGa','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','Force\x20overwrite\x20local\x20unsynced\x20changes','read','\x22\x20and\x20\x22','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.','\x20resolution','all','ino','functionNode','newDirectory','pull'];a43_0x4d9a=function(){return _0x1c5488;};return a43_0x4d9a();}function a43_0x27bf(_0x273379,_0x322399){_0x273379=_0x273379-0x8f;const _0x4d9ae0=a43_0x4d9a();let _0x27bf1c=_0x4d9ae0[_0x273379];return _0x27bf1c;}async function planHookDirectoryMigration(_0x4dfa8b,_0x482882,_0xb2d396,_0xe0aa13){const _0x198620=a43_0x212d3a,_0x10b53a=new Map();for(const [_0x3d978f,_0x59ea0f]of Object[_0x198620(0xd0)](_0x482882[_0x198620(0xb2)])){const [_0x2f9e67,_0x6c8dc3,_0x19e899,_0x31460f,_0x3cb653,..._0x66e41b]=_0x3d978f[_0x198620(0x117)]('/');if(_0x2f9e67!==_0x198620(0xb1)||!_0x6c8dc3||!_0x19e899||!_0x31460f||!_0x3cb653||_0x66e41b[_0x198620(0x10a)]>0x0||!_0x59ea0f['datasetCode'])continue;const _0x36cf34=_0xb2d396['get'](_0x59ea0f[_0x198620(0xd1)]['toLowerCase']()),_0x5a36ce=_0x36cf34??_0x59ea0f[_0x198620(0xd1)];if(!isSafeHookDirectorySegment(_0x6c8dc3))throw CliErrors[_0x198620(0xf2)](_0x198620(0x122)+_0x6c8dc3+_0x198620(0xc9));if(!isSafeHookDirectorySegment(_0x5a36ce))throw CliErrors[_0x198620(0xf2)](_0x198620(0xc1)+_0x6c8dc3+_0x198620(0xa0));if(_0x6c8dc3===_0x5a36ce)continue;const _0x574740=_0x10b53a[_0x198620(0x97)](_0x6c8dc3)??{'datasetCode':_0x59ea0f[_0x198620(0xd1)],'alias':_0x36cf34,'keyChanges':[]};if(_0x574740['datasetCode']!==_0x59ea0f['datasetCode'])throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x6c8dc3+_0x198620(0x124));const _0x52973b=_0x198620(0x109)+_0x5a36ce+'/'+_0x19e899+'/'+_0x31460f+'/'+_0x3cb653;try{resolveLocalFilePathFromLockKey(_0x4dfa8b,_0x3d978f),resolveLocalFilePathFromLockKey(_0x4dfa8b,_0x52973b);}catch(_0x552015){throw CliErrors[_0x198620(0xf2)](_0x198620(0x92)+_0x3d978f+_0x198620(0x103)+(_0x552015 instanceof Error?_0x552015[_0x198620(0xb0)]:String(_0x552015)));}_0x574740['keyChanges'][_0x198620(0x107)]({'oldLockKey':_0x3d978f,'newLockKey':_0x52973b,'entry':_0x59ea0f}),_0x10b53a[_0x198620(0xd3)](_0x6c8dc3,_0x574740);}const _0x3ddd95=new Set([..._0x10b53a[_0x198620(0xd8)]()][_0x198620(0xee)](_0x56aeb7=>_0x56aeb7[_0x198620(0x8f)][_0x198620(0x111)](_0x5908d8=>_0x5908d8['oldLockKey']))),_0x26bcca=new Map(),_0xc0c41a=new Map();for(const [_0x157062,_0x54bd1b]of _0x10b53a){const _0x1a7db5=_0x54bd1b[_0x198620(0xc7)]??_0x54bd1b[_0x198620(0xd1)],_0x5555ed=hookDirectoryIdentity(_0x1a7db5),_0xd7bf97=_0x26bcca[_0x198620(0x97)](_0x5555ed);if(_0xd7bf97&&_0xd7bf97!==_0x157062)throw CliErrors['validation'](_0x198620(0x105)+_0xd7bf97+_0x198620(0xa3)+_0x157062+_0x198620(0xc0)+_0x1a7db5+_0x198620(0xef));_0x26bcca[_0x198620(0xd3)](_0x5555ed,_0x157062);for(const _0x1c0590 of _0x54bd1b[_0x198620(0x8f)]){const _0x5309f6=_0xc0c41a[_0x198620(0x97)](_0x1c0590[_0x198620(0xdd)]);if(_0x5309f6&&_0x5309f6!==_0x1c0590[_0x198620(0x125)])throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x5309f6+_0x198620(0xa3)+_0x1c0590[_0x198620(0x125)]+_0x198620(0xc0)+_0x1c0590[_0x198620(0xdd)]+_0x198620(0x11f));if(_0x3ddd95['has'](_0x1c0590[_0x198620(0xdd)]))throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x1c0590['oldLockKey']+'\x22:\x20its\x20target\x20\x22'+_0x1c0590[_0x198620(0xdd)]+_0x198620(0x10f));_0xc0c41a[_0x198620(0xd3)](_0x1c0590[_0x198620(0xdd)],_0x1c0590[_0x198620(0x125)]);}}const _0x2e8a83=new Map();for(const [_0x1049b2,_0x5e0664]of _0xb2d396){_0x2e8a83[_0x198620(0xd3)](hookDirectoryIdentity(_0x5e0664),_0x1049b2);}const _0x9bf980=[];for(const [_0x2ff2cf,_0x307b92]of _0x10b53a){const _0x30d663=_0x307b92[_0x198620(0xc7)]??_0x307b92[_0x198620(0xd1)],_0x23413e=join(_0x4dfa8b[_0x198620(0xc3)],_0x198620(0xb1),_0x2ff2cf),_0x31aba1=join(_0x4dfa8b[_0x198620(0xc3)],_0x198620(0xb1),_0x30d663),_0x59cc84=await directoryExists(_0x23413e),_0x52d861=await directoryExists(_0x31aba1),_0x19365d=_0x59cc84?_0x52d861?await sameDirectory(_0x23413e,_0x31aba1)?_0x198620(0xc2):undefined:_0x198620(0x90):_0x198620(0x106);if(!_0x19365d)throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x2ff2cf+_0x198620(0xb6)+_0x30d663+_0x198620(0x126));const _0x1aa842=_0x2e8a83['get'](hookDirectoryIdentity(_0x2ff2cf));if(_0x1aa842&&_0x1aa842!==_0x307b92[_0x198620(0xd1)]['toLowerCase']()){const _0x506aa0=new Set(_0x307b92[_0x198620(0x8f)][_0x198620(0x111)](_0x472960=>_0x472960[_0x198620(0x125)])),_0x22f84e=_0xe0aa13[_0x198620(0x112)](_0x41c4ad=>_0x41c4ad[_0x198620(0xfd)]===_0x198620(0xb1)&&_0x41c4ad[_0x198620(0xc7)]!=null&&hookDirectoryIdentity(_0x41c4ad[_0x198620(0xc7)])===hookDirectoryIdentity(_0x2ff2cf)&&!_0x506aa0[_0x198620(0xd2)](_0x41c4ad[_0x198620(0xbc)]));if(_0x22f84e['length']>0x0)throw CliErrors[_0x198620(0xf2)](_0x198620(0xc1)+_0x2ff2cf+_0x198620(0xd9));}const _0x3735f1=_0x2e8a83[_0x198620(0x97)](hookDirectoryIdentity(_0x30d663));if(_0x3735f1&&_0x3735f1!==_0x307b92[_0x198620(0xd1)]['toLowerCase']())throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x2ff2cf+_0x198620(0xb6)+_0x30d663+_0x198620(0xe5));for(const _0x414979 of _0x307b92[_0x198620(0x8f)]){const _0x5beb42=_0x482882[_0x198620(0xb2)][_0x414979[_0x198620(0xdd)]];if(_0x5beb42&&!_0x3ddd95[_0x198620(0xd2)](_0x414979[_0x198620(0xdd)])&&!sameHookIdentity(_0x414979['entry'],_0x5beb42))throw CliErrors['validation'](_0x198620(0xc1)+_0x2ff2cf+_0x198620(0xb6)+_0x30d663+_0x198620(0xf6));}_0x9bf980[_0x198620(0x107)]({'oldDirectory':_0x2ff2cf,'newDirectory':_0x30d663,'oldDirectoryPath':_0x23413e,'newDirectoryPath':_0x31aba1,'mode':_0x19365d,'alias':_0x307b92[_0x198620(0xc7)],'keyChanges':_0x307b92['keyChanges']});}const _0x22bbe7={..._0x482882[_0x198620(0xb2)]},_0x4c27dc=new Map(),_0x529084=new Map();for(const _0x245dec of _0x9bf980){const _0x30c525=_0x245dec[_0x198620(0x100)]!=='rekey';_0x30c525&&_0x529084['set'](hookDirectoryIdentity(_0x245dec[_0x198620(0xa9)]),_0x245dec[_0x198620(0xf3)]);for(const _0x39d8f8 of _0x245dec[_0x198620(0x8f)]){const _0x2806fd=_0x22bbe7[_0x39d8f8[_0x198620(0xdd)]],_0x3e9fa0=_0x30c525?_0x39d8f8[_0x198620(0xfb)]:_0x2806fd??_0x39d8f8[_0x198620(0xfb)];_0x22bbe7[_0x39d8f8[_0x198620(0xdd)]]=canonicalizeHookEntry(_0x3e9fa0,_0x245dec[_0x198620(0xc7)]),delete _0x22bbe7[_0x39d8f8[_0x198620(0x125)]],_0x30c525&&_0x4c27dc[_0x198620(0xd3)](_0x39d8f8[_0x198620(0xdd)],resolveLocalFilePathFromLockKey(_0x4dfa8b,_0x39d8f8[_0x198620(0x125)]));}}return{'migrations':_0x9bf980,'projectedFunctions':_0x22bbe7,'sourceFilePathByNewLockKey':_0x4c27dc,'sourceDirectoryPathByNewDirectory':_0x529084};}function resolveMigratedSourceFilePath(_0x4f117b,_0x2c7acf){const _0xab652c=a43_0x212d3a;if(!_0x4f117b||!_0x2c7acf)return undefined;const _0x3a74ec=_0x4f117b[_0xab652c(0xff)][_0xab652c(0x97)](_0x2c7acf[_0xab652c(0xbc)]);if(_0x3a74ec)return _0x3a74ec;if(_0x2c7acf[_0xab652c(0xfd)]!==_0xab652c(0xb1))return undefined;const [,_0x573808,..._0x5be6f5]=_0x2c7acf['lockKey'][_0xab652c(0x117)]('/');if(!_0x573808||_0x5be6f5[_0xab652c(0x10a)]===0x0)return undefined;const _0x1c2e2f=_0x4f117b[_0xab652c(0xb5)][_0xab652c(0x97)](hookDirectoryIdentity(_0x573808));return _0x1c2e2f?join(_0x1c2e2f,..._0x5be6f5)+_0xab652c(0xab):undefined;}function sameHookIdentity(_0x6a7aee,_0x158522){const _0x2e0db7=a43_0x212d3a;return _0x6a7aee[_0x2e0db7(0x108)]===_0x158522[_0x2e0db7(0x108)]&&_0x6a7aee[_0x2e0db7(0xd1)]===_0x158522[_0x2e0db7(0xd1)]&&_0x6a7aee['operationType']===_0x158522[_0x2e0db7(0xbb)]&&_0x6a7aee[_0x2e0db7(0xa8)]===_0x158522[_0x2e0db7(0xa8)];}function canonicalizeHookEntry(_0x398a08,_0x589cb3){const {alias:_0x42da2c,..._0x3a25f9}=_0x398a08;return _0x589cb3?{..._0x3a25f9,'alias':_0x589cb3}:_0x3a25f9;}function hookDirectoryIdentity(_0x416e8a){const _0x4032e4=a43_0x212d3a;return _0x416e8a[_0x4032e4(0xe0)](_0x4032e4(0xcf))[_0x4032e4(0xe9)]();}function isSafeHookDirectorySegment(_0x33a640){return isSafeLockKeySegment(_0x33a640);}async function sameDirectory(_0x1a3645,_0xac2cce){const _0x5a8c30=a43_0x212d3a,[_0x1294eb,_0x257acd]=await Promise[_0x5a8c30(0xa6)]([stat(_0x1a3645),stat(_0xac2cce)]);return _0x1294eb[_0x5a8c30(0xcd)]===_0x257acd['dev']&&_0x1294eb[_0x5a8c30(0xa7)]===_0x257acd[_0x5a8c30(0xa7)];}async function applyHookDirectoryMigration(_0x2b3462,_0x304026){const _0x4bfae1=a43_0x212d3a,_0x22036c=_0x304026[_0x4bfae1(0xb2)],_0x53aa02=_0x304026[_0x4bfae1(0xf5)],_0x1d9bed=[],_0x1afd84=async()=>{const _0x1c7024=_0x4bfae1,_0x11c825=[];_0x304026[_0x1c7024(0xb2)]=_0x22036c,_0x304026[_0x1c7024(0xf5)]=_0x53aa02;for(const {migration:_0x326bd6,temporaryPath:_0x49eb50}of[..._0x1d9bed][_0x1c7024(0x110)]()){try{_0x49eb50?(await rename(_0x326bd6[_0x1c7024(0x102)],_0x49eb50),await rename(_0x49eb50,_0x326bd6[_0x1c7024(0xf3)])):await rename(_0x326bd6[_0x1c7024(0x102)],_0x326bd6['oldDirectoryPath']);}catch(_0x2f7de3){_0x11c825[_0x1c7024(0x107)](new Error(_0x1c7024(0xe3)+_0x326bd6[_0x1c7024(0xc5)]+'\x22\x20from\x20\x22'+_0x326bd6[_0x1c7024(0xa9)]+_0x1c7024(0x103)+(_0x2f7de3 instanceof Error?_0x2f7de3[_0x1c7024(0xb0)]:String(_0x2f7de3))));}}return _0x11c825;};try{for(const _0x215229 of _0x2b3462[_0x4bfae1(0x9e)]){if(_0x215229[_0x4bfae1(0x100)]===_0x4bfae1(0x90))await ensureParentDirectory(_0x215229[_0x4bfae1(0x102)]),await rename(_0x215229[_0x4bfae1(0xf3)],_0x215229['newDirectoryPath']),_0x1d9bed[_0x4bfae1(0x107)]({'migration':_0x215229});else{if(_0x215229[_0x4bfae1(0x100)]===_0x4bfae1(0xc2)){const _0x11ef47=join(dirname(_0x215229[_0x4bfae1(0xf3)]),_0x4bfae1(0xb3)+randomUUID());await rename(_0x215229[_0x4bfae1(0xf3)],_0x11ef47);try{await rename(_0x11ef47,_0x215229[_0x4bfae1(0x102)]);}catch(_0x55f8ba){try{await rename(_0x11ef47,_0x215229['oldDirectoryPath']);}catch(_0x1947df){throw withRollbackErrors(_0x55f8ba,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x215229['oldDirectory']+'\x22\x20to\x20\x22'+_0x215229[_0x4bfae1(0xa9)]+_0x4bfae1(0x128)+_0x11ef47+_0x4bfae1(0xc6),[new Error(_0x4bfae1(0xd4)+_0x11ef47+_0x4bfae1(0xb6)+_0x215229['oldDirectory']+'\x22:\x20'+(_0x1947df instanceof Error?_0x1947df[_0x4bfae1(0xb0)]:String(_0x1947df)))]);}throw _0x55f8ba;}_0x1d9bed[_0x4bfae1(0x107)]({'migration':_0x215229,'temporaryPath':_0x11ef47});}}}return _0x304026[_0x4bfae1(0xb2)]=_0x2b3462['projectedFunctions'],{'rollback':_0x1afd84};}catch(_0xc16cef){const _0x7297c7=await _0x1afd84();throw withRollbackErrors(_0xc16cef,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x7297c7);}}async function confirmForce(){const _0x56eb32=a43_0x212d3a,_0x53845a=createInterface({'input':process[_0x56eb32(0x101)],'output':process[_0x56eb32(0x10d)]}),_0x2781cb=await new Promise(_0x1864c1=>{const _0x5b9d00=_0x56eb32;_0x53845a['question'](_0x5b9d00(0xba),_0x1864c1);});return _0x53845a[_0x56eb32(0xdc)](),['y',_0x56eb32(0x116)]['includes'](_0x2781cb[_0x56eb32(0xb9)]()[_0x56eb32(0xe9)]());}
|
|
1
|
+
const a43_0x14c7c8=a43_0x56b0;(function(_0xe6ba17,_0x151bc3){const _0x1452c9=a43_0x56b0,_0x21d9a9=_0xe6ba17();while(!![]){try{const _0x2c4985=parseInt(_0x1452c9(0x16d))/0x1*(parseInt(_0x1452c9(0x19a))/0x2)+-parseInt(_0x1452c9(0x180))/0x3*(-parseInt(_0x1452c9(0x170))/0x4)+-parseInt(_0x1452c9(0x192))/0x5+-parseInt(_0x1452c9(0x140))/0x6*(parseInt(_0x1452c9(0x177))/0x7)+parseInt(_0x1452c9(0x12e))/0x8+-parseInt(_0x1452c9(0x145))/0x9+-parseInt(_0x1452c9(0x18d))/0xa;if(_0x2c4985===_0x151bc3)break;else _0x21d9a9['push'](_0x21d9a9['shift']());}catch(_0x412e4a){_0x21d9a9['push'](_0x21d9a9['shift']());}}}(a43_0x5dbe,0x65568));import{createInterface}from'node:readline';function a43_0x5dbe(){const _0x5b450a=['rollback','\x20Recovery\x20errors:\x20','apps','skipped','str','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','message','.hook-directory-migrate-','Pull\x20complete:\x20','move','3219680dKTWgE','\x22:\x20its\x20target\x20\x22','ENOENT','profileName','validation','405790oJkNid','includes','values','content','entries','mergedCli','apiDir','sourceFilePathByNewLockKey','1021714LnSDKz','type','version','lockKey','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','parse','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','force','has','Failed\x20to\x20write\x20local\x20script\x20\x22','case-rename','all','newLockKey','COMMON','appCode','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','scriptContent','push','some','Remote\x20script\x20missing\x20content.','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','projectedFunctions','oldDirectory','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.','\x20resolution','stderr','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','functionNode','ENDPOINT','Remote\x20script\x20missing\x20id.','\x22\x20and\x20\x22','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','nonInteractive','oldLockKey','datasetCode','\x22:\x20','unresolvable\x20target\x20path','BFF_LOCAL_UNSYNCED','mode','5872080iQVtjD','operationType','scriptsRootDir','delete','\x22:\x20both\x20target\x20\x22','\x20failed','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','split','\x22\x20to\x20\x22','entry','alias','question','pull','dev','selectedAppName','map','scriptsRoot','/api/management/library/scripts/list?appCode=','366LWWXZs','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','set','\x20--format\x20compress','bff','4274514GpNXwH','code','requires','remoteId','sourceDirectoryPathByNewDirectory','push_local','Would\x20inspect\x20','currentApp','hookLocation','flatMap','utf8','length','GET','\x22\x20not\x20found\x20after\x20ensureLockScope.','\x20pulled','Force\x20overwrite\x20local\x20unsynced\x20changes','Could\x20not\x20restore\x20local\x20script\x20\x22','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x22\x20from\x20\x22','newDirectoryPath','hash','&type=','\x20--name\x20','string','NFC','scriptType','ino','functionName','reverse','Pull\x20only\x20this\x20script\x20type','filePath','\x20skipped','\x22\x20from\x20the\x20lock\x20file.','HOOK/','toLowerCase','lastSync','newDirectory','stdin','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','bool','1GSJEKl','boolean','stringify','4748GewNCW','defaultApp','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','join','HOOK','functions','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','88991ZIoDWY','trim','read','oldDirectoryPath','Force\x20pull\x20cancelled.','keyChanges','rekey','get','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','2082nvFXmm','lockFilePath','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.'];a43_0x5dbe=function(){return _0x5b450a;};return a43_0x5dbe();}import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x14c7c8(0x144),'command':'pull','description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':a43_0x14c7c8(0x179),'structuredErrors':!![],'flags':[{'name':'type','type':a43_0x14c7c8(0x15c),'description':a43_0x14c7c8(0x162),'enum':[a43_0x14c7c8(0x1a7),a43_0x14c7c8(0x123),a43_0x14c7c8(0x174)]},{'name':a43_0x14c7c8(0x1a1),'type':a43_0x14c7c8(0x16e),'description':a43_0x14c7c8(0x154)}],async 'dryRun'(_0x2743a6){const _0x46b21c=a43_0x14c7c8,_0xec4007=loadBffProjectConfig(_0x2743a6[_0x46b21c(0x1a8)]),_0x2c457a=await readBffLockFile(_0xec4007[_0x46b21c(0x181)]),{appLock:_0x291c02}=ensureLockScope(_0x2c457a??createEmptyBffLock(),_0x2743a6[_0x46b21c(0x1a8)],_0xec4007[_0x46b21c(0x13e)],_0x46b21c(0x13a)),_0xe86b12=normalizeBffType(_0x2743a6[_0x46b21c(0x187)]('type'))??undefined,[_0x4f8f45,_0x68167]=await Promise[_0x46b21c(0x1a5)]([listBffScripts(_0x2743a6[_0x46b21c(0x1a8)],_0xe86b12),getBffScriptStatistics(_0x2743a6[_0x46b21c(0x1a8)])]),_0x398380=_0x4f8f45[_0x46b21c(0x1af)](_0x3ade2a=>normalizeBffType(_0x3ade2a[_0x46b21c(0x15e)])===_0x46b21c(0x174)),_0x5dce52=_0x398380?buildDatasetCodeToAliasMap(_0x2743a6[_0x46b21c(0x198)],_0x2743a6[_0x46b21c(0x1a8)],_0x2743a6['selectedAppName']||_0x2743a6[_0x46b21c(0x197)]?.['currentApp']||_0x2743a6[_0x46b21c(0x197)]?.[_0x46b21c(0x171)]):new Map(),_0x1da25d=_0x398380?await planHookDirectoryMigration(_0xec4007,_0x291c02,_0x5dce52,await scanLocalBffFunctions(_0xec4007,_0x46b21c(0x174))):undefined,_0xbcc849=createHookLocationMap(_0x68167),_0x44f365=[];for(const _0xc73eaf of _0x4f8f45){const _0x142ff1=resolveRemoteScriptTarget(_0xec4007,_0xc73eaf,_0xbcc849,_0x1da25d?.[_0x46b21c(0x1b2)]??_0x291c02[_0x46b21c(0x175)],_0x5dce52);if(!_0x142ff1){_0x44f365['push']({'scriptType':_0xc73eaf[_0x46b21c(0x15e)],'functionName':_0xc73eaf[_0x46b21c(0x160)]??'','status':_0x46b21c(0x186),'reason':'unresolvable\x20target\x20path'});continue;}const _0x21e58e=(_0x1da25d?.[_0x46b21c(0x1b2)]??_0x291c02[_0x46b21c(0x175)])[_0x142ff1['lockKey']],_0x1ca44e=_0xc73eaf[_0x46b21c(0x1ad)]!=null?computeContentHash(_0xc73eaf[_0x46b21c(0x1ad)]):undefined,_0x79d8eb=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x1da25d,_0x142ff1)??_0x142ff1[_0x46b21c(0x163)],_0x21e58e,_0x1ca44e),_0x2eb75a=_0x79d8eb?localUnsyncedConflict(_0x142ff1,_0xc73eaf['id']):undefined;_0x44f365[_0x46b21c(0x1ae)]({'lockKey':_0x142ff1['lockKey'],'filePath':_0x142ff1[_0x46b21c(0x163)],'remoteId':_0xc73eaf['id']??null,'status':_0x2eb75a?'conflict':'would_pull',..._0x2eb75a?{'conflict':_0x2eb75a}:{},..._0x142ff1[_0x46b21c(0x14d)]?{'alias':_0x142ff1[_0x46b21c(0x14d)]['alias']??null,'datasetCode':_0x142ff1[_0x46b21c(0x14d)]['datasetCode'],'operationType':_0x142ff1[_0x46b21c(0x14d)][_0x46b21c(0x12f)],'functionNode':_0x142ff1[_0x46b21c(0x14d)][_0x46b21c(0x122)]}:{}});}return{'method':_0x46b21c(0x151),'url':_0x46b21c(0x13f)+_0x2743a6[_0x46b21c(0x1a8)]+(_0xe86b12?_0x46b21c(0x15a)+_0xe86b12:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x2743a6[_0x46b21c(0x1a8)],'filterType':_0xe86b12??null,..._0x1da25d&&_0x1da25d['migrations'][_0x46b21c(0x150)]>0x0?{'hookDirectoryMigrations':_0x1da25d['migrations'][_0x46b21c(0x13d)](_0x57cc06=>({'from':_0x57cc06[_0x46b21c(0x1b3)],'to':_0x57cc06[_0x46b21c(0x169)]}))}:{},'files':_0x44f365},'description':_0x46b21c(0x14b)+_0x44f365['length']+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x583e38){const _0x5ef4cc=a43_0x14c7c8,_0x160717=loadBffProjectConfig(_0x583e38[_0x5ef4cc(0x1a8)]),_0x30ee94=await readBffLockFile(_0x160717[_0x5ef4cc(0x181)]),{lockData:_0x23db0e,appLock:_0x26b4b4}=ensureLockScope(_0x30ee94??createEmptyBffLock(),_0x583e38['appCode'],_0x160717['scriptsRoot'],_0x5ef4cc(0x13a)),_0x47d257=normalizeBffType(_0x583e38['str'](_0x5ef4cc(0x19b)))??undefined;if(_0x583e38[_0x5ef4cc(0x187)]('type')&&!_0x47d257)throw CliErrors[_0x5ef4cc(0x191)](_0x5ef4cc(0x176));const [_0x2f45bd,_0x4ad79c]=await Promise[_0x5ef4cc(0x1a5)]([listBffScripts(_0x583e38[_0x5ef4cc(0x1a8)],_0x47d257),getBffScriptStatistics(_0x583e38[_0x5ef4cc(0x1a8)])]);if(_0x2f45bd[_0x5ef4cc(0x150)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x5ef4cc(0x126)};const _0x4e05c4=_0x583e38[_0x5ef4cc(0x16c)](_0x5ef4cc(0x1a1));if(_0x4e05c4&&!_0x583e38[_0x5ef4cc(0x127)]){const _0xb56d21=await confirmForce();if(!_0xb56d21)throw CliErrors['cancelled'](_0x5ef4cc(0x17b));}if(_0x4e05c4&&_0x583e38[_0x5ef4cc(0x127)]){}const _0x48000e=_0x2f45bd[_0x5ef4cc(0x1af)](_0x2f4c10=>normalizeBffType(_0x2f4c10[_0x5ef4cc(0x15e)])===_0x5ef4cc(0x174)),_0x424d31=_0x48000e?buildDatasetCodeToAliasMap(_0x583e38[_0x5ef4cc(0x198)],_0x583e38[_0x5ef4cc(0x1a8)],_0x583e38[_0x5ef4cc(0x13c)]||_0x583e38[_0x5ef4cc(0x197)]?.[_0x5ef4cc(0x14c)]||_0x583e38[_0x5ef4cc(0x197)]?.['defaultApp']):new Map(),_0x4bc55d=createHookLocationMap(_0x4ad79c),_0x1eac08=JSON[_0x5ef4cc(0x19f)](JSON[_0x5ef4cc(0x16f)](_0x23db0e)),_0x32eb68=_0x583e38['appCode'],_0x406baf=_0x1eac08[_0x5ef4cc(0x185)][_0x32eb68];if(!_0x406baf)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x32eb68+_0x5ef4cc(0x152));const _0x46a59c=_0x48000e?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x160717,_0x406baf,_0x424d31,await scanLocalBffFunctions(_0x160717,_0x5ef4cc(0x174))),_0x406baf):undefined,_0x88d0cc=createPullFileTransaction(),_0x2b9e73=[],_0x4bdad2=[],_0x4259ed=[],_0x2fd56a=[];for(const _0x3491a3 of _0x2f45bd){const _0x260e12=resolveRemoteScriptTarget(_0x160717,_0x3491a3,_0x4bc55d,_0x406baf[_0x5ef4cc(0x175)],_0x424d31);if(!_0x260e12){_0x4bdad2[_0x5ef4cc(0x1ae)]({'lockKey':_0x3491a3[_0x5ef4cc(0x15e)]+'/'+_0x3491a3['functionName'],'reason':_0x5ef4cc(0x12b)});continue;}const _0x478792=_0x406baf[_0x5ef4cc(0x175)][_0x260e12[_0x5ef4cc(0x19d)]];try{if(!_0x3491a3['id'])throw new Error(_0x5ef4cc(0x124));if(_0x3491a3['scriptContent']==null)throw new Error(_0x5ef4cc(0x1b0));const _0x4e113e=_0x3491a3['scriptContent'],_0x3c9adb=computeContentHash(_0x4e113e);if(!_0x4e05c4){const _0x35b435=await hasUnsyncedLocalChanges(_0x260e12[_0x5ef4cc(0x163)],_0x478792,_0x3c9adb);if(_0x35b435){_0x4259ed[_0x5ef4cc(0x1ae)](localUnsyncedConflict(_0x260e12,_0x3491a3['id']));continue;}}await _0x88d0cc['write'](_0x260e12[_0x5ef4cc(0x163)],_0x4e113e);const _0x188b7a={'hash':_0x3c9adb,'remoteId':_0x3491a3['id'],'version':_0x3491a3[_0x5ef4cc(0x19c)]};_0x260e12[_0x5ef4cc(0x19b)]==='HOOK'&&_0x260e12[_0x5ef4cc(0x14d)]&&(_0x188b7a[_0x5ef4cc(0x138)]=_0x260e12[_0x5ef4cc(0x14d)]['alias'],_0x188b7a[_0x5ef4cc(0x129)]=_0x260e12[_0x5ef4cc(0x14d)][_0x5ef4cc(0x129)],_0x188b7a[_0x5ef4cc(0x12f)]=_0x260e12[_0x5ef4cc(0x14d)][_0x5ef4cc(0x12f)],_0x188b7a[_0x5ef4cc(0x122)]=_0x260e12[_0x5ef4cc(0x14d)]['functionNode']),_0x406baf[_0x5ef4cc(0x175)][_0x260e12[_0x5ef4cc(0x19d)]]=_0x188b7a,_0x2b9e73['push']({'lockKey':_0x260e12['lockKey'],'remoteId':_0x3491a3['id']});}catch(_0x4c3bc9){_0x2fd56a[_0x5ef4cc(0x1ae)]({'lockKey':_0x260e12[_0x5ef4cc(0x19d)],'error':_0x4c3bc9 instanceof Error?_0x4c3bc9[_0x5ef4cc(0x189)]:String(_0x4c3bc9)});}}_0x406baf['lastSync']=new Date()['toISOString']();try{await writeBffLockFile(_0x160717[_0x5ef4cc(0x181)],_0x1eac08);}catch(_0x4021c0){const _0x39f5a5=[...await _0x88d0cc[_0x5ef4cc(0x183)](),...await _0x46a59c?.[_0x5ef4cc(0x183)]()??[]];throw withRollbackErrors(_0x4021c0,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x39f5a5);}return{'ok':_0x2fd56a[_0x5ef4cc(0x150)]===0x0,'data':{'pulled':_0x2b9e73,'skipped':_0x4bdad2,'conflicts':_0x4259ed,'failed':_0x2fd56a},'message':formatPullMessage(_0x2b9e73['length'],_0x4bdad2[_0x5ef4cc(0x150)],_0x4259ed[_0x5ef4cc(0x150)],_0x2fd56a[_0x5ef4cc(0x150)])};}};function localUnsyncedConflict(_0x1e0930,_0x240c52){const _0x40c3ec=a43_0x14c7c8,_0x1729f1=_0x1e0930['lockKey'][_0x40c3ec(0x135)]('/')['at'](-0x1);return{'code':_0x40c3ec(0x12c),'lockKey':_0x1e0930['lockKey'],'filePath':_0x1e0930[_0x40c3ec(0x163)],..._0x240c52!=null?{'remoteId':_0x240c52}:{},'message':_0x40c3ec(0x1aa),'nextAction':{'action':_0x40c3ec(0x14a),'command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x1e0930[_0x40c3ec(0x19b)]+_0x40c3ec(0x15b)+_0x1729f1+_0x40c3ec(0x143),'requiresReview':!![],'message':_0x40c3ec(0x1b4)}};}function formatPullMessage(_0x41bc48,_0xcd7f14,_0x1cc037,_0x43d36b){const _0x364c4f=a43_0x14c7c8,_0x1e3c6b=[_0x364c4f(0x18b)+_0x41bc48+_0x364c4f(0x153),_0xcd7f14+_0x364c4f(0x164)];_0x1cc037>0x0&&_0x1e3c6b[_0x364c4f(0x1ae)](_0x1cc037+'\x20conflict'+(_0x1cc037===0x1?'':'s')+'\x20'+(_0x1cc037===0x1?_0x364c4f(0x147):'require')+_0x364c4f(0x1b5));if(_0x43d36b>0x0)_0x1e3c6b[_0x364c4f(0x1ae)](_0x43d36b+_0x364c4f(0x133));return _0x1e3c6b['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x4265f6,_0x3ca2f0,_0x162b03){const _0x13cd9d=a43_0x14c7c8;if(!await fileExists(_0x4265f6))return![];const _0xcb1437=await computeFileHash(_0x4265f6);if(!_0x3ca2f0)return _0x162b03?_0xcb1437!==_0x162b03:!![];return _0xcb1437!==_0x3ca2f0[_0x13cd9d(0x159)];}function createPullFileTransaction(){const _0xa4696f=new Map(),_0x13e0ec=async(_0x55bfc9,_0x2cb769)=>{const _0x47f178=a43_0x56b0;try{if(_0x2cb769['existed'])await ensureParentDirectory(_0x55bfc9),await writeFile(_0x55bfc9,_0x2cb769[_0x47f178(0x195)]);else try{await unlink(_0x55bfc9);}catch(_0x220c93){if(_0x220c93[_0x47f178(0x146)]!==_0x47f178(0x18f))throw _0x220c93;}return undefined;}catch(_0xa42d87){return _0xa42d87 instanceof Error?_0xa42d87:new Error(String(_0xa42d87));}};return{async 'write'(_0x4c2116,_0x3733de){const _0x550ae2=a43_0x56b0;if(!_0xa4696f[_0x550ae2(0x1a2)](_0x4c2116))try{_0xa4696f[_0x550ae2(0x142)](_0x4c2116,{'existed':!![],'content':await readFile(_0x4c2116)});}catch(_0x5c7ddd){if(_0x5c7ddd[_0x550ae2(0x146)]!=='ENOENT')throw _0x5c7ddd;_0xa4696f[_0x550ae2(0x142)](_0x4c2116,{'existed':![]});}try{await ensureParentDirectory(_0x4c2116),await writeFile(_0x4c2116,_0x3733de,_0x550ae2(0x14f));}catch(_0x1b6716){const _0x176c6e=await _0x13e0ec(_0x4c2116,_0xa4696f['get'](_0x4c2116));if(!_0x176c6e)_0xa4696f[_0x550ae2(0x131)](_0x4c2116);throw withRollbackErrors(_0x1b6716,_0x550ae2(0x1a3)+_0x4c2116+'\x22.',_0x176c6e?[_0x176c6e]:[]);}},async 'rollback'(){const _0x371dab=a43_0x56b0,_0x340013=[];for(const [_0xe41cb1,_0x509deb]of[..._0xa4696f[_0x371dab(0x196)]()][_0x371dab(0x161)]()){const _0x542719=await _0x13e0ec(_0xe41cb1,_0x509deb);_0x542719&&_0x340013[_0x371dab(0x1ae)](new Error(_0x371dab(0x155)+_0xe41cb1+'\x22:\x20'+_0x542719['message']));}return _0x340013;}};}function withRollbackErrors(_0x299904,_0x3f2a55,_0x4bf1dc){const _0x21c545=a43_0x14c7c8,_0x329c85=_0x299904 instanceof Error?_0x299904:new Error(String(_0x299904));if(_0x4bf1dc[_0x21c545(0x150)]===0x0)return _0x329c85;return new AggregateError([_0x329c85,..._0x4bf1dc],_0x3f2a55+_0x21c545(0x184)+_0x4bf1dc[_0x21c545(0x13d)](_0x2c9cc8=>_0x2c9cc8['message'])[_0x21c545(0x173)](';\x20'));}function buildDatasetCodeToAliasMap(_0x1e3d52,_0x33fca7,_0x292640){const _0x18afed=a43_0x14c7c8,_0x764690=resolveApiModelSource(_0x1e3d52,_0x33fca7,_0x292640),_0xb96ba1=loadAliasMap(_0x1e3d52,undefined,_0x764690[_0x18afed(0x163)],_0x764690[_0x18afed(0x190)]);return assertUnambiguousHookAliases(_0xb96ba1),new Map(_0xb96ba1[_0x18afed(0x13d)](_0x2031f7=>[_0x2031f7[_0x18afed(0x129)][_0x18afed(0x167)](),_0x2031f7[_0x18afed(0x138)]]));}async function planHookDirectoryMigration(_0x47db5e,_0x3d5faa,_0x1176c8,_0x4b6dbf){const _0x9c0b81=a43_0x14c7c8,_0x31b28=new Map();for(const [_0x1f3080,_0x491870]of Object['entries'](_0x3d5faa['functions'])){const [_0x52c281,_0x598d89,_0xc4bf8c,_0x4a7513,_0x342dc3,..._0x1712e8]=_0x1f3080[_0x9c0b81(0x135)]('/');if(_0x52c281!==_0x9c0b81(0x174)||!_0x598d89||!_0xc4bf8c||!_0x4a7513||!_0x342dc3||_0x1712e8['length']>0x0||!_0x491870[_0x9c0b81(0x129)])continue;const _0x55f655=_0x1176c8[_0x9c0b81(0x17e)](_0x491870[_0x9c0b81(0x129)][_0x9c0b81(0x167)]()),_0x5eb532=_0x55f655??_0x491870[_0x9c0b81(0x129)];if(!isSafeHookDirectorySegment(_0x598d89))throw CliErrors[_0x9c0b81(0x191)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x598d89+_0x9c0b81(0x165));if(!isSafeHookDirectorySegment(_0x5eb532))throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x156)+_0x598d89+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x598d89===_0x5eb532)continue;const _0x7ed219=_0x31b28[_0x9c0b81(0x17e)](_0x598d89)??{'datasetCode':_0x491870[_0x9c0b81(0x129)],'alias':_0x55f655,'keyChanges':[]};if(_0x7ed219[_0x9c0b81(0x129)]!==_0x491870[_0x9c0b81(0x129)])throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x156)+_0x598d89+_0x9c0b81(0x134));const _0x407b29=_0x9c0b81(0x166)+_0x5eb532+'/'+_0xc4bf8c+'/'+_0x4a7513+'/'+_0x342dc3;try{resolveLocalFilePathFromLockKey(_0x47db5e,_0x1f3080),resolveLocalFilePathFromLockKey(_0x47db5e,_0x407b29);}catch(_0x285ee0){throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x1ac)+_0x1f3080+_0x9c0b81(0x12a)+(_0x285ee0 instanceof Error?_0x285ee0[_0x9c0b81(0x189)]:String(_0x285ee0)));}_0x7ed219[_0x9c0b81(0x17c)]['push']({'oldLockKey':_0x1f3080,'newLockKey':_0x407b29,'entry':_0x491870}),_0x31b28[_0x9c0b81(0x142)](_0x598d89,_0x7ed219);}const _0x42bab8=new Set([..._0x31b28[_0x9c0b81(0x194)]()][_0x9c0b81(0x14e)](_0x322ccc=>_0x322ccc[_0x9c0b81(0x17c)][_0x9c0b81(0x13d)](_0x153e37=>_0x153e37['oldLockKey']))),_0x4eb2f7=new Map(),_0x4a1ad6=new Map();for(const [_0x452d42,_0x136e63]of _0x31b28){const _0x5f983=_0x136e63[_0x9c0b81(0x138)]??_0x136e63[_0x9c0b81(0x129)],_0x8bfad5=hookDirectoryIdentity(_0x5f983),_0x1bbc48=_0x4eb2f7[_0x9c0b81(0x17e)](_0x8bfad5);if(_0x1bbc48&&_0x1bbc48!==_0x452d42)throw CliErrors['validation'](_0x9c0b81(0x16b)+_0x1bbc48+_0x9c0b81(0x125)+_0x452d42+_0x9c0b81(0x132)+_0x5f983+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x4eb2f7[_0x9c0b81(0x142)](_0x8bfad5,_0x452d42);for(const _0x1b2c0a of _0x136e63[_0x9c0b81(0x17c)]){const _0x3625b6=_0x4a1ad6[_0x9c0b81(0x17e)](_0x1b2c0a[_0x9c0b81(0x1a6)]);if(_0x3625b6&&_0x3625b6!==_0x1b2c0a[_0x9c0b81(0x128)])throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x121)+_0x3625b6+_0x9c0b81(0x125)+_0x1b2c0a[_0x9c0b81(0x128)]+_0x9c0b81(0x132)+_0x1b2c0a[_0x9c0b81(0x1a6)]+_0x9c0b81(0x1a0));if(_0x42bab8[_0x9c0b81(0x1a2)](_0x1b2c0a[_0x9c0b81(0x1a6)]))throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x1ab)+_0x1b2c0a[_0x9c0b81(0x128)]+_0x9c0b81(0x18e)+_0x1b2c0a[_0x9c0b81(0x1a6)]+_0x9c0b81(0x1a9));_0x4a1ad6[_0x9c0b81(0x142)](_0x1b2c0a[_0x9c0b81(0x1a6)],_0x1b2c0a['oldLockKey']);}}const _0x52a81d=new Map();for(const [_0x596e68,_0x3af866]of _0x1176c8){_0x52a81d[_0x9c0b81(0x142)](hookDirectoryIdentity(_0x3af866),_0x596e68);}const _0x568cac=[];for(const [_0xd006bf,_0x5412da]of _0x31b28){const _0x45a631=_0x5412da['alias']??_0x5412da[_0x9c0b81(0x129)],_0x204681=join(_0x47db5e[_0x9c0b81(0x130)],_0x9c0b81(0x174),_0xd006bf),_0x140183=join(_0x47db5e[_0x9c0b81(0x130)],'HOOK',_0x45a631),_0xb5c886=await directoryExists(_0x204681),_0x47cd6=await directoryExists(_0x140183),_0x5b67b0=_0xb5c886?_0x47cd6?await sameDirectory(_0x204681,_0x140183)?_0x9c0b81(0x1a4):undefined:'move':_0x9c0b81(0x17d);if(!_0x5b67b0)throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x156)+_0xd006bf+'\x22\x20to\x20\x22'+_0x45a631+_0x9c0b81(0x19e));const _0x235abc=_0x52a81d[_0x9c0b81(0x17e)](hookDirectoryIdentity(_0xd006bf));if(_0x235abc&&_0x235abc!==_0x5412da[_0x9c0b81(0x129)][_0x9c0b81(0x167)]()){const _0xd23ec5=new Set(_0x5412da[_0x9c0b81(0x17c)][_0x9c0b81(0x13d)](_0x30ce77=>_0x30ce77[_0x9c0b81(0x128)])),_0x1c265c=_0x4b6dbf['filter'](_0x592ae9=>_0x592ae9['type']==='HOOK'&&_0x592ae9[_0x9c0b81(0x138)]!=null&&hookDirectoryIdentity(_0x592ae9[_0x9c0b81(0x138)])===hookDirectoryIdentity(_0xd006bf)&&!_0xd23ec5[_0x9c0b81(0x1a2)](_0x592ae9['lockKey']));if(_0x1c265c[_0x9c0b81(0x150)]>0x0)throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0xd006bf+_0x9c0b81(0x17f));}const _0x4a266a=_0x52a81d[_0x9c0b81(0x17e)](hookDirectoryIdentity(_0x45a631));if(_0x4a266a&&_0x4a266a!==_0x5412da[_0x9c0b81(0x129)][_0x9c0b81(0x167)]())throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x156)+_0xd006bf+'\x22\x20to\x20\x22'+_0x45a631+_0x9c0b81(0x188));for(const _0x3c99c9 of _0x5412da['keyChanges']){const _0x430060=_0x3d5faa[_0x9c0b81(0x175)][_0x3c99c9[_0x9c0b81(0x1a6)]];if(_0x430060&&!_0x42bab8[_0x9c0b81(0x1a2)](_0x3c99c9[_0x9c0b81(0x1a6)])&&!sameHookIdentity(_0x3c99c9[_0x9c0b81(0x137)],_0x430060))throw CliErrors[_0x9c0b81(0x191)](_0x9c0b81(0x156)+_0xd006bf+_0x9c0b81(0x136)+_0x45a631+'\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.');}_0x568cac[_0x9c0b81(0x1ae)]({'oldDirectory':_0xd006bf,'newDirectory':_0x45a631,'oldDirectoryPath':_0x204681,'newDirectoryPath':_0x140183,'mode':_0x5b67b0,'alias':_0x5412da[_0x9c0b81(0x138)],'keyChanges':_0x5412da[_0x9c0b81(0x17c)]});}const _0x3a5a38={..._0x3d5faa['functions']},_0x4a5014=new Map(),_0xb325f=new Map();for(const _0x281ec2 of _0x568cac){const _0x553397=_0x281ec2['mode']!==_0x9c0b81(0x17d);_0x553397&&_0xb325f['set'](hookDirectoryIdentity(_0x281ec2[_0x9c0b81(0x169)]),_0x281ec2[_0x9c0b81(0x17a)]);for(const _0x4cb23d of _0x281ec2['keyChanges']){const _0x9e3aa5=_0x3a5a38[_0x4cb23d[_0x9c0b81(0x1a6)]],_0x328b8c=_0x553397?_0x4cb23d[_0x9c0b81(0x137)]:_0x9e3aa5??_0x4cb23d[_0x9c0b81(0x137)];_0x3a5a38[_0x4cb23d[_0x9c0b81(0x1a6)]]=canonicalizeHookEntry(_0x328b8c,_0x281ec2['alias']),delete _0x3a5a38[_0x4cb23d[_0x9c0b81(0x128)]],_0x553397&&_0x4a5014[_0x9c0b81(0x142)](_0x4cb23d['newLockKey'],resolveLocalFilePathFromLockKey(_0x47db5e,_0x4cb23d['oldLockKey']));}}return{'migrations':_0x568cac,'projectedFunctions':_0x3a5a38,'sourceFilePathByNewLockKey':_0x4a5014,'sourceDirectoryPathByNewDirectory':_0xb325f};}function resolveMigratedSourceFilePath(_0x319471,_0x2c95d1){const _0x4e8d23=a43_0x14c7c8;if(!_0x319471||!_0x2c95d1)return undefined;const _0x172f17=_0x319471[_0x4e8d23(0x199)][_0x4e8d23(0x17e)](_0x2c95d1[_0x4e8d23(0x19d)]);if(_0x172f17)return _0x172f17;if(_0x2c95d1[_0x4e8d23(0x19b)]!=='HOOK')return undefined;const [,_0x3c0028,..._0x2e60e5]=_0x2c95d1[_0x4e8d23(0x19d)][_0x4e8d23(0x135)]('/');if(!_0x3c0028||_0x2e60e5[_0x4e8d23(0x150)]===0x0)return undefined;const _0xd2ba57=_0x319471[_0x4e8d23(0x149)][_0x4e8d23(0x17e)](hookDirectoryIdentity(_0x3c0028));return _0xd2ba57?join(_0xd2ba57,..._0x2e60e5)+'.js':undefined;}function a43_0x56b0(_0x2787b3,_0x5cdcb7){_0x2787b3=_0x2787b3-0x121;const _0x5dbe3a=a43_0x5dbe();let _0x56b06c=_0x5dbe3a[_0x2787b3];return _0x56b06c;}function sameHookIdentity(_0x579386,_0x3db9b1){const _0x16ec0d=a43_0x14c7c8;return _0x579386[_0x16ec0d(0x148)]===_0x3db9b1[_0x16ec0d(0x148)]&&_0x579386[_0x16ec0d(0x129)]===_0x3db9b1[_0x16ec0d(0x129)]&&_0x579386[_0x16ec0d(0x12f)]===_0x3db9b1[_0x16ec0d(0x12f)]&&_0x579386[_0x16ec0d(0x122)]===_0x3db9b1[_0x16ec0d(0x122)];}function canonicalizeHookEntry(_0x33beaf,_0x385350){const {alias:_0x5ebf92,..._0xadc646}=_0x33beaf;return _0x385350?{..._0xadc646,'alias':_0x385350}:_0xadc646;}function hookDirectoryIdentity(_0x572909){const _0x390fa9=a43_0x14c7c8;return _0x572909['normalize'](_0x390fa9(0x15d))[_0x390fa9(0x167)]();}function isSafeHookDirectorySegment(_0x11ac59){return isSafeLockKeySegment(_0x11ac59);}async function sameDirectory(_0x8da055,_0x468fee){const _0x528b70=a43_0x14c7c8,[_0x6d8336,_0x4d556d]=await Promise['all']([stat(_0x8da055),stat(_0x468fee)]);return _0x6d8336[_0x528b70(0x13b)]===_0x4d556d[_0x528b70(0x13b)]&&_0x6d8336[_0x528b70(0x15f)]===_0x4d556d['ino'];}async function applyHookDirectoryMigration(_0x19cc5e,_0x44953e){const _0xe15813=a43_0x14c7c8,_0x2ba3c5=_0x44953e[_0xe15813(0x175)],_0x2d3618=_0x44953e[_0xe15813(0x168)],_0x4fa281=[],_0x39ae01=async()=>{const _0x1c7923=_0xe15813,_0x58f191=[];_0x44953e[_0x1c7923(0x175)]=_0x2ba3c5,_0x44953e[_0x1c7923(0x168)]=_0x2d3618;for(const {migration:_0x42c0d3,temporaryPath:_0x30c4d1}of[..._0x4fa281]['reverse']()){try{_0x30c4d1?(await rename(_0x42c0d3[_0x1c7923(0x158)],_0x30c4d1),await rename(_0x30c4d1,_0x42c0d3[_0x1c7923(0x17a)])):await rename(_0x42c0d3[_0x1c7923(0x158)],_0x42c0d3[_0x1c7923(0x17a)]);}catch(_0x546488){_0x58f191[_0x1c7923(0x1ae)](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x42c0d3[_0x1c7923(0x1b3)]+_0x1c7923(0x157)+_0x42c0d3['newDirectory']+_0x1c7923(0x12a)+(_0x546488 instanceof Error?_0x546488[_0x1c7923(0x189)]:String(_0x546488))));}}return _0x58f191;};try{for(const _0x41b115 of _0x19cc5e['migrations']){if(_0x41b115[_0xe15813(0x12d)]===_0xe15813(0x18c))await ensureParentDirectory(_0x41b115[_0xe15813(0x158)]),await rename(_0x41b115[_0xe15813(0x17a)],_0x41b115[_0xe15813(0x158)]),_0x4fa281['push']({'migration':_0x41b115});else{if(_0x41b115[_0xe15813(0x12d)]===_0xe15813(0x1a4)){const _0x496672=join(dirname(_0x41b115[_0xe15813(0x17a)]),_0xe15813(0x18a)+randomUUID());await rename(_0x41b115['oldDirectoryPath'],_0x496672);try{await rename(_0x496672,_0x41b115[_0xe15813(0x158)]);}catch(_0x182299){try{await rename(_0x496672,_0x41b115[_0xe15813(0x17a)]);}catch(_0x2a7576){throw withRollbackErrors(_0x182299,_0xe15813(0x172)+_0x41b115[_0xe15813(0x1b3)]+'\x22\x20to\x20\x22'+_0x41b115[_0xe15813(0x169)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x496672+'\x22\x20may\x20remain.',[new Error(_0xe15813(0x141)+_0x496672+_0xe15813(0x136)+_0x41b115['oldDirectory']+_0xe15813(0x12a)+(_0x2a7576 instanceof Error?_0x2a7576[_0xe15813(0x189)]:String(_0x2a7576)))]);}throw _0x182299;}_0x4fa281[_0xe15813(0x1ae)]({'migration':_0x41b115,'temporaryPath':_0x496672});}}}return _0x44953e[_0xe15813(0x175)]=_0x19cc5e[_0xe15813(0x1b2)],{'rollback':_0x39ae01};}catch(_0x812286){const _0x2cec14=await _0x39ae01();throw withRollbackErrors(_0x812286,_0xe15813(0x182),_0x2cec14);}}async function confirmForce(){const _0x3690a5=a43_0x14c7c8,_0x3b5f47=createInterface({'input':process[_0x3690a5(0x16a)],'output':process[_0x3690a5(0x1b6)]}),_0x394c38=await new Promise(_0x37b86d=>{const _0x122167=_0x3690a5;_0x3b5f47[_0x122167(0x139)](_0x122167(0x1b1),_0x37b86d);});return _0x3b5f47['close'](),['y','yes'][_0x3690a5(0x193)](_0x394c38[_0x3690a5(0x178)]()['toLowerCase']());}
|