@lovrabet/rabetbase-cli 2.5.10 → 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
|
-
const
|
|
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
|
-
const a37_0x282431=a37_0x106f;(function(_0x5ebbc6,_0x2eee9f){const _0x5f576c=a37_0x106f,_0x9c5fd1=_0x5ebbc6();while(!![]){try{const _0x81e6ec=-parseInt(_0x5f576c(0x95))/0x1+parseInt(_0x5f576c(0xe2))/0x2*(-parseInt(_0x5f576c(0xe8))/0x3)+-parseInt(_0x5f576c(0xc1))/0x4+parseInt(_0x5f576c(0x9b))/0x5*(-parseInt(_0x5f576c(0xe0))/0x6)+-parseInt(_0x5f576c(0x93))/0x7*(parseInt(_0x5f576c(0x80))/0x8)+parseInt(_0x5f576c(0xbd))/0x9+-parseInt(_0x5f576c(0xdb))/0xa*(-parseInt(_0x5f576c(0xb8))/0xb);if(_0x81e6ec===_0x2eee9f)break;else _0x9c5fd1['push'](_0x9c5fd1['shift']());}catch(_0x206622){_0x9c5fd1['push'](_0x9c5fd1['shift']());}}}(a37_0x14c1,0x4096d));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';function a37_0x14c1(){const _0x3266ae=['HOOK\x20requires\x20alias/operation/node\x20options.','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','datasetId','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','source','selectedAppName','bff','keys','stderr','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','nonInteractive','str','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','write','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','30TiAvyS','name','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','当前响应结果','appCode','27132QoeMgY','\x20api\x20pull`\x20to\x20refresh.','146434GNxtsk','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','\x22,\x20params\x20})\x0a','entries','apiDir','HOOK','3QgArUx','scriptsRootDir','string','after','Invalid\x20function\x20name\x20\x22','filePath','3620872jQWnLf','COMMON','stdin','find','function-node','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','trim','description','/ENDPOINT/','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','.js','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','UNKNOWN','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','create','Function\x20name\x20(valid\x20JS\x20identifier)','defaultApp','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','No\x20model\x20aliases\x20found.\x20Run\x20`','7lggEmv','includes','341619cptKDR','Select\x20trigger\x20node:','Script\x20description','/COMMON/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','question','495OhcmMN','datasetCode','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','close','mergedCli','parseInt','functionNode','operationType','Operation\x20type\x20(HOOK\x20only)','read','修改后的响应结果','Select\x20operation\x20type:','Select\x20dataset:',']\x20(','validation','datasetcode','No\x20datasets\x20found\x20for\x20this\x20app.','File\x20already\x20exists:\x20','Operation\x20type\x20\x22','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','/**\x0a\x20*\x20','alias','length','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','.js\x0a','\x22\x20not\x20found\x20for\x20dataset\x20','code','Alias\x20\x22','\x22\x20not\x20found.\x20','5447937WHjnja','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','当前请求参数','map','type','3255615KMcJoT','currentApp','Invalid\x20dataset\x20selection.','\x22.\x20','1071424cftFDB','before','profileName','join','.js\x0a\x20*\x20[触发节点]\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','/data/dataset/','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Script\x20type'];a37_0x14c1=function(){return _0x3266ae;};return a37_0x14c1();}function a37_0x106f(_0x5ef440,_0x22ec36){_0x5ef440=_0x5ef440-0x7c;const _0x14c159=a37_0x14c1();let _0x106f39=_0x14c159[_0x5ef440];return _0x106f39;}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_0x282431(0xd1),'command':a37_0x282431(0x8e),'description':a37_0x282431(0x8d),'risk':a37_0x282431(0xa4),'flags':[{'name':a37_0x282431(0xbc),'type':'string','required':!![],'enum':[a37_0x282431(0x81),'ENDPOINT',a37_0x282431(0xe7)],'description':a37_0x282431(0xca)},{'name':a37_0x282431(0xdc),'type':a37_0x282431(0x7c),'required':!![],'description':a37_0x282431(0x8f)},{'name':a37_0x282431(0x87),'type':a37_0x282431(0x7c),'description':a37_0x282431(0x97)},{'name':a37_0x282431(0xb0),'type':a37_0x282431(0x7c),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':'datasetcode','type':a37_0x282431(0x7c),'description':a37_0x282431(0x8b)},{'name':'operation-type','type':a37_0x282431(0x7c),'description':a37_0x282431(0xa3)},{'name':a37_0x282431(0x84),'type':a37_0x282431(0x7c),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':['before','after']}],async 'validate'(_0x3f2a49){const _0x1c057b=a37_0x282431,_0x1e34e7=_0x3f2a49[_0x1c057b(0xd6)](_0x1c057b(0xdc));if(!isValidBffFunctionName(_0x1e34e7))throw CliErrors['validation'](_0x1c057b(0x7e)+_0x1e34e7+_0x1c057b(0x89));},async 'execute'(_0x10ed8b){const _0xfe1e7=a37_0x282431,_0x21db1c=loadBffProjectConfig(_0x10ed8b[_0xfe1e7(0xdf)]),_0x4ac455=_0x10ed8b[_0xfe1e7(0xd6)]('type'),_0x1ae9b4=_0x10ed8b[_0xfe1e7(0xd6)]('name'),_0x466423=_0x10ed8b['str']('description')||undefined,_0x4e8485=_0x4ac455===_0xfe1e7(0xe7)?await resolveHookOptions(_0x21db1c,_0x10ed8b):undefined,_0x140d35=buildFilePath(_0x21db1c,_0x4ac455,_0x1ae9b4,_0x4e8485);if(await fileExists(_0x140d35))throw CliErrors['validation'](_0xfe1e7(0xac)+_0x140d35);await mkdir(dirname(_0x140d35),{'recursive':!![]});const _0x1d8733=generateTemplate(_0x4ac455,_0x1ae9b4,_0x10ed8b[_0xfe1e7(0xdf)],_0x466423,_0x4e8485);await writeFile(_0x140d35,_0x1d8733,'utf8');const _0x345ada={'type':_0x4ac455,'name':_0x1ae9b4,'path':_0x140d35};if(_0x466423)_0x345ada[_0xfe1e7(0x87)]=_0x466423;if(_0x4e8485){if(_0x4e8485['alias'])_0x345ada[_0xfe1e7(0xb0)]=_0x4e8485[_0xfe1e7(0xb0)];_0x345ada['datasetCode']=_0x4e8485[_0xfe1e7(0x9c)],_0x345ada['operationType']=_0x4e8485['operationType'],_0x345ada[_0xfe1e7(0xa1)]=_0x4e8485[_0xfe1e7(0xa1)];}return{'ok':!![],'data':_0x345ada,'message':'Created\x20'+_0x4ac455+'\x20function:\x20'+_0x1ae9b4};}};async function resolveHookOptions(_0x49d6b9,_0x8076f6){const _0x573e99=a37_0x282431,_0xcbfa8e=resolveApiModelSource(_0x8076f6[_0x573e99(0xe6)],_0x8076f6[_0x573e99(0xdf)],_0x8076f6[_0x573e99(0xd0)]||_0x8076f6[_0x573e99(0x9f)]?.[_0x573e99(0xbe)]||_0x8076f6['mergedCli']?.[_0x573e99(0x90)]),_0x398aeb=loadAliasMap(_0x8076f6[_0x573e99(0xe6)],undefined,_0xcbfa8e['filePath'],_0xcbfa8e[_0x573e99(0xc3)]),_0x329974=_0x398aeb[_0x573e99(0xb1)]>0x0;let _0x37a32a,_0x204010,_0x3e6d2e;const _0x4095df=_0x8076f6[_0x573e99(0xd6)](_0x573e99(0xb0)),_0x608663=_0x8076f6[_0x573e99(0xd6)](_0x573e99(0xaa));if(_0x4095df){const _0x1d687e=resolveAlias(_0x8076f6[_0x573e99(0xe6)],_0x4095df,undefined,_0xcbfa8e[_0x573e99(0x7f)],_0xcbfa8e[_0x573e99(0xc3)]);if(!_0x1d687e){const _0x42ee70=_0x329974?'Available\x20aliases:\x20'+_0x398aeb[_0x573e99(0xbb)](_0x203565=>_0x203565['alias'])[_0x573e99(0xc4)](',\x20'):_0x573e99(0x92)+CLI_BIN_NAME+_0x573e99(0xce);throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xb6)+_0x4095df+_0x573e99(0xb7)+_0x42ee70);}_0x37a32a=_0x4095df,_0x204010=_0x1d687e;}else{if(_0x608663){_0x204010=_0x608663;const _0x3f1b76=_0x398aeb[_0x573e99(0x83)](_0x57fc6f=>_0x57fc6f[_0x573e99(0x9c)]===_0x608663);_0x37a32a=_0x3f1b76?.['alias'];}else{if(_0x8076f6['nonInteractive'])throw CliErrors['validation']('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x329974){const _0x1a10d6=_0x398aeb[_0x573e99(0xbb)](_0x12d67e=>_0x12d67e['alias']+'\x20('+_0x12d67e['tableName']+')'),_0x3092cd=await promptSelect(_0x573e99(0xa7),_0x1a10d6),_0x1d5bdf=_0x398aeb[_0x3092cd];if(!_0x1d5bdf)throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xbf));_0x37a32a=_0x1d5bdf[_0x573e99(0xb0)],_0x204010=_0x1d5bdf[_0x573e99(0x9c)];}else{const _0x4b1a29=await listDatasets(_0x8076f6['appCode']);if(_0x4b1a29[_0x573e99(0xb1)]===0x0)throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xab));const _0x288705=_0x4b1a29[_0x573e99(0xbb)](_0xd57047=>_0xd57047[_0x573e99(0xdc)]+'\x20['+(_0xd57047[_0x573e99(0xcf)]??_0x573e99(0x8c))+_0x573e99(0xa8)+_0xd57047['code']+')'),_0x2a9f25=await promptSelect('Select\x20dataset:',_0x288705),_0x3eb049=_0x4b1a29[_0x2a9f25];if(!_0x3eb049)throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xbf));_0x204010=_0x3eb049[_0x573e99(0xb5)],_0x37a32a=undefined;}}}}const _0x3b2629=await listDatasets(_0x8076f6[_0x573e99(0xdf)]),_0x53b481=_0x3b2629[_0x573e99(0x83)](_0x38660e=>_0x38660e['code']===_0x204010);if(!_0x53b481)throw CliErrors[_0x573e99(0xa9)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x204010+_0x573e99(0xc0)+(_0x37a32a?_0x573e99(0xda)+CLI_BIN_NAME+_0x573e99(0xe1):''));_0x3e6d2e=_0x53b481['id'];const _0x482b68=_0x37a32a??_0x204010,_0x505d2e=await listBffDatasetOperations(_0x8076f6[_0x573e99(0xdf)],_0x3e6d2e),_0x7648f1=_0x505d2e?Object[_0x573e99(0xd2)](_0x505d2e):[];if(_0x7648f1[_0x573e99(0xb1)]===0x0)throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xc9)+_0x482b68+'.');let _0x2d6c2b;const _0x14233d=_0x8076f6['str']('operation-type');if(_0x14233d){if(!_0x7648f1[_0x573e99(0x94)](_0x14233d))throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xad)+_0x14233d+_0x573e99(0xb4)+_0x482b68+'.\x20'+('Available:\x20'+_0x7648f1[_0x573e99(0xc4)](',\x20')));_0x2d6c2b=_0x14233d;}else{if(_0x8076f6['nonInteractive'])throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xae));const _0xae2a26=await promptSelect(_0x573e99(0xa6),_0x7648f1);_0x2d6c2b=_0x7648f1[_0xae2a26]??_0x7648f1[0x0];}let _0x14370a=normalizeHookFunctionNode(_0x8076f6[_0x573e99(0xd6)](_0x573e99(0x84)));if(!_0x14370a){if(_0x8076f6[_0x573e99(0xd6)](_0x573e99(0x84)))throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xb9));if(_0x8076f6[_0x573e99(0xd5)])throw CliErrors[_0x573e99(0xa9)](_0x573e99(0xcc));const _0x4ff1d4=await promptSelect(_0x573e99(0x96),['before','after']);_0x14370a=[_0x573e99(0xc2),_0x573e99(0x7d)][_0x4ff1d4]??'before';}return{'alias':_0x37a32a,'datasetCode':_0x204010,'datasetId':_0x3e6d2e,'operationType':_0x2d6c2b,'functionNode':_0x14370a};}async function promptSelect(_0x3c1de8,_0xdc5167){const _0x40109c=a37_0x282431;if(_0xdc5167[_0x40109c(0xb1)]===0x1)return 0x0;for(const [_0x4f0e83,_0x5d7990]of _0xdc5167[_0x40109c(0xe5)]()){process[_0x40109c(0xd3)][_0x40109c(0xd9)]('\x20\x20'+(_0x4f0e83+0x1)+'.\x20'+_0x5d7990+'\x0a');}const _0x19aa97=createInterface({'input':process[_0x40109c(0x82)],'output':process[_0x40109c(0xd3)]});while(!![]){const _0x487f2c=await new Promise(_0x5e2fa1=>{const _0xa1a0da=_0x40109c;_0x19aa97[_0xa1a0da(0x9a)](_0x3c1de8+'\x20',_0x5e2fa1);}),_0x4e2b09=Number[_0x40109c(0xa0)](_0x487f2c[_0x40109c(0x86)](),0xa);if(Number['isInteger'](_0x4e2b09)&&_0x4e2b09>=0x1&&_0x4e2b09<=_0xdc5167[_0x40109c(0xb1)])return _0x19aa97[_0x40109c(0x9e)](),_0x4e2b09-0x1;process[_0x40109c(0xd3)]['write'](_0x40109c(0x9d)+_0xdc5167['length']+'.\x0a');}}function buildFilePath(_0x381f6a,_0x48d287,_0x2552af,_0xd867a9){const _0x5abee5=a37_0x282431;if(_0x48d287===_0x5abee5(0xe7)){if(!_0xd867a9)throw CliErrors['validation'](_0x5abee5(0xcb));const _0x1bab01=_0xd867a9[_0x5abee5(0xb0)]??_0xd867a9[_0x5abee5(0x9c)];return join(_0x381f6a[_0x5abee5(0xe9)],_0x5abee5(0xe7),_0x1bab01,_0xd867a9['operationType'],_0xd867a9[_0x5abee5(0xa1)],_0x2552af+'.js');}return join(_0x381f6a[_0x5abee5(0xe9)],_0x48d287,_0x2552af+_0x5abee5(0x8a));}export function generateTemplate(_0x33a0de,_0x7f31a5,_0x3b3526,_0x345d5f,_0x5c5d60){const _0x3fc8ff=a37_0x282431,_0x49f137=_0x345d5f?.[_0x3fc8ff(0x86)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x11e7ad=getAppBaseUrl(_0x3b3526),_0xe4ea29=_0x3fc8ff(0xb2);if(_0x33a0de==='COMMON')return _0x3fc8ff(0xaf)+_0x49f137+_0x3fc8ff(0xe3)+_0x7f31a5+'\x0a\x20*\x20[平台配置]\x20'+_0x11e7ad+_0x3fc8ff(0xdd)+_0x3b3526+_0x3fc8ff(0x98)+_0x7f31a5+_0x3fc8ff(0x91)+_0x7f31a5+_0x3fc8ff(0xe4)+_0xe4ea29+_0x3fc8ff(0xd8)+_0x7f31a5+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x33a0de==='ENDPOINT')return _0x3fc8ff(0xaf)+_0x49f137+_0x3fc8ff(0x99)+_0x7f31a5+_0x3fc8ff(0xc6)+_0x3b3526+'/'+_0x7f31a5+'\x0a\x20*\x20[平台配置]\x20'+_0x11e7ad+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x3b3526+_0x3fc8ff(0x88)+_0x7f31a5+_0x3fc8ff(0xb3)+_0xe4ea29+'\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'+_0x7f31a5+_0x3fc8ff(0xc8);if(!_0x5c5d60)throw CliErrors[_0x3fc8ff(0xa9)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x1a7c2a=_0x5c5d60[_0x3fc8ff(0xb0)]??_0x5c5d60['datasetCode'],_0xc0c94c=_0x5c5d60['functionNode']===_0x3fc8ff(0xc2)?_0x3fc8ff(0xba):_0x3fc8ff(0xde),_0x5e133d=_0x5c5d60[_0x3fc8ff(0xa1)]===_0x3fc8ff(0xc2)?'修改后的请求参数':_0x3fc8ff(0xa5);return _0x3fc8ff(0xaf)+_0x49f137+_0x3fc8ff(0xd4)+_0x7f31a5+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x3b3526+'/'+_0x5c5d60[_0x3fc8ff(0x9c)]+'/'+_0x5c5d60[_0x3fc8ff(0xa2)]+'\x0a\x20*\x20[平台配置]\x20'+_0x11e7ad+_0x3fc8ff(0xc7)+_0x5c5d60[_0x3fc8ff(0xcd)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x3b3526+'/HOOK/'+_0x1a7c2a+'/'+_0x5c5d60[_0x3fc8ff(0xa2)]+'/'+_0x5c5d60['functionNode']+'/'+_0x7f31a5+_0x3fc8ff(0xc5)+_0x5c5d60[_0x3fc8ff(0xa1)]+'\x0a'+_0xe4ea29+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0xc0c94c+_0x3fc8ff(0xd7)+_0x5e133d+_0x3fc8ff(0x85)+_0x7f31a5+_0x3fc8ff(0xc8);}
|
|
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
|
-
const
|
|
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
|
-
(function(
|
|
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
|
-
function a43_0x3f0d(_0x1a49ab,_0x1476a3){_0x1a49ab=_0x1a49ab-0xc3;const _0x253be0=a43_0x253b();let _0x3f0dfe=_0x253be0[_0x1a49ab];return _0x3f0dfe;}const a43_0x2847ba=a43_0x3f0d;(function(_0x1d1247,_0x22843a){const _0x55972b=a43_0x3f0d,_0x109fd3=_0x1d1247();while(!![]){try{const _0x3d7a5b=parseInt(_0x55972b(0x137))/0x1+-parseInt(_0x55972b(0xd4))/0x2+parseInt(_0x55972b(0xd6))/0x3*(-parseInt(_0x55972b(0x14a))/0x4)+-parseInt(_0x55972b(0x11a))/0x5*(parseInt(_0x55972b(0x108))/0x6)+parseInt(_0x55972b(0xcf))/0x7*(-parseInt(_0x55972b(0x132))/0x8)+-parseInt(_0x55972b(0x100))/0x9+parseInt(_0x55972b(0x147))/0xa;if(_0x3d7a5b===_0x22843a)break;else _0x109fd3['push'](_0x109fd3['shift']());}catch(_0x1d9ec5){_0x109fd3['push'](_0x109fd3['shift']());}}}(a43_0x253b,0xe1a9f));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';function a43_0x253b(){const _0x2b5509=['split','NFC','map','currentApp','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','\x20failed','operationType','\x22:\x20both\x20target\x20\x22','\x22:\x20its\x20target\x20\x22','BFF_LOCAL_UNSYNCED','686LnFJLt','\x22;\x20temporary\x20directory\x20\x22','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','move','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','449868TKYTas','Remote\x20script\x20missing\x20content.','1186383VDphMi','bool','write','\x22\x20from\x20the\x20lock\x20file.','requires','migrations','COMMON','ENDPOINT','version','.hook-directory-migrate-','mergedCli','lastSync','ino','join','nonInteractive','Force\x20overwrite\x20local\x20unsynced\x20changes','projectedFunctions','\x22\x20and\x20\x22','require','functions','filePath','Force\x20pull\x20cancelled.','hookLocation','stdin','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','toLowerCase','\x20conflict','\x22\x20from\x20\x22','&type=','stringify','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','values','would_pull','sourceDirectoryPathByNewDirectory','parse','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','length','appCode','remoteId','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','scriptType','datasetCode','8586324dTfrAq','¤tPage=1&pageSize=','defaultApp','scriptsRoot','profileName','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','oldDirectoryPath','str','9774930GXlTqn','skipped','Failed\x20to\x20write\x20local\x20script\x20\x22','Pull\x20only\x20this\x20script\x20type','some','includes','\x20--format\x20compress','HOOK/','normalize','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','oldDirectory','lockFilePath','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','delete','unresolvable\x20target\x20path','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','alias','5aPgGuF','\x22\x20may\x20remain.','dev','existed','/api/management/library/scripts/list?appCode=','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','cancelled','boolean','trim','newDirectory','content','functionNode','toISOString','entries','oldLockKey','bff','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','set','utf8','\x22\x20not\x20found\x20after\x20ensureLockScope.','force','\x20pulled','rollback','.js','43664iIaVTA','get','push','type','read','1299606MvoEAT','flatMap','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','message','newDirectoryPath','rekey','pull','\x20resolution','selectedAppName','scriptContent','lockKey','has','entry','Remote\x20script\x20missing\x20id.','scriptsRootDir','37586440mdxFjo','apiDir','\x20--name\x20','8CUcjvi','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','functionName','validation','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Lock\x20scope\x20for\x20app\x20\x22','mode','newLockKey','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','question','keyChanges','yes','\x22:\x20','\x22\x20to\x20\x22','all','ENOENT','apps','Pull\x20complete:\x20','reverse','HOOK','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.','GET','stderr'];a43_0x253b=function(){return _0x2b5509;};return a43_0x253b();}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_0x2847ba(0x129),'command':'pull','description':a43_0x2847ba(0xee),'risk':a43_0x2847ba(0x136),'structuredErrors':!![],'flags':[{'name':a43_0x2847ba(0x135),'type':'string','description':a43_0x2847ba(0x10b),'enum':[a43_0x2847ba(0xdc),a43_0x2847ba(0xdd),a43_0x2847ba(0x160)]},{'name':a43_0x2847ba(0x12e),'type':a43_0x2847ba(0x121),'description':a43_0x2847ba(0xe5)}],async 'dryRun'(_0x2e7ed9){const _0x33c87f=a43_0x2847ba,_0x58407c=loadBffProjectConfig(_0x2e7ed9['appCode']),_0x417607=await readBffLockFile(_0x58407c[_0x33c87f(0x113)]),{appLock:_0x383689}=ensureLockScope(_0x417607??createEmptyBffLock(),_0x2e7ed9[_0x33c87f(0xfb)],_0x58407c[_0x33c87f(0x103)],_0x33c87f(0x13e)),_0x49f9ed=normalizeBffType(_0x2e7ed9[_0x33c87f(0x107)](_0x33c87f(0x135)))??undefined,[_0x58997f,_0x343779]=await Promise[_0x33c87f(0x15b)]([listBffScripts(_0x2e7ed9[_0x33c87f(0xfb)],_0x49f9ed),getBffScriptStatistics(_0x2e7ed9[_0x33c87f(0xfb)])]),_0x771f1e=_0x58997f[_0x33c87f(0x10c)](_0x1f3233=>normalizeBffType(_0x1f3233['scriptType'])===_0x33c87f(0x160)),_0x5367ad=_0x771f1e?buildDatasetCodeToAliasMap(_0x2e7ed9[_0x33c87f(0x148)],_0x2e7ed9[_0x33c87f(0xfb)],_0x2e7ed9[_0x33c87f(0x140)]||_0x2e7ed9[_0x33c87f(0xe0)]?.[_0x33c87f(0xc8)]||_0x2e7ed9[_0x33c87f(0xe0)]?.[_0x33c87f(0x102)]):new Map(),_0x8cb015=_0x771f1e?await planHookDirectoryMigration(_0x58407c,_0x383689,_0x5367ad,await scanLocalBffFunctions(_0x58407c,_0x33c87f(0x160))):undefined,_0x344494=createHookLocationMap(_0x343779),_0x4929ee=[];for(const _0x5eb51b of _0x58997f){const _0x22b0d4=resolveRemoteScriptTarget(_0x58407c,_0x5eb51b,_0x344494,_0x8cb015?.[_0x33c87f(0xe6)]??_0x383689['functions'],_0x5367ad);if(!_0x22b0d4){_0x4929ee['push']({'scriptType':_0x5eb51b['scriptType'],'functionName':_0x5eb51b[_0x33c87f(0x14d)]??'','status':_0x33c87f(0x109),'reason':_0x33c87f(0x116)});continue;}const _0x269571=(_0x8cb015?.['projectedFunctions']??_0x383689[_0x33c87f(0xe9)])[_0x22b0d4[_0x33c87f(0x142)]],_0xbcf92c=_0x5eb51b[_0x33c87f(0x141)]!=null?computeContentHash(_0x5eb51b['scriptContent']):undefined,_0xcf4a69=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x8cb015,_0x22b0d4)??_0x22b0d4[_0x33c87f(0xea)],_0x269571,_0xbcf92c),_0xa00c5a=_0xcf4a69?localUnsyncedConflict(_0x22b0d4,_0x5eb51b['id']):undefined;_0x4929ee['push']({'lockKey':_0x22b0d4['lockKey'],'filePath':_0x22b0d4[_0x33c87f(0xea)],'remoteId':_0x5eb51b['id']??null,'status':_0xa00c5a?'conflict':_0x33c87f(0xf6),..._0xa00c5a?{'conflict':_0xa00c5a}:{},..._0x22b0d4[_0x33c87f(0xec)]?{'alias':_0x22b0d4['hookLocation'][_0x33c87f(0x119)]??null,'datasetCode':_0x22b0d4[_0x33c87f(0xec)][_0x33c87f(0xff)],'operationType':_0x22b0d4[_0x33c87f(0xec)]['operationType'],'functionNode':_0x22b0d4[_0x33c87f(0xec)][_0x33c87f(0x125)]}:{}});}return{'method':_0x33c87f(0xc3),'url':_0x33c87f(0x11e)+_0x2e7ed9[_0x33c87f(0xfb)]+(_0x49f9ed?_0x33c87f(0xf2)+_0x49f9ed:'')+_0x33c87f(0x101)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x2e7ed9[_0x33c87f(0xfb)],'filterType':_0x49f9ed??null,..._0x8cb015&&_0x8cb015[_0x33c87f(0xdb)][_0x33c87f(0xfa)]>0x0?{'hookDirectoryMigrations':_0x8cb015[_0x33c87f(0xdb)][_0x33c87f(0xc7)](_0x15b5ed=>({'from':_0x15b5ed[_0x33c87f(0x112)],'to':_0x15b5ed[_0x33c87f(0x123)]}))}:{},'files':_0x4929ee},'description':'Would\x20inspect\x20'+_0x4929ee[_0x33c87f(0xfa)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x17ebbe){const _0x332171=a43_0x2847ba,_0x397c94=loadBffProjectConfig(_0x17ebbe[_0x332171(0xfb)]),_0x6781f8=await readBffLockFile(_0x397c94[_0x332171(0x113)]),{lockData:_0x7bf2a1,appLock:_0xcfd1e1}=ensureLockScope(_0x6781f8??createEmptyBffLock(),_0x17ebbe[_0x332171(0xfb)],_0x397c94[_0x332171(0x103)],_0x332171(0x13e)),_0x2ff0bf=normalizeBffType(_0x17ebbe[_0x332171(0x107)](_0x332171(0x135)))??undefined;if(_0x17ebbe[_0x332171(0x107)](_0x332171(0x135))&&!_0x2ff0bf)throw CliErrors[_0x332171(0x14e)](_0x332171(0xd3));const [_0x4762de,_0x254635]=await Promise[_0x332171(0x15b)]([listBffScripts(_0x17ebbe[_0x332171(0xfb)],_0x2ff0bf),getBffScriptStatistics(_0x17ebbe[_0x332171(0xfb)])]);if(_0x4762de[_0x332171(0xfa)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x332171(0x117)};const _0x321611=_0x17ebbe[_0x332171(0xd7)](_0x332171(0x12e));if(_0x321611&&!_0x17ebbe[_0x332171(0xe4)]){const _0x84fb1e=await confirmForce();if(!_0x84fb1e)throw CliErrors[_0x332171(0x120)](_0x332171(0xeb));}if(_0x321611&&_0x17ebbe[_0x332171(0xe4)]){}const _0x352b33=_0x4762de[_0x332171(0x10c)](_0x4ff28f=>normalizeBffType(_0x4ff28f['scriptType'])===_0x332171(0x160)),_0x485ea4=_0x352b33?buildDatasetCodeToAliasMap(_0x17ebbe['apiDir'],_0x17ebbe[_0x332171(0xfb)],_0x17ebbe[_0x332171(0x140)]||_0x17ebbe['mergedCli']?.[_0x332171(0xc8)]||_0x17ebbe[_0x332171(0xe0)]?.[_0x332171(0x102)]):new Map(),_0x2c66a7=createHookLocationMap(_0x254635),_0x4b6753=JSON[_0x332171(0xf8)](JSON[_0x332171(0xf3)](_0x7bf2a1)),_0x2c86c2=_0x17ebbe[_0x332171(0xfb)],_0x263411=_0x4b6753[_0x332171(0x15d)][_0x2c86c2];if(!_0x263411)throw new Error(_0x332171(0x151)+_0x2c86c2+_0x332171(0x12d));const _0x14d85f=_0x352b33?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x397c94,_0x263411,_0x485ea4,await scanLocalBffFunctions(_0x397c94,_0x332171(0x160))),_0x263411):undefined,_0x206d5b=createPullFileTransaction(),_0x20fb14=[],_0x3f2da8=[],_0x1d4211=[],_0x488329=[];for(const _0x4962f6 of _0x4762de){const _0x20c0af=resolveRemoteScriptTarget(_0x397c94,_0x4962f6,_0x2c66a7,_0x263411[_0x332171(0xe9)],_0x485ea4);if(!_0x20c0af){_0x3f2da8[_0x332171(0x134)]({'lockKey':_0x4962f6[_0x332171(0xfe)]+'/'+_0x4962f6[_0x332171(0x14d)],'reason':_0x332171(0x116)});continue;}const _0x503bd4=_0x263411[_0x332171(0xe9)][_0x20c0af[_0x332171(0x142)]];try{if(!_0x4962f6['id'])throw new Error(_0x332171(0x145));if(_0x4962f6[_0x332171(0x141)]==null)throw new Error(_0x332171(0xd5));const _0x212532=_0x4962f6[_0x332171(0x141)],_0xf4b899=computeContentHash(_0x212532);if(!_0x321611){const _0x5a7852=await hasUnsyncedLocalChanges(_0x20c0af[_0x332171(0xea)],_0x503bd4,_0xf4b899);if(_0x5a7852){_0x1d4211[_0x332171(0x134)](localUnsyncedConflict(_0x20c0af,_0x4962f6['id']));continue;}}await _0x206d5b[_0x332171(0xd8)](_0x20c0af['filePath'],_0x212532);const _0x365ab4={'hash':_0xf4b899,'remoteId':_0x4962f6['id'],'version':_0x4962f6[_0x332171(0xde)]};_0x20c0af[_0x332171(0x135)]==='HOOK'&&_0x20c0af[_0x332171(0xec)]&&(_0x365ab4['alias']=_0x20c0af['hookLocation'][_0x332171(0x119)],_0x365ab4['datasetCode']=_0x20c0af[_0x332171(0xec)]['datasetCode'],_0x365ab4['operationType']=_0x20c0af['hookLocation'][_0x332171(0xcb)],_0x365ab4[_0x332171(0x125)]=_0x20c0af[_0x332171(0xec)][_0x332171(0x125)]),_0x263411['functions'][_0x20c0af[_0x332171(0x142)]]=_0x365ab4,_0x20fb14[_0x332171(0x134)]({'lockKey':_0x20c0af[_0x332171(0x142)],'remoteId':_0x4962f6['id']});}catch(_0x46a07d){_0x488329[_0x332171(0x134)]({'lockKey':_0x20c0af[_0x332171(0x142)],'error':_0x46a07d instanceof Error?_0x46a07d[_0x332171(0x13b)]:String(_0x46a07d)});}}_0x263411[_0x332171(0xe1)]=new Date()[_0x332171(0x126)]();try{await writeBffLockFile(_0x397c94[_0x332171(0x113)],_0x4b6753);}catch(_0x49ecc2){const _0x170cc7=[...await _0x206d5b['rollback'](),...await _0x14d85f?.[_0x332171(0x130)]()??[]];throw withRollbackErrors(_0x49ecc2,_0x332171(0x155),_0x170cc7);}return{'ok':_0x488329['length']===0x0,'data':{'pulled':_0x20fb14,'skipped':_0x3f2da8,'conflicts':_0x1d4211,'failed':_0x488329},'message':formatPullMessage(_0x20fb14[_0x332171(0xfa)],_0x3f2da8[_0x332171(0xfa)],_0x1d4211['length'],_0x488329['length'])};}};function localUnsyncedConflict(_0x15168d,_0x22c795){const _0x218309=a43_0x2847ba,_0x65aa63=_0x15168d[_0x218309(0x142)][_0x218309(0xc5)]('/')['at'](-0x1);return{'code':_0x218309(0xce),'lockKey':_0x15168d[_0x218309(0x142)],'filePath':_0x15168d['filePath'],..._0x22c795!=null?{'remoteId':_0x22c795}:{},'message':_0x218309(0x14f),'nextAction':{'action':'push_local','command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x15168d[_0x218309(0x135)]+_0x218309(0x149)+_0x65aa63+_0x218309(0x10e),'requiresReview':!![],'message':_0x218309(0x161)}};}function formatPullMessage(_0x1134b4,_0x50315e,_0x9e7e9f,_0x5ecc54){const _0xd456ae=a43_0x2847ba,_0x6f5bbb=[_0xd456ae(0x15e)+_0x1134b4+_0xd456ae(0x12f),_0x50315e+'\x20skipped'];_0x9e7e9f>0x0&&_0x6f5bbb[_0xd456ae(0x134)](_0x9e7e9f+_0xd456ae(0xf0)+(_0x9e7e9f===0x1?'':'s')+'\x20'+(_0x9e7e9f===0x1?_0xd456ae(0xda):_0xd456ae(0xe8))+_0xd456ae(0x13f));if(_0x5ecc54>0x0)_0x6f5bbb[_0xd456ae(0x134)](_0x5ecc54+_0xd456ae(0xca));return _0x6f5bbb[_0xd456ae(0xe3)](',\x20');}async function hasUnsyncedLocalChanges(_0x28405f,_0x48f6ce,_0x2a8f84){if(!await fileExists(_0x28405f))return![];const _0x336fc8=await computeFileHash(_0x28405f);if(!_0x48f6ce)return _0x2a8f84?_0x336fc8!==_0x2a8f84:!![];return _0x336fc8!==_0x48f6ce['hash'];}function createPullFileTransaction(){const _0x5c5616=new Map(),_0x3880f7=async(_0x5c9f4b,_0x136426)=>{const _0x6a9b94=a43_0x3f0d;try{if(_0x136426[_0x6a9b94(0x11d)])await ensureParentDirectory(_0x5c9f4b),await writeFile(_0x5c9f4b,_0x136426[_0x6a9b94(0x124)]);else try{await unlink(_0x5c9f4b);}catch(_0x1634de){if(_0x1634de['code']!==_0x6a9b94(0x15c))throw _0x1634de;}return undefined;}catch(_0x239f9c){return _0x239f9c instanceof Error?_0x239f9c:new Error(String(_0x239f9c));}};return{async 'write'(_0x4576a7,_0x5ebad9){const _0x2ebadc=a43_0x3f0d;if(!_0x5c5616['has'](_0x4576a7))try{_0x5c5616['set'](_0x4576a7,{'existed':!![],'content':await readFile(_0x4576a7)});}catch(_0x977f7f){if(_0x977f7f['code']!==_0x2ebadc(0x15c))throw _0x977f7f;_0x5c5616['set'](_0x4576a7,{'existed':![]});}try{await ensureParentDirectory(_0x4576a7),await writeFile(_0x4576a7,_0x5ebad9,_0x2ebadc(0x12c));}catch(_0x34c9e9){const _0x5d8178=await _0x3880f7(_0x4576a7,_0x5c5616['get'](_0x4576a7));if(!_0x5d8178)_0x5c5616[_0x2ebadc(0x115)](_0x4576a7);throw withRollbackErrors(_0x34c9e9,_0x2ebadc(0x10a)+_0x4576a7+'\x22.',_0x5d8178?[_0x5d8178]:[]);}},async 'rollback'(){const _0x58ea6b=a43_0x3f0d,_0x36619c=[];for(const [_0x5e9967,_0xdc62a8]of[..._0x5c5616[_0x58ea6b(0x127)]()][_0x58ea6b(0x15f)]()){const _0x26a49a=await _0x3880f7(_0x5e9967,_0xdc62a8);_0x26a49a&&_0x36619c[_0x58ea6b(0x134)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x5e9967+_0x58ea6b(0x159)+_0x26a49a[_0x58ea6b(0x13b)]));}return _0x36619c;}};}function withRollbackErrors(_0x47b21c,_0x245528,_0x50ae8c){const _0x23ce82=a43_0x2847ba,_0x461884=_0x47b21c instanceof Error?_0x47b21c:new Error(String(_0x47b21c));if(_0x50ae8c[_0x23ce82(0xfa)]===0x0)return _0x461884;return new AggregateError([_0x461884,..._0x50ae8c],_0x245528+'\x20Recovery\x20errors:\x20'+_0x50ae8c['map'](_0x10c75f=>_0x10c75f[_0x23ce82(0x13b)])[_0x23ce82(0xe3)](';\x20'));}function buildDatasetCodeToAliasMap(_0x3b80b4,_0x22a090,_0xe25ba5){const _0x1dc2b0=a43_0x2847ba,_0x413b68=resolveApiModelSource(_0x3b80b4,_0x22a090,_0xe25ba5),_0x5f464f=loadAliasMap(_0x3b80b4,undefined,_0x413b68[_0x1dc2b0(0xea)],_0x413b68[_0x1dc2b0(0x104)]);return assertUnambiguousHookAliases(_0x5f464f),new Map(_0x5f464f[_0x1dc2b0(0xc7)](_0x568a9e=>[_0x568a9e['datasetCode'][_0x1dc2b0(0xef)](),_0x568a9e[_0x1dc2b0(0x119)]]));}async function planHookDirectoryMigration(_0x57318a,_0x4620b7,_0x54f843,_0x16c71c){const _0x3da747=a43_0x2847ba,_0x18d92b=new Map();for(const [_0x3a2294,_0x2dea8d]of Object[_0x3da747(0x127)](_0x4620b7['functions'])){const [_0x3fdc52,_0x49cad0,_0xa41ada,_0x3ccd0e,_0x367d47,..._0x3496bd]=_0x3a2294[_0x3da747(0xc5)]('/');if(_0x3fdc52!==_0x3da747(0x160)||!_0x49cad0||!_0xa41ada||!_0x3ccd0e||!_0x367d47||_0x3496bd[_0x3da747(0xfa)]>0x0||!_0x2dea8d[_0x3da747(0xff)])continue;const _0x6d3b75=_0x54f843[_0x3da747(0x133)](_0x2dea8d['datasetCode'][_0x3da747(0xef)]()),_0x2106eb=_0x6d3b75??_0x2dea8d['datasetCode'];if(!isSafeHookDirectorySegment(_0x49cad0))throw CliErrors[_0x3da747(0x14e)](_0x3da747(0x150)+_0x49cad0+_0x3da747(0xd9));if(!isSafeHookDirectorySegment(_0x2106eb))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x49cad0+_0x3da747(0xc9));if(_0x49cad0===_0x2106eb)continue;const _0x5198cd=_0x18d92b[_0x3da747(0x133)](_0x49cad0)??{'datasetCode':_0x2dea8d[_0x3da747(0xff)],'alias':_0x6d3b75,'keyChanges':[]};if(_0x5198cd['datasetCode']!==_0x2dea8d['datasetCode'])throw CliErrors[_0x3da747(0x14e)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x49cad0+_0x3da747(0x13a));const _0xb9f98f=_0x3da747(0x10f)+_0x2106eb+'/'+_0xa41ada+'/'+_0x3ccd0e+'/'+_0x367d47;try{resolveLocalFilePathFromLockKey(_0x57318a,_0x3a2294),resolveLocalFilePathFromLockKey(_0x57318a,_0xb9f98f);}catch(_0x4982c4){throw CliErrors[_0x3da747(0x14e)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x3a2294+'\x22:\x20'+(_0x4982c4 instanceof Error?_0x4982c4[_0x3da747(0x13b)]:String(_0x4982c4)));}_0x5198cd[_0x3da747(0x157)][_0x3da747(0x134)]({'oldLockKey':_0x3a2294,'newLockKey':_0xb9f98f,'entry':_0x2dea8d}),_0x18d92b[_0x3da747(0x12b)](_0x49cad0,_0x5198cd);}const _0x5f4426=new Set([..._0x18d92b[_0x3da747(0xf5)]()][_0x3da747(0x138)](_0x1dada7=>_0x1dada7['keyChanges'][_0x3da747(0xc7)](_0x1ebcaa=>_0x1ebcaa['oldLockKey']))),_0x2d1bd3=new Map(),_0x23a7bc=new Map();for(const [_0x5817fb,_0x21a707]of _0x18d92b){const _0x14aae2=_0x21a707[_0x3da747(0x119)]??_0x21a707[_0x3da747(0xff)],_0x50293d=hookDirectoryIdentity(_0x14aae2),_0xcd5942=_0x2d1bd3[_0x3da747(0x133)](_0x50293d);if(_0xcd5942&&_0xcd5942!==_0x5817fb)throw CliErrors['validation'](_0x3da747(0x118)+_0xcd5942+_0x3da747(0xe7)+_0x5817fb+'\x22:\x20both\x20target\x20\x22'+_0x14aae2+_0x3da747(0x11f));_0x2d1bd3[_0x3da747(0x12b)](_0x50293d,_0x5817fb);for(const _0x3e26d4 of _0x21a707['keyChanges']){const _0xf84038=_0x23a7bc[_0x3da747(0x133)](_0x3e26d4[_0x3da747(0x153)]);if(_0xf84038&&_0xf84038!==_0x3e26d4['oldLockKey'])throw CliErrors[_0x3da747(0x14e)](_0x3da747(0x154)+_0xf84038+_0x3da747(0xe7)+_0x3e26d4[_0x3da747(0x128)]+_0x3da747(0xcc)+_0x3e26d4[_0x3da747(0x153)]+_0x3da747(0x12a));if(_0x5f4426[_0x3da747(0x143)](_0x3e26d4[_0x3da747(0x153)]))throw CliErrors['validation'](_0x3da747(0xf9)+_0x3e26d4[_0x3da747(0x128)]+_0x3da747(0xcd)+_0x3e26d4[_0x3da747(0x153)]+_0x3da747(0xfd));_0x23a7bc[_0x3da747(0x12b)](_0x3e26d4[_0x3da747(0x153)],_0x3e26d4['oldLockKey']);}}const _0x3da110=new Map();for(const [_0x3ba233,_0x4cf5b4]of _0x54f843){_0x3da110[_0x3da747(0x12b)](hookDirectoryIdentity(_0x4cf5b4),_0x3ba233);}const _0x5070a3=[];for(const [_0x37c3d3,_0x762e81]of _0x18d92b){const _0x233bd3=_0x762e81[_0x3da747(0x119)]??_0x762e81[_0x3da747(0xff)],_0x3a4abb=join(_0x57318a[_0x3da747(0x146)],_0x3da747(0x160),_0x37c3d3),_0x67d8e=join(_0x57318a[_0x3da747(0x146)],'HOOK',_0x233bd3),_0x3ea1f1=await directoryExists(_0x3a4abb),_0x5c6391=await directoryExists(_0x67d8e),_0x1ac0e7=_0x3ea1f1?_0x5c6391?await sameDirectory(_0x3a4abb,_0x67d8e)?'case-rename':undefined:_0x3da747(0xd2):'rekey';if(!_0x1ac0e7)throw CliErrors[_0x3da747(0x14e)](_0x3da747(0x105)+_0x37c3d3+_0x3da747(0x15a)+_0x233bd3+_0x3da747(0x14b));const _0x9d558d=_0x3da110[_0x3da747(0x133)](hookDirectoryIdentity(_0x37c3d3));if(_0x9d558d&&_0x9d558d!==_0x762e81[_0x3da747(0xff)][_0x3da747(0xef)]()){const _0x2ed761=new Set(_0x762e81[_0x3da747(0x157)]['map'](_0x467498=>_0x467498[_0x3da747(0x128)])),_0x210fbe=_0x16c71c['filter'](_0x22eb89=>_0x22eb89[_0x3da747(0x135)]===_0x3da747(0x160)&&_0x22eb89['alias']!=null&&hookDirectoryIdentity(_0x22eb89['alias'])===hookDirectoryIdentity(_0x37c3d3)&&!_0x2ed761[_0x3da747(0x143)](_0x22eb89[_0x3da747(0x142)]));if(_0x210fbe['length']>0x0)throw CliErrors[_0x3da747(0x14e)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x37c3d3+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x277aef=_0x3da110[_0x3da747(0x133)](hookDirectoryIdentity(_0x233bd3));if(_0x277aef&&_0x277aef!==_0x762e81['datasetCode'][_0x3da747(0xef)]())throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x37c3d3+_0x3da747(0x15a)+_0x233bd3+_0x3da747(0xf4));for(const _0x41d28f of _0x762e81['keyChanges']){const _0x310a0c=_0x4620b7['functions'][_0x41d28f[_0x3da747(0x153)]];if(_0x310a0c&&!_0x5f4426[_0x3da747(0x143)](_0x41d28f['newLockKey'])&&!sameHookIdentity(_0x41d28f[_0x3da747(0x144)],_0x310a0c))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x37c3d3+_0x3da747(0x15a)+_0x233bd3+'\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.');}_0x5070a3[_0x3da747(0x134)]({'oldDirectory':_0x37c3d3,'newDirectory':_0x233bd3,'oldDirectoryPath':_0x3a4abb,'newDirectoryPath':_0x67d8e,'mode':_0x1ac0e7,'alias':_0x762e81[_0x3da747(0x119)],'keyChanges':_0x762e81['keyChanges']});}const _0x31035a={..._0x4620b7[_0x3da747(0xe9)]},_0x2857e0=new Map(),_0x4afc32=new Map();for(const _0x3948bd of _0x5070a3){const _0x4cf55f=_0x3948bd['mode']!==_0x3da747(0x13d);_0x4cf55f&&_0x4afc32[_0x3da747(0x12b)](hookDirectoryIdentity(_0x3948bd[_0x3da747(0x123)]),_0x3948bd['oldDirectoryPath']);for(const _0x3f579e of _0x3948bd[_0x3da747(0x157)]){const _0x487167=_0x31035a[_0x3f579e[_0x3da747(0x153)]],_0x488fdb=_0x4cf55f?_0x3f579e['entry']:_0x487167??_0x3f579e[_0x3da747(0x144)];_0x31035a[_0x3f579e['newLockKey']]=canonicalizeHookEntry(_0x488fdb,_0x3948bd['alias']),delete _0x31035a[_0x3f579e['oldLockKey']],_0x4cf55f&&_0x2857e0[_0x3da747(0x12b)](_0x3f579e['newLockKey'],resolveLocalFilePathFromLockKey(_0x57318a,_0x3f579e[_0x3da747(0x128)]));}}return{'migrations':_0x5070a3,'projectedFunctions':_0x31035a,'sourceFilePathByNewLockKey':_0x2857e0,'sourceDirectoryPathByNewDirectory':_0x4afc32};}function resolveMigratedSourceFilePath(_0x558920,_0xbd7ea0){const _0x2eb08b=a43_0x2847ba;if(!_0x558920||!_0xbd7ea0)return undefined;const _0x1dbb59=_0x558920['sourceFilePathByNewLockKey']['get'](_0xbd7ea0[_0x2eb08b(0x142)]);if(_0x1dbb59)return _0x1dbb59;if(_0xbd7ea0[_0x2eb08b(0x135)]!==_0x2eb08b(0x160))return undefined;const [,_0x23e7ad,..._0x17c5aa]=_0xbd7ea0[_0x2eb08b(0x142)]['split']('/');if(!_0x23e7ad||_0x17c5aa[_0x2eb08b(0xfa)]===0x0)return undefined;const _0x405b39=_0x558920[_0x2eb08b(0xf7)][_0x2eb08b(0x133)](hookDirectoryIdentity(_0x23e7ad));return _0x405b39?join(_0x405b39,..._0x17c5aa)+_0x2eb08b(0x131):undefined;}function sameHookIdentity(_0x233c39,_0x33e8f1){const _0x45800d=a43_0x2847ba;return _0x233c39[_0x45800d(0xfc)]===_0x33e8f1[_0x45800d(0xfc)]&&_0x233c39['datasetCode']===_0x33e8f1[_0x45800d(0xff)]&&_0x233c39[_0x45800d(0xcb)]===_0x33e8f1['operationType']&&_0x233c39[_0x45800d(0x125)]===_0x33e8f1[_0x45800d(0x125)];}function canonicalizeHookEntry(_0x5c40b4,_0x297b0f){const {alias:_0x67c41,..._0x55c2c}=_0x5c40b4;return _0x297b0f?{..._0x55c2c,'alias':_0x297b0f}:_0x55c2c;}function hookDirectoryIdentity(_0x3ce861){const _0x23e1e6=a43_0x2847ba;return _0x3ce861[_0x23e1e6(0x110)](_0x23e1e6(0xc6))[_0x23e1e6(0xef)]();}function isSafeHookDirectorySegment(_0x2f56b3){return isSafeLockKeySegment(_0x2f56b3);}async function sameDirectory(_0x2b1dd2,_0x16969a){const _0x3f71e9=a43_0x2847ba,[_0x4ad30e,_0xed0b77]=await Promise[_0x3f71e9(0x15b)]([stat(_0x2b1dd2),stat(_0x16969a)]);return _0x4ad30e['dev']===_0xed0b77[_0x3f71e9(0x11c)]&&_0x4ad30e[_0x3f71e9(0xe2)]===_0xed0b77['ino'];}async function applyHookDirectoryMigration(_0x5a6e51,_0x361e1c){const _0x56dd5c=a43_0x2847ba,_0x17b5c1=_0x361e1c['functions'],_0x19af53=_0x361e1c['lastSync'],_0x51fad8=[],_0x5ec45d=async()=>{const _0x22899e=a43_0x3f0d,_0x358eb0=[];_0x361e1c['functions']=_0x17b5c1,_0x361e1c[_0x22899e(0xe1)]=_0x19af53;for(const {migration:_0x1c728f,temporaryPath:_0x257f60}of[..._0x51fad8][_0x22899e(0x15f)]()){try{_0x257f60?(await rename(_0x1c728f[_0x22899e(0x13c)],_0x257f60),await rename(_0x257f60,_0x1c728f[_0x22899e(0x106)])):await rename(_0x1c728f[_0x22899e(0x13c)],_0x1c728f[_0x22899e(0x106)]);}catch(_0x354830){_0x358eb0[_0x22899e(0x134)](new Error(_0x22899e(0x14c)+_0x1c728f['oldDirectory']+_0x22899e(0xf1)+_0x1c728f['newDirectory']+_0x22899e(0x159)+(_0x354830 instanceof Error?_0x354830[_0x22899e(0x13b)]:String(_0x354830))));}}return _0x358eb0;};try{for(const _0xc8465b of _0x5a6e51[_0x56dd5c(0xdb)]){if(_0xc8465b[_0x56dd5c(0x152)]===_0x56dd5c(0xd2))await ensureParentDirectory(_0xc8465b['newDirectoryPath']),await rename(_0xc8465b[_0x56dd5c(0x106)],_0xc8465b['newDirectoryPath']),_0x51fad8[_0x56dd5c(0x134)]({'migration':_0xc8465b});else{if(_0xc8465b[_0x56dd5c(0x152)]==='case-rename'){const _0x3a8129=join(dirname(_0xc8465b[_0x56dd5c(0x106)]),_0x56dd5c(0xdf)+randomUUID());await rename(_0xc8465b[_0x56dd5c(0x106)],_0x3a8129);try{await rename(_0x3a8129,_0xc8465b[_0x56dd5c(0x13c)]);}catch(_0x2ba87f){try{await rename(_0x3a8129,_0xc8465b[_0x56dd5c(0x106)]);}catch(_0x15f99c){throw withRollbackErrors(_0x2ba87f,_0x56dd5c(0xd1)+_0xc8465b[_0x56dd5c(0x112)]+_0x56dd5c(0x15a)+_0xc8465b[_0x56dd5c(0x123)]+_0x56dd5c(0xd0)+_0x3a8129+_0x56dd5c(0x11b),[new Error(_0x56dd5c(0x114)+_0x3a8129+_0x56dd5c(0x15a)+_0xc8465b[_0x56dd5c(0x112)]+_0x56dd5c(0x159)+(_0x15f99c instanceof Error?_0x15f99c[_0x56dd5c(0x13b)]:String(_0x15f99c)))]);}throw _0x2ba87f;}_0x51fad8[_0x56dd5c(0x134)]({'migration':_0xc8465b,'temporaryPath':_0x3a8129});}}}return _0x361e1c[_0x56dd5c(0xe9)]=_0x5a6e51['projectedFunctions'],{'rollback':_0x5ec45d};}catch(_0x457fe6){const _0xfd5464=await _0x5ec45d();throw withRollbackErrors(_0x457fe6,_0x56dd5c(0x111),_0xfd5464);}}async function confirmForce(){const _0x36c2b6=a43_0x2847ba,_0x21e0cc=createInterface({'input':process[_0x36c2b6(0xed)],'output':process[_0x36c2b6(0xc4)]}),_0x5b1fc5=await new Promise(_0x588be5=>{const _0x48841e=_0x36c2b6;_0x21e0cc[_0x48841e(0x156)](_0x48841e(0x139),_0x588be5);});return _0x21e0cc['close'](),['y',_0x36c2b6(0x158)][_0x36c2b6(0x10d)](_0x5b1fc5[_0x36c2b6(0x122)]()[_0x36c2b6(0xef)]());}
|
|
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']());}
|