@lovrabet/rabetbase-cli 2.5.9 → 2.5.10-beta.2
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 +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.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.d.ts +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +0 -28
- 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.d.ts +8 -0
- package/lib/core/instant-api-policy/endpoints.js +1 -0
- package/lib/core/kb-management-client.d.ts +3 -9
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.d.ts +1 -4
- 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/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +3 -2
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase-dataset-generation/SKILL.md +2 -2
- package/skills/rabetbase-page-generation/SKILL.md +2 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x4541f8=a34_0x35c8;(function(_0x306dc3,_0x33fa07){const _0x9cd5e0=a34_0x35c8,_0x31c4fe=_0x306dc3();while(!![]){try{const _0x5c0eab=parseInt(_0x9cd5e0(0xc2))/0x1+parseInt(_0x9cd5e0(0xbf))/0x2+-parseInt(_0x9cd5e0(0xb5))/0x3+-parseInt(_0x9cd5e0(0xb9))/0x4*(-parseInt(_0x9cd5e0(0xb3))/0x5)+parseInt(_0x9cd5e0(0xb7))/0x6+-parseInt(_0x9cd5e0(0xb6))/0x7+-parseInt(_0x9cd5e0(0xc8))/0x8*(parseInt(_0x9cd5e0(0xc9))/0x9);if(_0x5c0eab===_0x33fa07)break;else _0x31c4fe['push'](_0x31c4fe['shift']());}catch(_0x47eb67){_0x31c4fe['push'](_0x31c4fe['shift']());}}}(a34_0x4cab,0x7d76d));function a34_0x35c8(_0x3468fb,_0x464b5d){_0x3468fb=_0x3468fb-0xb0;const _0x4cabb5=a34_0x4cab();let _0x35c815=_0x4cabb5[_0x3468fb];return _0x35c815;}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_0x4cab(){const _0x2168f9=['update','App\x20config\x20server\x20id\x20missing\x20for\x20key=','appCode','get','/smartapi/app-config/create','1880Enmsbw','29610pltUvq','Updated','Read\x20config\x20value\x20from\x20file','write','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','/smartapi/app-config/update','3346495nvEZqB','app-config','1605213HyWsVe','803488vmTWTn','2937498uXeaVY','set','4lNGOMc','tags',',\x20appCode=','number','\x20app\x20config\x20','apiError','390652QEiwBH','create','isFinite','582698OAyYzk'];a34_0x4cab=function(){return _0x2168f9;};return a34_0x4cab();}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_0x4541f8(0xc7),UPDATE_PATH=a34_0x4541f8(0xb2);export const appConfigSet={'service':a34_0x4541f8(0xb4),'command':a34_0x4541f8(0xb8),'description':a34_0x4541f8(0xb1),'risk':a34_0x4541f8(0xb0),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':'file','type':'string','description':a34_0x4541f8(0xcb)}],async 'validate'(_0x2c5707){readKeyArg(_0x2c5707),readOptionalTags(_0x2c5707),assertSingleValueSource(_0x2c5707);},async 'dryRun'(_0x3203c1){const _0x3f771f=a34_0x4541f8,_0x346653=readKeyArg(_0x3203c1),_0x4df34a=readOptionalTags(_0x3203c1),_0x580c50=assertSingleValueSource(_0x3203c1);await assertValueSourceReadable(_0x580c50);const _0x570485=await withAppConfigApiBoundary(_0x3f771f(0xc6),{'appCode':_0x3203c1['appCode'],'key':_0x346653},()=>getAppConfigByKey(_0x3203c1[_0x3f771f(0xc5)],_0x346653)),_0x429655=_0x570485?'update':_0x3f771f(0xc0),_0x10df9a=_0x570485?projectAppConfig(_0x570485):null,_0x120d6c=plannedAppConfig({'appCode':_0x3203c1['appCode'],'key':_0x346653,'tags':_0x4df34a??_0x570485?.[_0x3f771f(0xba)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x429655,'appCode':_0x3203c1['appCode'],'key':_0x346653,'before':_0x10df9a,'after':_0x120d6c,'dryRun':!![]}),{'method':'POST','url':_0x429655===_0x3f771f(0xc3)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x1b9a74){const _0x946da0=a34_0x4541f8,_0x5e8db7=readKeyArg(_0x1b9a74),_0x37e86b=readOptionalTags(_0x1b9a74),_0x3e1b3c=await withAppConfigApiBoundary(_0x946da0(0xc6),{'appCode':_0x1b9a74['appCode'],'key':_0x5e8db7},()=>getAppConfigByKey(_0x1b9a74['appCode'],_0x5e8db7)),_0x42daef=_0x3e1b3c?projectAppConfig(_0x3e1b3c):null,_0x33b8c8=_0x3e1b3c?_0x946da0(0xc3):_0x946da0(0xc0),{value:_0x11803c,warnings:_0x241746}=await readAppConfigValue(_0x1b9a74),_0x5b626c={'appCode':_0x1b9a74['appCode'],'key':_0x5e8db7,'value':_0x11803c,'tags':_0x37e86b??_0x3e1b3c?.[_0x946da0(0xba)]??undefined};await withAppConfigApiBoundary(_0x33b8c8,{'appCode':_0x1b9a74[_0x946da0(0xc5)],'key':_0x5e8db7},async()=>{const _0x21bf9c=_0x946da0;_0x3e1b3c?await updateAppConfig({..._0x5b626c,'id':requireAppConfigId(_0x3e1b3c,_0x5e8db7,_0x1b9a74[_0x21bf9c(0xc5)])}):await createAppConfig(_0x5b626c);});const _0x296025=await withAppConfigApiBoundary('get',{'appCode':_0x1b9a74['appCode'],'key':_0x5e8db7},()=>getAppConfigByKey(_0x1b9a74[_0x946da0(0xc5)],_0x5e8db7)),_0x93d064=_0x296025?projectAppConfig(_0x296025):plannedAppConfig({'appCode':_0x1b9a74[_0x946da0(0xc5)],'key':_0x5e8db7,'tags':_0x5b626c[_0x946da0(0xba)],'hasValue':_0x11803c!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x33b8c8,'appCode':_0x1b9a74['appCode'],'key':_0x5e8db7,'before':_0x42daef,'after':_0x93d064,'dryRun':![],'warnings':_0x241746}),'message':(_0x33b8c8===_0x946da0(0xc3)?_0x946da0(0xca):'Created')+_0x946da0(0xbd)+_0x5e8db7};}};function requireAppConfigId(_0x2d8572,_0x41337c,_0x593ff9){const _0x26f6ef=a34_0x4541f8;if(typeof _0x2d8572['id']===_0x26f6ef(0xbc)&&Number[_0x26f6ef(0xc1)](_0x2d8572['id'])&&_0x2d8572['id']>0x0)return _0x2d8572['id'];throw CliErrors[_0x26f6ef(0xbe)](_0x26f6ef(0xc4)+_0x41337c+_0x26f6ef(0xbb)+_0x593ff9);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x16f0fc=a35_0x658b;(function(_0x3d9335,_0x3d1c8e){const _0x378bc8=a35_0x658b,_0x1be614=_0x3d9335();while(!![]){try{const _0x2c976f=parseInt(_0x378bc8(0x14b))/0x1+-parseInt(_0x378bc8(0x14a))/0x2*(parseInt(_0x378bc8(0x136))/0x3)+parseInt(_0x378bc8(0x13b))/0x4*(-parseInt(_0x378bc8(0x147))/0x5)+-parseInt(_0x378bc8(0x144))/0x6+-parseInt(_0x378bc8(0x142))/0x7+-parseInt(_0x378bc8(0x15e))/0x8*(-parseInt(_0x378bc8(0x123))/0x9)+parseInt(_0x378bc8(0x146))/0xa;if(_0x2c976f===_0x3d1c8e)break;else _0x1be614['push'](_0x1be614['shift']());}catch(_0x124aaa){_0x1be614['push'](_0x1be614['shift']());}}}(a35_0x31d9,0x31456));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a35_0x16f0fc(0x148),'required':!![]};export const VALUE_ARG={'name':a35_0x16f0fc(0x135),'description':'Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','required':![]};export const TAGS_FLAG={'name':'tags','type':a35_0x16f0fc(0x153),'description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':a35_0x16f0fc(0x14d),'type':a35_0x16f0fc(0x141),'description':a35_0x16f0fc(0x137),'default':![]};export const FROM_ENV_FLAG={'name':'from-env','type':a35_0x16f0fc(0x153),'description':a35_0x16f0fc(0x12e)};export const REVEAL_FLAG={'name':a35_0x16f0fc(0x131),'type':a35_0x16f0fc(0x141),'description':a35_0x16f0fc(0x134),'default':![]};function a35_0x31d9(){const _0x3fe374=['after','trim','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','value','27GXDDZU','Read\x20config\x20value\x20from\x20stdin','flag','join','slice','220636xBzBNv','from-env','push','key:\x20','argument','args','boolean','250369UCkFQS','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','181272cRyYXD','once','1790760hraJay','5JfFViL','Runtime\x20app-config\x20key','path','64628TlQVzv','383992HNBTLh','operation','stdin','hasValue','utf8','Missing\x20app-config\x20key.','env','file','string','appCode:\x20','\x20app\x20config.','apiError','gmtCreate','key','length','value\x20is\x20redacted','setEncoding','method','error','16IpyLXo','kind','str','appCode','Environment\x20variable\x20is\x20not\x20set:\x20','228195aOEMrJ','Missing\x20app-config\x20value\x20source.','data','gmtModified','defineProperties','name','Failed\x20to\x20','before','validation','App\x20config\x20value\x20source\x20is\x20ambiguous.','tags','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','reveal'];a35_0x31d9=function(){return _0x3fe374;};return a35_0x31d9();}export function readKeyArg(_0x3d3ec1){const _0x45e988=a35_0x16f0fc,_0x205ed8=_0x3d3ec1['args'][0x0]?.[_0x45e988(0x133)]()??'';return validateKey(_0x205ed8),_0x205ed8;}export function readOptionalTags(_0x36a45b){const _0x3dc698=a35_0x16f0fc,_0x507770=_0x36a45b['str'](_0x3dc698(0x12d))['trim']();if(!_0x507770)return undefined;if(_0x507770[_0x3dc698(0x159)]>0x20)throw CliErrors[_0x3dc698(0x12b)](_0x3dc698(0x143));return _0x507770;}export function validateKey(_0x30720f){const _0x4e611e=a35_0x16f0fc;if(!_0x30720f)throw CliErrors[_0x4e611e(0x12b)](_0x4e611e(0x150));if(_0x30720f['length']>0x100)throw CliErrors[_0x4e611e(0x12b)]('App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.');}export function projectAppConfig(_0x386643,_0x461871){const _0x109d70=a35_0x16f0fc,_0x31694c=_0x386643[_0x109d70(0x135)]!==undefined&&_0x386643[_0x109d70(0x135)]!==null&&_0x386643[_0x109d70(0x135)]!=='',_0x25eb69={'appCode':_0x386643['appCode'],'key':_0x386643['key'],'tags':_0x386643[_0x109d70(0x12d)]??undefined,'hasValue':_0x31694c,'valueRedacted':_0x31694c&&!_0x461871?.['reveal'],'gmtCreate':_0x386643[_0x109d70(0x157)],'gmtModified':_0x386643[_0x109d70(0x126)]};return _0x461871?.[_0x109d70(0x131)]&&(_0x25eb69[_0x109d70(0x135)]=_0x386643[_0x109d70(0x135)]??'',_0x25eb69['valueRedacted']=![]),_0x25eb69;}export function plannedAppConfig(_0x584dfa){const _0x3ce966=a35_0x16f0fc,_0x1b7042=_0x584dfa[_0x3ce966(0x14e)]??!![];return{'appCode':_0x584dfa[_0x3ce966(0x121)],'key':_0x584dfa[_0x3ce966(0x158)],'tags':_0x584dfa[_0x3ce966(0x12d)]??undefined,'hasValue':_0x1b7042,'valueRedacted':_0x1b7042};}function a35_0x658b(_0x406c7e,_0x3e6e36){_0x406c7e=_0x406c7e-0x120;const _0x31d992=a35_0x31d9();let _0x658bb5=_0x31d992[_0x406c7e];return _0x658bb5;}export function buildMutationData(_0x31be86){const _0x11215a=a35_0x16f0fc;return{'operation':_0x31be86[_0x11215a(0x14c)],'selector':{'appCode':_0x31be86[_0x11215a(0x121)],'key':_0x31be86['key']},'before':_0x31be86[_0x11215a(0x12a)],'after':_0x31be86[_0x11215a(0x132)],'dryRun':_0x31be86['dryRun'],'warnings':_0x31be86['warnings']??[]};}export async function withAppConfigApiBoundary(_0x59b687,_0x1166e8,_0x395485){const _0x1ae3ea=a35_0x16f0fc;try{return await _0x395485();}catch{const _0x4aa0dd=[_0x1ae3ea(0x154)+_0x1166e8[_0x1ae3ea(0x121)]];if(_0x1166e8['key'])_0x4aa0dd['push'](_0x1ae3ea(0x13e)+_0x1166e8['key']);_0x4aa0dd[_0x1ae3ea(0x13d)](_0x1ae3ea(0x15a));throw CliErrors[_0x1ae3ea(0x156)](_0x1ae3ea(0x129)+_0x59b687+_0x1ae3ea(0x155),_0x4aa0dd[_0x1ae3ea(0x139)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x582fd3,_0xfe5af0){const _0x1f98cb=a35_0x16f0fc;return Object[_0x1f98cb(0x127)](_0x582fd3,{'method':{'value':_0xfe5af0[_0x1f98cb(0x15c)],'enumerable':![]},'url':{'value':_0xfe5af0['url'],'enumerable':![]}});}export function assertSingleValueSource(_0x5782f4){const _0x4cf790=a35_0x16f0fc,_0x33e8bb=[];_0x5782f4[_0x4cf790(0x140)]['length']>0x1&&_0x33e8bb['push']({'kind':'argument','value':_0x5782f4['args'][_0x4cf790(0x13a)](0x1)[_0x4cf790(0x139)]('\x20')});const _0x2468e1=_0x5782f4[_0x4cf790(0x138)](_0x4cf790(0x135));_0x2468e1!==undefined&&_0x2468e1!==null&&_0x33e8bb[_0x4cf790(0x13d)]({'kind':_0x4cf790(0x13f),'value':String(_0x2468e1)});_0x5782f4['bool'](_0x4cf790(0x14d))&&_0x33e8bb[_0x4cf790(0x13d)]({'kind':'stdin'});const _0x1a69c1=_0x5782f4[_0x4cf790(0x120)](_0x4cf790(0x13c))['trim']();_0x1a69c1&&_0x33e8bb['push']({'kind':_0x4cf790(0x151),'name':_0x1a69c1});const _0x4c7d68=_0x5782f4[_0x4cf790(0x120)](_0x4cf790(0x152))['trim']();_0x4c7d68&&_0x33e8bb['push']({'kind':_0x4cf790(0x152),'path':_0x4c7d68});if(_0x33e8bb[_0x4cf790(0x159)]===0x0)throw CliErrors[_0x4cf790(0x12b)](_0x4cf790(0x124),'Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0x33e8bb['length']>0x1)throw CliErrors['validation'](_0x4cf790(0x12c),_0x4cf790(0x130));return _0x33e8bb[0x0];}export async function assertValueSourceReadable(_0x57ecf1){const _0xc77331=a35_0x16f0fc;if(_0x57ecf1[_0xc77331(0x15f)]===_0xc77331(0x151)&&!(_0x57ecf1[_0xc77331(0x128)]in process.env))throw CliErrors['validation'](_0xc77331(0x122)+_0x57ecf1[_0xc77331(0x128)]);if(_0x57ecf1[_0xc77331(0x15f)]===_0xc77331(0x152))try{await access(_0x57ecf1[_0xc77331(0x149)]);}catch{throw CliErrors[_0xc77331(0x12b)]('Value\x20file\x20is\x20not\x20readable:\x20'+_0x57ecf1[_0xc77331(0x149)]);}}export async function readAppConfigValue(_0x20a1ca){const _0x41807d=a35_0x16f0fc,_0x250b7e=assertSingleValueSource(_0x20a1ca),_0x3e6596=[];if(_0x250b7e[_0x41807d(0x15f)]===_0x41807d(0x13f))return _0x3e6596[_0x41807d(0x13d)](_0x41807d(0x12f)),{'value':_0x250b7e[_0x41807d(0x135)]??'','source':_0x250b7e[_0x41807d(0x15f)],'warnings':_0x3e6596};if(_0x250b7e['kind']===_0x41807d(0x14d))return{'value':await readStdin(),'source':_0x250b7e[_0x41807d(0x15f)],'warnings':_0x3e6596};if(_0x250b7e[_0x41807d(0x15f)]===_0x41807d(0x151)){if(!(_0x250b7e[_0x41807d(0x128)]in process.env))throw CliErrors['validation'](_0x41807d(0x122)+_0x250b7e[_0x41807d(0x128)]);return{'value':process.env[_0x250b7e.name]??'','source':_0x250b7e[_0x41807d(0x15f)],'warnings':_0x3e6596};}return{'value':await readFile(_0x250b7e['path'],_0x41807d(0x14f)),'source':_0x250b7e[_0x41807d(0x15f)],'warnings':_0x3e6596};}function readStdin(){return new Promise((_0x2c9e56,_0x28236c)=>{const _0x6b253e=a35_0x658b;let _0x47248b='';process[_0x6b253e(0x14d)][_0x6b253e(0x15b)](_0x6b253e(0x14f)),process[_0x6b253e(0x14d)]['on'](_0x6b253e(0x125),_0x3b541a=>{_0x47248b+=_0x3b541a;}),process[_0x6b253e(0x14d)][_0x6b253e(0x145)]('end',()=>_0x2c9e56(_0x47248b)),process['stdin']['once'](_0x6b253e(0x15d),_0x28236c);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a36_0x56c3(){const _0x345570=['bool','70uhkSuM','login','18AOVlnA','3203860ACdiGD','boolean','17689OBsfMs','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','nonInteractive','7133532rqYVKy','yes','362274RxDcjF','../../auth/auth-server-ui.js','✓\x20Logged\x20out','814488UrFdCV','Login\x20via\x20browser','1121646kvLGeF','22vlfJsP','auth','!\x20Not\x20logged\x20in','215620qLIsDE','write','7XPSbBq','8CHThUu'];a36_0x56c3=function(){return _0x345570;};return a36_0x56c3();}const a36_0x11b0b3=a36_0x472a;function a36_0x472a(_0x49cd05,_0x29b4eb){_0x49cd05=_0x49cd05-0x150;const _0x56c396=a36_0x56c3();let _0x472a21=_0x56c396[_0x49cd05];return _0x472a21;}(function(_0x418800,_0x1939bc){const _0x56701d=a36_0x472a,_0x1e0c5b=_0x418800();while(!![]){try{const _0x3da49b=-parseInt(_0x56701d(0x154))/0x1*(parseInt(_0x56701d(0x167))/0x2)+parseInt(_0x56701d(0x15e))/0x3+parseInt(_0x56701d(0x165))/0x4*(-parseInt(_0x56701d(0x162))/0x5)+parseInt(_0x56701d(0x159))/0x6*(parseInt(_0x56701d(0x164))/0x7)+-parseInt(_0x56701d(0x15c))/0x8*(parseInt(_0x56701d(0x151))/0x9)+-parseInt(_0x56701d(0x152))/0xa+parseInt(_0x56701d(0x15f))/0xb*(parseInt(_0x56701d(0x157))/0xc);if(_0x3da49b===_0x1939bc)break;else _0x1e0c5b['push'](_0x1e0c5b['shift']());}catch(_0x6f99bf){_0x1e0c5b['push'](_0x1e0c5b['shift']());}}}(a36_0x56c3,0x60254));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a36_0x11b0b3(0x160),'command':a36_0x11b0b3(0x150),'description':a36_0x11b0b3(0x15d),'risk':a36_0x11b0b3(0x163),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x11b0b3(0x158),'type':a36_0x11b0b3(0x153),'description':a36_0x11b0b3(0x155),'default':![]}],async 'execute'(_0x31327b){const _0x11b2a1=a36_0x11b0b3,{runAuthServer:_0xf0541b}=await import(_0x11b2a1(0x15a));return await _0xf0541b({'autoYes':_0x31327b[_0x11b2a1(0x166)](_0x11b2a1(0x158)),'nonInteractive':_0x31327b[_0x11b2a1(0x156)]}),{'ok':!![]};}},{'service':a36_0x11b0b3(0x160),'command':'logout','description':'Clear\x20login\x20session','risk':a36_0x11b0b3(0x163),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x53a907){const _0x441ceb=a36_0x11b0b3;return existsSync(cookieFile)?(unlinkSync(cookieFile),console['log'](_0x441ceb(0x15b))):console['log'](_0x441ceb(0x161)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x51ef77=a37_0x4867;(function(_0x2eda3b,_0x21a477){const _0x209712=a37_0x4867,_0xe26b1b=_0x2eda3b();while(!![]){try{const _0x41d74d=parseInt(_0x209712(0x228))/0x1+parseInt(_0x209712(0x243))/0x2*(-parseInt(_0x209712(0x222))/0x3)+-parseInt(_0x209712(0x241))/0x4*(-parseInt(_0x209712(0x1f7))/0x5)+-parseInt(_0x209712(0x21e))/0x6+-parseInt(_0x209712(0x200))/0x7+-parseInt(_0x209712(0x24f))/0x8+parseInt(_0x209712(0x202))/0x9*(parseInt(_0x209712(0x21d))/0xa);if(_0x41d74d===_0x21a477)break;else _0xe26b1b['push'](_0xe26b1b['shift']());}catch(_0x23ca65){_0xe26b1b['push'](_0xe26b1b['shift']());}}}(a37_0x1bd0,0x56ee6));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';function a37_0x1bd0(){const _0x31fde0=['369lvUoZY','code','修改后的请求参数','bff','ENDPOINT','COMMON','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Script\x20type','\x0a\x20*\x20[平台配置]\x20','name','operation-type','\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','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','Invalid\x20dataset\x20selection.','.js','join','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','No\x20datasets\x20found\x20for\x20this\x20app.','function-node','stderr','validation','appCode','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','HOOK\x20requires\x20alias/operation/node\x20options.','apiDir','find','Available:\x20','220090ngzDJq','653238Phtezr','source','nonInteractive','operationType','3TjSaTN','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','No\x20operation\x20types\x20found\x20for\x20dataset\x20','keys','修改后的响应结果','before','693312CjBFvu','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x22\x20not\x20found.\x20','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','datasetId','Dataset\x20not\x20found\x20for\x20code\x20\x22','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','close','.js\x0a','profileName','str','/data/dataset/','Operation\x20type\x20(HOOK\x20only)','/COMMON/','.js\x0a\x20*\x20[触发节点]\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','entries','string','Alias\x20\x22','datasetcode','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','includes','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','UNKNOWN','1332azlfSs','Operation\x20type\x20\x22','1160262WgthGz','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','type','Script\x20description','alias','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','isInteger','datasetCode','map','write','\x22,\x20params\x20})\x0a','description','3857208zVCafq','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','Select\x20operation\x20type:',']\x20(','functionNode','mergedCli','Select\x20dataset:','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','Available\x20aliases:\x20','File\x20already\x20exists:\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','parseInt','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','trim','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','read','Created\x20','length','/HOOK/','Select\x20trigger\x20node:','1265asgRIM','\x22\x20not\x20found\x20for\x20dataset\x20','/**\x0a\x20*\x20','scriptsRootDir','/ENDPOINT/','\x22.\x20','utf8','HOOK','filePath','1068935erFhrF','after'];a37_0x1bd0=function(){return _0x31fde0;};return a37_0x1bd0();}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_0x51ef77(0x205),'command':'create','description':a37_0x51ef77(0x25c),'risk':a37_0x51ef77(0x25f),'flags':[{'name':'type','type':a37_0x51ef77(0x239),'required':!![],'enum':[a37_0x51ef77(0x207),a37_0x51ef77(0x206),a37_0x51ef77(0x1fe)],'description':a37_0x51ef77(0x209)},{'name':a37_0x51ef77(0x20b),'type':a37_0x51ef77(0x239),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x51ef77(0x24e),'type':a37_0x51ef77(0x239),'description':a37_0x51ef77(0x246)},{'name':a37_0x51ef77(0x247),'type':a37_0x51ef77(0x239),'description':a37_0x51ef77(0x237)},{'name':a37_0x51ef77(0x23b),'type':a37_0x51ef77(0x239),'description':a37_0x51ef77(0x23d)},{'name':a37_0x51ef77(0x20c),'type':'string','description':a37_0x51ef77(0x234)},{'name':'function-node','type':a37_0x51ef77(0x239),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a37_0x51ef77(0x227),a37_0x51ef77(0x201)]}],async 'validate'(_0x327cf1){const _0x12544f=a37_0x51ef77,_0x40f92f=_0x327cf1[_0x12544f(0x232)](_0x12544f(0x20b));if(!isValidBffFunctionName(_0x40f92f))throw CliErrors[_0x12544f(0x216)]('Invalid\x20function\x20name\x20\x22'+_0x40f92f+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x400cb8){const _0x5824d8=a37_0x51ef77,_0x4c8956=loadBffProjectConfig(_0x400cb8['appCode']),_0x29ade7=_0x400cb8[_0x5824d8(0x232)](_0x5824d8(0x245)),_0x127d67=_0x400cb8['str'](_0x5824d8(0x20b)),_0x4f3181=_0x400cb8[_0x5824d8(0x232)](_0x5824d8(0x24e))||undefined,_0x4db091=_0x29ade7===_0x5824d8(0x1fe)?await resolveHookOptions(_0x4c8956,_0x400cb8):undefined,_0x2b8a8e=buildFilePath(_0x4c8956,_0x29ade7,_0x127d67,_0x4db091);if(await fileExists(_0x2b8a8e))throw CliErrors[_0x5824d8(0x216)](_0x5824d8(0x259)+_0x2b8a8e);await mkdir(dirname(_0x2b8a8e),{'recursive':!![]});const _0x28df9c=generateTemplate(_0x29ade7,_0x127d67,_0x400cb8[_0x5824d8(0x217)],_0x4f3181,_0x4db091);await writeFile(_0x2b8a8e,_0x28df9c,_0x5824d8(0x1fd));const _0x3b1272={'type':_0x29ade7,'name':_0x127d67,'path':_0x2b8a8e};if(_0x4f3181)_0x3b1272['description']=_0x4f3181;if(_0x4db091){if(_0x4db091[_0x5824d8(0x247)])_0x3b1272['alias']=_0x4db091['alias'];_0x3b1272[_0x5824d8(0x24a)]=_0x4db091['datasetCode'],_0x3b1272['operationType']=_0x4db091['operationType'],_0x3b1272['functionNode']=_0x4db091[_0x5824d8(0x254)];}return{'ok':!![],'data':_0x3b1272,'message':_0x5824d8(0x260)+_0x29ade7+'\x20function:\x20'+_0x127d67};}};function a37_0x4867(_0x3e9b20,_0x39f308){_0x3e9b20=_0x3e9b20-0x1f4;const _0x1bd052=a37_0x1bd0();let _0x4867ed=_0x1bd052[_0x3e9b20];return _0x4867ed;}async function resolveHookOptions(_0x37d12d,_0x42c1a7){const _0x502e3c=a37_0x51ef77,_0x93f925=resolveApiModelSource(_0x42c1a7['apiDir'],_0x42c1a7[_0x502e3c(0x217)],_0x42c1a7['selectedAppName']||_0x42c1a7[_0x502e3c(0x255)]?.['currentApp']||_0x42c1a7[_0x502e3c(0x255)]?.['defaultApp']),_0x2f84b0=loadAliasMap(_0x42c1a7[_0x502e3c(0x21a)],undefined,_0x93f925[_0x502e3c(0x1ff)],_0x93f925[_0x502e3c(0x231)]),_0x48fe08=_0x2f84b0['length']>0x0;let _0x47f427,_0x10c1d4,_0x40b488;const _0x58e7d5=_0x42c1a7[_0x502e3c(0x232)](_0x502e3c(0x247)),_0xb7e885=_0x42c1a7[_0x502e3c(0x232)](_0x502e3c(0x23b));if(_0x58e7d5){const _0x291495=resolveAlias(_0x42c1a7[_0x502e3c(0x21a)],_0x58e7d5,undefined,_0x93f925['filePath'],_0x93f925[_0x502e3c(0x231)]);if(!_0x291495){const _0xed607c=_0x48fe08?_0x502e3c(0x258)+_0x2f84b0[_0x502e3c(0x24b)](_0x1440a8=>_0x1440a8[_0x502e3c(0x247)])[_0x502e3c(0x211)](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x23a)+_0x58e7d5+_0x502e3c(0x22a)+_0xed607c);}_0x47f427=_0x58e7d5,_0x10c1d4=_0x291495;}else{if(_0xb7e885){_0x10c1d4=_0xb7e885;const _0x5eb882=_0x2f84b0[_0x502e3c(0x21b)](_0x2ed643=>_0x2ed643['datasetCode']===_0xb7e885);_0x47f427=_0x5eb882?.['alias'];}else{if(_0x42c1a7[_0x502e3c(0x220)])throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x229));else{if(_0x48fe08){const _0x4a8c22=_0x2f84b0['map'](_0x5563a8=>_0x5563a8[_0x502e3c(0x247)]+'\x20('+_0x5563a8['tableName']+')'),_0x2b1e42=await promptSelect(_0x502e3c(0x256),_0x4a8c22),_0xd4f407=_0x2f84b0[_0x2b1e42];if(!_0xd4f407)throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x20f));_0x47f427=_0xd4f407['alias'],_0x10c1d4=_0xd4f407['datasetCode'];}else{const _0x2a5522=await listDatasets(_0x42c1a7[_0x502e3c(0x217)]);if(_0x2a5522[_0x502e3c(0x1f4)]===0x0)throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x213));const _0x96273c=_0x2a5522[_0x502e3c(0x24b)](_0x4452a9=>_0x4452a9['name']+'\x20['+(_0x4452a9[_0x502e3c(0x21f)]??_0x502e3c(0x240))+_0x502e3c(0x253)+_0x4452a9[_0x502e3c(0x203)]+')'),_0x5eca0c=await promptSelect(_0x502e3c(0x256),_0x96273c),_0x252ced=_0x2a5522[_0x5eca0c];if(!_0x252ced)throw CliErrors['validation']('Invalid\x20dataset\x20selection.');_0x10c1d4=_0x252ced[_0x502e3c(0x203)],_0x47f427=undefined;}}}}const _0x42b49a=await listDatasets(_0x42c1a7['appCode']),_0xdfde20=_0x42b49a[_0x502e3c(0x21b)](_0x35a598=>_0x35a598[_0x502e3c(0x203)]===_0x10c1d4);if(!_0xdfde20)throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x22d)+_0x10c1d4+_0x502e3c(0x1fc)+(_0x47f427?_0x502e3c(0x218)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x40b488=_0xdfde20['id'];const _0x57945a=_0x47f427??_0x10c1d4,_0x5ded1c=await listBffDatasetOperations(_0x42c1a7[_0x502e3c(0x217)],_0x40b488),_0x4716b4=_0x5ded1c?Object[_0x502e3c(0x225)](_0x5ded1c):[];if(_0x4716b4[_0x502e3c(0x1f4)]===0x0)throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x224)+_0x57945a+'.');let _0x3f6152;const _0x5debc5=_0x42c1a7[_0x502e3c(0x232)]('operation-type');if(_0x5debc5){if(!_0x4716b4[_0x502e3c(0x23e)](_0x5debc5))throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x242)+_0x5debc5+_0x502e3c(0x1f8)+_0x57945a+'.\x20'+(_0x502e3c(0x21c)+_0x4716b4[_0x502e3c(0x211)](',\x20')));_0x3f6152=_0x5debc5;}else{if(_0x42c1a7[_0x502e3c(0x220)])throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x250));const _0x154f94=await promptSelect(_0x502e3c(0x252),_0x4716b4);_0x3f6152=_0x4716b4[_0x154f94]??_0x4716b4[0x0];}let _0x3dd5ed=normalizeHookFunctionNode(_0x42c1a7[_0x502e3c(0x232)](_0x502e3c(0x214)));if(!_0x3dd5ed){if(_0x42c1a7['str']('function-node'))throw CliErrors[_0x502e3c(0x216)](_0x502e3c(0x25e));if(_0x42c1a7[_0x502e3c(0x220)])throw CliErrors[_0x502e3c(0x216)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x5dbc6e=await promptSelect(_0x502e3c(0x1f6),['before',_0x502e3c(0x201)]);_0x3dd5ed=['before',_0x502e3c(0x201)][_0x5dbc6e]??_0x502e3c(0x227);}return{'alias':_0x47f427,'datasetCode':_0x10c1d4,'datasetId':_0x40b488,'operationType':_0x3f6152,'functionNode':_0x3dd5ed};}async function promptSelect(_0x3ffb65,_0xa643b0){const _0x5932bb=a37_0x51ef77;if(_0xa643b0[_0x5932bb(0x1f4)]===0x1)return 0x0;for(const [_0x312852,_0x18e996]of _0xa643b0[_0x5932bb(0x238)]()){process['stderr'][_0x5932bb(0x24c)]('\x20\x20'+(_0x312852+0x1)+'.\x20'+_0x18e996+'\x0a');}const _0x221614=createInterface({'input':process['stdin'],'output':process['stderr']});while(!![]){const _0x3c57f7=await new Promise(_0x42218f=>{_0x221614['question'](_0x3ffb65+'\x20',_0x42218f);}),_0x540bf4=Number[_0x5932bb(0x25b)](_0x3c57f7['trim'](),0xa);if(Number[_0x5932bb(0x249)](_0x540bf4)&&_0x540bf4>=0x1&&_0x540bf4<=_0xa643b0['length'])return _0x221614[_0x5932bb(0x22f)](),_0x540bf4-0x1;process[_0x5932bb(0x215)][_0x5932bb(0x24c)](_0x5932bb(0x20e)+_0xa643b0[_0x5932bb(0x1f4)]+'.\x0a');}}function buildFilePath(_0x43be46,_0xae800d,_0x159f7b,_0x4c74fd){const _0x5db734=a37_0x51ef77;if(_0xae800d==='HOOK'){if(!_0x4c74fd)throw CliErrors['validation'](_0x5db734(0x219));const _0x2a101f=_0x4c74fd[_0x5db734(0x247)]??_0x4c74fd['datasetCode'];return join(_0x43be46[_0x5db734(0x1fa)],_0x5db734(0x1fe),_0x2a101f,_0x4c74fd[_0x5db734(0x221)],_0x4c74fd[_0x5db734(0x254)],_0x159f7b+'.js');}return join(_0x43be46[_0x5db734(0x1fa)],_0xae800d,_0x159f7b+_0x5db734(0x210));}export function generateTemplate(_0x4c1421,_0x428a32,_0x2dae9e,_0xd1b107,_0x1cc737){const _0x3e3e62=a37_0x51ef77,_0x470107=_0xd1b107?.[_0x3e3e62(0x25d)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xfe6c70=getAppBaseUrl(_0x2dae9e),_0x1a048f='\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)';if(_0x4c1421==='COMMON')return _0x3e3e62(0x1f9)+_0x470107+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x428a32+_0x3e3e62(0x20a)+_0xfe6c70+_0x3e3e62(0x257)+_0x2dae9e+_0x3e3e62(0x235)+_0x428a32+_0x3e3e62(0x22e)+_0x428a32+_0x3e3e62(0x24d)+_0x1a048f+'\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'+_0x428a32+_0x3e3e62(0x208);if(_0x4c1421===_0x3e3e62(0x206))return _0x3e3e62(0x1f9)+_0x470107+_0x3e3e62(0x23c)+_0x428a32+_0x3e3e62(0x248)+_0x2dae9e+'/'+_0x428a32+_0x3e3e62(0x20a)+_0xfe6c70+_0x3e3e62(0x257)+_0x2dae9e+_0x3e3e62(0x1fb)+_0x428a32+_0x3e3e62(0x230)+_0x1a048f+_0x3e3e62(0x20d)+_0x428a32+_0x3e3e62(0x208);if(!_0x1cc737)throw CliErrors[_0x3e3e62(0x216)](_0x3e3e62(0x22b));const _0x15178d=_0x1cc737[_0x3e3e62(0x247)]??_0x1cc737[_0x3e3e62(0x24a)],_0x4c821b=_0x1cc737[_0x3e3e62(0x254)]===_0x3e3e62(0x227)?'当前请求参数':'当前响应结果',_0xf3f2f0=_0x1cc737[_0x3e3e62(0x254)]===_0x3e3e62(0x227)?_0x3e3e62(0x204):_0x3e3e62(0x226);return _0x3e3e62(0x1f9)+_0x470107+_0x3e3e62(0x244)+_0x428a32+_0x3e3e62(0x25a)+_0x2dae9e+'/'+_0x1cc737[_0x3e3e62(0x24a)]+'/'+_0x1cc737[_0x3e3e62(0x221)]+'\x0a\x20*\x20[平台配置]\x20'+_0xfe6c70+_0x3e3e62(0x233)+_0x1cc737[_0x3e3e62(0x22c)]+_0x3e3e62(0x251)+_0x2dae9e+_0x3e3e62(0x1f5)+_0x15178d+'/'+_0x1cc737[_0x3e3e62(0x221)]+'/'+_0x1cc737['functionNode']+'/'+_0x428a32+_0x3e3e62(0x236)+_0x1cc737['functionNode']+'\x0a'+_0x1a048f+_0x3e3e62(0x212)+_0x4c821b+_0x3e3e62(0x223)+_0xf3f2f0+_0x3e3e62(0x23f)+_0x428a32+_0x3e3e62(0x208);}
|
|
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 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x276e50=a38_0x1614;(function(_0x48b297,_0x2c2929){const _0x18583a=a38_0x1614,_0x42c0f6=_0x48b297();while(!![]){try{const _0x3b50e8=parseInt(_0x18583a(0x19d))/0x1*(parseInt(_0x18583a(0x1a7))/0x2)+-parseInt(_0x18583a(0x186))/0x3+parseInt(_0x18583a(0x182))/0x4+-parseInt(_0x18583a(0x1a1))/0x5*(-parseInt(_0x18583a(0x17f))/0x6)+-parseInt(_0x18583a(0x17d))/0x7*(-parseInt(_0x18583a(0x18e))/0x8)+parseInt(_0x18583a(0x198))/0x9*(parseInt(_0x18583a(0x18a))/0xa)+parseInt(_0x18583a(0x180))/0xb*(-parseInt(_0x18583a(0x189))/0xc);if(_0x3b50e8===_0x2c2929)break;else _0x42c0f6['push'](_0x42c0f6['shift']());}catch(_0x5e5abf){_0x42c0f6['push'](_0x42c0f6['shift']());}}}(a38_0x1246,0x44f3e));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';function a38_0x1614(_0x59a3f8,_0x16003d){_0x59a3f8=_0x59a3f8-0x17c;const _0x1246f9=a38_0x1246();let _0x1614dc=_0x1246f9[_0x59a3f8];return _0x1614dc;}import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x276e50(0x197),'command':'delete','description':a38_0x276e50(0x19a),'risk':'high-risk-write','flags':[{'name':a38_0x276e50(0x1a2),'type':a38_0x276e50(0x193),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x24c1c4){const _0x17b4fe=a38_0x276e50,_0x5f2b7c=loadBffProjectConfig(_0x24c1c4['appCode']),_0x2f281e=await readBffLockFile(_0x5f2b7c['lockFilePath']);if(!_0x2f281e)throw CliErrors[_0x17b4fe(0x187)](_0x17b4fe(0x194));},async 'dryRun'(_0x142b08){const _0x250f23=a38_0x276e50,_0x7235c9=loadBffProjectConfig(_0x142b08[_0x250f23(0x192)]),_0x250edd=await readBffLockFile(_0x7235c9[_0x250f23(0x18b)]);if(!_0x250edd)throw CliErrors[_0x250f23(0x187)](_0x250f23(0x1b2));const {appLock:_0x182435}=ensureLockScope(_0x250edd,_0x142b08['appCode'],_0x7235c9[_0x250f23(0x17c)],_0x250f23(0x1a4)),_0x3f7711=_0x142b08['str'](_0x250f23(0x1a2)),_0x959f7d=Object['keys'](_0x182435[_0x250f23(0x1a3)]),_0x18a2b5=resolveDeleteTarget(_0x3f7711,_0x959f7d),_0x1400db=_0x182435[_0x250f23(0x1a3)][_0x18a2b5];if(!_0x1400db)throw CliErrors[_0x250f23(0x187)](_0x250f23(0x1ae)+_0x18a2b5+'\x22.');const _0x43d4a7=resolveLocalFilePathFromLockKey(_0x7235c9,_0x18a2b5),_0x843fa8=relative(_0x7235c9['projectRoot'],_0x43d4a7),_0x3823a8=join(_0x7235c9['trashDir'],_0x250f23(0x19c),_0x843fa8);return{'method':_0x250f23(0x19b),'url':_0x250f23(0x1a8),'body':{'appCode':_0x142b08[_0x250f23(0x192)],'target':_0x18a2b5,'remoteId':_0x1400db['remoteId'],'localFilePath':_0x43d4a7,'trashedPath':_0x3823a8},'description':'Would\x20delete\x20'+_0x18a2b5+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash'};},async 'execute'(_0x4de1c3){const _0x19dae6=a38_0x276e50,_0x1696e5=loadBffProjectConfig(_0x4de1c3[_0x19dae6(0x192)]),_0x4acd73=await readBffLockFile(_0x1696e5['lockFilePath']);if(!_0x4acd73)throw CliErrors['validation']('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x31360b,appLock:_0x38e023}=ensureLockScope(_0x4acd73,_0x4de1c3['appCode'],_0x1696e5[_0x19dae6(0x17c)],'delete'),_0x40aaa3=JSON[_0x19dae6(0x181)](JSON[_0x19dae6(0x1a5)](_0x31360b)),_0x3e538f=_0x40aaa3[_0x19dae6(0x17e)][_0x4de1c3[_0x19dae6(0x192)]];if(!_0x3e538f)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x4de1c3[_0x19dae6(0x192)]+_0x19dae6(0x1a9));const _0x2b9a42=_0x4de1c3[_0x19dae6(0x1b1)](_0x19dae6(0x1a2)),_0x9d4f95=Object[_0x19dae6(0x183)](_0x3e538f[_0x19dae6(0x1a3)]),_0x3b2489=resolveDeleteTarget(_0x2b9a42,_0x9d4f95),_0x50fa03=_0x3e538f['functions'][_0x3b2489];if(!_0x50fa03)throw CliErrors[_0x19dae6(0x187)](_0x19dae6(0x1ae)+_0x3b2489+'\x22.');await deleteBffScript(_0x50fa03['remoteId']),delete _0x3e538f['functions'][_0x3b2489],_0x3e538f['lastSync']=new Date()['toISOString'](),await writeBffLockFile(_0x1696e5['lockFilePath'],_0x40aaa3);const _0x2eb83e=resolveLocalFilePathFromLockKey(_0x1696e5,_0x3b2489);let _0x341d95;await fileExists(_0x2eb83e)&&(_0x341d95=await moveToTrash(_0x1696e5[_0x19dae6(0x190)],_0x1696e5[_0x19dae6(0x185)],_0x2eb83e),await cleanupEmptyDirectories(dirname(_0x2eb83e),_0x1696e5[_0x19dae6(0x18d)]));await waitForDeleteSettlement(_0x1696e5[_0x19dae6(0x18b)],_0x4de1c3[_0x19dae6(0x192)],_0x3b2489,_0x2eb83e),await sleep(0x96);const _0x189310={'deleted':_0x3b2489,'remoteId':_0x50fa03[_0x19dae6(0x18c)]};if(_0x341d95)_0x189310[_0x19dae6(0x1ab)]=_0x341d95;return{'ok':!![],'data':_0x189310,'message':_0x19dae6(0x19f)+_0x3b2489+(_0x341d95?_0x19dae6(0x19e):'')};}};function resolveDeleteTarget(_0x4befca,_0x25450a){const _0x575e2f=a38_0x276e50;if(_0x4befca[_0x575e2f(0x184)]('/')){const _0x515689=_0x25450a[_0x575e2f(0x195)](_0x961b8=>_0x961b8===_0x4befca);if(!_0x515689)throw CliErrors[_0x575e2f(0x187)](_0x575e2f(0x1af)+_0x4befca);return _0x515689;}const _0x26e524=_0x25450a[_0x575e2f(0x1ac)](_0x2b54dc=>_0x2b54dc[_0x575e2f(0x18f)]('/')['at'](-0x1)===_0x4befca);if(_0x26e524['length']===0x0)throw CliErrors[_0x575e2f(0x187)]('Function\x20not\x20found:\x20'+_0x4befca);if(_0x26e524[_0x575e2f(0x1a0)]>0x1)throw CliErrors[_0x575e2f(0x187)](_0x575e2f(0x199)+_0x4befca+_0x575e2f(0x191)+_0x26e524[_0x575e2f(0x1aa)](_0xda7d3c=>_0x575e2f(0x196)+_0xda7d3c)[_0x575e2f(0x188)]('\x0a'));return _0x26e524[0x0];}function a38_0x1246(){const _0xe7fd1e=['string','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','find','\x20\x20-\x20','bff','2736630ALpcla','Multiple\x20functions\x20match\x20\x22','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','POST','<timestamp>','143896cxCuwQ','\x20(local\x20file\x20moved\x20to\x20trash)','Deleted\x20','length','2344670uycyVZ','target','functions','delete','stringify','replace','2yFeKlG','/api/management/library/scripts/delete','\x22\x20not\x20found\x20after\x20ensureLockScope.','map','trashedTo','filter','toISOString','No\x20lock\x20entry\x20found\x20for\x20\x22','Function\x20not\x20found:\x20','startsWith','str','Backend\x20Function\x20lock\x20file\x20not\x20found.','scriptsRoot','9793xRXShY','apps','6dNPAzy','10596311dhTWCL','parse','1741632WCBzud','keys','includes','trashDir','475020ojIyMF','validation','join','12hysWpW','10JheDfz','lockFilePath','remoteId','scriptsRootDir','296QbGpLn','split','projectRoot','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','appCode'];a38_0x1246=function(){return _0xe7fd1e;};return a38_0x1246();}async function moveToTrash(_0x178511,_0x23d969,_0xb74b6c){const _0x1c05d8=a38_0x276e50,_0x5d3e6b=new Date()[_0x1c05d8(0x1ad)]()[_0x1c05d8(0x1a6)](/[:.]/g,'-'),_0x56f3bd=relative(_0x178511,_0xb74b6c),_0x10b5ed=join(_0x23d969,_0x5d3e6b,_0x56f3bd);return await mkdir(dirname(_0x10b5ed),{'recursive':!![]}),await rename(_0xb74b6c,_0x10b5ed),_0x10b5ed;}async function cleanupEmptyDirectories(_0x599334,_0x39e941){const _0x54b8f6=a38_0x276e50;let _0x338e87=resolve(_0x599334);const _0x29892d=resolve(_0x39e941);while(_0x338e87[_0x54b8f6(0x1b0)](''+_0x29892d+sep)||_0x338e87===_0x29892d){if(_0x338e87===_0x29892d)return;try{const _0x2e3a5e=await readdir(_0x338e87);if(_0x2e3a5e[_0x54b8f6(0x1a0)]>0x0)return;await rmdir(_0x338e87);}catch{return;}_0x338e87=dirname(_0x338e87);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x4d7b2a,_0xf5d539,_0x39eb7c,_0x3b7e6e){const _0x445b48=a38_0x276e50;for(let _0x5e0331=0x0;_0x5e0331<DELETE_SETTLE_RETRY_COUNT;_0x5e0331+=0x1){const _0x3e3ddf=await readBffLockFile(_0x4d7b2a),_0x2edfe9=!!_0x3e3ddf?.[_0x445b48(0x17e)]?.[_0xf5d539]?.[_0x445b48(0x1a3)]?.[_0x39eb7c],_0x2e98c4=await fileExists(_0x3b7e6e);if(!_0x2edfe9&&!_0x2e98c4)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x39eb7c+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x19a0d2=a39_0x4216;function a39_0x4216(_0x5a2d0a,_0x367dcf){_0x5a2d0a=_0x5a2d0a-0xbb;const _0x58981b=a39_0x5898();let _0x421632=_0x58981b[_0x5a2d0a];return _0x421632;}(function(_0x212ad9,_0x576558){const _0x535cd8=a39_0x4216,_0x4f8a3b=_0x212ad9();while(!![]){try{const _0x21583c=-parseInt(_0x535cd8(0xcb))/0x1+parseInt(_0x535cd8(0xc5))/0x2*(parseInt(_0x535cd8(0xbe))/0x3)+-parseInt(_0x535cd8(0xcc))/0x4*(-parseInt(_0x535cd8(0xc1))/0x5)+parseInt(_0x535cd8(0xc8))/0x6+-parseInt(_0x535cd8(0xc3))/0x7*(parseInt(_0x535cd8(0xc7))/0x8)+parseInt(_0x535cd8(0xc2))/0x9*(-parseInt(_0x535cd8(0xcd))/0xa)+-parseInt(_0x535cd8(0xca))/0xb;if(_0x21583c===_0x576558)break;else _0x4f8a3b['push'](_0x4f8a3b['shift']());}catch(_0x4ce416){_0x4f8a3b['push'](_0x4f8a3b['shift']());}}}(a39_0x5898,0xba68f));import{getBffScriptInfo}from'../../core/api-client.js';function a39_0x5898(){const _0x95e818=['updatedTime','12565036akGMot','511921somBLc','21668dLXGYU','850870vLSSjG','scriptContent','scriptType','description','appCode','3ZihKFA','verbose','read','435ZqnCjW','27hiMJaE','196567xxQxWF','boolean','1871698BHrTzI','Script\x20ID','56ylvYmv','8774592KcFSkk'];a39_0x5898=function(){return _0x95e818;};return a39_0x5898();}export const bffDetail={'service':'bff','command':'detail','description':'Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','risk':a39_0x19a0d2(0xc0),'flags':[{'name':'id','type':'number','required':!![],'description':a39_0x19a0d2(0xc6)},{'name':a39_0x19a0d2(0xbf),'type':a39_0x19a0d2(0xc4),'description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x42bb13){const _0xd3a5de=a39_0x19a0d2,_0x58c14c=await getBffScriptInfo(_0x42bb13['num']('id')),_0x5d72d1=_0x42bb13['bool'](_0xd3a5de(0xbf));if(_0x5d72d1)return{'ok':!![],'data':_0x58c14c};return{'ok':!![],'data':{'id':_0x58c14c['id'],'functionName':_0x58c14c['functionName']??'','version':_0x58c14c['version']??'','updateUserName':_0x58c14c['updateUserName']??'','appCode':_0x58c14c[_0xd3a5de(0xbd)],'scriptType':_0x58c14c[_0xd3a5de(0xbb)],'description':_0x58c14c[_0xd3a5de(0xbc)]||'(none)','createdTime':_0x58c14c['createdTime']??'','updatedTime':_0x58c14c[_0xd3a5de(0xc9)]??'','scriptContent':_0x58c14c[_0xd3a5de(0xce)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x19b2b0,_0x2525e9){const _0x3fe19b=a40_0x4862,_0x2ce7bc=_0x19b2b0();while(!![]){try{const _0x2293f9=-parseInt(_0x3fe19b(0x12b))/0x1*(parseInt(_0x3fe19b(0x128))/0x2)+-parseInt(_0x3fe19b(0x12a))/0x3+parseInt(_0x3fe19b(0x127))/0x4*(-parseInt(_0x3fe19b(0x126))/0x5)+-parseInt(_0x3fe19b(0x125))/0x6*(parseInt(_0x3fe19b(0x124))/0x7)+parseInt(_0x3fe19b(0x123))/0x8*(parseInt(_0x3fe19b(0x12f))/0x9)+parseInt(_0x3fe19b(0x12d))/0xa*(parseInt(_0x3fe19b(0x12c))/0xb)+-parseInt(_0x3fe19b(0x129))/0xc*(-parseInt(_0x3fe19b(0x12e))/0xd);if(_0x2293f9===_0x2525e9)break;else _0x2ce7bc['push'](_0x2ce7bc['shift']());}catch(_0x23d6f5){_0x2ce7bc['push'](_0x2ce7bc['shift']());}}}(a40_0x1233,0x7bf30));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';function a40_0x4862(_0xa11184,_0x15271d){_0xa11184=_0xa11184-0x123;const _0x123379=a40_0x1233();let _0x48625f=_0x123379[_0xa11184];return _0x48625f;}function a40_0x1233(){const _0x2aa198=['16484djBqcw','9viUcaS','6209312NCpGgo','7rlXxJW','940686NWiQSX','49275TzPUXh','268mIIZsT','1578OLsVSc','11256gJvZay','2603328aigGUi','653hiPGiw','32527dTjmnZ','2510PbIzbK'];a40_0x1233=function(){return _0x2aa198;};return a40_0x1233();}import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x2acfb1=a41_0x80d4;(function(_0x3311f9,_0x39540a){const _0x5be0fd=a41_0x80d4,_0x4b7ec2=_0x3311f9();while(!![]){try{const _0x182e4d=parseInt(_0x5be0fd(0x1ab))/0x1+-parseInt(_0x5be0fd(0x1a9))/0x2*(parseInt(_0x5be0fd(0x19f))/0x3)+-parseInt(_0x5be0fd(0x195))/0x4+parseInt(_0x5be0fd(0x1a5))/0x5*(parseInt(_0x5be0fd(0x1a0))/0x6)+-parseInt(_0x5be0fd(0x19d))/0x7+parseInt(_0x5be0fd(0x190))/0x8*(-parseInt(_0x5be0fd(0x1a7))/0x9)+parseInt(_0x5be0fd(0x1a4))/0xa;if(_0x182e4d===_0x39540a)break;else _0x4b7ec2['push'](_0x4b7ec2['shift']());}catch(_0x3d9354){_0x4b7ec2['push'](_0x4b7ec2['shift']());}}}(a41_0x10f3,0x76c2b));function a41_0x80d4(_0xde8d81,_0x3e957b){_0xde8d81=_0xde8d81-0x18f;const _0x10f317=a41_0x10f3();let _0x80d40b=_0x10f317[_0xde8d81];return _0x80d40b;}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':'bff','command':a41_0x2acfb1(0x1a6),'description':'List\x20Backend\x20Function\x20scripts','risk':'read','flags':[{'name':a41_0x2acfb1(0x197),'type':a41_0x2acfb1(0x1a8),'description':a41_0x2acfb1(0x193),'default':'ENDPOINT','enum':[a41_0x2acfb1(0x1a3),a41_0x2acfb1(0x1aa)]},{'name':a41_0x2acfb1(0x198),'type':a41_0x2acfb1(0x1a8),'description':a41_0x2acfb1(0x1a1)},{'name':'verbose','type':a41_0x2acfb1(0x1a2),'description':a41_0x2acfb1(0x192)}],async 'execute'(_0x24d602){const _0xef37f1=a41_0x2acfb1,_0x4ed94b=await listBffScripts(_0x24d602[_0xef37f1(0x19a)],_0x24d602['str'](_0xef37f1(0x197)),{'scriptName':_0x24d602[_0xef37f1(0x194)](_0xef37f1(0x198))||undefined}),_0x40e5ce=_0x24d602[_0xef37f1(0x191)](_0xef37f1(0x19b));return{'ok':!![],'data':_0x40e5ce?_0x4ed94b:_0x4ed94b['map'](_0x2399e3=>({'id':_0x2399e3['id'],'functionName':_0x2399e3[_0xef37f1(0x199)]??'','description':_0x2399e3[_0xef37f1(0x19e)]||_0xef37f1(0x18f),'scriptType':_0x2399e3['scriptType']})),'message':_0x4ed94b[_0xef37f1(0x19c)]===0x0?_0xef37f1(0x196):undefined};}};function a41_0x10f3(){const _0x419276=['990974fthfzx','COMMON','556227dygQLb','(unnamed)','1224zawchL','bool','Return\x20full\x20script\x20objects','Script\x20type\x20filter','str','3227556QOtMGq','No\x20Backend\x20Function\x20scripts\x20found.','type','name','functionName','appCode','verbose','length','4527306ooDAzS','description','3FihYKA','3056862xlbQpm','Filter\x20by\x20script\x20name','boolean','ENDPOINT','18864010gmwvHz','5gNPIdc','list','30384fcHwlI','string'];a41_0x10f3=function(){return _0x419276;};return a41_0x10f3();}
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x2b80de=a42_0x45c4;(function(_0x18ff2c,_0x5e61c1){const _0x3a26e1=a42_0x45c4,_0x333fc1=_0x18ff2c();while(!![]){try{const _0xf1d546=parseInt(_0x3a26e1(0xb5))/0x1*(-parseInt(_0x3a26e1(0xcc))/0x2)+parseInt(_0x3a26e1(0xb1))/0x3+parseInt(_0x3a26e1(0xb6))/0x4*(-parseInt(_0x3a26e1(0xaf))/0x5)+parseInt(_0x3a26e1(0xd3))/0x6*(parseInt(_0x3a26e1(0xda))/0x7)+parseInt(_0x3a26e1(0xcb))/0x8+parseInt(_0x3a26e1(0xb2))/0x9+-parseInt(_0x3a26e1(0xbb))/0xa*(-parseInt(_0x3a26e1(0xbd))/0xb);if(_0xf1d546===_0x5e61c1)break;else _0x333fc1['push'](_0x333fc1['shift']());}catch(_0x14bbb4){_0x333fc1['push'](_0x333fc1['shift']());}}}(a42_0x59ee,0xb1d7b));function a42_0x59ee(){const _0x32400c=['--end-time','WARN','\x20must\x20be\x20a\x20positive\x20integer.','35lQeQaz','DEBUG','trim','--limit','--limit\x20must\x20be\x20between\x201\x20and\x20','level','4255QhwpPL','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','323334jzKbCo','5191479yWpKdt','str','INFO','1WcWsBs','4948dpYQLK','--since','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','--start-time','since','1475940hwccTm','Maximum\x20log\x20lines\x20to\x20return\x20(1-','11WeAESu','read','now','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','appCode','string','end-time','length','validation','toUpperCase','Filter\x20by\x20log\x20level','Found\x20','num','isSafeInteger','5597248NGrKlL','259918mNMBBO','flag','logs','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','keyword','start-time','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','455076utEBCB','number','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','limit'];a42_0x59ee=function(){return _0x32400c;};return a42_0x59ee();}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_0x2b80de(0xdb),a42_0x2b80de(0xb4),a42_0x2b80de(0xd8),'ERROR'];export function resolveBffLogQuery(_0x2e0f93,_0x107dd6=Date[a42_0x2b80de(0xbf)]()){const _0x37e9fa=a42_0x2b80de,_0x2f8ec8=_0x2e0f93[_0x37e9fa(0xcd)](_0x37e9fa(0xba)),_0x4435b6=_0x2e0f93[_0x37e9fa(0xcd)](_0x37e9fa(0xd1)),_0x505eaa=_0x2e0f93[_0x37e9fa(0xcd)](_0x37e9fa(0xc3));if(_0x2f8ec8!==undefined&&_0x4435b6!==undefined)throw CliErrors[_0x37e9fa(0xc5)]('--since\x20cannot\x20be\x20combined\x20with\x20--start-time.');const _0x34fef1=_0x505eaa===undefined?_0x107dd6:readPositiveInteger(_0x2e0f93[_0x37e9fa(0xc9)](_0x37e9fa(0xc3)),_0x37e9fa(0xd7)),_0x42b057=_0x4435b6===undefined?_0x34fef1-readSinceMinutes(_0x2e0f93)*0xea60:readPositiveInteger(_0x2e0f93[_0x37e9fa(0xc9)](_0x37e9fa(0xd1)),_0x37e9fa(0xb9));if(_0x42b057<=0x0)throw CliErrors[_0x37e9fa(0xc5)](_0x37e9fa(0xb0));if(_0x42b057>_0x34fef1)throw CliErrors['validation'](_0x37e9fa(0xd5));const _0x596b94=readPositiveInteger(_0x2e0f93[_0x37e9fa(0xc9)](_0x37e9fa(0xd6),DEFAULT_LIMIT),_0x37e9fa(0xdd));if(_0x596b94>MAX_LIMIT)throw CliErrors['validation'](_0x37e9fa(0xad)+MAX_LIMIT+'.');const _0x2bc99a=_0x2e0f93[_0x37e9fa(0xb3)]('level')[_0x37e9fa(0xdc)]()[_0x37e9fa(0xc6)]()||undefined,_0x41fd94=_0x2e0f93['str']('keyword')[_0x37e9fa(0xdc)]()||undefined;return{'appCode':_0x2e0f93[_0x37e9fa(0xc1)],'startTime':_0x42b057,'endTime':_0x34fef1,..._0x4435b6===undefined?{'sinceMinutes':readSinceMinutes(_0x2e0f93)}:{},..._0x2bc99a?{'level':_0x2bc99a}:{},..._0x41fd94?{'keyword':_0x41fd94}:{},'limit':_0x596b94};}function readSinceMinutes(_0xe9b306){const _0x44231e=a42_0x2b80de;return readPositiveInteger(_0xe9b306['num'](_0x44231e(0xba),DEFAULT_SINCE_MINUTES),_0x44231e(0xb7));}function a42_0x45c4(_0x3d49b3,_0x499f35){_0x3d49b3=_0x3d49b3-0xad;const _0x59ee5b=a42_0x59ee();let _0x45c42e=_0x59ee5b[_0x3d49b3];return _0x45c42e;}function readPositiveInteger(_0x4374fa,_0x4fa6b1){const _0x246d4a=a42_0x2b80de;if(!Number[_0x246d4a(0xca)](_0x4374fa)||_0x4374fa<=0x0)throw CliErrors[_0x246d4a(0xc5)](_0x4fa6b1+_0x246d4a(0xd9));return _0x4374fa;}export const bffLogs={'service':'bff','command':a42_0x2b80de(0xce),'description':a42_0x2b80de(0xd2),'risk':a42_0x2b80de(0xbe),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x2b80de(0xba),'type':a42_0x2b80de(0xd4),'description':a42_0x2b80de(0xc0)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x2b80de(0xd1),'type':a42_0x2b80de(0xd4),'description':a42_0x2b80de(0xb8)},{'name':a42_0x2b80de(0xc3),'type':'number','description':a42_0x2b80de(0xcf)},{'name':a42_0x2b80de(0xae),'type':a42_0x2b80de(0xc2),'description':a42_0x2b80de(0xc7),'enum':LOG_LEVELS},{'name':a42_0x2b80de(0xd0),'type':a42_0x2b80de(0xc2),'description':'Filter\x20formatted\x20log\x20lines\x20by\x20keyword'},{'name':a42_0x2b80de(0xd6),'type':'number','description':a42_0x2b80de(0xbc)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x835686){resolveBffLogQuery(_0x835686);},async 'execute'(_0x38218d){const _0x51d09b=a42_0x2b80de,_0x2fa055=resolveBffLogQuery(_0x38218d),{sinceMinutes:_0x49ce2d,..._0x4bc526}=_0x2fa055,_0x2701f9=await searchBffScriptLogs(_0x4bc526);return{'ok':!![],'data':{'query':_0x2fa055,'count':_0x2701f9[_0x51d09b(0xc4)],'logs':_0x2701f9},'message':_0x2701f9[_0x51d09b(0xc4)]===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':_0x51d09b(0xc8)+_0x2701f9[_0x51d09b(0xc4)]+'\x20Backend\x20Function\x20log\x20line(s).'};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x204254=a43_0x4228;function a43_0x4228(_0x183d06,_0x300297){_0x183d06=_0x183d06-0x1a6;const _0x3caa27=a43_0x3caa();let _0x42280f=_0x3caa27[_0x183d06];return _0x42280f;}(function(_0x2d2d9e,_0x49a1ba){const _0x77a613=a43_0x4228,_0x10cc75=_0x2d2d9e();while(!![]){try{const _0x498054=-parseInt(_0x77a613(0x21e))/0x1+parseInt(_0x77a613(0x221))/0x2*(-parseInt(_0x77a613(0x1ac))/0x3)+parseInt(_0x77a613(0x239))/0x4*(-parseInt(_0x77a613(0x21b))/0x5)+parseInt(_0x77a613(0x1c8))/0x6*(-parseInt(_0x77a613(0x216))/0x7)+-parseInt(_0x77a613(0x1fb))/0x8*(-parseInt(_0x77a613(0x1ef))/0x9)+parseInt(_0x77a613(0x204))/0xa*(-parseInt(_0x77a613(0x1d8))/0xb)+parseInt(_0x77a613(0x22f))/0xc*(parseInt(_0x77a613(0x227))/0xd);if(_0x498054===_0x49a1ba)break;else _0x10cc75['push'](_0x10cc75['shift']());}catch(_0x52e962){_0x10cc75['push'](_0x10cc75['shift']());}}}(a43_0x3caa,0x74ac0));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x204254(0x1c7),'command':a43_0x204254(0x1e1),'description':a43_0x204254(0x1f1),'risk':'read','structuredErrors':!![],'flags':[{'name':a43_0x204254(0x1ff),'type':a43_0x204254(0x1fa),'description':a43_0x204254(0x1f4),'enum':[a43_0x204254(0x21a),a43_0x204254(0x1c6),a43_0x204254(0x1b1)]},{'name':a43_0x204254(0x238),'type':a43_0x204254(0x23a),'description':a43_0x204254(0x209)}],async 'dryRun'(_0x4d6d7e){const _0x3bdf48=a43_0x204254,_0x120ee2=loadBffProjectConfig(_0x4d6d7e[_0x3bdf48(0x200)]),_0x42d87c=await readBffLockFile(_0x120ee2[_0x3bdf48(0x1cb)]),{appLock:_0x5d8472}=ensureLockScope(_0x42d87c??createEmptyBffLock(),_0x4d6d7e[_0x3bdf48(0x200)],_0x120ee2[_0x3bdf48(0x1b5)],'pull'),_0xbc123b=normalizeBffType(_0x4d6d7e[_0x3bdf48(0x1c1)]('type'))??undefined,[_0x1cc26c,_0x15a116]=await Promise['all']([listBffScripts(_0x4d6d7e[_0x3bdf48(0x200)],_0xbc123b),getBffScriptStatistics(_0x4d6d7e['appCode'])]),_0x499b1f=_0x1cc26c[_0x3bdf48(0x23b)](_0x3ddc49=>normalizeBffType(_0x3ddc49[_0x3bdf48(0x1d6)])===_0x3bdf48(0x1b1)),_0x634146=_0x499b1f?buildDatasetCodeToAliasMap(_0x4d6d7e[_0x3bdf48(0x1e8)],_0x4d6d7e['appCode'],_0x4d6d7e[_0x3bdf48(0x1bc)]||_0x4d6d7e[_0x3bdf48(0x1e5)]?.['currentApp']||_0x4d6d7e[_0x3bdf48(0x1e5)]?.[_0x3bdf48(0x20f)]):new Map(),_0x481ab2=_0x499b1f?await planHookDirectoryMigration(_0x120ee2,_0x5d8472,_0x634146,await scanLocalBffFunctions(_0x120ee2,_0x3bdf48(0x1b1))):undefined,_0x40c363=createHookLocationMap(_0x15a116),_0x2002d2=[];for(const _0xb57363 of _0x1cc26c){const _0x14fed7=resolveRemoteScriptTarget(_0x120ee2,_0xb57363,_0x40c363,_0x481ab2?.['projectedFunctions']??_0x5d8472[_0x3bdf48(0x1fc)],_0x634146);if(!_0x14fed7){_0x2002d2[_0x3bdf48(0x23f)]({'scriptType':_0xb57363['scriptType'],'functionName':_0xb57363[_0x3bdf48(0x1ad)]??'','status':_0x3bdf48(0x1db),'reason':_0x3bdf48(0x22a)});continue;}const _0x1ec755=(_0x481ab2?.[_0x3bdf48(0x1dd)]??_0x5d8472[_0x3bdf48(0x1fc)])[_0x14fed7[_0x3bdf48(0x1b2)]],_0x3066d2=_0xb57363['scriptContent']!=null?computeContentHash(_0xb57363[_0x3bdf48(0x223)]):undefined,_0x595466=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x481ab2,_0x14fed7)??_0x14fed7[_0x3bdf48(0x233)],_0x1ec755,_0x3066d2),_0x54490d=_0x595466?localUnsyncedConflict(_0x14fed7,_0xb57363['id']):undefined;_0x2002d2[_0x3bdf48(0x23f)]({'lockKey':_0x14fed7['lockKey'],'filePath':_0x14fed7['filePath'],'remoteId':_0xb57363['id']??null,'status':_0x54490d?_0x3bdf48(0x22e):_0x3bdf48(0x1a9),..._0x54490d?{'conflict':_0x54490d}:{},..._0x14fed7[_0x3bdf48(0x1d2)]?{'alias':_0x14fed7['hookLocation'][_0x3bdf48(0x215)]??null,'datasetCode':_0x14fed7[_0x3bdf48(0x1d2)]['datasetCode'],'operationType':_0x14fed7[_0x3bdf48(0x1d2)][_0x3bdf48(0x1c2)],'functionNode':_0x14fed7[_0x3bdf48(0x1d2)][_0x3bdf48(0x20a)]}:{}});}return{'method':_0x3bdf48(0x1c9),'url':'/api/management/library/scripts/list?appCode='+_0x4d6d7e['appCode']+(_0xbc123b?'&type='+_0xbc123b:'')+_0x3bdf48(0x206)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x4d6d7e['appCode'],'filterType':_0xbc123b??null,..._0x481ab2&&_0x481ab2[_0x3bdf48(0x1b6)][_0x3bdf48(0x1da)]>0x0?{'hookDirectoryMigrations':_0x481ab2[_0x3bdf48(0x1b6)]['map'](_0x50bfc6=>({'from':_0x50bfc6['oldDirectory'],'to':_0x50bfc6[_0x3bdf48(0x1d9)]}))}:{},'files':_0x2002d2},'description':_0x3bdf48(0x20e)+_0x2002d2[_0x3bdf48(0x1da)]+_0x3bdf48(0x1a6)};},async 'execute'(_0x7ffda3){const _0x1ae596=a43_0x204254,_0x43845e=loadBffProjectConfig(_0x7ffda3[_0x1ae596(0x200)]),_0x22d7f6=await readBffLockFile(_0x43845e[_0x1ae596(0x1cb)]),{lockData:_0x37b3a8,appLock:_0x103012}=ensureLockScope(_0x22d7f6??createEmptyBffLock(),_0x7ffda3['appCode'],_0x43845e[_0x1ae596(0x1b5)],_0x1ae596(0x1e1)),_0x4d0040=normalizeBffType(_0x7ffda3['str']('type'))??undefined;if(_0x7ffda3[_0x1ae596(0x1c1)](_0x1ae596(0x1ff))&&!_0x4d0040)throw CliErrors[_0x1ae596(0x1e3)](_0x1ae596(0x1f7));const [_0x21a2db,_0x1d7a52]=await Promise['all']([listBffScripts(_0x7ffda3['appCode'],_0x4d0040),getBffScriptStatistics(_0x7ffda3[_0x1ae596(0x200)])]);if(_0x21a2db['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x1ae596(0x211)};const _0x44cca3=_0x7ffda3[_0x1ae596(0x1ab)]('force');if(_0x44cca3&&!_0x7ffda3[_0x1ae596(0x1ca)]){const _0x591832=await confirmForce();if(!_0x591832)throw CliErrors['cancelled'](_0x1ae596(0x1f5));}if(_0x44cca3&&_0x7ffda3[_0x1ae596(0x1ca)]){}const _0x524c8a=_0x21a2db['some'](_0x424076=>normalizeBffType(_0x424076[_0x1ae596(0x1d6)])===_0x1ae596(0x1b1)),_0x34e870=_0x524c8a?buildDatasetCodeToAliasMap(_0x7ffda3[_0x1ae596(0x1e8)],_0x7ffda3['appCode'],_0x7ffda3[_0x1ae596(0x1bc)]||_0x7ffda3[_0x1ae596(0x1e5)]?.[_0x1ae596(0x225)]||_0x7ffda3[_0x1ae596(0x1e5)]?.[_0x1ae596(0x20f)]):new Map(),_0x3c0d79=createHookLocationMap(_0x1d7a52),_0x130410=JSON[_0x1ae596(0x224)](JSON[_0x1ae596(0x237)](_0x37b3a8)),_0x216043=_0x7ffda3[_0x1ae596(0x200)],_0x403d9f=_0x130410[_0x1ae596(0x219)][_0x216043];if(!_0x403d9f)throw new Error(_0x1ae596(0x208)+_0x216043+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x39df2a=_0x524c8a?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x43845e,_0x403d9f,_0x34e870,await scanLocalBffFunctions(_0x43845e,_0x1ae596(0x1b1))),_0x403d9f):undefined,_0x215af4=createPullFileTransaction(),_0x441f71=[],_0x241b4f=[],_0x34d4d1=[],_0x27fc1d=[];for(const _0x39481a of _0x21a2db){const _0x4039e9=resolveRemoteScriptTarget(_0x43845e,_0x39481a,_0x3c0d79,_0x403d9f['functions'],_0x34e870);if(!_0x4039e9){_0x241b4f[_0x1ae596(0x23f)]({'lockKey':_0x39481a['scriptType']+'/'+_0x39481a[_0x1ae596(0x1ad)],'reason':_0x1ae596(0x22a)});continue;}const _0x57be6f=_0x403d9f[_0x1ae596(0x1fc)][_0x4039e9['lockKey']];try{if(!_0x39481a['id'])throw new Error(_0x1ae596(0x1a8));if(_0x39481a[_0x1ae596(0x223)]==null)throw new Error(_0x1ae596(0x1f6));const _0x1a7e3d=_0x39481a['scriptContent'],_0x1c6631=computeContentHash(_0x1a7e3d);if(!_0x44cca3){const _0x57cfbe=await hasUnsyncedLocalChanges(_0x4039e9['filePath'],_0x57be6f,_0x1c6631);if(_0x57cfbe){_0x34d4d1['push'](localUnsyncedConflict(_0x4039e9,_0x39481a['id']));continue;}}await _0x215af4['write'](_0x4039e9[_0x1ae596(0x233)],_0x1a7e3d);const _0xd165bf={'hash':_0x1c6631,'remoteId':_0x39481a['id'],'version':_0x39481a['version']};_0x4039e9[_0x1ae596(0x1ff)]===_0x1ae596(0x1b1)&&_0x4039e9[_0x1ae596(0x1d2)]&&(_0xd165bf['alias']=_0x4039e9[_0x1ae596(0x1d2)][_0x1ae596(0x215)],_0xd165bf[_0x1ae596(0x202)]=_0x4039e9[_0x1ae596(0x1d2)]['datasetCode'],_0xd165bf[_0x1ae596(0x1c2)]=_0x4039e9[_0x1ae596(0x1d2)][_0x1ae596(0x1c2)],_0xd165bf[_0x1ae596(0x20a)]=_0x4039e9[_0x1ae596(0x1d2)][_0x1ae596(0x20a)]),_0x403d9f[_0x1ae596(0x1fc)][_0x4039e9['lockKey']]=_0xd165bf,_0x441f71[_0x1ae596(0x23f)]({'lockKey':_0x4039e9['lockKey'],'remoteId':_0x39481a['id']});}catch(_0xfc00e3){_0x27fc1d[_0x1ae596(0x23f)]({'lockKey':_0x4039e9[_0x1ae596(0x1b2)],'error':_0xfc00e3 instanceof Error?_0xfc00e3['message']:String(_0xfc00e3)});}}_0x403d9f['lastSync']=new Date()[_0x1ae596(0x1b3)]();try{await writeBffLockFile(_0x43845e['lockFilePath'],_0x130410);}catch(_0xcfcc8c){const _0x7cd6ee=[...await _0x215af4['rollback'](),...await _0x39df2a?.['rollback']()??[]];throw withRollbackErrors(_0xcfcc8c,_0x1ae596(0x1e0),_0x7cd6ee);}return{'ok':_0x27fc1d[_0x1ae596(0x1da)]===0x0,'data':{'pulled':_0x441f71,'skipped':_0x241b4f,'conflicts':_0x34d4d1,'failed':_0x27fc1d},'message':formatPullMessage(_0x441f71[_0x1ae596(0x1da)],_0x241b4f[_0x1ae596(0x1da)],_0x34d4d1['length'],_0x27fc1d[_0x1ae596(0x1da)])};}};function localUnsyncedConflict(_0x3381cd,_0x3fab70){const _0x13cbed=a43_0x204254,_0x59916d=_0x3381cd[_0x13cbed(0x1b2)][_0x13cbed(0x1e4)]('/')['at'](-0x1);return{'code':_0x13cbed(0x1ba),'lockKey':_0x3381cd[_0x13cbed(0x1b2)],'filePath':_0x3381cd[_0x13cbed(0x233)],..._0x3fab70!=null?{'remoteId':_0x3fab70}:{},'message':_0x13cbed(0x235),'nextAction':{'action':_0x13cbed(0x218),'command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x3381cd[_0x13cbed(0x1ff)]+_0x13cbed(0x201)+_0x59916d+_0x13cbed(0x1fd),'requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function formatPullMessage(_0x562f98,_0x33ba70,_0x36a78c,_0x21c850){const _0x278d16=a43_0x204254,_0x225c56=[_0x278d16(0x1dc)+_0x562f98+_0x278d16(0x23c),_0x33ba70+_0x278d16(0x220)];_0x36a78c>0x0&&_0x225c56[_0x278d16(0x23f)](_0x36a78c+_0x278d16(0x231)+(_0x36a78c===0x1?'':'s')+'\x20'+(_0x36a78c===0x1?_0x278d16(0x1ce):_0x278d16(0x1fe))+_0x278d16(0x1c0));if(_0x21c850>0x0)_0x225c56['push'](_0x21c850+_0x278d16(0x1be));return _0x225c56[_0x278d16(0x207)](',\x20');}async function hasUnsyncedLocalChanges(_0x5b8de6,_0x11d5a3,_0x1089c0){if(!await fileExists(_0x5b8de6))return![];const _0x1e6ba3=await computeFileHash(_0x5b8de6);if(!_0x11d5a3)return _0x1089c0?_0x1e6ba3!==_0x1089c0:!![];return _0x1e6ba3!==_0x11d5a3['hash'];}function createPullFileTransaction(){const _0x2ce6ee=new Map(),_0x3c1206=async(_0x6bd4f4,_0x4ebc52)=>{const _0x3cbb1d=a43_0x4228;try{if(_0x4ebc52[_0x3cbb1d(0x222)])await ensureParentDirectory(_0x6bd4f4),await writeFile(_0x6bd4f4,_0x4ebc52['content']);else try{await unlink(_0x6bd4f4);}catch(_0x1d108c){if(_0x1d108c[_0x3cbb1d(0x1d5)]!==_0x3cbb1d(0x1b4))throw _0x1d108c;}return undefined;}catch(_0x93de0a){return _0x93de0a instanceof Error?_0x93de0a:new Error(String(_0x93de0a));}};return{async 'write'(_0x5b43e8,_0x464c0d){const _0x325067=a43_0x4228;if(!_0x2ce6ee['has'](_0x5b43e8))try{_0x2ce6ee[_0x325067(0x1e7)](_0x5b43e8,{'existed':!![],'content':await readFile(_0x5b43e8)});}catch(_0x16f220){if(_0x16f220[_0x325067(0x1d5)]!==_0x325067(0x1b4))throw _0x16f220;_0x2ce6ee[_0x325067(0x1e7)](_0x5b43e8,{'existed':![]});}try{await ensureParentDirectory(_0x5b43e8),await writeFile(_0x5b43e8,_0x464c0d,_0x325067(0x210));}catch(_0x33154e){const _0xd307c0=await _0x3c1206(_0x5b43e8,_0x2ce6ee['get'](_0x5b43e8));if(!_0xd307c0)_0x2ce6ee[_0x325067(0x1e9)](_0x5b43e8);throw withRollbackErrors(_0x33154e,_0x325067(0x23d)+_0x5b43e8+'\x22.',_0xd307c0?[_0xd307c0]:[]);}},async 'rollback'(){const _0x1ee80f=a43_0x4228,_0x31dfe6=[];for(const [_0x61ba94,_0x82abac]of[..._0x2ce6ee[_0x1ee80f(0x226)]()][_0x1ee80f(0x1af)]()){const _0x4e288c=await _0x3c1206(_0x61ba94,_0x82abac);_0x4e288c&&_0x31dfe6['push'](new Error(_0x1ee80f(0x1ee)+_0x61ba94+'\x22:\x20'+_0x4e288c['message']));}return _0x31dfe6;}};}function withRollbackErrors(_0x12c47a,_0x16d844,_0x74a8e9){const _0x3a9208=a43_0x204254,_0x183c26=_0x12c47a instanceof Error?_0x12c47a:new Error(String(_0x12c47a));if(_0x74a8e9['length']===0x0)return _0x183c26;return new AggregateError([_0x183c26,..._0x74a8e9],_0x16d844+_0x3a9208(0x22b)+_0x74a8e9[_0x3a9208(0x1f2)](_0x28d4cd=>_0x28d4cd['message'])[_0x3a9208(0x207)](';\x20'));}function buildDatasetCodeToAliasMap(_0x167aed,_0x1100be,_0x4c505f){const _0x573b5f=a43_0x204254,_0x524acd=resolveApiModelSource(_0x167aed,_0x1100be,_0x4c505f),_0x299baf=loadAliasMap(_0x167aed,undefined,_0x524acd[_0x573b5f(0x233)],_0x524acd['profileName']);return assertUnambiguousHookAliases(_0x299baf),new Map(_0x299baf[_0x573b5f(0x1f2)](_0x22f57c=>[_0x22f57c['datasetCode'][_0x573b5f(0x1bb)](),_0x22f57c['alias']]));}async function planHookDirectoryMigration(_0x3c77d2,_0x1b4af2,_0xc9ec9e,_0x59c2ba){const _0x1e4252=a43_0x204254,_0x20d739=new Map();for(const [_0x1184c6,_0x25bbdc]of Object[_0x1e4252(0x226)](_0x1b4af2[_0x1e4252(0x1fc)])){const [_0x42be63,_0x409875,_0x226c17,_0x45b237,_0xfbf882,..._0x47c78e]=_0x1184c6[_0x1e4252(0x1e4)]('/');if(_0x42be63!=='HOOK'||!_0x409875||!_0x226c17||!_0x45b237||!_0xfbf882||_0x47c78e[_0x1e4252(0x1da)]>0x0||!_0x25bbdc[_0x1e4252(0x202)])continue;const _0x1dc81b=_0xc9ec9e[_0x1e4252(0x21f)](_0x25bbdc[_0x1e4252(0x202)]['toLowerCase']()),_0xd82668=_0x1dc81b??_0x25bbdc[_0x1e4252(0x202)];if(!isSafeHookDirectorySegment(_0x409875))throw CliErrors[_0x1e4252(0x1e3)](_0x1e4252(0x1d7)+_0x409875+_0x1e4252(0x1d1));if(!isSafeHookDirectorySegment(_0xd82668))throw CliErrors[_0x1e4252(0x1e3)](_0x1e4252(0x217)+_0x409875+_0x1e4252(0x1ec));if(_0x409875===_0xd82668)continue;const _0x473fad=_0x20d739[_0x1e4252(0x21f)](_0x409875)??{'datasetCode':_0x25bbdc[_0x1e4252(0x202)],'alias':_0x1dc81b,'keyChanges':[]};if(_0x473fad['datasetCode']!==_0x25bbdc[_0x1e4252(0x202)])throw CliErrors['validation'](_0x1e4252(0x217)+_0x409875+'\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.');const _0x345a11=_0x1e4252(0x1bf)+_0xd82668+'/'+_0x226c17+'/'+_0x45b237+'/'+_0xfbf882;try{resolveLocalFilePathFromLockKey(_0x3c77d2,_0x1184c6),resolveLocalFilePathFromLockKey(_0x3c77d2,_0x345a11);}catch(_0x293008){throw CliErrors[_0x1e4252(0x1e3)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x1184c6+_0x1e4252(0x1ea)+(_0x293008 instanceof Error?_0x293008['message']:String(_0x293008)));}_0x473fad[_0x1e4252(0x1a7)]['push']({'oldLockKey':_0x1184c6,'newLockKey':_0x345a11,'entry':_0x25bbdc}),_0x20d739[_0x1e4252(0x1e7)](_0x409875,_0x473fad);}const _0xbd08d1=new Set([..._0x20d739['values']()][_0x1e4252(0x1ed)](_0x12ac85=>_0x12ac85[_0x1e4252(0x1a7)][_0x1e4252(0x1f2)](_0xe07a0b=>_0xe07a0b[_0x1e4252(0x1f9)]))),_0xbb00ba=new Map(),_0x3a689d=new Map();for(const [_0xed7981,_0x30d270]of _0x20d739){const _0x3f1df8=_0x30d270[_0x1e4252(0x215)]??_0x30d270[_0x1e4252(0x202)],_0x2631bb=hookDirectoryIdentity(_0x3f1df8),_0x509fa2=_0xbb00ba[_0x1e4252(0x21f)](_0x2631bb);if(_0x509fa2&&_0x509fa2!==_0xed7981)throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x509fa2+_0x1e4252(0x1ae)+_0xed7981+_0x1e4252(0x1b7)+_0x3f1df8+_0x1e4252(0x20c));_0xbb00ba[_0x1e4252(0x1e7)](_0x2631bb,_0xed7981);for(const _0x32402d of _0x30d270[_0x1e4252(0x1a7)]){const _0x311c66=_0x3a689d[_0x1e4252(0x21f)](_0x32402d['newLockKey']);if(_0x311c66&&_0x311c66!==_0x32402d[_0x1e4252(0x1f9)])throw CliErrors[_0x1e4252(0x1e3)](_0x1e4252(0x20d)+_0x311c66+_0x1e4252(0x1ae)+_0x32402d[_0x1e4252(0x1f9)]+_0x1e4252(0x1b7)+_0x32402d[_0x1e4252(0x1f0)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0xbd08d1[_0x1e4252(0x1b9)](_0x32402d[_0x1e4252(0x1f0)]))throw CliErrors[_0x1e4252(0x1e3)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x32402d[_0x1e4252(0x1f9)]+_0x1e4252(0x228)+_0x32402d[_0x1e4252(0x1f0)]+_0x1e4252(0x236));_0x3a689d[_0x1e4252(0x1e7)](_0x32402d['newLockKey'],_0x32402d[_0x1e4252(0x1f9)]);}}const _0x53ddb0=new Map();for(const [_0x5389e2,_0xed6fed]of _0xc9ec9e){_0x53ddb0[_0x1e4252(0x1e7)](hookDirectoryIdentity(_0xed6fed),_0x5389e2);}const _0x5ddc7a=[];for(const [_0x112c6e,_0x2f2533]of _0x20d739){const _0x30152e=_0x2f2533[_0x1e4252(0x215)]??_0x2f2533[_0x1e4252(0x202)],_0x1843cf=join(_0x3c77d2[_0x1e4252(0x1cc)],_0x1e4252(0x1b1),_0x112c6e),_0x5bcfaa=join(_0x3c77d2['scriptsRootDir'],_0x1e4252(0x1b1),_0x30152e),_0x3593c1=await directoryExists(_0x1843cf),_0x37af35=await directoryExists(_0x5bcfaa),_0x26937b=_0x3593c1?_0x37af35?await sameDirectory(_0x1843cf,_0x5bcfaa)?_0x1e4252(0x21c):undefined:'move':_0x1e4252(0x230);if(!_0x26937b)throw CliErrors['validation'](_0x1e4252(0x217)+_0x112c6e+'\x22\x20to\x20\x22'+_0x30152e+_0x1e4252(0x1c3));const _0x1d8e83=_0x53ddb0[_0x1e4252(0x21f)](hookDirectoryIdentity(_0x112c6e));if(_0x1d8e83&&_0x1d8e83!==_0x2f2533[_0x1e4252(0x202)]['toLowerCase']()){const _0x3ae6d5=new Set(_0x2f2533[_0x1e4252(0x1a7)][_0x1e4252(0x1f2)](_0x341320=>_0x341320[_0x1e4252(0x1f9)])),_0x39d3f7=_0x59c2ba[_0x1e4252(0x214)](_0x5b9ec9=>_0x5b9ec9[_0x1e4252(0x1ff)]==='HOOK'&&_0x5b9ec9[_0x1e4252(0x215)]!=null&&hookDirectoryIdentity(_0x5b9ec9[_0x1e4252(0x215)])===hookDirectoryIdentity(_0x112c6e)&&!_0x3ae6d5[_0x1e4252(0x1b9)](_0x5b9ec9['lockKey']));if(_0x39d3f7['length']>0x0)throw CliErrors['validation'](_0x1e4252(0x217)+_0x112c6e+_0x1e4252(0x23e));}const _0x22d4cb=_0x53ddb0['get'](hookDirectoryIdentity(_0x30152e));if(_0x22d4cb&&_0x22d4cb!==_0x2f2533[_0x1e4252(0x202)][_0x1e4252(0x1bb)]())throw CliErrors[_0x1e4252(0x1e3)](_0x1e4252(0x217)+_0x112c6e+_0x1e4252(0x20b)+_0x30152e+_0x1e4252(0x1b0));for(const _0x460358 of _0x2f2533[_0x1e4252(0x1a7)]){const _0x4b4832=_0x1b4af2[_0x1e4252(0x1fc)][_0x460358[_0x1e4252(0x1f0)]];if(_0x4b4832&&!_0xbd08d1[_0x1e4252(0x1b9)](_0x460358['newLockKey'])&&!sameHookIdentity(_0x460358['entry'],_0x4b4832))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x112c6e+_0x1e4252(0x20b)+_0x30152e+_0x1e4252(0x1cf));}_0x5ddc7a[_0x1e4252(0x23f)]({'oldDirectory':_0x112c6e,'newDirectory':_0x30152e,'oldDirectoryPath':_0x1843cf,'newDirectoryPath':_0x5bcfaa,'mode':_0x26937b,'alias':_0x2f2533[_0x1e4252(0x215)],'keyChanges':_0x2f2533['keyChanges']});}const _0x1b0125={..._0x1b4af2[_0x1e4252(0x1fc)]},_0x875958=new Map(),_0x1d43e4=new Map();for(const _0xe73612 of _0x5ddc7a){const _0x4c6437=_0xe73612['mode']!==_0x1e4252(0x230);_0x4c6437&&_0x1d43e4[_0x1e4252(0x1e7)](hookDirectoryIdentity(_0xe73612[_0x1e4252(0x1d9)]),_0xe73612['oldDirectoryPath']);for(const _0xc6e0d of _0xe73612['keyChanges']){const _0x4e00d8=_0x1b0125[_0xc6e0d['newLockKey']],_0x7d1bae=_0x4c6437?_0xc6e0d['entry']:_0x4e00d8??_0xc6e0d[_0x1e4252(0x205)];_0x1b0125[_0xc6e0d[_0x1e4252(0x1f0)]]=canonicalizeHookEntry(_0x7d1bae,_0xe73612['alias']),delete _0x1b0125[_0xc6e0d['oldLockKey']],_0x4c6437&&_0x875958[_0x1e4252(0x1e7)](_0xc6e0d[_0x1e4252(0x1f0)],resolveLocalFilePathFromLockKey(_0x3c77d2,_0xc6e0d[_0x1e4252(0x1f9)]));}}return{'migrations':_0x5ddc7a,'projectedFunctions':_0x1b0125,'sourceFilePathByNewLockKey':_0x875958,'sourceDirectoryPathByNewDirectory':_0x1d43e4};}function resolveMigratedSourceFilePath(_0x22ed23,_0x10419d){const _0x442b08=a43_0x204254;if(!_0x22ed23||!_0x10419d)return undefined;const _0x54aba7=_0x22ed23[_0x442b08(0x22d)]['get'](_0x10419d['lockKey']);if(_0x54aba7)return _0x54aba7;if(_0x10419d[_0x442b08(0x1ff)]!=='HOOK')return undefined;const [,_0x20bc03,..._0x1d1934]=_0x10419d[_0x442b08(0x1b2)]['split']('/');if(!_0x20bc03||_0x1d1934['length']===0x0)return undefined;const _0x3de8c6=_0x22ed23[_0x442b08(0x212)][_0x442b08(0x21f)](hookDirectoryIdentity(_0x20bc03));return _0x3de8c6?join(_0x3de8c6,..._0x1d1934)+'.js':undefined;}function sameHookIdentity(_0xab0c85,_0x2877a6){const _0x3f5923=a43_0x204254;return _0xab0c85['remoteId']===_0x2877a6['remoteId']&&_0xab0c85['datasetCode']===_0x2877a6[_0x3f5923(0x202)]&&_0xab0c85[_0x3f5923(0x1c2)]===_0x2877a6[_0x3f5923(0x1c2)]&&_0xab0c85[_0x3f5923(0x20a)]===_0x2877a6[_0x3f5923(0x20a)];}function canonicalizeHookEntry(_0x4cc035,_0x3318b6){const {alias:_0xa2d03b,..._0x4c4143}=_0x4cc035;return _0x3318b6?{..._0x4c4143,'alias':_0x3318b6}:_0x4c4143;}function hookDirectoryIdentity(_0x281d4a){const _0x1bfa52=a43_0x204254;return _0x281d4a[_0x1bfa52(0x232)]('NFC')[_0x1bfa52(0x1bb)]();}function a43_0x3caa(){const _0x15836e=['HOOK','lockKey','toISOString','ENOENT','scriptsRoot','migrations','\x22:\x20both\x20target\x20\x22','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','has','BFF_LOCAL_UNSYNCED','toLowerCase','selectedAppName','includes','\x20failed','HOOK/','\x20resolution','str','operationType','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','.hook-directory-migrate-','stdin','ENDPOINT','bff','278304tbLLYJ','GET','nonInteractive','lockFilePath','scriptsRootDir','move','requires','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x22\x20may\x20remain.','\x22\x20from\x20the\x20lock\x20file.','hookLocation','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','oldDirectoryPath','code','scriptType','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','121AFApOQ','newDirectory','length','skipped','Pull\x20complete:\x20','projectedFunctions','question','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','pull','message','validation','split','mergedCli','newDirectoryPath','set','apiDir','delete','\x22:\x20','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','flatMap','Could\x20not\x20restore\x20local\x20script\x20\x22','2061KWzzAZ','newLockKey','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','map','yes','Pull\x20only\x20this\x20script\x20type','Force\x20pull\x20cancelled.','Remote\x20script\x20missing\x20content.','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','ino','oldLockKey','string','10312xdxdmz','functions','\x20--format\x20compress','require','type','appCode','\x20--name\x20','datasetCode','dev','509390gwrPau','entry','¤tPage=1&pageSize=','join','Lock\x20scope\x20for\x20app\x20\x22','Force\x20overwrite\x20local\x20unsynced\x20changes','functionNode','\x22\x20to\x20\x22','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','Would\x20inspect\x20','defaultApp','utf8','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','sourceDirectoryPathByNewDirectory','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','filter','alias','105VLZvIc','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','push_local','apps','COMMON','5lwHPDJ','case-rename','oldDirectory','208046WuImxl','get','\x20skipped','149808erkwps','existed','scriptContent','parse','currentApp','entries','830089TYRNCh','\x22:\x20its\x20target\x20\x22','mode','unresolvable\x20target\x20path','\x20Recovery\x20errors:\x20','\x22;\x20temporary\x20directory\x20\x22','sourceFilePathByNewLockKey','conflict','432OczkKF','rekey','\x20conflict','normalize','filePath','close','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','stringify','force','210536SWukwg','boolean','some','\x20pulled','Failed\x20to\x20write\x20local\x20script\x20\x22','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','push','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','keyChanges','Remote\x20script\x20missing\x20id.','would_pull','\x22\x20from\x20\x22','bool','24qFLTRd','functionName','\x22\x20and\x20\x22','reverse','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.'];a43_0x3caa=function(){return _0x15836e;};return a43_0x3caa();}function isSafeHookDirectorySegment(_0x1a285){return isSafeLockKeySegment(_0x1a285);}async function sameDirectory(_0x3044bc,_0x234572){const _0x472244=a43_0x204254,[_0x4fcea3,_0x4842aa]=await Promise['all']([stat(_0x3044bc),stat(_0x234572)]);return _0x4fcea3[_0x472244(0x203)]===_0x4842aa['dev']&&_0x4fcea3[_0x472244(0x1f8)]===_0x4842aa[_0x472244(0x1f8)];}async function applyHookDirectoryMigration(_0x540d7c,_0x9ade8a){const _0x3a47bb=a43_0x204254,_0x461a8d=_0x9ade8a[_0x3a47bb(0x1fc)],_0xc5a23=_0x9ade8a['lastSync'],_0x3208ad=[],_0x9a2601=async()=>{const _0x4b6b84=_0x3a47bb,_0x136e1e=[];_0x9ade8a[_0x4b6b84(0x1fc)]=_0x461a8d,_0x9ade8a['lastSync']=_0xc5a23;for(const {migration:_0xfae653,temporaryPath:_0x4a7922}of[..._0x3208ad][_0x4b6b84(0x1af)]()){try{_0x4a7922?(await rename(_0xfae653[_0x4b6b84(0x1e6)],_0x4a7922),await rename(_0x4a7922,_0xfae653[_0x4b6b84(0x1d4)])):await rename(_0xfae653[_0x4b6b84(0x1e6)],_0xfae653['oldDirectoryPath']);}catch(_0x3f855d){_0x136e1e[_0x4b6b84(0x23f)](new Error(_0x4b6b84(0x1eb)+_0xfae653['oldDirectory']+_0x4b6b84(0x1aa)+_0xfae653[_0x4b6b84(0x1d9)]+_0x4b6b84(0x1ea)+(_0x3f855d instanceof Error?_0x3f855d['message']:String(_0x3f855d))));}}return _0x136e1e;};try{for(const _0xa764a1 of _0x540d7c[_0x3a47bb(0x1b6)]){if(_0xa764a1[_0x3a47bb(0x229)]===_0x3a47bb(0x1cd))await ensureParentDirectory(_0xa764a1[_0x3a47bb(0x1e6)]),await rename(_0xa764a1['oldDirectoryPath'],_0xa764a1[_0x3a47bb(0x1e6)]),_0x3208ad[_0x3a47bb(0x23f)]({'migration':_0xa764a1});else{if(_0xa764a1[_0x3a47bb(0x229)]===_0x3a47bb(0x21c)){const _0x430c8a=join(dirname(_0xa764a1[_0x3a47bb(0x1d4)]),_0x3a47bb(0x1c4)+randomUUID());await rename(_0xa764a1[_0x3a47bb(0x1d4)],_0x430c8a);try{await rename(_0x430c8a,_0xa764a1['newDirectoryPath']);}catch(_0x151423){try{await rename(_0x430c8a,_0xa764a1[_0x3a47bb(0x1d4)]);}catch(_0x56099d){throw withRollbackErrors(_0x151423,_0x3a47bb(0x1d3)+_0xa764a1[_0x3a47bb(0x21d)]+_0x3a47bb(0x20b)+_0xa764a1[_0x3a47bb(0x1d9)]+_0x3a47bb(0x22c)+_0x430c8a+_0x3a47bb(0x1d0),[new Error(_0x3a47bb(0x1df)+_0x430c8a+'\x22\x20to\x20\x22'+_0xa764a1['oldDirectory']+_0x3a47bb(0x1ea)+(_0x56099d instanceof Error?_0x56099d[_0x3a47bb(0x1e2)]:String(_0x56099d)))]);}throw _0x151423;}_0x3208ad[_0x3a47bb(0x23f)]({'migration':_0xa764a1,'temporaryPath':_0x430c8a});}}}return _0x9ade8a['functions']=_0x540d7c[_0x3a47bb(0x1dd)],{'rollback':_0x9a2601};}catch(_0x3a4ca5){const _0x1ea531=await _0x9a2601();throw withRollbackErrors(_0x3a4ca5,_0x3a47bb(0x1b8),_0x1ea531);}}async function confirmForce(){const _0xddebe8=a43_0x204254,_0x31a321=createInterface({'input':process[_0xddebe8(0x1c5)],'output':process['stderr']}),_0x4f7a7c=await new Promise(_0xd5a641=>{const _0x43c1a0=_0xddebe8;_0x31a321[_0x43c1a0(0x1de)](_0x43c1a0(0x213),_0xd5a641);});return _0x31a321[_0xddebe8(0x234)](),['y',_0xddebe8(0x1f3)][_0xddebe8(0x1bd)](_0x4f7a7c['trim']()[_0xddebe8(0x1bb)]());}
|
|
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']());}
|