@lovrabet/rabetbase-cli 2.5.4-beta.4 → 2.5.4
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 +8 -2
- 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.d.ts +2 -0
- package/lib/commands/app/detail.js +1 -0
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.d.ts +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.d.ts +3 -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.d.ts +2 -0
- package/lib/commands/menu/shared/path.js +1 -0
- package/lib/commands/menu/shared/service.d.ts +6 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.d.ts +28 -0
- package/lib/commands/menu/shared/subapp-assets.js +1 -0
- package/lib/commands/menu/shared/sync-core.d.ts +2 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/types.d.ts +14 -4
- 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.d.ts +2 -0
- package/lib/commands/menu/subapp-assets-status.js +1 -0
- package/lib/commands/menu/subapp-assets-update.d.ts +2 -0
- package/lib/commands/menu/subapp-assets-update.js +1 -0
- 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 +15 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +21 -12
- package/skills/rabetbase/guides/backend-function.md +2 -7
- package/skills/rabetbase/guides/bff-creation-workflow.md +24 -23
- package/skills/rabetbase/guides/host-frontend-integration.md +62 -0
- package/skills/rabetbase/guides/independent-deployment.md +45 -0
- package/skills/rabetbase/guides/troubleshooting.md +9 -1
- package/skills/rabetbase/references/rabetbase-app-detail.md +31 -0
- package/skills/rabetbase/references/rabetbase-bff-detail.md +1 -1
- package/skills/rabetbase/references/rabetbase-bff-push.md +2 -2
- package/skills/rabetbase/references/rabetbase-data-list-status.md +1 -0
- package/skills/rabetbase/references/rabetbase-deployment-sync-all.md +5 -1
- package/skills/rabetbase/references/rabetbase-menu-asset-update.md +9 -7
- package/skills/rabetbase/references/rabetbase-menu-list.md +2 -2
- package/skills/rabetbase/references/rabetbase-menu-subapp-assets-status.md +19 -0
- package/skills/rabetbase/references/rabetbase-menu-subapp-assets-update.md +27 -0
- package/skills/rabetbase/references/rabetbase-menu-sync.md +40 -14
- package/skills/rabetbase/references/rabetbase-page-create.md +1 -1
- package/skills/rabetbase/references/rabetbase-page-generate-start.md +5 -3
- package/skills/rabetbase/references/rabetbase-page-generate-status.md +1 -0
- package/skills/rabetbase.manifest.json +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a34_0x2fcd4e=a34_0x6ee9;(function(_0x1d71b2,_0x43e742){const _0x48399c=a34_0x6ee9,_0x1c197e=_0x1d71b2();while(!![]){try{const _0x2df03c=parseInt(_0x48399c(0x14e))/0x1+parseInt(_0x48399c(0x165))/0x2*(parseInt(_0x48399c(0x16a))/0x3)+-parseInt(_0x48399c(0x15c))/0x4*(-parseInt(_0x48399c(0x168))/0x5)+parseInt(_0x48399c(0x163))/0x6*(parseInt(_0x48399c(0x15a))/0x7)+parseInt(_0x48399c(0x164))/0x8*(parseInt(_0x48399c(0x151))/0x9)+parseInt(_0x48399c(0x159))/0xa*(parseInt(_0x48399c(0x156))/0xb)+-parseInt(_0x48399c(0x14b))/0xc*(parseInt(_0x48399c(0x161))/0xd);if(_0x2df03c===_0x43e742)break;else _0x1c197e['push'](_0x1c197e['shift']());}catch(_0x555ea8){_0x1c197e['push'](_0x1c197e['shift']());}}}(a34_0x46b3,0xd3c3c));function a34_0x6ee9(_0x40d82a,_0x24e237){_0x40d82a=_0x40d82a-0x14b;const _0x46b399=a34_0x46b3();let _0x6ee9bf=_0x46b399[_0x40d82a];return _0x6ee9bf;}import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a34_0x46b3(){const _0x49a9e2=['6rDdNGt','183856jtWUdn','21314zIHKvi','/smartapi/app-config/create','write','3441835YKvfXC','create','99sfdPbn','12Udssib','string','tags','1239491MIApMK','number',',\x20appCode=','36ylAhoJ','get','Read\x20config\x20value\x20from\x20file','Created','appCode','1409309dnlmaW','Updated','update','20KehVqd','768215zUuagI','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','8AUySiK','apiError','file','app-config','\x20app\x20config\x20','33259577IdaKFK','isFinite'];a34_0x46b3=function(){return _0x49a9e2;};return a34_0x46b3();}import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';const CREATE_PATH=a34_0x2fcd4e(0x166),UPDATE_PATH='/smartapi/app-config/update';export const appConfigSet={'service':a34_0x2fcd4e(0x15f),'command':'set','description':a34_0x2fcd4e(0x15b),'risk':a34_0x2fcd4e(0x167),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x2fcd4e(0x15e),'type':a34_0x2fcd4e(0x14c),'description':a34_0x2fcd4e(0x153)}],async 'validate'(_0x55b2f1){readKeyArg(_0x55b2f1),readOptionalTags(_0x55b2f1),assertSingleValueSource(_0x55b2f1);},async 'dryRun'(_0x8f10b6){const _0x173d40=a34_0x2fcd4e,_0x190abb=readKeyArg(_0x8f10b6),_0x266b1f=readOptionalTags(_0x8f10b6),_0x53c8ba=assertSingleValueSource(_0x8f10b6);await assertValueSourceReadable(_0x53c8ba);const _0x123936=await withAppConfigApiBoundary(_0x173d40(0x152),{'appCode':_0x8f10b6[_0x173d40(0x155)],'key':_0x190abb},()=>getAppConfigByKey(_0x8f10b6[_0x173d40(0x155)],_0x190abb)),_0x4b8d76=_0x123936?_0x173d40(0x158):_0x173d40(0x169),_0x19dea0=_0x123936?projectAppConfig(_0x123936):null,_0x35fddd=plannedAppConfig({'appCode':_0x8f10b6[_0x173d40(0x155)],'key':_0x190abb,'tags':_0x266b1f??_0x123936?.[_0x173d40(0x14d)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x4b8d76,'appCode':_0x8f10b6[_0x173d40(0x155)],'key':_0x190abb,'before':_0x19dea0,'after':_0x35fddd,'dryRun':!![]}),{'method':'POST','url':_0x4b8d76===_0x173d40(0x158)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x12bea7){const _0x384322=a34_0x2fcd4e,_0x44de0c=readKeyArg(_0x12bea7),_0x2f454b=readOptionalTags(_0x12bea7),_0x4a098d=await withAppConfigApiBoundary(_0x384322(0x152),{'appCode':_0x12bea7[_0x384322(0x155)],'key':_0x44de0c},()=>getAppConfigByKey(_0x12bea7[_0x384322(0x155)],_0x44de0c)),_0x563e5b=_0x4a098d?projectAppConfig(_0x4a098d):null,_0x3c7d6f=_0x4a098d?_0x384322(0x158):'create',{value:_0x631149,warnings:_0x4ef619}=await readAppConfigValue(_0x12bea7),_0x58b241={'appCode':_0x12bea7[_0x384322(0x155)],'key':_0x44de0c,'value':_0x631149,'tags':_0x2f454b??_0x4a098d?.[_0x384322(0x14d)]??undefined};await withAppConfigApiBoundary(_0x3c7d6f,{'appCode':_0x12bea7['appCode'],'key':_0x44de0c},async()=>{_0x4a098d?await updateAppConfig({..._0x58b241,'id':requireAppConfigId(_0x4a098d,_0x44de0c,_0x12bea7['appCode'])}):await createAppConfig(_0x58b241);});const _0x251e7e=await withAppConfigApiBoundary(_0x384322(0x152),{'appCode':_0x12bea7['appCode'],'key':_0x44de0c},()=>getAppConfigByKey(_0x12bea7[_0x384322(0x155)],_0x44de0c)),_0x4a09ef=_0x251e7e?projectAppConfig(_0x251e7e):plannedAppConfig({'appCode':_0x12bea7['appCode'],'key':_0x44de0c,'tags':_0x58b241['tags'],'hasValue':_0x631149!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x3c7d6f,'appCode':_0x12bea7['appCode'],'key':_0x44de0c,'before':_0x563e5b,'after':_0x4a09ef,'dryRun':![],'warnings':_0x4ef619}),'message':(_0x3c7d6f===_0x384322(0x158)?_0x384322(0x157):_0x384322(0x154))+_0x384322(0x160)+_0x44de0c};}};function requireAppConfigId(_0x1053ba,_0x1abc71,_0x101790){const _0x46ed8e=a34_0x2fcd4e;if(typeof _0x1053ba['id']===_0x46ed8e(0x14f)&&Number[_0x46ed8e(0x162)](_0x1053ba['id'])&&_0x1053ba['id']>0x0)return _0x1053ba['id'];throw CliErrors[_0x46ed8e(0x15d)]('App\x20config\x20server\x20id\x20missing\x20for\x20key='+_0x1abc71+_0x46ed8e(0x150)+_0x101790);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x2075b6=a35_0x5ca5;(function(_0x4b3330,_0x2d152){const _0x28efa6=a35_0x5ca5,_0x426c1a=_0x4b3330();while(!![]){try{const _0x593478=-parseInt(_0x28efa6(0x135))/0x1+parseInt(_0x28efa6(0x133))/0x2*(-parseInt(_0x28efa6(0x12c))/0x3)+-parseInt(_0x28efa6(0x15b))/0x4+parseInt(_0x28efa6(0x124))/0x5+parseInt(_0x28efa6(0x161))/0x6*(-parseInt(_0x28efa6(0x125))/0x7)+-parseInt(_0x28efa6(0x12b))/0x8*(parseInt(_0x28efa6(0x134))/0x9)+parseInt(_0x28efa6(0x15a))/0xa*(parseInt(_0x28efa6(0x149))/0xb);if(_0x593478===_0x2d152)break;else _0x426c1a['push'](_0x426c1a['shift']());}catch(_0x8afc7a){_0x426c1a['push'](_0x426c1a['shift']());}}}(a35_0x3e06,0xc670d));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a35_0x2075b6(0x12d),'required':!![]};export const VALUE_ARG={'name':a35_0x2075b6(0x126),'description':a35_0x2075b6(0x12e),'required':![]};export const TAGS_FLAG={'name':a35_0x2075b6(0x15f),'type':a35_0x2075b6(0x142),'description':a35_0x2075b6(0x160)};export const STDIN_FLAG={'name':a35_0x2075b6(0x156),'type':a35_0x2075b6(0x162),'description':'Read\x20config\x20value\x20from\x20stdin','default':![]};function a35_0x3e06(){const _0x3fd5c7=['before','11520575OvUAwn','Missing\x20app-config\x20value\x20source.','validation','bool','length','path','data','file','argument','once','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','hasValue','push','stdin','args','apiError','defineProperties','50FdKQVJ','5403228FnkxUc','utf8','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','Value\x20file\x20is\x20not\x20readable:\x20','tags','Config\x20tags\x20for\x20filtering/display\x20metadata','2034zWXzUx','boolean','Missing\x20app-config\x20key.','method','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','1713370vCEjLc','10451BFmEem','value','end','env','from-env','setEncoding','9320VDmMdz','15RaYDIH','Runtime\x20app-config\x20key','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','flag','appCode','after','valueRedacted','81534vTYjom','9459FRSFSk','1481302vGMXSN','name','Failed\x20to\x20','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','join','error','str','trim','Environment\x20variable\x20is\x20not\x20set:\x20','kind','slice','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','key','string','warnings','dryRun','value\x20is\x20redacted','reveal','url'];a35_0x3e06=function(){return _0x3fd5c7;};return a35_0x3e06();}export const FROM_ENV_FLAG={'name':a35_0x2075b6(0x129),'type':a35_0x2075b6(0x142),'description':a35_0x2075b6(0x15d)};export const REVEAL_FLAG={'name':a35_0x2075b6(0x146),'type':'boolean','description':a35_0x2075b6(0x123),'default':![]};export function readKeyArg(_0x3df2eb){const _0x63d20e=a35_0x2075b6,_0x40ac13=_0x3df2eb[_0x63d20e(0x157)][0x0]?.[_0x63d20e(0x13c)]()??'';return validateKey(_0x40ac13),_0x40ac13;}function a35_0x5ca5(_0x549a51,_0x16ccfa){_0x549a51=_0x549a51-0x122;const _0x3e060a=a35_0x3e06();let _0x5ca52d=_0x3e060a[_0x549a51];return _0x5ca52d;}export function readOptionalTags(_0x3c2954){const _0x5d6d56=a35_0x2075b6,_0x15f626=_0x3c2954['str'](_0x5d6d56(0x15f))['trim']();if(!_0x15f626)return undefined;if(_0x15f626[_0x5d6d56(0x14d)]>0x20)throw CliErrors[_0x5d6d56(0x14b)](_0x5d6d56(0x140));return _0x15f626;}export function validateKey(_0x4cd963){const _0x2ed5e3=a35_0x2075b6;if(!_0x4cd963)throw CliErrors[_0x2ed5e3(0x14b)](_0x2ed5e3(0x163));if(_0x4cd963[_0x2ed5e3(0x14d)]>0x100)throw CliErrors[_0x2ed5e3(0x14b)]('App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.');}export function projectAppConfig(_0x38b441,_0x48a672){const _0x9dce66=a35_0x2075b6,_0x1af1be=_0x38b441[_0x9dce66(0x126)]!==undefined&&_0x38b441['value']!==null&&_0x38b441['value']!=='',_0x18217e={'appCode':_0x38b441[_0x9dce66(0x130)],'key':_0x38b441['key'],'tags':_0x38b441['tags']??undefined,'hasValue':_0x1af1be,'valueRedacted':_0x1af1be&&!_0x48a672?.[_0x9dce66(0x146)],'gmtCreate':_0x38b441['gmtCreate'],'gmtModified':_0x38b441['gmtModified']};return _0x48a672?.[_0x9dce66(0x146)]&&(_0x18217e[_0x9dce66(0x126)]=_0x38b441[_0x9dce66(0x126)]??'',_0x18217e[_0x9dce66(0x132)]=![]),_0x18217e;}export function plannedAppConfig(_0x2b3c63){const _0x41c2c2=a35_0x2075b6,_0x393a37=_0x2b3c63[_0x41c2c2(0x154)]??!![];return{'appCode':_0x2b3c63['appCode'],'key':_0x2b3c63['key'],'tags':_0x2b3c63[_0x41c2c2(0x15f)]??undefined,'hasValue':_0x393a37,'valueRedacted':_0x393a37};}export function buildMutationData(_0x4b1d78){const _0x2f90e0=a35_0x2075b6;return{'operation':_0x4b1d78['operation'],'selector':{'appCode':_0x4b1d78[_0x2f90e0(0x130)],'key':_0x4b1d78['key']},'before':_0x4b1d78[_0x2f90e0(0x148)],'after':_0x4b1d78[_0x2f90e0(0x131)],'dryRun':_0x4b1d78[_0x2f90e0(0x144)],'warnings':_0x4b1d78[_0x2f90e0(0x143)]??[]};}export async function withAppConfigApiBoundary(_0x286089,_0x556cf7,_0x3d7fd4){const _0x525cb1=a35_0x2075b6;try{return await _0x3d7fd4();}catch{const _0x238ae2=['appCode:\x20'+_0x556cf7[_0x525cb1(0x130)]];if(_0x556cf7[_0x525cb1(0x141)])_0x238ae2[_0x525cb1(0x155)]('key:\x20'+_0x556cf7[_0x525cb1(0x141)]);_0x238ae2[_0x525cb1(0x155)](_0x525cb1(0x145));throw CliErrors[_0x525cb1(0x158)](_0x525cb1(0x137)+_0x286089+'\x20app\x20config.',_0x238ae2[_0x525cb1(0x139)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x5c63d1,_0x2c6eba){const _0xf04948=a35_0x2075b6;return Object[_0xf04948(0x159)](_0x5c63d1,{'method':{'value':_0x2c6eba[_0xf04948(0x122)],'enumerable':![]},'url':{'value':_0x2c6eba[_0xf04948(0x147)],'enumerable':![]}});}export function assertSingleValueSource(_0x549c7a){const _0x140f69=a35_0x2075b6,_0x174c24=[];_0x549c7a[_0x140f69(0x157)]['length']>0x1&&_0x174c24['push']({'kind':_0x140f69(0x151),'value':_0x549c7a[_0x140f69(0x157)][_0x140f69(0x13f)](0x1)[_0x140f69(0x139)]('\x20')});const _0x246037=_0x549c7a[_0x140f69(0x12f)](_0x140f69(0x126));_0x246037!==undefined&&_0x246037!==null&&_0x174c24[_0x140f69(0x155)]({'kind':'argument','value':String(_0x246037)});_0x549c7a[_0x140f69(0x14c)]('stdin')&&_0x174c24[_0x140f69(0x155)]({'kind':_0x140f69(0x156)});const _0x57bea2=_0x549c7a[_0x140f69(0x13b)]('from-env')[_0x140f69(0x13c)]();_0x57bea2&&_0x174c24[_0x140f69(0x155)]({'kind':_0x140f69(0x128),'name':_0x57bea2});const _0x5a719f=_0x549c7a['str'](_0x140f69(0x150))[_0x140f69(0x13c)]();_0x5a719f&&_0x174c24[_0x140f69(0x155)]({'kind':_0x140f69(0x150),'path':_0x5a719f});if(_0x174c24['length']===0x0)throw CliErrors['validation'](_0x140f69(0x14a),_0x140f69(0x138));if(_0x174c24[_0x140f69(0x14d)]>0x1)throw CliErrors[_0x140f69(0x14b)]('App\x20config\x20value\x20source\x20is\x20ambiguous.',_0x140f69(0x153));return _0x174c24[0x0];}export async function assertValueSourceReadable(_0x4c5e96){const _0x4c50e1=a35_0x2075b6;if(_0x4c5e96[_0x4c50e1(0x13e)]===_0x4c50e1(0x128)&&!(_0x4c5e96[_0x4c50e1(0x136)]in process.env))throw CliErrors[_0x4c50e1(0x14b)](_0x4c50e1(0x13d)+_0x4c5e96['name']);if(_0x4c5e96['kind']==='file')try{await access(_0x4c5e96[_0x4c50e1(0x14e)]);}catch{throw CliErrors['validation'](_0x4c50e1(0x15e)+_0x4c5e96['path']);}}export async function readAppConfigValue(_0x5e42be){const _0x21f059=a35_0x2075b6,_0x3b88c6=assertSingleValueSource(_0x5e42be),_0x2068bb=[];if(_0x3b88c6[_0x21f059(0x13e)]===_0x21f059(0x151))return _0x2068bb[_0x21f059(0x155)]('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0x3b88c6[_0x21f059(0x126)]??'','source':_0x3b88c6[_0x21f059(0x13e)],'warnings':_0x2068bb};if(_0x3b88c6['kind']===_0x21f059(0x156))return{'value':await readStdin(),'source':_0x3b88c6['kind'],'warnings':_0x2068bb};if(_0x3b88c6[_0x21f059(0x13e)]===_0x21f059(0x128)){if(!(_0x3b88c6['name']in process.env))throw CliErrors[_0x21f059(0x14b)](_0x21f059(0x13d)+_0x3b88c6['name']);return{'value':process.env[_0x3b88c6.name]??'','source':_0x3b88c6[_0x21f059(0x13e)],'warnings':_0x2068bb};}return{'value':await readFile(_0x3b88c6[_0x21f059(0x14e)],_0x21f059(0x15c)),'source':_0x3b88c6[_0x21f059(0x13e)],'warnings':_0x2068bb};}function readStdin(){return new Promise((_0x2bc333,_0x285771)=>{const _0xf77b7f=a35_0x5ca5;let _0x145ec7='';process[_0xf77b7f(0x156)][_0xf77b7f(0x12a)](_0xf77b7f(0x15c)),process[_0xf77b7f(0x156)]['on'](_0xf77b7f(0x14f),_0x50fd1e=>{_0x145ec7+=_0x50fd1e;}),process[_0xf77b7f(0x156)][_0xf77b7f(0x152)](_0xf77b7f(0x127),()=>_0x2bc333(_0x145ec7)),process[_0xf77b7f(0x156)]['once'](_0xf77b7f(0x13a),_0x285771);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a36_0x286f57=a36_0x48f9;(function(_0x4b81ef,_0x3d71b8){const _0x175634=a36_0x48f9,_0x50e6b0=_0x4b81ef();while(!![]){try{const _0x46499f=-parseInt(_0x175634(0x125))/0x1+-parseInt(_0x175634(0x136))/0x2*(parseInt(_0x175634(0x12c))/0x3)+-parseInt(_0x175634(0x129))/0x4*(-parseInt(_0x175634(0x130))/0x5)+-parseInt(_0x175634(0x132))/0x6*(parseInt(_0x175634(0x137))/0x7)+-parseInt(_0x175634(0x124))/0x8+parseInt(_0x175634(0x126))/0x9+parseInt(_0x175634(0x12a))/0xa*(parseInt(_0x175634(0x123))/0xb);if(_0x46499f===_0x3d71b8)break;else _0x50e6b0['push'](_0x50e6b0['shift']());}catch(_0x245318){_0x50e6b0['push'](_0x50e6b0['shift']());}}}(a36_0x98ad,0x46869));import{unlinkSync,existsSync}from'node:fs';function a36_0x48f9(_0x5e5b63,_0x4d98fd){_0x5e5b63=_0x5e5b63-0x122;const _0x98ad4=a36_0x98ad();let _0x48f99e=_0x98ad4[_0x5e5b63];return _0x48f99e;}function a36_0x98ad(){const _0x3d67ae=['login','449796fYCwsE','Clear\x20login\x20session','log','../../auth/auth-server-ui.js','801042Cexvon','7Mwdtpu','!\x20Not\x20logged\x20in','11RNMorP','3809928pKrtPU','444330SZXPWE','707679fUWyTL','nonInteractive','logout','36zhQeHG','12254020JRbqMW','Login\x20via\x20browser','3qUXPcp','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','bool','auth','211610hgpIkU'];a36_0x98ad=function(){return _0x3d67ae;};return a36_0x98ad();}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a36_0x286f57(0x12f),'command':a36_0x286f57(0x131),'description':a36_0x286f57(0x12b),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'yes','type':'boolean','description':a36_0x286f57(0x12d),'default':![]}],async 'execute'(_0x407755){const _0x1320c1=a36_0x286f57,{runAuthServer:_0x4e842a}=await import(_0x1320c1(0x135));return await _0x4e842a({'autoYes':_0x407755[_0x1320c1(0x12e)]('yes'),'nonInteractive':_0x407755[_0x1320c1(0x127)]}),{'ok':!![]};}},{'service':'auth','command':a36_0x286f57(0x128),'description':a36_0x286f57(0x133),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x5875c6){const _0x55564d=a36_0x286f57;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x55564d(0x134)]('✓\x20Logged\x20out')):console[_0x55564d(0x134)](_0x55564d(0x122)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x4719a2=a36_0x195b;(function(_0x4de90a,_0x11d061){const _0x2b4265=a36_0x195b,_0x2ef10f=_0x4de90a();while(!![]){try{const _0x552404=-parseInt(_0x2b4265(0x12a))/0x1+-parseInt(_0x2b4265(0x147))/0x2*(parseInt(_0x2b4265(0x180))/0x3)+parseInt(_0x2b4265(0x159))/0x4+-parseInt(_0x2b4265(0x148))/0x5+-parseInt(_0x2b4265(0x134))/0x6+-parseInt(_0x2b4265(0x16f))/0x7*(-parseInt(_0x2b4265(0x163))/0x8)+-parseInt(_0x2b4265(0x174))/0x9*(-parseInt(_0x2b4265(0x184))/0xa);if(_0x552404===_0x11d061)break;else _0x2ef10f['push'](_0x2ef10f['shift']());}catch(_0x51e92d){_0x2ef10f['push'](_0x2ef10f['shift']());}}}(a36_0x24df,0x49a9f));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';function a36_0x24df(){const _0x5e34d8=['8405289hveRzz','HOOK','map','.js\x0a','description','validation','filePath','Operation\x20type\x20(HOOK\x20only)','function-node','\x22\x20not\x20found.\x20','COMMON','operationType','3NbWrSb','Available:\x20','join','defaultApp','10KwVVFU','ENDPOINT','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','HOOK\x20requires\x20alias/operation/node\x20options.','No\x20datasets\x20found\x20for\x20this\x20app.','trim','Select\x20trigger\x20node:','/COMMON/','Function\x20name\x20(valid\x20JS\x20identifier)','/HOOK/','keys','scriptsRootDir','write','length','Select\x20dataset:','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','当前响应结果','operation-type','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','mergedCli','408743lhEAcn','/**\x0a\x20*\x20','includes','apiDir','nonInteractive','stderr','str','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','datasetcode','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','951138TjyotD','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Trigger\x20node\x20(HOOK\x20only)','datasetCode','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Select\x20operation\x20type:','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','utf8','修改后的请求参数','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','name','functionNode','Available\x20aliases:\x20','tableName','\x22.\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','source','before','1116244eutpgj','733435jXxzFk','find','Dataset\x20not\x20found\x20for\x20code\x20\x22','Invalid\x20dataset\x20selection.','.js','after','/data/dataset/','bff','read','.js\x0a\x20*\x20[触发节点]\x20','\x0a\x20*\x20[平台配置]\x20','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Invalid\x20function\x20name\x20\x22','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','No\x20operation\x20types\x20found\x20for\x20dataset\x20','alias','question','412612gZxAiP','File\x20already\x20exists:\x20','No\x20model\x20aliases\x20found.\x20Run\x20`','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','parseInt','selectedAppName','create','isInteger','修改后的响应结果','\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','16EFPpZB',']\x20(','UNKNOWN','code','entries','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','type','当前请求参数','appCode','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','\x20function:\x20','\x22,\x20params\x20})\x0a','1878548WQHmwQ','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','string','profileName','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'];a36_0x24df=function(){return _0x5e34d8;};return a36_0x24df();}function a36_0x195b(_0x39b426,_0x239b53){_0x39b426=_0x39b426-0x128;const _0x24df85=a36_0x24df();let _0x195b93=_0x24df85[_0x39b426];return _0x195b93;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a36_0x4719a2(0x14f),'command':a36_0x4719a2(0x15f),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a36_0x4719a2(0x150),'flags':[{'name':a36_0x4719a2(0x169),'type':'string','required':!![],'enum':[a36_0x4719a2(0x17e),'ENDPOINT',a36_0x4719a2(0x175)],'description':'Script\x20type'},{'name':a36_0x4719a2(0x13f),'type':a36_0x4719a2(0x171),'required':!![],'description':a36_0x4719a2(0x18d)},{'name':'description','type':a36_0x4719a2(0x171),'description':'Script\x20description'},{'name':'alias','type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a36_0x4719a2(0x132),'type':'string','description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a36_0x4719a2(0x196),'type':a36_0x4719a2(0x171),'description':a36_0x4719a2(0x17b)},{'name':a36_0x4719a2(0x17c),'type':a36_0x4719a2(0x171),'description':a36_0x4719a2(0x136),'enum':[a36_0x4719a2(0x146),a36_0x4719a2(0x14d)]}],async 'validate'(_0x133225){const _0x5027cc=a36_0x4719a2,_0x104599=_0x133225[_0x5027cc(0x130)]('name');if(!isValidBffFunctionName(_0x104599))throw CliErrors['validation'](_0x5027cc(0x154)+_0x104599+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x305fda){const _0x43f21c=a36_0x4719a2,_0x283e05=loadBffProjectConfig(_0x305fda[_0x43f21c(0x16b)]),_0x49731e=_0x305fda[_0x43f21c(0x130)](_0x43f21c(0x169)),_0x2a02cf=_0x305fda[_0x43f21c(0x130)]('name'),_0x11ea4d=_0x305fda['str']('description')||undefined,_0x48ee8f=_0x49731e===_0x43f21c(0x175)?await resolveHookOptions(_0x283e05,_0x305fda):undefined,_0x134504=buildFilePath(_0x283e05,_0x49731e,_0x2a02cf,_0x48ee8f);if(await fileExists(_0x134504))throw CliErrors[_0x43f21c(0x179)](_0x43f21c(0x15a)+_0x134504);await mkdir(dirname(_0x134504),{'recursive':!![]});const _0x274240=generateTemplate(_0x49731e,_0x2a02cf,_0x305fda[_0x43f21c(0x16b)],_0x11ea4d,_0x48ee8f);await writeFile(_0x134504,_0x274240,_0x43f21c(0x13c));const _0x3ef679={'type':_0x49731e,'name':_0x2a02cf,'path':_0x134504};if(_0x11ea4d)_0x3ef679[_0x43f21c(0x178)]=_0x11ea4d;if(_0x48ee8f){if(_0x48ee8f['alias'])_0x3ef679[_0x43f21c(0x157)]=_0x48ee8f[_0x43f21c(0x157)];_0x3ef679[_0x43f21c(0x137)]=_0x48ee8f[_0x43f21c(0x137)],_0x3ef679['operationType']=_0x48ee8f[_0x43f21c(0x17f)],_0x3ef679[_0x43f21c(0x140)]=_0x48ee8f[_0x43f21c(0x140)];}return{'ok':!![],'data':_0x3ef679,'message':'Created\x20'+_0x49731e+_0x43f21c(0x16d)+_0x2a02cf};}};async function resolveHookOptions(_0x1a951c,_0x568343){const _0xe81234=a36_0x4719a2,_0x168d7e=resolveApiModelSource(_0x568343['apiDir'],_0x568343[_0xe81234(0x16b)],_0x568343[_0xe81234(0x15e)]||_0x568343['mergedCli']?.['currentApp']||_0x568343[_0xe81234(0x129)]?.[_0xe81234(0x183)]),_0x22a54b=loadAliasMap(_0x568343['apiDir'],undefined,_0x168d7e[_0xe81234(0x17a)],_0x168d7e[_0xe81234(0x172)]),_0x5c4fff=_0x22a54b['length']>0x0;let _0x1191b6,_0x538e48,_0x407cd8;const _0x52fe52=_0x568343[_0xe81234(0x130)]('alias'),_0x1b9f77=_0x568343[_0xe81234(0x130)](_0xe81234(0x132));if(_0x52fe52){const _0x33e2f0=resolveAlias(_0x568343[_0xe81234(0x12d)],_0x52fe52,undefined,_0x168d7e[_0xe81234(0x17a)],_0x168d7e[_0xe81234(0x172)]);if(!_0x33e2f0){const _0x5e6783=_0x5c4fff?_0xe81234(0x141)+_0x22a54b[_0xe81234(0x176)](_0x4f2da2=>_0x4f2da2[_0xe81234(0x157)])['join'](',\x20'):_0xe81234(0x15b)+CLI_BIN_NAME+_0xe81234(0x131);throw CliErrors[_0xe81234(0x179)]('Alias\x20\x22'+_0x52fe52+_0xe81234(0x17d)+_0x5e6783);}_0x1191b6=_0x52fe52,_0x538e48=_0x33e2f0;}else{if(_0x1b9f77){_0x538e48=_0x1b9f77;const _0x31a300=_0x22a54b['find'](_0x28338a=>_0x28338a[_0xe81234(0x137)]===_0x1b9f77);_0x1191b6=_0x31a300?.[_0xe81234(0x157)];}else{if(_0x568343[_0xe81234(0x12e)])throw CliErrors[_0xe81234(0x179)](_0xe81234(0x153));else{if(_0x5c4fff){const _0x149083=_0x22a54b[_0xe81234(0x176)](_0x3cc6eb=>_0x3cc6eb['alias']+'\x20('+_0x3cc6eb[_0xe81234(0x142)]+')'),_0x3b9b99=await promptSelect(_0xe81234(0x193),_0x149083),_0x51669d=_0x22a54b[_0x3b9b99];if(!_0x51669d)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x14b));_0x1191b6=_0x51669d['alias'],_0x538e48=_0x51669d['datasetCode'];}else{const _0x713b8=await listDatasets(_0x568343[_0xe81234(0x16b)]);if(_0x713b8[_0xe81234(0x192)]===0x0)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x189));const _0x31b30b=_0x713b8['map'](_0x3a78d3=>_0x3a78d3['name']+'\x20['+(_0x3a78d3[_0xe81234(0x145)]??_0xe81234(0x165))+_0xe81234(0x164)+_0x3a78d3[_0xe81234(0x166)]+')'),_0x46b0a3=await promptSelect(_0xe81234(0x193),_0x31b30b),_0x2a2011=_0x713b8[_0x46b0a3];if(!_0x2a2011)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x14b));_0x538e48=_0x2a2011['code'],_0x1191b6=undefined;}}}}const _0x35fa51=await listDatasets(_0x568343[_0xe81234(0x16b)]),_0x2ad824=_0x35fa51[_0xe81234(0x149)](_0x463e6e=>_0x463e6e['code']===_0x538e48);if(!_0x2ad824)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x14a)+_0x538e48+_0xe81234(0x143)+(_0x1191b6?_0xe81234(0x16c)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x407cd8=_0x2ad824['id'];const _0xe4f127=_0x1191b6??_0x538e48,_0xd00f03=await listBffDatasetOperations(_0x568343['appCode'],_0x407cd8),_0x52f16d=_0xd00f03?Object[_0xe81234(0x18f)](_0xd00f03):[];if(_0x52f16d[_0xe81234(0x192)]===0x0)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x156)+_0xe4f127+'.');let _0x5e2a11;const _0x252219=_0x568343[_0xe81234(0x130)](_0xe81234(0x196));if(_0x252219){if(!_0x52f16d[_0xe81234(0x12c)](_0x252219))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x252219+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0xe4f127+'.\x20'+(_0xe81234(0x181)+_0x52f16d[_0xe81234(0x182)](',\x20')));_0x5e2a11=_0x252219;}else{if(_0x568343[_0xe81234(0x12e)])throw CliErrors['validation']('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x1aad25=await promptSelect(_0xe81234(0x13a),_0x52f16d);_0x5e2a11=_0x52f16d[_0x1aad25]??_0x52f16d[0x0];}let _0x44aef8=normalizeHookFunctionNode(_0x568343[_0xe81234(0x130)]('function-node'));if(!_0x44aef8){if(_0x568343[_0xe81234(0x130)](_0xe81234(0x17c)))throw CliErrors[_0xe81234(0x179)](_0xe81234(0x135));if(_0x568343[_0xe81234(0x12e)])throw CliErrors[_0xe81234(0x179)](_0xe81234(0x170));const _0x2dabd8=await promptSelect(_0xe81234(0x18b),[_0xe81234(0x146),_0xe81234(0x14d)]);_0x44aef8=[_0xe81234(0x146),_0xe81234(0x14d)][_0x2dabd8]??_0xe81234(0x146);}return{'alias':_0x1191b6,'datasetCode':_0x538e48,'datasetId':_0x407cd8,'operationType':_0x5e2a11,'functionNode':_0x44aef8};}async function promptSelect(_0x5ef2e3,_0x26d90f){const _0x5967c8=a36_0x4719a2;if(_0x26d90f[_0x5967c8(0x192)]===0x1)return 0x0;for(const [_0x3f3c68,_0x4e57f3]of _0x26d90f[_0x5967c8(0x167)]()){process[_0x5967c8(0x12f)][_0x5967c8(0x191)]('\x20\x20'+(_0x3f3c68+0x1)+'.\x20'+_0x4e57f3+'\x0a');}const _0x2ff64b=createInterface({'input':process['stdin'],'output':process[_0x5967c8(0x12f)]});while(!![]){const _0x7e9066=await new Promise(_0x3f089b=>{const _0x50aacb=_0x5967c8;_0x2ff64b[_0x50aacb(0x158)](_0x5ef2e3+'\x20',_0x3f089b);}),_0x20c122=Number[_0x5967c8(0x15d)](_0x7e9066[_0x5967c8(0x18a)](),0xa);if(Number[_0x5967c8(0x160)](_0x20c122)&&_0x20c122>=0x1&&_0x20c122<=_0x26d90f[_0x5967c8(0x192)])return _0x2ff64b['close'](),_0x20c122-0x1;process['stderr'][_0x5967c8(0x191)](_0x5967c8(0x128)+_0x26d90f['length']+'.\x0a');}}function buildFilePath(_0x358b31,_0xe97b74,_0x12bbca,_0x509d61){const _0x434761=a36_0x4719a2;if(_0xe97b74===_0x434761(0x175)){if(!_0x509d61)throw CliErrors[_0x434761(0x179)](_0x434761(0x188));const _0x16def3=_0x509d61['alias']??_0x509d61['datasetCode'];return join(_0x358b31['scriptsRootDir'],_0x434761(0x175),_0x16def3,_0x509d61[_0x434761(0x17f)],_0x509d61['functionNode'],_0x12bbca+_0x434761(0x14c));}return join(_0x358b31[_0x434761(0x190)],_0xe97b74,_0x12bbca+_0x434761(0x14c));}export function generateTemplate(_0x32c5b4,_0x2e684f,_0x31def5,_0xd2b75e,_0x3b0ac1){const _0x130979=a36_0x4719a2,_0x64058f=_0xd2b75e?.[_0x130979(0x18a)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x33ff83=getAppBaseUrl(_0x31def5),_0x42b0eb=_0x130979(0x155);if(_0x32c5b4===_0x130979(0x17e))return _0x130979(0x12b)+_0x64058f+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x2e684f+_0x130979(0x152)+_0x33ff83+_0x130979(0x173)+_0x31def5+_0x130979(0x18c)+_0x2e684f+_0x130979(0x138)+_0x2e684f+_0x130979(0x16e)+_0x42b0eb+'\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'+_0x2e684f+_0x130979(0x168);if(_0x32c5b4===_0x130979(0x185))return _0x130979(0x12b)+_0x64058f+_0x130979(0x13b)+_0x2e684f+_0x130979(0x144)+_0x31def5+'/'+_0x2e684f+_0x130979(0x152)+_0x33ff83+_0x130979(0x173)+_0x31def5+'/ENDPOINT/'+_0x2e684f+_0x130979(0x177)+_0x42b0eb+_0x130979(0x162)+_0x2e684f+_0x130979(0x168);if(!_0x3b0ac1)throw CliErrors[_0x130979(0x179)](_0x130979(0x194));const _0x443241=_0x3b0ac1['alias']??_0x3b0ac1['datasetCode'],_0x3e25b3=_0x3b0ac1[_0x130979(0x140)]===_0x130979(0x146)?_0x130979(0x16a):_0x130979(0x195),_0x58f4ef=_0x3b0ac1[_0x130979(0x140)]==='before'?_0x130979(0x13d):_0x130979(0x161);return _0x130979(0x12b)+_0x64058f+_0x130979(0x139)+_0x2e684f+_0x130979(0x15c)+_0x31def5+'/'+_0x3b0ac1[_0x130979(0x137)]+'/'+_0x3b0ac1['operationType']+_0x130979(0x152)+_0x33ff83+_0x130979(0x14e)+_0x3b0ac1['datasetId']+_0x130979(0x133)+_0x31def5+_0x130979(0x18e)+_0x443241+'/'+_0x3b0ac1[_0x130979(0x17f)]+'/'+_0x3b0ac1[_0x130979(0x140)]+'/'+_0x2e684f+_0x130979(0x151)+_0x3b0ac1[_0x130979(0x140)]+'\x0a'+_0x42b0eb+_0x130979(0x187)+_0x3e25b3+_0x130979(0x186)+_0x58f4ef+_0x130979(0x13e)+_0x2e684f+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
|
1
|
+
const a37_0x15ca3c=a37_0x3926;(function(_0x4cab90,_0x4904e8){const _0x1462c1=a37_0x3926,_0x45138f=_0x4cab90();while(!![]){try{const _0x3370cb=parseInt(_0x1462c1(0x140))/0x1+-parseInt(_0x1462c1(0x125))/0x2*(-parseInt(_0x1462c1(0x16b))/0x3)+parseInt(_0x1462c1(0x129))/0x4*(parseInt(_0x1462c1(0x16d))/0x5)+-parseInt(_0x1462c1(0x12e))/0x6*(parseInt(_0x1462c1(0x15f))/0x7)+parseInt(_0x1462c1(0x149))/0x8+-parseInt(_0x1462c1(0x13f))/0x9*(parseInt(_0x1462c1(0x14b))/0xa)+-parseInt(_0x1462c1(0x141))/0xb;if(_0x3370cb===_0x4904e8)break;else _0x45138f['push'](_0x45138f['shift']());}catch(_0x344ecc){_0x45138f['push'](_0x45138f['shift']());}}}(a37_0x3449,0x3eb3f));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_0x3926(_0x563e3c,_0x2085ec){_0x563e3c=_0x563e3c-0x124;const _0x34491d=a37_0x3449();let _0x3926c6=_0x34491d[_0x563e3c];return _0x3926c6;}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_0x3449(){const _0xc572b6=['The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','str','.js','function-node','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','length','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','operation-type','\x0a\x20*\x20[平台配置]\x20','datasetId','/**\x0a\x20*\x20','修改后的请求参数','name','appCode','mergedCli','UNKNOWN','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Operation\x20type\x20\x22','966fSxRCq','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Select\x20dataset:','No\x20model\x20aliases\x20found.\x20Run\x20`','Invalid\x20dataset\x20selection.','\x20api\x20pull`\x20to\x20refresh.','Available\x20aliases:\x20','alias','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','stderr','keys','1149QDrman','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','5WIvPHT','/ENDPOINT/','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','after','profileName','bff','Script\x20description','Created\x20','Available:\x20','selectedAppName','functionNode','\x22.\x20','stdin','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','apiDir','当前响应结果','datasetCode','\x20function:\x20','includes','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','write','Alias\x20\x22','map','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','defaultApp','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','/data/dataset/','currentApp','close','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','description','No\x20datasets\x20found\x20for\x20this\x20app.','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','operationType','find','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','Trigger\x20node\x20(HOOK\x20only)','Invalid\x20function\x20name\x20\x22','\x22\x20not\x20found\x20for\x20dataset\x20','1708NIejJQ','join','question','HOOK','1312788lIGQxK','filePath','utf8','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','/HOOK/','7746zKLFlN','type','parseInt','string','Operation\x20type\x20(HOOK\x20only)','nonInteractive','Select\x20operation\x20type:','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','File\x20already\x20exists:\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','.js\x0a\x20*\x20[触发节点]\x20','source','validation','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','1098yieEYT','459486sHTESN','8883226JHbqEJ','No\x20operation\x20types\x20found\x20for\x20dataset\x20','COMMON','before','HOOK\x20requires\x20alias/operation/node\x20options.','修改后的响应结果','code','tableName','3532592tpBqTQ','\x22,\x20params\x20})\x0a','25720YWkuHW','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'];a37_0x3449=function(){return _0xc572b6;};return a37_0x3449();}export const bffCreate={'service':a37_0x15ca3c(0x172),'command':'create','description':a37_0x15ca3c(0x13e),'risk':'read','flags':[{'name':a37_0x15ca3c(0x12f),'type':'string','required':!![],'enum':['COMMON','ENDPOINT','HOOK'],'description':'Script\x20type'},{'name':a37_0x15ca3c(0x159),'type':'string','required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x15ca3c(0x18b),'type':'string','description':a37_0x15ca3c(0x173)},{'name':'alias','type':'string','description':a37_0x15ca3c(0x137)},{'name':'datasetcode','type':a37_0x15ca3c(0x131),'description':a37_0x15ca3c(0x190)},{'name':a37_0x15ca3c(0x154),'type':'string','description':a37_0x15ca3c(0x132)},{'name':a37_0x15ca3c(0x150),'type':a37_0x15ca3c(0x131),'description':a37_0x15ca3c(0x192),'enum':[a37_0x15ca3c(0x144),a37_0x15ca3c(0x170)]}],async 'validate'(_0x13bb7e){const _0x40c8e3=a37_0x15ca3c,_0x130687=_0x13bb7e[_0x40c8e3(0x14e)](_0x40c8e3(0x159));if(!isValidBffFunctionName(_0x130687))throw CliErrors[_0x40c8e3(0x13d)](_0x40c8e3(0x193)+_0x130687+_0x40c8e3(0x186));},async 'execute'(_0x54f3b0){const _0x290424=a37_0x15ca3c,_0x4016c9=loadBffProjectConfig(_0x54f3b0[_0x290424(0x15a)]),_0x3fed4b=_0x54f3b0[_0x290424(0x14e)](_0x290424(0x12f)),_0x1f3470=_0x54f3b0[_0x290424(0x14e)](_0x290424(0x159)),_0x5384d9=_0x54f3b0['str']('description')||undefined,_0x1f63e7=_0x3fed4b===_0x290424(0x128)?await resolveHookOptions(_0x4016c9,_0x54f3b0):undefined,_0x53d5dc=buildFilePath(_0x4016c9,_0x3fed4b,_0x1f3470,_0x1f63e7);if(await fileExists(_0x53d5dc))throw CliErrors['validation'](_0x290424(0x136)+_0x53d5dc);await mkdir(dirname(_0x53d5dc),{'recursive':!![]});const _0x1a879e=generateTemplate(_0x3fed4b,_0x1f3470,_0x54f3b0[_0x290424(0x15a)],_0x5384d9,_0x1f63e7);await writeFile(_0x53d5dc,_0x1a879e,_0x290424(0x12b));const _0x3d996a={'type':_0x3fed4b,'name':_0x1f3470,'path':_0x53d5dc};if(_0x5384d9)_0x3d996a[_0x290424(0x18b)]=_0x5384d9;if(_0x1f63e7){if(_0x1f63e7[_0x290424(0x167)])_0x3d996a['alias']=_0x1f63e7[_0x290424(0x167)];_0x3d996a['datasetCode']=_0x1f63e7[_0x290424(0x17d)],_0x3d996a[_0x290424(0x18e)]=_0x1f63e7[_0x290424(0x18e)],_0x3d996a['functionNode']=_0x1f63e7['functionNode'];}return{'ok':!![],'data':_0x3d996a,'message':_0x290424(0x174)+_0x3fed4b+_0x290424(0x17e)+_0x1f3470};}};async function resolveHookOptions(_0x336ca8,_0x2c1631){const _0x58320c=a37_0x15ca3c,_0x42ee99=resolveApiModelSource(_0x2c1631[_0x58320c(0x17b)],_0x2c1631[_0x58320c(0x15a)],_0x2c1631[_0x58320c(0x176)]||_0x2c1631[_0x58320c(0x15b)]?.[_0x58320c(0x188)]||_0x2c1631['mergedCli']?.[_0x58320c(0x185)]),_0x2f306a=loadAliasMap(_0x2c1631[_0x58320c(0x17b)],undefined,_0x42ee99[_0x58320c(0x12a)],_0x42ee99[_0x58320c(0x171)]),_0x33d8e7=_0x2f306a[_0x58320c(0x152)]>0x0;let _0x166e0d,_0x197d0f,_0x7b1093;const _0x1cc175=_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x167)),_0x19c5c9=_0x2c1631[_0x58320c(0x14e)]('datasetcode');if(_0x1cc175){const _0x25fe51=resolveAlias(_0x2c1631[_0x58320c(0x17b)],_0x1cc175,undefined,_0x42ee99[_0x58320c(0x12a)],_0x42ee99[_0x58320c(0x171)]);if(!_0x25fe51){const _0x7049b6=_0x33d8e7?_0x58320c(0x166)+_0x2f306a[_0x58320c(0x183)](_0x307ee5=>_0x307ee5[_0x58320c(0x167)])[_0x58320c(0x126)](',\x20'):_0x58320c(0x163)+CLI_BIN_NAME+_0x58320c(0x12c);throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x182)+_0x1cc175+'\x22\x20not\x20found.\x20'+_0x7049b6);}_0x166e0d=_0x1cc175,_0x197d0f=_0x25fe51;}else{if(_0x19c5c9){_0x197d0f=_0x19c5c9;const _0x5bb408=_0x2f306a[_0x58320c(0x18f)](_0x9227bc=>_0x9227bc['datasetCode']===_0x19c5c9);_0x166e0d=_0x5bb408?.[_0x58320c(0x167)];}else{if(_0x2c1631[_0x58320c(0x133)])throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x15d));else{if(_0x33d8e7){const _0x2f4f46=_0x2f306a['map'](_0xcfcec9=>_0xcfcec9[_0x58320c(0x167)]+'\x20('+_0xcfcec9[_0x58320c(0x148)]+')'),_0x20c49f=await promptSelect(_0x58320c(0x162),_0x2f4f46),_0x116e23=_0x2f306a[_0x20c49f];if(!_0x116e23)throw CliErrors['validation'](_0x58320c(0x164));_0x166e0d=_0x116e23['alias'],_0x197d0f=_0x116e23[_0x58320c(0x17d)];}else{const _0x22baf9=await listDatasets(_0x2c1631[_0x58320c(0x15a)]);if(_0x22baf9[_0x58320c(0x152)]===0x0)throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x18c));const _0x417e0f=_0x22baf9[_0x58320c(0x183)](_0x14049c=>_0x14049c[_0x58320c(0x159)]+'\x20['+(_0x14049c[_0x58320c(0x13c)]??_0x58320c(0x15c))+']\x20('+_0x14049c['code']+')'),_0x26eff=await promptSelect(_0x58320c(0x162),_0x417e0f),_0x2ca2b2=_0x22baf9[_0x26eff];if(!_0x2ca2b2)throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x164));_0x197d0f=_0x2ca2b2[_0x58320c(0x147)],_0x166e0d=undefined;}}}}const _0x59cb01=await listDatasets(_0x2c1631[_0x58320c(0x15a)]),_0x4bbaef=_0x59cb01[_0x58320c(0x18f)](_0x41a037=>_0x41a037[_0x58320c(0x147)]===_0x197d0f);if(!_0x4bbaef)throw CliErrors[_0x58320c(0x13d)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x197d0f+_0x58320c(0x178)+(_0x166e0d?_0x58320c(0x14d)+CLI_BIN_NAME+_0x58320c(0x165):''));_0x7b1093=_0x4bbaef['id'];const _0x4b4f06=_0x166e0d??_0x197d0f,_0x240f34=await listBffDatasetOperations(_0x2c1631['appCode'],_0x7b1093),_0x194dbc=_0x240f34?Object[_0x58320c(0x16a)](_0x240f34):[];if(_0x194dbc[_0x58320c(0x152)]===0x0)throw CliErrors['validation'](_0x58320c(0x142)+_0x4b4f06+'.');let _0x56a4f5;const _0x2dda50=_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x154));if(_0x2dda50){if(!_0x194dbc[_0x58320c(0x17f)](_0x2dda50))throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x15e)+_0x2dda50+_0x58320c(0x124)+_0x4b4f06+'.\x20'+(_0x58320c(0x175)+_0x194dbc[_0x58320c(0x126)](',\x20')));_0x56a4f5=_0x2dda50;}else{if(_0x2c1631[_0x58320c(0x133)])throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x161));const _0x17d752=await promptSelect(_0x58320c(0x134),_0x194dbc);_0x56a4f5=_0x194dbc[_0x17d752]??_0x194dbc[0x0];}let _0x482a91=normalizeHookFunctionNode(_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x150)));if(!_0x482a91){if(_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x150)))throw CliErrors[_0x58320c(0x13d)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x2c1631[_0x58320c(0x133)])throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x160));const _0x1fc618=await promptSelect('Select\x20trigger\x20node:',[_0x58320c(0x144),_0x58320c(0x170)]);_0x482a91=[_0x58320c(0x144),_0x58320c(0x170)][_0x1fc618]??_0x58320c(0x144);}return{'alias':_0x166e0d,'datasetCode':_0x197d0f,'datasetId':_0x7b1093,'operationType':_0x56a4f5,'functionNode':_0x482a91};}async function promptSelect(_0x5b43d7,_0x25f293){const _0x122bab=a37_0x15ca3c;if(_0x25f293[_0x122bab(0x152)]===0x1)return 0x0;for(const [_0x5bf726,_0xdff51f]of _0x25f293['entries']()){process[_0x122bab(0x169)][_0x122bab(0x181)]('\x20\x20'+(_0x5bf726+0x1)+'.\x20'+_0xdff51f+'\x0a');}const _0x537669=createInterface({'input':process[_0x122bab(0x179)],'output':process[_0x122bab(0x169)]});while(!![]){const _0x2397d6=await new Promise(_0x10e5b7=>{const _0x3de219=_0x122bab;_0x537669[_0x3de219(0x127)](_0x5b43d7+'\x20',_0x10e5b7);}),_0x41d090=Number[_0x122bab(0x130)](_0x2397d6['trim'](),0xa);if(Number['isInteger'](_0x41d090)&&_0x41d090>=0x1&&_0x41d090<=_0x25f293[_0x122bab(0x152)])return _0x537669[_0x122bab(0x189)](),_0x41d090-0x1;process[_0x122bab(0x169)][_0x122bab(0x181)](_0x122bab(0x16c)+_0x25f293[_0x122bab(0x152)]+'.\x0a');}}function buildFilePath(_0x323740,_0x3b7e98,_0x12d7e8,_0xe3d581){const _0x19fa5f=a37_0x15ca3c;if(_0x3b7e98===_0x19fa5f(0x128)){if(!_0xe3d581)throw CliErrors[_0x19fa5f(0x13d)](_0x19fa5f(0x145));const _0x22662d=_0xe3d581[_0x19fa5f(0x167)]??_0xe3d581[_0x19fa5f(0x17d)];return join(_0x323740['scriptsRootDir'],'HOOK',_0x22662d,_0xe3d581[_0x19fa5f(0x18e)],_0xe3d581['functionNode'],_0x12d7e8+'.js');}return join(_0x323740['scriptsRootDir'],_0x3b7e98,_0x12d7e8+_0x19fa5f(0x14f));}export function generateTemplate(_0x596781,_0x198233,_0x5d8ad7,_0x55d2ed,_0x1bf064){const _0x79960b=a37_0x15ca3c,_0x369aea=_0x55d2ed?.['trim']()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x178bf8=getAppBaseUrl(_0x5d8ad7),_0x2f1565=_0x79960b(0x17a);if(_0x596781===_0x79960b(0x143))return _0x79960b(0x157)+_0x369aea+_0x79960b(0x138)+_0x198233+_0x79960b(0x155)+_0x178bf8+_0x79960b(0x14c)+_0x5d8ad7+'/COMMON/'+_0x198233+_0x79960b(0x18d)+_0x198233+_0x79960b(0x14a)+_0x2f1565+_0x79960b(0x139)+_0x198233+_0x79960b(0x151);if(_0x596781==='ENDPOINT')return _0x79960b(0x157)+_0x369aea+_0x79960b(0x13a)+_0x198233+_0x79960b(0x191)+_0x5d8ad7+'/'+_0x198233+'\x0a\x20*\x20[平台配置]\x20'+_0x178bf8+_0x79960b(0x14c)+_0x5d8ad7+_0x79960b(0x16e)+_0x198233+'.js\x0a'+_0x2f1565+'\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'+_0x198233+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x1bf064)throw CliErrors[_0x79960b(0x13d)](_0x79960b(0x180));const _0x22801b=_0x1bf064[_0x79960b(0x167)]??_0x1bf064[_0x79960b(0x17d)],_0x1a77c9=_0x1bf064[_0x79960b(0x177)]===_0x79960b(0x144)?'当前请求参数':_0x79960b(0x17c),_0x935d6d=_0x1bf064['functionNode']===_0x79960b(0x144)?_0x79960b(0x158):_0x79960b(0x146);return _0x79960b(0x157)+_0x369aea+_0x79960b(0x135)+_0x198233+_0x79960b(0x18a)+_0x5d8ad7+'/'+_0x1bf064[_0x79960b(0x17d)]+'/'+_0x1bf064['operationType']+_0x79960b(0x155)+_0x178bf8+_0x79960b(0x187)+_0x1bf064[_0x79960b(0x156)]+_0x79960b(0x168)+_0x5d8ad7+_0x79960b(0x12d)+_0x22801b+'/'+_0x1bf064[_0x79960b(0x18e)]+'/'+_0x1bf064[_0x79960b(0x177)]+'/'+_0x198233+_0x79960b(0x13b)+_0x1bf064[_0x79960b(0x177)]+'\x0a'+_0x2f1565+_0x79960b(0x184)+_0x1a77c9+_0x79960b(0x153)+_0x935d6d+_0x79960b(0x16f)+_0x198233+_0x79960b(0x151);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a38_0x1822f4=a38_0x5c2d;(function(_0x3906c3,_0x34927d){const _0x48a8fb=a38_0x5c2d,_0x45a0ce=_0x3906c3();while(!![]){try{const _0x2c8b29=-parseInt(_0x48a8fb(0x100))/0x1+parseInt(_0x48a8fb(0xf9))/0x2+parseInt(_0x48a8fb(0xfb))/0x3*(parseInt(_0x48a8fb(0xf8))/0x4)+parseInt(_0x48a8fb(0x128))/0x5+parseInt(_0x48a8fb(0x11b))/0x6+parseInt(_0x48a8fb(0x11e))/0x7+-parseInt(_0x48a8fb(0x111))/0x8*(parseInt(_0x48a8fb(0x109))/0x9);if(_0x2c8b29===_0x34927d)break;else _0x45a0ce['push'](_0x45a0ce['shift']());}catch(_0x32774d){_0x45a0ce['push'](_0x45a0ce['shift']());}}}(a38_0x3571,0x387e3));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';function a38_0x5c2d(_0x4c0681,_0x40a763){_0x4c0681=_0x4c0681-0xf7;const _0x35712e=a38_0x3571();let _0x5c2d10=_0x35712e[_0x4c0681];return _0x5c2d10;}import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';function a38_0x3571(){const _0xb59073=['126371OsXuCq','parse','\x22\x20not\x20found\x20after\x20ensureLockScope.','filter','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','bff','\x20(local\x20file\x20moved\x20to\x20trash)','high-risk-write','scriptsRootDir','functions','1686450vQQUgO','/api/management/library/scripts/delete','Lock\x20scope\x20for\x20app\x20\x22','17800wcijpq','254290KoYvXb','validation','9sVNfLZ','toISOString','length','trashDir','remoteId','222329vYXBMA','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','\x20\x20-\x20','Multiple\x20functions\x20match\x20\x22','appCode','find','map','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','join','279DQNgcL','keys','No\x20lock\x20entry\x20found\x20for\x20\x22','Local\x20delete\x20not\x20settled\x20for\x20','scriptsRoot','lastSync','Function\x20not\x20found:\x20','Would\x20delete\x20','120448RHEeFJ','apps','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','str','lockFilePath','target','projectRoot','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','delete','replace','2547732apZKCF','startsWith','includes'];a38_0x3571=function(){return _0xb59073;};return a38_0x3571();}import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x1822f4(0x123),'command':a38_0x1822f4(0x119),'description':a38_0x1822f4(0x118),'risk':a38_0x1822f4(0x125),'flags':[{'name':a38_0x1822f4(0x116),'type':'string','required':!![],'description':a38_0x1822f4(0x122)}],async 'validate'(_0x1ff08c){const _0x2bd4db=a38_0x1822f4,_0x389f1d=loadBffProjectConfig(_0x1ff08c[_0x2bd4db(0x104)]),_0x8681ee=await readBffLockFile(_0x389f1d[_0x2bd4db(0x115)]);if(!_0x8681ee)throw CliErrors[_0x2bd4db(0xfa)](_0x2bd4db(0x107));},async 'dryRun'(_0x2a3b43){const _0x41ec89=a38_0x1822f4,_0x2acfa2=loadBffProjectConfig(_0x2a3b43['appCode']),_0x549dcb=await readBffLockFile(_0x2acfa2['lockFilePath']);if(!_0x549dcb)throw CliErrors[_0x41ec89(0xfa)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {appLock:_0x51cd5b}=ensureLockScope(_0x549dcb,_0x2a3b43[_0x41ec89(0x104)],_0x2acfa2[_0x41ec89(0x10d)],_0x41ec89(0x119)),_0x4dd9d1=_0x2a3b43[_0x41ec89(0x114)](_0x41ec89(0x116)),_0x27fb84=Object[_0x41ec89(0x10a)](_0x51cd5b[_0x41ec89(0x127)]),_0x24e6d8=resolveDeleteTarget(_0x4dd9d1,_0x27fb84),_0x4eecec=_0x51cd5b[_0x41ec89(0x127)][_0x24e6d8];if(!_0x4eecec)throw CliErrors['validation']('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x24e6d8+'\x22.');const _0x85aecf=resolveLocalFilePathFromLockKey(_0x2acfa2,_0x24e6d8),_0x5d8d3a=relative(_0x2acfa2['projectRoot'],_0x85aecf),_0x59c38a=join(_0x2acfa2['trashDir'],'<timestamp>',_0x5d8d3a);return{'method':'POST','url':_0x41ec89(0x129),'body':{'appCode':_0x2a3b43[_0x41ec89(0x104)],'target':_0x24e6d8,'remoteId':_0x4eecec[_0x41ec89(0xff)],'localFilePath':_0x85aecf,'trashedPath':_0x59c38a},'description':_0x41ec89(0x110)+_0x24e6d8+_0x41ec89(0x113)};},async 'execute'(_0x2e11aa){const _0x18510b=a38_0x1822f4,_0x54431b=loadBffProjectConfig(_0x2e11aa['appCode']),_0xc48375=await readBffLockFile(_0x54431b[_0x18510b(0x115)]);if(!_0xc48375)throw CliErrors[_0x18510b(0xfa)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x383813,appLock:_0x435f31}=ensureLockScope(_0xc48375,_0x2e11aa['appCode'],_0x54431b[_0x18510b(0x10d)],_0x18510b(0x119)),_0x5eec68=JSON[_0x18510b(0x11f)](JSON['stringify'](_0x383813)),_0x1c0d8c=_0x5eec68[_0x18510b(0x112)][_0x2e11aa[_0x18510b(0x104)]];if(!_0x1c0d8c)throw new Error(_0x18510b(0xf7)+_0x2e11aa[_0x18510b(0x104)]+_0x18510b(0x120));const _0xc9fdd=_0x2e11aa[_0x18510b(0x114)](_0x18510b(0x116)),_0x18c4cb=Object['keys'](_0x1c0d8c['functions']),_0x5f2f40=resolveDeleteTarget(_0xc9fdd,_0x18c4cb),_0x35e685=_0x1c0d8c[_0x18510b(0x127)][_0x5f2f40];if(!_0x35e685)throw CliErrors[_0x18510b(0xfa)](_0x18510b(0x10b)+_0x5f2f40+'\x22.');await deleteBffScript(_0x35e685[_0x18510b(0xff)]),delete _0x1c0d8c[_0x18510b(0x127)][_0x5f2f40],_0x1c0d8c[_0x18510b(0x10e)]=new Date()['toISOString'](),await writeBffLockFile(_0x54431b[_0x18510b(0x115)],_0x5eec68);const _0x516801=resolveLocalFilePathFromLockKey(_0x54431b,_0x5f2f40);let _0x39909b;await fileExists(_0x516801)&&(_0x39909b=await moveToTrash(_0x54431b[_0x18510b(0x117)],_0x54431b[_0x18510b(0xfe)],_0x516801),await cleanupEmptyDirectories(dirname(_0x516801),_0x54431b[_0x18510b(0x126)]));await waitForDeleteSettlement(_0x54431b[_0x18510b(0x115)],_0x2e11aa[_0x18510b(0x104)],_0x5f2f40,_0x516801),await sleep(0x96);const _0x1433ff={'deleted':_0x5f2f40,'remoteId':_0x35e685[_0x18510b(0xff)]};if(_0x39909b)_0x1433ff['trashedTo']=_0x39909b;return{'ok':!![],'data':_0x1433ff,'message':'Deleted\x20'+_0x5f2f40+(_0x39909b?_0x18510b(0x124):'')};}};function resolveDeleteTarget(_0x194e81,_0x19ced8){const _0x1a6304=a38_0x1822f4;if(_0x194e81[_0x1a6304(0x11d)]('/')){const _0x122300=_0x19ced8[_0x1a6304(0x105)](_0x30d2b1=>_0x30d2b1===_0x194e81);if(!_0x122300)throw CliErrors[_0x1a6304(0xfa)](_0x1a6304(0x10f)+_0x194e81);return _0x122300;}const _0x581d2e=_0x19ced8[_0x1a6304(0x121)](_0x122ce3=>_0x122ce3['split']('/')['at'](-0x1)===_0x194e81);if(_0x581d2e[_0x1a6304(0xfd)]===0x0)throw CliErrors[_0x1a6304(0xfa)]('Function\x20not\x20found:\x20'+_0x194e81);if(_0x581d2e[_0x1a6304(0xfd)]>0x1)throw CliErrors[_0x1a6304(0xfa)](_0x1a6304(0x103)+_0x194e81+_0x1a6304(0x101)+_0x581d2e[_0x1a6304(0x106)](_0xe969e5=>_0x1a6304(0x102)+_0xe969e5)[_0x1a6304(0x108)]('\x0a'));return _0x581d2e[0x0];}async function moveToTrash(_0x251cca,_0x576092,_0x298543){const _0x5edd3e=a38_0x1822f4,_0x4060a4=new Date()[_0x5edd3e(0xfc)]()[_0x5edd3e(0x11a)](/[:.]/g,'-'),_0xc6aa8b=relative(_0x251cca,_0x298543),_0xd402fc=join(_0x576092,_0x4060a4,_0xc6aa8b);return await mkdir(dirname(_0xd402fc),{'recursive':!![]}),await rename(_0x298543,_0xd402fc),_0xd402fc;}async function cleanupEmptyDirectories(_0x4c8af3,_0x1850b5){const _0x34ab89=a38_0x1822f4;let _0x38a503=resolve(_0x4c8af3);const _0x5c9dc5=resolve(_0x1850b5);while(_0x38a503[_0x34ab89(0x11c)](''+_0x5c9dc5+sep)||_0x38a503===_0x5c9dc5){if(_0x38a503===_0x5c9dc5)return;try{const _0x49b0d8=await readdir(_0x38a503);if(_0x49b0d8[_0x34ab89(0xfd)]>0x0)return;await rmdir(_0x38a503);}catch{return;}_0x38a503=dirname(_0x38a503);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x53b0b6,_0x1ce89,_0x6f5dfe,_0x4f1489){const _0x4bfede=a38_0x1822f4;for(let _0x23d38d=0x0;_0x23d38d<DELETE_SETTLE_RETRY_COUNT;_0x23d38d+=0x1){const _0x5bc801=await readBffLockFile(_0x53b0b6),_0x572a11=!!_0x5bc801?.[_0x4bfede(0x112)]?.[_0x1ce89]?.['functions']?.[_0x6f5dfe],_0x4eb8b2=await fileExists(_0x4f1489);if(!_0x572a11&&!_0x4eb8b2)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x4bfede(0x10c)+_0x6f5dfe+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x4b53cb=a39_0x5bb0;(function(_0x1331b8,_0x4ff3a1){const _0x4ae560=a39_0x5bb0,_0x4d5f4c=_0x1331b8();while(!![]){try{const _0x3f43d9=-parseInt(_0x4ae560(0xba))/0x1+parseInt(_0x4ae560(0xc2))/0x2*(parseInt(_0x4ae560(0xb7))/0x3)+parseInt(_0x4ae560(0xb8))/0x4*(-parseInt(_0x4ae560(0xbe))/0x5)+-parseInt(_0x4ae560(0xc4))/0x6*(-parseInt(_0x4ae560(0xc0))/0x7)+parseInt(_0x4ae560(0xc7))/0x8*(parseInt(_0x4ae560(0xc9))/0x9)+parseInt(_0x4ae560(0xb4))/0xa*(-parseInt(_0x4ae560(0xbc))/0xb)+parseInt(_0x4ae560(0xc3))/0xc;if(_0x3f43d9===_0x4ff3a1)break;else _0x4d5f4c['push'](_0x4d5f4c['shift']());}catch(_0x28c644){_0x4d5f4c['push'](_0x4d5f4c['shift']());}}}(a39_0x26ae,0x93757));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x4b53cb(0xb9),'command':'detail','description':a39_0x4b53cb(0xc1),'risk':a39_0x4b53cb(0xca),'flags':[{'name':'id','type':a39_0x4b53cb(0xb6),'required':!![],'description':a39_0x4b53cb(0xbf)},{'name':'verbose','type':a39_0x4b53cb(0xbb),'description':a39_0x4b53cb(0xc8)}],async 'execute'(_0xec0e65){const _0x6ca2b=a39_0x4b53cb,_0x1a12a5=await getBffScriptInfo(_0xec0e65[_0x6ca2b(0xcd)]('id')),_0x5766c6=_0xec0e65[_0x6ca2b(0xbd)](_0x6ca2b(0xcc));if(_0x5766c6)return{'ok':!![],'data':_0x1a12a5};return{'ok':!![],'data':{'id':_0x1a12a5['id'],'functionName':_0x1a12a5['functionName']??'','version':_0x1a12a5[_0x6ca2b(0xce)]??'','updateUserName':_0x1a12a5[_0x6ca2b(0xb5)]??'','appCode':_0x1a12a5['appCode'],'scriptType':_0x1a12a5['scriptType'],'description':_0x1a12a5['description']||_0x6ca2b(0xc6),'createdTime':_0x1a12a5[_0x6ca2b(0xc5)]??'','updatedTime':_0x1a12a5[_0x6ca2b(0xcf)]??'','scriptContent':_0x1a12a5[_0x6ca2b(0xcb)]??''}};}};function a39_0x5bb0(_0x2d018b,_0x221b08){_0x2d018b=_0x2d018b-0xb4;const _0x26aece=a39_0x26ae();let _0x5bb06b=_0x26aece[_0x2d018b];return _0x5bb06b;}function a39_0x26ae(){const _0x519249=['9714qqVExG','createdTime','(none)','96wptOBd','Return\x20full\x20raw\x20script\x20object','15912KDMquR','read','scriptContent','verbose','num','version','updatedTime','30GALSFF','updateUserName','number','207150sFUyoj','1524536ziUrfL','bff','444655OdPhxF','boolean','97229veRfTC','bool','5RtXxaE','Script\x20ID','189MjWDai','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','18Mvnizd','9239016rTLHYH'];a39_0x26ae=function(){return _0x519249;};return a39_0x26ae();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xe0ba84,_0xc02361){const _0x1fa260=a40_0x376f,_0x40c6a8=_0xe0ba84();while(!![]){try{const _0x195121=parseInt(_0x1fa260(0x121))/0x1*(parseInt(_0x1fa260(0x123))/0x2)+parseInt(_0x1fa260(0x120))/0x3*(parseInt(_0x1fa260(0x11c))/0x4)+-parseInt(_0x1fa260(0x122))/0x5+-parseInt(_0x1fa260(0x11d))/0x6+-parseInt(_0x1fa260(0x124))/0x7+parseInt(_0x1fa260(0x11f))/0x8+parseInt(_0x1fa260(0x11e))/0x9;if(_0x195121===_0xc02361)break;else _0x40c6a8['push'](_0x40c6a8['shift']());}catch(_0xa25c7b){_0x40c6a8['push'](_0x40c6a8['shift']());}}}(a40_0x23c7,0xf2a0d));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';function a40_0x23c7(){const _0x2e021f=['1xTVIhw','6935950MJEBUO','402994mxEQGT','8673672baGdFu','4156OAWxaS','6969540Hwmlyq','10298169Ahuids','14213280dXPrcZ','4791chdmsp'];a40_0x23c7=function(){return _0x2e021f;};return a40_0x23c7();}import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';function a40_0x376f(_0x9bec83,_0x10504e){_0x9bec83=_0x9bec83-0x11c;const _0x23c7e1=a40_0x23c7();let _0x376f6e=_0x23c7e1[_0x9bec83];return _0x376f6e;}export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a41_0x1fd6(){const _0x446f57=['Script\x20type\x20filter','name','scriptType','map','type','boolean','appCode','24pXfzGG','590vDUyAK','4VveltI','4202752tuZGcd','functionName','list','7LhcpEQ','No\x20Backend\x20Function\x20scripts\x20found.','347695DmUaLd','read','25867pjLqkb','508852dJpHJX','449339joSIrs','description','COMMON','List\x20Backend\x20Function\x20scripts','verbose','string','689229xqOHqF','143406nlgUUZ','str'];a41_0x1fd6=function(){return _0x446f57;};return a41_0x1fd6();}function a41_0x2402(_0x56c2b9,_0x4380e6){_0x56c2b9=_0x56c2b9-0x79;const _0x1fd674=a41_0x1fd6();let _0x240286=_0x1fd674[_0x56c2b9];return _0x240286;}const a41_0x4ae00d=a41_0x2402;(function(_0x359e83,_0x187065){const _0x86a9eb=a41_0x2402,_0x15f877=_0x359e83();while(!![]){try{const _0x4b5a3a=parseInt(_0x86a9eb(0x84))/0x1*(-parseInt(_0x86a9eb(0x7c))/0x2)+parseInt(_0x86a9eb(0x8c))/0x3+parseInt(_0x86a9eb(0x85))/0x4+parseInt(_0x86a9eb(0x82))/0x5*(-parseInt(_0x86a9eb(0x7a))/0x6)+parseInt(_0x86a9eb(0x80))/0x7*(-parseInt(_0x86a9eb(0x7d))/0x8)+parseInt(_0x86a9eb(0x8d))/0x9*(parseInt(_0x86a9eb(0x7b))/0xa)+parseInt(_0x86a9eb(0x86))/0xb;if(_0x4b5a3a===_0x187065)break;else _0x15f877['push'](_0x15f877['shift']());}catch(_0x1829c7){_0x15f877['push'](_0x15f877['shift']());}}}(a41_0x1fd6,0x75d75));import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':'bff','command':a41_0x4ae00d(0x7f),'description':a41_0x4ae00d(0x89),'risk':a41_0x4ae00d(0x83),'flags':[{'name':a41_0x4ae00d(0x93),'type':a41_0x4ae00d(0x8b),'description':a41_0x4ae00d(0x8f),'default':'ENDPOINT','enum':['ENDPOINT',a41_0x4ae00d(0x88)]},{'name':a41_0x4ae00d(0x90),'type':a41_0x4ae00d(0x8b),'description':'Filter\x20by\x20script\x20name'},{'name':a41_0x4ae00d(0x8a),'type':a41_0x4ae00d(0x94),'description':'Return\x20full\x20script\x20objects'}],async 'execute'(_0x34f61b){const _0x2aeffa=a41_0x4ae00d,_0x464ce2=await listBffScripts(_0x34f61b[_0x2aeffa(0x79)],_0x34f61b['str']('type'),{'scriptName':_0x34f61b[_0x2aeffa(0x8e)](_0x2aeffa(0x90))||undefined}),_0xd80124=_0x34f61b['bool']('verbose');return{'ok':!![],'data':_0xd80124?_0x464ce2:_0x464ce2[_0x2aeffa(0x92)](_0x15c6ba=>({'id':_0x15c6ba['id'],'functionName':_0x15c6ba[_0x2aeffa(0x7e)]??'','description':_0x15c6ba[_0x2aeffa(0x87)]||'(unnamed)','scriptType':_0x15c6ba[_0x2aeffa(0x91)]})),'message':_0x464ce2['length']===0x0?_0x2aeffa(0x81):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a42_0x3449(_0x3599c9,_0x20b53f){_0x3599c9=_0x3599c9-0xfd;const _0x32247c=a42_0x3224();let _0x34498a=_0x32247c[_0x3599c9];return _0x34498a;}const a42_0x42c929=a42_0x3449;(function(_0x5e28d2,_0x4164e1){const _0x57eff8=a42_0x3449,_0x66efb1=_0x5e28d2();while(!![]){try{const _0x43ea5e=-parseInt(_0x57eff8(0x121))/0x1+-parseInt(_0x57eff8(0x110))/0x2+parseInt(_0x57eff8(0x100))/0x3+-parseInt(_0x57eff8(0xff))/0x4+-parseInt(_0x57eff8(0x115))/0x5*(parseInt(_0x57eff8(0x118))/0x6)+-parseInt(_0x57eff8(0x11f))/0x7+parseInt(_0x57eff8(0x11a))/0x8;if(_0x43ea5e===_0x4164e1)break;else _0x66efb1['push'](_0x66efb1['shift']());}catch(_0x79adbb){_0x66efb1['push'](_0x66efb1['shift']());}}}(a42_0x3224,0x92959));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x42c929(0x103),a42_0x42c929(0x123),a42_0x42c929(0x114),a42_0x42c929(0x101)];export function resolveBffLogQuery(_0x20da30,_0x5aba7f=Date['now']()){const _0x4090d7=a42_0x42c929,_0x191712=_0x20da30[_0x4090d7(0x12a)](_0x4090d7(0x11c)),_0x12be7b=_0x20da30['flag'](_0x4090d7(0x104)),_0x2dd871=_0x20da30[_0x4090d7(0x12a)](_0x4090d7(0x102));if(_0x191712!==undefined&&_0x12be7b!==undefined)throw CliErrors['validation'](_0x4090d7(0x129));const _0x569286=_0x2dd871===undefined?_0x5aba7f:readPositiveInteger(_0x20da30[_0x4090d7(0xfd)](_0x4090d7(0x102)),_0x4090d7(0x124)),_0x451e7b=_0x12be7b===undefined?_0x569286-readSinceMinutes(_0x20da30)*0xea60:readPositiveInteger(_0x20da30[_0x4090d7(0xfd)]('start-time'),_0x4090d7(0x11e));if(_0x451e7b<=0x0)throw CliErrors[_0x4090d7(0x112)]('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x451e7b>_0x569286)throw CliErrors[_0x4090d7(0x112)](_0x4090d7(0x109));const _0x1fc5bc=readPositiveInteger(_0x20da30[_0x4090d7(0xfd)]('limit',DEFAULT_LIMIT),_0x4090d7(0x11d));if(_0x1fc5bc>MAX_LIMIT)throw CliErrors[_0x4090d7(0x112)]('--limit\x20must\x20be\x20between\x201\x20and\x20'+MAX_LIMIT+'.');const _0x9b4e79=_0x20da30[_0x4090d7(0x10e)]('level')[_0x4090d7(0x108)]()[_0x4090d7(0x105)]()||undefined,_0x10c27f=_0x20da30[_0x4090d7(0x10e)](_0x4090d7(0x111))[_0x4090d7(0x108)]()||undefined;return{'appCode':_0x20da30[_0x4090d7(0x126)],'startTime':_0x451e7b,'endTime':_0x569286,..._0x12be7b===undefined?{'sinceMinutes':readSinceMinutes(_0x20da30)}:{},..._0x9b4e79?{'level':_0x9b4e79}:{},..._0x10c27f?{'keyword':_0x10c27f}:{},'limit':_0x1fc5bc};}function readSinceMinutes(_0x377d3a){const _0x395e63=a42_0x42c929;return readPositiveInteger(_0x377d3a[_0x395e63(0xfd)](_0x395e63(0x11c),DEFAULT_SINCE_MINUTES),_0x395e63(0x125));}function readPositiveInteger(_0x568be6,_0x4f5f47){const _0x4a7bf1=a42_0x42c929;if(!Number[_0x4a7bf1(0x113)](_0x568be6)||_0x568be6<=0x0)throw CliErrors[_0x4a7bf1(0x112)](_0x4f5f47+'\x20must\x20be\x20a\x20positive\x20integer.');return _0x568be6;}function a42_0x3224(){const _0x10ac5a=['23215hvEqGq','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','string','780NQmUUR','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','26136504UNJscn','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','since','--limit','--start-time','8283520bIJHzO','\x20Backend\x20Function\x20log\x20line(s).','127040BUyvNq','Filter\x20by\x20log\x20level','INFO','--end-time','--since','appCode','number','bff','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','flag','num','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','1291168VgjYKG','1184418jrWTeT','ERROR','end-time','DEBUG','start-time','toUpperCase','logs','length','trim','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','Found\x20','level','Maximum\x20log\x20lines\x20to\x20return\x20(1-','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','str','read','1649356izgTRt','keyword','validation','isSafeInteger','WARN'];a42_0x3224=function(){return _0x10ac5a;};return a42_0x3224();}export const bffLogs={'service':a42_0x42c929(0x128),'command':a42_0x42c929(0x106),'description':a42_0x42c929(0x11b),'risk':a42_0x42c929(0x10f),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':'since','type':a42_0x42c929(0x127),'description':'Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20'+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x42c929(0x104),'type':a42_0x42c929(0x127),'description':a42_0x42c929(0xfe)},{'name':'end-time','type':a42_0x42c929(0x127),'description':a42_0x42c929(0x119)},{'name':a42_0x42c929(0x10b),'type':'string','description':a42_0x42c929(0x122),'enum':LOG_LEVELS},{'name':a42_0x42c929(0x111),'type':a42_0x42c929(0x117),'description':a42_0x42c929(0x116)},{'name':'limit','type':a42_0x42c929(0x127),'description':a42_0x42c929(0x10c)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x5c4bf7){resolveBffLogQuery(_0x5c4bf7);},async 'execute'(_0x3e1464){const _0x533709=a42_0x42c929,_0x5a8f36=resolveBffLogQuery(_0x3e1464),{sinceMinutes:_0x481afc,..._0x490528}=_0x5a8f36,_0x245157=await searchBffScriptLogs(_0x490528);return{'ok':!![],'data':{'query':_0x5a8f36,'count':_0x245157['length'],'logs':_0x245157},'message':_0x245157['length']===0x0?_0x533709(0x10d):_0x533709(0x10a)+_0x245157[_0x533709(0x107)]+_0x533709(0x120)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a42_0x59b6b6=a42_0x118c;(function(_0x1bdb8c,_0x1235d9){const _0x31598e=a42_0x118c,_0x30c464=_0x1bdb8c();while(!![]){try{const _0x5e73a5=parseInt(_0x31598e(0x1e9))/0x1+-parseInt(_0x31598e(0x215))/0x2*(parseInt(_0x31598e(0x1e0))/0x3)+parseInt(_0x31598e(0x1c1))/0x4+-parseInt(_0x31598e(0x1b3))/0x5*(-parseInt(_0x31598e(0x227))/0x6)+parseInt(_0x31598e(0x19f))/0x7*(-parseInt(_0x31598e(0x1d8))/0x8)+parseInt(_0x31598e(0x205))/0x9*(-parseInt(_0x31598e(0x1de))/0xa)+-parseInt(_0x31598e(0x1df))/0xb*(-parseInt(_0x31598e(0x1e8))/0xc);if(_0x5e73a5===_0x1235d9)break;else _0x30c464['push'](_0x30c464['shift']());}catch(_0x7650d){_0x30c464['push'](_0x30c464['shift']());}}}(a42_0x11bb,0x86a14));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';function a42_0x118c(_0x54407c,_0x4682a3){_0x54407c=_0x54407c-0x199;const _0x11bb88=a42_0x11bb();let _0x118c94=_0x11bb88[_0x54407c];return _0x118c94;}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':a42_0x59b6b6(0x1ee),'command':a42_0x59b6b6(0x1d0),'description':a42_0x59b6b6(0x1e6),'risk':a42_0x59b6b6(0x200),'structuredErrors':!![],'flags':[{'name':a42_0x59b6b6(0x20a),'type':a42_0x59b6b6(0x1bf),'description':a42_0x59b6b6(0x1fc),'enum':[a42_0x59b6b6(0x1e1),a42_0x59b6b6(0x1b1),a42_0x59b6b6(0x19c)]},{'name':a42_0x59b6b6(0x22e),'type':'boolean','description':a42_0x59b6b6(0x21d)}],async 'dryRun'(_0x11871b){const _0x478c30=a42_0x59b6b6,_0x2a54fd=loadBffProjectConfig(_0x11871b['appCode']),_0x261acf=await readBffLockFile(_0x2a54fd[_0x478c30(0x1ad)]),{appLock:_0x396076}=ensureLockScope(_0x261acf??createEmptyBffLock(),_0x11871b[_0x478c30(0x1b5)],_0x2a54fd[_0x478c30(0x1da)],_0x478c30(0x1d0)),_0x32e2b2=normalizeBffType(_0x11871b[_0x478c30(0x1d5)](_0x478c30(0x20a)))??undefined,[_0x4d0833,_0xf011d8]=await Promise[_0x478c30(0x1a2)]([listBffScripts(_0x11871b[_0x478c30(0x1b5)],_0x32e2b2),getBffScriptStatistics(_0x11871b[_0x478c30(0x1b5)])]),_0x1bb89d=_0x4d0833[_0x478c30(0x21e)](_0xb80b1b=>normalizeBffType(_0xb80b1b[_0x478c30(0x1c4)])==='HOOK'),_0x5d4dba=_0x1bb89d?buildDatasetCodeToAliasMap(_0x11871b[_0x478c30(0x1e4)],_0x11871b[_0x478c30(0x1b5)],_0x11871b[_0x478c30(0x1d7)]||_0x11871b[_0x478c30(0x1bc)]?.['currentApp']||_0x11871b[_0x478c30(0x1bc)]?.[_0x478c30(0x19d)]):new Map(),_0x523464=_0x1bb89d?await planHookDirectoryMigration(_0x2a54fd,_0x396076,_0x5d4dba,await scanLocalBffFunctions(_0x2a54fd,'HOOK')):undefined,_0x5842a4=createHookLocationMap(_0xf011d8),_0x4d7906=[];for(const _0x18e637 of _0x4d0833){const _0x442842=resolveRemoteScriptTarget(_0x2a54fd,_0x18e637,_0x5842a4,_0x523464?.[_0x478c30(0x1af)]??_0x396076['functions'],_0x5d4dba);if(!_0x442842){_0x4d7906[_0x478c30(0x1f1)]({'scriptType':_0x18e637[_0x478c30(0x1c4)],'functionName':_0x18e637[_0x478c30(0x226)]??'','status':_0x478c30(0x22b),'reason':_0x478c30(0x221)});continue;}const _0x2701fb=(_0x523464?.[_0x478c30(0x1af)]??_0x396076[_0x478c30(0x212)])[_0x442842[_0x478c30(0x1ef)]],_0x5c816e=_0x18e637[_0x478c30(0x228)]!=null?computeContentHash(_0x18e637['scriptContent']):undefined,_0x19a0c9=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x523464,_0x442842)??_0x442842[_0x478c30(0x20e)],_0x2701fb,_0x5c816e),_0x53c5ac=_0x19a0c9?localUnsyncedConflict(_0x442842,_0x18e637['id']):undefined;_0x4d7906[_0x478c30(0x1f1)]({'lockKey':_0x442842[_0x478c30(0x1ef)],'filePath':_0x442842[_0x478c30(0x20e)],'remoteId':_0x18e637['id']??null,'status':_0x53c5ac?_0x478c30(0x229):_0x478c30(0x1c8),..._0x53c5ac?{'conflict':_0x53c5ac}:{},..._0x442842[_0x478c30(0x1b7)]?{'alias':_0x442842[_0x478c30(0x1b7)][_0x478c30(0x1eb)]??null,'datasetCode':_0x442842['hookLocation']['datasetCode'],'operationType':_0x442842['hookLocation'][_0x478c30(0x208)],'functionNode':_0x442842[_0x478c30(0x1b7)]['functionNode']}:{}});}return{'method':_0x478c30(0x1d9),'url':_0x478c30(0x203)+_0x11871b[_0x478c30(0x1b5)]+(_0x32e2b2?_0x478c30(0x1dc)+_0x32e2b2:'')+_0x478c30(0x21b)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x11871b[_0x478c30(0x1b5)],'filterType':_0x32e2b2??null,..._0x523464&&_0x523464['migrations'][_0x478c30(0x224)]>0x0?{'hookDirectoryMigrations':_0x523464['migrations'][_0x478c30(0x1c0)](_0x5adf95=>({'from':_0x5adf95['oldDirectory'],'to':_0x5adf95[_0x478c30(0x1cf)]}))}:{},'files':_0x4d7906},'description':_0x478c30(0x199)+_0x4d7906['length']+_0x478c30(0x1a3)};},async 'execute'(_0x46e905){const _0x5ef651=a42_0x59b6b6,_0x4c86df=loadBffProjectConfig(_0x46e905[_0x5ef651(0x1b5)]),_0x448fcd=await readBffLockFile(_0x4c86df['lockFilePath']),{lockData:_0x1405fc,appLock:_0x52b296}=ensureLockScope(_0x448fcd??createEmptyBffLock(),_0x46e905[_0x5ef651(0x1b5)],_0x4c86df[_0x5ef651(0x1da)],_0x5ef651(0x1d0)),_0x2150ea=normalizeBffType(_0x46e905[_0x5ef651(0x1d5)](_0x5ef651(0x20a)))??undefined;if(_0x46e905['str'](_0x5ef651(0x20a))&&!_0x2150ea)throw CliErrors[_0x5ef651(0x232)](_0x5ef651(0x1fa));const [_0x28ccac,_0x530025]=await Promise[_0x5ef651(0x1a2)]([listBffScripts(_0x46e905[_0x5ef651(0x1b5)],_0x2150ea),getBffScriptStatistics(_0x46e905[_0x5ef651(0x1b5)])]);if(_0x28ccac[_0x5ef651(0x224)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x5ef651(0x1f6)};const _0x2853de=_0x46e905['bool'](_0x5ef651(0x22e));if(_0x2853de&&!_0x46e905[_0x5ef651(0x1d4)]){const _0xc8953=await confirmForce();if(!_0xc8953)throw CliErrors[_0x5ef651(0x20d)](_0x5ef651(0x1a9));}if(_0x2853de&&_0x46e905['nonInteractive']){}const _0x279bc7=_0x28ccac[_0x5ef651(0x21e)](_0x24f74e=>normalizeBffType(_0x24f74e[_0x5ef651(0x1c4)])===_0x5ef651(0x19c)),_0x380e34=_0x279bc7?buildDatasetCodeToAliasMap(_0x46e905[_0x5ef651(0x1e4)],_0x46e905[_0x5ef651(0x1b5)],_0x46e905[_0x5ef651(0x1d7)]||_0x46e905['mergedCli']?.['currentApp']||_0x46e905[_0x5ef651(0x1bc)]?.['defaultApp']):new Map(),_0x3ecf7c=createHookLocationMap(_0x530025),_0x5ae17b=JSON[_0x5ef651(0x222)](JSON[_0x5ef651(0x219)](_0x1405fc)),_0x617ce9=_0x46e905[_0x5ef651(0x1b5)],_0x140168=_0x5ae17b[_0x5ef651(0x1db)][_0x617ce9];if(!_0x140168)throw new Error(_0x5ef651(0x1a4)+_0x617ce9+_0x5ef651(0x21f));const _0x3b3d60=_0x279bc7?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4c86df,_0x140168,_0x380e34,await scanLocalBffFunctions(_0x4c86df,_0x5ef651(0x19c))),_0x140168):undefined,_0x22315c=createPullFileTransaction(),_0x51176e=[],_0x3521f5=[],_0x439974=[],_0x421bf7=[];for(const _0x2a6ef3 of _0x28ccac){const _0x5c7faa=resolveRemoteScriptTarget(_0x4c86df,_0x2a6ef3,_0x3ecf7c,_0x140168[_0x5ef651(0x212)],_0x380e34);if(!_0x5c7faa){_0x3521f5[_0x5ef651(0x1f1)]({'lockKey':_0x2a6ef3[_0x5ef651(0x1c4)]+'/'+_0x2a6ef3[_0x5ef651(0x226)],'reason':_0x5ef651(0x221)});continue;}const _0xff6706=_0x140168[_0x5ef651(0x212)][_0x5c7faa[_0x5ef651(0x1ef)]];try{if(!_0x2a6ef3['id'])throw new Error(_0x5ef651(0x217));if(_0x2a6ef3[_0x5ef651(0x228)]==null)throw new Error(_0x5ef651(0x1f0));const _0x4a038e=_0x2a6ef3[_0x5ef651(0x228)],_0x4c4eb5=computeContentHash(_0x4a038e);if(!_0x2853de){const _0x579062=await hasUnsyncedLocalChanges(_0x5c7faa[_0x5ef651(0x20e)],_0xff6706,_0x4c4eb5);if(_0x579062){_0x439974['push'](localUnsyncedConflict(_0x5c7faa,_0x2a6ef3['id']));continue;}}await _0x22315c[_0x5ef651(0x1c5)](_0x5c7faa[_0x5ef651(0x20e)],_0x4a038e);const _0x3820b5={'hash':_0x4c4eb5,'remoteId':_0x2a6ef3['id'],'version':_0x2a6ef3[_0x5ef651(0x22c)]};_0x5c7faa[_0x5ef651(0x20a)]==='HOOK'&&_0x5c7faa[_0x5ef651(0x1b7)]&&(_0x3820b5['alias']=_0x5c7faa[_0x5ef651(0x1b7)][_0x5ef651(0x1eb)],_0x3820b5[_0x5ef651(0x1cd)]=_0x5c7faa['hookLocation'][_0x5ef651(0x1cd)],_0x3820b5[_0x5ef651(0x208)]=_0x5c7faa[_0x5ef651(0x1b7)]['operationType'],_0x3820b5['functionNode']=_0x5c7faa[_0x5ef651(0x1b7)][_0x5ef651(0x1e7)]),_0x140168[_0x5ef651(0x212)][_0x5c7faa[_0x5ef651(0x1ef)]]=_0x3820b5,_0x51176e['push']({'lockKey':_0x5c7faa[_0x5ef651(0x1ef)],'remoteId':_0x2a6ef3['id']});}catch(_0x1faf1f){_0x421bf7[_0x5ef651(0x1f1)]({'lockKey':_0x5c7faa[_0x5ef651(0x1ef)],'error':_0x1faf1f instanceof Error?_0x1faf1f[_0x5ef651(0x1d6)]:String(_0x1faf1f)});}}_0x140168['lastSync']=new Date()[_0x5ef651(0x1bd)]();try{await writeBffLockFile(_0x4c86df[_0x5ef651(0x1ad)],_0x5ae17b);}catch(_0x5837d0){const _0x10987d=[...await _0x22315c['rollback'](),...await _0x3b3d60?.[_0x5ef651(0x19a)]()??[]];throw withRollbackErrors(_0x5837d0,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x10987d);}return{'ok':_0x421bf7['length']===0x0,'data':{'pulled':_0x51176e,'skipped':_0x3521f5,'conflicts':_0x439974,'failed':_0x421bf7},'message':formatPullMessage(_0x51176e['length'],_0x3521f5['length'],_0x439974[_0x5ef651(0x224)],_0x421bf7[_0x5ef651(0x224)])};}};function localUnsyncedConflict(_0x1a3e09,_0x24ed8f){const _0x572a40=a42_0x59b6b6,_0x5162b1=_0x1a3e09[_0x572a40(0x1ef)]['split']('/')['at'](-0x1);return{'code':_0x572a40(0x225),'lockKey':_0x1a3e09[_0x572a40(0x1ef)],'filePath':_0x1a3e09[_0x572a40(0x20e)],..._0x24ed8f!=null?{'remoteId':_0x24ed8f}:{},'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+_0x572a40(0x1e2)+_0x1a3e09['type']+_0x572a40(0x1ed)+_0x5162b1+'\x20--format\x20compress','requiresReview':!![],'message':_0x572a40(0x1e3)}};}function formatPullMessage(_0x3876ff,_0x2ed4e4,_0x308e31,_0x217b1b){const _0x2969df=a42_0x59b6b6,_0x4560d6=[_0x2969df(0x218)+_0x3876ff+_0x2969df(0x1ca),_0x2ed4e4+_0x2969df(0x1ce)];_0x308e31>0x0&&_0x4560d6[_0x2969df(0x1f1)](_0x308e31+_0x2969df(0x1f9)+(_0x308e31===0x1?'':'s')+'\x20'+(_0x308e31===0x1?_0x2969df(0x1ac):_0x2969df(0x1be))+_0x2969df(0x1ab));if(_0x217b1b>0x0)_0x4560d6[_0x2969df(0x1f1)](_0x217b1b+'\x20failed');return _0x4560d6[_0x2969df(0x19b)](',\x20');}async function hasUnsyncedLocalChanges(_0x4fdd64,_0x43e453,_0x53bb30){const _0x12fd53=a42_0x59b6b6;if(!await fileExists(_0x4fdd64))return![];const _0x275ee2=await computeFileHash(_0x4fdd64);if(!_0x43e453)return _0x53bb30?_0x275ee2!==_0x53bb30:!![];return _0x275ee2!==_0x43e453[_0x12fd53(0x206)];}function createPullFileTransaction(){const _0x303d01=new Map(),_0x376053=async(_0x5bf9c9,_0x199e54)=>{const _0x216863=a42_0x118c;try{if(_0x199e54[_0x216863(0x21a)])await ensureParentDirectory(_0x5bf9c9),await writeFile(_0x5bf9c9,_0x199e54[_0x216863(0x1b6)]);else try{await unlink(_0x5bf9c9);}catch(_0x5547de){if(_0x5547de[_0x216863(0x1b2)]!==_0x216863(0x1f5))throw _0x5547de;}return undefined;}catch(_0x1365d7){return _0x1365d7 instanceof Error?_0x1365d7:new Error(String(_0x1365d7));}};return{async 'write'(_0x1b4ab5,_0x1a917b){const _0xd546ee=a42_0x118c;if(!_0x303d01[_0xd546ee(0x1f8)](_0x1b4ab5))try{_0x303d01[_0xd546ee(0x20f)](_0x1b4ab5,{'existed':!![],'content':await readFile(_0x1b4ab5)});}catch(_0x1d1946){if(_0x1d1946[_0xd546ee(0x1b2)]!==_0xd546ee(0x1f5))throw _0x1d1946;_0x303d01['set'](_0x1b4ab5,{'existed':![]});}try{await ensureParentDirectory(_0x1b4ab5),await writeFile(_0x1b4ab5,_0x1a917b,_0xd546ee(0x210));}catch(_0x557fee){const _0x1479e3=await _0x376053(_0x1b4ab5,_0x303d01[_0xd546ee(0x22f)](_0x1b4ab5));if(!_0x1479e3)_0x303d01['delete'](_0x1b4ab5);throw withRollbackErrors(_0x557fee,_0xd546ee(0x1a7)+_0x1b4ab5+'\x22.',_0x1479e3?[_0x1479e3]:[]);}},async 'rollback'(){const _0x313f34=a42_0x118c,_0x2ef98b=[];for(const [_0x23a325,_0x37cc48]of[..._0x303d01['entries']()][_0x313f34(0x211)]()){const _0x951299=await _0x376053(_0x23a325,_0x37cc48);_0x951299&&_0x2ef98b[_0x313f34(0x1f1)](new Error(_0x313f34(0x220)+_0x23a325+_0x313f34(0x1fd)+_0x951299['message']));}return _0x2ef98b;}};}function withRollbackErrors(_0x5e844c,_0x29d2d1,_0x279929){const _0x30a6cf=a42_0x59b6b6,_0x84763e=_0x5e844c instanceof Error?_0x5e844c:new Error(String(_0x5e844c));if(_0x279929['length']===0x0)return _0x84763e;return new AggregateError([_0x84763e,..._0x279929],_0x29d2d1+_0x30a6cf(0x1a1)+_0x279929[_0x30a6cf(0x1c0)](_0x374acf=>_0x374acf[_0x30a6cf(0x1d6)])[_0x30a6cf(0x19b)](';\x20'));}function buildDatasetCodeToAliasMap(_0x4cd8a0,_0x330207,_0x2552b8){const _0x2bc417=a42_0x59b6b6,_0x296b3c=resolveApiModelSource(_0x4cd8a0,_0x330207,_0x2552b8),_0x3c8373=loadAliasMap(_0x4cd8a0,undefined,_0x296b3c[_0x2bc417(0x20e)],_0x296b3c['profileName']);return assertUnambiguousHookAliases(_0x3c8373),new Map(_0x3c8373[_0x2bc417(0x1c0)](_0x1d9100=>[_0x1d9100['datasetCode'][_0x2bc417(0x1ba)](),_0x1d9100[_0x2bc417(0x1eb)]]));}async function planHookDirectoryMigration(_0x2bcead,_0x2206f9,_0x553674,_0x2d3689){const _0x428e51=a42_0x59b6b6,_0x2bdafc=new Map();for(const [_0x412c8c,_0x3e0966]of Object[_0x428e51(0x1b4)](_0x2206f9['functions'])){const [_0x254986,_0x2477f5,_0x3c9293,_0x2eff5b,_0x37590e,..._0x512dd7]=_0x412c8c['split']('/');if(_0x254986!=='HOOK'||!_0x2477f5||!_0x3c9293||!_0x2eff5b||!_0x37590e||_0x512dd7[_0x428e51(0x224)]>0x0||!_0x3e0966['datasetCode'])continue;const _0x2e5908=_0x553674[_0x428e51(0x22f)](_0x3e0966[_0x428e51(0x1cd)][_0x428e51(0x1ba)]()),_0x1715b5=_0x2e5908??_0x3e0966[_0x428e51(0x1cd)];if(!isSafeHookDirectorySegment(_0x2477f5))throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1fb)+_0x2477f5+_0x428e51(0x209));if(!isSafeHookDirectorySegment(_0x1715b5))throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x2477f5+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x2477f5===_0x1715b5)continue;const _0xd7cb2c=_0x2bdafc[_0x428e51(0x22f)](_0x2477f5)??{'datasetCode':_0x3e0966[_0x428e51(0x1cd)],'alias':_0x2e5908,'keyChanges':[]};if(_0xd7cb2c[_0x428e51(0x1cd)]!==_0x3e0966[_0x428e51(0x1cd)])throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x2477f5+_0x428e51(0x1cb));const _0x4d2503=_0x428e51(0x1a8)+_0x1715b5+'/'+_0x3c9293+'/'+_0x2eff5b+'/'+_0x37590e;try{resolveLocalFilePathFromLockKey(_0x2bcead,_0x412c8c),resolveLocalFilePathFromLockKey(_0x2bcead,_0x4d2503);}catch(_0x2e354a){throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1d3)+_0x412c8c+_0x428e51(0x1fd)+(_0x2e354a instanceof Error?_0x2e354a[_0x428e51(0x1d6)]:String(_0x2e354a)));}_0xd7cb2c[_0x428e51(0x1f7)][_0x428e51(0x1f1)]({'oldLockKey':_0x412c8c,'newLockKey':_0x4d2503,'entry':_0x3e0966}),_0x2bdafc[_0x428e51(0x20f)](_0x2477f5,_0xd7cb2c);}const _0x1f45f8=new Set([..._0x2bdafc['values']()][_0x428e51(0x1ec)](_0x142813=>_0x142813[_0x428e51(0x1f7)][_0x428e51(0x1c0)](_0x2d9ea0=>_0x2d9ea0[_0x428e51(0x1f3)]))),_0x39121d=new Map(),_0x3ac236=new Map();for(const [_0x5dbf3e,_0x2f3fbf]of _0x2bdafc){const _0xe6cf45=_0x2f3fbf[_0x428e51(0x1eb)]??_0x2f3fbf[_0x428e51(0x1cd)],_0x45f6e9=hookDirectoryIdentity(_0xe6cf45),_0x5b3330=_0x39121d[_0x428e51(0x22f)](_0x45f6e9);if(_0x5b3330&&_0x5b3330!==_0x5dbf3e)throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1f4)+_0x5b3330+_0x428e51(0x1dd)+_0x5dbf3e+'\x22:\x20both\x20target\x20\x22'+_0xe6cf45+_0x428e51(0x22d));_0x39121d[_0x428e51(0x20f)](_0x45f6e9,_0x5dbf3e);for(const _0x18a96c of _0x2f3fbf['keyChanges']){const _0x4fec92=_0x3ac236['get'](_0x18a96c[_0x428e51(0x1aa)]);if(_0x4fec92&&_0x4fec92!==_0x18a96c['oldLockKey'])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x4fec92+_0x428e51(0x1dd)+_0x18a96c[_0x428e51(0x1f3)]+'\x22:\x20both\x20target\x20\x22'+_0x18a96c[_0x428e51(0x1aa)]+_0x428e51(0x1ea));if(_0x1f45f8[_0x428e51(0x1f8)](_0x18a96c[_0x428e51(0x1aa)]))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x18a96c[_0x428e51(0x1f3)]+_0x428e51(0x201)+_0x18a96c[_0x428e51(0x1aa)]+_0x428e51(0x1a6));_0x3ac236[_0x428e51(0x20f)](_0x18a96c['newLockKey'],_0x18a96c['oldLockKey']);}}const _0x25f687=new Map();for(const [_0x36e8f2,_0xd57c30]of _0x553674){_0x25f687[_0x428e51(0x20f)](hookDirectoryIdentity(_0xd57c30),_0x36e8f2);}const _0x16adb3=[];for(const [_0x17000f,_0x3d567a]of _0x2bdafc){const _0x120558=_0x3d567a['alias']??_0x3d567a[_0x428e51(0x1cd)],_0x8f4479=join(_0x2bcead[_0x428e51(0x1d1)],_0x428e51(0x19c),_0x17000f),_0x5316e5=join(_0x2bcead['scriptsRootDir'],_0x428e51(0x19c),_0x120558),_0x5d6094=await directoryExists(_0x8f4479),_0x1b2d70=await directoryExists(_0x5316e5),_0x486938=_0x5d6094?_0x1b2d70?await sameDirectory(_0x8f4479,_0x5316e5)?'case-rename':undefined:_0x428e51(0x1ae):'rekey';if(!_0x486938)throw CliErrors[_0x428e51(0x232)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x17000f+_0x428e51(0x230)+_0x120558+_0x428e51(0x202));const _0x51f97c=_0x25f687['get'](hookDirectoryIdentity(_0x17000f));if(_0x51f97c&&_0x51f97c!==_0x3d567a['datasetCode']['toLowerCase']()){const _0x1d9e06=new Set(_0x3d567a[_0x428e51(0x1f7)][_0x428e51(0x1c0)](_0x27a712=>_0x27a712['oldLockKey'])),_0x16ec48=_0x2d3689[_0x428e51(0x204)](_0x2d6fae=>_0x2d6fae[_0x428e51(0x20a)]===_0x428e51(0x19c)&&_0x2d6fae['alias']!=null&&hookDirectoryIdentity(_0x2d6fae['alias'])===hookDirectoryIdentity(_0x17000f)&&!_0x1d9e06[_0x428e51(0x1f8)](_0x2d6fae[_0x428e51(0x1ef)]));if(_0x16ec48[_0x428e51(0x224)]>0x0)throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x17000f+_0x428e51(0x1c7));}const _0x4ea3a6=_0x25f687[_0x428e51(0x22f)](hookDirectoryIdentity(_0x120558));if(_0x4ea3a6&&_0x4ea3a6!==_0x3d567a[_0x428e51(0x1cd)]['toLowerCase']())throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x17000f+_0x428e51(0x230)+_0x120558+_0x428e51(0x1b0));for(const _0x272141 of _0x3d567a[_0x428e51(0x1f7)]){const _0x1cf35d=_0x2206f9[_0x428e51(0x212)][_0x272141[_0x428e51(0x1aa)]];if(_0x1cf35d&&!_0x1f45f8[_0x428e51(0x1f8)](_0x272141[_0x428e51(0x1aa)])&&!sameHookIdentity(_0x272141[_0x428e51(0x207)],_0x1cf35d))throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x17000f+'\x22\x20to\x20\x22'+_0x120558+_0x428e51(0x1d2));}_0x16adb3['push']({'oldDirectory':_0x17000f,'newDirectory':_0x120558,'oldDirectoryPath':_0x8f4479,'newDirectoryPath':_0x5316e5,'mode':_0x486938,'alias':_0x3d567a[_0x428e51(0x1eb)],'keyChanges':_0x3d567a['keyChanges']});}const _0x5137c2={..._0x2206f9[_0x428e51(0x212)]},_0x5a1063=new Map(),_0x465d97=new Map();for(const _0x2c3913 of _0x16adb3){const _0x3ee3ee=_0x2c3913[_0x428e51(0x1c2)]!=='rekey';_0x3ee3ee&&_0x465d97[_0x428e51(0x20f)](hookDirectoryIdentity(_0x2c3913[_0x428e51(0x1cf)]),_0x2c3913[_0x428e51(0x223)]);for(const _0x1155bc of _0x2c3913[_0x428e51(0x1f7)]){const _0x39ed53=_0x5137c2[_0x1155bc[_0x428e51(0x1aa)]],_0xc3a919=_0x3ee3ee?_0x1155bc['entry']:_0x39ed53??_0x1155bc[_0x428e51(0x207)];_0x5137c2[_0x1155bc[_0x428e51(0x1aa)]]=canonicalizeHookEntry(_0xc3a919,_0x2c3913[_0x428e51(0x1eb)]),delete _0x5137c2[_0x1155bc[_0x428e51(0x1f3)]],_0x3ee3ee&&_0x5a1063[_0x428e51(0x20f)](_0x1155bc[_0x428e51(0x1aa)],resolveLocalFilePathFromLockKey(_0x2bcead,_0x1155bc[_0x428e51(0x1f3)]));}}return{'migrations':_0x16adb3,'projectedFunctions':_0x5137c2,'sourceFilePathByNewLockKey':_0x5a1063,'sourceDirectoryPathByNewDirectory':_0x465d97};}function resolveMigratedSourceFilePath(_0x57f0f3,_0x16dd9a){const _0x4bc676=a42_0x59b6b6;if(!_0x57f0f3||!_0x16dd9a)return undefined;const _0x103448=_0x57f0f3[_0x4bc676(0x21c)]['get'](_0x16dd9a[_0x4bc676(0x1ef)]);if(_0x103448)return _0x103448;if(_0x16dd9a[_0x4bc676(0x20a)]!==_0x4bc676(0x19c))return undefined;const [,_0x3dc95a,..._0x52db92]=_0x16dd9a[_0x4bc676(0x1ef)][_0x4bc676(0x1c9)]('/');if(!_0x3dc95a||_0x52db92['length']===0x0)return undefined;const _0x485c4c=_0x57f0f3['sourceDirectoryPathByNewDirectory'][_0x4bc676(0x22f)](hookDirectoryIdentity(_0x3dc95a));return _0x485c4c?join(_0x485c4c,..._0x52db92)+'.js':undefined;}function sameHookIdentity(_0x2f962b,_0xa46b48){const _0x22b6ce=a42_0x59b6b6;return _0x2f962b['remoteId']===_0xa46b48[_0x22b6ce(0x1cc)]&&_0x2f962b[_0x22b6ce(0x1cd)]===_0xa46b48[_0x22b6ce(0x1cd)]&&_0x2f962b[_0x22b6ce(0x208)]===_0xa46b48[_0x22b6ce(0x208)]&&_0x2f962b[_0x22b6ce(0x1e7)]===_0xa46b48[_0x22b6ce(0x1e7)];}function canonicalizeHookEntry(_0x1148de,_0x59583f){const {alias:_0x2a1939,..._0xb44d4d}=_0x1148de;return _0x59583f?{..._0xb44d4d,'alias':_0x59583f}:_0xb44d4d;}function hookDirectoryIdentity(_0x3d41b7){const _0x31b5fc=a42_0x59b6b6;return _0x3d41b7['normalize'](_0x31b5fc(0x22a))[_0x31b5fc(0x1ba)]();}function isSafeHookDirectorySegment(_0x1da962){return isSafeLockKeySegment(_0x1da962);}function a42_0x11bb(){const _0x11e867=['projectedFunctions','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','ENDPOINT','code','5PJgeIu','entries','appCode','content','hookLocation','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','lastSync','toLowerCase','migrations','mergedCli','toISOString','require','string','map','1163864yvxCAP','mode','newDirectoryPath','scriptType','write','question','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','would_pull','split','\x20pulled','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','remoteId','datasetCode','\x20skipped','newDirectory','pull','scriptsRootDir','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','nonInteractive','str','message','selectedAppName','40wopYXa','GET','scriptsRoot','apps','&type=','\x22\x20and\x20\x22','611360wdJjrm','55yaJHty','12jYEGoZ','COMMON','\x20bff\x20push\x20--type\x20','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.','apiDir','dev','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','functionNode','1811496tQCRin','965657SVmjXr','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','alias','flatMap','\x20--name\x20','bff','lockKey','Remote\x20script\x20missing\x20content.','push','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','oldLockKey','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','ENOENT','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','keyChanges','has','\x20conflict','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Pull\x20only\x20this\x20script\x20type','\x22:\x20','close','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','read','\x22:\x20its\x20target\x20\x22','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','/api/management/library/scripts/list?appCode=','filter','81qHYjPU','hash','entry','operationType','\x22\x20from\x20the\x20lock\x20file.','type','stderr','\x22\x20from\x20\x22','cancelled','filePath','set','utf8','reverse','functions','stdin','ino','381772oJGfQZ','case-rename','Remote\x20script\x20missing\x20id.','Pull\x20complete:\x20','stringify','existed','¤tPage=1&pageSize=','sourceFilePathByNewLockKey','Force\x20overwrite\x20local\x20unsynced\x20changes','some','\x22\x20not\x20found\x20after\x20ensureLockScope.','Could\x20not\x20restore\x20local\x20script\x20\x22','unresolvable\x20target\x20path','parse','oldDirectoryPath','length','BFF_LOCAL_UNSYNCED','functionName','1754334ZkCgtZ','scriptContent','conflict','NFC','skipped','version','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','force','get','\x22\x20to\x20\x22','includes','validation','Would\x20inspect\x20','rollback','join','HOOK','defaultApp','oldDirectory','614026rOxNmM','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x20Recovery\x20errors:\x20','all','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','Lock\x20scope\x20for\x20app\x20\x22','trim','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Failed\x20to\x20write\x20local\x20script\x20\x22','HOOK/','Force\x20pull\x20cancelled.','newLockKey','\x20resolution','requires','lockFilePath','move'];a42_0x11bb=function(){return _0x11e867;};return a42_0x11bb();}async function sameDirectory(_0x1adbfc,_0xb3354f){const _0xfeb117=a42_0x59b6b6,[_0x15ad26,_0x15ea1e]=await Promise[_0xfeb117(0x1a2)]([stat(_0x1adbfc),stat(_0xb3354f)]);return _0x15ad26[_0xfeb117(0x1e5)]===_0x15ea1e['dev']&&_0x15ad26[_0xfeb117(0x214)]===_0x15ea1e[_0xfeb117(0x214)];}async function applyHookDirectoryMigration(_0x2da0b2,_0x510c75){const _0x199a4d=a42_0x59b6b6,_0x1b51ea=_0x510c75[_0x199a4d(0x212)],_0x432e9f=_0x510c75[_0x199a4d(0x1b9)],_0x3b268a=[],_0x3d2f99=async()=>{const _0x2d9f7b=_0x199a4d,_0x2fc1b3=[];_0x510c75[_0x2d9f7b(0x212)]=_0x1b51ea,_0x510c75[_0x2d9f7b(0x1b9)]=_0x432e9f;for(const {migration:_0x386ecc,temporaryPath:_0x58363c}of[..._0x3b268a][_0x2d9f7b(0x211)]()){try{_0x58363c?(await rename(_0x386ecc[_0x2d9f7b(0x1c3)],_0x58363c),await rename(_0x58363c,_0x386ecc[_0x2d9f7b(0x223)])):await rename(_0x386ecc['newDirectoryPath'],_0x386ecc[_0x2d9f7b(0x223)]);}catch(_0x74c7ab){_0x2fc1b3['push'](new Error(_0x2d9f7b(0x1b8)+_0x386ecc['oldDirectory']+_0x2d9f7b(0x20c)+_0x386ecc['newDirectory']+'\x22:\x20'+(_0x74c7ab instanceof Error?_0x74c7ab[_0x2d9f7b(0x1d6)]:String(_0x74c7ab))));}}return _0x2fc1b3;};try{for(const _0x3c34bb of _0x2da0b2[_0x199a4d(0x1bb)]){if(_0x3c34bb[_0x199a4d(0x1c2)]===_0x199a4d(0x1ae))await ensureParentDirectory(_0x3c34bb[_0x199a4d(0x1c3)]),await rename(_0x3c34bb[_0x199a4d(0x223)],_0x3c34bb[_0x199a4d(0x1c3)]),_0x3b268a['push']({'migration':_0x3c34bb});else{if(_0x3c34bb[_0x199a4d(0x1c2)]===_0x199a4d(0x216)){const _0x318195=join(dirname(_0x3c34bb['oldDirectoryPath']),'.hook-directory-migrate-'+randomUUID());await rename(_0x3c34bb[_0x199a4d(0x223)],_0x318195);try{await rename(_0x318195,_0x3c34bb[_0x199a4d(0x1c3)]);}catch(_0x3182a9){try{await rename(_0x318195,_0x3c34bb[_0x199a4d(0x223)]);}catch(_0x5b114e){throw withRollbackErrors(_0x3182a9,_0x199a4d(0x1f2)+_0x3c34bb[_0x199a4d(0x19e)]+_0x199a4d(0x230)+_0x3c34bb['newDirectory']+'\x22;\x20temporary\x20directory\x20\x22'+_0x318195+'\x22\x20may\x20remain.',[new Error(_0x199a4d(0x1ff)+_0x318195+_0x199a4d(0x230)+_0x3c34bb[_0x199a4d(0x19e)]+_0x199a4d(0x1fd)+(_0x5b114e instanceof Error?_0x5b114e[_0x199a4d(0x1d6)]:String(_0x5b114e)))]);}throw _0x3182a9;}_0x3b268a[_0x199a4d(0x1f1)]({'migration':_0x3c34bb,'temporaryPath':_0x318195});}}}return _0x510c75[_0x199a4d(0x212)]=_0x2da0b2[_0x199a4d(0x1af)],{'rollback':_0x3d2f99};}catch(_0x298e5f){const _0x4e8f82=await _0x3d2f99();throw withRollbackErrors(_0x298e5f,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x4e8f82);}}async function confirmForce(){const _0x419b2c=a42_0x59b6b6,_0xae6b74=createInterface({'input':process[_0x419b2c(0x213)],'output':process[_0x419b2c(0x20b)]}),_0x32833d=await new Promise(_0x32da89=>{const _0x4422cc=_0x419b2c;_0xae6b74[_0x4422cc(0x1c6)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x32da89);});return _0xae6b74[_0x419b2c(0x1fe)](),['y','yes'][_0x419b2c(0x231)](_0x32833d[_0x419b2c(0x1a5)]()['toLowerCase']());}
|
|
1
|
+
const a43_0x27f8d1=a43_0x7e08;function a43_0x7e08(_0xde8849,_0x118e87){_0xde8849=_0xde8849-0x146;const _0x395ad8=a43_0x395a();let _0x7e082d=_0x395ad8[_0xde8849];return _0x7e082d;}(function(_0x5d869c,_0x173f86){const _0xda683a=a43_0x7e08,_0x740891=_0x5d869c();while(!![]){try{const _0x380614=parseInt(_0xda683a(0x17b))/0x1*(-parseInt(_0xda683a(0x19a))/0x2)+parseInt(_0xda683a(0x1ba))/0x3*(parseInt(_0xda683a(0x16f))/0x4)+parseInt(_0xda683a(0x16b))/0x5*(-parseInt(_0xda683a(0x1ce))/0x6)+parseInt(_0xda683a(0x195))/0x7+-parseInt(_0xda683a(0x168))/0x8*(parseInt(_0xda683a(0x1d5))/0x9)+parseInt(_0xda683a(0x148))/0xa*(parseInt(_0xda683a(0x18d))/0xb)+parseInt(_0xda683a(0x1db))/0xc*(parseInt(_0xda683a(0x14e))/0xd);if(_0x380614===_0x173f86)break;else _0x740891['push'](_0x740891['shift']());}catch(_0x490941){_0x740891['push'](_0x740891['shift']());}}}(a43_0x395a,0x48cf7));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_0x27f8d1(0x147),'command':a43_0x27f8d1(0x170),'description':a43_0x27f8d1(0x1a2),'risk':a43_0x27f8d1(0x1c9),'structuredErrors':!![],'flags':[{'name':a43_0x27f8d1(0x193),'type':'string','description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x27f8d1(0x14d),'ENDPOINT',a43_0x27f8d1(0x191)]},{'name':a43_0x27f8d1(0x17a),'type':a43_0x27f8d1(0x15d),'description':a43_0x27f8d1(0x1cb)}],async 'dryRun'(_0x180422){const _0x54d961=a43_0x27f8d1,_0x1010e9=loadBffProjectConfig(_0x180422[_0x54d961(0x1d6)]),_0x1e3272=await readBffLockFile(_0x1010e9['lockFilePath']),{appLock:_0x1bafce}=ensureLockScope(_0x1e3272??createEmptyBffLock(),_0x180422[_0x54d961(0x1d6)],_0x1010e9[_0x54d961(0x183)],'pull'),_0x8e4b8b=normalizeBffType(_0x180422[_0x54d961(0x1ac)](_0x54d961(0x193)))??undefined,[_0x1c72bf,_0x4070af]=await Promise['all']([listBffScripts(_0x180422[_0x54d961(0x1d6)],_0x8e4b8b),getBffScriptStatistics(_0x180422['appCode'])]),_0x641275=_0x1c72bf[_0x54d961(0x1c3)](_0x394bdb=>normalizeBffType(_0x394bdb['scriptType'])==='HOOK'),_0x21b84a=_0x641275?buildDatasetCodeToAliasMap(_0x180422[_0x54d961(0x19b)],_0x180422[_0x54d961(0x1d6)],_0x180422[_0x54d961(0x184)]||_0x180422[_0x54d961(0x175)]?.[_0x54d961(0x176)]||_0x180422[_0x54d961(0x175)]?.[_0x54d961(0x1a1)]):new Map(),_0xc97c2e=_0x641275?await planHookDirectoryMigration(_0x1010e9,_0x1bafce,_0x21b84a,await scanLocalBffFunctions(_0x1010e9,_0x54d961(0x191))):undefined,_0x1c7efa=createHookLocationMap(_0x4070af),_0x212623=[];for(const _0x315785 of _0x1c72bf){const _0x3b917f=resolveRemoteScriptTarget(_0x1010e9,_0x315785,_0x1c7efa,_0xc97c2e?.[_0x54d961(0x1d8)]??_0x1bafce[_0x54d961(0x17c)],_0x21b84a);if(!_0x3b917f){_0x212623[_0x54d961(0x18e)]({'scriptType':_0x315785[_0x54d961(0x1dd)],'functionName':_0x315785[_0x54d961(0x1c7)]??'','status':_0x54d961(0x1bd),'reason':_0x54d961(0x1c6)});continue;}const _0x141098=(_0xc97c2e?.[_0x54d961(0x1d8)]??_0x1bafce['functions'])[_0x3b917f[_0x54d961(0x1ad)]],_0x4662b4=_0x315785[_0x54d961(0x166)]!=null?computeContentHash(_0x315785[_0x54d961(0x166)]):undefined,_0x593b17=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0xc97c2e,_0x3b917f)??_0x3b917f[_0x54d961(0x186)],_0x141098,_0x4662b4),_0x2c8c31=_0x593b17?localUnsyncedConflict(_0x3b917f,_0x315785['id']):undefined;_0x212623['push']({'lockKey':_0x3b917f['lockKey'],'filePath':_0x3b917f['filePath'],'remoteId':_0x315785['id']??null,'status':_0x2c8c31?'conflict':_0x54d961(0x1d7),..._0x2c8c31?{'conflict':_0x2c8c31}:{},..._0x3b917f[_0x54d961(0x1d3)]?{'alias':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x194)]??null,'datasetCode':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x1c0)],'operationType':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x1bc)],'functionNode':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x1b1)]}:{}});}return{'method':_0x54d961(0x14a),'url':_0x54d961(0x150)+_0x180422[_0x54d961(0x1d6)]+(_0x8e4b8b?_0x54d961(0x15e)+_0x8e4b8b:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x180422[_0x54d961(0x1d6)],'filterType':_0x8e4b8b??null,..._0xc97c2e&&_0xc97c2e[_0x54d961(0x161)][_0x54d961(0x16a)]>0x0?{'hookDirectoryMigrations':_0xc97c2e['migrations']['map'](_0xa2b2f2=>({'from':_0xa2b2f2[_0x54d961(0x158)],'to':_0xa2b2f2[_0x54d961(0x1c4)]}))}:{},'files':_0x212623},'description':_0x54d961(0x1dc)+_0x212623[_0x54d961(0x16a)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x3912dc){const _0x23b472=a43_0x27f8d1,_0x4f1506=loadBffProjectConfig(_0x3912dc[_0x23b472(0x1d6)]),_0x337b67=await readBffLockFile(_0x4f1506[_0x23b472(0x17e)]),{lockData:_0x19d3ca,appLock:_0x2ea86e}=ensureLockScope(_0x337b67??createEmptyBffLock(),_0x3912dc[_0x23b472(0x1d6)],_0x4f1506['scriptsRoot'],_0x23b472(0x170)),_0x3bf888=normalizeBffType(_0x3912dc['str']('type'))??undefined;if(_0x3912dc['str'](_0x23b472(0x193))&&!_0x3bf888)throw CliErrors[_0x23b472(0x162)](_0x23b472(0x1b5));const [_0x1a8124,_0x2e1930]=await Promise[_0x23b472(0x1ab)]([listBffScripts(_0x3912dc['appCode'],_0x3bf888),getBffScriptStatistics(_0x3912dc[_0x23b472(0x1d6)])]);if(_0x1a8124[_0x23b472(0x16a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x23b472(0x173)};const _0x2f023f=_0x3912dc['bool'](_0x23b472(0x17a));if(_0x2f023f&&!_0x3912dc[_0x23b472(0x180)]){const _0x120e36=await confirmForce();if(!_0x120e36)throw CliErrors[_0x23b472(0x15c)](_0x23b472(0x19e));}if(_0x2f023f&&_0x3912dc['nonInteractive']){}const _0xb1887b=_0x1a8124['some'](_0x544265=>normalizeBffType(_0x544265[_0x23b472(0x1dd)])==='HOOK'),_0xd42c0a=_0xb1887b?buildDatasetCodeToAliasMap(_0x3912dc[_0x23b472(0x19b)],_0x3912dc[_0x23b472(0x1d6)],_0x3912dc[_0x23b472(0x184)]||_0x3912dc[_0x23b472(0x175)]?.['currentApp']||_0x3912dc[_0x23b472(0x175)]?.['defaultApp']):new Map(),_0x51cb60=createHookLocationMap(_0x2e1930),_0x4ef5c5=JSON[_0x23b472(0x18f)](JSON[_0x23b472(0x1cf)](_0x19d3ca)),_0x301500=_0x3912dc[_0x23b472(0x1d6)],_0x1e79f9=_0x4ef5c5['apps'][_0x301500];if(!_0x1e79f9)throw new Error(_0x23b472(0x1a3)+_0x301500+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x1e3c13=_0xb1887b?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4f1506,_0x1e79f9,_0xd42c0a,await scanLocalBffFunctions(_0x4f1506,'HOOK')),_0x1e79f9):undefined,_0x2f86ca=createPullFileTransaction(),_0x1d7096=[],_0x88ef88=[],_0x281587=[],_0x24a3f3=[];for(const _0x19b318 of _0x1a8124){const _0x1d4bfb=resolveRemoteScriptTarget(_0x4f1506,_0x19b318,_0x51cb60,_0x1e79f9[_0x23b472(0x17c)],_0xd42c0a);if(!_0x1d4bfb){_0x88ef88['push']({'lockKey':_0x19b318[_0x23b472(0x1dd)]+'/'+_0x19b318[_0x23b472(0x1c7)],'reason':_0x23b472(0x1c6)});continue;}const _0x4a19cf=_0x1e79f9[_0x23b472(0x17c)][_0x1d4bfb[_0x23b472(0x1ad)]];try{if(!_0x19b318['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x19b318[_0x23b472(0x166)]==null)throw new Error(_0x23b472(0x157));const _0x1ff23f=_0x19b318['scriptContent'],_0x5f5cc7=computeContentHash(_0x1ff23f);if(!_0x2f023f){const _0x13320a=await hasUnsyncedLocalChanges(_0x1d4bfb['filePath'],_0x4a19cf,_0x5f5cc7);if(_0x13320a){_0x281587[_0x23b472(0x18e)](localUnsyncedConflict(_0x1d4bfb,_0x19b318['id']));continue;}}await _0x2f86ca[_0x23b472(0x1d9)](_0x1d4bfb[_0x23b472(0x186)],_0x1ff23f);const _0x510089={'hash':_0x5f5cc7,'remoteId':_0x19b318['id'],'version':_0x19b318['version']};_0x1d4bfb[_0x23b472(0x193)]===_0x23b472(0x191)&&_0x1d4bfb[_0x23b472(0x1d3)]&&(_0x510089[_0x23b472(0x194)]=_0x1d4bfb[_0x23b472(0x1d3)][_0x23b472(0x194)],_0x510089['datasetCode']=_0x1d4bfb['hookLocation'][_0x23b472(0x1c0)],_0x510089['operationType']=_0x1d4bfb[_0x23b472(0x1d3)][_0x23b472(0x1bc)],_0x510089[_0x23b472(0x1b1)]=_0x1d4bfb[_0x23b472(0x1d3)][_0x23b472(0x1b1)]),_0x1e79f9[_0x23b472(0x17c)][_0x1d4bfb[_0x23b472(0x1ad)]]=_0x510089,_0x1d7096[_0x23b472(0x18e)]({'lockKey':_0x1d4bfb[_0x23b472(0x1ad)],'remoteId':_0x19b318['id']});}catch(_0x542d78){_0x24a3f3[_0x23b472(0x18e)]({'lockKey':_0x1d4bfb[_0x23b472(0x1ad)],'error':_0x542d78 instanceof Error?_0x542d78[_0x23b472(0x14c)]:String(_0x542d78)});}}_0x1e79f9[_0x23b472(0x16e)]=new Date()[_0x23b472(0x1b8)]();try{await writeBffLockFile(_0x4f1506[_0x23b472(0x17e)],_0x4ef5c5);}catch(_0x2af6bb){const _0x2b0cb8=[...await _0x2f86ca[_0x23b472(0x1da)](),...await _0x1e3c13?.[_0x23b472(0x1da)]()??[]];throw withRollbackErrors(_0x2af6bb,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x2b0cb8);}return{'ok':_0x24a3f3['length']===0x0,'data':{'pulled':_0x1d7096,'skipped':_0x88ef88,'conflicts':_0x281587,'failed':_0x24a3f3},'message':formatPullMessage(_0x1d7096[_0x23b472(0x16a)],_0x88ef88['length'],_0x281587['length'],_0x24a3f3[_0x23b472(0x16a)])};}};function localUnsyncedConflict(_0x5c725d,_0xab7697){const _0x47bb57=a43_0x27f8d1,_0x9b1552=_0x5c725d[_0x47bb57(0x1ad)][_0x47bb57(0x171)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x5c725d[_0x47bb57(0x1ad)],'filePath':_0x5c725d['filePath'],..._0xab7697!=null?{'remoteId':_0xab7697}:{},'message':_0x47bb57(0x15a),'nextAction':{'action':_0x47bb57(0x177),'command':CLI_BIN_NAME+_0x47bb57(0x1ae)+_0x5c725d['type']+_0x47bb57(0x1bf)+_0x9b1552+_0x47bb57(0x188),'requiresReview':!![],'message':_0x47bb57(0x1c2)}};}function formatPullMessage(_0x3246a8,_0x1bb502,_0x5f4c67,_0xf6cfcf){const _0x519cb6=a43_0x27f8d1,_0x4a447f=['Pull\x20complete:\x20'+_0x3246a8+_0x519cb6(0x155),_0x1bb502+_0x519cb6(0x1a5)];_0x5f4c67>0x0&&_0x4a447f[_0x519cb6(0x18e)](_0x5f4c67+'\x20conflict'+(_0x5f4c67===0x1?'':'s')+'\x20'+(_0x5f4c67===0x1?_0x519cb6(0x1d4):'require')+'\x20resolution');if(_0xf6cfcf>0x0)_0x4a447f[_0x519cb6(0x18e)](_0xf6cfcf+_0x519cb6(0x152));return _0x4a447f[_0x519cb6(0x174)](',\x20');}async function hasUnsyncedLocalChanges(_0x5930,_0x273b49,_0x755c48){const _0x2683dc=a43_0x27f8d1;if(!await fileExists(_0x5930))return![];const _0x4aab34=await computeFileHash(_0x5930);if(!_0x273b49)return _0x755c48?_0x4aab34!==_0x755c48:!![];return _0x4aab34!==_0x273b49[_0x2683dc(0x1a4)];}function createPullFileTransaction(){const _0x5954bc=new Map(),_0x58d838=async(_0x2f491f,_0x5c5241)=>{const _0x1896da=a43_0x7e08;try{if(_0x5c5241[_0x1896da(0x149)])await ensureParentDirectory(_0x2f491f),await writeFile(_0x2f491f,_0x5c5241[_0x1896da(0x156)]);else try{await unlink(_0x2f491f);}catch(_0x357be4){if(_0x357be4[_0x1896da(0x1aa)]!==_0x1896da(0x160))throw _0x357be4;}return undefined;}catch(_0x9669b1){return _0x9669b1 instanceof Error?_0x9669b1:new Error(String(_0x9669b1));}};return{async 'write'(_0x157320,_0x2a344e){const _0x369880=a43_0x7e08;if(!_0x5954bc['has'](_0x157320))try{_0x5954bc[_0x369880(0x1a8)](_0x157320,{'existed':!![],'content':await readFile(_0x157320)});}catch(_0x755c0d){if(_0x755c0d['code']!==_0x369880(0x160))throw _0x755c0d;_0x5954bc[_0x369880(0x1a8)](_0x157320,{'existed':![]});}try{await ensureParentDirectory(_0x157320),await writeFile(_0x157320,_0x2a344e,_0x369880(0x1b0));}catch(_0x3421bc){const _0x59afc7=await _0x58d838(_0x157320,_0x5954bc[_0x369880(0x15f)](_0x157320));if(!_0x59afc7)_0x5954bc[_0x369880(0x1b9)](_0x157320);throw withRollbackErrors(_0x3421bc,_0x369880(0x1a7)+_0x157320+'\x22.',_0x59afc7?[_0x59afc7]:[]);}},async 'rollback'(){const _0x2d6f17=a43_0x7e08,_0x2b2053=[];for(const [_0x1a8bb7,_0x4ae69e]of[..._0x5954bc[_0x2d6f17(0x18b)]()][_0x2d6f17(0x19c)]()){const _0x3d161e=await _0x58d838(_0x1a8bb7,_0x4ae69e);_0x3d161e&&_0x2b2053[_0x2d6f17(0x18e)](new Error(_0x2d6f17(0x1cd)+_0x1a8bb7+_0x2d6f17(0x1be)+_0x3d161e[_0x2d6f17(0x14c)]));}return _0x2b2053;}};}function withRollbackErrors(_0x3f0b7f,_0x5ae34c,_0xdd61ad){const _0x1f6d1c=a43_0x27f8d1,_0x4a9eab=_0x3f0b7f instanceof Error?_0x3f0b7f:new Error(String(_0x3f0b7f));if(_0xdd61ad[_0x1f6d1c(0x16a)]===0x0)return _0x4a9eab;return new AggregateError([_0x4a9eab,..._0xdd61ad],_0x5ae34c+_0x1f6d1c(0x167)+_0xdd61ad[_0x1f6d1c(0x1b3)](_0x382469=>_0x382469[_0x1f6d1c(0x14c)])[_0x1f6d1c(0x174)](';\x20'));}function buildDatasetCodeToAliasMap(_0x4baf42,_0xc82e4a,_0x36d93f){const _0xfdd774=a43_0x27f8d1,_0x3dae37=resolveApiModelSource(_0x4baf42,_0xc82e4a,_0x36d93f),_0x3da54b=loadAliasMap(_0x4baf42,undefined,_0x3dae37[_0xfdd774(0x186)],_0x3dae37[_0xfdd774(0x14b)]);return assertUnambiguousHookAliases(_0x3da54b),new Map(_0x3da54b[_0xfdd774(0x1b3)](_0x27e2bc=>[_0x27e2bc[_0xfdd774(0x1c0)]['toLowerCase'](),_0x27e2bc['alias']]));}async function planHookDirectoryMigration(_0x13bc75,_0x3cf4ce,_0x27c476,_0x44824d){const _0x393464=a43_0x27f8d1,_0x4654bf=new Map();for(const [_0x43b45b,_0x55bc21]of Object['entries'](_0x3cf4ce[_0x393464(0x17c)])){const [_0x14834b,_0x25b6eb,_0xbd58e2,_0x2c072e,_0x275135,..._0x308ecb]=_0x43b45b[_0x393464(0x171)]('/');if(_0x14834b!=='HOOK'||!_0x25b6eb||!_0xbd58e2||!_0x2c072e||!_0x275135||_0x308ecb[_0x393464(0x16a)]>0x0||!_0x55bc21['datasetCode'])continue;const _0x465d0a=_0x27c476[_0x393464(0x15f)](_0x55bc21[_0x393464(0x1c0)][_0x393464(0x169)]()),_0x452c06=_0x465d0a??_0x55bc21[_0x393464(0x1c0)];if(!isSafeHookDirectorySegment(_0x25b6eb))throw CliErrors[_0x393464(0x162)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x25b6eb+_0x393464(0x192));if(!isSafeHookDirectorySegment(_0x452c06))throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x25b6eb+_0x393464(0x1af));if(_0x25b6eb===_0x452c06)continue;const _0x294ec1=_0x4654bf[_0x393464(0x15f)](_0x25b6eb)??{'datasetCode':_0x55bc21[_0x393464(0x1c0)],'alias':_0x465d0a,'keyChanges':[]};if(_0x294ec1[_0x393464(0x1c0)]!==_0x55bc21[_0x393464(0x1c0)])throw CliErrors[_0x393464(0x162)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x25b6eb+'\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.');const _0x35c01a=_0x393464(0x18c)+_0x452c06+'/'+_0xbd58e2+'/'+_0x2c072e+'/'+_0x275135;try{resolveLocalFilePathFromLockKey(_0x13bc75,_0x43b45b),resolveLocalFilePathFromLockKey(_0x13bc75,_0x35c01a);}catch(_0x2a29aa){throw CliErrors[_0x393464(0x162)](_0x393464(0x198)+_0x43b45b+'\x22:\x20'+(_0x2a29aa instanceof Error?_0x2a29aa['message']:String(_0x2a29aa)));}_0x294ec1[_0x393464(0x190)][_0x393464(0x18e)]({'oldLockKey':_0x43b45b,'newLockKey':_0x35c01a,'entry':_0x55bc21}),_0x4654bf[_0x393464(0x1a8)](_0x25b6eb,_0x294ec1);}const _0x3b53c5=new Set([..._0x4654bf['values']()][_0x393464(0x181)](_0x29abd6=>_0x29abd6['keyChanges'][_0x393464(0x1b3)](_0x12ec3e=>_0x12ec3e[_0x393464(0x1b6)]))),_0x242e80=new Map(),_0x3a0164=new Map();for(const [_0x43974c,_0x152bf4]of _0x4654bf){const _0x215067=_0x152bf4[_0x393464(0x194)]??_0x152bf4[_0x393464(0x1c0)],_0xeadcfb=hookDirectoryIdentity(_0x215067),_0x136a46=_0x242e80[_0x393464(0x15f)](_0xeadcfb);if(_0x136a46&&_0x136a46!==_0x43974c)throw CliErrors[_0x393464(0x162)](_0x393464(0x199)+_0x136a46+_0x393464(0x165)+_0x43974c+_0x393464(0x151)+_0x215067+_0x393464(0x172));_0x242e80['set'](_0xeadcfb,_0x43974c);for(const _0x518712 of _0x152bf4['keyChanges']){const _0xf7d6d7=_0x3a0164[_0x393464(0x15f)](_0x518712[_0x393464(0x146)]);if(_0xf7d6d7&&_0xf7d6d7!==_0x518712['oldLockKey'])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0xf7d6d7+_0x393464(0x165)+_0x518712[_0x393464(0x1b6)]+_0x393464(0x151)+_0x518712['newLockKey']+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x3b53c5[_0x393464(0x189)](_0x518712[_0x393464(0x146)]))throw CliErrors['validation'](_0x393464(0x182)+_0x518712[_0x393464(0x1b6)]+_0x393464(0x197)+_0x518712[_0x393464(0x146)]+_0x393464(0x1a6));_0x3a0164[_0x393464(0x1a8)](_0x518712[_0x393464(0x146)],_0x518712[_0x393464(0x1b6)]);}}const _0x40d254=new Map();for(const [_0x7af792,_0xbd402d]of _0x27c476){_0x40d254['set'](hookDirectoryIdentity(_0xbd402d),_0x7af792);}const _0x371e30=[];for(const [_0x443f4f,_0x4f50dc]of _0x4654bf){const _0x15203d=_0x4f50dc[_0x393464(0x194)]??_0x4f50dc[_0x393464(0x1c0)],_0xc25484=join(_0x13bc75['scriptsRootDir'],'HOOK',_0x443f4f),_0x1b8034=join(_0x13bc75['scriptsRootDir'],_0x393464(0x191),_0x15203d),_0x33b6a2=await directoryExists(_0xc25484),_0x1cfc51=await directoryExists(_0x1b8034),_0x20c344=_0x33b6a2?_0x1cfc51?await sameDirectory(_0xc25484,_0x1b8034)?_0x393464(0x17f):undefined:_0x393464(0x153):_0x393464(0x1d2);if(!_0x20c344)throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x443f4f+'\x22\x20to\x20\x22'+_0x15203d+_0x393464(0x163));const _0x362742=_0x40d254[_0x393464(0x15f)](hookDirectoryIdentity(_0x443f4f));if(_0x362742&&_0x362742!==_0x4f50dc[_0x393464(0x1c0)][_0x393464(0x169)]()){const _0x201940=new Set(_0x4f50dc['keyChanges']['map'](_0x1f79dc=>_0x1f79dc[_0x393464(0x1b6)])),_0x49e405=_0x44824d[_0x393464(0x185)](_0x65eaeb=>_0x65eaeb[_0x393464(0x193)]===_0x393464(0x191)&&_0x65eaeb['alias']!=null&&hookDirectoryIdentity(_0x65eaeb[_0x393464(0x194)])===hookDirectoryIdentity(_0x443f4f)&&!_0x201940['has'](_0x65eaeb['lockKey']));if(_0x49e405[_0x393464(0x16a)]>0x0)throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x443f4f+_0x393464(0x19d));}const _0x15760b=_0x40d254[_0x393464(0x15f)](hookDirectoryIdentity(_0x15203d));if(_0x15760b&&_0x15760b!==_0x4f50dc[_0x393464(0x1c0)]['toLowerCase']())throw CliErrors['validation'](_0x393464(0x16c)+_0x443f4f+_0x393464(0x159)+_0x15203d+_0x393464(0x1c5));for(const _0x4ab9c7 of _0x4f50dc[_0x393464(0x190)]){const _0x57a42f=_0x3cf4ce[_0x393464(0x17c)][_0x4ab9c7[_0x393464(0x146)]];if(_0x57a42f&&!_0x3b53c5['has'](_0x4ab9c7['newLockKey'])&&!sameHookIdentity(_0x4ab9c7[_0x393464(0x1ca)],_0x57a42f))throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x443f4f+_0x393464(0x159)+_0x15203d+_0x393464(0x154));}_0x371e30[_0x393464(0x18e)]({'oldDirectory':_0x443f4f,'newDirectory':_0x15203d,'oldDirectoryPath':_0xc25484,'newDirectoryPath':_0x1b8034,'mode':_0x20c344,'alias':_0x4f50dc[_0x393464(0x194)],'keyChanges':_0x4f50dc[_0x393464(0x190)]});}const _0x4cf6f1={..._0x3cf4ce['functions']},_0x5cbf4b=new Map(),_0x1d508b=new Map();for(const _0x597274 of _0x371e30){const _0x559060=_0x597274[_0x393464(0x1b2)]!=='rekey';_0x559060&&_0x1d508b[_0x393464(0x1a8)](hookDirectoryIdentity(_0x597274['newDirectory']),_0x597274[_0x393464(0x16d)]);for(const _0x5392ed of _0x597274[_0x393464(0x190)]){const _0x1650c4=_0x4cf6f1[_0x5392ed[_0x393464(0x146)]],_0x4fd37c=_0x559060?_0x5392ed['entry']:_0x1650c4??_0x5392ed[_0x393464(0x1ca)];_0x4cf6f1[_0x5392ed[_0x393464(0x146)]]=canonicalizeHookEntry(_0x4fd37c,_0x597274['alias']),delete _0x4cf6f1[_0x5392ed['oldLockKey']],_0x559060&&_0x5cbf4b[_0x393464(0x1a8)](_0x5392ed[_0x393464(0x146)],resolveLocalFilePathFromLockKey(_0x13bc75,_0x5392ed['oldLockKey']));}}return{'migrations':_0x371e30,'projectedFunctions':_0x4cf6f1,'sourceFilePathByNewLockKey':_0x5cbf4b,'sourceDirectoryPathByNewDirectory':_0x1d508b};}function resolveMigratedSourceFilePath(_0x56d53a,_0x5f7d76){const _0x5cb5e4=a43_0x27f8d1;if(!_0x56d53a||!_0x5f7d76)return undefined;const _0x269691=_0x56d53a[_0x5cb5e4(0x1de)][_0x5cb5e4(0x15f)](_0x5f7d76[_0x5cb5e4(0x1ad)]);if(_0x269691)return _0x269691;if(_0x5f7d76[_0x5cb5e4(0x193)]!=='HOOK')return undefined;const [,_0x52f787,..._0x4ccfc7]=_0x5f7d76[_0x5cb5e4(0x1ad)]['split']('/');if(!_0x52f787||_0x4ccfc7[_0x5cb5e4(0x16a)]===0x0)return undefined;const _0x51ec8b=_0x56d53a[_0x5cb5e4(0x18a)]['get'](hookDirectoryIdentity(_0x52f787));return _0x51ec8b?join(_0x51ec8b,..._0x4ccfc7)+_0x5cb5e4(0x1b4):undefined;}function sameHookIdentity(_0x5d9e5e,_0x474b29){const _0x2b9013=a43_0x27f8d1;return _0x5d9e5e[_0x2b9013(0x1c1)]===_0x474b29[_0x2b9013(0x1c1)]&&_0x5d9e5e[_0x2b9013(0x1c0)]===_0x474b29['datasetCode']&&_0x5d9e5e[_0x2b9013(0x1bc)]===_0x474b29[_0x2b9013(0x1bc)]&&_0x5d9e5e[_0x2b9013(0x1b1)]===_0x474b29[_0x2b9013(0x1b1)];}function canonicalizeHookEntry(_0x4fdd10,_0x599d02){const {alias:_0x42df26,..._0x2984ab}=_0x4fdd10;return _0x599d02?{..._0x2984ab,'alias':_0x599d02}:_0x2984ab;}function hookDirectoryIdentity(_0x2dd194){const _0x245cc9=a43_0x27f8d1;return _0x2dd194['normalize'](_0x245cc9(0x1bb))[_0x245cc9(0x169)]();}function isSafeHookDirectorySegment(_0x5131b7){return isSafeLockKeySegment(_0x5131b7);}async function sameDirectory(_0x566b38,_0x31a9bb){const _0x35cbe6=a43_0x27f8d1,[_0x5c3ad4,_0x7f32d]=await Promise[_0x35cbe6(0x1ab)]([stat(_0x566b38),stat(_0x31a9bb)]);return _0x5c3ad4[_0x35cbe6(0x187)]===_0x7f32d['dev']&&_0x5c3ad4[_0x35cbe6(0x15b)]===_0x7f32d['ino'];}function a43_0x395a(){const _0x5333c6=['pull','split','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','join','mergedCli','currentApp','push_local','.hook-directory-migrate-','stderr','force','356527kMGqiU','functions','trim','lockFilePath','case-rename','nonInteractive','flatMap','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','scriptsRoot','selectedAppName','filter','filePath','dev','\x20--format\x20compress','has','sourceDirectoryPathByNewDirectory','entries','HOOK/','198RbqEhA','push','parse','keyChanges','HOOK','\x22\x20from\x20the\x20lock\x20file.','type','alias','3230283gyZsmW','\x22\x20from\x20\x22','\x22:\x20its\x20target\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','2FmErmS','apiDir','reverse','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Force\x20pull\x20cancelled.','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22;\x20temporary\x20directory\x20\x22','defaultApp','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Lock\x20scope\x20for\x20app\x20\x22','hash','\x20skipped','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Failed\x20to\x20write\x20local\x20script\x20\x22','set','\x22\x20may\x20remain.','code','all','str','lockKey','\x20bff\x20push\x20--type\x20','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','utf8','functionNode','mode','map','.js','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','oldLockKey','question','toISOString','delete','266664tlfuuQ','NFC','operationType','skipped','\x22:\x20','\x20--name\x20','datasetCode','remoteId','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.','some','newDirectory','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','unresolvable\x20target\x20path','functionName','includes','read','entry','Force\x20overwrite\x20local\x20unsynced\x20changes','newDirectoryPath','Could\x20not\x20restore\x20local\x20script\x20\x22','3390tujokZ','stringify','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','rekey','hookLocation','requires','9geKftS','appCode','would_pull','projectedFunctions','write','rollback','3468qcVMGx','Would\x20inspect\x20','scriptType','sourceFilePathByNewLockKey','newLockKey','bff','84050YOwAjb','existed','GET','profileName','message','COMMON','4069RCEnvK','yes','/api/management/library/scripts/list?appCode=','\x22:\x20both\x20target\x20\x22','\x20failed','move','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x20pulled','content','Remote\x20script\x20missing\x20content.','oldDirectory','\x22\x20to\x20\x22','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','ino','cancelled','boolean','&type=','get','ENOENT','migrations','validation','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','stdin','\x22\x20and\x20\x22','scriptContent','\x20Recovery\x20errors:\x20','1000792RGxDIE','toLowerCase','length','895Aqhaft','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','oldDirectoryPath','lastSync','8rvVuVf'];a43_0x395a=function(){return _0x5333c6;};return a43_0x395a();}async function applyHookDirectoryMigration(_0x2fcf23,_0xf060e0){const _0x32767e=a43_0x27f8d1,_0x1dd855=_0xf060e0[_0x32767e(0x17c)],_0x5aa4fe=_0xf060e0[_0x32767e(0x16e)],_0x3a05d6=[],_0x1b50f3=async()=>{const _0x15fe69=_0x32767e,_0x498e6f=[];_0xf060e0[_0x15fe69(0x17c)]=_0x1dd855,_0xf060e0[_0x15fe69(0x16e)]=_0x5aa4fe;for(const {migration:_0x2e1f4a,temporaryPath:_0x3a7d78}of[..._0x3a05d6][_0x15fe69(0x19c)]()){try{_0x3a7d78?(await rename(_0x2e1f4a[_0x15fe69(0x1cc)],_0x3a7d78),await rename(_0x3a7d78,_0x2e1f4a['oldDirectoryPath'])):await rename(_0x2e1f4a[_0x15fe69(0x1cc)],_0x2e1f4a[_0x15fe69(0x16d)]);}catch(_0x4c0119){_0x498e6f[_0x15fe69(0x18e)](new Error(_0x15fe69(0x1d0)+_0x2e1f4a[_0x15fe69(0x158)]+_0x15fe69(0x196)+_0x2e1f4a[_0x15fe69(0x1c4)]+_0x15fe69(0x1be)+(_0x4c0119 instanceof Error?_0x4c0119[_0x15fe69(0x14c)]:String(_0x4c0119))));}}return _0x498e6f;};try{for(const _0x286b6c of _0x2fcf23[_0x32767e(0x161)]){if(_0x286b6c[_0x32767e(0x1b2)]==='move')await ensureParentDirectory(_0x286b6c['newDirectoryPath']),await rename(_0x286b6c[_0x32767e(0x16d)],_0x286b6c[_0x32767e(0x1cc)]),_0x3a05d6[_0x32767e(0x18e)]({'migration':_0x286b6c});else{if(_0x286b6c[_0x32767e(0x1b2)]===_0x32767e(0x17f)){const _0x8efd21=join(dirname(_0x286b6c['oldDirectoryPath']),_0x32767e(0x178)+randomUUID());await rename(_0x286b6c['oldDirectoryPath'],_0x8efd21);try{await rename(_0x8efd21,_0x286b6c[_0x32767e(0x1cc)]);}catch(_0x25830d){try{await rename(_0x8efd21,_0x286b6c['oldDirectoryPath']);}catch(_0x2395eb){throw withRollbackErrors(_0x25830d,_0x32767e(0x19f)+_0x286b6c['oldDirectory']+_0x32767e(0x159)+_0x286b6c[_0x32767e(0x1c4)]+_0x32767e(0x1a0)+_0x8efd21+_0x32767e(0x1a9),[new Error(_0x32767e(0x1d1)+_0x8efd21+_0x32767e(0x159)+_0x286b6c['oldDirectory']+_0x32767e(0x1be)+(_0x2395eb instanceof Error?_0x2395eb[_0x32767e(0x14c)]:String(_0x2395eb)))]);}throw _0x25830d;}_0x3a05d6['push']({'migration':_0x286b6c,'temporaryPath':_0x8efd21});}}}return _0xf060e0['functions']=_0x2fcf23[_0x32767e(0x1d8)],{'rollback':_0x1b50f3};}catch(_0x3243e0){const _0x50afdd=await _0x1b50f3();throw withRollbackErrors(_0x3243e0,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x50afdd);}}async function confirmForce(){const _0x28e91a=a43_0x27f8d1,_0x18ebea=createInterface({'input':process[_0x28e91a(0x164)],'output':process[_0x28e91a(0x179)]}),_0x56f697=await new Promise(_0x3fa172=>{const _0x8227cc=_0x28e91a;_0x18ebea[_0x8227cc(0x1b7)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x3fa172);});return _0x18ebea['close'](),['y',_0x28e91a(0x14f)][_0x28e91a(0x1c8)](_0x56f697[_0x28e91a(0x17d)]()[_0x28e91a(0x169)]());}
|