@lovrabet/rabetbase-cli 2.5.10-beta.2 → 2.5.10-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- 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.d.ts +2 -2
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.d.ts +3 -0
- package/lib/commands/issue/context.js +1 -0
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -2
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase/references/rabetbase-issue-report.md +4 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
- package/lib/commands/issue/shared.d.ts +0 -32
- package/lib/commands/issue/shared.js +0 -1
- package/lib/telemetry/send-platform-issue-collect-log.d.ts +0 -26
- package/lib/telemetry/send-platform-issue-collect-log.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x2731bb=a34_0x854d;(function(_0x5380f7,_0x156787){const _0x5bcaca=a34_0x854d,_0x2dbaf6=_0x5380f7();while(!![]){try{const _0x4e6443=-parseInt(_0x5bcaca(0xef))/0x1*(parseInt(_0x5bcaca(0xed))/0x2)+-parseInt(_0x5bcaca(0x105))/0x3*(parseInt(_0x5bcaca(0xf4))/0x4)+parseInt(_0x5bcaca(0xff))/0x5*(-parseInt(_0x5bcaca(0x108))/0x6)+-parseInt(_0x5bcaca(0xf8))/0x7+-parseInt(_0x5bcaca(0x101))/0x8*(-parseInt(_0x5bcaca(0xf2))/0x9)+parseInt(_0x5bcaca(0xf3))/0xa+parseInt(_0x5bcaca(0xf6))/0xb*(parseInt(_0x5bcaca(0x103))/0xc);if(_0x4e6443===_0x156787)break;else _0x2dbaf6['push'](_0x2dbaf6['shift']());}catch(_0x293d40){_0x2dbaf6['push'](_0x2dbaf6['shift']());}}}(a34_0x21e5,0x5d836));function a34_0x21e5(){const _0x143e1e=['399hWVitl','isFinite','\x20app\x20config\x20','522EVzMwP','/smartapi/app-config/update','/smartapi/app-config/create','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','6706vtUiAr','get','77senQJt','app-config','apiError','639xkJPWM','6736530IUGlMY','552JEdHVX','number','297935RqHgkb','string','3592687OoMOWH','tags','Updated','App\x20config\x20server\x20id\x20missing\x20for\x20key=','update','file',',\x20appCode=','16215RXBMNb','create','36152CDMdkU','appCode','204vGJeVq','Created'];a34_0x21e5=function(){return _0x143e1e;};return a34_0x21e5();}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_0x854d(_0x5a97ca,_0x48dd5a){_0x5a97ca=_0x5a97ca-0xed;const _0x21e556=a34_0x21e5();let _0x854d96=_0x21e556[_0x5a97ca];return _0x854d96;}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_0x2731bb(0x10a),UPDATE_PATH=a34_0x2731bb(0x109);export const appConfigSet={'service':a34_0x2731bb(0xf0),'command':'set','description':a34_0x2731bb(0x10b),'risk':'write','args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x2731bb(0xfd),'type':a34_0x2731bb(0xf7),'description':'Read\x20config\x20value\x20from\x20file'}],async 'validate'(_0x4bdd13){readKeyArg(_0x4bdd13),readOptionalTags(_0x4bdd13),assertSingleValueSource(_0x4bdd13);},async 'dryRun'(_0x227125){const _0x51515d=a34_0x2731bb,_0x125e99=readKeyArg(_0x227125),_0x33b6fc=readOptionalTags(_0x227125),_0x573bf3=assertSingleValueSource(_0x227125);await assertValueSourceReadable(_0x573bf3);const _0x18e572=await withAppConfigApiBoundary(_0x51515d(0xee),{'appCode':_0x227125['appCode'],'key':_0x125e99},()=>getAppConfigByKey(_0x227125[_0x51515d(0x102)],_0x125e99)),_0x5632b3=_0x18e572?_0x51515d(0xfc):_0x51515d(0x100),_0x4475d9=_0x18e572?projectAppConfig(_0x18e572):null,_0x205aec=plannedAppConfig({'appCode':_0x227125[_0x51515d(0x102)],'key':_0x125e99,'tags':_0x33b6fc??_0x18e572?.[_0x51515d(0xf9)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x5632b3,'appCode':_0x227125[_0x51515d(0x102)],'key':_0x125e99,'before':_0x4475d9,'after':_0x205aec,'dryRun':!![]}),{'method':'POST','url':_0x5632b3===_0x51515d(0xfc)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x22d861){const _0x3363d4=a34_0x2731bb,_0x1c0fb1=readKeyArg(_0x22d861),_0x28016c=readOptionalTags(_0x22d861),_0x50ef1=await withAppConfigApiBoundary(_0x3363d4(0xee),{'appCode':_0x22d861[_0x3363d4(0x102)],'key':_0x1c0fb1},()=>getAppConfigByKey(_0x22d861[_0x3363d4(0x102)],_0x1c0fb1)),_0x399719=_0x50ef1?projectAppConfig(_0x50ef1):null,_0x498278=_0x50ef1?_0x3363d4(0xfc):_0x3363d4(0x100),{value:_0x2832bd,warnings:_0x263072}=await readAppConfigValue(_0x22d861),_0x4fe2d9={'appCode':_0x22d861[_0x3363d4(0x102)],'key':_0x1c0fb1,'value':_0x2832bd,'tags':_0x28016c??_0x50ef1?.['tags']??undefined};await withAppConfigApiBoundary(_0x498278,{'appCode':_0x22d861[_0x3363d4(0x102)],'key':_0x1c0fb1},async()=>{const _0x28c445=_0x3363d4;_0x50ef1?await updateAppConfig({..._0x4fe2d9,'id':requireAppConfigId(_0x50ef1,_0x1c0fb1,_0x22d861[_0x28c445(0x102)])}):await createAppConfig(_0x4fe2d9);});const _0x17652a=await withAppConfigApiBoundary(_0x3363d4(0xee),{'appCode':_0x22d861['appCode'],'key':_0x1c0fb1},()=>getAppConfigByKey(_0x22d861[_0x3363d4(0x102)],_0x1c0fb1)),_0x181412=_0x17652a?projectAppConfig(_0x17652a):plannedAppConfig({'appCode':_0x22d861['appCode'],'key':_0x1c0fb1,'tags':_0x4fe2d9[_0x3363d4(0xf9)],'hasValue':_0x2832bd!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x498278,'appCode':_0x22d861[_0x3363d4(0x102)],'key':_0x1c0fb1,'before':_0x399719,'after':_0x181412,'dryRun':![],'warnings':_0x263072}),'message':(_0x498278===_0x3363d4(0xfc)?_0x3363d4(0xfa):_0x3363d4(0x104))+_0x3363d4(0x107)+_0x1c0fb1};}};function requireAppConfigId(_0x430c29,_0x1cea87,_0x9c16dc){const _0x513fca=a34_0x2731bb;if(typeof _0x430c29['id']===_0x513fca(0xf5)&&Number[_0x513fca(0x106)](_0x430c29['id'])&&_0x430c29['id']>0x0)return _0x430c29['id'];throw CliErrors[_0x513fca(0xf1)](_0x513fca(0xfb)+_0x1cea87+_0x513fca(0xfe)+_0x9c16dc);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x571932=a35_0x2ee8;function a35_0x2ee8(_0x4e89d9,_0x25cb0d){_0x4e89d9=_0x4e89d9-0x64;const _0x58f926=a35_0x58f9();let _0x2ee839=_0x58f926[_0x4e89d9];return _0x2ee839;}(function(_0x4024f7,_0x5d9456){const _0xb76e48=a35_0x2ee8,_0x24c57a=_0x4024f7();while(!![]){try{const _0x3a3089=-parseInt(_0xb76e48(0x89))/0x1+parseInt(_0xb76e48(0x80))/0x2*(-parseInt(_0xb76e48(0x95))/0x3)+parseInt(_0xb76e48(0x79))/0x4*(-parseInt(_0xb76e48(0x6f))/0x5)+parseInt(_0xb76e48(0x74))/0x6*(parseInt(_0xb76e48(0x6b))/0x7)+parseInt(_0xb76e48(0x94))/0x8*(-parseInt(_0xb76e48(0x67))/0x9)+parseInt(_0xb76e48(0xa1))/0xa*(parseInt(_0xb76e48(0x76))/0xb)+parseInt(_0xb76e48(0x9e))/0xc;if(_0x3a3089===_0x5d9456)break;else _0x24c57a['push'](_0x24c57a['shift']());}catch(_0x3df9c4){_0x24c57a['push'](_0x24c57a['shift']());}}}(a35_0x58f9,0xa6135));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x571932(0x7d),'description':'Runtime\x20app-config\x20key','required':!![]};export const VALUE_ARG={'name':a35_0x571932(0x91),'description':a35_0x571932(0x70),'required':![]};export const TAGS_FLAG={'name':'tags','type':a35_0x571932(0x9a),'description':a35_0x571932(0x92)};export const STDIN_FLAG={'name':'stdin','type':a35_0x571932(0x68),'description':a35_0x571932(0x81),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x571932(0x82),'type':a35_0x571932(0x9a),'description':a35_0x571932(0x85)};export const REVEAL_FLAG={'name':'reveal','type':'boolean','description':'Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','default':![]};export function readKeyArg(_0x57f166){const _0x28e86f=a35_0x571932,_0x1b56f5=_0x57f166[_0x28e86f(0x7f)][0x0]?.[_0x28e86f(0x9f)]()??'';return validateKey(_0x1b56f5),_0x1b56f5;}export function readOptionalTags(_0x3e4930){const _0x44c9f2=a35_0x571932,_0x3e4e62=_0x3e4930[_0x44c9f2(0x8f)]('tags')[_0x44c9f2(0x9f)]();if(!_0x3e4e62)return undefined;if(_0x3e4e62[_0x44c9f2(0x6a)]>0x20)throw CliErrors[_0x44c9f2(0x69)]('App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.');return _0x3e4e62;}export function validateKey(_0xb7998b){const _0x15fb2b=a35_0x571932;if(!_0xb7998b)throw CliErrors[_0x15fb2b(0x69)](_0x15fb2b(0x6e));if(_0xb7998b[_0x15fb2b(0x6a)]>0x100)throw CliErrors[_0x15fb2b(0x69)]('App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.');}export function projectAppConfig(_0x5d2f77,_0x387b77){const _0x2def92=a35_0x571932,_0xc5a42=_0x5d2f77[_0x2def92(0x91)]!==undefined&&_0x5d2f77['value']!==null&&_0x5d2f77['value']!=='',_0xd7fbc8={'appCode':_0x5d2f77[_0x2def92(0x97)],'key':_0x5d2f77[_0x2def92(0x7d)],'tags':_0x5d2f77[_0x2def92(0x77)]??undefined,'hasValue':_0xc5a42,'valueRedacted':_0xc5a42&&!_0x387b77?.[_0x2def92(0x72)],'gmtCreate':_0x5d2f77[_0x2def92(0x64)],'gmtModified':_0x5d2f77[_0x2def92(0x93)]};return _0x387b77?.['reveal']&&(_0xd7fbc8[_0x2def92(0x91)]=_0x5d2f77[_0x2def92(0x91)]??'',_0xd7fbc8[_0x2def92(0x73)]=![]),_0xd7fbc8;}export function plannedAppConfig(_0x174361){const _0x34a538=a35_0x571932,_0x1deb28=_0x174361[_0x34a538(0x83)]??!![];return{'appCode':_0x174361[_0x34a538(0x97)],'key':_0x174361['key'],'tags':_0x174361['tags']??undefined,'hasValue':_0x1deb28,'valueRedacted':_0x1deb28};}export function buildMutationData(_0x5ccbb0){const _0x47a079=a35_0x571932;return{'operation':_0x5ccbb0[_0x47a079(0x96)],'selector':{'appCode':_0x5ccbb0[_0x47a079(0x97)],'key':_0x5ccbb0[_0x47a079(0x7d)]},'before':_0x5ccbb0[_0x47a079(0x98)],'after':_0x5ccbb0[_0x47a079(0x7c)],'dryRun':_0x5ccbb0['dryRun'],'warnings':_0x5ccbb0['warnings']??[]};}function a35_0x58f9(){const _0x5bec6d=['from-env','hasValue','appCode:\x20','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','flag','name','stdin','1182049dHLZzW','value\x20is\x20redacted','slice','file','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','key:\x20','str','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','value','Config\x20tags\x20for\x20filtering/display\x20metadata','gmtModified','164568siyLBq','4014858AClIoF','operation','appCode','before','utf8','string','Environment\x20variable\x20is\x20not\x20set:\x20','url','join','32050452nrPCjC','trim','once','10JiIXPk','setEncoding','gmtCreate','argument','end','261xfgdbH','boolean','validation','length','2857463UvmyRQ','kind','Failed\x20to\x20','Missing\x20app-config\x20key.','5CvkNJu','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','env','reveal','valueRedacted','18BLRfwj','bool','13021712nOIEYf','tags','App\x20config\x20value\x20source\x20is\x20ambiguous.','5128604LdqKLI','path','data','after','key','push','args','2BuNQuU','Read\x20config\x20value\x20from\x20stdin'];a35_0x58f9=function(){return _0x5bec6d;};return a35_0x58f9();}export async function withAppConfigApiBoundary(_0x46a039,_0x4deef5,_0x4d2200){const _0x5706ee=a35_0x571932;try{return await _0x4d2200();}catch{const _0x11f577=[_0x5706ee(0x84)+_0x4deef5[_0x5706ee(0x97)]];if(_0x4deef5[_0x5706ee(0x7d)])_0x11f577[_0x5706ee(0x7e)](_0x5706ee(0x8e)+_0x4deef5['key']);_0x11f577['push'](_0x5706ee(0x8a));throw CliErrors['apiError'](_0x5706ee(0x6d)+_0x46a039+'\x20app\x20config.',_0x11f577[_0x5706ee(0x9d)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x1ead99,_0x35e649){const _0x31be0b=a35_0x571932;return Object['defineProperties'](_0x1ead99,{'method':{'value':_0x35e649['method'],'enumerable':![]},'url':{'value':_0x35e649[_0x31be0b(0x9c)],'enumerable':![]}});}export function assertSingleValueSource(_0xe1e457){const _0x9605a0=a35_0x571932,_0x1839da=[];_0xe1e457[_0x9605a0(0x7f)][_0x9605a0(0x6a)]>0x1&&_0x1839da[_0x9605a0(0x7e)]({'kind':_0x9605a0(0x65),'value':_0xe1e457['args'][_0x9605a0(0x8b)](0x1)['join']('\x20')});const _0x438c0e=_0xe1e457[_0x9605a0(0x86)](_0x9605a0(0x91));_0x438c0e!==undefined&&_0x438c0e!==null&&_0x1839da[_0x9605a0(0x7e)]({'kind':'argument','value':String(_0x438c0e)});_0xe1e457[_0x9605a0(0x75)](_0x9605a0(0x88))&&_0x1839da[_0x9605a0(0x7e)]({'kind':'stdin'});const _0x6c8a44=_0xe1e457['str'](_0x9605a0(0x82))[_0x9605a0(0x9f)]();_0x6c8a44&&_0x1839da[_0x9605a0(0x7e)]({'kind':_0x9605a0(0x71),'name':_0x6c8a44});const _0x441411=_0xe1e457[_0x9605a0(0x8f)](_0x9605a0(0x8c))[_0x9605a0(0x9f)]();_0x441411&&_0x1839da[_0x9605a0(0x7e)]({'kind':_0x9605a0(0x8c),'path':_0x441411});if(_0x1839da[_0x9605a0(0x6a)]===0x0)throw CliErrors[_0x9605a0(0x69)]('Missing\x20app-config\x20value\x20source.','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0x1839da[_0x9605a0(0x6a)]>0x1)throw CliErrors[_0x9605a0(0x69)](_0x9605a0(0x78),_0x9605a0(0x8d));return _0x1839da[0x0];}export async function assertValueSourceReadable(_0x526e1b){const _0x2d552b=a35_0x571932;if(_0x526e1b['kind']===_0x2d552b(0x71)&&!(_0x526e1b[_0x2d552b(0x87)]in process.env))throw CliErrors['validation'](_0x2d552b(0x9b)+_0x526e1b[_0x2d552b(0x87)]);if(_0x526e1b[_0x2d552b(0x6c)]==='file')try{await access(_0x526e1b['path']);}catch{throw CliErrors['validation']('Value\x20file\x20is\x20not\x20readable:\x20'+_0x526e1b['path']);}}export async function readAppConfigValue(_0x5be2f9){const _0xec1bc6=a35_0x571932,_0x490937=assertSingleValueSource(_0x5be2f9),_0x48d911=[];if(_0x490937[_0xec1bc6(0x6c)]===_0xec1bc6(0x65))return _0x48d911[_0xec1bc6(0x7e)](_0xec1bc6(0x90)),{'value':_0x490937['value']??'','source':_0x490937[_0xec1bc6(0x6c)],'warnings':_0x48d911};if(_0x490937['kind']==='stdin')return{'value':await readStdin(),'source':_0x490937[_0xec1bc6(0x6c)],'warnings':_0x48d911};if(_0x490937['kind']==='env'){if(!(_0x490937[_0xec1bc6(0x87)]in process.env))throw CliErrors[_0xec1bc6(0x69)](_0xec1bc6(0x9b)+_0x490937[_0xec1bc6(0x87)]);return{'value':process.env[_0x490937.name]??'','source':_0x490937[_0xec1bc6(0x6c)],'warnings':_0x48d911};}return{'value':await readFile(_0x490937[_0xec1bc6(0x7a)],_0xec1bc6(0x99)),'source':_0x490937[_0xec1bc6(0x6c)],'warnings':_0x48d911};}function readStdin(){return new Promise((_0x836c05,_0x4df48d)=>{const _0x4b84aa=a35_0x2ee8;let _0x47e539='';process[_0x4b84aa(0x88)][_0x4b84aa(0xa2)](_0x4b84aa(0x99)),process[_0x4b84aa(0x88)]['on'](_0x4b84aa(0x7b),_0x4c760c=>{_0x47e539+=_0x4c760c;}),process[_0x4b84aa(0x88)]['once'](_0x4b84aa(0x66),()=>_0x836c05(_0x47e539)),process[_0x4b84aa(0x88)][_0x4b84aa(0xa0)]('error',_0x4df48d);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a36_0x157a(_0x1c89a6,_0x62ba31){_0x1c89a6=_0x1c89a6-0x174;const _0x239d15=a36_0x239d();let _0x157aac=_0x239d15[_0x1c89a6];return _0x157aac;}const a36_0x487c96=a36_0x157a;(function(_0xf3f492,_0x31c234){const _0x4532ac=a36_0x157a,_0x3051b6=_0xf3f492();while(!![]){try{const _0x5955b1=-parseInt(_0x4532ac(0x17e))/0x1+parseInt(_0x4532ac(0x181))/0x2*(parseInt(_0x4532ac(0x188))/0x3)+parseInt(_0x4532ac(0x186))/0x4*(parseInt(_0x4532ac(0x187))/0x5)+parseInt(_0x4532ac(0x17b))/0x6*(-parseInt(_0x4532ac(0x17d))/0x7)+parseInt(_0x4532ac(0x17a))/0x8*(parseInt(_0x4532ac(0x183))/0x9)+-parseInt(_0x4532ac(0x184))/0xa*(parseInt(_0x4532ac(0x182))/0xb)+-parseInt(_0x4532ac(0x18c))/0xc*(-parseInt(_0x4532ac(0x177))/0xd);if(_0x5955b1===_0x31c234)break;else _0x3051b6['push'](_0x3051b6['shift']());}catch(_0x917f54){_0x3051b6['push'](_0x3051b6['shift']());}}}(a36_0x239d,0xb5b31));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x239d(){const _0x322602=['logout','boolean','log','13KDjlPq','auth','✓\x20Logged\x20out','24312kVqojc','6IJpgQh','Login\x20via\x20browser','9487807ZsjSQy','1423512BwAeJK','nonInteractive','bool','3206DXwuQP','110YqYmff','4068AzQkLG','1479020aWIJQI','yes','32LnJGyD','816965yNbEvF','423DbDyym','!\x20Not\x20logged\x20in','Clear\x20login\x20session','write','25144548yhPKWY'];a36_0x239d=function(){return _0x322602;};return a36_0x239d();}export const authDefinitions=[{'service':a36_0x487c96(0x178),'command':'login','description':a36_0x487c96(0x17c),'risk':a36_0x487c96(0x18b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x487c96(0x185),'type':a36_0x487c96(0x175),'description':'Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','default':![]}],async 'execute'(_0x371cc1){const _0x198671=a36_0x487c96,{runAuthServer:_0xb8f8e5}=await import('../../auth/auth-server-ui.js');return await _0xb8f8e5({'autoYes':_0x371cc1[_0x198671(0x180)](_0x198671(0x185)),'nonInteractive':_0x371cc1[_0x198671(0x17f)]}),{'ok':!![]};}},{'service':'auth','command':a36_0x487c96(0x174),'description':a36_0x487c96(0x18a),'risk':a36_0x487c96(0x18b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x54e65c){const _0x97f9a=a36_0x487c96;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x97f9a(0x176)](_0x97f9a(0x179))):console[_0x97f9a(0x176)](_0x97f9a(0x189)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x3f27db=a37_0x2ccf;function a37_0x67ed(){const _0x1512c6=['1897285FjhzIp','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','675048nhENSo','Select\x20dataset:','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x22\x20not\x20found\x20for\x20dataset\x20','before','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','str','close','currentApp','parseInt','profileName','.js\x0a\x20*\x20[触发节点]\x20','Trigger\x20node\x20(HOOK\x20only)','.js\x0a','Available:\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','datasetId','nonInteractive','HOOK','No\x20operation\x20types\x20found\x20for\x20dataset\x20','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','2711637vgLwzV','stderr','2812410ktwWLh','Available\x20aliases:\x20','stdin','alias','/ENDPOINT/','filePath','mergedCli','code','当前请求参数','datasetcode','defaultApp','715774dyQgMx','/**\x0a\x20*\x20','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','name','map','type','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','No\x20datasets\x20found\x20for\x20this\x20app.','string','question','length','isInteger','Function\x20name\x20(valid\x20JS\x20identifier)','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Script\x20description','utf8','/data/dataset/','Select\x20trigger\x20node:','operationType','source','当前响应结果','\x20api\x20pull`\x20to\x20refresh.','datasetCode','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','修改后的响应结果','No\x20model\x20aliases\x20found.\x20Run\x20`','trim','Operation\x20type\x20\x22','/HOOK/','UNKNOWN','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.',']\x20(','entries','\x22\x20not\x20found.\x20','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','COMMON','after','16CgIxyK','ENDPOINT','\x0a\x20*\x20[平台配置]\x20','find','\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','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','1600515VLTImJ','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','read','scriptsRootDir','apiDir','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','Invalid\x20dataset\x20selection.','Script\x20type','function-node','\x22.\x20','selectedAppName','description','.js','Created\x20','修改后的请求参数','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','/COMMON/','Operation\x20type\x20(HOOK\x20only)','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','join','HOOK\x20requires\x20alias/operation/node\x20options.','functionNode','File\x20already\x20exists:\x20','bff','validation','567lcTTKf','appCode','Select\x20operation\x20type:','write','16372EjcNYO','Alias\x20\x22'];a37_0x67ed=function(){return _0x1512c6;};return a37_0x67ed();}(function(_0x41a14f,_0x30fe5a){const _0x5134be=a37_0x2ccf,_0x1636b6=_0x41a14f();while(!![]){try{const _0x5e0a74=-parseInt(_0x5134be(0x82))/0x1+parseInt(_0x5134be(0xd0))/0x2+parseInt(_0x5134be(0xc8))/0x3*(parseInt(_0x5134be(0xcc))/0x4)+parseInt(_0x5134be(0xce))/0x5+-parseInt(_0x5134be(0x77))/0x6+parseInt(_0x5134be(0xaf))/0x7*(parseInt(_0x5134be(0xa8))/0x8)+-parseInt(_0x5134be(0x75))/0x9;if(_0x5e0a74===_0x30fe5a)break;else _0x1636b6['push'](_0x1636b6['shift']());}catch(_0x51b9c4){_0x1636b6['push'](_0x1636b6['shift']());}}}(a37_0x67ed,0x70cde));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';function a37_0x2ccf(_0x1bfbb4,_0x457603){_0x1bfbb4=_0x1bfbb4-0x70;const _0x67edba=a37_0x67ed();let _0x2ccfa8=_0x67edba[_0x1bfbb4];return _0x2ccfa8;}import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x3f27db(0xc6),'command':'create','description':a37_0x3f27db(0x9a),'risk':a37_0x3f27db(0xb1),'flags':[{'name':a37_0x3f27db(0x87),'type':'string','required':!![],'enum':['COMMON',a37_0x3f27db(0xa9),a37_0x3f27db(0x72)],'description':a37_0x3f27db(0xb6)},{'name':a37_0x3f27db(0x85),'type':a37_0x3f27db(0x8b),'required':!![],'description':a37_0x3f27db(0x8f)},{'name':a37_0x3f27db(0xba),'type':a37_0x3f27db(0x8b),'description':a37_0x3f27db(0x91)},{'name':a37_0x3f27db(0x7a),'type':a37_0x3f27db(0x8b),'description':a37_0x3f27db(0x90)},{'name':a37_0x3f27db(0x80),'type':'string','description':a37_0x3f27db(0xdf)},{'name':'operation-type','type':a37_0x3f27db(0x8b),'description':a37_0x3f27db(0xc0)},{'name':'function-node','type':'string','description':a37_0x3f27db(0xdc),'enum':['before',a37_0x3f27db(0xa7)]}],async 'validate'(_0x21feb1){const _0xe3c7d4=a37_0x3f27db,_0x332d14=_0x21feb1[_0xe3c7d4(0xd6)](_0xe3c7d4(0x85));if(!isValidBffFunctionName(_0x332d14))throw CliErrors[_0xe3c7d4(0xc7)]('Invalid\x20function\x20name\x20\x22'+_0x332d14+_0xe3c7d4(0x89));},async 'execute'(_0x6f461f){const _0x371657=a37_0x3f27db,_0x3d36ed=loadBffProjectConfig(_0x6f461f[_0x371657(0xc9)]),_0xfbadde=_0x6f461f[_0x371657(0xd6)](_0x371657(0x87)),_0x5e036b=_0x6f461f['str'](_0x371657(0x85)),_0x45e847=_0x6f461f['str'](_0x371657(0xba))||undefined,_0x4ebbcc=_0xfbadde===_0x371657(0x72)?await resolveHookOptions(_0x3d36ed,_0x6f461f):undefined,_0x533f3d=buildFilePath(_0x3d36ed,_0xfbadde,_0x5e036b,_0x4ebbcc);if(await fileExists(_0x533f3d))throw CliErrors[_0x371657(0xc7)](_0x371657(0xc5)+_0x533f3d);await mkdir(dirname(_0x533f3d),{'recursive':!![]});const _0x2c71b4=generateTemplate(_0xfbadde,_0x5e036b,_0x6f461f[_0x371657(0xc9)],_0x45e847,_0x4ebbcc);await writeFile(_0x533f3d,_0x2c71b4,_0x371657(0x92));const _0x439aee={'type':_0xfbadde,'name':_0x5e036b,'path':_0x533f3d};if(_0x45e847)_0x439aee[_0x371657(0xba)]=_0x45e847;if(_0x4ebbcc){if(_0x4ebbcc['alias'])_0x439aee['alias']=_0x4ebbcc[_0x371657(0x7a)];_0x439aee['datasetCode']=_0x4ebbcc[_0x371657(0x99)],_0x439aee[_0x371657(0x95)]=_0x4ebbcc[_0x371657(0x95)],_0x439aee[_0x371657(0xc4)]=_0x4ebbcc[_0x371657(0xc4)];}return{'ok':!![],'data':_0x439aee,'message':_0x371657(0xbc)+_0xfbadde+'\x20function:\x20'+_0x5e036b};}};async function resolveHookOptions(_0x4b16a2,_0x4a6418){const _0x37b01d=a37_0x3f27db,_0x33e958=resolveApiModelSource(_0x4a6418[_0x37b01d(0xb3)],_0x4a6418[_0x37b01d(0xc9)],_0x4a6418[_0x37b01d(0xb9)]||_0x4a6418[_0x37b01d(0x7d)]?.[_0x37b01d(0xd8)]||_0x4a6418['mergedCli']?.[_0x37b01d(0x81)]),_0x55109e=loadAliasMap(_0x4a6418[_0x37b01d(0xb3)],undefined,_0x33e958[_0x37b01d(0x7c)],_0x33e958[_0x37b01d(0xda)]),_0x558db1=_0x55109e[_0x37b01d(0x8d)]>0x0;let _0x1b4ead,_0x51179c,_0x19fb5f;const _0x1a1b51=_0x4a6418[_0x37b01d(0xd6)](_0x37b01d(0x7a)),_0x313cb4=_0x4a6418[_0x37b01d(0xd6)]('datasetcode');if(_0x1a1b51){const _0x16c2aa=resolveAlias(_0x4a6418[_0x37b01d(0xb3)],_0x1a1b51,undefined,_0x33e958[_0x37b01d(0x7c)],_0x33e958[_0x37b01d(0xda)]);if(!_0x16c2aa){const _0x528cad=_0x558db1?_0x37b01d(0x78)+_0x55109e['map'](_0x19416e=>_0x19416e[_0x37b01d(0x7a)])[_0x37b01d(0xc2)](',\x20'):_0x37b01d(0x9c)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x37b01d(0xc7)](_0x37b01d(0xcd)+_0x1a1b51+_0x37b01d(0xa4)+_0x528cad);}_0x1b4ead=_0x1a1b51,_0x51179c=_0x16c2aa;}else{if(_0x313cb4){_0x51179c=_0x313cb4;const _0x1ed918=_0x55109e['find'](_0x4afbbe=>_0x4afbbe[_0x37b01d(0x99)]===_0x313cb4);_0x1b4ead=_0x1ed918?.[_0x37b01d(0x7a)];}else{if(_0x4a6418[_0x37b01d(0x71)])throw CliErrors['validation'](_0x37b01d(0xa1));else{if(_0x558db1){const _0x464d52=_0x55109e[_0x37b01d(0x86)](_0x3849af=>_0x3849af[_0x37b01d(0x7a)]+'\x20('+_0x3849af['tableName']+')'),_0x28fdae=await promptSelect(_0x37b01d(0xd1),_0x464d52),_0x194c7f=_0x55109e[_0x28fdae];if(!_0x194c7f)throw CliErrors[_0x37b01d(0xc7)](_0x37b01d(0xb5));_0x1b4ead=_0x194c7f[_0x37b01d(0x7a)],_0x51179c=_0x194c7f[_0x37b01d(0x99)];}else{const _0x189f30=await listDatasets(_0x4a6418['appCode']);if(_0x189f30[_0x37b01d(0x8d)]===0x0)throw CliErrors[_0x37b01d(0xc7)](_0x37b01d(0x8a));const _0x27dae2=_0x189f30[_0x37b01d(0x86)](_0x1ee9c9=>_0x1ee9c9['name']+'\x20['+(_0x1ee9c9[_0x37b01d(0x96)]??_0x37b01d(0xa0))+_0x37b01d(0xa2)+_0x1ee9c9[_0x37b01d(0x7e)]+')'),_0x1e86ed=await promptSelect(_0x37b01d(0xd1),_0x27dae2),_0x1d2728=_0x189f30[_0x1e86ed];if(!_0x1d2728)throw CliErrors[_0x37b01d(0xc7)]('Invalid\x20dataset\x20selection.');_0x51179c=_0x1d2728[_0x37b01d(0x7e)],_0x1b4ead=undefined;}}}}const _0x3f856c=await listDatasets(_0x4a6418[_0x37b01d(0xc9)]),_0x5152fb=_0x3f856c[_0x37b01d(0xab)](_0x360408=>_0x360408[_0x37b01d(0x7e)]===_0x51179c);if(!_0x5152fb)throw CliErrors[_0x37b01d(0xc7)](_0x37b01d(0xe1)+_0x51179c+_0x37b01d(0xb8)+(_0x1b4ead?'The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0x37b01d(0x98):''));_0x19fb5f=_0x5152fb['id'];const _0x933bf4=_0x1b4ead??_0x51179c,_0x3f2c7d=await listBffDatasetOperations(_0x4a6418[_0x37b01d(0xc9)],_0x19fb5f),_0x30ed=_0x3f2c7d?Object['keys'](_0x3f2c7d):[];if(_0x30ed[_0x37b01d(0x8d)]===0x0)throw CliErrors[_0x37b01d(0xc7)](_0x37b01d(0x73)+_0x933bf4+'.');let _0x4a6e60;const _0x435174=_0x4a6418[_0x37b01d(0xd6)]('operation-type');if(_0x435174){if(!_0x30ed['includes'](_0x435174))throw CliErrors['validation'](_0x37b01d(0x9e)+_0x435174+_0x37b01d(0xd3)+_0x933bf4+'.\x20'+(_0x37b01d(0xde)+_0x30ed[_0x37b01d(0xc2)](',\x20')));_0x4a6e60=_0x435174;}else{if(_0x4a6418[_0x37b01d(0x71)])throw CliErrors[_0x37b01d(0xc7)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x104c73=await promptSelect(_0x37b01d(0xca),_0x30ed);_0x4a6e60=_0x30ed[_0x104c73]??_0x30ed[0x0];}let _0x432c7e=normalizeHookFunctionNode(_0x4a6418[_0x37b01d(0xd6)](_0x37b01d(0xb7)));if(!_0x432c7e){if(_0x4a6418[_0x37b01d(0xd6)](_0x37b01d(0xb7)))throw CliErrors[_0x37b01d(0xc7)](_0x37b01d(0xc1));if(_0x4a6418[_0x37b01d(0x71)])throw CliErrors[_0x37b01d(0xc7)](_0x37b01d(0xd5));const _0xbc0c20=await promptSelect(_0x37b01d(0x94),[_0x37b01d(0xd4),_0x37b01d(0xa7)]);_0x432c7e=['before','after'][_0xbc0c20]??'before';}return{'alias':_0x1b4ead,'datasetCode':_0x51179c,'datasetId':_0x19fb5f,'operationType':_0x4a6e60,'functionNode':_0x432c7e};}async function promptSelect(_0x5efecf,_0xc9ca7d){const _0x2ad2d9=a37_0x3f27db;if(_0xc9ca7d[_0x2ad2d9(0x8d)]===0x1)return 0x0;for(const [_0x1627eb,_0xafa96e]of _0xc9ca7d[_0x2ad2d9(0xa3)]()){process[_0x2ad2d9(0x76)][_0x2ad2d9(0xcb)]('\x20\x20'+(_0x1627eb+0x1)+'.\x20'+_0xafa96e+'\x0a');}const _0x21ba34=createInterface({'input':process[_0x2ad2d9(0x79)],'output':process[_0x2ad2d9(0x76)]});while(!![]){const _0x33ac5c=await new Promise(_0x25e303=>{const _0x53f84f=_0x2ad2d9;_0x21ba34[_0x53f84f(0x8c)](_0x5efecf+'\x20',_0x25e303);}),_0x4346d8=Number[_0x2ad2d9(0xd9)](_0x33ac5c['trim'](),0xa);if(Number[_0x2ad2d9(0x8e)](_0x4346d8)&&_0x4346d8>=0x1&&_0x4346d8<=_0xc9ca7d[_0x2ad2d9(0x8d)])return _0x21ba34[_0x2ad2d9(0xd7)](),_0x4346d8-0x1;process['stderr']['write']('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0xc9ca7d[_0x2ad2d9(0x8d)]+'.\x0a');}}function buildFilePath(_0x45a89c,_0x2e62a6,_0x14a64e,_0x212905){const _0x364462=a37_0x3f27db;if(_0x2e62a6===_0x364462(0x72)){if(!_0x212905)throw CliErrors[_0x364462(0xc7)](_0x364462(0xc3));const _0x8444fc=_0x212905[_0x364462(0x7a)]??_0x212905[_0x364462(0x99)];return join(_0x45a89c[_0x364462(0xb2)],_0x364462(0x72),_0x8444fc,_0x212905['operationType'],_0x212905[_0x364462(0xc4)],_0x14a64e+_0x364462(0xbb));}return join(_0x45a89c[_0x364462(0xb2)],_0x2e62a6,_0x14a64e+_0x364462(0xbb));}export function generateTemplate(_0x51fb06,_0x5c9087,_0x58667e,_0x4b2cf5,_0x20457e){const _0x3f6cc8=a37_0x3f27db,_0x4bdf66=_0x4b2cf5?.[_0x3f6cc8(0x9d)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x27498a=getAppBaseUrl(_0x58667e),_0x38be6e=_0x3f6cc8(0xb0);if(_0x51fb06===_0x3f6cc8(0xa6))return _0x3f6cc8(0x83)+_0x4bdf66+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x5c9087+_0x3f6cc8(0xaa)+_0x27498a+_0x3f6cc8(0xb4)+_0x58667e+_0x3f6cc8(0xbf)+_0x5c9087+_0x3f6cc8(0xcf)+_0x5c9087+'\x22,\x20params\x20})\x0a'+_0x38be6e+_0x3f6cc8(0xac)+_0x5c9087+_0x3f6cc8(0xa5);if(_0x51fb06==='ENDPOINT')return _0x3f6cc8(0x83)+_0x4bdf66+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x5c9087+_0x3f6cc8(0xe0)+_0x58667e+'/'+_0x5c9087+_0x3f6cc8(0xaa)+_0x27498a+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x58667e+_0x3f6cc8(0x7b)+_0x5c9087+_0x3f6cc8(0xdd)+_0x38be6e+_0x3f6cc8(0xd2)+_0x5c9087+_0x3f6cc8(0xa5);if(!_0x20457e)throw CliErrors[_0x3f6cc8(0xc7)](_0x3f6cc8(0xad));const _0x21bcc2=_0x20457e['alias']??_0x20457e[_0x3f6cc8(0x99)],_0xcd8135=_0x20457e[_0x3f6cc8(0xc4)]==='before'?_0x3f6cc8(0x7f):_0x3f6cc8(0x97),_0x28025d=_0x20457e[_0x3f6cc8(0xc4)]==='before'?_0x3f6cc8(0xbd):_0x3f6cc8(0x9b);return _0x3f6cc8(0x83)+_0x4bdf66+_0x3f6cc8(0x88)+_0x5c9087+_0x3f6cc8(0xbe)+_0x58667e+'/'+_0x20457e[_0x3f6cc8(0x99)]+'/'+_0x20457e[_0x3f6cc8(0x95)]+'\x0a\x20*\x20[平台配置]\x20'+_0x27498a+_0x3f6cc8(0x93)+_0x20457e[_0x3f6cc8(0x70)]+_0x3f6cc8(0x74)+_0x58667e+_0x3f6cc8(0x9f)+_0x21bcc2+'/'+_0x20457e[_0x3f6cc8(0x95)]+'/'+_0x20457e[_0x3f6cc8(0xc4)]+'/'+_0x5c9087+_0x3f6cc8(0xdb)+_0x20457e[_0x3f6cc8(0xc4)]+'\x0a'+_0x38be6e+_0x3f6cc8(0xae)+_0xcd8135+_0x3f6cc8(0xe2)+_0x28025d+_0x3f6cc8(0x84)+_0x5c9087+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
|
1
|
+
const a37_0x501c99=a37_0x2d92;(function(_0x17627a,_0x5d3213){const _0x3629d0=a37_0x2d92,_0x4775d1=_0x17627a();while(!![]){try{const _0x468240=-parseInt(_0x3629d0(0x105))/0x1+-parseInt(_0x3629d0(0x127))/0x2+-parseInt(_0x3629d0(0xf3))/0x3+parseInt(_0x3629d0(0x101))/0x4+-parseInt(_0x3629d0(0x146))/0x5+parseInt(_0x3629d0(0xfd))/0x6*(parseInt(_0x3629d0(0x12a))/0x7)+parseInt(_0x3629d0(0x145))/0x8;if(_0x468240===_0x5d3213)break;else _0x4775d1['push'](_0x4775d1['shift']());}catch(_0x37d360){_0x4775d1['push'](_0x4775d1['shift']());}}}(a37_0x1e4a,0xb2d7b));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 a37_0x1e4a(){const _0x259edd=['\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','HOOK\x20requires\x20alias/operation/node\x20options.','Operation\x20type\x20(HOOK\x20only)','selectedAppName','datasetcode','entries','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','source','7592040uDZiMK','1216900ZfCVqh','datasetId','Function\x20name\x20(valid\x20JS\x20identifier)','appCode','name','.js\x0a','UNKNOWN',']\x20(','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','当前请求参数','\x0a\x20*\x20[平台配置]\x20','mergedCli','COMMON','description','ENDPOINT','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','type','length','nonInteractive','before','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','datasetCode','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','707946vnKcME','stdin','Select\x20dataset:','profileName','Dataset\x20not\x20found\x20for\x20code\x20\x22','validation','\x20function:\x20','Invalid\x20function\x20name\x20\x22','Select\x20trigger\x20node:','functionNode','5109114UzQSst','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','\x22\x20not\x20found\x20for\x20dataset\x20','apiDir','4780724psoUse','Available:\x20','Available\x20aliases:\x20','after','469563IiStRX','No\x20datasets\x20found\x20for\x20this\x20app.','Trigger\x20node\x20(HOOK\x20only)','function-node','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','.js','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','HOOK','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','keys','string','scriptsRootDir','trim','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','tableName','No\x20operation\x20types\x20found\x20for\x20dataset\x20','File\x20already\x20exists:\x20','write','join','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','/COMMON/','\x22\x20not\x20found.\x20','code','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','find','alias','operation-type','修改后的请求参数','Invalid\x20dataset\x20selection.','create','isInteger','close','2628482KjbujO','Operation\x20type\x20\x22','No\x20model\x20aliases\x20found.\x20Run\x20`','7iOgfiv','/**\x0a\x20*\x20','bff','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','stderr','filePath','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Created\x20','str','utf8','parseInt','map','修改后的响应结果','operationType','\x22.\x20','\x20api\x20pull`\x20to\x20refresh.','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','\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','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'];a37_0x1e4a=function(){return _0x259edd;};return a37_0x1e4a();}function a37_0x2d92(_0x656473,_0x2033e2){_0x656473=_0x656473-0xe6;const _0x1e4a13=a37_0x1e4a();let _0x2d9281=_0x1e4a13[_0x656473];return _0x2d9281;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x501c99(0x12c),'command':a37_0x501c99(0x124),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':'read','flags':[{'name':a37_0x501c99(0xec),'type':'string','required':!![],'enum':[a37_0x501c99(0xe8),a37_0x501c99(0xea),'HOOK'],'description':'Script\x20type'},{'name':a37_0x501c99(0x14a),'type':a37_0x501c99(0x110),'required':!![],'description':a37_0x501c99(0x148)},{'name':'description','type':a37_0x501c99(0x110),'description':'Script\x20description'},{'name':a37_0x501c99(0x120),'type':'string','description':a37_0x501c99(0x13a)},{'name':a37_0x501c99(0x141),'type':a37_0x501c99(0x110),'description':a37_0x501c99(0x114)},{'name':'operation-type','type':a37_0x501c99(0x110),'description':a37_0x501c99(0x13f)},{'name':a37_0x501c99(0x108),'type':a37_0x501c99(0x110),'description':a37_0x501c99(0x107),'enum':[a37_0x501c99(0xef),a37_0x501c99(0x104)]}],async 'validate'(_0x527de6){const _0x113c48=a37_0x501c99,_0x2a3987=_0x527de6[_0x113c48(0x132)](_0x113c48(0x14a));if(!isValidBffFunctionName(_0x2a3987))throw CliErrors[_0x113c48(0xf8)](_0x113c48(0xfa)+_0x2a3987+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x38cbee){const _0x3b7125=a37_0x501c99,_0xa9c7ec=loadBffProjectConfig(_0x38cbee[_0x3b7125(0x149)]),_0x495a63=_0x38cbee['str']('type'),_0x185e33=_0x38cbee[_0x3b7125(0x132)](_0x3b7125(0x14a)),_0x4e99ca=_0x38cbee[_0x3b7125(0x132)](_0x3b7125(0xe9))||undefined,_0x174b53=_0x495a63==='HOOK'?await resolveHookOptions(_0xa9c7ec,_0x38cbee):undefined,_0x2f6538=buildFilePath(_0xa9c7ec,_0x495a63,_0x185e33,_0x174b53);if(await fileExists(_0x2f6538))throw CliErrors[_0x3b7125(0xf8)](_0x3b7125(0x117)+_0x2f6538);await mkdir(dirname(_0x2f6538),{'recursive':!![]});const _0x3e6ab8=generateTemplate(_0x495a63,_0x185e33,_0x38cbee[_0x3b7125(0x149)],_0x4e99ca,_0x174b53);await writeFile(_0x2f6538,_0x3e6ab8,_0x3b7125(0x133));const _0xd71f7a={'type':_0x495a63,'name':_0x185e33,'path':_0x2f6538};if(_0x4e99ca)_0xd71f7a[_0x3b7125(0xe9)]=_0x4e99ca;if(_0x174b53){if(_0x174b53['alias'])_0xd71f7a[_0x3b7125(0x120)]=_0x174b53[_0x3b7125(0x120)];_0xd71f7a[_0x3b7125(0xf1)]=_0x174b53[_0x3b7125(0xf1)],_0xd71f7a[_0x3b7125(0x137)]=_0x174b53[_0x3b7125(0x137)],_0xd71f7a[_0x3b7125(0xfc)]=_0x174b53[_0x3b7125(0xfc)];}return{'ok':!![],'data':_0xd71f7a,'message':_0x3b7125(0x131)+_0x495a63+_0x3b7125(0xf9)+_0x185e33};}};async function resolveHookOptions(_0x337bcb,_0x3bf0b8){const _0x1c9e9a=a37_0x501c99,_0x5a3100=resolveApiModelSource(_0x3bf0b8[_0x1c9e9a(0x100)],_0x3bf0b8[_0x1c9e9a(0x149)],_0x3bf0b8[_0x1c9e9a(0x140)]||_0x3bf0b8[_0x1c9e9a(0xe7)]?.['currentApp']||_0x3bf0b8[_0x1c9e9a(0xe7)]?.['defaultApp']),_0x50ab2e=loadAliasMap(_0x3bf0b8['apiDir'],undefined,_0x5a3100[_0x1c9e9a(0x12f)],_0x5a3100[_0x1c9e9a(0xf6)]),_0x281d8d=_0x50ab2e[_0x1c9e9a(0xed)]>0x0;let _0x32c0db,_0x267526,_0x471786;const _0x2c6703=_0x3bf0b8['str'](_0x1c9e9a(0x120)),_0x118b7e=_0x3bf0b8[_0x1c9e9a(0x132)](_0x1c9e9a(0x141));if(_0x2c6703){const _0x1d02b6=resolveAlias(_0x3bf0b8['apiDir'],_0x2c6703,undefined,_0x5a3100['filePath'],_0x5a3100[_0x1c9e9a(0xf6)]);if(!_0x1d02b6){const _0x4331b1=_0x281d8d?_0x1c9e9a(0x103)+_0x50ab2e[_0x1c9e9a(0x135)](_0x28e613=>_0x28e613[_0x1c9e9a(0x120)])[_0x1c9e9a(0x119)](',\x20'):_0x1c9e9a(0x129)+CLI_BIN_NAME+_0x1c9e9a(0xfe);throw CliErrors[_0x1c9e9a(0xf8)]('Alias\x20\x22'+_0x2c6703+_0x1c9e9a(0x11c)+_0x4331b1);}_0x32c0db=_0x2c6703,_0x267526=_0x1d02b6;}else{if(_0x118b7e){_0x267526=_0x118b7e;const _0x11780c=_0x50ab2e[_0x1c9e9a(0x11f)](_0x182d21=>_0x182d21[_0x1c9e9a(0xf1)]===_0x118b7e);_0x32c0db=_0x11780c?.[_0x1c9e9a(0x120)];}else{if(_0x3bf0b8[_0x1c9e9a(0xee)])throw CliErrors['validation'](_0x1c9e9a(0x113));else{if(_0x281d8d){const _0x5d2160=_0x50ab2e[_0x1c9e9a(0x135)](_0x2b8d50=>_0x2b8d50[_0x1c9e9a(0x120)]+'\x20('+_0x2b8d50[_0x1c9e9a(0x115)]+')'),_0x74b285=await promptSelect(_0x1c9e9a(0xf5),_0x5d2160),_0x34f165=_0x50ab2e[_0x74b285];if(!_0x34f165)throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x123));_0x32c0db=_0x34f165[_0x1c9e9a(0x120)],_0x267526=_0x34f165[_0x1c9e9a(0xf1)];}else{const _0x59f49d=await listDatasets(_0x3bf0b8[_0x1c9e9a(0x149)]);if(_0x59f49d[_0x1c9e9a(0xed)]===0x0)throw CliErrors['validation'](_0x1c9e9a(0x106));const _0x37baef=_0x59f49d[_0x1c9e9a(0x135)](_0x132811=>_0x132811[_0x1c9e9a(0x14a)]+'\x20['+(_0x132811[_0x1c9e9a(0x144)]??_0x1c9e9a(0x14c))+_0x1c9e9a(0x14d)+_0x132811[_0x1c9e9a(0x11d)]+')'),_0x2560de=await promptSelect(_0x1c9e9a(0xf5),_0x37baef),_0xcdb2b8=_0x59f49d[_0x2560de];if(!_0xcdb2b8)throw CliErrors['validation'](_0x1c9e9a(0x123));_0x267526=_0xcdb2b8[_0x1c9e9a(0x11d)],_0x32c0db=undefined;}}}}const _0x2aae54=await listDatasets(_0x3bf0b8['appCode']),_0x26a17d=_0x2aae54['find'](_0x556a7a=>_0x556a7a['code']===_0x267526);if(!_0x26a17d)throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0xf7)+_0x267526+_0x1c9e9a(0x138)+(_0x32c0db?_0x1c9e9a(0x13c)+CLI_BIN_NAME+_0x1c9e9a(0x139):''));_0x471786=_0x26a17d['id'];const _0x385bc6=_0x32c0db??_0x267526,_0x38c41d=await listBffDatasetOperations(_0x3bf0b8[_0x1c9e9a(0x149)],_0x471786),_0x40ef9b=_0x38c41d?Object[_0x1c9e9a(0x10f)](_0x38c41d):[];if(_0x40ef9b[_0x1c9e9a(0xed)]===0x0)throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x116)+_0x385bc6+'.');let _0x4d8269;const _0x176b9d=_0x3bf0b8[_0x1c9e9a(0x132)](_0x1c9e9a(0x121));if(_0x176b9d){if(!_0x40ef9b['includes'](_0x176b9d))throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x128)+_0x176b9d+_0x1c9e9a(0xff)+_0x385bc6+'.\x20'+(_0x1c9e9a(0x102)+_0x40ef9b[_0x1c9e9a(0x119)](',\x20')));_0x4d8269=_0x176b9d;}else{if(_0x3bf0b8[_0x1c9e9a(0xee)])throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0xf0));const _0x2bc755=await promptSelect('Select\x20operation\x20type:',_0x40ef9b);_0x4d8269=_0x40ef9b[_0x2bc755]??_0x40ef9b[0x0];}let _0x5dfb4a=normalizeHookFunctionNode(_0x3bf0b8[_0x1c9e9a(0x132)]('function-node'));if(!_0x5dfb4a){if(_0x3bf0b8['str'](_0x1c9e9a(0x108)))throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x10b));if(_0x3bf0b8[_0x1c9e9a(0xee)])throw CliErrors['validation'](_0x1c9e9a(0xf2));const _0x800c3f=await promptSelect(_0x1c9e9a(0xfb),[_0x1c9e9a(0xef),'after']);_0x5dfb4a=['before',_0x1c9e9a(0x104)][_0x800c3f]??_0x1c9e9a(0xef);}return{'alias':_0x32c0db,'datasetCode':_0x267526,'datasetId':_0x471786,'operationType':_0x4d8269,'functionNode':_0x5dfb4a};}async function promptSelect(_0xfbef3e,_0x325f90){const _0x4f62e8=a37_0x501c99;if(_0x325f90['length']===0x1)return 0x0;for(const [_0x5db411,_0x5a8fef]of _0x325f90[_0x4f62e8(0x142)]()){process[_0x4f62e8(0x12e)][_0x4f62e8(0x118)]('\x20\x20'+(_0x5db411+0x1)+'.\x20'+_0x5a8fef+'\x0a');}const _0x4e174e=createInterface({'input':process[_0x4f62e8(0xf4)],'output':process[_0x4f62e8(0x12e)]});while(!![]){const _0x3fb48a=await new Promise(_0x3a3867=>{_0x4e174e['question'](_0xfbef3e+'\x20',_0x3a3867);}),_0x53fce4=Number[_0x4f62e8(0x134)](_0x3fb48a['trim'](),0xa);if(Number[_0x4f62e8(0x125)](_0x53fce4)&&_0x53fce4>=0x1&&_0x53fce4<=_0x325f90[_0x4f62e8(0xed)])return _0x4e174e[_0x4f62e8(0x126)](),_0x53fce4-0x1;process['stderr'][_0x4f62e8(0x118)]('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x325f90[_0x4f62e8(0xed)]+'.\x0a');}}function buildFilePath(_0x5c7b66,_0x198589,_0xfb4cf9,_0x4ffba4){const _0x583907=a37_0x501c99;if(_0x198589===_0x583907(0x10d)){if(!_0x4ffba4)throw CliErrors[_0x583907(0xf8)](_0x583907(0x13e));const _0x35fc2e=_0x4ffba4[_0x583907(0x120)]??_0x4ffba4[_0x583907(0xf1)];return join(_0x5c7b66[_0x583907(0x111)],_0x583907(0x10d),_0x35fc2e,_0x4ffba4[_0x583907(0x137)],_0x4ffba4[_0x583907(0xfc)],_0xfb4cf9+_0x583907(0x10a));}return join(_0x5c7b66[_0x583907(0x111)],_0x198589,_0xfb4cf9+_0x583907(0x10a));}export function generateTemplate(_0x103074,_0x10122e,_0x277b75,_0x232dc2,_0x190385){const _0x994413=a37_0x501c99,_0x83be32=_0x232dc2?.[_0x994413(0x112)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x118ae6=getAppBaseUrl(_0x277b75),_0x4894e4=_0x994413(0x109);if(_0x103074===_0x994413(0xe8))return'/**\x0a\x20*\x20'+_0x83be32+_0x994413(0x130)+_0x10122e+_0x994413(0xe6)+_0x118ae6+_0x994413(0x11a)+_0x277b75+_0x994413(0x11b)+_0x10122e+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x10122e+'\x22,\x20params\x20})\x0a'+_0x4894e4+'\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'+_0x10122e+_0x994413(0x14e);if(_0x103074===_0x994413(0xea))return _0x994413(0x12b)+_0x83be32+_0x994413(0x12d)+_0x10122e+_0x994413(0xeb)+_0x277b75+'/'+_0x10122e+_0x994413(0xe6)+_0x118ae6+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x277b75+'/ENDPOINT/'+_0x10122e+_0x994413(0x14b)+_0x4894e4+_0x994413(0x13b)+_0x10122e+_0x994413(0x14e);if(!_0x190385)throw CliErrors[_0x994413(0xf8)](_0x994413(0x10e));const _0xbf6626=_0x190385[_0x994413(0x120)]??_0x190385[_0x994413(0xf1)],_0x513685=_0x190385[_0x994413(0xfc)]==='before'?_0x994413(0x14f):'当前响应结果',_0xa10c5a=_0x190385[_0x994413(0xfc)]===_0x994413(0xef)?_0x994413(0x122):_0x994413(0x136);return _0x994413(0x12b)+_0x83be32+_0x994413(0x13d)+_0x10122e+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x277b75+'/'+_0x190385[_0x994413(0xf1)]+'/'+_0x190385[_0x994413(0x137)]+_0x994413(0xe6)+_0x118ae6+'/data/dataset/'+_0x190385[_0x994413(0x147)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x277b75+'/HOOK/'+_0xbf6626+'/'+_0x190385[_0x994413(0x137)]+'/'+_0x190385['functionNode']+'/'+_0x10122e+'.js\x0a\x20*\x20[触发节点]\x20'+_0x190385[_0x994413(0xfc)]+'\x0a'+_0x4894e4+_0x994413(0x11e)+_0x513685+_0x994413(0x10c)+_0xa10c5a+_0x994413(0x143)+_0x10122e+_0x994413(0x14e);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x46ebd1=a38_0x49de;(function(_0x52a3bc,_0x27145f){const _0x566e3b=a38_0x49de,_0x19b91e=_0x52a3bc();while(!![]){try{const _0xb6b71f=parseInt(_0x566e3b(0x1d5))/0x1+parseInt(_0x566e3b(0x1d3))/0x2+-parseInt(_0x566e3b(0x1cd))/0x3*(parseInt(_0x566e3b(0x1c1))/0x4)+-parseInt(_0x566e3b(0x1db))/0x5*(-parseInt(_0x566e3b(0x1ce))/0x6)+parseInt(_0x566e3b(0x1c4))/0x7*(parseInt(_0x566e3b(0x1bc))/0x8)+-parseInt(_0x566e3b(0x1e7))/0x9+-parseInt(_0x566e3b(0x1de))/0xa*(parseInt(_0x566e3b(0x1bf))/0xb);if(_0xb6b71f===_0x27145f)break;else _0x19b91e['push'](_0x19b91e['shift']());}catch(_0x533eb4){_0x19b91e['push'](_0x19b91e['shift']());}}}(a38_0x56f3,0xe25e8));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a38_0x56f3(){const _0x136ec1=['replace','find','join','validation','Function\x20not\x20found:\x20','600vbqJOZ','Multiple\x20functions\x20match\x20\x22','remoteId','416230fRSyvp','apps','appCode','startsWith','parse','delete','<timestamp>','length','/api/management/library/scripts/delete','4955121CxOree','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','toISOString','projectRoot','trashDir','target','Backend\x20Function\x20lock\x20file\x20not\x20found.','187792hxMxXa','str','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','374oFGXwM','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','2044356jepRKq','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','Local\x20delete\x20not\x20settled\x20for\x20','133KdKYQu','\x20(local\x20file\x20moved\x20to\x20trash)','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','POST','lockFilePath','No\x20lock\x20entry\x20found\x20for\x20\x22','Lock\x20scope\x20for\x20app\x20\x22','keys','high-risk-write','6VUArNu','75792mTATJc','filter','scriptsRoot','functions','map','2252184WlTyBr','bff','827199MryrWJ'];a38_0x56f3=function(){return _0x136ec1;};return a38_0x56f3();}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x46ebd1(0x1d4),'command':a38_0x46ebd1(0x1e3),'description':a38_0x46ebd1(0x1be),'risk':a38_0x46ebd1(0x1cc),'flags':[{'name':a38_0x46ebd1(0x1ec),'type':'string','required':!![],'description':a38_0x46ebd1(0x1e8)}],async 'validate'(_0x40d55a){const _0x54296c=a38_0x46ebd1,_0x21729d=loadBffProjectConfig(_0x40d55a['appCode']),_0x53e685=await readBffLockFile(_0x21729d['lockFilePath']);if(!_0x53e685)throw CliErrors['validation'](_0x54296c(0x1c6));},async 'dryRun'(_0x20b76f){const _0x44ed68=a38_0x46ebd1,_0x1956f5=loadBffProjectConfig(_0x20b76f['appCode']),_0x47092b=await readBffLockFile(_0x1956f5[_0x44ed68(0x1c8)]);if(!_0x47092b)throw CliErrors[_0x44ed68(0x1d9)](_0x44ed68(0x1ed));const {appLock:_0x2d65d6}=ensureLockScope(_0x47092b,_0x20b76f[_0x44ed68(0x1e0)],_0x1956f5[_0x44ed68(0x1d0)],_0x44ed68(0x1e3)),_0x35b766=_0x20b76f[_0x44ed68(0x1bd)](_0x44ed68(0x1ec)),_0x4b36bb=Object[_0x44ed68(0x1cb)](_0x2d65d6[_0x44ed68(0x1d1)]),_0x3c3154=resolveDeleteTarget(_0x35b766,_0x4b36bb),_0x391e4c=_0x2d65d6[_0x44ed68(0x1d1)][_0x3c3154];if(!_0x391e4c)throw CliErrors[_0x44ed68(0x1d9)](_0x44ed68(0x1c9)+_0x3c3154+'\x22.');const _0x430737=resolveLocalFilePathFromLockKey(_0x1956f5,_0x3c3154),_0x1f5a31=relative(_0x1956f5[_0x44ed68(0x1ea)],_0x430737),_0x57fa0a=join(_0x1956f5[_0x44ed68(0x1eb)],_0x44ed68(0x1e4),_0x1f5a31);return{'method':_0x44ed68(0x1c7),'url':_0x44ed68(0x1e6),'body':{'appCode':_0x20b76f['appCode'],'target':_0x3c3154,'remoteId':_0x391e4c['remoteId'],'localFilePath':_0x430737,'trashedPath':_0x57fa0a},'description':'Would\x20delete\x20'+_0x3c3154+_0x44ed68(0x1c2)};},async 'execute'(_0xe11cf1){const _0x43cb3b=a38_0x46ebd1,_0x261828=loadBffProjectConfig(_0xe11cf1[_0x43cb3b(0x1e0)]),_0x257474=await readBffLockFile(_0x261828[_0x43cb3b(0x1c8)]);if(!_0x257474)throw CliErrors[_0x43cb3b(0x1d9)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x3eeaf9,appLock:_0x5796e7}=ensureLockScope(_0x257474,_0xe11cf1[_0x43cb3b(0x1e0)],_0x261828['scriptsRoot'],_0x43cb3b(0x1e3)),_0x38822f=JSON[_0x43cb3b(0x1e2)](JSON['stringify'](_0x3eeaf9)),_0x5c756e=_0x38822f[_0x43cb3b(0x1df)][_0xe11cf1['appCode']];if(!_0x5c756e)throw new Error(_0x43cb3b(0x1ca)+_0xe11cf1['appCode']+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x2c86c0=_0xe11cf1[_0x43cb3b(0x1bd)](_0x43cb3b(0x1ec)),_0x566900=Object['keys'](_0x5c756e[_0x43cb3b(0x1d1)]),_0x420c25=resolveDeleteTarget(_0x2c86c0,_0x566900),_0x4b2425=_0x5c756e[_0x43cb3b(0x1d1)][_0x420c25];if(!_0x4b2425)throw CliErrors['validation'](_0x43cb3b(0x1c9)+_0x420c25+'\x22.');await deleteBffScript(_0x4b2425['remoteId']),delete _0x5c756e[_0x43cb3b(0x1d1)][_0x420c25],_0x5c756e['lastSync']=new Date()[_0x43cb3b(0x1e9)](),await writeBffLockFile(_0x261828['lockFilePath'],_0x38822f);const _0x4050d7=resolveLocalFilePathFromLockKey(_0x261828,_0x420c25);let _0x46ae9d;await fileExists(_0x4050d7)&&(_0x46ae9d=await moveToTrash(_0x261828[_0x43cb3b(0x1ea)],_0x261828[_0x43cb3b(0x1eb)],_0x4050d7),await cleanupEmptyDirectories(dirname(_0x4050d7),_0x261828['scriptsRootDir']));await waitForDeleteSettlement(_0x261828['lockFilePath'],_0xe11cf1[_0x43cb3b(0x1e0)],_0x420c25,_0x4050d7),await sleep(0x96);const _0x51353c={'deleted':_0x420c25,'remoteId':_0x4b2425[_0x43cb3b(0x1dd)]};if(_0x46ae9d)_0x51353c['trashedTo']=_0x46ae9d;return{'ok':!![],'data':_0x51353c,'message':'Deleted\x20'+_0x420c25+(_0x46ae9d?_0x43cb3b(0x1c5):'')};}};function resolveDeleteTarget(_0x4277e1,_0xb19439){const _0x4300ed=a38_0x46ebd1;if(_0x4277e1['includes']('/')){const _0x2067ec=_0xb19439[_0x4300ed(0x1d7)](_0x5dfdc4=>_0x5dfdc4===_0x4277e1);if(!_0x2067ec)throw CliErrors['validation']('Function\x20not\x20found:\x20'+_0x4277e1);return _0x2067ec;}const _0x28ff3b=_0xb19439[_0x4300ed(0x1cf)](_0xd2c365=>_0xd2c365['split']('/')['at'](-0x1)===_0x4277e1);if(_0x28ff3b['length']===0x0)throw CliErrors[_0x4300ed(0x1d9)](_0x4300ed(0x1da)+_0x4277e1);if(_0x28ff3b['length']>0x1)throw CliErrors['validation'](_0x4300ed(0x1dc)+_0x4277e1+_0x4300ed(0x1c0)+_0x28ff3b[_0x4300ed(0x1d2)](_0x133109=>'\x20\x20-\x20'+_0x133109)[_0x4300ed(0x1d8)]('\x0a'));return _0x28ff3b[0x0];}async function moveToTrash(_0x374630,_0xfd4b93,_0x592dd7){const _0x1d1002=a38_0x46ebd1,_0x176ea0=new Date()[_0x1d1002(0x1e9)]()[_0x1d1002(0x1d6)](/[:.]/g,'-'),_0x4eb813=relative(_0x374630,_0x592dd7),_0x20b249=join(_0xfd4b93,_0x176ea0,_0x4eb813);return await mkdir(dirname(_0x20b249),{'recursive':!![]}),await rename(_0x592dd7,_0x20b249),_0x20b249;}async function cleanupEmptyDirectories(_0x15b4d3,_0x15f85f){const _0x3ab8cc=a38_0x46ebd1;let _0x1e5c3e=resolve(_0x15b4d3);const _0x33bc42=resolve(_0x15f85f);while(_0x1e5c3e[_0x3ab8cc(0x1e1)](''+_0x33bc42+sep)||_0x1e5c3e===_0x33bc42){if(_0x1e5c3e===_0x33bc42)return;try{const _0x129718=await readdir(_0x1e5c3e);if(_0x129718[_0x3ab8cc(0x1e5)]>0x0)return;await rmdir(_0x1e5c3e);}catch{return;}_0x1e5c3e=dirname(_0x1e5c3e);}}function a38_0x49de(_0x8f0809,_0x33f4bf){_0x8f0809=_0x8f0809-0x1bc;const _0x56f37f=a38_0x56f3();let _0x49de8e=_0x56f37f[_0x8f0809];return _0x49de8e;}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x27087f,_0x893fce,_0x114fc1,_0x5b4c75){const _0x25923f=a38_0x46ebd1;for(let _0x5ce4aa=0x0;_0x5ce4aa<DELETE_SETTLE_RETRY_COUNT;_0x5ce4aa+=0x1){const _0x349593=await readBffLockFile(_0x27087f),_0x5dbe71=!!_0x349593?.[_0x25923f(0x1df)]?.[_0x893fce]?.[_0x25923f(0x1d1)]?.[_0x114fc1],_0x154e97=await fileExists(_0x5b4c75);if(!_0x5dbe71&&!_0x154e97)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x25923f(0x1c3)+_0x114fc1+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a39_0x46a0(){const _0x1c854b=['(none)','bff','12700392OgnEts','functionName','9RPZLql','boolean','updateUserName','verbose','Script\x20ID','scriptContent','66GFTtUU','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','2708DmOjHm','Return\x20full\x20raw\x20script\x20object','3531845MMPnnA','36276tXwZHP','scriptType','126JUwxcK','description','number','2100370qOqZVO','3072570kpGVzP','createdTime','42BZfUci','bool','appCode','num','3710836XRvTFA'];a39_0x46a0=function(){return _0x1c854b;};return a39_0x46a0();}const a39_0x204585=a39_0xdd80;function a39_0xdd80(_0x522718,_0x1074bb){_0x522718=_0x522718-0x1ef;const _0x46a047=a39_0x46a0();let _0xdd80a0=_0x46a047[_0x522718];return _0xdd80a0;}(function(_0x20a2e1,_0x28a779){const _0x1131c7=a39_0xdd80,_0x3a0a6b=_0x20a2e1();while(!![]){try{const _0x48b865=-parseInt(_0x1131c7(0x1f3))/0x1*(-parseInt(_0x1131c7(0x204))/0x2)+parseInt(_0x1131c7(0x1f1))/0x3+parseInt(_0x1131c7(0x1f7))/0x4+-parseInt(_0x1131c7(0x206))/0x5+-parseInt(_0x1131c7(0x207))/0x6*(parseInt(_0x1131c7(0x209))/0x7)+parseInt(_0x1131c7(0x1fa))/0x8*(-parseInt(_0x1131c7(0x1fc))/0x9)+parseInt(_0x1131c7(0x1f0))/0xa*(parseInt(_0x1131c7(0x202))/0xb);if(_0x48b865===_0x28a779)break;else _0x3a0a6b['push'](_0x3a0a6b['shift']());}catch(_0x582ae3){_0x3a0a6b['push'](_0x3a0a6b['shift']());}}}(a39_0x46a0,0xd37c3));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x204585(0x1f9),'command':'detail','description':a39_0x204585(0x203),'risk':'read','flags':[{'name':'id','type':a39_0x204585(0x1ef),'required':!![],'description':a39_0x204585(0x200)},{'name':'verbose','type':a39_0x204585(0x1fd),'description':a39_0x204585(0x205)}],async 'execute'(_0x1955e4){const _0x11c36b=a39_0x204585,_0xad7fb9=await getBffScriptInfo(_0x1955e4[_0x11c36b(0x1f6)]('id')),_0x512a3a=_0x1955e4[_0x11c36b(0x1f4)](_0x11c36b(0x1ff));if(_0x512a3a)return{'ok':!![],'data':_0xad7fb9};return{'ok':!![],'data':{'id':_0xad7fb9['id'],'functionName':_0xad7fb9[_0x11c36b(0x1fb)]??'','version':_0xad7fb9['version']??'','updateUserName':_0xad7fb9[_0x11c36b(0x1fe)]??'','appCode':_0xad7fb9[_0x11c36b(0x1f5)],'scriptType':_0xad7fb9[_0x11c36b(0x208)],'description':_0xad7fb9[_0x11c36b(0x20a)]||_0x11c36b(0x1f8),'createdTime':_0xad7fb9[_0x11c36b(0x1f2)]??'','updatedTime':_0xad7fb9['updatedTime']??'','scriptContent':_0xad7fb9[_0x11c36b(0x201)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x36f389,_0x4e313e){const _0x2e2253=a40_0x12e5,_0x2bd143=_0x36f389();while(!![]){try{const _0xbe88eb=-parseInt(_0x2e2253(0xca))/0x1*(-parseInt(_0x2e2253(0xcc))/0x2)+-parseInt(_0x2e2253(0xd2))/0x3+parseInt(_0x2e2253(0xcd))/0x4+parseInt(_0x2e2253(0xd0))/0x5+parseInt(_0x2e2253(0xd3))/0x6*(parseInt(_0x2e2253(0xcb))/0x7)+-parseInt(_0x2e2253(0xd1))/0x8+parseInt(_0x2e2253(0xcf))/0x9*(-parseInt(_0x2e2253(0xce))/0xa);if(_0xbe88eb===_0x4e313e)break;else _0x2bd143['push'](_0x2bd143['shift']());}catch(_0x1ede75){_0x2bd143['push'](_0x2bd143['shift']());}}}(a40_0x4a86,0x6728c));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_0x12e5(_0x3a0a5c,_0x2a9e6f){_0x3a0a5c=_0x3a0a5c-0xca;const _0x4a86fd=a40_0x4a86();let _0x12e59f=_0x4a86fd[_0x3a0a5c];return _0x12e59f;}import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';function a40_0x4a86(){const _0x34f5ff=['904ojoeuX','3636BjhURW','5321270zLQayH','9TTLAgw','3164495BtjYZE','495800WQNZSF','1267122RCHRKV','84MvJkdp','1333FzBQnU','101346qgtpyn'];a40_0x4a86=function(){return _0x34f5ff;};return a40_0x4a86();}export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0xdf292f=a41_0x1c9a;function a41_0x332d(){const _0x491123=['verbose','Return\x20full\x20script\x20objects','2412445FLCBwQ','No\x20Backend\x20Function\x20scripts\x20found.','List\x20Backend\x20Function\x20scripts','name','297yhFnJi','(unnamed)','383998bpBULa','scriptType','map','functionName','87FOLxaf','COMMON','string','bool','str','1604xLGXeo','description','46445FWREYe','558680HmCfLC','49016JqIvod','type','441aewZRy','appCode','2XItblZ','Filter\x20by\x20script\x20name','bff','5620362TRshSq','ENDPOINT'];a41_0x332d=function(){return _0x491123;};return a41_0x332d();}(function(_0x536e3f,_0x18df0f){const _0x54352c=a41_0x1c9a,_0x507e82=_0x536e3f();while(!![]){try{const _0x46e5ad=-parseInt(_0x54352c(0x191))/0x1*(-parseInt(_0x54352c(0x19e))/0x2)+-parseInt(_0x54352c(0x1a2))/0x3*(-parseInt(_0x54352c(0x1a7))/0x4)+parseInt(_0x54352c(0x18b))/0x5+parseInt(_0x54352c(0x194))/0x6+parseInt(_0x54352c(0x198))/0x7+-parseInt(_0x54352c(0x18d))/0x8*(-parseInt(_0x54352c(0x18f))/0x9)+-parseInt(_0x54352c(0x18c))/0xa*(parseInt(_0x54352c(0x19c))/0xb);if(_0x46e5ad===_0x18df0f)break;else _0x507e82['push'](_0x507e82['shift']());}catch(_0x518cf6){_0x507e82['push'](_0x507e82['shift']());}}}(a41_0x332d,0x74b71));function a41_0x1c9a(_0x3a98e8,_0x4eca72){_0x3a98e8=_0x3a98e8-0x18b;const _0x332daf=a41_0x332d();let _0x1c9ae8=_0x332daf[_0x3a98e8];return _0x1c9ae8;}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0xdf292f(0x193),'command':'list','description':a41_0xdf292f(0x19a),'risk':'read','flags':[{'name':a41_0xdf292f(0x18e),'type':a41_0xdf292f(0x1a4),'description':'Script\x20type\x20filter','default':a41_0xdf292f(0x195),'enum':[a41_0xdf292f(0x195),a41_0xdf292f(0x1a3)]},{'name':a41_0xdf292f(0x19b),'type':'string','description':a41_0xdf292f(0x192)},{'name':a41_0xdf292f(0x196),'type':'boolean','description':a41_0xdf292f(0x197)}],async 'execute'(_0x1f5304){const _0x12564f=a41_0xdf292f,_0x5312a4=await listBffScripts(_0x1f5304[_0x12564f(0x190)],_0x1f5304[_0x12564f(0x1a6)](_0x12564f(0x18e)),{'scriptName':_0x1f5304[_0x12564f(0x1a6)](_0x12564f(0x19b))||undefined}),_0xf5dfda=_0x1f5304[_0x12564f(0x1a5)](_0x12564f(0x196));return{'ok':!![],'data':_0xf5dfda?_0x5312a4:_0x5312a4[_0x12564f(0x1a0)](_0x5f26e6=>({'id':_0x5f26e6['id'],'functionName':_0x5f26e6[_0x12564f(0x1a1)]??'','description':_0x5f26e6[_0x12564f(0x1a8)]||_0x12564f(0x19d),'scriptType':_0x5f26e6[_0x12564f(0x19f)]})),'message':_0x5312a4['length']===0x0?_0x12564f(0x199):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0xfe8d43=a42_0x3526;(function(_0x96120,_0x160537){const _0x4a616f=a42_0x3526,_0xdbc807=_0x96120();while(!![]){try{const _0x147305=-parseInt(_0x4a616f(0x1de))/0x1+-parseInt(_0x4a616f(0x1e4))/0x2*(parseInt(_0x4a616f(0x1e0))/0x3)+parseInt(_0x4a616f(0x1dc))/0x4+-parseInt(_0x4a616f(0x1ef))/0x5+-parseInt(_0x4a616f(0x1d2))/0x6+-parseInt(_0x4a616f(0x1ee))/0x7+parseInt(_0x4a616f(0x1ed))/0x8;if(_0x147305===_0x160537)break;else _0xdbc807['push'](_0xdbc807['shift']());}catch(_0x496ad7){_0xdbc807['push'](_0xdbc807['shift']());}}}(a42_0x1aa6,0x93f9b));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_0xfe8d43(0x1cb),'INFO',a42_0xfe8d43(0x1dd),a42_0xfe8d43(0x1f3)];export function resolveBffLogQuery(_0x18d0e9,_0x13ce63=Date[a42_0xfe8d43(0x1e6)]()){const _0x5e1130=a42_0xfe8d43,_0x19ca99=_0x18d0e9[_0x5e1130(0x1e8)](_0x5e1130(0x1ea)),_0x4ad9b7=_0x18d0e9[_0x5e1130(0x1e8)](_0x5e1130(0x1ce)),_0x4fcae3=_0x18d0e9[_0x5e1130(0x1e8)](_0x5e1130(0x1d5));if(_0x19ca99!==undefined&&_0x4ad9b7!==undefined)throw CliErrors[_0x5e1130(0x1df)](_0x5e1130(0x1f0));const _0x22ad41=_0x4fcae3===undefined?_0x13ce63:readPositiveInteger(_0x18d0e9[_0x5e1130(0x1db)](_0x5e1130(0x1d5)),_0x5e1130(0x1cc)),_0x13231c=_0x4ad9b7===undefined?_0x22ad41-readSinceMinutes(_0x18d0e9)*0xea60:readPositiveInteger(_0x18d0e9[_0x5e1130(0x1db)](_0x5e1130(0x1ce)),_0x5e1130(0x1d9));if(_0x13231c<=0x0)throw CliErrors['validation'](_0x5e1130(0x1ca));if(_0x13231c>_0x22ad41)throw CliErrors['validation']('--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.');const _0x3999e1=readPositiveInteger(_0x18d0e9[_0x5e1130(0x1db)](_0x5e1130(0x1e2),DEFAULT_LIMIT),'--limit');if(_0x3999e1>MAX_LIMIT)throw CliErrors[_0x5e1130(0x1df)](_0x5e1130(0x1d1)+MAX_LIMIT+'.');const _0x524f90=_0x18d0e9['str'](_0x5e1130(0x1f1))[_0x5e1130(0x1f2)]()[_0x5e1130(0x1e1)]()||undefined,_0x57bb3a=_0x18d0e9[_0x5e1130(0x1eb)]('keyword')['trim']()||undefined;return{'appCode':_0x18d0e9['appCode'],'startTime':_0x13231c,'endTime':_0x22ad41,..._0x4ad9b7===undefined?{'sinceMinutes':readSinceMinutes(_0x18d0e9)}:{},..._0x524f90?{'level':_0x524f90}:{},..._0x57bb3a?{'keyword':_0x57bb3a}:{},'limit':_0x3999e1};}function readSinceMinutes(_0x124d9d){const _0x264609=a42_0xfe8d43;return readPositiveInteger(_0x124d9d[_0x264609(0x1db)]('since',DEFAULT_SINCE_MINUTES),_0x264609(0x1d3));}function readPositiveInteger(_0x5e9cf9,_0x136454){const _0x4915da=a42_0xfe8d43;if(!Number[_0x4915da(0x1cf)](_0x5e9cf9)||_0x5e9cf9<=0x0)throw CliErrors[_0x4915da(0x1df)](_0x136454+_0x4915da(0x1ec));return _0x5e9cf9;}function a42_0x1aa6(){const _0x31fd24=['toUpperCase','limit','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','461870pwzJTK','logs','now','Found\x20','flag','number','since','str','\x20must\x20be\x20a\x20positive\x20integer.','17244208VyNUoF','6053768TsgyzG','3672395MqkYkJ','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','level','trim','ERROR','keyword','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','DEBUG','--end-time','Maximum\x20log\x20lines\x20to\x20return\x20(1-','start-time','isSafeInteger','length','--limit\x20must\x20be\x20between\x201\x20and\x20','3762606mjCvFI','--since','string','end-time','read','\x20Backend\x20Function\x20log\x20line(s).','bff','--start-time','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','num','4579736zpZism','WARN','6079AQQrMO','validation','6QoNMsk'];a42_0x1aa6=function(){return _0x31fd24;};return a42_0x1aa6();}function a42_0x3526(_0x221741,_0x8bd91b){_0x221741=_0x221741-0x1ca;const _0x1aa654=a42_0x1aa6();let _0x352632=_0x1aa654[_0x221741];return _0x352632;}export const bffLogs={'service':a42_0xfe8d43(0x1d8),'command':a42_0xfe8d43(0x1e5),'description':a42_0xfe8d43(0x1f6),'risk':a42_0xfe8d43(0x1d6),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0xfe8d43(0x1ea),'type':a42_0xfe8d43(0x1e9),'description':a42_0xfe8d43(0x1da)+DEFAULT_SINCE_MINUTES+')'},{'name':'start-time','type':a42_0xfe8d43(0x1e9),'description':a42_0xfe8d43(0x1e3)},{'name':a42_0xfe8d43(0x1d5),'type':a42_0xfe8d43(0x1e9),'description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0xfe8d43(0x1f1),'type':a42_0xfe8d43(0x1d4),'description':'Filter\x20by\x20log\x20level','enum':LOG_LEVELS},{'name':a42_0xfe8d43(0x1f4),'type':'string','description':'Filter\x20formatted\x20log\x20lines\x20by\x20keyword'},{'name':'limit','type':a42_0xfe8d43(0x1e9),'description':a42_0xfe8d43(0x1cd)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x181f16){resolveBffLogQuery(_0x181f16);},async 'execute'(_0x58b9d3){const _0x5e7c02=a42_0xfe8d43,_0x29a400=resolveBffLogQuery(_0x58b9d3),{sinceMinutes:_0x3c94f0,..._0x30948d}=_0x29a400,_0x35b02b=await searchBffScriptLogs(_0x30948d);return{'ok':!![],'data':{'query':_0x29a400,'count':_0x35b02b[_0x5e7c02(0x1d0)],'logs':_0x35b02b},'message':_0x35b02b[_0x5e7c02(0x1d0)]===0x0?_0x5e7c02(0x1f5):_0x5e7c02(0x1e7)+_0x35b02b[_0x5e7c02(0x1d0)]+_0x5e7c02(0x1d7)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x51c52a=a43_0x4ce0;(function(_0x4db81d,_0x2ebbc9){const _0x1ddaa6=a43_0x4ce0,_0x45db6b=_0x4db81d();while(!![]){try{const _0x2c64a4=-parseInt(_0x1ddaa6(0x257))/0x1+-parseInt(_0x1ddaa6(0x214))/0x2*(parseInt(_0x1ddaa6(0x248))/0x3)+-parseInt(_0x1ddaa6(0x246))/0x4*(-parseInt(_0x1ddaa6(0x222))/0x5)+-parseInt(_0x1ddaa6(0x254))/0x6*(-parseInt(_0x1ddaa6(0x218))/0x7)+parseInt(_0x1ddaa6(0x206))/0x8*(-parseInt(_0x1ddaa6(0x216))/0x9)+-parseInt(_0x1ddaa6(0x24c))/0xa*(-parseInt(_0x1ddaa6(0x228))/0xb)+-parseInt(_0x1ddaa6(0x1dc))/0xc*(-parseInt(_0x1ddaa6(0x266))/0xd);if(_0x2c64a4===_0x2ebbc9)break;else _0x45db6b['push'](_0x45db6b['shift']());}catch(_0x198c43){_0x45db6b['push'](_0x45db6b['shift']());}}}(a43_0x5c68,0x768b1));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';function a43_0x4ce0(_0xdfad9d,_0x4ab547){_0xdfad9d=_0xdfad9d-0x1d9;const _0x5c684b=a43_0x5c68();let _0x4ce00a=_0x5c684b[_0xdfad9d];return _0x4ce00a;}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_0x51c52a(0x269),'command':a43_0x51c52a(0x1e9),'description':a43_0x51c52a(0x1f4),'risk':a43_0x51c52a(0x219),'structuredErrors':!![],'flags':[{'name':a43_0x51c52a(0x1f2),'type':a43_0x51c52a(0x1e1),'description':a43_0x51c52a(0x244),'enum':[a43_0x51c52a(0x251),a43_0x51c52a(0x227),a43_0x51c52a(0x1f7)]},{'name':'force','type':a43_0x51c52a(0x23b),'description':a43_0x51c52a(0x258)}],async 'dryRun'(_0x4b7d1b){const _0x4073de=a43_0x51c52a,_0x2f9d5b=loadBffProjectConfig(_0x4b7d1b[_0x4073de(0x25f)]),_0x1509b5=await readBffLockFile(_0x2f9d5b[_0x4073de(0x205)]),{appLock:_0x5089ba}=ensureLockScope(_0x1509b5??createEmptyBffLock(),_0x4b7d1b[_0x4073de(0x25f)],_0x2f9d5b['scriptsRoot'],_0x4073de(0x1e9)),_0x2872ec=normalizeBffType(_0x4b7d1b[_0x4073de(0x1ed)]('type'))??undefined,[_0x3546f3,_0x48d1d1]=await Promise[_0x4073de(0x1df)]([listBffScripts(_0x4b7d1b[_0x4073de(0x25f)],_0x2872ec),getBffScriptStatistics(_0x4b7d1b['appCode'])]),_0x1850cc=_0x3546f3[_0x4073de(0x255)](_0x1bf45e=>normalizeBffType(_0x1bf45e[_0x4073de(0x1e4)])===_0x4073de(0x1f7)),_0x3f6ce2=_0x1850cc?buildDatasetCodeToAliasMap(_0x4b7d1b[_0x4073de(0x209)],_0x4b7d1b[_0x4073de(0x25f)],_0x4b7d1b[_0x4073de(0x1da)]||_0x4b7d1b[_0x4073de(0x1e0)]?.[_0x4073de(0x213)]||_0x4b7d1b['mergedCli']?.['defaultApp']):new Map(),_0x440eb5=_0x1850cc?await planHookDirectoryMigration(_0x2f9d5b,_0x5089ba,_0x3f6ce2,await scanLocalBffFunctions(_0x2f9d5b,_0x4073de(0x1f7))):undefined,_0x388983=createHookLocationMap(_0x48d1d1),_0x2ec8a9=[];for(const _0x93b323 of _0x3546f3){const _0x4eff02=resolveRemoteScriptTarget(_0x2f9d5b,_0x93b323,_0x388983,_0x440eb5?.[_0x4073de(0x21a)]??_0x5089ba['functions'],_0x3f6ce2);if(!_0x4eff02){_0x2ec8a9[_0x4073de(0x242)]({'scriptType':_0x93b323[_0x4073de(0x1e4)],'functionName':_0x93b323[_0x4073de(0x1f0)]??'','status':'skipped','reason':_0x4073de(0x20e)});continue;}const _0x364fb4=(_0x440eb5?.[_0x4073de(0x21a)]??_0x5089ba[_0x4073de(0x1f9)])[_0x4eff02['lockKey']],_0x299393=_0x93b323['scriptContent']!=null?computeContentHash(_0x93b323['scriptContent']):undefined,_0x513e6d=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x440eb5,_0x4eff02)??_0x4eff02[_0x4073de(0x231)],_0x364fb4,_0x299393),_0x3b2ed2=_0x513e6d?localUnsyncedConflict(_0x4eff02,_0x93b323['id']):undefined;_0x2ec8a9[_0x4073de(0x242)]({'lockKey':_0x4eff02[_0x4073de(0x1fc)],'filePath':_0x4eff02[_0x4073de(0x231)],'remoteId':_0x93b323['id']??null,'status':_0x3b2ed2?_0x4073de(0x208):'would_pull',..._0x3b2ed2?{'conflict':_0x3b2ed2}:{},..._0x4eff02[_0x4073de(0x21e)]?{'alias':_0x4eff02[_0x4073de(0x21e)][_0x4073de(0x21d)]??null,'datasetCode':_0x4eff02[_0x4073de(0x21e)][_0x4073de(0x20c)],'operationType':_0x4eff02['hookLocation'][_0x4073de(0x1ec)],'functionNode':_0x4eff02[_0x4073de(0x21e)][_0x4073de(0x1e2)]}:{}});}return{'method':'GET','url':_0x4073de(0x21c)+_0x4b7d1b[_0x4073de(0x25f)]+(_0x2872ec?_0x4073de(0x1ee)+_0x2872ec:'')+_0x4073de(0x1f6)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x4b7d1b[_0x4073de(0x25f)],'filterType':_0x2872ec??null,..._0x440eb5&&_0x440eb5['migrations'][_0x4073de(0x26a)]>0x0?{'hookDirectoryMigrations':_0x440eb5[_0x4073de(0x236)]['map'](_0x1ccff7=>({'from':_0x1ccff7[_0x4073de(0x1d9)],'to':_0x1ccff7[_0x4073de(0x260)]}))}:{},'files':_0x2ec8a9},'description':_0x4073de(0x1f8)+_0x2ec8a9['length']+_0x4073de(0x1e6)};},async 'execute'(_0x3cc65d){const _0xc8da7f=a43_0x51c52a,_0x2471e4=loadBffProjectConfig(_0x3cc65d[_0xc8da7f(0x25f)]),_0x9c881a=await readBffLockFile(_0x2471e4[_0xc8da7f(0x205)]),{lockData:_0x407e32,appLock:_0x3c03f3}=ensureLockScope(_0x9c881a??createEmptyBffLock(),_0x3cc65d[_0xc8da7f(0x25f)],_0x2471e4['scriptsRoot'],_0xc8da7f(0x1e9)),_0x5e21fe=normalizeBffType(_0x3cc65d[_0xc8da7f(0x1ed)]('type'))??undefined;if(_0x3cc65d[_0xc8da7f(0x1ed)]('type')&&!_0x5e21fe)throw CliErrors['validation']('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x87ebe,_0x3c2f23]=await Promise[_0xc8da7f(0x1df)]([listBffScripts(_0x3cc65d[_0xc8da7f(0x25f)],_0x5e21fe),getBffScriptStatistics(_0x3cc65d[_0xc8da7f(0x25f)])]);if(_0x87ebe[_0xc8da7f(0x26a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0xc8da7f(0x1fe)};const _0xe17429=_0x3cc65d[_0xc8da7f(0x234)](_0xc8da7f(0x25c));if(_0xe17429&&!_0x3cc65d[_0xc8da7f(0x262)]){const _0x162286=await confirmForce();if(!_0x162286)throw CliErrors[_0xc8da7f(0x1e5)](_0xc8da7f(0x1e7));}if(_0xe17429&&_0x3cc65d[_0xc8da7f(0x262)]){}const _0x289be7=_0x87ebe[_0xc8da7f(0x255)](_0x32c626=>normalizeBffType(_0x32c626[_0xc8da7f(0x1e4)])===_0xc8da7f(0x1f7)),_0x1f6dbc=_0x289be7?buildDatasetCodeToAliasMap(_0x3cc65d[_0xc8da7f(0x209)],_0x3cc65d['appCode'],_0x3cc65d[_0xc8da7f(0x1da)]||_0x3cc65d[_0xc8da7f(0x1e0)]?.[_0xc8da7f(0x213)]||_0x3cc65d['mergedCli']?.['defaultApp']):new Map(),_0xa7e8d3=createHookLocationMap(_0x3c2f23),_0x37bf06=JSON[_0xc8da7f(0x23a)](JSON['stringify'](_0x407e32)),_0x543d22=_0x3cc65d[_0xc8da7f(0x25f)],_0x4a1476=_0x37bf06[_0xc8da7f(0x22c)][_0x543d22];if(!_0x4a1476)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x543d22+_0xc8da7f(0x241));const _0x1a4ee4=_0x289be7?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x2471e4,_0x4a1476,_0x1f6dbc,await scanLocalBffFunctions(_0x2471e4,'HOOK')),_0x4a1476):undefined,_0x5c7231=createPullFileTransaction(),_0x24cf83=[],_0x19fe70=[],_0x214e6d=[],_0x37b9bd=[];for(const _0x1c0b33 of _0x87ebe){const _0x58b335=resolveRemoteScriptTarget(_0x2471e4,_0x1c0b33,_0xa7e8d3,_0x4a1476[_0xc8da7f(0x1f9)],_0x1f6dbc);if(!_0x58b335){_0x19fe70['push']({'lockKey':_0x1c0b33[_0xc8da7f(0x1e4)]+'/'+_0x1c0b33[_0xc8da7f(0x1f0)],'reason':_0xc8da7f(0x20e)});continue;}const _0xab45d5=_0x4a1476[_0xc8da7f(0x1f9)][_0x58b335[_0xc8da7f(0x1fc)]];try{if(!_0x1c0b33['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x1c0b33[_0xc8da7f(0x1ef)]==null)throw new Error(_0xc8da7f(0x1f1));const _0x566bb7=_0x1c0b33['scriptContent'],_0xd5c7af=computeContentHash(_0x566bb7);if(!_0xe17429){const _0xb52a77=await hasUnsyncedLocalChanges(_0x58b335[_0xc8da7f(0x231)],_0xab45d5,_0xd5c7af);if(_0xb52a77){_0x214e6d[_0xc8da7f(0x242)](localUnsyncedConflict(_0x58b335,_0x1c0b33['id']));continue;}}await _0x5c7231[_0xc8da7f(0x1f5)](_0x58b335[_0xc8da7f(0x231)],_0x566bb7);const _0x41126a={'hash':_0xd5c7af,'remoteId':_0x1c0b33['id'],'version':_0x1c0b33[_0xc8da7f(0x225)]};_0x58b335[_0xc8da7f(0x1f2)]===_0xc8da7f(0x1f7)&&_0x58b335[_0xc8da7f(0x21e)]&&(_0x41126a[_0xc8da7f(0x21d)]=_0x58b335[_0xc8da7f(0x21e)][_0xc8da7f(0x21d)],_0x41126a[_0xc8da7f(0x20c)]=_0x58b335[_0xc8da7f(0x21e)][_0xc8da7f(0x20c)],_0x41126a[_0xc8da7f(0x1ec)]=_0x58b335[_0xc8da7f(0x21e)][_0xc8da7f(0x1ec)],_0x41126a['functionNode']=_0x58b335[_0xc8da7f(0x21e)]['functionNode']),_0x4a1476[_0xc8da7f(0x1f9)][_0x58b335[_0xc8da7f(0x1fc)]]=_0x41126a,_0x24cf83[_0xc8da7f(0x242)]({'lockKey':_0x58b335['lockKey'],'remoteId':_0x1c0b33['id']});}catch(_0x35dd18){_0x37b9bd['push']({'lockKey':_0x58b335[_0xc8da7f(0x1fc)],'error':_0x35dd18 instanceof Error?_0x35dd18[_0xc8da7f(0x212)]:String(_0x35dd18)});}}_0x4a1476['lastSync']=new Date()['toISOString']();try{await writeBffLockFile(_0x2471e4[_0xc8da7f(0x205)],_0x37bf06);}catch(_0x3d9d64){const _0x5e64f9=[...await _0x5c7231['rollback'](),...await _0x1a4ee4?.['rollback']()??[]];throw withRollbackErrors(_0x3d9d64,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x5e64f9);}return{'ok':_0x37b9bd[_0xc8da7f(0x26a)]===0x0,'data':{'pulled':_0x24cf83,'skipped':_0x19fe70,'conflicts':_0x214e6d,'failed':_0x37b9bd},'message':formatPullMessage(_0x24cf83[_0xc8da7f(0x26a)],_0x19fe70['length'],_0x214e6d[_0xc8da7f(0x26a)],_0x37b9bd[_0xc8da7f(0x26a)])};}};function localUnsyncedConflict(_0x513af6,_0x360685){const _0x2187e2=a43_0x51c52a,_0x4c9bc0=_0x513af6[_0x2187e2(0x1fc)]['split']('/')['at'](-0x1);return{'code':_0x2187e2(0x24e),'lockKey':_0x513af6['lockKey'],'filePath':_0x513af6[_0x2187e2(0x231)],..._0x360685!=null?{'remoteId':_0x360685}:{},'message':_0x2187e2(0x23e),'nextAction':{'action':_0x2187e2(0x235),'command':CLI_BIN_NAME+_0x2187e2(0x253)+_0x513af6['type']+_0x2187e2(0x265)+_0x4c9bc0+_0x2187e2(0x21f),'requiresReview':!![],'message':_0x2187e2(0x24b)}};}function formatPullMessage(_0x402e4e,_0x475078,_0x376829,_0x51dbf2){const _0x4d7a69=a43_0x51c52a,_0x3f387d=[_0x4d7a69(0x264)+_0x402e4e+_0x4d7a69(0x25b),_0x475078+'\x20skipped'];_0x376829>0x0&&_0x3f387d[_0x4d7a69(0x242)](_0x376829+'\x20conflict'+(_0x376829===0x1?'':'s')+'\x20'+(_0x376829===0x1?_0x4d7a69(0x22f):_0x4d7a69(0x23f))+_0x4d7a69(0x223));if(_0x51dbf2>0x0)_0x3f387d['push'](_0x51dbf2+'\x20failed');return _0x3f387d[_0x4d7a69(0x24f)](',\x20');}async function hasUnsyncedLocalChanges(_0x8b9d2,_0x46ac32,_0x5eb3ca){const _0x24b344=a43_0x51c52a;if(!await fileExists(_0x8b9d2))return![];const _0x281422=await computeFileHash(_0x8b9d2);if(!_0x46ac32)return _0x5eb3ca?_0x281422!==_0x5eb3ca:!![];return _0x281422!==_0x46ac32[_0x24b344(0x249)];}function createPullFileTransaction(){const _0x413b3d=new Map(),_0x262aa1=async(_0x30ee50,_0x2426dc)=>{const _0x4996e1=a43_0x4ce0;try{if(_0x2426dc['existed'])await ensureParentDirectory(_0x30ee50),await writeFile(_0x30ee50,_0x2426dc['content']);else try{await unlink(_0x30ee50);}catch(_0xd1ec99){if(_0xd1ec99['code']!==_0x4996e1(0x221))throw _0xd1ec99;}return undefined;}catch(_0x3b1d99){return _0x3b1d99 instanceof Error?_0x3b1d99:new Error(String(_0x3b1d99));}};return{async 'write'(_0x4eea28,_0x433a6e){const _0x37ae99=a43_0x4ce0;if(!_0x413b3d[_0x37ae99(0x240)](_0x4eea28))try{_0x413b3d[_0x37ae99(0x20a)](_0x4eea28,{'existed':!![],'content':await readFile(_0x4eea28)});}catch(_0x5f4c1c){if(_0x5f4c1c[_0x37ae99(0x20f)]!==_0x37ae99(0x221))throw _0x5f4c1c;_0x413b3d[_0x37ae99(0x20a)](_0x4eea28,{'existed':![]});}try{await ensureParentDirectory(_0x4eea28),await writeFile(_0x4eea28,_0x433a6e,_0x37ae99(0x1ff));}catch(_0x1eaff5){const _0x1a4186=await _0x262aa1(_0x4eea28,_0x413b3d[_0x37ae99(0x1fd)](_0x4eea28));if(!_0x1a4186)_0x413b3d[_0x37ae99(0x25a)](_0x4eea28);throw withRollbackErrors(_0x1eaff5,_0x37ae99(0x1f3)+_0x4eea28+'\x22.',_0x1a4186?[_0x1a4186]:[]);}},async 'rollback'(){const _0x359d0a=a43_0x4ce0,_0xee072c=[];for(const [_0x50616f,_0xaa6e9c]of[..._0x413b3d[_0x359d0a(0x1db)]()][_0x359d0a(0x24d)]()){const _0x19e09a=await _0x262aa1(_0x50616f,_0xaa6e9c);_0x19e09a&&_0xee072c['push'](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x50616f+_0x359d0a(0x259)+_0x19e09a[_0x359d0a(0x212)]));}return _0xee072c;}};}function withRollbackErrors(_0x5ef579,_0x2e6abf,_0x3286d7){const _0x421a73=a43_0x51c52a,_0x45225c=_0x5ef579 instanceof Error?_0x5ef579:new Error(String(_0x5ef579));if(_0x3286d7['length']===0x0)return _0x45225c;return new AggregateError([_0x45225c,..._0x3286d7],_0x2e6abf+_0x421a73(0x238)+_0x3286d7[_0x421a73(0x1de)](_0x1c7c94=>_0x1c7c94[_0x421a73(0x212)])[_0x421a73(0x24f)](';\x20'));}function buildDatasetCodeToAliasMap(_0x587c8f,_0x55ad0b,_0x49ea16){const _0x21b8cb=a43_0x51c52a,_0x3d82ac=resolveApiModelSource(_0x587c8f,_0x55ad0b,_0x49ea16),_0x18d15f=loadAliasMap(_0x587c8f,undefined,_0x3d82ac[_0x21b8cb(0x231)],_0x3d82ac[_0x21b8cb(0x1e3)]);return assertUnambiguousHookAliases(_0x18d15f),new Map(_0x18d15f['map'](_0x5bedc2=>[_0x5bedc2['datasetCode'][_0x21b8cb(0x20b)](),_0x5bedc2[_0x21b8cb(0x21d)]]));}async function planHookDirectoryMigration(_0x2d7b6e,_0x842d54,_0x5337e4,_0x403cf3){const _0x5b55b2=a43_0x51c52a,_0x1fabf5=new Map();for(const [_0x1efaba,_0x3e5499]of Object['entries'](_0x842d54[_0x5b55b2(0x1f9)])){const [_0x245bf0,_0x2bdf8b,_0x3dfa2c,_0x7433c1,_0x3a6213,..._0x5d659c]=_0x1efaba[_0x5b55b2(0x207)]('/');if(_0x245bf0!==_0x5b55b2(0x1f7)||!_0x2bdf8b||!_0x3dfa2c||!_0x7433c1||!_0x3a6213||_0x5d659c[_0x5b55b2(0x26a)]>0x0||!_0x3e5499['datasetCode'])continue;const _0x55e1f9=_0x5337e4[_0x5b55b2(0x1fd)](_0x3e5499[_0x5b55b2(0x20c)]['toLowerCase']()),_0xf38eb9=_0x55e1f9??_0x3e5499['datasetCode'];if(!isSafeHookDirectorySegment(_0x2bdf8b))throw CliErrors[_0x5b55b2(0x252)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x2bdf8b+_0x5b55b2(0x224));if(!isSafeHookDirectorySegment(_0xf38eb9))throw CliErrors[_0x5b55b2(0x252)](_0x5b55b2(0x20d)+_0x2bdf8b+_0x5b55b2(0x202));if(_0x2bdf8b===_0xf38eb9)continue;const _0x16dce6=_0x1fabf5['get'](_0x2bdf8b)??{'datasetCode':_0x3e5499['datasetCode'],'alias':_0x55e1f9,'keyChanges':[]};if(_0x16dce6[_0x5b55b2(0x20c)]!==_0x3e5499[_0x5b55b2(0x20c)])throw CliErrors[_0x5b55b2(0x252)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x2bdf8b+'\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.');const _0x233212=_0x5b55b2(0x1dd)+_0xf38eb9+'/'+_0x3dfa2c+'/'+_0x7433c1+'/'+_0x3a6213;try{resolveLocalFilePathFromLockKey(_0x2d7b6e,_0x1efaba),resolveLocalFilePathFromLockKey(_0x2d7b6e,_0x233212);}catch(_0x3d8337){throw CliErrors[_0x5b55b2(0x252)](_0x5b55b2(0x245)+_0x1efaba+_0x5b55b2(0x259)+(_0x3d8337 instanceof Error?_0x3d8337[_0x5b55b2(0x212)]:String(_0x3d8337)));}_0x16dce6[_0x5b55b2(0x267)]['push']({'oldLockKey':_0x1efaba,'newLockKey':_0x233212,'entry':_0x3e5499}),_0x1fabf5[_0x5b55b2(0x20a)](_0x2bdf8b,_0x16dce6);}const _0x3616b3=new Set([..._0x1fabf5[_0x5b55b2(0x21b)]()]['flatMap'](_0x5b6f58=>_0x5b6f58['keyChanges'][_0x5b55b2(0x1de)](_0x38994b=>_0x38994b[_0x5b55b2(0x22a)]))),_0x4362fd=new Map(),_0x4b21b3=new Map();for(const [_0x25a4c0,_0x1cc58b]of _0x1fabf5){const _0x185066=_0x1cc58b[_0x5b55b2(0x21d)]??_0x1cc58b[_0x5b55b2(0x20c)],_0x169853=hookDirectoryIdentity(_0x185066),_0x42ebdc=_0x4362fd[_0x5b55b2(0x1fd)](_0x169853);if(_0x42ebdc&&_0x42ebdc!==_0x25a4c0)throw CliErrors[_0x5b55b2(0x252)]('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x42ebdc+'\x22\x20and\x20\x22'+_0x25a4c0+_0x5b55b2(0x25d)+_0x185066+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x4362fd[_0x5b55b2(0x20a)](_0x169853,_0x25a4c0);for(const _0x134573 of _0x1cc58b[_0x5b55b2(0x267)]){const _0x49acbb=_0x4b21b3[_0x5b55b2(0x1fd)](_0x134573['newLockKey']);if(_0x49acbb&&_0x49acbb!==_0x134573[_0x5b55b2(0x22a)])throw CliErrors['validation'](_0x5b55b2(0x22d)+_0x49acbb+_0x5b55b2(0x1ea)+_0x134573[_0x5b55b2(0x22a)]+_0x5b55b2(0x25d)+_0x134573[_0x5b55b2(0x215)]+_0x5b55b2(0x229));if(_0x3616b3[_0x5b55b2(0x240)](_0x134573[_0x5b55b2(0x215)]))throw CliErrors['validation'](_0x5b55b2(0x217)+_0x134573[_0x5b55b2(0x22a)]+_0x5b55b2(0x247)+_0x134573['newLockKey']+_0x5b55b2(0x232));_0x4b21b3['set'](_0x134573[_0x5b55b2(0x215)],_0x134573[_0x5b55b2(0x22a)]);}}const _0x251a0b=new Map();for(const [_0x36aa22,_0x3ee7e7]of _0x5337e4){_0x251a0b[_0x5b55b2(0x20a)](hookDirectoryIdentity(_0x3ee7e7),_0x36aa22);}const _0x3d8970=[];for(const [_0x361ca1,_0x4991d0]of _0x1fabf5){const _0x2bd087=_0x4991d0[_0x5b55b2(0x21d)]??_0x4991d0['datasetCode'],_0x38eaf0=join(_0x2d7b6e[_0x5b55b2(0x268)],_0x5b55b2(0x1f7),_0x361ca1),_0x2ca87a=join(_0x2d7b6e[_0x5b55b2(0x268)],'HOOK',_0x2bd087),_0x3702e5=await directoryExists(_0x38eaf0),_0x4f4b2d=await directoryExists(_0x2ca87a),_0x2e02c2=_0x3702e5?_0x4f4b2d?await sameDirectory(_0x38eaf0,_0x2ca87a)?_0x5b55b2(0x200):undefined:_0x5b55b2(0x233):_0x5b55b2(0x1eb);if(!_0x2e02c2)throw CliErrors['validation'](_0x5b55b2(0x20d)+_0x361ca1+'\x22\x20to\x20\x22'+_0x2bd087+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x1850d3=_0x251a0b[_0x5b55b2(0x1fd)](hookDirectoryIdentity(_0x361ca1));if(_0x1850d3&&_0x1850d3!==_0x4991d0[_0x5b55b2(0x20c)][_0x5b55b2(0x20b)]()){const _0x4a3446=new Set(_0x4991d0['keyChanges'][_0x5b55b2(0x1de)](_0x499f56=>_0x499f56[_0x5b55b2(0x22a)])),_0x8dc311=_0x403cf3[_0x5b55b2(0x1fa)](_0x266142=>_0x266142[_0x5b55b2(0x1f2)]===_0x5b55b2(0x1f7)&&_0x266142[_0x5b55b2(0x21d)]!=null&&hookDirectoryIdentity(_0x266142[_0x5b55b2(0x21d)])===hookDirectoryIdentity(_0x361ca1)&&!_0x4a3446[_0x5b55b2(0x240)](_0x266142[_0x5b55b2(0x1fc)]));if(_0x8dc311[_0x5b55b2(0x26a)]>0x0)throw CliErrors[_0x5b55b2(0x252)](_0x5b55b2(0x20d)+_0x361ca1+_0x5b55b2(0x26b));}const _0x25bb4e=_0x251a0b[_0x5b55b2(0x1fd)](hookDirectoryIdentity(_0x2bd087));if(_0x25bb4e&&_0x25bb4e!==_0x4991d0[_0x5b55b2(0x20c)]['toLowerCase']())throw CliErrors[_0x5b55b2(0x252)](_0x5b55b2(0x20d)+_0x361ca1+_0x5b55b2(0x22b)+_0x2bd087+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x27fb98 of _0x4991d0[_0x5b55b2(0x267)]){const _0x288b63=_0x842d54['functions'][_0x27fb98['newLockKey']];if(_0x288b63&&!_0x3616b3[_0x5b55b2(0x240)](_0x27fb98[_0x5b55b2(0x215)])&&!sameHookIdentity(_0x27fb98[_0x5b55b2(0x203)],_0x288b63))throw CliErrors[_0x5b55b2(0x252)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x361ca1+_0x5b55b2(0x22b)+_0x2bd087+'\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.');}_0x3d8970[_0x5b55b2(0x242)]({'oldDirectory':_0x361ca1,'newDirectory':_0x2bd087,'oldDirectoryPath':_0x38eaf0,'newDirectoryPath':_0x2ca87a,'mode':_0x2e02c2,'alias':_0x4991d0[_0x5b55b2(0x21d)],'keyChanges':_0x4991d0[_0x5b55b2(0x267)]});}const _0x9fab2d={..._0x842d54['functions']},_0x1b9952=new Map(),_0x42eebd=new Map();for(const _0x47d0f5 of _0x3d8970){const _0x4153b6=_0x47d0f5[_0x5b55b2(0x204)]!==_0x5b55b2(0x1eb);_0x4153b6&&_0x42eebd[_0x5b55b2(0x20a)](hookDirectoryIdentity(_0x47d0f5[_0x5b55b2(0x260)]),_0x47d0f5[_0x5b55b2(0x243)]);for(const _0x47406d of _0x47d0f5[_0x5b55b2(0x267)]){const _0x90d681=_0x9fab2d[_0x47406d[_0x5b55b2(0x215)]],_0x165927=_0x4153b6?_0x47406d[_0x5b55b2(0x203)]:_0x90d681??_0x47406d[_0x5b55b2(0x203)];_0x9fab2d[_0x47406d['newLockKey']]=canonicalizeHookEntry(_0x165927,_0x47d0f5[_0x5b55b2(0x21d)]),delete _0x9fab2d[_0x47406d[_0x5b55b2(0x22a)]],_0x4153b6&&_0x1b9952['set'](_0x47406d[_0x5b55b2(0x215)],resolveLocalFilePathFromLockKey(_0x2d7b6e,_0x47406d['oldLockKey']));}}return{'migrations':_0x3d8970,'projectedFunctions':_0x9fab2d,'sourceFilePathByNewLockKey':_0x1b9952,'sourceDirectoryPathByNewDirectory':_0x42eebd};}function resolveMigratedSourceFilePath(_0x20c6ee,_0x5355d7){const _0x361d5a=a43_0x51c52a;if(!_0x20c6ee||!_0x5355d7)return undefined;const _0x278462=_0x20c6ee[_0x361d5a(0x263)][_0x361d5a(0x1fd)](_0x5355d7['lockKey']);if(_0x278462)return _0x278462;if(_0x5355d7[_0x361d5a(0x1f2)]!==_0x361d5a(0x1f7))return undefined;const [,_0x4aed45,..._0x32d574]=_0x5355d7[_0x361d5a(0x1fc)][_0x361d5a(0x207)]('/');if(!_0x4aed45||_0x32d574['length']===0x0)return undefined;const _0x18715b=_0x20c6ee['sourceDirectoryPathByNewDirectory'][_0x361d5a(0x1fd)](hookDirectoryIdentity(_0x4aed45));return _0x18715b?join(_0x18715b,..._0x32d574)+'.js':undefined;}function sameHookIdentity(_0x1dbc6d,_0x1852ef){const _0x1e7429=a43_0x51c52a;return _0x1dbc6d[_0x1e7429(0x211)]===_0x1852ef[_0x1e7429(0x211)]&&_0x1dbc6d['datasetCode']===_0x1852ef[_0x1e7429(0x20c)]&&_0x1dbc6d['operationType']===_0x1852ef['operationType']&&_0x1dbc6d[_0x1e7429(0x1e2)]===_0x1852ef[_0x1e7429(0x1e2)];}function canonicalizeHookEntry(_0xe5a816,_0x237df5){const {alias:_0x5b099a,..._0x428356}=_0xe5a816;return _0x237df5?{..._0x428356,'alias':_0x237df5}:_0x428356;}function hookDirectoryIdentity(_0x486e03){const _0x205fe3=a43_0x51c52a;return _0x486e03[_0x205fe3(0x26c)]('NFC')['toLowerCase']();}function isSafeHookDirectorySegment(_0x16fc98){return isSafeLockKeySegment(_0x16fc98);}async function sameDirectory(_0x458497,_0x3625f8){const _0x5a3f25=a43_0x51c52a,[_0xfb5a5f,_0x4ffadd]=await Promise['all']([stat(_0x458497),stat(_0x3625f8)]);return _0xfb5a5f['dev']===_0x4ffadd[_0x5a3f25(0x210)]&&_0xfb5a5f[_0x5a3f25(0x256)]===_0x4ffadd[_0x5a3f25(0x256)];}async function applyHookDirectoryMigration(_0x5a3f48,_0x2b3638){const _0xa3a2bd=a43_0x51c52a,_0x393536=_0x2b3638[_0xa3a2bd(0x1f9)],_0x180761=_0x2b3638[_0xa3a2bd(0x250)],_0x1c6cbf=[],_0x40f601=async()=>{const _0x289e33=_0xa3a2bd,_0x2c1e5d=[];_0x2b3638[_0x289e33(0x1f9)]=_0x393536,_0x2b3638[_0x289e33(0x250)]=_0x180761;for(const {migration:_0x110174,temporaryPath:_0x50faa6}of[..._0x1c6cbf]['reverse']()){try{_0x50faa6?(await rename(_0x110174[_0x289e33(0x23d)],_0x50faa6),await rename(_0x50faa6,_0x110174['oldDirectoryPath'])):await rename(_0x110174[_0x289e33(0x23d)],_0x110174[_0x289e33(0x243)]);}catch(_0x4c3efe){_0x2c1e5d[_0x289e33(0x242)](new Error(_0x289e33(0x1fb)+_0x110174[_0x289e33(0x1d9)]+'\x22\x20from\x20\x22'+_0x110174[_0x289e33(0x260)]+_0x289e33(0x259)+(_0x4c3efe instanceof Error?_0x4c3efe[_0x289e33(0x212)]:String(_0x4c3efe))));}}return _0x2c1e5d;};try{for(const _0x35a592 of _0x5a3f48[_0xa3a2bd(0x236)]){if(_0x35a592[_0xa3a2bd(0x204)]===_0xa3a2bd(0x233))await ensureParentDirectory(_0x35a592[_0xa3a2bd(0x23d)]),await rename(_0x35a592[_0xa3a2bd(0x243)],_0x35a592['newDirectoryPath']),_0x1c6cbf[_0xa3a2bd(0x242)]({'migration':_0x35a592});else{if(_0x35a592[_0xa3a2bd(0x204)]==='case-rename'){const _0x443702=join(dirname(_0x35a592[_0xa3a2bd(0x243)]),_0xa3a2bd(0x230)+randomUUID());await rename(_0x35a592['oldDirectoryPath'],_0x443702);try{await rename(_0x443702,_0x35a592[_0xa3a2bd(0x23d)]);}catch(_0x4b6d19){try{await rename(_0x443702,_0x35a592[_0xa3a2bd(0x243)]);}catch(_0x56a471){throw withRollbackErrors(_0x4b6d19,_0xa3a2bd(0x25e)+_0x35a592[_0xa3a2bd(0x1d9)]+_0xa3a2bd(0x22b)+_0x35a592['newDirectory']+_0xa3a2bd(0x220)+_0x443702+_0xa3a2bd(0x201),[new Error(_0xa3a2bd(0x239)+_0x443702+'\x22\x20to\x20\x22'+_0x35a592[_0xa3a2bd(0x1d9)]+_0xa3a2bd(0x259)+(_0x56a471 instanceof Error?_0x56a471[_0xa3a2bd(0x212)]:String(_0x56a471)))]);}throw _0x4b6d19;}_0x1c6cbf[_0xa3a2bd(0x242)]({'migration':_0x35a592,'temporaryPath':_0x443702});}}}return _0x2b3638[_0xa3a2bd(0x1f9)]=_0x5a3f48[_0xa3a2bd(0x21a)],{'rollback':_0x40f601};}catch(_0x1748b6){const _0x567893=await _0x40f601();throw withRollbackErrors(_0x1748b6,_0xa3a2bd(0x1e8),_0x567893);}}function a43_0x5c68(){const _0x4f819a=['bff','length','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','normalize','oldDirectory','selectedAppName','entries','372mpzIiT','HOOK/','map','all','mergedCli','string','functionNode','profileName','scriptType','cancelled','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','Force\x20pull\x20cancelled.','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','pull','\x22\x20and\x20\x22','rekey','operationType','str','&type=','scriptContent','functionName','Remote\x20script\x20missing\x20content.','type','Failed\x20to\x20write\x20local\x20script\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','write','¤tPage=1&pageSize=','HOOK','Would\x20inspect\x20','functions','filter','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','lockKey','get','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','utf8','case-rename','\x22\x20may\x20remain.','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','entry','mode','lockFilePath','832152fEHIYb','split','conflict','apiDir','set','toLowerCase','datasetCode','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','unresolvable\x20target\x20path','code','dev','remoteId','message','currentApp','14624YPVMuk','newLockKey','27mGyYfG','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','687512zUdlfq','read','projectedFunctions','values','/api/management/library/scripts/list?appCode=','alias','hookLocation','\x20--format\x20compress','\x22;\x20temporary\x20directory\x20\x22','ENOENT','5kzdpSk','\x20resolution','\x22\x20from\x20the\x20lock\x20file.','version','stdin','ENDPOINT','1628WSPtZe','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','oldLockKey','\x22\x20to\x20\x22','apps','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','requires','.hook-directory-migrate-','filePath','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','move','bool','push_local','migrations','includes','\x20Recovery\x20errors:\x20','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','parse','boolean','trim','newDirectoryPath','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','require','has','\x22\x20not\x20found\x20after\x20ensureLockScope.','push','oldDirectoryPath','Pull\x20only\x20this\x20script\x20type','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','2302236GWoBVn','\x22:\x20its\x20target\x20\x22','354DFFvIm','hash','close','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.','18730aAUObT','reverse','BFF_LOCAL_UNSYNCED','join','lastSync','COMMON','validation','\x20bff\x20push\x20--type\x20','48OCwajT','some','ino','500973lNCuZA','Force\x20overwrite\x20local\x20unsynced\x20changes','\x22:\x20','delete','\x20pulled','force','\x22:\x20both\x20target\x20\x22','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','appCode','newDirectory','stderr','nonInteractive','sourceFilePathByNewLockKey','Pull\x20complete:\x20','\x20--name\x20','219284mHIEqJ','keyChanges','scriptsRootDir'];a43_0x5c68=function(){return _0x4f819a;};return a43_0x5c68();}async function confirmForce(){const _0x215697=a43_0x51c52a,_0x5012c8=createInterface({'input':process[_0x215697(0x226)],'output':process[_0x215697(0x261)]}),_0x2eb894=await new Promise(_0x3d9069=>{const _0x2c2fed=_0x215697;_0x5012c8['question'](_0x2c2fed(0x22e),_0x3d9069);});return _0x5012c8[_0x215697(0x24a)](),['y','yes'][_0x215697(0x237)](_0x2eb894[_0x215697(0x23c)]()['toLowerCase']());}
|
|
1
|
+
function a43_0x1830(_0x5d2a39,_0x244548){_0x5d2a39=_0x5d2a39-0x87;const _0x547eb8=a43_0x547e();let _0x18304f=_0x547eb8[_0x5d2a39];return _0x18304f;}const a43_0x1d3bc7=a43_0x1830;(function(_0x2038a8,_0x3c33a4){const _0x3ed6b6=a43_0x1830,_0x5552d1=_0x2038a8();while(!![]){try{const _0x455db2=-parseInt(_0x3ed6b6(0x117))/0x1+parseInt(_0x3ed6b6(0xb9))/0x2*(-parseInt(_0x3ed6b6(0xe2))/0x3)+-parseInt(_0x3ed6b6(0xa9))/0x4*(parseInt(_0x3ed6b6(0xa3))/0x5)+-parseInt(_0x3ed6b6(0x115))/0x6*(parseInt(_0x3ed6b6(0x119))/0x7)+parseInt(_0x3ed6b6(0x111))/0x8+parseInt(_0x3ed6b6(0xdf))/0x9+parseInt(_0x3ed6b6(0xcb))/0xa*(parseInt(_0x3ed6b6(0xca))/0xb);if(_0x455db2===_0x3c33a4)break;else _0x5552d1['push'](_0x5552d1['shift']());}catch(_0x482151){_0x5552d1['push'](_0x5552d1['shift']());}}}(a43_0x547e,0xa2fe2));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';function a43_0x547e(){const _0x14659c=['.hook-directory-migrate-','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','entry','stderr','join','set','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','includes','code','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','boolean','ENDPOINT','has','Pull\x20complete:\x20','require','¤tPage=1&pageSize=','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x20conflict','dev','nonInteractive','rekey','flatMap','split','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','read','toLowerCase','scriptType','move','\x22\x20to\x20\x22','functionName','Pull\x20only\x20this\x20script\x20type','type','lockKey','message','941944CetinU','all','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.','values','6PLNGMK','scriptContent','1242468ukfnBl','filePath','2614052JHWsXk','push_local','would_pull','NFC','oldDirectory','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','datasetCode','\x20resolution','Failed\x20to\x20write\x20local\x20script\x20\x22','\x20--name\x20','\x22:\x20','\x22:\x20both\x20target\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','content','Lock\x20scope\x20for\x20app\x20\x22','mode','lastSync','pull','lockFilePath','map','toISOString','selectedAppName','bff','requires','HOOK','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','hookLocation','operationType','conflict','keyChanges','defaultApp','389770WsBiyO','newDirectory','currentApp','scriptsRootDir','\x22:\x20its\x20target\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','44tGymuL','ENOENT','rollback','bool','functions','\x20--format\x20compress','utf8','\x22\x20from\x20\x22','case-rename','some','get','\x22\x20from\x20the\x20lock\x20file.','\x22\x20and\x20\x22','entries','close','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','46MjZJtX','existed','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','\x20Recovery\x20errors:\x20','stdin','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','normalize','GET','\x20skipped','oldLockKey','oldDirectoryPath','appCode','newLockKey','reverse','apps','length','&type=','39089875PDtFjl','10fKLfMi','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','remoteId','unresolvable\x20target\x20path','alias','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','string','projectedFunctions','\x20bff\x20push\x20--type\x20','push','Force\x20pull\x20cancelled.','HOOK/','validation','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','functionNode','str','yes','754353snGAQo','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','filter','80109HnqaYw','newDirectoryPath','mergedCli','ino','Remote\x20script\x20missing\x20id.','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','\x22;\x20temporary\x20directory\x20\x22','force','hash','\x20pulled','cancelled','apiDir','\x20failed'];a43_0x547e=function(){return _0x14659c;};return a43_0x547e();}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_0x1d3bc7(0x9a),'command':'pull','description':a43_0x1d3bc7(0xcf),'risk':a43_0x1d3bc7(0x107),'structuredErrors':!![],'flags':[{'name':a43_0x1d3bc7(0x10e),'type':a43_0x1d3bc7(0xd4),'description':a43_0x1d3bc7(0x10d),'enum':['COMMON',a43_0x1d3bc7(0xfa),a43_0x1d3bc7(0x9c)]},{'name':a43_0x1d3bc7(0xe9),'type':a43_0x1d3bc7(0xf9),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x12dd4c){const _0x31aa13=a43_0x1d3bc7,_0x16bfa2=loadBffProjectConfig(_0x12dd4c[_0x31aa13(0xc4)]),_0x25e32d=await readBffLockFile(_0x16bfa2[_0x31aa13(0x96)]),{appLock:_0x72983c}=ensureLockScope(_0x25e32d??createEmptyBffLock(),_0x12dd4c[_0x31aa13(0xc4)],_0x16bfa2['scriptsRoot'],_0x31aa13(0x95)),_0x34f8e6=normalizeBffType(_0x12dd4c[_0x31aa13(0xdd)](_0x31aa13(0x10e)))??undefined,[_0x220b2f,_0x30a30e]=await Promise['all']([listBffScripts(_0x12dd4c['appCode'],_0x34f8e6),getBffScriptStatistics(_0x12dd4c[_0x31aa13(0xc4)])]),_0x5c1b04=_0x220b2f[_0x31aa13(0xb2)](_0x32a2fc=>normalizeBffType(_0x32a2fc[_0x31aa13(0x109)])===_0x31aa13(0x9c)),_0x5626f6=_0x5c1b04?buildDatasetCodeToAliasMap(_0x12dd4c['apiDir'],_0x12dd4c[_0x31aa13(0xc4)],_0x12dd4c[_0x31aa13(0x99)]||_0x12dd4c['mergedCli']?.[_0x31aa13(0xa5)]||_0x12dd4c[_0x31aa13(0xe4)]?.[_0x31aa13(0xa2)]):new Map(),_0x21e4c5=_0x5c1b04?await planHookDirectoryMigration(_0x16bfa2,_0x72983c,_0x5626f6,await scanLocalBffFunctions(_0x16bfa2,_0x31aa13(0x9c))):undefined,_0x59ef64=createHookLocationMap(_0x30a30e),_0x4e25a8=[];for(const _0x168eb5 of _0x220b2f){const _0x3bc8fa=resolveRemoteScriptTarget(_0x16bfa2,_0x168eb5,_0x59ef64,_0x21e4c5?.[_0x31aa13(0xd5)]??_0x72983c[_0x31aa13(0xad)],_0x5626f6);if(!_0x3bc8fa){_0x4e25a8['push']({'scriptType':_0x168eb5[_0x31aa13(0x109)],'functionName':_0x168eb5[_0x31aa13(0x10c)]??'','status':'skipped','reason':_0x31aa13(0xd1)});continue;}const _0x5e68e3=(_0x21e4c5?.['projectedFunctions']??_0x72983c['functions'])[_0x3bc8fa[_0x31aa13(0x10f)]],_0x5c9f14=_0x168eb5[_0x31aa13(0x116)]!=null?computeContentHash(_0x168eb5[_0x31aa13(0x116)]):undefined,_0x468857=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x21e4c5,_0x3bc8fa)??_0x3bc8fa[_0x31aa13(0x118)],_0x5e68e3,_0x5c9f14),_0xb70a76=_0x468857?localUnsyncedConflict(_0x3bc8fa,_0x168eb5['id']):undefined;_0x4e25a8[_0x31aa13(0xd7)]({'lockKey':_0x3bc8fa[_0x31aa13(0x10f)],'filePath':_0x3bc8fa[_0x31aa13(0x118)],'remoteId':_0x168eb5['id']??null,'status':_0xb70a76?_0x31aa13(0xa0):_0x31aa13(0x11b),..._0xb70a76?{'conflict':_0xb70a76}:{},..._0x3bc8fa['hookLocation']?{'alias':_0x3bc8fa['hookLocation'][_0x31aa13(0xd2)]??null,'datasetCode':_0x3bc8fa['hookLocation'][_0x31aa13(0x8a)],'operationType':_0x3bc8fa[_0x31aa13(0x9e)][_0x31aa13(0x9f)],'functionNode':_0x3bc8fa[_0x31aa13(0x9e)][_0x31aa13(0xdc)]}:{}});}return{'method':_0x31aa13(0xc0),'url':'/api/management/library/scripts/list?appCode='+_0x12dd4c['appCode']+(_0x34f8e6?_0x31aa13(0xc9)+_0x34f8e6:'')+_0x31aa13(0xfe)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x12dd4c[_0x31aa13(0xc4)],'filterType':_0x34f8e6??null,..._0x21e4c5&&_0x21e4c5['migrations']['length']>0x0?{'hookDirectoryMigrations':_0x21e4c5['migrations'][_0x31aa13(0x97)](_0x42e449=>({'from':_0x42e449[_0x31aa13(0x87)],'to':_0x42e449['newDirectory']}))}:{},'files':_0x4e25a8},'description':'Would\x20inspect\x20'+_0x4e25a8[_0x31aa13(0xc8)]+_0x31aa13(0x106)};},async 'execute'(_0x507202){const _0x3e584d=a43_0x1d3bc7,_0x1fe713=loadBffProjectConfig(_0x507202[_0x3e584d(0xc4)]),_0x47d691=await readBffLockFile(_0x1fe713[_0x3e584d(0x96)]),{lockData:_0x2e1ade,appLock:_0xd6eb1d}=ensureLockScope(_0x47d691??createEmptyBffLock(),_0x507202[_0x3e584d(0xc4)],_0x1fe713['scriptsRoot'],'pull'),_0x5e2257=normalizeBffType(_0x507202[_0x3e584d(0xdd)](_0x3e584d(0x10e)))??undefined;if(_0x507202['str']('type')&&!_0x5e2257)throw CliErrors[_0x3e584d(0xda)](_0x3e584d(0xf8));const [_0x1dd0df,_0x2abccc]=await Promise[_0x3e584d(0x112)]([listBffScripts(_0x507202[_0x3e584d(0xc4)],_0x5e2257),getBffScriptStatistics(_0x507202[_0x3e584d(0xc4)])]);if(_0x1dd0df['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x5eb692=_0x507202[_0x3e584d(0xac)](_0x3e584d(0xe9));if(_0x5eb692&&!_0x507202[_0x3e584d(0x102)]){const _0x2e080f=await confirmForce();if(!_0x2e080f)throw CliErrors[_0x3e584d(0xec)](_0x3e584d(0xd8));}if(_0x5eb692&&_0x507202[_0x3e584d(0x102)]){}const _0x5e988f=_0x1dd0df[_0x3e584d(0xb2)](_0x4f4382=>normalizeBffType(_0x4f4382['scriptType'])===_0x3e584d(0x9c)),_0x2f9971=_0x5e988f?buildDatasetCodeToAliasMap(_0x507202[_0x3e584d(0xed)],_0x507202['appCode'],_0x507202[_0x3e584d(0x99)]||_0x507202[_0x3e584d(0xe4)]?.[_0x3e584d(0xa5)]||_0x507202[_0x3e584d(0xe4)]?.['defaultApp']):new Map(),_0x215a12=createHookLocationMap(_0x2abccc),_0x249575=JSON['parse'](JSON['stringify'](_0x2e1ade)),_0x3d45e9=_0x507202['appCode'],_0x53250a=_0x249575[_0x3e584d(0xc7)][_0x3d45e9];if(!_0x53250a)throw new Error(_0x3e584d(0x92)+_0x3d45e9+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0xb3ca0c=_0x5e988f?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x1fe713,_0x53250a,_0x2f9971,await scanLocalBffFunctions(_0x1fe713,_0x3e584d(0x9c))),_0x53250a):undefined,_0x3e340a=createPullFileTransaction(),_0x199554=[],_0x5a9517=[],_0x688946=[],_0x4f6355=[];for(const _0x121883 of _0x1dd0df){const _0x19e6ef=resolveRemoteScriptTarget(_0x1fe713,_0x121883,_0x215a12,_0x53250a[_0x3e584d(0xad)],_0x2f9971);if(!_0x19e6ef){_0x5a9517[_0x3e584d(0xd7)]({'lockKey':_0x121883[_0x3e584d(0x109)]+'/'+_0x121883[_0x3e584d(0x10c)],'reason':_0x3e584d(0xd1)});continue;}const _0x1160c4=_0x53250a[_0x3e584d(0xad)][_0x19e6ef[_0x3e584d(0x10f)]];try{if(!_0x121883['id'])throw new Error(_0x3e584d(0xe6));if(_0x121883[_0x3e584d(0x116)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x469041=_0x121883['scriptContent'],_0x3ab339=computeContentHash(_0x469041);if(!_0x5eb692){const _0xe29a06=await hasUnsyncedLocalChanges(_0x19e6ef[_0x3e584d(0x118)],_0x1160c4,_0x3ab339);if(_0xe29a06){_0x688946['push'](localUnsyncedConflict(_0x19e6ef,_0x121883['id']));continue;}}await _0x3e340a['write'](_0x19e6ef[_0x3e584d(0x118)],_0x469041);const _0x58aae0={'hash':_0x3ab339,'remoteId':_0x121883['id'],'version':_0x121883['version']};_0x19e6ef[_0x3e584d(0x10e)]===_0x3e584d(0x9c)&&_0x19e6ef['hookLocation']&&(_0x58aae0[_0x3e584d(0xd2)]=_0x19e6ef[_0x3e584d(0x9e)]['alias'],_0x58aae0[_0x3e584d(0x8a)]=_0x19e6ef[_0x3e584d(0x9e)][_0x3e584d(0x8a)],_0x58aae0[_0x3e584d(0x9f)]=_0x19e6ef['hookLocation'][_0x3e584d(0x9f)],_0x58aae0['functionNode']=_0x19e6ef[_0x3e584d(0x9e)][_0x3e584d(0xdc)]),_0x53250a[_0x3e584d(0xad)][_0x19e6ef[_0x3e584d(0x10f)]]=_0x58aae0,_0x199554[_0x3e584d(0xd7)]({'lockKey':_0x19e6ef[_0x3e584d(0x10f)],'remoteId':_0x121883['id']});}catch(_0x41e8e5){_0x4f6355[_0x3e584d(0xd7)]({'lockKey':_0x19e6ef[_0x3e584d(0x10f)],'error':_0x41e8e5 instanceof Error?_0x41e8e5[_0x3e584d(0x110)]:String(_0x41e8e5)});}}_0x53250a[_0x3e584d(0x94)]=new Date()[_0x3e584d(0x98)]();try{await writeBffLockFile(_0x1fe713[_0x3e584d(0x96)],_0x249575);}catch(_0x1d45a2){const _0x49d13c=[...await _0x3e340a[_0x3e584d(0xab)](),...await _0xb3ca0c?.[_0x3e584d(0xab)]()??[]];throw withRollbackErrors(_0x1d45a2,_0x3e584d(0x90),_0x49d13c);}return{'ok':_0x4f6355[_0x3e584d(0xc8)]===0x0,'data':{'pulled':_0x199554,'skipped':_0x5a9517,'conflicts':_0x688946,'failed':_0x4f6355},'message':formatPullMessage(_0x199554[_0x3e584d(0xc8)],_0x5a9517[_0x3e584d(0xc8)],_0x688946[_0x3e584d(0xc8)],_0x4f6355[_0x3e584d(0xc8)])};}};function localUnsyncedConflict(_0x5b3af6,_0x1b2f64){const _0x5932ec=a43_0x1d3bc7,_0x1b12a6=_0x5b3af6[_0x5932ec(0x10f)]['split']('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x5b3af6[_0x5932ec(0x10f)],'filePath':_0x5b3af6[_0x5932ec(0x118)],..._0x1b2f64!=null?{'remoteId':_0x1b2f64}:{},'message':_0x5932ec(0xf5),'nextAction':{'action':_0x5932ec(0x11a),'command':CLI_BIN_NAME+_0x5932ec(0xd6)+_0x5b3af6['type']+_0x5932ec(0x8d)+_0x1b12a6+_0x5932ec(0xae),'requiresReview':!![],'message':_0x5932ec(0x113)}};}function formatPullMessage(_0x22dc18,_0x18f21c,_0x325a31,_0x5df1aa){const _0x5be3a5=a43_0x1d3bc7,_0xc2e11c=[_0x5be3a5(0xfc)+_0x22dc18+_0x5be3a5(0xeb),_0x18f21c+_0x5be3a5(0xc1)];_0x325a31>0x0&&_0xc2e11c[_0x5be3a5(0xd7)](_0x325a31+_0x5be3a5(0x100)+(_0x325a31===0x1?'':'s')+'\x20'+(_0x325a31===0x1?_0x5be3a5(0x9b):_0x5be3a5(0xfd))+_0x5be3a5(0x8b));if(_0x5df1aa>0x0)_0xc2e11c[_0x5be3a5(0xd7)](_0x5df1aa+_0x5be3a5(0xee));return _0xc2e11c[_0x5be3a5(0xf3)](',\x20');}async function hasUnsyncedLocalChanges(_0xb806de,_0xb2a394,_0x45b1aa){const _0xb5557f=a43_0x1d3bc7;if(!await fileExists(_0xb806de))return![];const _0x44459c=await computeFileHash(_0xb806de);if(!_0xb2a394)return _0x45b1aa?_0x44459c!==_0x45b1aa:!![];return _0x44459c!==_0xb2a394[_0xb5557f(0xea)];}function createPullFileTransaction(){const _0x4b51c5=new Map(),_0x3094b1=async(_0x488377,_0x11be09)=>{const _0x339096=a43_0x1830;try{if(_0x11be09[_0x339096(0xba)])await ensureParentDirectory(_0x488377),await writeFile(_0x488377,_0x11be09[_0x339096(0x91)]);else try{await unlink(_0x488377);}catch(_0x5ccf5d){if(_0x5ccf5d[_0x339096(0xf7)]!==_0x339096(0xaa))throw _0x5ccf5d;}return undefined;}catch(_0x332e99){return _0x332e99 instanceof Error?_0x332e99:new Error(String(_0x332e99));}};return{async 'write'(_0x3d8c2c,_0xc0b57b){const _0x54e1a9=a43_0x1830;if(!_0x4b51c5[_0x54e1a9(0xfb)](_0x3d8c2c))try{_0x4b51c5[_0x54e1a9(0xf4)](_0x3d8c2c,{'existed':!![],'content':await readFile(_0x3d8c2c)});}catch(_0xe35ec8){if(_0xe35ec8[_0x54e1a9(0xf7)]!=='ENOENT')throw _0xe35ec8;_0x4b51c5[_0x54e1a9(0xf4)](_0x3d8c2c,{'existed':![]});}try{await ensureParentDirectory(_0x3d8c2c),await writeFile(_0x3d8c2c,_0xc0b57b,_0x54e1a9(0xaf));}catch(_0xd28b81){const _0x34bcfa=await _0x3094b1(_0x3d8c2c,_0x4b51c5['get'](_0x3d8c2c));if(!_0x34bcfa)_0x4b51c5['delete'](_0x3d8c2c);throw withRollbackErrors(_0xd28b81,_0x54e1a9(0x8c)+_0x3d8c2c+'\x22.',_0x34bcfa?[_0x34bcfa]:[]);}},async 'rollback'(){const _0x5e2776=a43_0x1830,_0x1c6760=[];for(const [_0x27eac6,_0x1a3e07]of[..._0x4b51c5['entries']()][_0x5e2776(0xc6)]()){const _0x2fd437=await _0x3094b1(_0x27eac6,_0x1a3e07);_0x2fd437&&_0x1c6760[_0x5e2776(0xd7)](new Error(_0x5e2776(0xa8)+_0x27eac6+_0x5e2776(0x8e)+_0x2fd437[_0x5e2776(0x110)]));}return _0x1c6760;}};}function withRollbackErrors(_0x7c8e65,_0x5b8017,_0xc1ee5f){const _0x5c8144=a43_0x1d3bc7,_0x46d577=_0x7c8e65 instanceof Error?_0x7c8e65:new Error(String(_0x7c8e65));if(_0xc1ee5f[_0x5c8144(0xc8)]===0x0)return _0x46d577;return new AggregateError([_0x46d577,..._0xc1ee5f],_0x5b8017+_0x5c8144(0xbc)+_0xc1ee5f[_0x5c8144(0x97)](_0x1c1334=>_0x1c1334[_0x5c8144(0x110)])[_0x5c8144(0xf3)](';\x20'));}function buildDatasetCodeToAliasMap(_0xa2de36,_0x196002,_0x385d98){const _0x3162a7=a43_0x1d3bc7,_0x50eb15=resolveApiModelSource(_0xa2de36,_0x196002,_0x385d98),_0x51e4aa=loadAliasMap(_0xa2de36,undefined,_0x50eb15['filePath'],_0x50eb15['profileName']);return assertUnambiguousHookAliases(_0x51e4aa),new Map(_0x51e4aa[_0x3162a7(0x97)](_0x4c7c0e=>[_0x4c7c0e[_0x3162a7(0x8a)][_0x3162a7(0x108)](),_0x4c7c0e['alias']]));}async function planHookDirectoryMigration(_0x33dd7a,_0x388f1a,_0x517c18,_0x1b2cd5){const _0x2e513d=a43_0x1d3bc7,_0x2c6e68=new Map();for(const [_0xeae7cc,_0x478228]of Object[_0x2e513d(0xb6)](_0x388f1a[_0x2e513d(0xad)])){const [_0x1dde0a,_0x43d85c,_0x5dc916,_0x34c958,_0x1178c7,..._0x323b0b]=_0xeae7cc[_0x2e513d(0x105)]('/');if(_0x1dde0a!==_0x2e513d(0x9c)||!_0x43d85c||!_0x5dc916||!_0x34c958||!_0x1178c7||_0x323b0b['length']>0x0||!_0x478228['datasetCode'])continue;const _0x484ba2=_0x517c18[_0x2e513d(0xb3)](_0x478228['datasetCode'][_0x2e513d(0x108)]()),_0x13065f=_0x484ba2??_0x478228['datasetCode'];if(!isSafeHookDirectorySegment(_0x43d85c))throw CliErrors[_0x2e513d(0xda)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x43d85c+_0x2e513d(0xb4));if(!isSafeHookDirectorySegment(_0x13065f))throw CliErrors[_0x2e513d(0xda)](_0x2e513d(0x9d)+_0x43d85c+_0x2e513d(0xbe));if(_0x43d85c===_0x13065f)continue;const _0x23a107=_0x2c6e68[_0x2e513d(0xb3)](_0x43d85c)??{'datasetCode':_0x478228[_0x2e513d(0x8a)],'alias':_0x484ba2,'keyChanges':[]};if(_0x23a107['datasetCode']!==_0x478228['datasetCode'])throw CliErrors['validation'](_0x2e513d(0x9d)+_0x43d85c+_0x2e513d(0xf0));const _0x34f87a=_0x2e513d(0xd9)+_0x13065f+'/'+_0x5dc916+'/'+_0x34c958+'/'+_0x1178c7;try{resolveLocalFilePathFromLockKey(_0x33dd7a,_0xeae7cc),resolveLocalFilePathFromLockKey(_0x33dd7a,_0x34f87a);}catch(_0x371cd7){throw CliErrors[_0x2e513d(0xda)](_0x2e513d(0xdb)+_0xeae7cc+'\x22:\x20'+(_0x371cd7 instanceof Error?_0x371cd7[_0x2e513d(0x110)]:String(_0x371cd7)));}_0x23a107['keyChanges']['push']({'oldLockKey':_0xeae7cc,'newLockKey':_0x34f87a,'entry':_0x478228}),_0x2c6e68[_0x2e513d(0xf4)](_0x43d85c,_0x23a107);}const _0x908966=new Set([..._0x2c6e68[_0x2e513d(0x114)]()][_0x2e513d(0x104)](_0x5025ce=>_0x5025ce[_0x2e513d(0xa1)][_0x2e513d(0x97)](_0x270c1d=>_0x270c1d[_0x2e513d(0xc2)]))),_0x2d1819=new Map(),_0xc4b884=new Map();for(const [_0x204565,_0x2a7453]of _0x2c6e68){const _0x23b37e=_0x2a7453[_0x2e513d(0xd2)]??_0x2a7453[_0x2e513d(0x8a)],_0x17fb1f=hookDirectoryIdentity(_0x23b37e),_0x4d5d78=_0x2d1819['get'](_0x17fb1f);if(_0x4d5d78&&_0x4d5d78!==_0x204565)throw CliErrors['validation'](_0x2e513d(0xe7)+_0x4d5d78+_0x2e513d(0xb5)+_0x204565+_0x2e513d(0x8f)+_0x23b37e+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x2d1819[_0x2e513d(0xf4)](_0x17fb1f,_0x204565);for(const _0x146863 of _0x2a7453[_0x2e513d(0xa1)]){const _0x501c68=_0xc4b884[_0x2e513d(0xb3)](_0x146863['newLockKey']);if(_0x501c68&&_0x501c68!==_0x146863['oldLockKey'])throw CliErrors['validation'](_0x2e513d(0x88)+_0x501c68+'\x22\x20and\x20\x22'+_0x146863['oldLockKey']+'\x22:\x20both\x20target\x20\x22'+_0x146863[_0x2e513d(0xc5)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x908966[_0x2e513d(0xfb)](_0x146863[_0x2e513d(0xc5)]))throw CliErrors[_0x2e513d(0xda)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x146863[_0x2e513d(0xc2)]+_0x2e513d(0xa7)+_0x146863[_0x2e513d(0xc5)]+_0x2e513d(0xbb));_0xc4b884[_0x2e513d(0xf4)](_0x146863[_0x2e513d(0xc5)],_0x146863[_0x2e513d(0xc2)]);}}const _0x54cb17=new Map();for(const [_0x93b019,_0xb1ad35]of _0x517c18){_0x54cb17['set'](hookDirectoryIdentity(_0xb1ad35),_0x93b019);}const _0x12bbe8=[];for(const [_0xaaa9c2,_0x7b07c7]of _0x2c6e68){const _0x337832=_0x7b07c7[_0x2e513d(0xd2)]??_0x7b07c7[_0x2e513d(0x8a)],_0x32704c=join(_0x33dd7a[_0x2e513d(0xa6)],_0x2e513d(0x9c),_0xaaa9c2),_0x3ee084=join(_0x33dd7a[_0x2e513d(0xa6)],_0x2e513d(0x9c),_0x337832),_0x2971ae=await directoryExists(_0x32704c),_0x2d27e2=await directoryExists(_0x3ee084),_0x504774=_0x2971ae?_0x2d27e2?await sameDirectory(_0x32704c,_0x3ee084)?_0x2e513d(0xb1):undefined:_0x2e513d(0x10a):_0x2e513d(0x103);if(!_0x504774)throw CliErrors['validation'](_0x2e513d(0x9d)+_0xaaa9c2+_0x2e513d(0x10b)+_0x337832+_0x2e513d(0xb8));const _0x554710=_0x54cb17['get'](hookDirectoryIdentity(_0xaaa9c2));if(_0x554710&&_0x554710!==_0x7b07c7[_0x2e513d(0x8a)][_0x2e513d(0x108)]()){const _0x3236e8=new Set(_0x7b07c7[_0x2e513d(0xa1)]['map'](_0x2bf1a2=>_0x2bf1a2[_0x2e513d(0xc2)])),_0x245753=_0x1b2cd5[_0x2e513d(0xe1)](_0x491a45=>_0x491a45[_0x2e513d(0x10e)]==='HOOK'&&_0x491a45[_0x2e513d(0xd2)]!=null&&hookDirectoryIdentity(_0x491a45[_0x2e513d(0xd2)])===hookDirectoryIdentity(_0xaaa9c2)&&!_0x3236e8[_0x2e513d(0xfb)](_0x491a45[_0x2e513d(0x10f)]));if(_0x245753[_0x2e513d(0xc8)]>0x0)throw CliErrors['validation'](_0x2e513d(0x9d)+_0xaaa9c2+_0x2e513d(0xcc));}const _0x3efa29=_0x54cb17[_0x2e513d(0xb3)](hookDirectoryIdentity(_0x337832));if(_0x3efa29&&_0x3efa29!==_0x7b07c7[_0x2e513d(0x8a)][_0x2e513d(0x108)]())throw CliErrors[_0x2e513d(0xda)](_0x2e513d(0x9d)+_0xaaa9c2+_0x2e513d(0x10b)+_0x337832+_0x2e513d(0xd3));for(const _0xe53c2 of _0x7b07c7['keyChanges']){const _0x18a3e2=_0x388f1a['functions'][_0xe53c2['newLockKey']];if(_0x18a3e2&&!_0x908966[_0x2e513d(0xfb)](_0xe53c2[_0x2e513d(0xc5)])&&!sameHookIdentity(_0xe53c2[_0x2e513d(0xf1)],_0x18a3e2))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0xaaa9c2+_0x2e513d(0x10b)+_0x337832+_0x2e513d(0x89));}_0x12bbe8[_0x2e513d(0xd7)]({'oldDirectory':_0xaaa9c2,'newDirectory':_0x337832,'oldDirectoryPath':_0x32704c,'newDirectoryPath':_0x3ee084,'mode':_0x504774,'alias':_0x7b07c7[_0x2e513d(0xd2)],'keyChanges':_0x7b07c7[_0x2e513d(0xa1)]});}const _0x468337={..._0x388f1a[_0x2e513d(0xad)]},_0x54429c=new Map(),_0x2ea376=new Map();for(const _0x3f0edb of _0x12bbe8){const _0x6c75d5=_0x3f0edb[_0x2e513d(0x93)]!==_0x2e513d(0x103);_0x6c75d5&&_0x2ea376[_0x2e513d(0xf4)](hookDirectoryIdentity(_0x3f0edb[_0x2e513d(0xa4)]),_0x3f0edb[_0x2e513d(0xc3)]);for(const _0x202339 of _0x3f0edb[_0x2e513d(0xa1)]){const _0x577a24=_0x468337[_0x202339[_0x2e513d(0xc5)]],_0x4c032c=_0x6c75d5?_0x202339[_0x2e513d(0xf1)]:_0x577a24??_0x202339[_0x2e513d(0xf1)];_0x468337[_0x202339['newLockKey']]=canonicalizeHookEntry(_0x4c032c,_0x3f0edb[_0x2e513d(0xd2)]),delete _0x468337[_0x202339[_0x2e513d(0xc2)]],_0x6c75d5&&_0x54429c['set'](_0x202339[_0x2e513d(0xc5)],resolveLocalFilePathFromLockKey(_0x33dd7a,_0x202339[_0x2e513d(0xc2)]));}}return{'migrations':_0x12bbe8,'projectedFunctions':_0x468337,'sourceFilePathByNewLockKey':_0x54429c,'sourceDirectoryPathByNewDirectory':_0x2ea376};}function resolveMigratedSourceFilePath(_0x4b102a,_0x3cf7c){const _0x133a04=a43_0x1d3bc7;if(!_0x4b102a||!_0x3cf7c)return undefined;const _0x2c2c1d=_0x4b102a['sourceFilePathByNewLockKey'][_0x133a04(0xb3)](_0x3cf7c['lockKey']);if(_0x2c2c1d)return _0x2c2c1d;if(_0x3cf7c[_0x133a04(0x10e)]!==_0x133a04(0x9c))return undefined;const [,_0x450041,..._0xfdb3e3]=_0x3cf7c[_0x133a04(0x10f)][_0x133a04(0x105)]('/');if(!_0x450041||_0xfdb3e3[_0x133a04(0xc8)]===0x0)return undefined;const _0x504682=_0x4b102a['sourceDirectoryPathByNewDirectory']['get'](hookDirectoryIdentity(_0x450041));return _0x504682?join(_0x504682,..._0xfdb3e3)+'.js':undefined;}function sameHookIdentity(_0x517485,_0x16dd45){const _0x317e4f=a43_0x1d3bc7;return _0x517485[_0x317e4f(0xd0)]===_0x16dd45[_0x317e4f(0xd0)]&&_0x517485[_0x317e4f(0x8a)]===_0x16dd45['datasetCode']&&_0x517485['operationType']===_0x16dd45[_0x317e4f(0x9f)]&&_0x517485['functionNode']===_0x16dd45[_0x317e4f(0xdc)];}function canonicalizeHookEntry(_0x1154a7,_0x201cf9){const {alias:_0x13e10d,..._0x2611d1}=_0x1154a7;return _0x201cf9?{..._0x2611d1,'alias':_0x201cf9}:_0x2611d1;}function hookDirectoryIdentity(_0x47e6af){const _0x1fc034=a43_0x1d3bc7;return _0x47e6af[_0x1fc034(0xbf)](_0x1fc034(0x11c))[_0x1fc034(0x108)]();}function isSafeHookDirectorySegment(_0x29b99c){return isSafeLockKeySegment(_0x29b99c);}async function sameDirectory(_0x3592a0,_0x322c02){const _0x14b2e7=a43_0x1d3bc7,[_0x1afc62,_0x53cd6a]=await Promise[_0x14b2e7(0x112)]([stat(_0x3592a0),stat(_0x322c02)]);return _0x1afc62[_0x14b2e7(0x101)]===_0x53cd6a[_0x14b2e7(0x101)]&&_0x1afc62[_0x14b2e7(0xe5)]===_0x53cd6a['ino'];}async function applyHookDirectoryMigration(_0x1b8ddf,_0xb84354){const _0x121895=a43_0x1d3bc7,_0x5b6f74=_0xb84354[_0x121895(0xad)],_0x21e833=_0xb84354[_0x121895(0x94)],_0x2b9594=[],_0x4656e8=async()=>{const _0x436d3f=_0x121895,_0xf096f5=[];_0xb84354[_0x436d3f(0xad)]=_0x5b6f74,_0xb84354[_0x436d3f(0x94)]=_0x21e833;for(const {migration:_0x2b860b,temporaryPath:_0x1d7409}of[..._0x2b9594][_0x436d3f(0xc6)]()){try{_0x1d7409?(await rename(_0x2b860b['newDirectoryPath'],_0x1d7409),await rename(_0x1d7409,_0x2b860b[_0x436d3f(0xc3)])):await rename(_0x2b860b[_0x436d3f(0xe3)],_0x2b860b[_0x436d3f(0xc3)]);}catch(_0x3a3f12){_0xf096f5[_0x436d3f(0xd7)](new Error(_0x436d3f(0xce)+_0x2b860b[_0x436d3f(0x87)]+_0x436d3f(0xb0)+_0x2b860b[_0x436d3f(0xa4)]+_0x436d3f(0x8e)+(_0x3a3f12 instanceof Error?_0x3a3f12[_0x436d3f(0x110)]:String(_0x3a3f12))));}}return _0xf096f5;};try{for(const _0x655560 of _0x1b8ddf['migrations']){if(_0x655560[_0x121895(0x93)]===_0x121895(0x10a))await ensureParentDirectory(_0x655560[_0x121895(0xe3)]),await rename(_0x655560['oldDirectoryPath'],_0x655560['newDirectoryPath']),_0x2b9594[_0x121895(0xd7)]({'migration':_0x655560});else{if(_0x655560['mode']===_0x121895(0xb1)){const _0x591bda=join(dirname(_0x655560[_0x121895(0xc3)]),_0x121895(0xef)+randomUUID());await rename(_0x655560['oldDirectoryPath'],_0x591bda);try{await rename(_0x591bda,_0x655560[_0x121895(0xe3)]);}catch(_0x59f44a){try{await rename(_0x591bda,_0x655560[_0x121895(0xc3)]);}catch(_0x6f2753){throw withRollbackErrors(_0x59f44a,_0x121895(0xff)+_0x655560[_0x121895(0x87)]+_0x121895(0x10b)+_0x655560['newDirectory']+_0x121895(0xe8)+_0x591bda+'\x22\x20may\x20remain.',[new Error(_0x121895(0xcd)+_0x591bda+_0x121895(0x10b)+_0x655560[_0x121895(0x87)]+_0x121895(0x8e)+(_0x6f2753 instanceof Error?_0x6f2753[_0x121895(0x110)]:String(_0x6f2753)))]);}throw _0x59f44a;}_0x2b9594['push']({'migration':_0x655560,'temporaryPath':_0x591bda});}}}return _0xb84354[_0x121895(0xad)]=_0x1b8ddf[_0x121895(0xd5)],{'rollback':_0x4656e8};}catch(_0x4fc03a){const _0x1eecc3=await _0x4656e8();throw withRollbackErrors(_0x4fc03a,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x1eecc3);}}async function confirmForce(){const _0x114fdf=a43_0x1d3bc7,_0x32f546=createInterface({'input':process[_0x114fdf(0xbd)],'output':process[_0x114fdf(0xf2)]}),_0x4fc0fa=await new Promise(_0x5960e2=>{const _0x44aaad=_0x114fdf;_0x32f546['question'](_0x44aaad(0xe0),_0x5960e2);});return _0x32f546[_0x114fdf(0xb7)](),['y',_0x114fdf(0xde)][_0x114fdf(0xf6)](_0x4fc0fa['trim']()[_0x114fdf(0x108)]());}
|