@lovrabet/rabetbase-cli 2.5.11-beta.1 → 2.5.11
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/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.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.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/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a34_0x13ff4a=a34_0x4954;function a34_0x5111(){const _0x219643=['apiError','write','file','update','get','POST','\x20app\x20config\x20','296780evQZUp','38FyQMMh','string','/smartapi/app-config/create','2624256EgrAtP','79569WLIwOU','81HumbqE','number','10913WKBeac','Read\x20config\x20value\x20from\x20file',',\x20appCode=','Updated','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','create','1650330yGiOHv','App\x20config\x20server\x20id\x20missing\x20for\x20key=','454392hbkYnv','/smartapi/app-config/update','2282838HtCEIn','isFinite','6DHQUqj','appCode','tags'];a34_0x5111=function(){return _0x219643;};return a34_0x5111();}(function(_0x337f67,_0x33f8d0){const _0x5f1dd8=a34_0x4954,_0x18904a=_0x337f67();while(!![]){try{const _0x2ee793=-parseInt(_0x5f1dd8(0xf0))/0x1*(parseInt(_0x5f1dd8(0xe9))/0x2)+parseInt(_0x5f1dd8(0xfa))/0x3+parseInt(_0x5f1dd8(0xec))/0x4+-parseInt(_0x5f1dd8(0xe8))/0x5+parseInt(_0x5f1dd8(0xde))/0x6*(-parseInt(_0x5f1dd8(0xed))/0x7)+-parseInt(_0x5f1dd8(0xf8))/0x8*(parseInt(_0x5f1dd8(0xee))/0x9)+-parseInt(_0x5f1dd8(0xf6))/0xa;if(_0x2ee793===_0x33f8d0)break;else _0x18904a['push'](_0x18904a['shift']());}catch(_0x4a0aed){_0x18904a['push'](_0x18904a['shift']());}}}(a34_0x5111,0x70f7c));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a34_0x4954(_0x1ae793,_0x765628){_0x1ae793=_0x1ae793-0xde;const _0x511150=a34_0x5111();let _0x495461=_0x511150[_0x1ae793];return _0x495461;}const CREATE_PATH=a34_0x13ff4a(0xeb),UPDATE_PATH=a34_0x13ff4a(0xf9);export const appConfigSet={'service':'app-config','command':'set','description':a34_0x13ff4a(0xf4),'risk':a34_0x13ff4a(0xe2),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x13ff4a(0xe3),'type':a34_0x13ff4a(0xea),'description':a34_0x13ff4a(0xf1)}],async 'validate'(_0x519e01){readKeyArg(_0x519e01),readOptionalTags(_0x519e01),assertSingleValueSource(_0x519e01);},async 'dryRun'(_0x4bad75){const _0x2f2ff4=a34_0x13ff4a,_0x5cc371=readKeyArg(_0x4bad75),_0x24dfdd=readOptionalTags(_0x4bad75),_0x8b978a=assertSingleValueSource(_0x4bad75);await assertValueSourceReadable(_0x8b978a);const _0x109024=await withAppConfigApiBoundary(_0x2f2ff4(0xe5),{'appCode':_0x4bad75[_0x2f2ff4(0xdf)],'key':_0x5cc371},()=>getAppConfigByKey(_0x4bad75[_0x2f2ff4(0xdf)],_0x5cc371)),_0x455608=_0x109024?'update':_0x2f2ff4(0xf5),_0x190387=_0x109024?projectAppConfig(_0x109024):null,_0x1fe707=plannedAppConfig({'appCode':_0x4bad75['appCode'],'key':_0x5cc371,'tags':_0x24dfdd??_0x109024?.[_0x2f2ff4(0xe0)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x455608,'appCode':_0x4bad75[_0x2f2ff4(0xdf)],'key':_0x5cc371,'before':_0x190387,'after':_0x1fe707,'dryRun':!![]}),{'method':_0x2f2ff4(0xe6),'url':_0x455608===_0x2f2ff4(0xe4)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x439d1e){const _0x57e3b6=a34_0x13ff4a,_0x3ca3b3=readKeyArg(_0x439d1e),_0x9037c2=readOptionalTags(_0x439d1e),_0x2bb2da=await withAppConfigApiBoundary(_0x57e3b6(0xe5),{'appCode':_0x439d1e[_0x57e3b6(0xdf)],'key':_0x3ca3b3},()=>getAppConfigByKey(_0x439d1e[_0x57e3b6(0xdf)],_0x3ca3b3)),_0x348e51=_0x2bb2da?projectAppConfig(_0x2bb2da):null,_0x269df0=_0x2bb2da?_0x57e3b6(0xe4):_0x57e3b6(0xf5),{value:_0x5219ed,warnings:_0x2681b0}=await readAppConfigValue(_0x439d1e),_0x40cde2={'appCode':_0x439d1e[_0x57e3b6(0xdf)],'key':_0x3ca3b3,'value':_0x5219ed,'tags':_0x9037c2??_0x2bb2da?.['tags']??undefined};await withAppConfigApiBoundary(_0x269df0,{'appCode':_0x439d1e[_0x57e3b6(0xdf)],'key':_0x3ca3b3},async()=>{const _0x209ddd=_0x57e3b6;_0x2bb2da?await updateAppConfig({..._0x40cde2,'id':requireAppConfigId(_0x2bb2da,_0x3ca3b3,_0x439d1e[_0x209ddd(0xdf)])}):await createAppConfig(_0x40cde2);});const _0x2f7d15=await withAppConfigApiBoundary(_0x57e3b6(0xe5),{'appCode':_0x439d1e[_0x57e3b6(0xdf)],'key':_0x3ca3b3},()=>getAppConfigByKey(_0x439d1e['appCode'],_0x3ca3b3)),_0x569b48=_0x2f7d15?projectAppConfig(_0x2f7d15):plannedAppConfig({'appCode':_0x439d1e['appCode'],'key':_0x3ca3b3,'tags':_0x40cde2[_0x57e3b6(0xe0)],'hasValue':_0x5219ed!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x269df0,'appCode':_0x439d1e[_0x57e3b6(0xdf)],'key':_0x3ca3b3,'before':_0x348e51,'after':_0x569b48,'dryRun':![],'warnings':_0x2681b0}),'message':(_0x269df0===_0x57e3b6(0xe4)?_0x57e3b6(0xf3):'Created')+_0x57e3b6(0xe7)+_0x3ca3b3};}};function requireAppConfigId(_0x972b45,_0x17de36,_0x40f058){const _0x150688=a34_0x13ff4a;if(typeof _0x972b45['id']===_0x150688(0xef)&&Number[_0x150688(0xfb)](_0x972b45['id'])&&_0x972b45['id']>0x0)return _0x972b45['id'];throw CliErrors[_0x150688(0xe1)](_0x150688(0xf7)+_0x17de36+_0x150688(0xf2)+_0x40f058);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x34ea46=a35_0x3d2e;(function(_0x149c83,_0x24b386){const _0x23cb7d=a35_0x3d2e,_0x2ab16a=_0x149c83();while(!![]){try{const _0x220b06=parseInt(_0x23cb7d(0x16a))/0x1+parseInt(_0x23cb7d(0x163))/0x2+parseInt(_0x23cb7d(0x183))/0x3+parseInt(_0x23cb7d(0x198))/0x4*(-parseInt(_0x23cb7d(0x199))/0x5)+parseInt(_0x23cb7d(0x164))/0x6+-parseInt(_0x23cb7d(0x19d))/0x7*(parseInt(_0x23cb7d(0x18d))/0x8)+-parseInt(_0x23cb7d(0x176))/0x9*(-parseInt(_0x23cb7d(0x189))/0xa);if(_0x220b06===_0x24b386)break;else _0x2ab16a['push'](_0x2ab16a['shift']());}catch(_0x5e2861){_0x2ab16a['push'](_0x2ab16a['shift']());}}}(a35_0x2e44,0x4600c));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a35_0x34ea46(0x19c),'required':!![]};export const VALUE_ARG={'name':'value','description':a35_0x34ea46(0x192),'required':![]};export const TAGS_FLAG={'name':a35_0x34ea46(0x18f),'type':a35_0x34ea46(0x16e),'description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':a35_0x34ea46(0x172),'type':a35_0x34ea46(0x19f),'description':a35_0x34ea46(0x18b),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x34ea46(0x16c),'type':'string','description':a35_0x34ea46(0x1a2)};export const REVEAL_FLAG={'name':'reveal','type':'boolean','description':a35_0x34ea46(0x195),'default':![]};export function readKeyArg(_0x2ad705){const _0x9705de=a35_0x34ea46,_0x5e1c39=_0x2ad705[_0x9705de(0x18a)][0x0]?.[_0x9705de(0x17f)]()??'';return validateKey(_0x5e1c39),_0x5e1c39;}export function readOptionalTags(_0x27ee5b){const _0x5504bc=a35_0x34ea46,_0x3b5afe=_0x27ee5b[_0x5504bc(0x17a)](_0x5504bc(0x18f))[_0x5504bc(0x17f)]();if(!_0x3b5afe)return undefined;if(_0x3b5afe[_0x5504bc(0x19a)]>0x20)throw CliErrors['validation'](_0x5504bc(0x17c));return _0x3b5afe;}export function validateKey(_0xd91a0){const _0x13e5c2=a35_0x34ea46;if(!_0xd91a0)throw CliErrors[_0x13e5c2(0x16f)](_0x13e5c2(0x175));if(_0xd91a0[_0x13e5c2(0x19a)]>0x100)throw CliErrors[_0x13e5c2(0x16f)](_0x13e5c2(0x180));}export function projectAppConfig(_0x2117b7,_0x59f0aa){const _0x88b3d0=a35_0x34ea46,_0x1949e8=_0x2117b7['value']!==undefined&&_0x2117b7[_0x88b3d0(0x170)]!==null&&_0x2117b7[_0x88b3d0(0x170)]!=='',_0x2fa749={'appCode':_0x2117b7['appCode'],'key':_0x2117b7[_0x88b3d0(0x185)],'tags':_0x2117b7[_0x88b3d0(0x18f)]??undefined,'hasValue':_0x1949e8,'valueRedacted':_0x1949e8&&!_0x59f0aa?.[_0x88b3d0(0x171)],'gmtCreate':_0x2117b7[_0x88b3d0(0x182)],'gmtModified':_0x2117b7[_0x88b3d0(0x173)]};return _0x59f0aa?.[_0x88b3d0(0x171)]&&(_0x2fa749[_0x88b3d0(0x170)]=_0x2117b7['value']??'',_0x2fa749[_0x88b3d0(0x16b)]=![]),_0x2fa749;}function a35_0x2e44(){const _0x1acbc4=['name','slice','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','once','file','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','path','dryRun','1944552khWNkU','5oeQPVM','length','error','Runtime\x20app-config\x20key','2218006doKvmL','hasValue','boolean','end','Failed\x20to\x20','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','985494eeqfHl','1364712lOAOwX','appCode:\x20','appCode','operation','flag','join','179525mUDQDH','valueRedacted','from-env','kind','string','validation','value','reveal','stdin','gmtModified','push','Missing\x20app-config\x20key.','18owVXUR','env','apiError','before','str','data','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','utf8','argument','trim','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','Missing\x20app-config\x20value\x20source.','gmtCreate','96624jOwKoV','key:\x20','key','\x20app\x20config.','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','method','788980ayChNJ','args','Read\x20config\x20value\x20from\x20stdin','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','8nNUjTo','defineProperties','tags'];a35_0x2e44=function(){return _0x1acbc4;};return a35_0x2e44();}export function plannedAppConfig(_0x2dc4e1){const _0x10c178=a35_0x34ea46,_0x271431=_0x2dc4e1[_0x10c178(0x19e)]??!![];return{'appCode':_0x2dc4e1[_0x10c178(0x166)],'key':_0x2dc4e1[_0x10c178(0x185)],'tags':_0x2dc4e1[_0x10c178(0x18f)]??undefined,'hasValue':_0x271431,'valueRedacted':_0x271431};}export function buildMutationData(_0x54cebd){const _0x18ffe1=a35_0x34ea46;return{'operation':_0x54cebd[_0x18ffe1(0x167)],'selector':{'appCode':_0x54cebd[_0x18ffe1(0x166)],'key':_0x54cebd[_0x18ffe1(0x185)]},'before':_0x54cebd[_0x18ffe1(0x179)],'after':_0x54cebd['after'],'dryRun':_0x54cebd[_0x18ffe1(0x197)],'warnings':_0x54cebd['warnings']??[]};}export async function withAppConfigApiBoundary(_0x6f37b7,_0xdeafc6,_0x13f0bd){const _0x1c70a8=a35_0x34ea46;try{return await _0x13f0bd();}catch{const _0x552f8b=[_0x1c70a8(0x165)+_0xdeafc6[_0x1c70a8(0x166)]];if(_0xdeafc6[_0x1c70a8(0x185)])_0x552f8b[_0x1c70a8(0x174)](_0x1c70a8(0x184)+_0xdeafc6[_0x1c70a8(0x185)]);_0x552f8b[_0x1c70a8(0x174)]('value\x20is\x20redacted');throw CliErrors[_0x1c70a8(0x178)](_0x1c70a8(0x1a1)+_0x6f37b7+_0x1c70a8(0x186),_0x552f8b['join'](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x39bb75,_0x1599fb){const _0x513ea2=a35_0x34ea46;return Object[_0x513ea2(0x18e)](_0x39bb75,{'method':{'value':_0x1599fb[_0x513ea2(0x188)],'enumerable':![]},'url':{'value':_0x1599fb['url'],'enumerable':![]}});}export function assertSingleValueSource(_0xf5116e){const _0x31dc26=a35_0x34ea46,_0x224f57=[];_0xf5116e[_0x31dc26(0x18a)][_0x31dc26(0x19a)]>0x1&&_0x224f57[_0x31dc26(0x174)]({'kind':_0x31dc26(0x17e),'value':_0xf5116e[_0x31dc26(0x18a)][_0x31dc26(0x191)](0x1)[_0x31dc26(0x169)]('\x20')});const _0xd51829=_0xf5116e[_0x31dc26(0x168)]('value');_0xd51829!==undefined&&_0xd51829!==null&&_0x224f57[_0x31dc26(0x174)]({'kind':_0x31dc26(0x17e),'value':String(_0xd51829)});_0xf5116e['bool'](_0x31dc26(0x172))&&_0x224f57['push']({'kind':_0x31dc26(0x172)});const _0x5656c1=_0xf5116e[_0x31dc26(0x17a)](_0x31dc26(0x16c))[_0x31dc26(0x17f)]();_0x5656c1&&_0x224f57[_0x31dc26(0x174)]({'kind':_0x31dc26(0x177),'name':_0x5656c1});const _0x40003a=_0xf5116e['str'](_0x31dc26(0x194))[_0x31dc26(0x17f)]();_0x40003a&&_0x224f57['push']({'kind':'file','path':_0x40003a});if(_0x224f57[_0x31dc26(0x19a)]===0x0)throw CliErrors[_0x31dc26(0x16f)](_0x31dc26(0x181),_0x31dc26(0x18c));if(_0x224f57['length']>0x1)throw CliErrors[_0x31dc26(0x16f)]('App\x20config\x20value\x20source\x20is\x20ambiguous.','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');return _0x224f57[0x0];}function a35_0x3d2e(_0x27ddeb,_0x59fd1a){_0x27ddeb=_0x27ddeb-0x163;const _0x2e44f7=a35_0x2e44();let _0x3d2efe=_0x2e44f7[_0x27ddeb];return _0x3d2efe;}export async function assertValueSourceReadable(_0x5f449d){const _0x3e2503=a35_0x34ea46;if(_0x5f449d[_0x3e2503(0x16d)]===_0x3e2503(0x177)&&!(_0x5f449d[_0x3e2503(0x190)]in process.env))throw CliErrors[_0x3e2503(0x16f)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x5f449d[_0x3e2503(0x190)]);if(_0x5f449d[_0x3e2503(0x16d)]===_0x3e2503(0x194))try{await access(_0x5f449d[_0x3e2503(0x196)]);}catch{throw CliErrors['validation']('Value\x20file\x20is\x20not\x20readable:\x20'+_0x5f449d[_0x3e2503(0x196)]);}}export async function readAppConfigValue(_0x288356){const _0x409973=a35_0x34ea46,_0x26f88b=assertSingleValueSource(_0x288356),_0x2893fe=[];if(_0x26f88b[_0x409973(0x16d)]===_0x409973(0x17e))return _0x2893fe[_0x409973(0x174)](_0x409973(0x187)),{'value':_0x26f88b[_0x409973(0x170)]??'','source':_0x26f88b[_0x409973(0x16d)],'warnings':_0x2893fe};if(_0x26f88b['kind']===_0x409973(0x172))return{'value':await readStdin(),'source':_0x26f88b[_0x409973(0x16d)],'warnings':_0x2893fe};if(_0x26f88b[_0x409973(0x16d)]==='env'){if(!(_0x26f88b[_0x409973(0x190)]in process.env))throw CliErrors[_0x409973(0x16f)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x26f88b['name']);return{'value':process.env[_0x26f88b.name]??'','source':_0x26f88b[_0x409973(0x16d)],'warnings':_0x2893fe};}return{'value':await readFile(_0x26f88b[_0x409973(0x196)],_0x409973(0x17d)),'source':_0x26f88b[_0x409973(0x16d)],'warnings':_0x2893fe};}function readStdin(){return new Promise((_0x3e3433,_0x549c80)=>{const _0x3c6ea8=a35_0x3d2e;let _0x8470f8='';process[_0x3c6ea8(0x172)]['setEncoding']('utf8'),process['stdin']['on'](_0x3c6ea8(0x17b),_0x1f7dc0=>{_0x8470f8+=_0x1f7dc0;}),process[_0x3c6ea8(0x172)][_0x3c6ea8(0x193)](_0x3c6ea8(0x1a0),()=>_0x3e3433(_0x8470f8)),process[_0x3c6ea8(0x172)]['once'](_0x3c6ea8(0x19b),_0x549c80);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a36_0x3a9d(_0x518900,_0x184ca3){_0x518900=_0x518900-0x126;const _0x287bb7=a36_0x287b();let _0x3a9dad=_0x287bb7[_0x518900];return _0x3a9dad;}const a36_0x4d3d72=a36_0x3a9d;(function(_0x56398f,_0x36de00){const _0x4f9ec1=a36_0x3a9d,_0x286b42=_0x56398f();while(!![]){try{const _0x5eaab2=-parseInt(_0x4f9ec1(0x12e))/0x1*(parseInt(_0x4f9ec1(0x130))/0x2)+parseInt(_0x4f9ec1(0x131))/0x3+parseInt(_0x4f9ec1(0x129))/0x4*(-parseInt(_0x4f9ec1(0x139))/0x5)+parseInt(_0x4f9ec1(0x12f))/0x6+parseInt(_0x4f9ec1(0x12a))/0x7+-parseInt(_0x4f9ec1(0x134))/0x8+parseInt(_0x4f9ec1(0x136))/0x9;if(_0x5eaab2===_0x36de00)break;else _0x286b42['push'](_0x286b42['shift']());}catch(_0x540cc2){_0x286b42['push'](_0x286b42['shift']());}}}(a36_0x287b,0x1e83c));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x287b(){const _0x166021=['nonInteractive','25928dUHkNX','587790KYgxSo','✓\x20Logged\x20out','yes','logout','236741XVSxHz','558492OxlodR','2wnuAhB','111312ZTcCwA','write','boolean','738280VLQPiJ','login','2625426ooAEOg','Login\x20via\x20browser','log','40FqNjMF','../../auth/auth-server-ui.js','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately'];a36_0x287b=function(){return _0x166021;};return a36_0x287b();}export const authDefinitions=[{'service':'auth','command':a36_0x4d3d72(0x135),'description':a36_0x4d3d72(0x137),'risk':a36_0x4d3d72(0x132),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x4d3d72(0x12c),'type':a36_0x4d3d72(0x133),'description':a36_0x4d3d72(0x127),'default':![]}],async 'execute'(_0x2aa3d2){const _0x260b4f=a36_0x4d3d72,{runAuthServer:_0x5d3b63}=await import(_0x260b4f(0x126));return await _0x5d3b63({'autoYes':_0x2aa3d2['bool']('yes'),'nonInteractive':_0x2aa3d2[_0x260b4f(0x128)]}),{'ok':!![]};}},{'service':'auth','command':a36_0x4d3d72(0x12d),'description':'Clear\x20login\x20session','risk':a36_0x4d3d72(0x132),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x8aa4f1){const _0x2d6181=a36_0x4d3d72;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x2d6181(0x138)](_0x2d6181(0x12b))):console[_0x2d6181(0x138)]('!\x20Not\x20logged\x20in'),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a37_0x5859(){const _0x51e10a=['/HOOK/','COMMON','datasetId','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','stdin','\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','当前响应结果','alias','isInteger','write','修改后的请求参数','\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','/data/dataset/','nonInteractive','length','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Available\x20aliases:\x20','ENDPOINT','当前请求参数','Script\x20description','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','entries','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','Invalid\x20function\x20name\x20\x22','functionNode','currentApp','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','No\x20datasets\x20found\x20for\x20this\x20app.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','\x22\x20not\x20found.\x20','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','\x0a\x20*\x20[平台配置]\x20','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','close','965132ghHtDU','Alias\x20\x22','\x20function:\x20','Select\x20operation\x20type:','str','Select\x20dataset:','after','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x22\x20not\x20found\x20for\x20dataset\x20','File\x20already\x20exists:\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','/**\x0a\x20*\x20','No\x20model\x20aliases\x20found.\x20Run\x20`','\x22,\x20params\x20})\x0a','question','trim','map','description','datasetcode','Created\x20','2221065oHGEfy','string','1278498WXuwtK','validation','6093488uMqsID','profileName','.js','filePath','type','datasetCode','before','2ykqmPu','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','mergedCli','operationType','defaultApp','Script\x20type','scriptsRootDir','UNKNOWN','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Select\x20trigger\x20node:','operation-type','19316zedoGE','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','HOOK\x20requires\x20alias/operation/node\x20options.','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','read','修改后的响应结果','source','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Function\x20name\x20(valid\x20JS\x20identifier)','stderr','11707206CCSJDb','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','1905qHlKPy','tableName','selectedAppName','HOOK',']\x20(','bff','Invalid\x20dataset\x20selection.','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','2627199RmPKet','appCode','.js\x0a','code','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','/ENDPOINT/','apiDir','name','find','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','/COMMON/'];a37_0x5859=function(){return _0x51e10a;};return a37_0x5859();}const a37_0x30e755=a37_0x29ed;(function(_0x274b5a,_0x3f6be2){const _0x11a53e=a37_0x29ed,_0x2b0a61=_0x274b5a();while(!![]){try{const _0x2ca9ce=-parseInt(_0x11a53e(0x19c))/0x1*(-parseInt(_0x11a53e(0x1bb))/0x2)+parseInt(_0x11a53e(0x16f))/0x3+-parseInt(_0x11a53e(0x15b))/0x4*(parseInt(_0x11a53e(0x167))/0x5)+-parseInt(_0x11a53e(0x1b2))/0x6+parseInt(_0x11a53e(0x165))/0x7+-parseInt(_0x11a53e(0x1b4))/0x8+parseInt(_0x11a53e(0x1b0))/0x9;if(_0x2ca9ce===_0x3f6be2)break;else _0x2b0a61['push'](_0x2b0a61['shift']());}catch(_0x565526){_0x2b0a61['push'](_0x2b0a61['shift']());}}}(a37_0x5859,0xe6d52));function a37_0x29ed(_0x2c14f2,_0xa4e469){_0x2c14f2=_0x2c14f2-0x155;const _0x5859f3=a37_0x5859();let _0x29ed56=_0x5859f3[_0x2c14f2];return _0x29ed56;}import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x30e755(0x16c),'command':'create','description':a37_0x30e755(0x15e),'risk':a37_0x30e755(0x15f),'flags':[{'name':a37_0x30e755(0x1b8),'type':a37_0x30e755(0x1b1),'required':!![],'enum':['COMMON','ENDPOINT',a37_0x30e755(0x16a)],'description':a37_0x30e755(0x155)},{'name':a37_0x30e755(0x176),'type':a37_0x30e755(0x1b1),'required':!![],'description':a37_0x30e755(0x163)},{'name':a37_0x30e755(0x1ad),'type':'string','description':a37_0x30e755(0x18d)},{'name':a37_0x30e755(0x181),'type':a37_0x30e755(0x1b1),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x30e755(0x1ae),'type':'string','description':a37_0x30e755(0x1a6)},{'name':a37_0x30e755(0x15a),'type':'string','description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a37_0x30e755(0x1b1),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a37_0x30e755(0x1ba),a37_0x30e755(0x1a2)]}],async 'validate'(_0x111a67){const _0x3babaa=a37_0x30e755,_0x3d7c6a=_0x111a67[_0x3babaa(0x1a0)]('name');if(!isValidBffFunctionName(_0x3d7c6a))throw CliErrors[_0x3babaa(0x1b3)](_0x3babaa(0x191)+_0x3d7c6a+_0x3babaa(0x178));},async 'execute'(_0x745064){const _0x386af9=a37_0x30e755,_0x3bf740=loadBffProjectConfig(_0x745064[_0x386af9(0x170)]),_0x5aef45=_0x745064['str'](_0x386af9(0x1b8)),_0x3b81b5=_0x745064['str'](_0x386af9(0x176)),_0x5c1a24=_0x745064[_0x386af9(0x1a0)](_0x386af9(0x1ad))||undefined,_0x4ae82f=_0x5aef45==='HOOK'?await resolveHookOptions(_0x3bf740,_0x745064):undefined,_0x1e3253=buildFilePath(_0x3bf740,_0x5aef45,_0x3b81b5,_0x4ae82f);if(await fileExists(_0x1e3253))throw CliErrors[_0x386af9(0x1b3)](_0x386af9(0x1a5)+_0x1e3253);await mkdir(dirname(_0x1e3253),{'recursive':!![]});const _0x224563=generateTemplate(_0x5aef45,_0x3b81b5,_0x745064[_0x386af9(0x170)],_0x5c1a24,_0x4ae82f);await writeFile(_0x1e3253,_0x224563,'utf8');const _0x3cb251={'type':_0x5aef45,'name':_0x3b81b5,'path':_0x1e3253};if(_0x5c1a24)_0x3cb251['description']=_0x5c1a24;if(_0x4ae82f){if(_0x4ae82f['alias'])_0x3cb251[_0x386af9(0x181)]=_0x4ae82f[_0x386af9(0x181)];_0x3cb251[_0x386af9(0x1b9)]=_0x4ae82f[_0x386af9(0x1b9)],_0x3cb251[_0x386af9(0x1be)]=_0x4ae82f[_0x386af9(0x1be)],_0x3cb251['functionNode']=_0x4ae82f[_0x386af9(0x192)];}return{'ok':!![],'data':_0x3cb251,'message':_0x386af9(0x1af)+_0x5aef45+_0x386af9(0x19e)+_0x3b81b5};}};async function resolveHookOptions(_0x4bd916,_0x457a79){const _0xe227bd=a37_0x30e755,_0x5c5753=resolveApiModelSource(_0x457a79[_0xe227bd(0x175)],_0x457a79[_0xe227bd(0x170)],_0x457a79[_0xe227bd(0x169)]||_0x457a79['mergedCli']?.[_0xe227bd(0x193)]||_0x457a79[_0xe227bd(0x1bd)]?.[_0xe227bd(0x1bf)]),_0x3461ec=loadAliasMap(_0x457a79['apiDir'],undefined,_0x5c5753[_0xe227bd(0x1b7)],_0x5c5753[_0xe227bd(0x1b5)]),_0x5808a8=_0x3461ec['length']>0x0;let _0x132175,_0x529a38,_0x313442;const _0x20b693=_0x457a79[_0xe227bd(0x1a0)](_0xe227bd(0x181)),_0x5ab6f7=_0x457a79[_0xe227bd(0x1a0)](_0xe227bd(0x1ae));if(_0x20b693){const _0x4ddd8e=resolveAlias(_0x457a79['apiDir'],_0x20b693,undefined,_0x5c5753['filePath'],_0x5c5753[_0xe227bd(0x1b5)]);if(!_0x4ddd8e){const _0x4861e5=_0x5808a8?_0xe227bd(0x18a)+_0x3461ec[_0xe227bd(0x1ac)](_0x96fe93=>_0x96fe93[_0xe227bd(0x181)])['join'](',\x20'):_0xe227bd(0x1a8)+CLI_BIN_NAME+_0xe227bd(0x18e);throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x19d)+_0x20b693+_0xe227bd(0x197)+_0x4861e5);}_0x132175=_0x20b693,_0x529a38=_0x4ddd8e;}else{if(_0x5ab6f7){_0x529a38=_0x5ab6f7;const _0x1a1b0d=_0x3461ec[_0xe227bd(0x177)](_0x5d65ee=>_0x5d65ee['datasetCode']===_0x5ab6f7);_0x132175=_0x1a1b0d?.[_0xe227bd(0x181)];}else{if(_0x457a79[_0xe227bd(0x187)])throw CliErrors['validation']('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x5808a8){const _0xf6cc6=_0x3461ec[_0xe227bd(0x1ac)](_0xfae18f=>_0xfae18f[_0xe227bd(0x181)]+'\x20('+_0xfae18f[_0xe227bd(0x168)]+')'),_0x2fe9ce=await promptSelect(_0xe227bd(0x1a1),_0xf6cc6),_0x4b82a9=_0x3461ec[_0x2fe9ce];if(!_0x4b82a9)throw CliErrors['validation']('Invalid\x20dataset\x20selection.');_0x132175=_0x4b82a9[_0xe227bd(0x181)],_0x529a38=_0x4b82a9['datasetCode'];}else{const _0x27ad0c=await listDatasets(_0x457a79[_0xe227bd(0x170)]);if(_0x27ad0c[_0xe227bd(0x188)]===0x0)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x195));const _0x4fdc26=_0x27ad0c[_0xe227bd(0x1ac)](_0x8a9c47=>_0x8a9c47[_0xe227bd(0x176)]+'\x20['+(_0x8a9c47[_0xe227bd(0x161)]??_0xe227bd(0x157))+_0xe227bd(0x16b)+_0x8a9c47[_0xe227bd(0x172)]+')'),_0x610c6=await promptSelect(_0xe227bd(0x1a1),_0x4fdc26),_0x371907=_0x27ad0c[_0x610c6];if(!_0x371907)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x16d));_0x529a38=_0x371907[_0xe227bd(0x172)],_0x132175=undefined;}}}}const _0x580930=await listDatasets(_0x457a79[_0xe227bd(0x170)]),_0x358d66=_0x580930[_0xe227bd(0x177)](_0x4ca104=>_0x4ca104[_0xe227bd(0x172)]===_0x529a38);if(!_0x358d66)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x1a3)+_0x529a38+'\x22.\x20'+(_0x132175?_0xe227bd(0x16e)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x313442=_0x358d66['id'];const _0x16c433=_0x132175??_0x529a38,_0x173cf6=await listBffDatasetOperations(_0x457a79[_0xe227bd(0x170)],_0x313442),_0x35fb27=_0x173cf6?Object['keys'](_0x173cf6):[];if(_0x35fb27[_0xe227bd(0x188)]===0x0)throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x189)+_0x16c433+'.');let _0x3f5b39;const _0x20ca1f=_0x457a79[_0xe227bd(0x1a0)]('operation-type');if(_0x20ca1f){if(!_0x35fb27['includes'](_0x20ca1f))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x20ca1f+_0xe227bd(0x1a4)+_0x16c433+'.\x20'+('Available:\x20'+_0x35fb27['join'](',\x20')));_0x3f5b39=_0x20ca1f;}else{if(_0x457a79[_0xe227bd(0x187)])throw CliErrors['validation'](_0xe227bd(0x166));const _0x472395=await promptSelect(_0xe227bd(0x19f),_0x35fb27);_0x3f5b39=_0x35fb27[_0x472395]??_0x35fb27[0x0];}let _0x1fc388=normalizeHookFunctionNode(_0x457a79[_0xe227bd(0x1a0)]('function-node'));if(!_0x1fc388){if(_0x457a79['str']('function-node'))throw CliErrors[_0xe227bd(0x1b3)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x457a79[_0xe227bd(0x187)])throw CliErrors[_0xe227bd(0x1b3)](_0xe227bd(0x162));const _0x174169=await promptSelect(_0xe227bd(0x159),[_0xe227bd(0x1ba),_0xe227bd(0x1a2)]);_0x1fc388=[_0xe227bd(0x1ba),_0xe227bd(0x1a2)][_0x174169]??_0xe227bd(0x1ba);}return{'alias':_0x132175,'datasetCode':_0x529a38,'datasetId':_0x313442,'operationType':_0x3f5b39,'functionNode':_0x1fc388};}async function promptSelect(_0x2153e2,_0x448d8a){const _0x1c8838=a37_0x30e755;if(_0x448d8a[_0x1c8838(0x188)]===0x1)return 0x0;for(const [_0x30579f,_0x2e5e36]of _0x448d8a[_0x1c8838(0x18f)]()){process['stderr'][_0x1c8838(0x183)]('\x20\x20'+(_0x30579f+0x1)+'.\x20'+_0x2e5e36+'\x0a');}const _0x288f88=createInterface({'input':process[_0x1c8838(0x17e)],'output':process[_0x1c8838(0x164)]});while(!![]){const _0x128f24=await new Promise(_0x59f3c0=>{const _0x3cbf66=_0x1c8838;_0x288f88[_0x3cbf66(0x1aa)](_0x2153e2+'\x20',_0x59f3c0);}),_0x30bf5d=Number['parseInt'](_0x128f24[_0x1c8838(0x1ab)](),0xa);if(Number[_0x1c8838(0x182)](_0x30bf5d)&&_0x30bf5d>=0x1&&_0x30bf5d<=_0x448d8a[_0x1c8838(0x188)])return _0x288f88[_0x1c8838(0x19b)](),_0x30bf5d-0x1;process[_0x1c8838(0x164)]['write']('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x448d8a[_0x1c8838(0x188)]+'.\x0a');}}function buildFilePath(_0x63fc68,_0x578d7e,_0x1bd4c1,_0x4d3f7d){const _0x5d950a=a37_0x30e755;if(_0x578d7e===_0x5d950a(0x16a)){if(!_0x4d3f7d)throw CliErrors['validation'](_0x5d950a(0x15d));const _0x1148a4=_0x4d3f7d[_0x5d950a(0x181)]??_0x4d3f7d[_0x5d950a(0x1b9)];return join(_0x63fc68[_0x5d950a(0x156)],_0x5d950a(0x16a),_0x1148a4,_0x4d3f7d[_0x5d950a(0x1be)],_0x4d3f7d[_0x5d950a(0x192)],_0x1bd4c1+_0x5d950a(0x1b6));}return join(_0x63fc68[_0x5d950a(0x156)],_0x578d7e,_0x1bd4c1+'.js');}export function generateTemplate(_0x4c5ad1,_0x7cc6b3,_0x512973,_0x4b4557,_0x245b0e){const _0x46ecd0=a37_0x30e755,_0x154497=_0x4b4557?.[_0x46ecd0(0x1ab)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x9d72ca=getAppBaseUrl(_0x512973),_0x2b6ef5=_0x46ecd0(0x173);if(_0x4c5ad1===_0x46ecd0(0x17b))return _0x46ecd0(0x1a7)+_0x154497+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x7cc6b3+_0x46ecd0(0x199)+_0x9d72ca+_0x46ecd0(0x194)+_0x512973+_0x46ecd0(0x179)+_0x7cc6b3+_0x46ecd0(0x19a)+_0x7cc6b3+_0x46ecd0(0x1a9)+_0x2b6ef5+_0x46ecd0(0x185)+_0x7cc6b3+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x4c5ad1===_0x46ecd0(0x18b))return _0x46ecd0(0x1a7)+_0x154497+_0x46ecd0(0x196)+_0x7cc6b3+_0x46ecd0(0x15c)+_0x512973+'/'+_0x7cc6b3+_0x46ecd0(0x199)+_0x9d72ca+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x512973+_0x46ecd0(0x174)+_0x7cc6b3+_0x46ecd0(0x171)+_0x2b6ef5+_0x46ecd0(0x17f)+_0x7cc6b3+_0x46ecd0(0x17d);if(!_0x245b0e)throw CliErrors[_0x46ecd0(0x1b3)](_0x46ecd0(0x190));const _0x1ea3ca=_0x245b0e[_0x46ecd0(0x181)]??_0x245b0e['datasetCode'],_0x542b00=_0x245b0e[_0x46ecd0(0x192)]===_0x46ecd0(0x1ba)?_0x46ecd0(0x18c):_0x46ecd0(0x180),_0xe9ca03=_0x245b0e[_0x46ecd0(0x192)]===_0x46ecd0(0x1ba)?_0x46ecd0(0x184):_0x46ecd0(0x160);return _0x46ecd0(0x1a7)+_0x154497+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x7cc6b3+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x512973+'/'+_0x245b0e[_0x46ecd0(0x1b9)]+'/'+_0x245b0e[_0x46ecd0(0x1be)]+_0x46ecd0(0x199)+_0x9d72ca+_0x46ecd0(0x186)+_0x245b0e[_0x46ecd0(0x17c)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x512973+_0x46ecd0(0x17a)+_0x1ea3ca+'/'+_0x245b0e[_0x46ecd0(0x1be)]+'/'+_0x245b0e[_0x46ecd0(0x192)]+'/'+_0x7cc6b3+'.js\x0a\x20*\x20[触发节点]\x20'+_0x245b0e[_0x46ecd0(0x192)]+'\x0a'+_0x2b6ef5+_0x46ecd0(0x1bc)+_0x542b00+_0x46ecd0(0x198)+_0xe9ca03+_0x46ecd0(0x158)+_0x7cc6b3+_0x46ecd0(0x17d);}
|
|
1
|
+
const a37_0xc44fdd=a37_0x38ee;(function(_0x2d9e9d,_0x464449){const _0x3e9359=a37_0x38ee,_0x1ba0c8=_0x2d9e9d();while(!![]){try{const _0xba83d8=parseInt(_0x3e9359(0x1c6))/0x1+-parseInt(_0x3e9359(0x1dd))/0x2+parseInt(_0x3e9359(0x1b6))/0x3+parseInt(_0x3e9359(0x1d5))/0x4*(parseInt(_0x3e9359(0x20b))/0x5)+parseInt(_0x3e9359(0x1c4))/0x6*(-parseInt(_0x3e9359(0x1df))/0x7)+parseInt(_0x3e9359(0x1ae))/0x8*(-parseInt(_0x3e9359(0x1b4))/0x9)+parseInt(_0x3e9359(0x1ff))/0xa;if(_0xba83d8===_0x464449)break;else _0x1ba0c8['push'](_0x1ba0c8['shift']());}catch(_0x2cdbb4){_0x1ba0c8['push'](_0x1ba0c8['shift']());}}}(a37_0x45e6,0xa4cf2));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';function a37_0x45e6(){const _0x8849f0=['stderr','6910980bPfNYZ','\x22\x20not\x20found\x20for\x20dataset\x20','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','after','/ENDPOINT/','datasetCode','tableName','operation-type','/data/dataset/','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','trim','1630675mfIRVz','before','Operation\x20type\x20\x22','alias','\x22.\x20','includes','currentApp','Invalid\x20dataset\x20selection.','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Select\x20operation\x20type:','\x20api\x20pull`\x20to\x20refresh.','appCode','validation','Operation\x20type\x20(HOOK\x20only)','create','close','isInteger','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Function\x20name\x20(valid\x20JS\x20identifier)','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','HOOK','40DkRNxu','\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','bff','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Select\x20dataset:','\x20function:\x20','111294YhIEmG','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','1242996IIXhjc','string','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','/HOOK/','/**\x0a\x20*\x20','Created\x20','Select\x20trigger\x20node:','code','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x22,\x20params\x20})\x0a','Invalid\x20function\x20name\x20\x22','4511226LOwaBm','parseInt','173715RmmhSO','join','.js\x0a','HOOK\x20requires\x20alias/operation/node\x20options.','apiDir','nonInteractive','source','question','entries','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Dataset\x20not\x20found\x20for\x20code\x20\x22','Script\x20description','operationType','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','File\x20already\x20exists:\x20','4eicxnq','description','COMMON','No\x20operation\x20types\x20found\x20for\x20dataset\x20','defaultApp','修改后的响应结果','ENDPOINT','datasetcode','233042nhpAZm','No\x20datasets\x20found\x20for\x20this\x20app.','7mgquHg','read','write','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','datasetId','Trigger\x20node\x20(HOOK\x20only)','stdin','name','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','/COMMON/','str','find','map','修改后的请求参数','\x0a\x20*\x20[平台配置]\x20','Available\x20aliases:\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','type','当前响应结果','.js','\x22\x20not\x20found.\x20','mergedCli','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','functionNode','scriptsRootDir','length','UNKNOWN','function-node','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','profileName'];a37_0x45e6=function(){return _0x8849f0;};return a37_0x45e6();}import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';function a37_0x38ee(_0x2a2314,_0x2bf0d4){_0x2a2314=_0x2a2314-0x1a2;const _0x45e6b3=a37_0x45e6();let _0x38ee43=_0x45e6b3[_0x2a2314];return _0x38ee43;}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_0xc44fdd(0x1b0),'command':a37_0xc44fdd(0x1a7),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0xc44fdd(0x1e0),'flags':[{'name':a37_0xc44fdd(0x1f0),'type':'string','required':!![],'enum':[a37_0xc44fdd(0x1d7),a37_0xc44fdd(0x1db),a37_0xc44fdd(0x1ad)],'description':'Script\x20type'},{'name':a37_0xc44fdd(0x1e6),'type':a37_0xc44fdd(0x1b7),'required':!![],'description':a37_0xc44fdd(0x1ab)},{'name':'description','type':'string','description':a37_0xc44fdd(0x1d1)},{'name':a37_0xc44fdd(0x20e),'type':'string','description':a37_0xc44fdd(0x213)},{'name':a37_0xc44fdd(0x1dc),'type':'string','description':a37_0xc44fdd(0x1d3)},{'name':a37_0xc44fdd(0x207),'type':'string','description':a37_0xc44fdd(0x1a6)},{'name':a37_0xc44fdd(0x1fa),'type':'string','description':a37_0xc44fdd(0x1e4),'enum':[a37_0xc44fdd(0x20c),a37_0xc44fdd(0x203)]}],async 'validate'(_0x3130fd){const _0x5ac436=a37_0xc44fdd,_0x1c3159=_0x3130fd[_0x5ac436(0x1e9)](_0x5ac436(0x1e6));if(!isValidBffFunctionName(_0x1c3159))throw CliErrors[_0x5ac436(0x1a5)](_0x5ac436(0x1c3)+_0x1c3159+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x52fb86){const _0x24cf51=a37_0xc44fdd,_0x3a1d87=loadBffProjectConfig(_0x52fb86[_0x24cf51(0x1a4)]),_0x7c616=_0x52fb86['str'](_0x24cf51(0x1f0)),_0xe66623=_0x52fb86[_0x24cf51(0x1e9)](_0x24cf51(0x1e6)),_0xf7b470=_0x52fb86[_0x24cf51(0x1e9)](_0x24cf51(0x1d6))||undefined,_0x30fc83=_0x7c616===_0x24cf51(0x1ad)?await resolveHookOptions(_0x3a1d87,_0x52fb86):undefined,_0x4cbde7=buildFilePath(_0x3a1d87,_0x7c616,_0xe66623,_0x30fc83);if(await fileExists(_0x4cbde7))throw CliErrors[_0x24cf51(0x1a5)](_0x24cf51(0x1d4)+_0x4cbde7);await mkdir(dirname(_0x4cbde7),{'recursive':!![]});const _0x540e90=generateTemplate(_0x7c616,_0xe66623,_0x52fb86['appCode'],_0xf7b470,_0x30fc83);await writeFile(_0x4cbde7,_0x540e90,'utf8');const _0x142e95={'type':_0x7c616,'name':_0xe66623,'path':_0x4cbde7};if(_0xf7b470)_0x142e95['description']=_0xf7b470;if(_0x30fc83){if(_0x30fc83[_0x24cf51(0x20e)])_0x142e95[_0x24cf51(0x20e)]=_0x30fc83[_0x24cf51(0x20e)];_0x142e95[_0x24cf51(0x205)]=_0x30fc83['datasetCode'],_0x142e95[_0x24cf51(0x1d2)]=_0x30fc83[_0x24cf51(0x1d2)],_0x142e95[_0x24cf51(0x1f6)]=_0x30fc83[_0x24cf51(0x1f6)];}return{'ok':!![],'data':_0x142e95,'message':_0x24cf51(0x1bd)+_0x7c616+_0x24cf51(0x1b3)+_0xe66623};}};async function resolveHookOptions(_0x1aef75,_0x5d01f0){const _0x590370=a37_0xc44fdd,_0x2bd291=resolveApiModelSource(_0x5d01f0[_0x590370(0x1ca)],_0x5d01f0[_0x590370(0x1a4)],_0x5d01f0['selectedAppName']||_0x5d01f0['mergedCli']?.[_0x590370(0x211)]||_0x5d01f0[_0x590370(0x1f4)]?.[_0x590370(0x1d9)]),_0x1a631b=loadAliasMap(_0x5d01f0[_0x590370(0x1ca)],undefined,_0x2bd291['filePath'],_0x2bd291[_0x590370(0x1fd)]),_0xd680af=_0x1a631b['length']>0x0;let _0x458d42,_0x4c40a8,_0x136a17;const _0x45dacd=_0x5d01f0[_0x590370(0x1e9)](_0x590370(0x20e)),_0x29c4a5=_0x5d01f0[_0x590370(0x1e9)](_0x590370(0x1dc));if(_0x45dacd){const _0xd9134a=resolveAlias(_0x5d01f0['apiDir'],_0x45dacd,undefined,_0x2bd291['filePath'],_0x2bd291['profileName']);if(!_0xd9134a){const _0x4eeade=_0xd680af?_0x590370(0x1ee)+_0x1a631b[_0x590370(0x1eb)](_0x1e142d=>_0x1e142d[_0x590370(0x20e)])[_0x590370(0x1c7)](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x590370(0x1a5)]('Alias\x20\x22'+_0x45dacd+_0x590370(0x1f3)+_0x4eeade);}_0x458d42=_0x45dacd,_0x4c40a8=_0xd9134a;}else{if(_0x29c4a5){_0x4c40a8=_0x29c4a5;const _0x3eddbf=_0x1a631b[_0x590370(0x1ea)](_0x4aad2a=>_0x4aad2a['datasetCode']===_0x29c4a5);_0x458d42=_0x3eddbf?.[_0x590370(0x20e)];}else{if(_0x5d01f0[_0x590370(0x1cb)])throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1c1));else{if(_0xd680af){const _0x5a5d0d=_0x1a631b['map'](_0x410823=>_0x410823[_0x590370(0x20e)]+'\x20('+_0x410823[_0x590370(0x206)]+')'),_0x32c982=await promptSelect(_0x590370(0x1b2),_0x5a5d0d),_0x3d396e=_0x1a631b[_0x32c982];if(!_0x3d396e)throw CliErrors['validation'](_0x590370(0x212));_0x458d42=_0x3d396e['alias'],_0x4c40a8=_0x3d396e[_0x590370(0x205)];}else{const _0x5766f4=await listDatasets(_0x5d01f0[_0x590370(0x1a4)]);if(_0x5766f4[_0x590370(0x1f8)]===0x0)throw CliErrors['validation'](_0x590370(0x1de));const _0x24c64a=_0x5766f4[_0x590370(0x1eb)](_0x1defcc=>_0x1defcc[_0x590370(0x1e6)]+'\x20['+(_0x1defcc[_0x590370(0x1cc)]??_0x590370(0x1f9))+']\x20('+_0x1defcc[_0x590370(0x1bf)]+')'),_0x116817=await promptSelect(_0x590370(0x1b2),_0x24c64a),_0x1b006e=_0x5766f4[_0x116817];if(!_0x1b006e)throw CliErrors['validation'](_0x590370(0x212));_0x4c40a8=_0x1b006e[_0x590370(0x1bf)],_0x458d42=undefined;}}}}const _0x4b2569=await listDatasets(_0x5d01f0['appCode']),_0x40de6b=_0x4b2569['find'](_0x5c207b=>_0x5c207b[_0x590370(0x1bf)]===_0x4c40a8);if(!_0x40de6b)throw CliErrors['validation'](_0x590370(0x1d0)+_0x4c40a8+_0x590370(0x20f)+(_0x458d42?_0x590370(0x1ba)+CLI_BIN_NAME+_0x590370(0x1a3):''));_0x136a17=_0x40de6b['id'];const _0x3d536c=_0x458d42??_0x4c40a8,_0x592f36=await listBffDatasetOperations(_0x5d01f0[_0x590370(0x1a4)],_0x136a17),_0x10530e=_0x592f36?Object['keys'](_0x592f36):[];if(_0x10530e[_0x590370(0x1f8)]===0x0)throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1d8)+_0x3d536c+'.');let _0x42210d;const _0x2bd6e0=_0x5d01f0[_0x590370(0x1e9)](_0x590370(0x207));if(_0x2bd6e0){if(!_0x10530e[_0x590370(0x210)](_0x2bd6e0))throw CliErrors[_0x590370(0x1a5)](_0x590370(0x20d)+_0x2bd6e0+_0x590370(0x200)+_0x3d536c+'.\x20'+('Available:\x20'+_0x10530e[_0x590370(0x1c7)](',\x20')));_0x42210d=_0x2bd6e0;}else{if(_0x5d01f0[_0x590370(0x1cb)])throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1aa));const _0x1fad3a=await promptSelect(_0x590370(0x1a2),_0x10530e);_0x42210d=_0x10530e[_0x1fad3a]??_0x10530e[0x0];}let _0x446c5c=normalizeHookFunctionNode(_0x5d01f0[_0x590370(0x1e9)]('function-node'));if(!_0x446c5c){if(_0x5d01f0['str'](_0x590370(0x1fa)))throw CliErrors[_0x590370(0x1a5)](_0x590370(0x201));if(_0x5d01f0[_0x590370(0x1cb)])throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1e7));const _0x5ba115=await promptSelect(_0x590370(0x1be),[_0x590370(0x20c),_0x590370(0x203)]);_0x446c5c=['before',_0x590370(0x203)][_0x5ba115]??_0x590370(0x20c);}return{'alias':_0x458d42,'datasetCode':_0x4c40a8,'datasetId':_0x136a17,'operationType':_0x42210d,'functionNode':_0x446c5c};}async function promptSelect(_0xa5294e,_0x14b0ff){const _0x290a7a=a37_0xc44fdd;if(_0x14b0ff[_0x290a7a(0x1f8)]===0x1)return 0x0;for(const [_0x5a1524,_0x40a496]of _0x14b0ff[_0x290a7a(0x1ce)]()){process[_0x290a7a(0x1fe)][_0x290a7a(0x1e1)]('\x20\x20'+(_0x5a1524+0x1)+'.\x20'+_0x40a496+'\x0a');}const _0x79fece=createInterface({'input':process[_0x290a7a(0x1e5)],'output':process[_0x290a7a(0x1fe)]});while(!![]){const _0x2a6196=await new Promise(_0x4e3b1d=>{const _0x497fc6=_0x290a7a;_0x79fece[_0x497fc6(0x1cd)](_0xa5294e+'\x20',_0x4e3b1d);}),_0x403019=Number[_0x290a7a(0x1c5)](_0x2a6196[_0x290a7a(0x20a)](),0xa);if(Number[_0x290a7a(0x1a9)](_0x403019)&&_0x403019>=0x1&&_0x403019<=_0x14b0ff['length'])return _0x79fece[_0x290a7a(0x1a8)](),_0x403019-0x1;process[_0x290a7a(0x1fe)][_0x290a7a(0x1e1)](_0x290a7a(0x1b9)+_0x14b0ff['length']+'.\x0a');}}function buildFilePath(_0x5bd7f7,_0x13d4ea,_0x405230,_0x496431){const _0x1f46a7=a37_0xc44fdd;if(_0x13d4ea===_0x1f46a7(0x1ad)){if(!_0x496431)throw CliErrors[_0x1f46a7(0x1a5)](_0x1f46a7(0x1c9));const _0x6628d2=_0x496431[_0x1f46a7(0x20e)]??_0x496431['datasetCode'];return join(_0x5bd7f7['scriptsRootDir'],_0x1f46a7(0x1ad),_0x6628d2,_0x496431[_0x1f46a7(0x1d2)],_0x496431[_0x1f46a7(0x1f6)],_0x405230+_0x1f46a7(0x1f2));}return join(_0x5bd7f7[_0x1f46a7(0x1f7)],_0x13d4ea,_0x405230+'.js');}export function generateTemplate(_0x50096f,_0x2157d5,_0x40cb54,_0x61b382,_0x402398){const _0x3b96da=a37_0xc44fdd,_0x200c59=_0x61b382?.[_0x3b96da(0x20a)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xe46fe=getAppBaseUrl(_0x40cb54),_0xbab750=_0x3b96da(0x1b5);if(_0x50096f===_0x3b96da(0x1d7))return _0x3b96da(0x1bc)+_0x200c59+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x2157d5+_0x3b96da(0x1ed)+_0xe46fe+_0x3b96da(0x209)+_0x40cb54+_0x3b96da(0x1e8)+_0x2157d5+_0x3b96da(0x1f5)+_0x2157d5+_0x3b96da(0x1c2)+_0xbab750+'\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'+_0x2157d5+_0x3b96da(0x202);if(_0x50096f===_0x3b96da(0x1db))return _0x3b96da(0x1bc)+_0x200c59+_0x3b96da(0x1cf)+_0x2157d5+_0x3b96da(0x1ef)+_0x40cb54+'/'+_0x2157d5+_0x3b96da(0x1ed)+_0xe46fe+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x40cb54+_0x3b96da(0x204)+_0x2157d5+_0x3b96da(0x1c8)+_0xbab750+_0x3b96da(0x1af)+_0x2157d5+_0x3b96da(0x202);if(!_0x402398)throw CliErrors[_0x3b96da(0x1a5)](_0x3b96da(0x1b8));const _0x3cff16=_0x402398['alias']??_0x402398[_0x3b96da(0x205)],_0x322f23=_0x402398['functionNode']===_0x3b96da(0x20c)?'当前请求参数':_0x3b96da(0x1f1),_0x4bee71=_0x402398[_0x3b96da(0x1f6)]===_0x3b96da(0x20c)?_0x3b96da(0x1ec):_0x3b96da(0x1da);return _0x3b96da(0x1bc)+_0x200c59+_0x3b96da(0x1b1)+_0x2157d5+_0x3b96da(0x1fb)+_0x40cb54+'/'+_0x402398[_0x3b96da(0x205)]+'/'+_0x402398['operationType']+_0x3b96da(0x1ed)+_0xe46fe+_0x3b96da(0x208)+_0x402398[_0x3b96da(0x1e3)]+_0x3b96da(0x1c0)+_0x40cb54+_0x3b96da(0x1bb)+_0x3cff16+'/'+_0x402398[_0x3b96da(0x1d2)]+'/'+_0x402398[_0x3b96da(0x1f6)]+'/'+_0x2157d5+'.js\x0a\x20*\x20[触发节点]\x20'+_0x402398['functionNode']+'\x0a'+_0xbab750+_0x3b96da(0x1e2)+_0x322f23+_0x3b96da(0x1ac)+_0x4bee71+_0x3b96da(0x1fc)+_0x2157d5+_0x3b96da(0x202);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x24bf67=a38_0x11c7;function a38_0x11c7(_0x2dcc36,_0x38ae18){_0x2dcc36=_0x2dcc36-0x184;const _0x54493c=a38_0x5449();let _0x11c7c7=_0x54493c[_0x2dcc36];return _0x11c7c7;}function a38_0x5449(){const _0x103fea=['remoteId','5UsJLfF','str','4389024AfgzXM','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','split','scriptsRoot','validation','startsWith','parse','trashedTo','find','length','963568tMCEWd','252086zPmkyK','scriptsRootDir','60gjnxkz','5944540sgtriM','toISOString','Backend\x20Function\x20lock\x20file\x20not\x20found.','Would\x20delete\x20','projectRoot','lockFilePath','map','join','appCode','\x20\x20-\x20','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','Lock\x20scope\x20for\x20app\x20\x22','apps','Multiple\x20functions\x20match\x20\x22','filter','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','target','trashDir','324152bEWlWt','No\x20lock\x20entry\x20found\x20for\x20\x22','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','keys','delete','1020671mZFoCT','stringify','/api/management/library/scripts/delete','includes','Function\x20not\x20found:\x20','9xfXOcN','functions','3585636oGMRnD'];a38_0x5449=function(){return _0x103fea;};return a38_0x5449();}(function(_0x53aa06,_0x16db0a){const _0x1b846f=a38_0x11c7,_0x142c13=_0x53aa06();while(!![]){try{const _0x2e205f=-parseInt(_0x1b846f(0x1a7))/0x1+parseInt(_0x1b846f(0x18d))/0x2*(-parseInt(_0x1b846f(0x1ac))/0x3)+-parseInt(_0x1b846f(0x18c))/0x4*(parseInt(_0x1b846f(0x1b0))/0x5)+-parseInt(_0x1b846f(0x1b2))/0x6+parseInt(_0x1b846f(0x190))/0x7+parseInt(_0x1b846f(0x1a2))/0x8+parseInt(_0x1b846f(0x1ae))/0x9*(parseInt(_0x1b846f(0x18f))/0xa);if(_0x2e205f===_0x16db0a)break;else _0x142c13['push'](_0x142c13['shift']());}catch(_0x39b408){_0x142c13['push'](_0x142c13['shift']());}}}(a38_0x5449,0xddea7));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':'bff','command':a38_0x24bf67(0x1a6),'description':a38_0x24bf67(0x1a4),'risk':'high-risk-write','flags':[{'name':a38_0x24bf67(0x1a0),'type':'string','required':!![],'description':a38_0x24bf67(0x1b3)}],async 'validate'(_0x150260){const _0x56c6dc=a38_0x24bf67,_0x31ea89=loadBffProjectConfig(_0x150260[_0x56c6dc(0x198)]),_0x26b46b=await readBffLockFile(_0x31ea89['lockFilePath']);if(!_0x26b46b)throw CliErrors[_0x56c6dc(0x186)](_0x56c6dc(0x19f));},async 'dryRun'(_0x3a9606){const _0xd3a427=a38_0x24bf67,_0x291831=loadBffProjectConfig(_0x3a9606[_0xd3a427(0x198)]),_0x5eda9f=await readBffLockFile(_0x291831[_0xd3a427(0x195)]);if(!_0x5eda9f)throw CliErrors[_0xd3a427(0x186)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {appLock:_0x5ea769}=ensureLockScope(_0x5eda9f,_0x3a9606[_0xd3a427(0x198)],_0x291831[_0xd3a427(0x185)],'delete'),_0xebbd09=_0x3a9606[_0xd3a427(0x1b1)]('target'),_0x6def9c=Object[_0xd3a427(0x1a5)](_0x5ea769[_0xd3a427(0x1ad)]),_0x39b1db=resolveDeleteTarget(_0xebbd09,_0x6def9c),_0x525c3a=_0x5ea769[_0xd3a427(0x1ad)][_0x39b1db];if(!_0x525c3a)throw CliErrors['validation'](_0xd3a427(0x1a3)+_0x39b1db+'\x22.');const _0x37bdee=resolveLocalFilePathFromLockKey(_0x291831,_0x39b1db),_0x1f6d8a=relative(_0x291831[_0xd3a427(0x194)],_0x37bdee),_0x5cff05=join(_0x291831[_0xd3a427(0x1a1)],'<timestamp>',_0x1f6d8a);return{'method':'POST','url':_0xd3a427(0x1a9),'body':{'appCode':_0x3a9606[_0xd3a427(0x198)],'target':_0x39b1db,'remoteId':_0x525c3a[_0xd3a427(0x1af)],'localFilePath':_0x37bdee,'trashedPath':_0x5cff05},'description':_0xd3a427(0x193)+_0x39b1db+_0xd3a427(0x19a)};},async 'execute'(_0x3fdf4b){const _0x5b6f0f=a38_0x24bf67,_0x3ee86f=loadBffProjectConfig(_0x3fdf4b[_0x5b6f0f(0x198)]),_0x1398b7=await readBffLockFile(_0x3ee86f[_0x5b6f0f(0x195)]);if(!_0x1398b7)throw CliErrors[_0x5b6f0f(0x186)](_0x5b6f0f(0x192));const {lockData:_0x3da2e6,appLock:_0x5d61da}=ensureLockScope(_0x1398b7,_0x3fdf4b[_0x5b6f0f(0x198)],_0x3ee86f[_0x5b6f0f(0x185)],'delete'),_0x24c413=JSON[_0x5b6f0f(0x188)](JSON[_0x5b6f0f(0x1a8)](_0x3da2e6)),_0x5c0de8=_0x24c413[_0x5b6f0f(0x19c)][_0x3fdf4b['appCode']];if(!_0x5c0de8)throw new Error(_0x5b6f0f(0x19b)+_0x3fdf4b['appCode']+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x2f016a=_0x3fdf4b[_0x5b6f0f(0x1b1)](_0x5b6f0f(0x1a0)),_0x2a6501=Object[_0x5b6f0f(0x1a5)](_0x5c0de8[_0x5b6f0f(0x1ad)]),_0x51734a=resolveDeleteTarget(_0x2f016a,_0x2a6501),_0x4bff0e=_0x5c0de8[_0x5b6f0f(0x1ad)][_0x51734a];if(!_0x4bff0e)throw CliErrors[_0x5b6f0f(0x186)](_0x5b6f0f(0x1a3)+_0x51734a+'\x22.');await deleteBffScript(_0x4bff0e['remoteId']),delete _0x5c0de8['functions'][_0x51734a],_0x5c0de8['lastSync']=new Date()[_0x5b6f0f(0x191)](),await writeBffLockFile(_0x3ee86f[_0x5b6f0f(0x195)],_0x24c413);const _0x4b5297=resolveLocalFilePathFromLockKey(_0x3ee86f,_0x51734a);let _0x1f53c5;await fileExists(_0x4b5297)&&(_0x1f53c5=await moveToTrash(_0x3ee86f[_0x5b6f0f(0x194)],_0x3ee86f[_0x5b6f0f(0x1a1)],_0x4b5297),await cleanupEmptyDirectories(dirname(_0x4b5297),_0x3ee86f[_0x5b6f0f(0x18e)]));await waitForDeleteSettlement(_0x3ee86f[_0x5b6f0f(0x195)],_0x3fdf4b['appCode'],_0x51734a,_0x4b5297),await sleep(0x96);const _0x3ae5f2={'deleted':_0x51734a,'remoteId':_0x4bff0e['remoteId']};if(_0x1f53c5)_0x3ae5f2[_0x5b6f0f(0x189)]=_0x1f53c5;return{'ok':!![],'data':_0x3ae5f2,'message':'Deleted\x20'+_0x51734a+(_0x1f53c5?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x94b286,_0x231055){const _0x5099d7=a38_0x24bf67;if(_0x94b286[_0x5099d7(0x1aa)]('/')){const _0x44ecd4=_0x231055[_0x5099d7(0x18a)](_0x3ba6fe=>_0x3ba6fe===_0x94b286);if(!_0x44ecd4)throw CliErrors[_0x5099d7(0x186)](_0x5099d7(0x1ab)+_0x94b286);return _0x44ecd4;}const _0x2d11ef=_0x231055[_0x5099d7(0x19e)](_0x4aad78=>_0x4aad78[_0x5099d7(0x184)]('/')['at'](-0x1)===_0x94b286);if(_0x2d11ef['length']===0x0)throw CliErrors[_0x5099d7(0x186)](_0x5099d7(0x1ab)+_0x94b286);if(_0x2d11ef[_0x5099d7(0x18b)]>0x1)throw CliErrors[_0x5099d7(0x186)](_0x5099d7(0x19d)+_0x94b286+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x2d11ef[_0x5099d7(0x196)](_0xb645db=>_0x5099d7(0x199)+_0xb645db)[_0x5099d7(0x197)]('\x0a'));return _0x2d11ef[0x0];}async function moveToTrash(_0x32ff21,_0x588753,_0x4cdc6f){const _0x55e532=a38_0x24bf67,_0x3caf3a=new Date()[_0x55e532(0x191)]()['replace'](/[:.]/g,'-'),_0xc2ccfb=relative(_0x32ff21,_0x4cdc6f),_0x24f7df=join(_0x588753,_0x3caf3a,_0xc2ccfb);return await mkdir(dirname(_0x24f7df),{'recursive':!![]}),await rename(_0x4cdc6f,_0x24f7df),_0x24f7df;}async function cleanupEmptyDirectories(_0x1f4569,_0x3ce650){const _0x432a56=a38_0x24bf67;let _0x2299a3=resolve(_0x1f4569);const _0x3a9a71=resolve(_0x3ce650);while(_0x2299a3[_0x432a56(0x187)](''+_0x3a9a71+sep)||_0x2299a3===_0x3a9a71){if(_0x2299a3===_0x3a9a71)return;try{const _0x877c02=await readdir(_0x2299a3);if(_0x877c02[_0x432a56(0x18b)]>0x0)return;await rmdir(_0x2299a3);}catch{return;}_0x2299a3=dirname(_0x2299a3);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x5552a5,_0x2a237b,_0x5f598f,_0x5dc435){const _0x514d87=a38_0x24bf67;for(let _0x1094f=0x0;_0x1094f<DELETE_SETTLE_RETRY_COUNT;_0x1094f+=0x1){const _0x1e69b1=await readBffLockFile(_0x5552a5),_0x3c8737=!!_0x1e69b1?.['apps']?.[_0x2a237b]?.[_0x514d87(0x1ad)]?.[_0x5f598f],_0x14f083=await fileExists(_0x5dc435);if(!_0x3c8737&&!_0x14f083)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x5f598f+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a39_0x1116(){const _0x5c9b76=['2395151bXtAwJ','3372jkBhdp','9385YRSRfW','30SvzgHj','bool','8AlIDZR','functionName','updatedTime','54DbINHg','1880556mjnXSy','4540cMLaab','(none)','version','read','num','1974679fkcnjO','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','32862MPUWXt','number','detail','6099732zRTvEo','description','bff','verbose','appCode','updateUserName','scriptContent','360iJIGGW','createdTime'];a39_0x1116=function(){return _0x5c9b76;};return a39_0x1116();}function a39_0x538c(_0x1cd090,_0x3c279f){_0x1cd090=_0x1cd090-0x12e;const _0x1116c2=a39_0x1116();let _0x538cfa=_0x1116c2[_0x1cd090];return _0x538cfa;}const a39_0x58e2e9=a39_0x538c;(function(_0x3f6208,_0x31738d){const _0x52eb88=a39_0x538c,_0x462b1a=_0x3f6208();while(!![]){try{const _0x18e62d=-parseInt(_0x52eb88(0x143))/0x1*(parseInt(_0x52eb88(0x13a))/0x2)+parseInt(_0x52eb88(0x130))/0x3*(-parseInt(_0x52eb88(0x13c))/0x4)+-parseInt(_0x52eb88(0x134))/0x5*(-parseInt(_0x52eb88(0x133))/0x6)+parseInt(_0x52eb88(0x141))/0x7*(-parseInt(_0x52eb88(0x137))/0x8)+parseInt(_0x52eb88(0x146))/0x9+-parseInt(_0x52eb88(0x135))/0xa*(-parseInt(_0x52eb88(0x132))/0xb)+-parseInt(_0x52eb88(0x13b))/0xc;if(_0x18e62d===_0x31738d)break;else _0x462b1a['push'](_0x462b1a['shift']());}catch(_0x346491){_0x462b1a['push'](_0x462b1a['shift']());}}}(a39_0x1116,0xe17a9));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x58e2e9(0x148),'command':a39_0x58e2e9(0x145),'description':a39_0x58e2e9(0x142),'risk':a39_0x58e2e9(0x13f),'flags':[{'name':'id','type':a39_0x58e2e9(0x144),'required':!![],'description':'Script\x20ID'},{'name':a39_0x58e2e9(0x149),'type':'boolean','description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x15f0c0){const _0x5257a3=a39_0x58e2e9,_0x4340a3=await getBffScriptInfo(_0x15f0c0[_0x5257a3(0x140)]('id')),_0x12eab9=_0x15f0c0[_0x5257a3(0x136)](_0x5257a3(0x149));if(_0x12eab9)return{'ok':!![],'data':_0x4340a3};return{'ok':!![],'data':{'id':_0x4340a3['id'],'functionName':_0x4340a3[_0x5257a3(0x138)]??'','version':_0x4340a3[_0x5257a3(0x13e)]??'','updateUserName':_0x4340a3[_0x5257a3(0x12e)]??'','appCode':_0x4340a3[_0x5257a3(0x14a)],'scriptType':_0x4340a3['scriptType'],'description':_0x4340a3[_0x5257a3(0x147)]||_0x5257a3(0x13d),'createdTime':_0x4340a3[_0x5257a3(0x131)]??'','updatedTime':_0x4340a3[_0x5257a3(0x139)]??'','scriptContent':_0x4340a3[_0x5257a3(0x12f)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1af3be,_0x5d5bfd){const _0x3fae00=a40_0x218b,_0x5b2cc4=_0x1af3be();while(!![]){try{const _0x1124dd=-parseInt(_0x3fae00(0x167))/0x1*(parseInt(_0x3fae00(0x161))/0x2)+parseInt(_0x3fae00(0x160))/0x3*(-parseInt(_0x3fae00(0x165))/0x4)+parseInt(_0x3fae00(0x162))/0x5+-parseInt(_0x3fae00(0x163))/0x6+-parseInt(_0x3fae00(0x169))/0x7*(-parseInt(_0x3fae00(0x168))/0x8)+-parseInt(_0x3fae00(0x16b))/0x9*(parseInt(_0x3fae00(0x16a))/0xa)+parseInt(_0x3fae00(0x164))/0xb*(parseInt(_0x3fae00(0x166))/0xc);if(_0x1124dd===_0x5d5bfd)break;else _0x5b2cc4['push'](_0x5b2cc4['shift']());}catch(_0x4bf5a7){_0x5b2cc4['push'](_0x5b2cc4['shift']());}}}(a40_0x2010,0x56de8));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';function a40_0x2010(){const _0x4db12e=['265538CfIvrR','1696360bBYbJB','18aVJDXD','315onUmVJ','57174BBKaeH','3333185Czlyvp','2475144yiKvSD','13089263BPLLBh','25956TbwSvX','12ZjCxNM','9oFoMBW','40HOnllY'];a40_0x2010=function(){return _0x4db12e;};return a40_0x2010();}function a40_0x218b(_0x2247c7,_0x44742c){_0x2247c7=_0x2247c7-0x160;const _0x201043=a40_0x2010();let _0x218bdb=_0x201043[_0x2247c7];return _0x218bdb;}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_0x5646a7=a41_0xcdb5;(function(_0x254b0b,_0x4fb212){const _0x55bda9=a41_0xcdb5,_0x55fdcc=_0x254b0b();while(!![]){try{const _0xa91b6d=parseInt(_0x55bda9(0xb9))/0x1*(-parseInt(_0x55bda9(0xc0))/0x2)+parseInt(_0x55bda9(0xa2))/0x3*(-parseInt(_0x55bda9(0xaa))/0x4)+-parseInt(_0x55bda9(0xa7))/0x5+parseInt(_0x55bda9(0xba))/0x6+-parseInt(_0x55bda9(0xa6))/0x7*(parseInt(_0x55bda9(0xb5))/0x8)+-parseInt(_0x55bda9(0xa3))/0x9+parseInt(_0x55bda9(0xa8))/0xa*(parseInt(_0x55bda9(0xb1))/0xb);if(_0xa91b6d===_0x4fb212)break;else _0x55fdcc['push'](_0x55fdcc['shift']());}catch(_0x4a2acd){_0x55fdcc['push'](_0x55fdcc['shift']());}}}(a41_0x5eaa,0xabe8d));import{listBffScripts}from'../../core/api-client.js';function a41_0xcdb5(_0x317a0c,_0x439330){_0x317a0c=_0x317a0c-0xa1;const _0x5eaa95=a41_0x5eaa();let _0xcdb53=_0x5eaa95[_0x317a0c];return _0xcdb53;}function a41_0x5eaa(){const _0x280ab0=['list','string','Filter\x20by\x20script\x20name','634821JinsGR','verbose','name','functionName','288aNyaCL','boolean','appCode','map','10832nSmafQ','101970ZBdEaz','type','Return\x20full\x20script\x20objects','(unnamed)','scriptType','bool','80dNXipD','Script\x20type\x20filter','str','511767OqQcWH','11619162oZOAVl','read','ENDPOINT','28049yazQeN','1963265PGYczY','570XewlDo','length','8RgcITf','bff','description','List\x20Backend\x20Function\x20scripts'];a41_0x5eaa=function(){return _0x280ab0;};return a41_0x5eaa();}export const bffList={'service':a41_0x5646a7(0xab),'command':a41_0x5646a7(0xae),'description':a41_0x5646a7(0xad),'risk':a41_0x5646a7(0xa4),'flags':[{'name':a41_0x5646a7(0xbb),'type':a41_0x5646a7(0xaf),'description':a41_0x5646a7(0xc1),'default':a41_0x5646a7(0xa5),'enum':[a41_0x5646a7(0xa5),'COMMON']},{'name':a41_0x5646a7(0xb3),'type':a41_0x5646a7(0xaf),'description':a41_0x5646a7(0xb0)},{'name':a41_0x5646a7(0xb2),'type':a41_0x5646a7(0xb6),'description':a41_0x5646a7(0xbc)}],async 'execute'(_0x38e557){const _0x45f7b0=a41_0x5646a7,_0x3fed0d=await listBffScripts(_0x38e557[_0x45f7b0(0xb7)],_0x38e557[_0x45f7b0(0xa1)](_0x45f7b0(0xbb)),{'scriptName':_0x38e557[_0x45f7b0(0xa1)](_0x45f7b0(0xb3))||undefined}),_0x5e5178=_0x38e557[_0x45f7b0(0xbf)](_0x45f7b0(0xb2));return{'ok':!![],'data':_0x5e5178?_0x3fed0d:_0x3fed0d[_0x45f7b0(0xb8)](_0x3da7cc=>({'id':_0x3da7cc['id'],'functionName':_0x3da7cc[_0x45f7b0(0xb4)]??'','description':_0x3da7cc[_0x45f7b0(0xac)]||_0x45f7b0(0xbd),'scriptType':_0x3da7cc[_0x45f7b0(0xbe)]})),'message':_0x3fed0d[_0x45f7b0(0xa9)]===0x0?'No\x20Backend\x20Function\x20scripts\x20found.':undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x3ce3d4=a42_0x2732;(function(_0x564e58,_0x4f698e){const _0x1ed291=a42_0x2732,_0x2e235f=_0x564e58();while(!![]){try{const _0x3ee7f7=-parseInt(_0x1ed291(0x189))/0x1+-parseInt(_0x1ed291(0x173))/0x2+-parseInt(_0x1ed291(0x182))/0x3+-parseInt(_0x1ed291(0x183))/0x4*(parseInt(_0x1ed291(0x176))/0x5)+-parseInt(_0x1ed291(0x16b))/0x6+-parseInt(_0x1ed291(0x16e))/0x7+parseInt(_0x1ed291(0x184))/0x8*(parseInt(_0x1ed291(0x16c))/0x9);if(_0x3ee7f7===_0x4f698e)break;else _0x2e235f['push'](_0x2e235f['shift']());}catch(_0x3a9026){_0x2e235f['push'](_0x2e235f['shift']());}}}(a42_0x45a5,0x53620));function a42_0x45a5(){const _0x3a489b=['INFO','--limit\x20must\x20be\x20between\x201\x20and\x20','logs','bff','validation','--since','string','ERROR','3464700wcfCLd','17627598yDGpWa','now','3176530SwAngx','Maximum\x20log\x20lines\x20to\x20return\x20(1-','--end-time','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','keyword','262570gcCiQd','\x20must\x20be\x20a\x20positive\x20integer.','level','22240ODaTtQ','start-time','Filter\x20by\x20log\x20level','end-time','number','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','--start-time','limit','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','trim','length','read','496986oCeymY','176jHQPdY','8DxtQhq','num','isSafeInteger','flag','--limit','93187HkPeZD','since','toUpperCase','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','DEBUG'];a42_0x45a5=function(){return _0x3a489b;};return a42_0x45a5();}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_0x3ce3d4(0x18e),a42_0x3ce3d4(0x18f),'WARN',a42_0x3ce3d4(0x196)];export function resolveBffLogQuery(_0x1c0a7b,_0x461837=Date[a42_0x3ce3d4(0x16d)]()){const _0x37438a=a42_0x3ce3d4,_0x407e05=_0x1c0a7b[_0x37438a(0x187)]('since'),_0x1f9468=_0x1c0a7b['flag'](_0x37438a(0x177)),_0x36d9e7=_0x1c0a7b['flag']('end-time');if(_0x407e05!==undefined&&_0x1f9468!==undefined)throw CliErrors[_0x37438a(0x193)]('--since\x20cannot\x20be\x20combined\x20with\x20--start-time.');const _0x420f0f=_0x36d9e7===undefined?_0x461837:readPositiveInteger(_0x1c0a7b[_0x37438a(0x185)](_0x37438a(0x179)),_0x37438a(0x170)),_0x1ba9fb=_0x1f9468===undefined?_0x420f0f-readSinceMinutes(_0x1c0a7b)*0xea60:readPositiveInteger(_0x1c0a7b['num']('start-time'),_0x37438a(0x17c));if(_0x1ba9fb<=0x0)throw CliErrors[_0x37438a(0x193)](_0x37438a(0x17e));if(_0x1ba9fb>_0x420f0f)throw CliErrors[_0x37438a(0x193)](_0x37438a(0x18c));const _0x23fbe9=readPositiveInteger(_0x1c0a7b[_0x37438a(0x185)](_0x37438a(0x17d),DEFAULT_LIMIT),_0x37438a(0x188));if(_0x23fbe9>MAX_LIMIT)throw CliErrors['validation'](_0x37438a(0x190)+MAX_LIMIT+'.');const _0x25896=_0x1c0a7b['str']('level')[_0x37438a(0x17f)]()[_0x37438a(0x18b)]()||undefined,_0x2470e2=_0x1c0a7b['str'](_0x37438a(0x172))[_0x37438a(0x17f)]()||undefined;return{'appCode':_0x1c0a7b['appCode'],'startTime':_0x1ba9fb,'endTime':_0x420f0f,..._0x1f9468===undefined?{'sinceMinutes':readSinceMinutes(_0x1c0a7b)}:{},..._0x25896?{'level':_0x25896}:{},..._0x2470e2?{'keyword':_0x2470e2}:{},'limit':_0x23fbe9};}function readSinceMinutes(_0x5bb058){const _0x11445a=a42_0x3ce3d4;return readPositiveInteger(_0x5bb058[_0x11445a(0x185)](_0x11445a(0x18a),DEFAULT_SINCE_MINUTES),_0x11445a(0x194));}function readPositiveInteger(_0x56dc22,_0x25a9d5){const _0x21fe4e=a42_0x3ce3d4;if(!Number[_0x21fe4e(0x186)](_0x56dc22)||_0x56dc22<=0x0)throw CliErrors[_0x21fe4e(0x193)](_0x25a9d5+_0x21fe4e(0x174));return _0x56dc22;}function a42_0x2732(_0x2cfce1,_0x27ed7b){_0x2cfce1=_0x2cfce1-0x16b;const _0x45a59f=a42_0x45a5();let _0x273252=_0x45a59f[_0x2cfce1];return _0x273252;}export const bffLogs={'service':a42_0x3ce3d4(0x192),'command':a42_0x3ce3d4(0x191),'description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':a42_0x3ce3d4(0x181),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x3ce3d4(0x18a),'type':a42_0x3ce3d4(0x17a),'description':a42_0x3ce3d4(0x18d)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x3ce3d4(0x177),'type':a42_0x3ce3d4(0x17a),'description':a42_0x3ce3d4(0x171)},{'name':'end-time','type':a42_0x3ce3d4(0x17a),'description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0x3ce3d4(0x175),'type':'string','description':a42_0x3ce3d4(0x178),'enum':LOG_LEVELS},{'name':a42_0x3ce3d4(0x172),'type':a42_0x3ce3d4(0x195),'description':'Filter\x20formatted\x20log\x20lines\x20by\x20keyword'},{'name':'limit','type':a42_0x3ce3d4(0x17a),'description':a42_0x3ce3d4(0x16f)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x28bc50){resolveBffLogQuery(_0x28bc50);},async 'execute'(_0x402346){const _0xde45ef=a42_0x3ce3d4,_0x324a56=resolveBffLogQuery(_0x402346),{sinceMinutes:_0x11a7d6,..._0x526066}=_0x324a56,_0x19a329=await searchBffScriptLogs(_0x526066);return{'ok':!![],'data':{'query':_0x324a56,'count':_0x19a329[_0xde45ef(0x180)],'logs':_0x19a329},'message':_0x19a329['length']===0x0?_0xde45ef(0x17b):'Found\x20'+_0x19a329[_0xde45ef(0x180)]+'\x20Backend\x20Function\x20log\x20line(s).'};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x43b08b=a43_0x35f6;(function(_0x5c41de,_0x486d9a){const _0x57c4a9=a43_0x35f6,_0x408509=_0x5c41de();while(!![]){try{const _0x5ad49c=parseInt(_0x57c4a9(0x147))/0x1*(parseInt(_0x57c4a9(0x137))/0x2)+parseInt(_0x57c4a9(0x10c))/0x3+parseInt(_0x57c4a9(0x108))/0x4+parseInt(_0x57c4a9(0x169))/0x5*(parseInt(_0x57c4a9(0x143))/0x6)+-parseInt(_0x57c4a9(0x10a))/0x7*(parseInt(_0x57c4a9(0x15f))/0x8)+-parseInt(_0x57c4a9(0x15c))/0x9+-parseInt(_0x57c4a9(0x142))/0xa;if(_0x5ad49c===_0x486d9a)break;else _0x408509['push'](_0x408509['shift']());}catch(_0x1daf60){_0x408509['push'](_0x408509['shift']());}}}(a43_0x4def,0xd1f6a));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';function a43_0x4def(){const _0x34b905=['version','flatMap','cancelled','boolean','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','stringify','alias','HOOK/','functions','\x22:\x20','length','mode','message','2959716GpFyzT','toLowerCase','26985Sgehlr','newDirectory','1741626ZmMnUr','remoteId','lastSync','profileName','push','some','Pull\x20only\x20this\x20script\x20type','str','operationType','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','content','stdin','scriptType','includes','scriptContent','code','join','requires','conflict','datasetCode','get','/api/management/library/scripts/list?appCode=','.hook-directory-migrate-','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','\x20failed','entry','appCode','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','\x20--format\x20compress','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','entries','oldDirectoryPath','pull','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','nonInteractive','set','values','skipped','validation','dev','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','mergedCli','34sBMiRT','currentApp','Force\x20overwrite\x20local\x20unsynced\x20changes','split','question','yes','Pull\x20complete:\x20','sourceDirectoryPathByNewDirectory','string','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','type','14565020uhUzrZ','90YCfldH','functionNode','lockKey','close','34789KQOuCw','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','has','\x20conflict','\x22\x20to\x20\x22','lockFilePath','keyChanges','newDirectoryPath','.js','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','HOOK','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','GET','trim','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','oldLockKey','&type=','Force\x20pull\x20cancelled.','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Failed\x20to\x20write\x20local\x20script\x20\x22','7133373mnOOuG','\x20skipped','require','248LRupKI','hookLocation','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','write','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','newLockKey','existed','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Would\x20inspect\x20','rollback','438910JwKUUs','read','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','BFF_LOCAL_UNSYNCED','reverse','\x22;\x20temporary\x20directory\x20\x22','ino','oldDirectory','filter','bool','projectedFunctions','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','scriptsRootDir','push_local','unresolvable\x20target\x20path','scriptsRoot','defaultApp','would_pull','normalize','ENDPOINT','\x22\x20may\x20remain.','rekey','selectedAppName','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','COMMON','stderr','sourceFilePathByNewLockKey','ENOENT','\x20--name\x20','map','Could\x20not\x20restore\x20local\x20script\x20\x22','\x22:\x20both\x20target\x20\x22','\x20pulled','Lock\x20scope\x20for\x20app\x20\x22','force','filePath','Remote\x20script\x20missing\x20id.','migrations','apiDir','Cannot\x20migrate\x20HOOK\x20directory\x20\x22'];a43_0x4def=function(){return _0x34b905;};return a43_0x4def();}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':'bff','command':a43_0x43b08b(0x12c),'description':a43_0x43b08b(0x15a),'risk':a43_0x43b08b(0x16a),'structuredErrors':!![],'flags':[{'name':a43_0x43b08b(0x141),'type':a43_0x43b08b(0x13f),'description':a43_0x43b08b(0x112),'enum':[a43_0x43b08b(0xeb),a43_0x43b08b(0xe6),'HOOK']},{'name':a43_0x43b08b(0xf5),'type':a43_0x43b08b(0xfe),'description':a43_0x43b08b(0x139)}],async 'dryRun'(_0x20dd77){const _0x475ea1=a43_0x43b08b,_0xf2e646=loadBffProjectConfig(_0x20dd77['appCode']),_0x1d0a83=await readBffLockFile(_0xf2e646[_0x475ea1(0x14c)]),{appLock:_0x16d7b4}=ensureLockScope(_0x1d0a83??createEmptyBffLock(),_0x20dd77[_0x475ea1(0x126)],_0xf2e646[_0x475ea1(0xe2)],'pull'),_0x57c231=normalizeBffType(_0x20dd77[_0x475ea1(0x113)](_0x475ea1(0x141)))??undefined,[_0x1c0d27,_0x539a11]=await Promise['all']([listBffScripts(_0x20dd77[_0x475ea1(0x126)],_0x57c231),getBffScriptStatistics(_0x20dd77[_0x475ea1(0x126)])]),_0x370ef4=_0x1c0d27[_0x475ea1(0x111)](_0x550e70=>normalizeBffType(_0x550e70[_0x475ea1(0x118)])===_0x475ea1(0x151)),_0x57e4fb=_0x370ef4?buildDatasetCodeToAliasMap(_0x20dd77[_0x475ea1(0xf9)],_0x20dd77[_0x475ea1(0x126)],_0x20dd77[_0x475ea1(0xe9)]||_0x20dd77[_0x475ea1(0x136)]?.[_0x475ea1(0x138)]||_0x20dd77[_0x475ea1(0x136)]?.[_0x475ea1(0xe3)]):new Map(),_0x5683b9=_0x370ef4?await planHookDirectoryMigration(_0xf2e646,_0x16d7b4,_0x57e4fb,await scanLocalBffFunctions(_0xf2e646,_0x475ea1(0x151))):undefined,_0x51eadf=createHookLocationMap(_0x539a11),_0x48f82f=[];for(const _0xdd5dc7 of _0x1c0d27){const _0x3dd6a9=resolveRemoteScriptTarget(_0xf2e646,_0xdd5dc7,_0x51eadf,_0x5683b9?.[_0x475ea1(0xdd)]??_0x16d7b4[_0x475ea1(0x103)],_0x57e4fb);if(!_0x3dd6a9){_0x48f82f['push']({'scriptType':_0xdd5dc7['scriptType'],'functionName':_0xdd5dc7['functionName']??'','status':_0x475ea1(0x132),'reason':_0x475ea1(0xe1)});continue;}const _0x13aa39=(_0x5683b9?.[_0x475ea1(0xdd)]??_0x16d7b4[_0x475ea1(0x103)])[_0x3dd6a9[_0x475ea1(0x145)]],_0x922e4=_0xdd5dc7[_0x475ea1(0x11a)]!=null?computeContentHash(_0xdd5dc7[_0x475ea1(0x11a)]):undefined,_0x5b6e58=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x5683b9,_0x3dd6a9)??_0x3dd6a9[_0x475ea1(0xf6)],_0x13aa39,_0x922e4),_0x28e73f=_0x5b6e58?localUnsyncedConflict(_0x3dd6a9,_0xdd5dc7['id']):undefined;_0x48f82f[_0x475ea1(0x110)]({'lockKey':_0x3dd6a9['lockKey'],'filePath':_0x3dd6a9[_0x475ea1(0xf6)],'remoteId':_0xdd5dc7['id']??null,'status':_0x28e73f?_0x475ea1(0x11e):_0x475ea1(0xe4),..._0x28e73f?{'conflict':_0x28e73f}:{},..._0x3dd6a9[_0x475ea1(0x160)]?{'alias':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x101)]??null,'datasetCode':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x11f)],'operationType':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x114)],'functionNode':_0x3dd6a9[_0x475ea1(0x160)][_0x475ea1(0x144)]}:{}});}return{'method':_0x475ea1(0x154),'url':_0x475ea1(0x121)+_0x20dd77[_0x475ea1(0x126)]+(_0x57c231?_0x475ea1(0x158)+_0x57c231:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x20dd77['appCode'],'filterType':_0x57c231??null,..._0x5683b9&&_0x5683b9[_0x475ea1(0xf8)][_0x475ea1(0x105)]>0x0?{'hookDirectoryMigrations':_0x5683b9[_0x475ea1(0xf8)][_0x475ea1(0xf0)](_0x3f3809=>({'from':_0x3f3809['oldDirectory'],'to':_0x3f3809[_0x475ea1(0x10b)]}))}:{},'files':_0x48f82f},'description':_0x475ea1(0x167)+_0x48f82f[_0x475ea1(0x105)]+_0x475ea1(0x135)};},async 'execute'(_0x586e2a){const _0x383817=a43_0x43b08b,_0x2e6338=loadBffProjectConfig(_0x586e2a[_0x383817(0x126)]),_0x4ed4c7=await readBffLockFile(_0x2e6338['lockFilePath']),{lockData:_0x12af0b,appLock:_0xa95aa9}=ensureLockScope(_0x4ed4c7??createEmptyBffLock(),_0x586e2a[_0x383817(0x126)],_0x2e6338[_0x383817(0xe2)],_0x383817(0x12c)),_0x858031=normalizeBffType(_0x586e2a[_0x383817(0x113)](_0x383817(0x141)))??undefined;if(_0x586e2a[_0x383817(0x113)](_0x383817(0x141))&&!_0x858031)throw CliErrors[_0x383817(0x133)](_0x383817(0x12d));const [_0x2e1db6,_0x301d5d]=await Promise['all']([listBffScripts(_0x586e2a[_0x383817(0x126)],_0x858031),getBffScriptStatistics(_0x586e2a['appCode'])]);if(_0x2e1db6[_0x383817(0x105)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x383817(0xea)};const _0x4da893=_0x586e2a[_0x383817(0xdc)](_0x383817(0xf5));if(_0x4da893&&!_0x586e2a[_0x383817(0x12f)]){const _0x539935=await confirmForce();if(!_0x539935)throw CliErrors[_0x383817(0xfd)](_0x383817(0x159));}if(_0x4da893&&_0x586e2a[_0x383817(0x12f)]){}const _0x2e8489=_0x2e1db6[_0x383817(0x111)](_0x47f83e=>normalizeBffType(_0x47f83e[_0x383817(0x118)])===_0x383817(0x151)),_0xee4bbc=_0x2e8489?buildDatasetCodeToAliasMap(_0x586e2a[_0x383817(0xf9)],_0x586e2a[_0x383817(0x126)],_0x586e2a[_0x383817(0xe9)]||_0x586e2a[_0x383817(0x136)]?.[_0x383817(0x138)]||_0x586e2a[_0x383817(0x136)]?.[_0x383817(0xe3)]):new Map(),_0x340a95=createHookLocationMap(_0x301d5d),_0x63fa27=JSON['parse'](JSON[_0x383817(0x100)](_0x12af0b)),_0x14b735=_0x586e2a[_0x383817(0x126)],_0xad6be3=_0x63fa27['apps'][_0x14b735];if(!_0xad6be3)throw new Error(_0x383817(0xf4)+_0x14b735+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x3b48ca=_0x2e8489?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x2e6338,_0xad6be3,_0xee4bbc,await scanLocalBffFunctions(_0x2e6338,_0x383817(0x151))),_0xad6be3):undefined,_0x14e4b4=createPullFileTransaction(),_0x43709e=[],_0x1831a4=[],_0x193d8d=[],_0x38b54e=[];for(const _0x3b9675 of _0x2e1db6){const _0x36899c=resolveRemoteScriptTarget(_0x2e6338,_0x3b9675,_0x340a95,_0xad6be3[_0x383817(0x103)],_0xee4bbc);if(!_0x36899c){_0x1831a4['push']({'lockKey':_0x3b9675['scriptType']+'/'+_0x3b9675['functionName'],'reason':_0x383817(0xe1)});continue;}const _0x14f9b5=_0xad6be3['functions'][_0x36899c[_0x383817(0x145)]];try{if(!_0x3b9675['id'])throw new Error(_0x383817(0xf7));if(_0x3b9675[_0x383817(0x11a)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x229b3c=_0x3b9675[_0x383817(0x11a)],_0x488b57=computeContentHash(_0x229b3c);if(!_0x4da893){const _0x45de7a=await hasUnsyncedLocalChanges(_0x36899c[_0x383817(0xf6)],_0x14f9b5,_0x488b57);if(_0x45de7a){_0x193d8d[_0x383817(0x110)](localUnsyncedConflict(_0x36899c,_0x3b9675['id']));continue;}}await _0x14e4b4[_0x383817(0x162)](_0x36899c[_0x383817(0xf6)],_0x229b3c);const _0x5d443b={'hash':_0x488b57,'remoteId':_0x3b9675['id'],'version':_0x3b9675[_0x383817(0xfb)]};_0x36899c[_0x383817(0x141)]===_0x383817(0x151)&&_0x36899c['hookLocation']&&(_0x5d443b[_0x383817(0x101)]=_0x36899c[_0x383817(0x160)][_0x383817(0x101)],_0x5d443b[_0x383817(0x11f)]=_0x36899c[_0x383817(0x160)]['datasetCode'],_0x5d443b[_0x383817(0x114)]=_0x36899c[_0x383817(0x160)][_0x383817(0x114)],_0x5d443b[_0x383817(0x144)]=_0x36899c[_0x383817(0x160)][_0x383817(0x144)]),_0xad6be3['functions'][_0x36899c[_0x383817(0x145)]]=_0x5d443b,_0x43709e[_0x383817(0x110)]({'lockKey':_0x36899c[_0x383817(0x145)],'remoteId':_0x3b9675['id']});}catch(_0x216f03){_0x38b54e['push']({'lockKey':_0x36899c['lockKey'],'error':_0x216f03 instanceof Error?_0x216f03[_0x383817(0x107)]:String(_0x216f03)});}}_0xad6be3['lastSync']=new Date()['toISOString']();try{await writeBffLockFile(_0x2e6338[_0x383817(0x14c)],_0x63fa27);}catch(_0x5b4f57){const _0x31185c=[...await _0x14e4b4['rollback'](),...await _0x3b48ca?.[_0x383817(0x168)]()??[]];throw withRollbackErrors(_0x5b4f57,_0x383817(0x16b),_0x31185c);}return{'ok':_0x38b54e[_0x383817(0x105)]===0x0,'data':{'pulled':_0x43709e,'skipped':_0x1831a4,'conflicts':_0x193d8d,'failed':_0x38b54e},'message':formatPullMessage(_0x43709e[_0x383817(0x105)],_0x1831a4[_0x383817(0x105)],_0x193d8d[_0x383817(0x105)],_0x38b54e[_0x383817(0x105)])};}};function localUnsyncedConflict(_0x16eda9,_0x4f340c){const _0x52c39b=a43_0x43b08b,_0x483f78=_0x16eda9[_0x52c39b(0x145)]['split']('/')['at'](-0x1);return{'code':_0x52c39b(0x16c),'lockKey':_0x16eda9[_0x52c39b(0x145)],'filePath':_0x16eda9[_0x52c39b(0xf6)],..._0x4f340c!=null?{'remoteId':_0x4f340c}:{},'message':_0x52c39b(0x161),'nextAction':{'action':_0x52c39b(0xe0),'command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x16eda9[_0x52c39b(0x141)]+_0x52c39b(0xef)+_0x483f78+_0x52c39b(0x128),'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(_0x48ea72,_0x150890,_0x1befdd,_0x419c7e){const _0x13f259=a43_0x43b08b,_0x3e7e1c=[_0x13f259(0x13d)+_0x48ea72+_0x13f259(0xf3),_0x150890+_0x13f259(0x15d)];_0x1befdd>0x0&&_0x3e7e1c['push'](_0x1befdd+_0x13f259(0x14a)+(_0x1befdd===0x1?'':'s')+'\x20'+(_0x1befdd===0x1?_0x13f259(0x11d):_0x13f259(0x15e))+'\x20resolution');if(_0x419c7e>0x0)_0x3e7e1c['push'](_0x419c7e+_0x13f259(0x124));return _0x3e7e1c[_0x13f259(0x11c)](',\x20');}function a43_0x35f6(_0x1d02e1,_0x384ed5){_0x1d02e1=_0x1d02e1-0xda;const _0x4def8a=a43_0x4def();let _0x35f6f2=_0x4def8a[_0x1d02e1];return _0x35f6f2;}async function hasUnsyncedLocalChanges(_0x4ba554,_0xc613cc,_0x8d3c6b){if(!await fileExists(_0x4ba554))return![];const _0x2f1905=await computeFileHash(_0x4ba554);if(!_0xc613cc)return _0x8d3c6b?_0x2f1905!==_0x8d3c6b:!![];return _0x2f1905!==_0xc613cc['hash'];}function createPullFileTransaction(){const _0xf6ebeb=new Map(),_0x466851=async(_0x51f56b,_0x284626)=>{const _0x12b850=a43_0x35f6;try{if(_0x284626[_0x12b850(0x165)])await ensureParentDirectory(_0x51f56b),await writeFile(_0x51f56b,_0x284626[_0x12b850(0x116)]);else try{await unlink(_0x51f56b);}catch(_0x3e9217){if(_0x3e9217[_0x12b850(0x11b)]!==_0x12b850(0xee))throw _0x3e9217;}return undefined;}catch(_0x4e1604){return _0x4e1604 instanceof Error?_0x4e1604:new Error(String(_0x4e1604));}};return{async 'write'(_0x418b1a,_0xcf5af1){const _0x5135ea=a43_0x35f6;if(!_0xf6ebeb[_0x5135ea(0x149)](_0x418b1a))try{_0xf6ebeb[_0x5135ea(0x130)](_0x418b1a,{'existed':!![],'content':await readFile(_0x418b1a)});}catch(_0x4808de){if(_0x4808de[_0x5135ea(0x11b)]!=='ENOENT')throw _0x4808de;_0xf6ebeb[_0x5135ea(0x130)](_0x418b1a,{'existed':![]});}try{await ensureParentDirectory(_0x418b1a),await writeFile(_0x418b1a,_0xcf5af1,'utf8');}catch(_0x2dd1b3){const _0x2e3e12=await _0x466851(_0x418b1a,_0xf6ebeb[_0x5135ea(0x120)](_0x418b1a));if(!_0x2e3e12)_0xf6ebeb['delete'](_0x418b1a);throw withRollbackErrors(_0x2dd1b3,_0x5135ea(0x15b)+_0x418b1a+'\x22.',_0x2e3e12?[_0x2e3e12]:[]);}},async 'rollback'(){const _0x2e90ca=a43_0x35f6,_0x12f8c7=[];for(const [_0x72f6b9,_0x5d318f]of[..._0xf6ebeb[_0x2e90ca(0x12a)]()][_0x2e90ca(0x16d)]()){const _0x230d83=await _0x466851(_0x72f6b9,_0x5d318f);_0x230d83&&_0x12f8c7['push'](new Error(_0x2e90ca(0xf1)+_0x72f6b9+'\x22:\x20'+_0x230d83[_0x2e90ca(0x107)]));}return _0x12f8c7;}};}function withRollbackErrors(_0x46a7d2,_0x3d00ac,_0x2b0bbc){const _0x324400=a43_0x43b08b,_0x13bf94=_0x46a7d2 instanceof Error?_0x46a7d2:new Error(String(_0x46a7d2));if(_0x2b0bbc['length']===0x0)return _0x13bf94;return new AggregateError([_0x13bf94,..._0x2b0bbc],_0x3d00ac+'\x20Recovery\x20errors:\x20'+_0x2b0bbc[_0x324400(0xf0)](_0x1558db=>_0x1558db['message'])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x5e1a6f,_0x2bdc4e,_0x4ad510){const _0x177194=a43_0x43b08b,_0x29da15=resolveApiModelSource(_0x5e1a6f,_0x2bdc4e,_0x4ad510),_0x39ec33=loadAliasMap(_0x5e1a6f,undefined,_0x29da15[_0x177194(0xf6)],_0x29da15[_0x177194(0x10f)]);return assertUnambiguousHookAliases(_0x39ec33),new Map(_0x39ec33[_0x177194(0xf0)](_0x21ef19=>[_0x21ef19[_0x177194(0x11f)][_0x177194(0x109)](),_0x21ef19['alias']]));}async function planHookDirectoryMigration(_0x1f8ba8,_0xbc4ef3,_0x5b6b1f,_0xc93b7f){const _0x168528=a43_0x43b08b,_0x2959d8=new Map();for(const [_0x462440,_0x166ec9]of Object[_0x168528(0x12a)](_0xbc4ef3[_0x168528(0x103)])){const [_0x242e16,_0x55d6df,_0x2e2492,_0x4f698d,_0x40dfea,..._0x13c5ff]=_0x462440[_0x168528(0x13a)]('/');if(_0x242e16!=='HOOK'||!_0x55d6df||!_0x2e2492||!_0x4f698d||!_0x40dfea||_0x13c5ff[_0x168528(0x105)]>0x0||!_0x166ec9[_0x168528(0x11f)])continue;const _0x3b37aa=_0x5b6b1f[_0x168528(0x120)](_0x166ec9[_0x168528(0x11f)][_0x168528(0x109)]()),_0x2db6de=_0x3b37aa??_0x166ec9[_0x168528(0x11f)];if(!isSafeHookDirectorySegment(_0x55d6df))throw CliErrors['validation']('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x55d6df+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x2db6de))throw CliErrors['validation'](_0x168528(0xfa)+_0x55d6df+_0x168528(0x115));if(_0x55d6df===_0x2db6de)continue;const _0x22936a=_0x2959d8[_0x168528(0x120)](_0x55d6df)??{'datasetCode':_0x166ec9[_0x168528(0x11f)],'alias':_0x3b37aa,'keyChanges':[]};if(_0x22936a[_0x168528(0x11f)]!==_0x166ec9[_0x168528(0x11f)])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x55d6df+_0x168528(0xde));const _0x182a6a=_0x168528(0x102)+_0x2db6de+'/'+_0x2e2492+'/'+_0x4f698d+'/'+_0x40dfea;try{resolveLocalFilePathFromLockKey(_0x1f8ba8,_0x462440),resolveLocalFilePathFromLockKey(_0x1f8ba8,_0x182a6a);}catch(_0x180dc8){throw CliErrors[_0x168528(0x133)](_0x168528(0x148)+_0x462440+_0x168528(0x104)+(_0x180dc8 instanceof Error?_0x180dc8[_0x168528(0x107)]:String(_0x180dc8)));}_0x22936a[_0x168528(0x14d)][_0x168528(0x110)]({'oldLockKey':_0x462440,'newLockKey':_0x182a6a,'entry':_0x166ec9}),_0x2959d8[_0x168528(0x130)](_0x55d6df,_0x22936a);}const _0x323344=new Set([..._0x2959d8[_0x168528(0x131)]()][_0x168528(0xfc)](_0x5d1e2c=>_0x5d1e2c[_0x168528(0x14d)][_0x168528(0xf0)](_0x5e6d9f=>_0x5e6d9f[_0x168528(0x157)]))),_0x38280b=new Map(),_0x24243b=new Map();for(const [_0x328d7b,_0x36bef7]of _0x2959d8){const _0x5a1a92=_0x36bef7['alias']??_0x36bef7['datasetCode'],_0x325cf5=hookDirectoryIdentity(_0x5a1a92),_0x2daeac=_0x38280b[_0x168528(0x120)](_0x325cf5);if(_0x2daeac&&_0x2daeac!==_0x328d7b)throw CliErrors[_0x168528(0x133)](_0x168528(0x150)+_0x2daeac+'\x22\x20and\x20\x22'+_0x328d7b+'\x22:\x20both\x20target\x20\x22'+_0x5a1a92+_0x168528(0x140));_0x38280b[_0x168528(0x130)](_0x325cf5,_0x328d7b);for(const _0x5a1763 of _0x36bef7['keyChanges']){const _0x171c75=_0x24243b[_0x168528(0x120)](_0x5a1763['newLockKey']);if(_0x171c75&&_0x171c75!==_0x5a1763[_0x168528(0x157)])throw CliErrors[_0x168528(0x133)](_0x168528(0x129)+_0x171c75+'\x22\x20and\x20\x22'+_0x5a1763[_0x168528(0x157)]+_0x168528(0xf2)+_0x5a1763[_0x168528(0x164)]+_0x168528(0x12e));if(_0x323344['has'](_0x5a1763['newLockKey']))throw CliErrors[_0x168528(0x133)](_0x168528(0x152)+_0x5a1763[_0x168528(0x157)]+'\x22:\x20its\x20target\x20\x22'+_0x5a1763[_0x168528(0x164)]+'\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');_0x24243b[_0x168528(0x130)](_0x5a1763[_0x168528(0x164)],_0x5a1763['oldLockKey']);}}const _0x451dfe=new Map();for(const [_0x210381,_0x145b2e]of _0x5b6b1f){_0x451dfe['set'](hookDirectoryIdentity(_0x145b2e),_0x210381);}const _0x115519=[];for(const [_0x21017e,_0x44cabd]of _0x2959d8){const _0x16b346=_0x44cabd[_0x168528(0x101)]??_0x44cabd[_0x168528(0x11f)],_0xd84c5=join(_0x1f8ba8[_0x168528(0xdf)],_0x168528(0x151),_0x21017e),_0x5d5fb5=join(_0x1f8ba8[_0x168528(0xdf)],'HOOK',_0x16b346),_0xdcb96e=await directoryExists(_0xd84c5),_0x201372=await directoryExists(_0x5d5fb5),_0x175960=_0xdcb96e?_0x201372?await sameDirectory(_0xd84c5,_0x5d5fb5)?'case-rename':undefined:'move':'rekey';if(!_0x175960)throw CliErrors[_0x168528(0x133)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x21017e+'\x22\x20to\x20\x22'+_0x16b346+_0x168528(0x127));const _0xcc062c=_0x451dfe[_0x168528(0x120)](hookDirectoryIdentity(_0x21017e));if(_0xcc062c&&_0xcc062c!==_0x44cabd[_0x168528(0x11f)][_0x168528(0x109)]()){const _0x3ec37d=new Set(_0x44cabd[_0x168528(0x14d)][_0x168528(0xf0)](_0x52ab8b=>_0x52ab8b['oldLockKey'])),_0x12b62c=_0xc93b7f[_0x168528(0xdb)](_0x5768a5=>_0x5768a5[_0x168528(0x141)]===_0x168528(0x151)&&_0x5768a5['alias']!=null&&hookDirectoryIdentity(_0x5768a5[_0x168528(0x101)])===hookDirectoryIdentity(_0x21017e)&&!_0x3ec37d[_0x168528(0x149)](_0x5768a5[_0x168528(0x145)]));if(_0x12b62c[_0x168528(0x105)]>0x0)throw CliErrors['validation'](_0x168528(0xfa)+_0x21017e+_0x168528(0x163));}const _0x268e6c=_0x451dfe[_0x168528(0x120)](hookDirectoryIdentity(_0x16b346));if(_0x268e6c&&_0x268e6c!==_0x44cabd[_0x168528(0x11f)][_0x168528(0x109)]())throw CliErrors[_0x168528(0x133)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x21017e+'\x22\x20to\x20\x22'+_0x16b346+_0x168528(0x153));for(const _0x52f992 of _0x44cabd[_0x168528(0x14d)]){const _0x1f2517=_0xbc4ef3[_0x168528(0x103)][_0x52f992[_0x168528(0x164)]];if(_0x1f2517&&!_0x323344[_0x168528(0x149)](_0x52f992[_0x168528(0x164)])&&!sameHookIdentity(_0x52f992[_0x168528(0x125)],_0x1f2517))throw CliErrors[_0x168528(0x133)](_0x168528(0xfa)+_0x21017e+_0x168528(0x14b)+_0x16b346+_0x168528(0xff));}_0x115519[_0x168528(0x110)]({'oldDirectory':_0x21017e,'newDirectory':_0x16b346,'oldDirectoryPath':_0xd84c5,'newDirectoryPath':_0x5d5fb5,'mode':_0x175960,'alias':_0x44cabd[_0x168528(0x101)],'keyChanges':_0x44cabd[_0x168528(0x14d)]});}const _0x2b922e={..._0xbc4ef3[_0x168528(0x103)]},_0x3893ad=new Map(),_0x11c2a4=new Map();for(const _0x3b1cc9 of _0x115519){const _0x1bf130=_0x3b1cc9['mode']!==_0x168528(0xe8);_0x1bf130&&_0x11c2a4[_0x168528(0x130)](hookDirectoryIdentity(_0x3b1cc9['newDirectory']),_0x3b1cc9[_0x168528(0x12b)]);for(const _0x3f9601 of _0x3b1cc9['keyChanges']){const _0x8d7456=_0x2b922e[_0x3f9601[_0x168528(0x164)]],_0x1c4698=_0x1bf130?_0x3f9601[_0x168528(0x125)]:_0x8d7456??_0x3f9601[_0x168528(0x125)];_0x2b922e[_0x3f9601['newLockKey']]=canonicalizeHookEntry(_0x1c4698,_0x3b1cc9['alias']),delete _0x2b922e[_0x3f9601[_0x168528(0x157)]],_0x1bf130&&_0x3893ad[_0x168528(0x130)](_0x3f9601[_0x168528(0x164)],resolveLocalFilePathFromLockKey(_0x1f8ba8,_0x3f9601[_0x168528(0x157)]));}}return{'migrations':_0x115519,'projectedFunctions':_0x2b922e,'sourceFilePathByNewLockKey':_0x3893ad,'sourceDirectoryPathByNewDirectory':_0x11c2a4};}function resolveMigratedSourceFilePath(_0x566827,_0x529907){const _0x15d5ee=a43_0x43b08b;if(!_0x566827||!_0x529907)return undefined;const _0x323b8e=_0x566827[_0x15d5ee(0xed)][_0x15d5ee(0x120)](_0x529907['lockKey']);if(_0x323b8e)return _0x323b8e;if(_0x529907['type']!=='HOOK')return undefined;const [,_0x1ae5bd,..._0xe325cf]=_0x529907['lockKey'][_0x15d5ee(0x13a)]('/');if(!_0x1ae5bd||_0xe325cf[_0x15d5ee(0x105)]===0x0)return undefined;const _0x3a07f9=_0x566827[_0x15d5ee(0x13e)][_0x15d5ee(0x120)](hookDirectoryIdentity(_0x1ae5bd));return _0x3a07f9?join(_0x3a07f9,..._0xe325cf)+_0x15d5ee(0x14f):undefined;}function sameHookIdentity(_0xf94da4,_0x372208){const _0x323ad6=a43_0x43b08b;return _0xf94da4[_0x323ad6(0x10d)]===_0x372208[_0x323ad6(0x10d)]&&_0xf94da4[_0x323ad6(0x11f)]===_0x372208[_0x323ad6(0x11f)]&&_0xf94da4[_0x323ad6(0x114)]===_0x372208[_0x323ad6(0x114)]&&_0xf94da4['functionNode']===_0x372208[_0x323ad6(0x144)];}function canonicalizeHookEntry(_0x357ef5,_0x200581){const {alias:_0x7cb840,..._0x5744e7}=_0x357ef5;return _0x200581?{..._0x5744e7,'alias':_0x200581}:_0x5744e7;}function hookDirectoryIdentity(_0x2f1784){const _0x1d9dd0=a43_0x43b08b;return _0x2f1784[_0x1d9dd0(0xe5)]('NFC')[_0x1d9dd0(0x109)]();}function isSafeHookDirectorySegment(_0xe03fe2){return isSafeLockKeySegment(_0xe03fe2);}async function sameDirectory(_0x3e745a,_0x4ab009){const _0x1805ec=a43_0x43b08b,[_0x14732e,_0xd0f1ba]=await Promise['all']([stat(_0x3e745a),stat(_0x4ab009)]);return _0x14732e[_0x1805ec(0x134)]===_0xd0f1ba[_0x1805ec(0x134)]&&_0x14732e['ino']===_0xd0f1ba[_0x1805ec(0x16f)];}async function applyHookDirectoryMigration(_0x26926e,_0x3de425){const _0x4efb6a=a43_0x43b08b,_0x4176e2=_0x3de425[_0x4efb6a(0x103)],_0x5372fe=_0x3de425[_0x4efb6a(0x10e)],_0x3d314d=[],_0x107dde=async()=>{const _0x14d566=_0x4efb6a,_0x3bcf13=[];_0x3de425['functions']=_0x4176e2,_0x3de425[_0x14d566(0x10e)]=_0x5372fe;for(const {migration:_0x407fa2,temporaryPath:_0x4902d8}of[..._0x3d314d]['reverse']()){try{_0x4902d8?(await rename(_0x407fa2[_0x14d566(0x14e)],_0x4902d8),await rename(_0x4902d8,_0x407fa2[_0x14d566(0x12b)])):await rename(_0x407fa2[_0x14d566(0x14e)],_0x407fa2[_0x14d566(0x12b)]);}catch(_0x555f2a){_0x3bcf13['push'](new Error(_0x14d566(0x123)+_0x407fa2[_0x14d566(0xda)]+'\x22\x20from\x20\x22'+_0x407fa2[_0x14d566(0x10b)]+'\x22:\x20'+(_0x555f2a instanceof Error?_0x555f2a[_0x14d566(0x107)]:String(_0x555f2a))));}}return _0x3bcf13;};try{for(const _0x185e89 of _0x26926e[_0x4efb6a(0xf8)]){if(_0x185e89[_0x4efb6a(0x106)]==='move')await ensureParentDirectory(_0x185e89[_0x4efb6a(0x14e)]),await rename(_0x185e89[_0x4efb6a(0x12b)],_0x185e89[_0x4efb6a(0x14e)]),_0x3d314d[_0x4efb6a(0x110)]({'migration':_0x185e89});else{if(_0x185e89[_0x4efb6a(0x106)]==='case-rename'){const _0x2ccd57=join(dirname(_0x185e89[_0x4efb6a(0x12b)]),_0x4efb6a(0x122)+randomUUID());await rename(_0x185e89[_0x4efb6a(0x12b)],_0x2ccd57);try{await rename(_0x2ccd57,_0x185e89[_0x4efb6a(0x14e)]);}catch(_0x572bb8){try{await rename(_0x2ccd57,_0x185e89[_0x4efb6a(0x12b)]);}catch(_0x2fda1f){throw withRollbackErrors(_0x572bb8,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x185e89[_0x4efb6a(0xda)]+'\x22\x20to\x20\x22'+_0x185e89[_0x4efb6a(0x10b)]+_0x4efb6a(0x16e)+_0x2ccd57+_0x4efb6a(0xe7),[new Error('Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22'+_0x2ccd57+'\x22\x20to\x20\x22'+_0x185e89[_0x4efb6a(0xda)]+_0x4efb6a(0x104)+(_0x2fda1f instanceof Error?_0x2fda1f[_0x4efb6a(0x107)]:String(_0x2fda1f)))]);}throw _0x572bb8;}_0x3d314d[_0x4efb6a(0x110)]({'migration':_0x185e89,'temporaryPath':_0x2ccd57});}}}return _0x3de425['functions']=_0x26926e[_0x4efb6a(0xdd)],{'rollback':_0x107dde};}catch(_0xbfbb2c){const _0x587dd5=await _0x107dde();throw withRollbackErrors(_0xbfbb2c,_0x4efb6a(0x166),_0x587dd5);}}async function confirmForce(){const _0x58bd66=a43_0x43b08b,_0x2080b8=createInterface({'input':process[_0x58bd66(0x117)],'output':process[_0x58bd66(0xec)]}),_0x23fcd7=await new Promise(_0xfc74a4=>{const _0x22fdcf=_0x58bd66;_0x2080b8[_0x22fdcf(0x13b)](_0x22fdcf(0x156),_0xfc74a4);});return _0x2080b8[_0x58bd66(0x146)](),['y',_0x58bd66(0x13c)][_0x58bd66(0x119)](_0x23fcd7[_0x58bd66(0x155)]()[_0x58bd66(0x109)]());}
|
|
1
|
+
const a43_0x54976f=a43_0x510b;(function(_0x1a0188,_0x28c3c1){const _0x29bd38=a43_0x510b,_0xfb992a=_0x1a0188();while(!![]){try{const _0x12ee29=parseInt(_0x29bd38(0x22d))/0x1+parseInt(_0x29bd38(0x26a))/0x2+parseInt(_0x29bd38(0x26f))/0x3+parseInt(_0x29bd38(0x258))/0x4+parseInt(_0x29bd38(0x1ff))/0x5+-parseInt(_0x29bd38(0x257))/0x6*(-parseInt(_0x29bd38(0x25b))/0x7)+parseInt(_0x29bd38(0x202))/0x8*(-parseInt(_0x29bd38(0x246))/0x9);if(_0x12ee29===_0x28c3c1)break;else _0xfb992a['push'](_0xfb992a['shift']());}catch(_0x14f708){_0xfb992a['push'](_0xfb992a['shift']());}}}(a43_0x41eb,0x77ca5));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_0x54976f(0x276),'command':a43_0x54976f(0x25e),'description':a43_0x54976f(0x260),'risk':a43_0x54976f(0x1fd),'structuredErrors':!![],'flags':[{'name':a43_0x54976f(0x230),'type':a43_0x54976f(0x219),'description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x54976f(0x1f5),'ENDPOINT',a43_0x54976f(0x22a)]},{'name':a43_0x54976f(0x1e6),'type':a43_0x54976f(0x26b),'description':a43_0x54976f(0x255)}],async 'dryRun'(_0x738562){const _0x41fa42=a43_0x54976f,_0x1f232f=loadBffProjectConfig(_0x738562[_0x41fa42(0x20c)]),_0x28d9a5=await readBffLockFile(_0x1f232f['lockFilePath']),{appLock:_0x15be34}=ensureLockScope(_0x28d9a5??createEmptyBffLock(),_0x738562['appCode'],_0x1f232f[_0x41fa42(0x233)],_0x41fa42(0x25e)),_0x44546a=normalizeBffType(_0x738562[_0x41fa42(0x256)](_0x41fa42(0x230)))??undefined,[_0xffcc51,_0x22aa10]=await Promise[_0x41fa42(0x1e3)]([listBffScripts(_0x738562[_0x41fa42(0x20c)],_0x44546a),getBffScriptStatistics(_0x738562[_0x41fa42(0x20c)])]),_0x147cf2=_0xffcc51[_0x41fa42(0x212)](_0x52aace=>normalizeBffType(_0x52aace[_0x41fa42(0x205)])==='HOOK'),_0x1b6704=_0x147cf2?buildDatasetCodeToAliasMap(_0x738562[_0x41fa42(0x1f1)],_0x738562[_0x41fa42(0x20c)],_0x738562[_0x41fa42(0x239)]||_0x738562['mergedCli']?.['currentApp']||_0x738562[_0x41fa42(0x254)]?.[_0x41fa42(0x20f)]):new Map(),_0x2b64cb=_0x147cf2?await planHookDirectoryMigration(_0x1f232f,_0x15be34,_0x1b6704,await scanLocalBffFunctions(_0x1f232f,_0x41fa42(0x22a))):undefined,_0x16e129=createHookLocationMap(_0x22aa10),_0xdbd284=[];for(const _0x34966b of _0xffcc51){const _0x343ba1=resolveRemoteScriptTarget(_0x1f232f,_0x34966b,_0x16e129,_0x2b64cb?.[_0x41fa42(0x275)]??_0x15be34[_0x41fa42(0x244)],_0x1b6704);if(!_0x343ba1){_0xdbd284[_0x41fa42(0x21d)]({'scriptType':_0x34966b[_0x41fa42(0x205)],'functionName':_0x34966b[_0x41fa42(0x20d)]??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x82ac86=(_0x2b64cb?.[_0x41fa42(0x275)]??_0x15be34['functions'])[_0x343ba1[_0x41fa42(0x24f)]],_0x495048=_0x34966b['scriptContent']!=null?computeContentHash(_0x34966b[_0x41fa42(0x23b)]):undefined,_0x4129b8=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x2b64cb,_0x343ba1)??_0x343ba1['filePath'],_0x82ac86,_0x495048),_0x1eaa4a=_0x4129b8?localUnsyncedConflict(_0x343ba1,_0x34966b['id']):undefined;_0xdbd284['push']({'lockKey':_0x343ba1['lockKey'],'filePath':_0x343ba1[_0x41fa42(0x26e)],'remoteId':_0x34966b['id']??null,'status':_0x1eaa4a?_0x41fa42(0x1f4):_0x41fa42(0x1ea),..._0x1eaa4a?{'conflict':_0x1eaa4a}:{},..._0x343ba1['hookLocation']?{'alias':_0x343ba1['hookLocation']['alias']??null,'datasetCode':_0x343ba1[_0x41fa42(0x266)][_0x41fa42(0x249)],'operationType':_0x343ba1[_0x41fa42(0x266)][_0x41fa42(0x226)],'functionNode':_0x343ba1[_0x41fa42(0x266)]['functionNode']}:{}});}return{'method':'GET','url':_0x41fa42(0x20b)+_0x738562[_0x41fa42(0x20c)]+(_0x44546a?_0x41fa42(0x21e)+_0x44546a:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x738562[_0x41fa42(0x20c)],'filterType':_0x44546a??null,..._0x2b64cb&&_0x2b64cb['migrations'][_0x41fa42(0x209)]>0x0?{'hookDirectoryMigrations':_0x2b64cb[_0x41fa42(0x277)][_0x41fa42(0x262)](_0x1cab8b=>({'from':_0x1cab8b[_0x41fa42(0x273)],'to':_0x1cab8b[_0x41fa42(0x22c)]}))}:{},'files':_0xdbd284},'description':_0x41fa42(0x23a)+_0xdbd284[_0x41fa42(0x209)]+_0x41fa42(0x24e)};},async 'execute'(_0x5ebd89){const _0x40d251=a43_0x54976f,_0x6d59f3=loadBffProjectConfig(_0x5ebd89[_0x40d251(0x20c)]),_0x118efd=await readBffLockFile(_0x6d59f3[_0x40d251(0x217)]),{lockData:_0x1cda68,appLock:_0xa09d38}=ensureLockScope(_0x118efd??createEmptyBffLock(),_0x5ebd89[_0x40d251(0x20c)],_0x6d59f3[_0x40d251(0x233)],_0x40d251(0x25e)),_0x5e47b4=normalizeBffType(_0x5ebd89[_0x40d251(0x256)](_0x40d251(0x230)))??undefined;if(_0x5ebd89[_0x40d251(0x256)]('type')&&!_0x5e47b4)throw CliErrors[_0x40d251(0x264)](_0x40d251(0x236));const [_0x187265,_0x391f5e]=await Promise[_0x40d251(0x1e3)]([listBffScripts(_0x5ebd89['appCode'],_0x5e47b4),getBffScriptStatistics(_0x5ebd89['appCode'])]);if(_0x187265[_0x40d251(0x209)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x40d251(0x22f)};const _0x25f572=_0x5ebd89[_0x40d251(0x274)](_0x40d251(0x1e6));if(_0x25f572&&!_0x5ebd89[_0x40d251(0x203)]){const _0x3e7229=await confirmForce();if(!_0x3e7229)throw CliErrors[_0x40d251(0x232)](_0x40d251(0x259));}if(_0x25f572&&_0x5ebd89[_0x40d251(0x203)]){}const _0x3ca6bc=_0x187265[_0x40d251(0x212)](_0x46609f=>normalizeBffType(_0x46609f['scriptType'])===_0x40d251(0x22a)),_0x5d5c12=_0x3ca6bc?buildDatasetCodeToAliasMap(_0x5ebd89['apiDir'],_0x5ebd89['appCode'],_0x5ebd89[_0x40d251(0x239)]||_0x5ebd89[_0x40d251(0x254)]?.['currentApp']||_0x5ebd89['mergedCli']?.['defaultApp']):new Map(),_0x41bf59=createHookLocationMap(_0x391f5e),_0x4fde7d=JSON[_0x40d251(0x25a)](JSON[_0x40d251(0x1ed)](_0x1cda68)),_0x2d1de1=_0x5ebd89[_0x40d251(0x20c)],_0xa0e252=_0x4fde7d[_0x40d251(0x1f8)][_0x2d1de1];if(!_0xa0e252)throw new Error(_0x40d251(0x26d)+_0x2d1de1+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x4c546f=_0x3ca6bc?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x6d59f3,_0xa0e252,_0x5d5c12,await scanLocalBffFunctions(_0x6d59f3,_0x40d251(0x22a))),_0xa0e252):undefined,_0x19bbe4=createPullFileTransaction(),_0x3a72c9=[],_0xf8b0a7=[],_0x41f556=[],_0x2a4d74=[];for(const _0x2ba62f of _0x187265){const _0x14001c=resolveRemoteScriptTarget(_0x6d59f3,_0x2ba62f,_0x41bf59,_0xa0e252['functions'],_0x5d5c12);if(!_0x14001c){_0xf8b0a7['push']({'lockKey':_0x2ba62f[_0x40d251(0x205)]+'/'+_0x2ba62f['functionName'],'reason':_0x40d251(0x207)});continue;}const _0x37052b=_0xa0e252['functions'][_0x14001c[_0x40d251(0x24f)]];try{if(!_0x2ba62f['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x2ba62f[_0x40d251(0x23b)]==null)throw new Error(_0x40d251(0x267));const _0x36c84f=_0x2ba62f[_0x40d251(0x23b)],_0x2980c3=computeContentHash(_0x36c84f);if(!_0x25f572){const _0x2bc51a=await hasUnsyncedLocalChanges(_0x14001c[_0x40d251(0x26e)],_0x37052b,_0x2980c3);if(_0x2bc51a){_0x41f556[_0x40d251(0x21d)](localUnsyncedConflict(_0x14001c,_0x2ba62f['id']));continue;}}await _0x19bbe4[_0x40d251(0x251)](_0x14001c['filePath'],_0x36c84f);const _0x61e71c={'hash':_0x2980c3,'remoteId':_0x2ba62f['id'],'version':_0x2ba62f[_0x40d251(0x204)]};_0x14001c['type']===_0x40d251(0x22a)&&_0x14001c[_0x40d251(0x266)]&&(_0x61e71c['alias']=_0x14001c[_0x40d251(0x266)]['alias'],_0x61e71c[_0x40d251(0x249)]=_0x14001c[_0x40d251(0x266)][_0x40d251(0x249)],_0x61e71c[_0x40d251(0x226)]=_0x14001c[_0x40d251(0x266)][_0x40d251(0x226)],_0x61e71c['functionNode']=_0x14001c[_0x40d251(0x266)][_0x40d251(0x248)]),_0xa0e252['functions'][_0x14001c[_0x40d251(0x24f)]]=_0x61e71c,_0x3a72c9[_0x40d251(0x21d)]({'lockKey':_0x14001c['lockKey'],'remoteId':_0x2ba62f['id']});}catch(_0x1496f4){_0x2a4d74[_0x40d251(0x21d)]({'lockKey':_0x14001c[_0x40d251(0x24f)],'error':_0x1496f4 instanceof Error?_0x1496f4[_0x40d251(0x268)]:String(_0x1496f4)});}}_0xa0e252['lastSync']=new Date()[_0x40d251(0x231)]();try{await writeBffLockFile(_0x6d59f3[_0x40d251(0x217)],_0x4fde7d);}catch(_0x3dbcf4){const _0x281b7b=[...await _0x19bbe4['rollback'](),...await _0x4c546f?.[_0x40d251(0x250)]()??[]];throw withRollbackErrors(_0x3dbcf4,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x281b7b);}return{'ok':_0x2a4d74[_0x40d251(0x209)]===0x0,'data':{'pulled':_0x3a72c9,'skipped':_0xf8b0a7,'conflicts':_0x41f556,'failed':_0x2a4d74},'message':formatPullMessage(_0x3a72c9[_0x40d251(0x209)],_0xf8b0a7[_0x40d251(0x209)],_0x41f556[_0x40d251(0x209)],_0x2a4d74[_0x40d251(0x209)])};}};function localUnsyncedConflict(_0x1bfdc0,_0x4164db){const _0x45828d=a43_0x54976f,_0xc75244=_0x1bfdc0[_0x45828d(0x24f)][_0x45828d(0x269)]('/')['at'](-0x1);return{'code':_0x45828d(0x208),'lockKey':_0x1bfdc0[_0x45828d(0x24f)],'filePath':_0x1bfdc0[_0x45828d(0x26e)],..._0x4164db!=null?{'remoteId':_0x4164db}:{},'message':_0x45828d(0x222),'nextAction':{'action':_0x45828d(0x23c),'command':CLI_BIN_NAME+_0x45828d(0x21f)+_0x1bfdc0[_0x45828d(0x230)]+_0x45828d(0x1fa)+_0xc75244+_0x45828d(0x238),'requiresReview':!![],'message':_0x45828d(0x223)}};}function formatPullMessage(_0xe5e28c,_0x2d0f85,_0x34ddfa,_0x462ad7){const _0x5e44ff=a43_0x54976f,_0x20392c=[_0x5e44ff(0x24d)+_0xe5e28c+_0x5e44ff(0x200),_0x2d0f85+_0x5e44ff(0x253)];_0x34ddfa>0x0&&_0x20392c['push'](_0x34ddfa+_0x5e44ff(0x211)+(_0x34ddfa===0x1?'':'s')+'\x20'+(_0x34ddfa===0x1?_0x5e44ff(0x247):_0x5e44ff(0x263))+_0x5e44ff(0x24a));if(_0x462ad7>0x0)_0x20392c['push'](_0x462ad7+_0x5e44ff(0x228));return _0x20392c[_0x5e44ff(0x224)](',\x20');}async function hasUnsyncedLocalChanges(_0x1cfcef,_0x29ac99,_0x4f730a){if(!await fileExists(_0x1cfcef))return![];const _0x2cdd23=await computeFileHash(_0x1cfcef);if(!_0x29ac99)return _0x4f730a?_0x2cdd23!==_0x4f730a:!![];return _0x2cdd23!==_0x29ac99['hash'];}function createPullFileTransaction(){const _0x14e45e=new Map(),_0x281cfe=async(_0x49a9a0,_0x36779c)=>{const _0x78686d=a43_0x510b;try{if(_0x36779c['existed'])await ensureParentDirectory(_0x49a9a0),await writeFile(_0x49a9a0,_0x36779c[_0x78686d(0x237)]);else try{await unlink(_0x49a9a0);}catch(_0x506dcd){if(_0x506dcd['code']!==_0x78686d(0x1e4))throw _0x506dcd;}return undefined;}catch(_0x5549d6){return _0x5549d6 instanceof Error?_0x5549d6:new Error(String(_0x5549d6));}};return{async 'write'(_0x2e936e,_0x1335d6){const _0x47a519=a43_0x510b;if(!_0x14e45e['has'](_0x2e936e))try{_0x14e45e[_0x47a519(0x245)](_0x2e936e,{'existed':!![],'content':await readFile(_0x2e936e)});}catch(_0x3314fb){if(_0x3314fb[_0x47a519(0x1ef)]!==_0x47a519(0x1e4))throw _0x3314fb;_0x14e45e[_0x47a519(0x245)](_0x2e936e,{'existed':![]});}try{await ensureParentDirectory(_0x2e936e),await writeFile(_0x2e936e,_0x1335d6,_0x47a519(0x1f7));}catch(_0x488a70){const _0x3e4574=await _0x281cfe(_0x2e936e,_0x14e45e['get'](_0x2e936e));if(!_0x3e4574)_0x14e45e[_0x47a519(0x22b)](_0x2e936e);throw withRollbackErrors(_0x488a70,_0x47a519(0x25d)+_0x2e936e+'\x22.',_0x3e4574?[_0x3e4574]:[]);}},async 'rollback'(){const _0x45b0fc=a43_0x510b,_0x267cd9=[];for(const [_0x1dea60,_0xbb8cf6]of[..._0x14e45e[_0x45b0fc(0x214)]()][_0x45b0fc(0x22e)]()){const _0x1f6a8b=await _0x281cfe(_0x1dea60,_0xbb8cf6);_0x1f6a8b&&_0x267cd9[_0x45b0fc(0x21d)](new Error(_0x45b0fc(0x221)+_0x1dea60+_0x45b0fc(0x265)+_0x1f6a8b[_0x45b0fc(0x268)]));}return _0x267cd9;}};}function withRollbackErrors(_0xd097e5,_0x365f55,_0x5e4d4c){const _0x19296e=a43_0x54976f,_0x3517f8=_0xd097e5 instanceof Error?_0xd097e5:new Error(String(_0xd097e5));if(_0x5e4d4c[_0x19296e(0x209)]===0x0)return _0x3517f8;return new AggregateError([_0x3517f8,..._0x5e4d4c],_0x365f55+'\x20Recovery\x20errors:\x20'+_0x5e4d4c[_0x19296e(0x262)](_0x315976=>_0x315976[_0x19296e(0x268)])[_0x19296e(0x224)](';\x20'));}function buildDatasetCodeToAliasMap(_0x518c0a,_0x4a25a0,_0x14d058){const _0x270a09=a43_0x54976f,_0x344f8f=resolveApiModelSource(_0x518c0a,_0x4a25a0,_0x14d058),_0x5b04a1=loadAliasMap(_0x518c0a,undefined,_0x344f8f[_0x270a09(0x26e)],_0x344f8f['profileName']);return assertUnambiguousHookAliases(_0x5b04a1),new Map(_0x5b04a1[_0x270a09(0x262)](_0x414741=>[_0x414741[_0x270a09(0x249)][_0x270a09(0x20a)](),_0x414741[_0x270a09(0x25f)]]));}async function planHookDirectoryMigration(_0x57b0d6,_0x554fd7,_0x1a8580,_0x3b68d9){const _0x3b19a6=a43_0x54976f,_0x2c6299=new Map();for(const [_0x468e8f,_0x2af7d9]of Object[_0x3b19a6(0x214)](_0x554fd7[_0x3b19a6(0x244)])){const [_0x5aa786,_0x4c8276,_0x153801,_0x263495,_0x1f4df4,..._0x1e7c51]=_0x468e8f[_0x3b19a6(0x269)]('/');if(_0x5aa786!==_0x3b19a6(0x22a)||!_0x4c8276||!_0x153801||!_0x263495||!_0x1f4df4||_0x1e7c51[_0x3b19a6(0x209)]>0x0||!_0x2af7d9['datasetCode'])continue;const _0x5e5293=_0x1a8580[_0x3b19a6(0x210)](_0x2af7d9['datasetCode'][_0x3b19a6(0x20a)]()),_0x255fec=_0x5e5293??_0x2af7d9[_0x3b19a6(0x249)];if(!isSafeHookDirectorySegment(_0x4c8276))throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x24c)+_0x4c8276+_0x3b19a6(0x252));if(!isSafeHookDirectorySegment(_0x255fec))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x4c8276+_0x3b19a6(0x241));if(_0x4c8276===_0x255fec)continue;const _0x276ae9=_0x2c6299[_0x3b19a6(0x210)](_0x4c8276)??{'datasetCode':_0x2af7d9[_0x3b19a6(0x249)],'alias':_0x5e5293,'keyChanges':[]};if(_0x276ae9[_0x3b19a6(0x249)]!==_0x2af7d9[_0x3b19a6(0x249)])throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x4c8276+_0x3b19a6(0x243));const _0x1f970a=_0x3b19a6(0x1fe)+_0x255fec+'/'+_0x153801+'/'+_0x263495+'/'+_0x1f4df4;try{resolveLocalFilePathFromLockKey(_0x57b0d6,_0x468e8f),resolveLocalFilePathFromLockKey(_0x57b0d6,_0x1f970a);}catch(_0x227378){throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x272)+_0x468e8f+_0x3b19a6(0x265)+(_0x227378 instanceof Error?_0x227378['message']:String(_0x227378)));}_0x276ae9[_0x3b19a6(0x1f6)][_0x3b19a6(0x21d)]({'oldLockKey':_0x468e8f,'newLockKey':_0x1f970a,'entry':_0x2af7d9}),_0x2c6299[_0x3b19a6(0x245)](_0x4c8276,_0x276ae9);}const _0x57de56=new Set([..._0x2c6299[_0x3b19a6(0x21a)]()][_0x3b19a6(0x1e5)](_0x4ee1f7=>_0x4ee1f7[_0x3b19a6(0x1f6)][_0x3b19a6(0x262)](_0x564c37=>_0x564c37['oldLockKey']))),_0x7770e7=new Map(),_0x1abce9=new Map();for(const [_0xc02a2a,_0x2de086]of _0x2c6299){const _0x48abef=_0x2de086[_0x3b19a6(0x25f)]??_0x2de086['datasetCode'],_0x3c03bf=hookDirectoryIdentity(_0x48abef),_0x37ff82=_0x7770e7['get'](_0x3c03bf);if(_0x37ff82&&_0x37ff82!==_0xc02a2a)throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x23e)+_0x37ff82+_0x3b19a6(0x220)+_0xc02a2a+_0x3b19a6(0x261)+_0x48abef+_0x3b19a6(0x1e2));_0x7770e7[_0x3b19a6(0x245)](_0x3c03bf,_0xc02a2a);for(const _0x1971ad of _0x2de086[_0x3b19a6(0x1f6)]){const _0x328662=_0x1abce9[_0x3b19a6(0x210)](_0x1971ad[_0x3b19a6(0x229)]);if(_0x328662&&_0x328662!==_0x1971ad[_0x3b19a6(0x227)])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x328662+_0x3b19a6(0x220)+_0x1971ad[_0x3b19a6(0x227)]+'\x22:\x20both\x20target\x20\x22'+_0x1971ad[_0x3b19a6(0x229)]+_0x3b19a6(0x1f0));if(_0x57de56['has'](_0x1971ad['newLockKey']))throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x206)+_0x1971ad[_0x3b19a6(0x227)]+'\x22:\x20its\x20target\x20\x22'+_0x1971ad[_0x3b19a6(0x229)]+_0x3b19a6(0x1e1));_0x1abce9[_0x3b19a6(0x245)](_0x1971ad[_0x3b19a6(0x229)],_0x1971ad[_0x3b19a6(0x227)]);}}const _0xd83048=new Map();for(const [_0x84e042,_0xc3d855]of _0x1a8580){_0xd83048[_0x3b19a6(0x245)](hookDirectoryIdentity(_0xc3d855),_0x84e042);}const _0xda566f=[];for(const [_0x5f4f8b,_0x13b51a]of _0x2c6299){const _0x1231fa=_0x13b51a['alias']??_0x13b51a['datasetCode'],_0x3f1ae9=join(_0x57b0d6[_0x3b19a6(0x21b)],_0x3b19a6(0x22a),_0x5f4f8b),_0x25521d=join(_0x57b0d6[_0x3b19a6(0x21b)],'HOOK',_0x1231fa),_0x3a68f2=await directoryExists(_0x3f1ae9),_0x764fd9=await directoryExists(_0x25521d),_0xa6462=_0x3a68f2?_0x764fd9?await sameDirectory(_0x3f1ae9,_0x25521d)?_0x3b19a6(0x1e7):undefined:_0x3b19a6(0x1eb):_0x3b19a6(0x218);if(!_0xa6462)throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+_0x3b19a6(0x1ee)+_0x1231fa+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x35247c=_0xd83048[_0x3b19a6(0x210)](hookDirectoryIdentity(_0x5f4f8b));if(_0x35247c&&_0x35247c!==_0x13b51a[_0x3b19a6(0x249)][_0x3b19a6(0x20a)]()){const _0x3da436=new Set(_0x13b51a[_0x3b19a6(0x1f6)]['map'](_0x1bd4bf=>_0x1bd4bf['oldLockKey'])),_0x433c27=_0x3b68d9['filter'](_0x1391b6=>_0x1391b6['type']===_0x3b19a6(0x22a)&&_0x1391b6[_0x3b19a6(0x25f)]!=null&&hookDirectoryIdentity(_0x1391b6[_0x3b19a6(0x25f)])===hookDirectoryIdentity(_0x5f4f8b)&&!_0x3da436['has'](_0x1391b6[_0x3b19a6(0x24f)]));if(_0x433c27[_0x3b19a6(0x209)]>0x0)throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+_0x3b19a6(0x23f));}const _0x3169a0=_0xd83048[_0x3b19a6(0x210)](hookDirectoryIdentity(_0x1231fa));if(_0x3169a0&&_0x3169a0!==_0x13b51a[_0x3b19a6(0x249)][_0x3b19a6(0x20a)]())throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+_0x3b19a6(0x1ee)+_0x1231fa+_0x3b19a6(0x216));for(const _0x575fba of _0x13b51a[_0x3b19a6(0x1f6)]){const _0x244f70=_0x554fd7[_0x3b19a6(0x244)][_0x575fba[_0x3b19a6(0x229)]];if(_0x244f70&&!_0x57de56[_0x3b19a6(0x1e8)](_0x575fba[_0x3b19a6(0x229)])&&!sameHookIdentity(_0x575fba[_0x3b19a6(0x271)],_0x244f70))throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+'\x22\x20to\x20\x22'+_0x1231fa+_0x3b19a6(0x1f3));}_0xda566f[_0x3b19a6(0x21d)]({'oldDirectory':_0x5f4f8b,'newDirectory':_0x1231fa,'oldDirectoryPath':_0x3f1ae9,'newDirectoryPath':_0x25521d,'mode':_0xa6462,'alias':_0x13b51a[_0x3b19a6(0x25f)],'keyChanges':_0x13b51a['keyChanges']});}const _0x1f1144={..._0x554fd7['functions']},_0x41a6ae=new Map(),_0x438f2c=new Map();for(const _0x47b7ad of _0xda566f){const _0x57bf78=_0x47b7ad[_0x3b19a6(0x278)]!==_0x3b19a6(0x218);_0x57bf78&&_0x438f2c[_0x3b19a6(0x245)](hookDirectoryIdentity(_0x47b7ad[_0x3b19a6(0x22c)]),_0x47b7ad[_0x3b19a6(0x235)]);for(const _0x4c761e of _0x47b7ad[_0x3b19a6(0x1f6)]){const _0x42c0ef=_0x1f1144[_0x4c761e[_0x3b19a6(0x229)]],_0x3b8060=_0x57bf78?_0x4c761e[_0x3b19a6(0x271)]:_0x42c0ef??_0x4c761e[_0x3b19a6(0x271)];_0x1f1144[_0x4c761e['newLockKey']]=canonicalizeHookEntry(_0x3b8060,_0x47b7ad[_0x3b19a6(0x25f)]),delete _0x1f1144[_0x4c761e[_0x3b19a6(0x227)]],_0x57bf78&&_0x41a6ae[_0x3b19a6(0x245)](_0x4c761e[_0x3b19a6(0x229)],resolveLocalFilePathFromLockKey(_0x57b0d6,_0x4c761e[_0x3b19a6(0x227)]));}}return{'migrations':_0xda566f,'projectedFunctions':_0x1f1144,'sourceFilePathByNewLockKey':_0x41a6ae,'sourceDirectoryPathByNewDirectory':_0x438f2c};}function a43_0x41eb(){const _0x4d6e1f=['Remote\x20script\x20missing\x20content.','message','split','1853584vZfNOO','boolean','lastSync','Lock\x20scope\x20for\x20app\x20\x22','filePath','2323365XLnHrG','newDirectoryPath','entry','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','oldDirectory','bool','projectedFunctions','bff','migrations','mode','close','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','all','ENOENT','flatMap','force','case-rename','has','yes','would_pull','move','sourceDirectoryPathByNewDirectory','stringify','\x22\x20to\x20\x22','code','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','apiDir','remoteId','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','conflict','COMMON','keyChanges','utf8','apps','includes','\x20--name\x20','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','dev','read','HOOK/','1787395LHvBli','\x20pulled','stderr','6607864EXQvaZ','nonInteractive','version','scriptType','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','unresolvable\x20target\x20path','BFF_LOCAL_UNSYNCED','length','toLowerCase','/api/management/library/scripts/list?appCode=','appCode','functionName','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','defaultApp','get','\x20conflict','some','.hook-directory-migrate-','entries','sourceFilePathByNewLockKey','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','lockFilePath','rekey','string','values','scriptsRootDir','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','push','&type=','\x20bff\x20push\x20--type\x20','\x22\x20and\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','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.','join','stdin','operationType','oldLockKey','\x20failed','newLockKey','HOOK','delete','newDirectory','80396NUWyDs','reverse','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','type','toISOString','cancelled','scriptsRoot','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','oldDirectoryPath','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','content','\x20--format\x20compress','selectedAppName','Would\x20inspect\x20','scriptContent','push_local','.js','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','\x22;\x20temporary\x20directory\x20\x22','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','NFC','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','functions','set','36AuUrpu','requires','functionNode','datasetCode','\x20resolution','ino','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Pull\x20complete:\x20','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','lockKey','rollback','write','\x22\x20from\x20the\x20lock\x20file.','\x20skipped','mergedCli','Force\x20overwrite\x20local\x20unsynced\x20changes','str','6tzBigZ','3825696dVRZSI','Force\x20pull\x20cancelled.','parse','4893329CQySAG','\x22\x20from\x20\x22','Failed\x20to\x20write\x20local\x20script\x20\x22','pull','alias','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','\x22:\x20both\x20target\x20\x22','map','require','validation','\x22:\x20','hookLocation'];a43_0x41eb=function(){return _0x4d6e1f;};return a43_0x41eb();}function resolveMigratedSourceFilePath(_0x444245,_0x54740a){const _0x396f2e=a43_0x54976f;if(!_0x444245||!_0x54740a)return undefined;const _0x33e709=_0x444245[_0x396f2e(0x215)][_0x396f2e(0x210)](_0x54740a['lockKey']);if(_0x33e709)return _0x33e709;if(_0x54740a['type']!==_0x396f2e(0x22a))return undefined;const [,_0x243f58,..._0x57b16d]=_0x54740a[_0x396f2e(0x24f)][_0x396f2e(0x269)]('/');if(!_0x243f58||_0x57b16d['length']===0x0)return undefined;const _0x4d7d4d=_0x444245[_0x396f2e(0x1ec)][_0x396f2e(0x210)](hookDirectoryIdentity(_0x243f58));return _0x4d7d4d?join(_0x4d7d4d,..._0x57b16d)+_0x396f2e(0x23d):undefined;}function sameHookIdentity(_0x20fed6,_0x1f0f55){const _0x53f33c=a43_0x54976f;return _0x20fed6[_0x53f33c(0x1f2)]===_0x1f0f55[_0x53f33c(0x1f2)]&&_0x20fed6[_0x53f33c(0x249)]===_0x1f0f55[_0x53f33c(0x249)]&&_0x20fed6[_0x53f33c(0x226)]===_0x1f0f55[_0x53f33c(0x226)]&&_0x20fed6[_0x53f33c(0x248)]===_0x1f0f55[_0x53f33c(0x248)];}function canonicalizeHookEntry(_0x24fda6,_0x419752){const {alias:_0xfd35db,..._0x5ec793}=_0x24fda6;return _0x419752?{..._0x5ec793,'alias':_0x419752}:_0x5ec793;}function hookDirectoryIdentity(_0x1d1d6f){const _0x1f0e31=a43_0x54976f;return _0x1d1d6f['normalize'](_0x1f0e31(0x242))[_0x1f0e31(0x20a)]();}function isSafeHookDirectorySegment(_0x2b6f07){return isSafeLockKeySegment(_0x2b6f07);}async function sameDirectory(_0x46334f,_0x1d61a2){const _0x5823ae=a43_0x54976f,[_0x3dcafe,_0x3efe12]=await Promise[_0x5823ae(0x1e3)]([stat(_0x46334f),stat(_0x1d61a2)]);return _0x3dcafe[_0x5823ae(0x1fc)]===_0x3efe12['dev']&&_0x3dcafe[_0x5823ae(0x24b)]===_0x3efe12['ino'];}async function applyHookDirectoryMigration(_0x55b785,_0x2830dd){const _0x104ba4=a43_0x54976f,_0x48cfea=_0x2830dd[_0x104ba4(0x244)],_0x475475=_0x2830dd[_0x104ba4(0x26c)],_0x4fcd86=[],_0x59e83f=async()=>{const _0x41829f=_0x104ba4,_0x58171a=[];_0x2830dd[_0x41829f(0x244)]=_0x48cfea,_0x2830dd[_0x41829f(0x26c)]=_0x475475;for(const {migration:_0x2cf2a3,temporaryPath:_0x1c3d69}of[..._0x4fcd86][_0x41829f(0x22e)]()){try{_0x1c3d69?(await rename(_0x2cf2a3[_0x41829f(0x270)],_0x1c3d69),await rename(_0x1c3d69,_0x2cf2a3[_0x41829f(0x235)])):await rename(_0x2cf2a3[_0x41829f(0x270)],_0x2cf2a3[_0x41829f(0x235)]);}catch(_0x4ad7a1){_0x58171a[_0x41829f(0x21d)](new Error(_0x41829f(0x20e)+_0x2cf2a3['oldDirectory']+_0x41829f(0x25c)+_0x2cf2a3[_0x41829f(0x22c)]+_0x41829f(0x265)+(_0x4ad7a1 instanceof Error?_0x4ad7a1[_0x41829f(0x268)]:String(_0x4ad7a1))));}}return _0x58171a;};try{for(const _0x58235b of _0x55b785[_0x104ba4(0x277)]){if(_0x58235b['mode']===_0x104ba4(0x1eb))await ensureParentDirectory(_0x58235b[_0x104ba4(0x270)]),await rename(_0x58235b[_0x104ba4(0x235)],_0x58235b['newDirectoryPath']),_0x4fcd86['push']({'migration':_0x58235b});else{if(_0x58235b[_0x104ba4(0x278)]===_0x104ba4(0x1e7)){const _0x68794=join(dirname(_0x58235b['oldDirectoryPath']),_0x104ba4(0x213)+randomUUID());await rename(_0x58235b['oldDirectoryPath'],_0x68794);try{await rename(_0x68794,_0x58235b['newDirectoryPath']);}catch(_0x7fffde){try{await rename(_0x68794,_0x58235b[_0x104ba4(0x235)]);}catch(_0x1de994){throw withRollbackErrors(_0x7fffde,_0x104ba4(0x27a)+_0x58235b[_0x104ba4(0x273)]+_0x104ba4(0x1ee)+_0x58235b[_0x104ba4(0x22c)]+_0x104ba4(0x240)+_0x68794+'\x22\x20may\x20remain.',[new Error(_0x104ba4(0x1fb)+_0x68794+'\x22\x20to\x20\x22'+_0x58235b[_0x104ba4(0x273)]+'\x22:\x20'+(_0x1de994 instanceof Error?_0x1de994[_0x104ba4(0x268)]:String(_0x1de994)))]);}throw _0x7fffde;}_0x4fcd86['push']({'migration':_0x58235b,'temporaryPath':_0x68794});}}}return _0x2830dd[_0x104ba4(0x244)]=_0x55b785[_0x104ba4(0x275)],{'rollback':_0x59e83f};}catch(_0x4acf31){const _0x14e229=await _0x59e83f();throw withRollbackErrors(_0x4acf31,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x14e229);}}function a43_0x510b(_0x41541f,_0x1e843a){_0x41541f=_0x41541f-0x1e1;const _0x41eb57=a43_0x41eb();let _0x510bbd=_0x41eb57[_0x41541f];return _0x510bbd;}async function confirmForce(){const _0x4c5ec=a43_0x54976f,_0x1df691=createInterface({'input':process[_0x4c5ec(0x225)],'output':process[_0x4c5ec(0x201)]}),_0x7aaa9b=await new Promise(_0x1fa684=>{const _0x55c245=_0x4c5ec;_0x1df691['question'](_0x55c245(0x21c),_0x1fa684);});return _0x1df691[_0x4c5ec(0x279)](),['y',_0x4c5ec(0x1e9)][_0x4c5ec(0x1f9)](_0x7aaa9b['trim']()['toLowerCase']());}
|