@lovrabet/rabetbase-cli 2.5.9-beta.1 → 2.5.10-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.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/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/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -2
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase-dataset-generation/SKILL.md +2 -2
- package/skills/rabetbase-page-generation/SKILL.md +2 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a34_0x3bb6(){const _0x3b8eb1=['app-config','update','apiError','Updated','3287424IgYQwp','POST','\x20app\x20config\x20',',\x20appCode=','196zMWnlM','App\x20config\x20server\x20id\x20missing\x20for\x20key=','isFinite','string','9422fJNLIc','2880445gPeDNT','65829XOSmKX','create','Created','write','1347378JLIfgm','1650604fnEKtC','tags','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','Read\x20config\x20value\x20from\x20file','19235079oaIEYa','/smartapi/app-config/update','number','get','/smartapi/app-config/create','appCode','5190bZZIqj'];a34_0x3bb6=function(){return _0x3b8eb1;};return a34_0x3bb6();}const a34_0x4416e6=a34_0x4067;(function(_0x29feea,_0x3e4051){const _0xd9d596=a34_0x4067,_0x46bb15=_0x29feea();while(!![]){try{const _0x364e69=-parseInt(_0xd9d596(0x102))/0x1+parseInt(_0xd9d596(0x101))/0x2+-parseInt(_0xd9d596(0xfd))/0x3*(-parseInt(_0xd9d596(0x115))/0x4)+-parseInt(_0xd9d596(0xfc))/0x5+-parseInt(_0xd9d596(0x10c))/0x6*(parseInt(_0xd9d596(0xfb))/0x7)+parseInt(_0xd9d596(0x111))/0x8+parseInt(_0xd9d596(0x106))/0x9;if(_0x364e69===_0x3e4051)break;else _0x46bb15['push'](_0x46bb15['shift']());}catch(_0x1647ef){_0x46bb15['push'](_0x46bb15['shift']());}}}(a34_0x3bb6,0xdd358));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';function a34_0x4067(_0x1f3fc1,_0x2a2e22){_0x1f3fc1=_0x1f3fc1-0xf9;const _0x3bb6fc=a34_0x3bb6();let _0x40676e=_0x3bb6fc[_0x1f3fc1];return _0x40676e;}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';const CREATE_PATH=a34_0x4416e6(0x10a),UPDATE_PATH=a34_0x4416e6(0x107);export const appConfigSet={'service':a34_0x4416e6(0x10d),'command':'set','description':a34_0x4416e6(0x104),'risk':a34_0x4416e6(0x100),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':'file','type':a34_0x4416e6(0xfa),'description':a34_0x4416e6(0x105)}],async 'validate'(_0x4474b3){readKeyArg(_0x4474b3),readOptionalTags(_0x4474b3),assertSingleValueSource(_0x4474b3);},async 'dryRun'(_0x1b56c6){const _0xd10afb=a34_0x4416e6,_0x450b11=readKeyArg(_0x1b56c6),_0x26ac17=readOptionalTags(_0x1b56c6),_0x2c50ef=assertSingleValueSource(_0x1b56c6);await assertValueSourceReadable(_0x2c50ef);const _0x53bd96=await withAppConfigApiBoundary(_0xd10afb(0x109),{'appCode':_0x1b56c6[_0xd10afb(0x10b)],'key':_0x450b11},()=>getAppConfigByKey(_0x1b56c6[_0xd10afb(0x10b)],_0x450b11)),_0xddb109=_0x53bd96?_0xd10afb(0x10e):_0xd10afb(0xfe),_0x25516f=_0x53bd96?projectAppConfig(_0x53bd96):null,_0x10b519=plannedAppConfig({'appCode':_0x1b56c6[_0xd10afb(0x10b)],'key':_0x450b11,'tags':_0x26ac17??_0x53bd96?.['tags'],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0xddb109,'appCode':_0x1b56c6[_0xd10afb(0x10b)],'key':_0x450b11,'before':_0x25516f,'after':_0x10b519,'dryRun':!![]}),{'method':_0xd10afb(0x112),'url':_0xddb109===_0xd10afb(0x10e)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x1f336a){const _0x3a4204=a34_0x4416e6,_0x3bdba0=readKeyArg(_0x1f336a),_0x586922=readOptionalTags(_0x1f336a),_0x53ccc3=await withAppConfigApiBoundary('get',{'appCode':_0x1f336a[_0x3a4204(0x10b)],'key':_0x3bdba0},()=>getAppConfigByKey(_0x1f336a['appCode'],_0x3bdba0)),_0x1f1b07=_0x53ccc3?projectAppConfig(_0x53ccc3):null,_0x5508d9=_0x53ccc3?_0x3a4204(0x10e):_0x3a4204(0xfe),{value:_0xb06594,warnings:_0x2e8fb7}=await readAppConfigValue(_0x1f336a),_0x30d28a={'appCode':_0x1f336a['appCode'],'key':_0x3bdba0,'value':_0xb06594,'tags':_0x586922??_0x53ccc3?.[_0x3a4204(0x103)]??undefined};await withAppConfigApiBoundary(_0x5508d9,{'appCode':_0x1f336a[_0x3a4204(0x10b)],'key':_0x3bdba0},async()=>{const _0x49de25=_0x3a4204;_0x53ccc3?await updateAppConfig({..._0x30d28a,'id':requireAppConfigId(_0x53ccc3,_0x3bdba0,_0x1f336a[_0x49de25(0x10b)])}):await createAppConfig(_0x30d28a);});const _0x5773fb=await withAppConfigApiBoundary('get',{'appCode':_0x1f336a[_0x3a4204(0x10b)],'key':_0x3bdba0},()=>getAppConfigByKey(_0x1f336a['appCode'],_0x3bdba0)),_0x5486f6=_0x5773fb?projectAppConfig(_0x5773fb):plannedAppConfig({'appCode':_0x1f336a['appCode'],'key':_0x3bdba0,'tags':_0x30d28a[_0x3a4204(0x103)],'hasValue':_0xb06594!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x5508d9,'appCode':_0x1f336a[_0x3a4204(0x10b)],'key':_0x3bdba0,'before':_0x1f1b07,'after':_0x5486f6,'dryRun':![],'warnings':_0x2e8fb7}),'message':(_0x5508d9===_0x3a4204(0x10e)?_0x3a4204(0x110):_0x3a4204(0xff))+_0x3a4204(0x113)+_0x3bdba0};}};function requireAppConfigId(_0x283d0,_0x4c1888,_0x11e631){const _0x2e2982=a34_0x4416e6;if(typeof _0x283d0['id']===_0x2e2982(0x108)&&Number[_0x2e2982(0xf9)](_0x283d0['id'])&&_0x283d0['id']>0x0)return _0x283d0['id'];throw CliErrors[_0x2e2982(0x10f)](_0x2e2982(0x116)+_0x4c1888+_0x2e2982(0x114)+_0x11e631);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x22b607=a35_0x2b7b;(function(_0x5bbf97,_0x38ea2e){const _0x36f648=a35_0x2b7b,_0x15db83=_0x5bbf97();while(!![]){try{const _0xcbef62=-parseInt(_0x36f648(0x193))/0x1+parseInt(_0x36f648(0x1a4))/0x2*(-parseInt(_0x36f648(0x1ae))/0x3)+parseInt(_0x36f648(0x1a3))/0x4*(parseInt(_0x36f648(0x1ad))/0x5)+-parseInt(_0x36f648(0x1a2))/0x6*(-parseInt(_0x36f648(0x18c))/0x7)+parseInt(_0x36f648(0x199))/0x8*(-parseInt(_0x36f648(0x183))/0x9)+parseInt(_0x36f648(0x197))/0xa+parseInt(_0x36f648(0x187))/0xb*(parseInt(_0x36f648(0x1ab))/0xc);if(_0xcbef62===_0x38ea2e)break;else _0x15db83['push'](_0x15db83['shift']());}catch(_0x46282b){_0x15db83['push'](_0x15db83['shift']());}}}(a35_0x230e,0xd78af));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x22b607(0x177),'description':a35_0x22b607(0x17d),'required':!![]};export const VALUE_ARG={'name':a35_0x22b607(0x1b3),'description':a35_0x22b607(0x19c),'required':![]};export const TAGS_FLAG={'name':a35_0x22b607(0x192),'type':a35_0x22b607(0x1b1),'description':a35_0x22b607(0x1a0)};function a35_0x2b7b(_0x465e88,_0x4a966c){_0x465e88=_0x465e88-0x176;const _0x230e9e=a35_0x230e();let _0x2b7bfd=_0x230e9e[_0x465e88];return _0x2b7bfd;}export const STDIN_FLAG={'name':a35_0x22b607(0x176),'type':a35_0x22b607(0x1a8),'description':a35_0x22b607(0x1a5),'default':![]};export const FROM_ENV_FLAG={'name':'from-env','type':a35_0x22b607(0x1b1),'description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};export const REVEAL_FLAG={'name':a35_0x22b607(0x191),'type':a35_0x22b607(0x1a8),'description':a35_0x22b607(0x1af),'default':![]};export function readKeyArg(_0x2dff58){const _0x5a173a=a35_0x22b607,_0x4524fa=_0x2dff58[_0x5a173a(0x1ba)][0x0]?.[_0x5a173a(0x1ac)]()??'';return validateKey(_0x4524fa),_0x4524fa;}export function readOptionalTags(_0x18b0ef){const _0xc25d83=a35_0x22b607,_0x5671d9=_0x18b0ef[_0xc25d83(0x18b)]('tags')[_0xc25d83(0x1ac)]();if(!_0x5671d9)return undefined;if(_0x5671d9['length']>0x20)throw CliErrors[_0xc25d83(0x17c)](_0xc25d83(0x194));return _0x5671d9;}export function validateKey(_0x23db43){const _0x5622f5=a35_0x22b607;if(!_0x23db43)throw CliErrors[_0x5622f5(0x17c)](_0x5622f5(0x195));if(_0x23db43['length']>0x100)throw CliErrors[_0x5622f5(0x17c)](_0x5622f5(0x182));}export function projectAppConfig(_0x572348,_0x52d394){const _0xdb3da3=a35_0x22b607,_0x1acb6f=_0x572348['value']!==undefined&&_0x572348['value']!==null&&_0x572348[_0xdb3da3(0x1b3)]!=='',_0x1f9428={'appCode':_0x572348[_0xdb3da3(0x1aa)],'key':_0x572348[_0xdb3da3(0x177)],'tags':_0x572348[_0xdb3da3(0x192)]??undefined,'hasValue':_0x1acb6f,'valueRedacted':_0x1acb6f&&!_0x52d394?.['reveal'],'gmtCreate':_0x572348[_0xdb3da3(0x181)],'gmtModified':_0x572348[_0xdb3da3(0x19f)]};return _0x52d394?.[_0xdb3da3(0x191)]&&(_0x1f9428[_0xdb3da3(0x1b3)]=_0x572348[_0xdb3da3(0x1b3)]??'',_0x1f9428[_0xdb3da3(0x1b8)]=![]),_0x1f9428;}export function plannedAppConfig(_0x41e0de){const _0x3c179c=a35_0x22b607,_0x583587=_0x41e0de['hasValue']??!![];return{'appCode':_0x41e0de[_0x3c179c(0x1aa)],'key':_0x41e0de['key'],'tags':_0x41e0de[_0x3c179c(0x192)]??undefined,'hasValue':_0x583587,'valueRedacted':_0x583587};}export function buildMutationData(_0x46aa9f){const _0x1c32a7=a35_0x22b607;return{'operation':_0x46aa9f[_0x1c32a7(0x1b2)],'selector':{'appCode':_0x46aa9f[_0x1c32a7(0x1aa)],'key':_0x46aa9f[_0x1c32a7(0x177)]},'before':_0x46aa9f[_0x1c32a7(0x1b9)],'after':_0x46aa9f[_0x1c32a7(0x18a)],'dryRun':_0x46aa9f['dryRun'],'warnings':_0x46aa9f[_0x1c32a7(0x198)]??[]};}export async function withAppConfigApiBoundary(_0x543867,_0x5a2bac,_0xef3674){const _0x454f58=a35_0x22b607;try{return await _0xef3674();}catch{const _0xab6484=[_0x454f58(0x1b6)+_0x5a2bac['appCode']];if(_0x5a2bac['key'])_0xab6484[_0x454f58(0x186)]('key:\x20'+_0x5a2bac[_0x454f58(0x177)]);_0xab6484[_0x454f58(0x186)](_0x454f58(0x1bc));throw CliErrors[_0x454f58(0x1a7)](_0x454f58(0x1b5)+_0x543867+_0x454f58(0x17f),_0xab6484['join'](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x49dfc7,_0x1fbb9d){const _0x3cb98f=a35_0x22b607;return Object[_0x3cb98f(0x17a)](_0x49dfc7,{'method':{'value':_0x1fbb9d['method'],'enumerable':![]},'url':{'value':_0x1fbb9d[_0x3cb98f(0x1a9)],'enumerable':![]}});}export function assertSingleValueSource(_0x481db7){const _0x6a003b=a35_0x22b607,_0x3abcc6=[];_0x481db7['args'][_0x6a003b(0x18f)]>0x1&&_0x3abcc6[_0x6a003b(0x186)]({'kind':'argument','value':_0x481db7[_0x6a003b(0x1ba)][_0x6a003b(0x178)](0x1)[_0x6a003b(0x1a6)]('\x20')});const _0xbadddc=_0x481db7[_0x6a003b(0x1b4)](_0x6a003b(0x1b3));_0xbadddc!==undefined&&_0xbadddc!==null&&_0x3abcc6['push']({'kind':_0x6a003b(0x19b),'value':String(_0xbadddc)});_0x481db7[_0x6a003b(0x184)](_0x6a003b(0x176))&&_0x3abcc6['push']({'kind':'stdin'});const _0x2385e8=_0x481db7[_0x6a003b(0x18b)]('from-env')[_0x6a003b(0x1ac)]();_0x2385e8&&_0x3abcc6[_0x6a003b(0x186)]({'kind':_0x6a003b(0x180),'name':_0x2385e8});const _0x135654=_0x481db7[_0x6a003b(0x18b)](_0x6a003b(0x185))[_0x6a003b(0x1ac)]();_0x135654&&_0x3abcc6['push']({'kind':_0x6a003b(0x185),'path':_0x135654});if(_0x3abcc6[_0x6a003b(0x18f)]===0x0)throw CliErrors['validation'](_0x6a003b(0x190),_0x6a003b(0x19e));if(_0x3abcc6[_0x6a003b(0x18f)]>0x1)throw CliErrors[_0x6a003b(0x17c)](_0x6a003b(0x18e),_0x6a003b(0x1b7));return _0x3abcc6[0x0];}export async function assertValueSourceReadable(_0x21675a){const _0x2041dc=a35_0x22b607;if(_0x21675a['kind']===_0x2041dc(0x180)&&!(_0x21675a[_0x2041dc(0x17e)]in process.env))throw CliErrors['validation']('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x21675a[_0x2041dc(0x17e)]);if(_0x21675a[_0x2041dc(0x19a)]===_0x2041dc(0x185))try{await access(_0x21675a[_0x2041dc(0x188)]);}catch{throw CliErrors['validation'](_0x2041dc(0x17b)+_0x21675a['path']);}}export async function readAppConfigValue(_0x10e1de){const _0xd8a8d5=a35_0x22b607,_0x56eea3=assertSingleValueSource(_0x10e1de),_0x29a5b6=[];if(_0x56eea3[_0xd8a8d5(0x19a)]==='argument')return _0x29a5b6['push'](_0xd8a8d5(0x1a1)),{'value':_0x56eea3[_0xd8a8d5(0x1b3)]??'','source':_0x56eea3['kind'],'warnings':_0x29a5b6};if(_0x56eea3[_0xd8a8d5(0x19a)]===_0xd8a8d5(0x176))return{'value':await readStdin(),'source':_0x56eea3[_0xd8a8d5(0x19a)],'warnings':_0x29a5b6};if(_0x56eea3[_0xd8a8d5(0x19a)]===_0xd8a8d5(0x180)){if(!(_0x56eea3[_0xd8a8d5(0x17e)]in process.env))throw CliErrors[_0xd8a8d5(0x17c)](_0xd8a8d5(0x1bb)+_0x56eea3['name']);return{'value':process.env[_0x56eea3.name]??'','source':_0x56eea3[_0xd8a8d5(0x19a)],'warnings':_0x29a5b6};}return{'value':await readFile(_0x56eea3[_0xd8a8d5(0x188)],'utf8'),'source':_0x56eea3[_0xd8a8d5(0x19a)],'warnings':_0x29a5b6};}function a35_0x230e(){const _0x435402=['Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','6WElIxC','12DfbiiN','293174xSgoAY','Read\x20config\x20value\x20from\x20stdin','join','apiError','boolean','url','appCode','7459188aGNgbO','trim','2330560MnDJdE','27EuGkms','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','data','string','operation','value','flag','Failed\x20to\x20','appCode:\x20','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','valueRedacted','before','args','Environment\x20variable\x20is\x20not\x20set:\x20','value\x20is\x20redacted','stdin','key','slice','once','defineProperties','Value\x20file\x20is\x20not\x20readable:\x20','validation','Runtime\x20app-config\x20key','name','\x20app\x20config.','env','gmtCreate','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','1693530AipWWe','bool','file','push','22VlRKWW','path','error','after','str','10859422bobPbD','end','App\x20config\x20value\x20source\x20is\x20ambiguous.','length','Missing\x20app-config\x20value\x20source.','reveal','tags','1660998sNiGcI','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','Missing\x20app-config\x20key.','utf8','9874540zqGteA','warnings','56WnJIvg','kind','argument','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','setEncoding','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','gmtModified','Config\x20tags\x20for\x20filtering/display\x20metadata'];a35_0x230e=function(){return _0x435402;};return a35_0x230e();}function readStdin(){return new Promise((_0x53ae69,_0x1f721b)=>{const _0x1aad25=a35_0x2b7b;let _0x27c956='';process[_0x1aad25(0x176)][_0x1aad25(0x19d)](_0x1aad25(0x196)),process[_0x1aad25(0x176)]['on'](_0x1aad25(0x1b0),_0x1b5c2d=>{_0x27c956+=_0x1b5c2d;}),process[_0x1aad25(0x176)][_0x1aad25(0x179)](_0x1aad25(0x18d),()=>_0x53ae69(_0x27c956)),process[_0x1aad25(0x176)]['once'](_0x1aad25(0x189),_0x1f721b);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a36_0x32cd(_0x541207,_0x733a9e){_0x541207=_0x541207-0x160;const _0x34801f=a36_0x3480();let _0x32cdb8=_0x34801f[_0x541207];return _0x32cdb8;}const a36_0x516101=a36_0x32cd;(function(_0x11a821,_0x569dc1){const _0x10499f=a36_0x32cd,_0x3bf0da=_0x11a821();while(!![]){try{const _0x2e296e=parseInt(_0x10499f(0x16c))/0x1+-parseInt(_0x10499f(0x16d))/0x2*(parseInt(_0x10499f(0x164))/0x3)+-parseInt(_0x10499f(0x170))/0x4+parseInt(_0x10499f(0x173))/0x5*(-parseInt(_0x10499f(0x16b))/0x6)+-parseInt(_0x10499f(0x166))/0x7+-parseInt(_0x10499f(0x163))/0x8*(parseInt(_0x10499f(0x16a))/0x9)+parseInt(_0x10499f(0x169))/0xa*(parseInt(_0x10499f(0x171))/0xb);if(_0x2e296e===_0x569dc1)break;else _0x3bf0da['push'](_0x3bf0da['shift']());}catch(_0x487d9a){_0x3bf0da['push'](_0x3bf0da['shift']());}}}(a36_0x3480,0x1a894));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x3480(){const _0x2cfc25=['509668whFKpr','824813JDNncH','logout','569670vXRKyC','login','✓\x20Logged\x20out','log','!\x20Not\x20logged\x20in','bool','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','yes','boolean','392cwIJCr','36WzMgCc','../../auth/auth-server-ui.js','1213282CvSeUO','Clear\x20login\x20session','Login\x20via\x20browser','60LyBzuv','10629Bhjwlr','6XDzZap','142608SYFXBL','1878tfbCbl','auth','nonInteractive'];a36_0x3480=function(){return _0x2cfc25;};return a36_0x3480();}export const authDefinitions=[{'service':'auth','command':a36_0x516101(0x174),'description':a36_0x516101(0x168),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x516101(0x161),'type':a36_0x516101(0x162),'description':a36_0x516101(0x160),'default':![]}],async 'execute'(_0x61c8de){const _0x45c807=a36_0x516101,{runAuthServer:_0x53ceb5}=await import(_0x45c807(0x165));return await _0x53ceb5({'autoYes':_0x61c8de[_0x45c807(0x178)](_0x45c807(0x161)),'nonInteractive':_0x61c8de[_0x45c807(0x16f)]}),{'ok':!![]};}},{'service':a36_0x516101(0x16e),'command':a36_0x516101(0x172),'description':a36_0x516101(0x167),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x1b8feb){const _0x5f1e53=a36_0x516101;return existsSync(cookieFile)?(unlinkSync(cookieFile),console['log'](_0x5f1e53(0x175))):console[_0x5f1e53(0x176)](_0x5f1e53(0x177)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x324bd7=a37_0x5cd0;(function(_0x485607,_0x217b26){const _0x19c7cd=a37_0x5cd0,_0x2b962a=_0x485607();while(!![]){try{const _0xe57518=parseInt(_0x19c7cd(0x9d))/0x1*(parseInt(_0x19c7cd(0x6d))/0x2)+-parseInt(_0x19c7cd(0x74))/0x3*(-parseInt(_0x19c7cd(0x6f))/0x4)+-parseInt(_0x19c7cd(0x91))/0x5+parseInt(_0x19c7cd(0xc2))/0x6+parseInt(_0x19c7cd(0x68))/0x7*(parseInt(_0x19c7cd(0xb3))/0x8)+-parseInt(_0x19c7cd(0x9f))/0x9+parseInt(_0x19c7cd(0xc5))/0xa*(-parseInt(_0x19c7cd(0x9c))/0xb);if(_0xe57518===_0x217b26)break;else _0x2b962a['push'](_0x2b962a['shift']());}catch(_0x69beca){_0x2b962a['push'](_0x2b962a['shift']());}}}(a37_0xc8ed,0xd4de2));function a37_0x5cd0(_0x30d3c0,_0x454cb7){_0x30d3c0=_0x30d3c0-0x68;const _0xc8ed84=a37_0xc8ed();let _0x5cd0f9=_0xc8ed84[_0x30d3c0];return _0x5cd0f9;}import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0xc8ed(){const _0x26e4bd=['bff','tableName','entries','Select\x20operation\x20type:','COMMON','\x22,\x20params\x20})\x0a','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','alias','keys','6911920WIlUTA','selectedAppName','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','operationType','currentApp','stderr','.js\x0a','parseInt','name','/data/dataset/','join','4119907ChLHPl','9013cEyxNC','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','4831308ihhhXB','Invalid\x20dataset\x20selection.','str','Script\x20description','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','File\x20already\x20exists:\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','create','apiDir','Select\x20dataset:','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','isInteger','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','No\x20datasets\x20found\x20for\x20this\x20app.','Created\x20','mergedCli','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','profileName','trim','8yjCcKE','appCode','length','.js','当前响应结果','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','ENDPOINT','after','includes','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','nonInteractive','before','code','string','9966516ITbwyZ','source','find','20YMBeLf','type','\x20function:\x20','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','修改后的请求参数','datasetcode','description','\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','修改后的响应结果','\x22\x20not\x20found\x20for\x20dataset\x20','No\x20model\x20aliases\x20found.\x20Run\x20`','functionNode','write','3455221DPvBcG','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','function-node','HOOK','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','74cppZrD','\x22.\x20','2104012fRTred','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','scriptsRootDir','\x20api\x20pull`\x20to\x20refresh.','Operation\x20type\x20(HOOK\x20only)','6pHdwqF','Alias\x20\x22','\x0a\x20*\x20[平台配置]\x20','filePath','/COMMON/','/**\x0a\x20*\x20','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','question','datasetCode','Available:\x20','.js\x0a\x20*\x20[触发节点]\x20','map','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','Dataset\x20not\x20found\x20for\x20code\x20\x22','read','operation-type','validation','\x22\x20not\x20found.\x20','UNKNOWN'];a37_0xc8ed=function(){return _0x26e4bd;};return a37_0xc8ed();}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x324bd7(0x88),'command':a37_0x324bd7(0xa7),'description':a37_0x324bd7(0x81),'risk':a37_0x324bd7(0x83),'flags':[{'name':a37_0x324bd7(0xc6),'type':a37_0x324bd7(0xc1),'required':!![],'enum':[a37_0x324bd7(0x8c),a37_0x324bd7(0xba),a37_0x324bd7(0x6b)],'description':'Script\x20type'},{'name':a37_0x324bd7(0x99),'type':a37_0x324bd7(0xc1),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':'description','type':a37_0x324bd7(0xc1),'description':a37_0x324bd7(0xa2)},{'name':'alias','type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x324bd7(0xca),'type':'string','description':a37_0x324bd7(0x93)},{'name':a37_0x324bd7(0x84),'type':a37_0x324bd7(0xc1),'description':a37_0x324bd7(0x73)},{'name':a37_0x324bd7(0x6a),'type':a37_0x324bd7(0xc1),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a37_0x324bd7(0xbf),a37_0x324bd7(0xbb)]}],async 'validate'(_0x11c754){const _0x45d794=a37_0x324bd7,_0x2db2d2=_0x11c754[_0x45d794(0xa1)](_0x45d794(0x99));if(!isValidBffFunctionName(_0x2db2d2))throw CliErrors[_0x45d794(0x85)]('Invalid\x20function\x20name\x20\x22'+_0x2db2d2+_0x45d794(0xaa));},async 'execute'(_0x7ffc04){const _0x275b5e=a37_0x324bd7,_0x5bdd03=loadBffProjectConfig(_0x7ffc04[_0x275b5e(0xb4)]),_0x39296=_0x7ffc04[_0x275b5e(0xa1)]('type'),_0x1dc25d=_0x7ffc04['str'](_0x275b5e(0x99)),_0x2d5961=_0x7ffc04[_0x275b5e(0xa1)]('description')||undefined,_0x4040c3=_0x39296==='HOOK'?await resolveHookOptions(_0x5bdd03,_0x7ffc04):undefined,_0x1c9517=buildFilePath(_0x5bdd03,_0x39296,_0x1dc25d,_0x4040c3);if(await fileExists(_0x1c9517))throw CliErrors[_0x275b5e(0x85)](_0x275b5e(0xa4)+_0x1c9517);await mkdir(dirname(_0x1c9517),{'recursive':!![]});const _0xd5e91f=generateTemplate(_0x39296,_0x1dc25d,_0x7ffc04[_0x275b5e(0xb4)],_0x2d5961,_0x4040c3);await writeFile(_0x1c9517,_0xd5e91f,'utf8');const _0x4f79dc={'type':_0x39296,'name':_0x1dc25d,'path':_0x1c9517};if(_0x2d5961)_0x4f79dc[_0x275b5e(0xcb)]=_0x2d5961;if(_0x4040c3){if(_0x4040c3[_0x275b5e(0x8f)])_0x4f79dc[_0x275b5e(0x8f)]=_0x4040c3[_0x275b5e(0x8f)];_0x4f79dc[_0x275b5e(0x7c)]=_0x4040c3[_0x275b5e(0x7c)],_0x4f79dc['operationType']=_0x4040c3[_0x275b5e(0x94)],_0x4f79dc['functionNode']=_0x4040c3[_0x275b5e(0xd0)];}return{'ok':!![],'data':_0x4f79dc,'message':_0x275b5e(0xae)+_0x39296+_0x275b5e(0xc7)+_0x1dc25d};}};async function resolveHookOptions(_0x3ced97,_0x1b1bf5){const _0x4d868e=a37_0x324bd7,_0x402722=resolveApiModelSource(_0x1b1bf5['apiDir'],_0x1b1bf5[_0x4d868e(0xb4)],_0x1b1bf5[_0x4d868e(0x92)]||_0x1b1bf5['mergedCli']?.[_0x4d868e(0x95)]||_0x1b1bf5[_0x4d868e(0xaf)]?.['defaultApp']),_0x5b507f=loadAliasMap(_0x1b1bf5[_0x4d868e(0xa8)],undefined,_0x402722[_0x4d868e(0x77)],_0x402722[_0x4d868e(0xb1)]),_0x2710ae=_0x5b507f['length']>0x0;let _0x5b2f01,_0x3159d6,_0x1b2886;const _0x210ee0=_0x1b1bf5['str'](_0x4d868e(0x8f)),_0x339acf=_0x1b1bf5[_0x4d868e(0xa1)](_0x4d868e(0xca));if(_0x210ee0){const _0xe59f9=resolveAlias(_0x1b1bf5[_0x4d868e(0xa8)],_0x210ee0,undefined,_0x402722[_0x4d868e(0x77)],_0x402722[_0x4d868e(0xb1)]);if(!_0xe59f9){const _0x7fc131=_0x2710ae?'Available\x20aliases:\x20'+_0x5b507f[_0x4d868e(0x7f)](_0x4875c2=>_0x4875c2[_0x4d868e(0x8f)])[_0x4d868e(0x9b)](',\x20'):_0x4d868e(0xcf)+CLI_BIN_NAME+_0x4d868e(0xa5);throw CliErrors[_0x4d868e(0x85)](_0x4d868e(0x75)+_0x210ee0+_0x4d868e(0x86)+_0x7fc131);}_0x5b2f01=_0x210ee0,_0x3159d6=_0xe59f9;}else{if(_0x339acf){_0x3159d6=_0x339acf;const _0x189ddd=_0x5b507f[_0x4d868e(0xc4)](_0x2a4b1c=>_0x2a4b1c[_0x4d868e(0x7c)]===_0x339acf);_0x5b2f01=_0x189ddd?.['alias'];}else{if(_0x1b1bf5[_0x4d868e(0xbe)])throw CliErrors[_0x4d868e(0x85)](_0x4d868e(0xb9));else{if(_0x2710ae){const _0xc0ee5=_0x5b507f['map'](_0x4ff06c=>_0x4ff06c[_0x4d868e(0x8f)]+'\x20('+_0x4ff06c[_0x4d868e(0x89)]+')'),_0x559ac1=await promptSelect(_0x4d868e(0xa9),_0xc0ee5),_0x70c8fe=_0x5b507f[_0x559ac1];if(!_0x70c8fe)throw CliErrors['validation']('Invalid\x20dataset\x20selection.');_0x5b2f01=_0x70c8fe[_0x4d868e(0x8f)],_0x3159d6=_0x70c8fe[_0x4d868e(0x7c)];}else{const _0x1b600a=await listDatasets(_0x1b1bf5['appCode']);if(_0x1b600a[_0x4d868e(0xb5)]===0x0)throw CliErrors['validation'](_0x4d868e(0xad));const _0x1bd13f=_0x1b600a[_0x4d868e(0x7f)](_0x58b468=>_0x58b468[_0x4d868e(0x99)]+'\x20['+(_0x58b468[_0x4d868e(0xc3)]??_0x4d868e(0x87))+']\x20('+_0x58b468['code']+')'),_0x4d3d8c=await promptSelect(_0x4d868e(0xa9),_0x1bd13f),_0x163737=_0x1b600a[_0x4d3d8c];if(!_0x163737)throw CliErrors[_0x4d868e(0x85)](_0x4d868e(0xa0));_0x3159d6=_0x163737[_0x4d868e(0xc0)],_0x5b2f01=undefined;}}}}const _0x450f64=await listDatasets(_0x1b1bf5['appCode']),_0x44c790=_0x450f64['find'](_0x5c31b7=>_0x5c31b7[_0x4d868e(0xc0)]===_0x3159d6);if(!_0x44c790)throw CliErrors[_0x4d868e(0x85)](_0x4d868e(0x82)+_0x3159d6+_0x4d868e(0x6e)+(_0x5b2f01?'The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0x4d868e(0x72):''));_0x1b2886=_0x44c790['id'];const _0x2c65c9=_0x5b2f01??_0x3159d6,_0x1572b8=await listBffDatasetOperations(_0x1b1bf5[_0x4d868e(0xb4)],_0x1b2886),_0x59375e=_0x1572b8?Object[_0x4d868e(0x90)](_0x1572b8):[];if(_0x59375e[_0x4d868e(0xb5)]===0x0)throw CliErrors[_0x4d868e(0x85)](_0x4d868e(0x80)+_0x2c65c9+'.');let _0x178a8a;const _0x44194c=_0x1b1bf5['str'](_0x4d868e(0x84));if(_0x44194c){if(!_0x59375e[_0x4d868e(0xbc)](_0x44194c))throw CliErrors[_0x4d868e(0x85)]('Operation\x20type\x20\x22'+_0x44194c+_0x4d868e(0xce)+_0x2c65c9+'.\x20'+(_0x4d868e(0x7d)+_0x59375e['join'](',\x20')));_0x178a8a=_0x44194c;}else{if(_0x1b1bf5[_0x4d868e(0xbe)])throw CliErrors[_0x4d868e(0x85)](_0x4d868e(0xb8));const _0x2a09dd=await promptSelect(_0x4d868e(0x8b),_0x59375e);_0x178a8a=_0x59375e[_0x2a09dd]??_0x59375e[0x0];}let _0x4d4b9e=normalizeHookFunctionNode(_0x1b1bf5[_0x4d868e(0xa1)]('function-node'));if(!_0x4d4b9e){if(_0x1b1bf5[_0x4d868e(0xa1)](_0x4d868e(0x6a)))throw CliErrors[_0x4d868e(0x85)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x1b1bf5['nonInteractive'])throw CliErrors[_0x4d868e(0x85)](_0x4d868e(0x8e));const _0x2b08c7=await promptSelect('Select\x20trigger\x20node:',['before',_0x4d868e(0xbb)]);_0x4d4b9e=[_0x4d868e(0xbf),'after'][_0x2b08c7]??_0x4d868e(0xbf);}return{'alias':_0x5b2f01,'datasetCode':_0x3159d6,'datasetId':_0x1b2886,'operationType':_0x178a8a,'functionNode':_0x4d4b9e};}async function promptSelect(_0x5f5c74,_0x1118b1){const _0x4898d3=a37_0x324bd7;if(_0x1118b1[_0x4898d3(0xb5)]===0x1)return 0x0;for(const [_0x1c2a87,_0x8e29f3]of _0x1118b1[_0x4898d3(0x8a)]()){process['stderr'][_0x4898d3(0xd1)]('\x20\x20'+(_0x1c2a87+0x1)+'.\x20'+_0x8e29f3+'\x0a');}const _0x53ae33=createInterface({'input':process['stdin'],'output':process[_0x4898d3(0x96)]});while(!![]){const _0x1f1a7=await new Promise(_0x3da185=>{const _0x471141=_0x4898d3;_0x53ae33[_0x471141(0x7b)](_0x5f5c74+'\x20',_0x3da185);}),_0x250075=Number[_0x4898d3(0x98)](_0x1f1a7[_0x4898d3(0xb2)](),0xa);if(Number[_0x4898d3(0xab)](_0x250075)&&_0x250075>=0x1&&_0x250075<=_0x1118b1['length'])return _0x53ae33['close'](),_0x250075-0x1;process['stderr'][_0x4898d3(0xd1)](_0x4898d3(0xc8)+_0x1118b1[_0x4898d3(0xb5)]+'.\x0a');}}function buildFilePath(_0x65fe27,_0x47cebc,_0x3766e5,_0x1ba74b){const _0x85a833=a37_0x324bd7;if(_0x47cebc===_0x85a833(0x6b)){if(!_0x1ba74b)throw CliErrors[_0x85a833(0x85)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x284b1f=_0x1ba74b['alias']??_0x1ba74b[_0x85a833(0x7c)];return join(_0x65fe27[_0x85a833(0x71)],_0x85a833(0x6b),_0x284b1f,_0x1ba74b[_0x85a833(0x94)],_0x1ba74b[_0x85a833(0xd0)],_0x3766e5+'.js');}return join(_0x65fe27[_0x85a833(0x71)],_0x47cebc,_0x3766e5+_0x85a833(0xb6));}export function generateTemplate(_0x3b9e61,_0xee55f,_0x1db0af,_0x4e6f05,_0x157681){const _0x53eb22=a37_0x324bd7,_0x1079f8=_0x4e6f05?.[_0x53eb22(0xb2)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xb4bd03=getAppBaseUrl(_0x1db0af),_0x1cf2ed=_0x53eb22(0x70);if(_0x3b9e61===_0x53eb22(0x8c))return _0x53eb22(0x79)+_0x1079f8+_0x53eb22(0x9e)+_0xee55f+_0x53eb22(0x76)+_0xb4bd03+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x1db0af+_0x53eb22(0x78)+_0xee55f+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0xee55f+_0x53eb22(0x8d)+_0x1cf2ed+_0x53eb22(0xcc)+_0xee55f+_0x53eb22(0x7a);if(_0x3b9e61===_0x53eb22(0xba))return _0x53eb22(0x79)+_0x1079f8+_0x53eb22(0xa3)+_0xee55f+_0x53eb22(0xb0)+_0x1db0af+'/'+_0xee55f+_0x53eb22(0x76)+_0xb4bd03+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x1db0af+'/ENDPOINT/'+_0xee55f+_0x53eb22(0x97)+_0x1cf2ed+'\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'+_0xee55f+_0x53eb22(0x7a);if(!_0x157681)throw CliErrors['validation'](_0x53eb22(0xbd));const _0x23b199=_0x157681[_0x53eb22(0x8f)]??_0x157681[_0x53eb22(0x7c)],_0x3596f5=_0x157681[_0x53eb22(0xd0)]===_0x53eb22(0xbf)?'当前请求参数':_0x53eb22(0xb7),_0x2fac69=_0x157681[_0x53eb22(0xd0)]===_0x53eb22(0xbf)?_0x53eb22(0xc9):_0x53eb22(0xcd);return _0x53eb22(0x79)+_0x1079f8+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0xee55f+_0x53eb22(0x69)+_0x1db0af+'/'+_0x157681[_0x53eb22(0x7c)]+'/'+_0x157681['operationType']+'\x0a\x20*\x20[平台配置]\x20'+_0xb4bd03+_0x53eb22(0x9a)+_0x157681['datasetId']+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x1db0af+'/HOOK/'+_0x23b199+'/'+_0x157681[_0x53eb22(0x94)]+'/'+_0x157681['functionNode']+'/'+_0xee55f+_0x53eb22(0x7e)+_0x157681[_0x53eb22(0xd0)]+'\x0a'+_0x1cf2ed+_0x53eb22(0xac)+_0x3596f5+_0x53eb22(0x6c)+_0x2fac69+_0x53eb22(0xa6)+_0xee55f+_0x53eb22(0x7a);}
|
|
1
|
+
const a37_0x44a4ac=a37_0x32c0;(function(_0x241629,_0x41441d){const _0x4f126e=a37_0x32c0,_0x517175=_0x241629();while(!![]){try{const _0x5c3e7e=-parseInt(_0x4f126e(0xc0))/0x1+parseInt(_0x4f126e(0xc3))/0x2+-parseInt(_0x4f126e(0xc9))/0x3+-parseInt(_0x4f126e(0x83))/0x4*(parseInt(_0x4f126e(0xc4))/0x5)+parseInt(_0x4f126e(0xa5))/0x6+-parseInt(_0x4f126e(0xba))/0x7*(parseInt(_0x4f126e(0xb7))/0x8)+parseInt(_0x4f126e(0xda))/0x9;if(_0x5c3e7e===_0x41441d)break;else _0x517175['push'](_0x517175['shift']());}catch(_0x87bc61){_0x517175['push'](_0x517175['shift']());}}}(a37_0x287f,0x2fefc));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';function a37_0x287f(){const _0x468f84=['name','nonInteractive','trim','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','read','code','/data/dataset/','Invalid\x20dataset\x20selection.','727812PnQUdv','defaultApp','\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','HOOK','\x22.\x20','description','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','type','Dataset\x20not\x20found\x20for\x20code\x20\x22','selectedAppName','filePath','File\x20already\x20exists:\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','Select\x20operation\x20type:','function-node','ENDPOINT','tableName','map','232jTyRKv','utf8','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','28903cZtHfd','/COMMON/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','after','HOOK\x20requires\x20alias/operation/node\x20options.','functionNode','7393yAQczj','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','source','286464mWXrVK','335YcnTNR','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','Function\x20name\x20(valid\x20JS\x20identifier)','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','/**\x0a\x20*\x20','819618CiFmaa','join','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Created\x20','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','string','write','Available\x20aliases:\x20','Alias\x20\x22','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','keys','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','\x20function:\x20','mergedCli','before','修改后的请求参数','Trigger\x20node\x20(HOOK\x20only)','4586733vbWggt','\x22\x20not\x20found.\x20','/ENDPOINT/','datasetCode','bff','apiDir','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','stderr','parseInt','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','isInteger','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','当前响应结果','.js','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','operationType','/HOOK/','operation-type','\x22\x20not\x20found\x20for\x20dataset\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','当前请求参数','COMMON','10596FwhhAQ','Select\x20trigger\x20node:','Select\x20dataset:','UNKNOWN','validation','currentApp','str','profileName','No\x20datasets\x20found\x20for\x20this\x20app.','datasetId','.js\x0a\x20*\x20[触发节点]\x20','length','.js\x0a','find','Script\x20description','alias','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Invalid\x20function\x20name\x20\x22','\x0a\x20*\x20[平台配置]\x20','create','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','appCode','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'];a37_0x287f=function(){return _0x468f84;};return a37_0x287f();}import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x32c0(_0x517fa0,_0x182c48){_0x517fa0=_0x517fa0-0x7e;const _0x287fb5=a37_0x287f();let _0x32c04c=_0x287fb5[_0x517fa0];return _0x32c04c;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x44a4ac(0xde),'command':a37_0x44a4ac(0x96),'description':a37_0x44a4ac(0xe4),'risk':a37_0x44a4ac(0xa1),'flags':[{'name':'type','type':a37_0x44a4ac(0xce),'required':!![],'enum':['COMMON',a37_0x44a4ac(0xb4),a37_0x44a4ac(0xa8)],'description':'Script\x20type'},{'name':'name','type':a37_0x44a4ac(0xce),'required':!![],'description':a37_0x44a4ac(0xc6)},{'name':a37_0x44a4ac(0xaa),'type':a37_0x44a4ac(0xce),'description':a37_0x44a4ac(0x91)},{'name':a37_0x44a4ac(0x92),'type':a37_0x44a4ac(0xce),'description':a37_0x44a4ac(0xcb)},{'name':'datasetcode','type':a37_0x44a4ac(0xce),'description':a37_0x44a4ac(0xb9)},{'name':a37_0x44a4ac(0x7e),'type':'string','description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a37_0x44a4ac(0xb3),'type':a37_0x44a4ac(0xce),'description':a37_0x44a4ac(0xd9),'enum':['before',a37_0x44a4ac(0xbd)]}],async 'validate'(_0x548425){const _0x5b3022=a37_0x44a4ac,_0xc2317e=_0x548425['str'](_0x5b3022(0x9c));if(!isValidBffFunctionName(_0xc2317e))throw CliErrors[_0x5b3022(0x87)](_0x5b3022(0x94)+_0xc2317e+_0x5b3022(0x99));},async 'execute'(_0x5aeb0f){const _0x5904e9=a37_0x44a4ac,_0xeab712=loadBffProjectConfig(_0x5aeb0f[_0x5904e9(0x98)]),_0x3befaa=_0x5aeb0f[_0x5904e9(0x89)](_0x5904e9(0xac)),_0x45cdcb=_0x5aeb0f[_0x5904e9(0x89)](_0x5904e9(0x9c)),_0x51c113=_0x5aeb0f[_0x5904e9(0x89)]('description')||undefined,_0x3bb13c=_0x3befaa==='HOOK'?await resolveHookOptions(_0xeab712,_0x5aeb0f):undefined,_0x7b29c9=buildFilePath(_0xeab712,_0x3befaa,_0x45cdcb,_0x3bb13c);if(await fileExists(_0x7b29c9))throw CliErrors['validation'](_0x5904e9(0xb0)+_0x7b29c9);await mkdir(dirname(_0x7b29c9),{'recursive':!![]});const _0x4e68a8=generateTemplate(_0x3befaa,_0x45cdcb,_0x5aeb0f[_0x5904e9(0x98)],_0x51c113,_0x3bb13c);await writeFile(_0x7b29c9,_0x4e68a8,_0x5904e9(0xb8));const _0x5650bf={'type':_0x3befaa,'name':_0x45cdcb,'path':_0x7b29c9};if(_0x51c113)_0x5650bf[_0x5904e9(0xaa)]=_0x51c113;if(_0x3bb13c){if(_0x3bb13c['alias'])_0x5650bf[_0x5904e9(0x92)]=_0x3bb13c[_0x5904e9(0x92)];_0x5650bf[_0x5904e9(0xdd)]=_0x3bb13c[_0x5904e9(0xdd)],_0x5650bf[_0x5904e9(0xea)]=_0x3bb13c[_0x5904e9(0xea)],_0x5650bf[_0x5904e9(0xbf)]=_0x3bb13c['functionNode'];}return{'ok':!![],'data':_0x5650bf,'message':_0x5904e9(0xcc)+_0x3befaa+_0x5904e9(0xd5)+_0x45cdcb};}};async function resolveHookOptions(_0x1035d6,_0x536a58){const _0x39a455=a37_0x44a4ac,_0x5c7e11=resolveApiModelSource(_0x536a58[_0x39a455(0xdf)],_0x536a58[_0x39a455(0x98)],_0x536a58[_0x39a455(0xae)]||_0x536a58['mergedCli']?.[_0x39a455(0x88)]||_0x536a58[_0x39a455(0xd6)]?.[_0x39a455(0xa6)]),_0x4a5a42=loadAliasMap(_0x536a58[_0x39a455(0xdf)],undefined,_0x5c7e11[_0x39a455(0xaf)],_0x5c7e11[_0x39a455(0x8a)]),_0x34ad1d=_0x4a5a42[_0x39a455(0x8e)]>0x0;let _0x47a249,_0x68e445,_0x1d5d1e;const _0x1ca809=_0x536a58[_0x39a455(0x89)](_0x39a455(0x92)),_0x1da800=_0x536a58[_0x39a455(0x89)]('datasetcode');if(_0x1ca809){const _0xde8efa=resolveAlias(_0x536a58[_0x39a455(0xdf)],_0x1ca809,undefined,_0x5c7e11[_0x39a455(0xaf)],_0x5c7e11['profileName']);if(!_0xde8efa){const _0x4f59c0=_0x34ad1d?_0x39a455(0xd0)+_0x4a5a42[_0x39a455(0xb6)](_0x1d0ffc=>_0x1d0ffc['alias'])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x39a455(0xd4);throw CliErrors[_0x39a455(0x87)](_0x39a455(0xd1)+_0x1ca809+_0x39a455(0xdb)+_0x4f59c0);}_0x47a249=_0x1ca809,_0x68e445=_0xde8efa;}else{if(_0x1da800){_0x68e445=_0x1da800;const _0x126579=_0x4a5a42['find'](_0x216efb=>_0x216efb['datasetCode']===_0x1da800);_0x47a249=_0x126579?.[_0x39a455(0x92)];}else{if(_0x536a58[_0x39a455(0x9d)])throw CliErrors[_0x39a455(0x87)](_0x39a455(0xcd));else{if(_0x34ad1d){const _0x473cb8=_0x4a5a42[_0x39a455(0xb6)](_0x43a713=>_0x43a713[_0x39a455(0x92)]+'\x20('+_0x43a713[_0x39a455(0xb5)]+')'),_0x5837c6=await promptSelect(_0x39a455(0x85),_0x473cb8),_0x3c6b0f=_0x4a5a42[_0x5837c6];if(!_0x3c6b0f)throw CliErrors[_0x39a455(0x87)](_0x39a455(0xa4));_0x47a249=_0x3c6b0f[_0x39a455(0x92)],_0x68e445=_0x3c6b0f[_0x39a455(0xdd)];}else{const _0x456cc9=await listDatasets(_0x536a58[_0x39a455(0x98)]);if(_0x456cc9['length']===0x0)throw CliErrors[_0x39a455(0x87)](_0x39a455(0x8b));const _0xa989c4=_0x456cc9[_0x39a455(0xb6)](_0xa6f83b=>_0xa6f83b[_0x39a455(0x9c)]+'\x20['+(_0xa6f83b[_0x39a455(0xc2)]??_0x39a455(0x86))+']\x20('+_0xa6f83b[_0x39a455(0xa2)]+')'),_0x25b334=await promptSelect('Select\x20dataset:',_0xa989c4),_0x3a15b5=_0x456cc9[_0x25b334];if(!_0x3a15b5)throw CliErrors[_0x39a455(0x87)]('Invalid\x20dataset\x20selection.');_0x68e445=_0x3a15b5[_0x39a455(0xa2)],_0x47a249=undefined;}}}}const _0x31b751=await listDatasets(_0x536a58[_0x39a455(0x98)]),_0x54c47c=_0x31b751[_0x39a455(0x90)](_0x4542fa=>_0x4542fa[_0x39a455(0xa2)]===_0x68e445);if(!_0x54c47c)throw CliErrors['validation'](_0x39a455(0xad)+_0x68e445+_0x39a455(0xa9)+(_0x47a249?_0x39a455(0x97)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x1d5d1e=_0x54c47c['id'];const _0xcaeb38=_0x47a249??_0x68e445,_0x3d562e=await listBffDatasetOperations(_0x536a58[_0x39a455(0x98)],_0x1d5d1e),_0x203f8c=_0x3d562e?Object[_0x39a455(0xd3)](_0x3d562e):[];if(_0x203f8c[_0x39a455(0x8e)]===0x0)throw CliErrors[_0x39a455(0x87)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0xcaeb38+'.');let _0x12919b;const _0x433715=_0x536a58[_0x39a455(0x89)](_0x39a455(0x7e));if(_0x433715){if(!_0x203f8c['includes'](_0x433715))throw CliErrors[_0x39a455(0x87)]('Operation\x20type\x20\x22'+_0x433715+_0x39a455(0x7f)+_0xcaeb38+'.\x20'+('Available:\x20'+_0x203f8c[_0x39a455(0xca)](',\x20')));_0x12919b=_0x433715;}else{if(_0x536a58[_0x39a455(0x9d)])throw CliErrors[_0x39a455(0x87)](_0x39a455(0xe9));const _0x4a83b3=await promptSelect(_0x39a455(0xb2),_0x203f8c);_0x12919b=_0x203f8c[_0x4a83b3]??_0x203f8c[0x0];}let _0x3a76ff=normalizeHookFunctionNode(_0x536a58[_0x39a455(0x89)](_0x39a455(0xb3)));if(!_0x3a76ff){if(_0x536a58[_0x39a455(0x89)](_0x39a455(0xb3)))throw CliErrors[_0x39a455(0x87)](_0x39a455(0x9a));if(_0x536a58[_0x39a455(0x9d)])throw CliErrors[_0x39a455(0x87)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0xb3d186=await promptSelect(_0x39a455(0x84),[_0x39a455(0xd7),_0x39a455(0xbd)]);_0x3a76ff=[_0x39a455(0xd7),'after'][_0xb3d186]??_0x39a455(0xd7);}return{'alias':_0x47a249,'datasetCode':_0x68e445,'datasetId':_0x1d5d1e,'operationType':_0x12919b,'functionNode':_0x3a76ff};}async function promptSelect(_0xf47174,_0x6957d8){const _0x23cf5a=a37_0x44a4ac;if(_0x6957d8['length']===0x1)return 0x0;for(const [_0x34c8fb,_0x426500]of _0x6957d8['entries']()){process[_0x23cf5a(0xe2)]['write']('\x20\x20'+(_0x34c8fb+0x1)+'.\x20'+_0x426500+'\x0a');}const _0x624d14=createInterface({'input':process['stdin'],'output':process[_0x23cf5a(0xe2)]});while(!![]){const _0x38da57=await new Promise(_0x17df2a=>{_0x624d14['question'](_0xf47174+'\x20',_0x17df2a);}),_0x221d74=Number[_0x23cf5a(0xe3)](_0x38da57[_0x23cf5a(0x9e)](),0xa);if(Number[_0x23cf5a(0xe5)](_0x221d74)&&_0x221d74>=0x1&&_0x221d74<=_0x6957d8[_0x23cf5a(0x8e)])return _0x624d14['close'](),_0x221d74-0x1;process[_0x23cf5a(0xe2)][_0x23cf5a(0xcf)]('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x6957d8[_0x23cf5a(0x8e)]+'.\x0a');}}function buildFilePath(_0xadc352,_0x9bb2f5,_0x59f53a,_0x1ab191){const _0x10a2a9=a37_0x44a4ac;if(_0x9bb2f5===_0x10a2a9(0xa8)){if(!_0x1ab191)throw CliErrors[_0x10a2a9(0x87)](_0x10a2a9(0xbe));const _0x219058=_0x1ab191[_0x10a2a9(0x92)]??_0x1ab191[_0x10a2a9(0xdd)];return join(_0xadc352['scriptsRootDir'],_0x10a2a9(0xa8),_0x219058,_0x1ab191[_0x10a2a9(0xea)],_0x1ab191[_0x10a2a9(0xbf)],_0x59f53a+_0x10a2a9(0xe8));}return join(_0xadc352['scriptsRootDir'],_0x9bb2f5,_0x59f53a+'.js');}export function generateTemplate(_0x5b14a5,_0x19e21f,_0x15e453,_0x297cc6,_0x2b639d){const _0x5d51dc=a37_0x44a4ac,_0x3e94af=_0x297cc6?.[_0x5d51dc(0x9e)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xfece74=getAppBaseUrl(_0x15e453),_0x2f4671=_0x5d51dc(0xe0);if(_0x5b14a5===_0x5d51dc(0x82))return _0x5d51dc(0xc8)+_0x3e94af+_0x5d51dc(0x80)+_0x19e21f+_0x5d51dc(0x95)+_0xfece74+_0x5d51dc(0xa0)+_0x15e453+_0x5d51dc(0xbb)+_0x19e21f+_0x5d51dc(0xab)+_0x19e21f+'\x22,\x20params\x20})\x0a'+_0x2f4671+_0x5d51dc(0xb1)+_0x19e21f+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x5b14a5===_0x5d51dc(0xb4))return _0x5d51dc(0xc8)+_0x3e94af+_0x5d51dc(0xbc)+_0x19e21f+_0x5d51dc(0xc7)+_0x15e453+'/'+_0x19e21f+_0x5d51dc(0x95)+_0xfece74+_0x5d51dc(0xa0)+_0x15e453+_0x5d51dc(0xdc)+_0x19e21f+_0x5d51dc(0x8f)+_0x2f4671+_0x5d51dc(0xa7)+_0x19e21f+_0x5d51dc(0x93);if(!_0x2b639d)throw CliErrors[_0x5d51dc(0x87)](_0x5d51dc(0xe1));const _0xb47a81=_0x2b639d[_0x5d51dc(0x92)]??_0x2b639d[_0x5d51dc(0xdd)],_0x3ca059=_0x2b639d['functionNode']===_0x5d51dc(0xd7)?_0x5d51dc(0x81):_0x5d51dc(0xe7),_0x455757=_0x2b639d['functionNode']===_0x5d51dc(0xd7)?_0x5d51dc(0xd8):'修改后的响应结果';return _0x5d51dc(0xc8)+_0x3e94af+_0x5d51dc(0x9f)+_0x19e21f+_0x5d51dc(0xc5)+_0x15e453+'/'+_0x2b639d[_0x5d51dc(0xdd)]+'/'+_0x2b639d[_0x5d51dc(0xea)]+'\x0a\x20*\x20[平台配置]\x20'+_0xfece74+_0x5d51dc(0xa3)+_0x2b639d[_0x5d51dc(0x8c)]+_0x5d51dc(0xd2)+_0x15e453+_0x5d51dc(0xeb)+_0xb47a81+'/'+_0x2b639d[_0x5d51dc(0xea)]+'/'+_0x2b639d['functionNode']+'/'+_0x19e21f+_0x5d51dc(0x8d)+_0x2b639d[_0x5d51dc(0xbf)]+'\x0a'+_0x2f4671+_0x5d51dc(0x9b)+_0x3ca059+_0x5d51dc(0xc1)+_0x455757+_0x5d51dc(0xe6)+_0x19e21f+_0x5d51dc(0x93);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a38_0x384e6a=a38_0x4e8f;(function(_0x465326,_0x20c4ff){const _0x2ce346=a38_0x4e8f,_0x41e0c6=_0x465326();while(!![]){try{const _0x2ab230=-parseInt(_0x2ce346(0x1bc))/0x1+-parseInt(_0x2ce346(0x1ae))/0x2*(-parseInt(_0x2ce346(0x1aa))/0x3)+parseInt(_0x2ce346(0x1b9))/0x4*(-parseInt(_0x2ce346(0x1cd))/0x5)+-parseInt(_0x2ce346(0x1cf))/0x6*(parseInt(_0x2ce346(0x1c9))/0x7)+-parseInt(_0x2ce346(0x1a5))/0x8+parseInt(_0x2ce346(0x1a8))/0x9+parseInt(_0x2ce346(0x1cc))/0xa*(parseInt(_0x2ce346(0x1a3))/0xb);if(_0x2ab230===_0x20c4ff)break;else _0x41e0c6['push'](_0x41e0c6['shift']());}catch(_0x359177){_0x41e0c6['push'](_0x41e0c6['shift']());}}}(a38_0x1e8f,0xe3994));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a38_0x4e8f(_0x5594c2,_0x4fe862){_0x5594c2=_0x5594c2-0x1a1;const _0x1e8f09=a38_0x1e8f();let _0x4e8f97=_0x1e8f09[_0x5594c2];return _0x4e8f97;}import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';function a38_0x1e8f(){const _0x3622ce=['\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','apps','validation','toISOString','Deleted\x20','remoteId','/api/management/library/scripts/delete','scriptsRootDir','Would\x20delete\x20','startsWith','replace','84ZxpaeQ','projectRoot','lockFilePath','8938890NOVVGd','55VjzWRn','stringify','541038Axyado','scriptsRoot','length','\x20\x20-\x20','22qVzlhF','map','2697928aKKUes','trashDir','target','12450645vcuhWd','delete','339IbduLd','lastSync','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','filter','17206YYdIcr','No\x20lock\x20entry\x20found\x20for\x20\x22','Lock\x20scope\x20for\x20app\x20\x22','str','functions','string','keys','Multiple\x20functions\x20match\x20\x22','find','POST','split','325884SJLfSo','Function\x20not\x20found:\x20','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','895580rjZXgN','appCode'];a38_0x1e8f=function(){return _0x3622ce;};return a38_0x1e8f();}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_0x384e6a(0x1a9),'description':'Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','risk':'high-risk-write','flags':[{'name':a38_0x384e6a(0x1a7),'type':a38_0x384e6a(0x1b3),'required':!![],'description':a38_0x384e6a(0x1ac)}],async 'validate'(_0x47e530){const _0x9b7141=a38_0x384e6a,_0x1a5871=loadBffProjectConfig(_0x47e530[_0x9b7141(0x1bd)]),_0x3b9e6e=await readBffLockFile(_0x1a5871[_0x9b7141(0x1cb)]);if(!_0x3b9e6e)throw CliErrors[_0x9b7141(0x1c0)](_0x9b7141(0x1bb));},async 'dryRun'(_0x2d50e9){const _0x5b762f=a38_0x384e6a,_0x4efbe4=loadBffProjectConfig(_0x2d50e9[_0x5b762f(0x1bd)]),_0x5aae0e=await readBffLockFile(_0x4efbe4['lockFilePath']);if(!_0x5aae0e)throw CliErrors[_0x5b762f(0x1c0)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {appLock:_0x3a4d67}=ensureLockScope(_0x5aae0e,_0x2d50e9[_0x5b762f(0x1bd)],_0x4efbe4[_0x5b762f(0x1d0)],'delete'),_0x384f89=_0x2d50e9[_0x5b762f(0x1b1)](_0x5b762f(0x1a7)),_0xcb7f42=Object[_0x5b762f(0x1b4)](_0x3a4d67[_0x5b762f(0x1b2)]),_0x234fc4=resolveDeleteTarget(_0x384f89,_0xcb7f42),_0x1017ee=_0x3a4d67['functions'][_0x234fc4];if(!_0x1017ee)throw CliErrors['validation']('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x234fc4+'\x22.');const _0x5591aa=resolveLocalFilePathFromLockKey(_0x4efbe4,_0x234fc4),_0x1ccb8e=relative(_0x4efbe4[_0x5b762f(0x1ca)],_0x5591aa),_0x49afd9=join(_0x4efbe4[_0x5b762f(0x1a6)],'<timestamp>',_0x1ccb8e);return{'method':_0x5b762f(0x1b7),'url':_0x5b762f(0x1c4),'body':{'appCode':_0x2d50e9[_0x5b762f(0x1bd)],'target':_0x234fc4,'remoteId':_0x1017ee['remoteId'],'localFilePath':_0x5591aa,'trashedPath':_0x49afd9},'description':_0x5b762f(0x1c6)+_0x234fc4+_0x5b762f(0x1be)};},async 'execute'(_0x2cd032){const _0x47d1f0=a38_0x384e6a,_0x41e9a5=loadBffProjectConfig(_0x2cd032[_0x47d1f0(0x1bd)]),_0x63cb89=await readBffLockFile(_0x41e9a5[_0x47d1f0(0x1cb)]);if(!_0x63cb89)throw CliErrors[_0x47d1f0(0x1c0)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x23e2e6,appLock:_0xfb81a6}=ensureLockScope(_0x63cb89,_0x2cd032[_0x47d1f0(0x1bd)],_0x41e9a5[_0x47d1f0(0x1d0)],'delete'),_0x29f764=JSON['parse'](JSON[_0x47d1f0(0x1ce)](_0x23e2e6)),_0x4e4eb5=_0x29f764[_0x47d1f0(0x1bf)][_0x2cd032[_0x47d1f0(0x1bd)]];if(!_0x4e4eb5)throw new Error(_0x47d1f0(0x1b0)+_0x2cd032[_0x47d1f0(0x1bd)]+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x48a000=_0x2cd032[_0x47d1f0(0x1b1)]('target'),_0x105c35=Object[_0x47d1f0(0x1b4)](_0x4e4eb5['functions']),_0x5b4115=resolveDeleteTarget(_0x48a000,_0x105c35),_0x470b59=_0x4e4eb5['functions'][_0x5b4115];if(!_0x470b59)throw CliErrors['validation'](_0x47d1f0(0x1af)+_0x5b4115+'\x22.');await deleteBffScript(_0x470b59[_0x47d1f0(0x1c3)]),delete _0x4e4eb5['functions'][_0x5b4115],_0x4e4eb5[_0x47d1f0(0x1ab)]=new Date()[_0x47d1f0(0x1c1)](),await writeBffLockFile(_0x41e9a5[_0x47d1f0(0x1cb)],_0x29f764);const _0x1fcad4=resolveLocalFilePathFromLockKey(_0x41e9a5,_0x5b4115);let _0x401cb7;await fileExists(_0x1fcad4)&&(_0x401cb7=await moveToTrash(_0x41e9a5[_0x47d1f0(0x1ca)],_0x41e9a5['trashDir'],_0x1fcad4),await cleanupEmptyDirectories(dirname(_0x1fcad4),_0x41e9a5[_0x47d1f0(0x1c5)]));await waitForDeleteSettlement(_0x41e9a5[_0x47d1f0(0x1cb)],_0x2cd032[_0x47d1f0(0x1bd)],_0x5b4115,_0x1fcad4),await sleep(0x96);const _0x18ea05={'deleted':_0x5b4115,'remoteId':_0x470b59[_0x47d1f0(0x1c3)]};if(_0x401cb7)_0x18ea05['trashedTo']=_0x401cb7;return{'ok':!![],'data':_0x18ea05,'message':_0x47d1f0(0x1c2)+_0x5b4115+(_0x401cb7?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x298f61,_0x4ab8dc){const _0x61768c=a38_0x384e6a;if(_0x298f61['includes']('/')){const _0x23b87e=_0x4ab8dc[_0x61768c(0x1b6)](_0x1b23d8=>_0x1b23d8===_0x298f61);if(!_0x23b87e)throw CliErrors['validation'](_0x61768c(0x1ba)+_0x298f61);return _0x23b87e;}const _0x374e17=_0x4ab8dc[_0x61768c(0x1ad)](_0xde090e=>_0xde090e[_0x61768c(0x1b8)]('/')['at'](-0x1)===_0x298f61);if(_0x374e17[_0x61768c(0x1a1)]===0x0)throw CliErrors['validation'](_0x61768c(0x1ba)+_0x298f61);if(_0x374e17[_0x61768c(0x1a1)]>0x1)throw CliErrors[_0x61768c(0x1c0)](_0x61768c(0x1b5)+_0x298f61+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x374e17[_0x61768c(0x1a4)](_0x4b1cc0=>_0x61768c(0x1a2)+_0x4b1cc0)['join']('\x0a'));return _0x374e17[0x0];}async function moveToTrash(_0x1604b8,_0x4ea9d7,_0x24900b){const _0x5ecdb1=a38_0x384e6a,_0x69ee22=new Date()[_0x5ecdb1(0x1c1)]()[_0x5ecdb1(0x1c8)](/[:.]/g,'-'),_0x446ac5=relative(_0x1604b8,_0x24900b),_0x1e1379=join(_0x4ea9d7,_0x69ee22,_0x446ac5);return await mkdir(dirname(_0x1e1379),{'recursive':!![]}),await rename(_0x24900b,_0x1e1379),_0x1e1379;}async function cleanupEmptyDirectories(_0x1b14bb,_0x2ed988){const _0x49b7c7=a38_0x384e6a;let _0x447539=resolve(_0x1b14bb);const _0x19e81f=resolve(_0x2ed988);while(_0x447539[_0x49b7c7(0x1c7)](''+_0x19e81f+sep)||_0x447539===_0x19e81f){if(_0x447539===_0x19e81f)return;try{const _0x311cba=await readdir(_0x447539);if(_0x311cba[_0x49b7c7(0x1a1)]>0x0)return;await rmdir(_0x447539);}catch{return;}_0x447539=dirname(_0x447539);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0xf54edc,_0x492072,_0x4400b3,_0x28cab9){const _0x4b86bf=a38_0x384e6a;for(let _0x16768c=0x0;_0x16768c<DELETE_SETTLE_RETRY_COUNT;_0x16768c+=0x1){const _0xeafb8c=await readBffLockFile(_0xf54edc),_0x51c197=!!_0xeafb8c?.['apps']?.[_0x492072]?.[_0x4b86bf(0x1b2)]?.[_0x4400b3],_0x4babbb=await fileExists(_0x28cab9);if(!_0x51c197&&!_0x4babbb)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x4400b3+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x47d7d7=a39_0x5786;(function(_0xe369e3,_0x27c218){const _0x16ff00=a39_0x5786,_0x5acf6c=_0xe369e3();while(!![]){try{const _0x3054b1=-parseInt(_0x16ff00(0x116))/0x1*(parseInt(_0x16ff00(0x11b))/0x2)+parseInt(_0x16ff00(0x10c))/0x3*(parseInt(_0x16ff00(0x11a))/0x4)+parseInt(_0x16ff00(0x101))/0x5+-parseInt(_0x16ff00(0x118))/0x6+parseInt(_0x16ff00(0x11c))/0x7*(parseInt(_0x16ff00(0x115))/0x8)+parseInt(_0x16ff00(0x110))/0x9+parseInt(_0x16ff00(0x119))/0xa*(-parseInt(_0x16ff00(0x104))/0xb);if(_0x3054b1===_0x27c218)break;else _0x5acf6c['push'](_0x5acf6c['shift']());}catch(_0x416289){_0x5acf6c['push'](_0x5acf6c['shift']());}}}(a39_0x3655,0x5e019));function a39_0x3655(){const _0x1dfbf4=['566580XRsrJi','10oIEyTD','13044wOQTaU','2yBhZks','186690KBmvxg','1531550gAqtYr','read','bff','8800231skYtpG','Script\x20ID','createdTime','version','verbose','updateUserName','(none)','description','261WTLGvf','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','functionName','scriptContent','5322492MiNZAi','number','num','scriptType','bool','72Qeamiw','141935lCuOcs','Return\x20full\x20raw\x20script\x20object'];a39_0x3655=function(){return _0x1dfbf4;};return a39_0x3655();}function a39_0x5786(_0x4ed85a,_0xf6c4d1){_0x4ed85a=_0x4ed85a-0x101;const _0x3655db=a39_0x3655();let _0x578664=_0x3655db[_0x4ed85a];return _0x578664;}import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x47d7d7(0x103),'command':'detail','description':a39_0x47d7d7(0x10d),'risk':a39_0x47d7d7(0x102),'flags':[{'name':'id','type':a39_0x47d7d7(0x111),'required':!![],'description':a39_0x47d7d7(0x105)},{'name':a39_0x47d7d7(0x108),'type':'boolean','description':a39_0x47d7d7(0x117)}],async 'execute'(_0xb5a551){const _0xabf75e=a39_0x47d7d7,_0x2ab724=await getBffScriptInfo(_0xb5a551[_0xabf75e(0x112)]('id')),_0x5db912=_0xb5a551[_0xabf75e(0x114)]('verbose');if(_0x5db912)return{'ok':!![],'data':_0x2ab724};return{'ok':!![],'data':{'id':_0x2ab724['id'],'functionName':_0x2ab724[_0xabf75e(0x10e)]??'','version':_0x2ab724[_0xabf75e(0x107)]??'','updateUserName':_0x2ab724[_0xabf75e(0x109)]??'','appCode':_0x2ab724['appCode'],'scriptType':_0x2ab724[_0xabf75e(0x113)],'description':_0x2ab724[_0xabf75e(0x10b)]||_0xabf75e(0x10a),'createdTime':_0x2ab724[_0xabf75e(0x106)]??'','updatedTime':_0x2ab724['updatedTime']??'','scriptContent':_0x2ab724[_0xabf75e(0x10f)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3d78c1,_0x3e4683){const _0x8758b5=a40_0x34d0,_0x1529f1=_0x3d78c1();while(!![]){try{const _0x2c7e42=parseInt(_0x8758b5(0x1a3))/0x1*(parseInt(_0x8758b5(0x1a1))/0x2)+-parseInt(_0x8758b5(0x19d))/0x3*(-parseInt(_0x8758b5(0x1a7))/0x4)+parseInt(_0x8758b5(0x19f))/0x5*(parseInt(_0x8758b5(0x1a2))/0x6)+-parseInt(_0x8758b5(0x1a0))/0x7*(-parseInt(_0x8758b5(0x1a6))/0x8)+-parseInt(_0x8758b5(0x1a4))/0x9*(parseInt(_0x8758b5(0x19c))/0xa)+parseInt(_0x8758b5(0x19a))/0xb*(parseInt(_0x8758b5(0x19b))/0xc)+-parseInt(_0x8758b5(0x19e))/0xd*(parseInt(_0x8758b5(0x1a5))/0xe);if(_0x2c7e42===_0x3e4683)break;else _0x1529f1['push'](_0x1529f1['shift']());}catch(_0x587b09){_0x1529f1['push'](_0x1529f1['shift']());}}}(a40_0x1e80,0x5724f));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';function a40_0x1e80(){const _0x5051d7=['404678mSMSHr','13941SbUEDy','42jtHSkg','16568GJtnSY','16076YgbFSP','685267RHkOcw','132LKMypO','1570mBEmxa','3drxSgH','5087407mtRnhS','1050dKupjY','203pWIrYk','2sDNNSl','17718sgJnmv'];a40_0x1e80=function(){return _0x5051d7;};return a40_0x1e80();}import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';function a40_0x34d0(_0x5de247,_0x23f47a){_0x5de247=_0x5de247-0x19a;const _0x1e808d=a40_0x1e80();let _0x34d076=_0x1e808d[_0x5de247];return _0x34d076;}import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a41_0x1f31(_0x27ecd6,_0xf44642){_0x27ecd6=_0x27ecd6-0x1d4;const _0x575e5a=a41_0x575e();let _0x1f313e=_0x575e5a[_0x27ecd6];return _0x1f313e;}const a41_0x4a0e11=a41_0x1f31;function a41_0x575e(){const _0x490cbd=['verbose','COMMON','75915KNIzYi','length','read','string','str','type','19976uIYNrp','name','5llGDaC','1341444AXycfx','list','scriptType','1135029PNEFoV','739252wMCjnv','1298972LcHkwO','1808968jVWcwk','List\x20Backend\x20Function\x20scripts','Filter\x20by\x20script\x20name','description','No\x20Backend\x20Function\x20scripts\x20found.','Return\x20full\x20script\x20objects'];a41_0x575e=function(){return _0x490cbd;};return a41_0x575e();}(function(_0x15e666,_0x4efe22){const _0x579eb7=a41_0x1f31,_0x35cb99=_0x15e666();while(!![]){try{const _0x4f1214=-parseInt(_0x579eb7(0x1d5))/0x1+-parseInt(_0x579eb7(0x1e2))/0x2+parseInt(_0x579eb7(0x1e1))/0x3+parseInt(_0x579eb7(0x1e3))/0x4*(parseInt(_0x579eb7(0x1dd))/0x5)+parseInt(_0x579eb7(0x1de))/0x6+-parseInt(_0x579eb7(0x1e4))/0x7+-parseInt(_0x579eb7(0x1db))/0x8;if(_0x4f1214===_0x4efe22)break;else _0x35cb99['push'](_0x35cb99['shift']());}catch(_0x4a7248){_0x35cb99['push'](_0x35cb99['shift']());}}}(a41_0x575e,0x35c26));import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':'bff','command':a41_0x4a0e11(0x1df),'description':a41_0x4a0e11(0x1e5),'risk':a41_0x4a0e11(0x1d7),'flags':[{'name':a41_0x4a0e11(0x1da),'type':a41_0x4a0e11(0x1d8),'description':'Script\x20type\x20filter','default':'ENDPOINT','enum':['ENDPOINT',a41_0x4a0e11(0x1d4)]},{'name':a41_0x4a0e11(0x1dc),'type':a41_0x4a0e11(0x1d8),'description':a41_0x4a0e11(0x1e6)},{'name':'verbose','type':'boolean','description':a41_0x4a0e11(0x1e9)}],async 'execute'(_0x117a85){const _0x254736=a41_0x4a0e11,_0x1ae8fd=await listBffScripts(_0x117a85['appCode'],_0x117a85[_0x254736(0x1d9)](_0x254736(0x1da)),{'scriptName':_0x117a85[_0x254736(0x1d9)](_0x254736(0x1dc))||undefined}),_0x309a33=_0x117a85['bool'](_0x254736(0x1ea));return{'ok':!![],'data':_0x309a33?_0x1ae8fd:_0x1ae8fd['map'](_0x272710=>({'id':_0x272710['id'],'functionName':_0x272710['functionName']??'','description':_0x272710[_0x254736(0x1e7)]||'(unnamed)','scriptType':_0x272710[_0x254736(0x1e0)]})),'message':_0x1ae8fd[_0x254736(0x1d6)]===0x0?_0x254736(0x1e8):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a42_0x3386(_0x170f72,_0x58e9e3){_0x170f72=_0x170f72-0xd4;const _0x2d8748=a42_0x2d87();let _0x338679=_0x2d8748[_0x170f72];return _0x338679;}const a42_0xecfff4=a42_0x3386;(function(_0x13bd04,_0x24dfde){const _0x2c4c92=a42_0x3386,_0xec8937=_0x13bd04();while(!![]){try{const _0x4ccabf=parseInt(_0x2c4c92(0xe5))/0x1*(-parseInt(_0x2c4c92(0xee))/0x2)+-parseInt(_0x2c4c92(0x104))/0x3*(-parseInt(_0x2c4c92(0xf7))/0x4)+-parseInt(_0x2c4c92(0xd8))/0x5*(parseInt(_0x2c4c92(0xfa))/0x6)+-parseInt(_0x2c4c92(0xd4))/0x7*(-parseInt(_0x2c4c92(0xe9))/0x8)+parseInt(_0x2c4c92(0x101))/0x9+parseInt(_0x2c4c92(0xe7))/0xa+-parseInt(_0x2c4c92(0xd7))/0xb;if(_0x4ccabf===_0x24dfde)break;else _0xec8937['push'](_0xec8937['shift']());}catch(_0x40b7de){_0xec8937['push'](_0xec8937['shift']());}}}(a42_0x2d87,0xd25ad));function a42_0x2d87(){const _0xf4f55d=['logs','6KcCQSL','num','6201130PCFxPV','str','232rVtbjH','Filter\x20by\x20log\x20level','bff','ERROR','--since','278184dlUBDh','trim','flag','--start-time','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','string','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','level','now','6801636ztULVm','\x20must\x20be\x20a\x20positive\x20integer.','start-time','5945718VBzOsX','end-time','since','WARN','--limit','toUpperCase','length','3092211rwcuRy','--end-time','keyword','3clxOKl','--limit\x20must\x20be\x20between\x201\x20and\x20','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','77413ignGVD','Maximum\x20log\x20lines\x20to\x20return\x20(1-','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','3274634AJCMhq','5JFRcaD','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','read','INFO','number','\x20Backend\x20Function\x20log\x20line(s).','validation','isSafeInteger','DEBUG','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','Found\x20','limit'];a42_0x2d87=function(){return _0xf4f55d;};return a42_0x2d87();}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_0xecfff4(0xe0),a42_0xecfff4(0xdb),a42_0xecfff4(0xfd),a42_0xecfff4(0xec)];export function resolveBffLogQuery(_0xc87cd5,_0x2cc44e=Date[a42_0xecfff4(0xf6)]()){const _0x3521f2=a42_0xecfff4,_0x344b1a=_0xc87cd5['flag'](_0x3521f2(0xfc)),_0x20fa74=_0xc87cd5[_0x3521f2(0xf0)](_0x3521f2(0xf9)),_0xec6b87=_0xc87cd5[_0x3521f2(0xf0)](_0x3521f2(0xfb));if(_0x344b1a!==undefined&&_0x20fa74!==undefined)throw CliErrors[_0x3521f2(0xde)](_0x3521f2(0xf2));const _0xe0a0c4=_0xec6b87===undefined?_0x2cc44e:readPositiveInteger(_0xc87cd5[_0x3521f2(0xe6)](_0x3521f2(0xfb)),_0x3521f2(0x102)),_0x1c60df=_0x20fa74===undefined?_0xe0a0c4-readSinceMinutes(_0xc87cd5)*0xea60:readPositiveInteger(_0xc87cd5[_0x3521f2(0xe6)]('start-time'),_0x3521f2(0xf1));if(_0x1c60df<=0x0)throw CliErrors[_0x3521f2(0xde)](_0x3521f2(0xf4));if(_0x1c60df>_0xe0a0c4)throw CliErrors[_0x3521f2(0xde)](_0x3521f2(0xd6));const _0x16b561=readPositiveInteger(_0xc87cd5['num'](_0x3521f2(0xe3),DEFAULT_LIMIT),_0x3521f2(0xfe));if(_0x16b561>MAX_LIMIT)throw CliErrors[_0x3521f2(0xde)](_0x3521f2(0x105)+MAX_LIMIT+'.');const _0x2c689b=_0xc87cd5[_0x3521f2(0xe8)](_0x3521f2(0xf5))['trim']()[_0x3521f2(0xff)]()||undefined,_0x5c5f1e=_0xc87cd5['str'](_0x3521f2(0x103))[_0x3521f2(0xef)]()||undefined;return{'appCode':_0xc87cd5['appCode'],'startTime':_0x1c60df,'endTime':_0xe0a0c4,..._0x20fa74===undefined?{'sinceMinutes':readSinceMinutes(_0xc87cd5)}:{},..._0x2c689b?{'level':_0x2c689b}:{},..._0x5c5f1e?{'keyword':_0x5c5f1e}:{},'limit':_0x16b561};}function readSinceMinutes(_0x28bdcd){const _0x35decc=a42_0xecfff4;return readPositiveInteger(_0x28bdcd[_0x35decc(0xe6)]('since',DEFAULT_SINCE_MINUTES),_0x35decc(0xed));}function readPositiveInteger(_0x2e47d3,_0x94bf4d){const _0x5c0067=a42_0xecfff4;if(!Number[_0x5c0067(0xdf)](_0x2e47d3)||_0x2e47d3<=0x0)throw CliErrors[_0x5c0067(0xde)](_0x94bf4d+_0x5c0067(0xf8));return _0x2e47d3;}export const bffLogs={'service':a42_0xecfff4(0xeb),'command':a42_0xecfff4(0xe4),'description':a42_0xecfff4(0x106),'risk':a42_0xecfff4(0xda),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0xecfff4(0xfc),'type':a42_0xecfff4(0xdc),'description':a42_0xecfff4(0xd9)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0xecfff4(0xf9),'type':'number','description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a42_0xecfff4(0xfb),'type':a42_0xecfff4(0xdc),'description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0xecfff4(0xf5),'type':'string','description':a42_0xecfff4(0xea),'enum':LOG_LEVELS},{'name':a42_0xecfff4(0x103),'type':a42_0xecfff4(0xf3),'description':a42_0xecfff4(0xe1)},{'name':'limit','type':a42_0xecfff4(0xdc),'description':a42_0xecfff4(0xd5)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x5d41df){resolveBffLogQuery(_0x5d41df);},async 'execute'(_0x588c9a){const _0x4e5d3a=a42_0xecfff4,_0x33daa3=resolveBffLogQuery(_0x588c9a),{sinceMinutes:_0x4b128f,..._0x5a0b28}=_0x33daa3,_0x205f92=await searchBffScriptLogs(_0x5a0b28);return{'ok':!![],'data':{'query':_0x33daa3,'count':_0x205f92['length'],'logs':_0x205f92},'message':_0x205f92['length']===0x0?_0x4e5d3a(0x107):_0x4e5d3a(0xe2)+_0x205f92[_0x4e5d3a(0x100)]+_0x4e5d3a(0xdd)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0xe89db0=a43_0x57e6;(function(_0x162101,_0x11682c){const _0x1b574f=a43_0x57e6,_0x421080=_0x162101();while(!![]){try{const _0x5b7c16=parseInt(_0x1b574f(0x1d4))/0x1*(-parseInt(_0x1b574f(0x210))/0x2)+parseInt(_0x1b574f(0x1c4))/0x3+parseInt(_0x1b574f(0x1ee))/0x4+-parseInt(_0x1b574f(0x1b1))/0x5+parseInt(_0x1b574f(0x1e4))/0x6*(-parseInt(_0x1b574f(0x1cb))/0x7)+parseInt(_0x1b574f(0x1af))/0x8+parseInt(_0x1b574f(0x1f6))/0x9;if(_0x5b7c16===_0x11682c)break;else _0x421080['push'](_0x421080['shift']());}catch(_0x44916e){_0x421080['push'](_0x421080['shift']());}}}(a43_0x313f,0x8e8a4));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_0xe89db0(0x1f1),'command':a43_0xe89db0(0x1f4),'description':a43_0xe89db0(0x200),'risk':a43_0xe89db0(0x1c1),'structuredErrors':!![],'flags':[{'name':'type','type':a43_0xe89db0(0x224),'description':a43_0xe89db0(0x19b),'enum':[a43_0xe89db0(0x193),a43_0xe89db0(0x1da),a43_0xe89db0(0x19d)]},{'name':a43_0xe89db0(0x1dc),'type':a43_0xe89db0(0x1b7),'description':a43_0xe89db0(0x1e3)}],async 'dryRun'(_0x42fc99){const _0x332181=a43_0xe89db0,_0x46aba7=loadBffProjectConfig(_0x42fc99[_0x332181(0x1ed)]),_0x15f146=await readBffLockFile(_0x46aba7['lockFilePath']),{appLock:_0x14c1f3}=ensureLockScope(_0x15f146??createEmptyBffLock(),_0x42fc99[_0x332181(0x1ed)],_0x46aba7[_0x332181(0x1fe)],_0x332181(0x1f4)),_0x496931=normalizeBffType(_0x42fc99['str']('type'))??undefined,[_0xb6c698,_0x247f21]=await Promise['all']([listBffScripts(_0x42fc99[_0x332181(0x1ed)],_0x496931),getBffScriptStatistics(_0x42fc99[_0x332181(0x1ed)])]),_0x26581e=_0xb6c698[_0x332181(0x20c)](_0x48dc4b=>normalizeBffType(_0x48dc4b[_0x332181(0x1f8)])===_0x332181(0x19d)),_0x4f86e8=_0x26581e?buildDatasetCodeToAliasMap(_0x42fc99[_0x332181(0x1cc)],_0x42fc99['appCode'],_0x42fc99[_0x332181(0x1bc)]||_0x42fc99[_0x332181(0x221)]?.[_0x332181(0x21d)]||_0x42fc99['mergedCli']?.[_0x332181(0x1db)]):new Map(),_0x55f3e3=_0x26581e?await planHookDirectoryMigration(_0x46aba7,_0x14c1f3,_0x4f86e8,await scanLocalBffFunctions(_0x46aba7,_0x332181(0x19d))):undefined,_0x443dfb=createHookLocationMap(_0x247f21),_0x4ebf1f=[];for(const _0x50aa7f of _0xb6c698){const _0x5ca24e=resolveRemoteScriptTarget(_0x46aba7,_0x50aa7f,_0x443dfb,_0x55f3e3?.[_0x332181(0x1fa)]??_0x14c1f3[_0x332181(0x1bf)],_0x4f86e8);if(!_0x5ca24e){_0x4ebf1f[_0x332181(0x1d6)]({'scriptType':_0x50aa7f[_0x332181(0x1f8)],'functionName':_0x50aa7f[_0x332181(0x1c6)]??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x5ecc10=(_0x55f3e3?.[_0x332181(0x1fa)]??_0x14c1f3[_0x332181(0x1bf)])[_0x5ca24e['lockKey']],_0x30bcfa=_0x50aa7f['scriptContent']!=null?computeContentHash(_0x50aa7f['scriptContent']):undefined,_0x2d2502=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x55f3e3,_0x5ca24e)??_0x5ca24e[_0x332181(0x1d3)],_0x5ecc10,_0x30bcfa),_0x59091b=_0x2d2502?localUnsyncedConflict(_0x5ca24e,_0x50aa7f['id']):undefined;_0x4ebf1f[_0x332181(0x1d6)]({'lockKey':_0x5ca24e[_0x332181(0x202)],'filePath':_0x5ca24e['filePath'],'remoteId':_0x50aa7f['id']??null,'status':_0x59091b?_0x332181(0x209):_0x332181(0x1f5),..._0x59091b?{'conflict':_0x59091b}:{},..._0x5ca24e[_0x332181(0x197)]?{'alias':_0x5ca24e['hookLocation'][_0x332181(0x213)]??null,'datasetCode':_0x5ca24e[_0x332181(0x197)][_0x332181(0x1d1)],'operationType':_0x5ca24e['hookLocation'][_0x332181(0x21e)],'functionNode':_0x5ca24e[_0x332181(0x197)][_0x332181(0x1ba)]}:{}});}return{'method':'GET','url':'/api/management/library/scripts/list?appCode='+_0x42fc99[_0x332181(0x1ed)]+(_0x496931?'&type='+_0x496931:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x42fc99[_0x332181(0x1ed)],'filterType':_0x496931??null,..._0x55f3e3&&_0x55f3e3[_0x332181(0x21a)][_0x332181(0x1d5)]>0x0?{'hookDirectoryMigrations':_0x55f3e3[_0x332181(0x21a)][_0x332181(0x208)](_0x390d89=>({'from':_0x390d89[_0x332181(0x1c5)],'to':_0x390d89[_0x332181(0x201)]}))}:{},'files':_0x4ebf1f},'description':_0x332181(0x1c3)+_0x4ebf1f[_0x332181(0x1d5)]+_0x332181(0x1cf)};},async 'execute'(_0x3f87ee){const _0x2db5f4=a43_0xe89db0,_0x21fadc=loadBffProjectConfig(_0x3f87ee['appCode']),_0x51b4d5=await readBffLockFile(_0x21fadc[_0x2db5f4(0x20d)]),{lockData:_0x1285dc,appLock:_0x317f78}=ensureLockScope(_0x51b4d5??createEmptyBffLock(),_0x3f87ee[_0x2db5f4(0x1ed)],_0x21fadc['scriptsRoot'],'pull'),_0x5b526b=normalizeBffType(_0x3f87ee[_0x2db5f4(0x196)]('type'))??undefined;if(_0x3f87ee['str'](_0x2db5f4(0x1cd))&&!_0x5b526b)throw CliErrors[_0x2db5f4(0x1bb)](_0x2db5f4(0x199));const [_0x3655f0,_0x1c9f88]=await Promise[_0x2db5f4(0x1fc)]([listBffScripts(_0x3f87ee[_0x2db5f4(0x1ed)],_0x5b526b),getBffScriptStatistics(_0x3f87ee[_0x2db5f4(0x1ed)])]);if(_0x3655f0[_0x2db5f4(0x1d5)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x2f398d=_0x3f87ee[_0x2db5f4(0x1dd)]('force');if(_0x2f398d&&!_0x3f87ee['nonInteractive']){const _0x1b3079=await confirmForce();if(!_0x1b3079)throw CliErrors['cancelled'](_0x2db5f4(0x1a4));}if(_0x2f398d&&_0x3f87ee[_0x2db5f4(0x1a8)]){}const _0xd685d8=_0x3655f0[_0x2db5f4(0x20c)](_0x4b1bf9=>normalizeBffType(_0x4b1bf9[_0x2db5f4(0x1f8)])==='HOOK'),_0x18c4e2=_0xd685d8?buildDatasetCodeToAliasMap(_0x3f87ee[_0x2db5f4(0x1cc)],_0x3f87ee[_0x2db5f4(0x1ed)],_0x3f87ee['selectedAppName']||_0x3f87ee['mergedCli']?.[_0x2db5f4(0x21d)]||_0x3f87ee[_0x2db5f4(0x221)]?.['defaultApp']):new Map(),_0x434405=createHookLocationMap(_0x1c9f88),_0x6c6086=JSON['parse'](JSON[_0x2db5f4(0x223)](_0x1285dc)),_0x4652fa=_0x3f87ee[_0x2db5f4(0x1ed)],_0x397ad=_0x6c6086[_0x2db5f4(0x20e)][_0x4652fa];if(!_0x397ad)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x4652fa+_0x2db5f4(0x20a));const _0x2df8ad=_0xd685d8?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x21fadc,_0x397ad,_0x18c4e2,await scanLocalBffFunctions(_0x21fadc,_0x2db5f4(0x19d))),_0x397ad):undefined,_0x202ea4=createPullFileTransaction(),_0x43d016=[],_0x5f4a67=[],_0xd593b4=[],_0x33a612=[];for(const _0x361345 of _0x3655f0){const _0x46a746=resolveRemoteScriptTarget(_0x21fadc,_0x361345,_0x434405,_0x397ad[_0x2db5f4(0x1bf)],_0x18c4e2);if(!_0x46a746){_0x5f4a67['push']({'lockKey':_0x361345['scriptType']+'/'+_0x361345[_0x2db5f4(0x1c6)],'reason':_0x2db5f4(0x204)});continue;}const _0x56232d=_0x397ad[_0x2db5f4(0x1bf)][_0x46a746[_0x2db5f4(0x202)]];try{if(!_0x361345['id'])throw new Error(_0x2db5f4(0x220));if(_0x361345[_0x2db5f4(0x1d2)]==null)throw new Error(_0x2db5f4(0x1e5));const _0x1d6b9c=_0x361345[_0x2db5f4(0x1d2)],_0x34fcd5=computeContentHash(_0x1d6b9c);if(!_0x2f398d){const _0x510eb5=await hasUnsyncedLocalChanges(_0x46a746[_0x2db5f4(0x1d3)],_0x56232d,_0x34fcd5);if(_0x510eb5){_0xd593b4['push'](localUnsyncedConflict(_0x46a746,_0x361345['id']));continue;}}await _0x202ea4[_0x2db5f4(0x217)](_0x46a746[_0x2db5f4(0x1d3)],_0x1d6b9c);const _0xcbb08={'hash':_0x34fcd5,'remoteId':_0x361345['id'],'version':_0x361345[_0x2db5f4(0x212)]};_0x46a746['type']===_0x2db5f4(0x19d)&&_0x46a746[_0x2db5f4(0x197)]&&(_0xcbb08['alias']=_0x46a746['hookLocation'][_0x2db5f4(0x213)],_0xcbb08[_0x2db5f4(0x1d1)]=_0x46a746['hookLocation'][_0x2db5f4(0x1d1)],_0xcbb08[_0x2db5f4(0x21e)]=_0x46a746['hookLocation']['operationType'],_0xcbb08[_0x2db5f4(0x1ba)]=_0x46a746['hookLocation'][_0x2db5f4(0x1ba)]),_0x397ad['functions'][_0x46a746[_0x2db5f4(0x202)]]=_0xcbb08,_0x43d016[_0x2db5f4(0x1d6)]({'lockKey':_0x46a746[_0x2db5f4(0x202)],'remoteId':_0x361345['id']});}catch(_0x22a121){_0x33a612['push']({'lockKey':_0x46a746[_0x2db5f4(0x202)],'error':_0x22a121 instanceof Error?_0x22a121['message']:String(_0x22a121)});}}_0x397ad['lastSync']=new Date()['toISOString']();try{await writeBffLockFile(_0x21fadc[_0x2db5f4(0x20d)],_0x6c6086);}catch(_0x31e1fc){const _0x59936b=[...await _0x202ea4[_0x2db5f4(0x1ef)](),...await _0x2df8ad?.[_0x2db5f4(0x1ef)]()??[]];throw withRollbackErrors(_0x31e1fc,_0x2db5f4(0x1ae),_0x59936b);}return{'ok':_0x33a612[_0x2db5f4(0x1d5)]===0x0,'data':{'pulled':_0x43d016,'skipped':_0x5f4a67,'conflicts':_0xd593b4,'failed':_0x33a612},'message':formatPullMessage(_0x43d016[_0x2db5f4(0x1d5)],_0x5f4a67[_0x2db5f4(0x1d5)],_0xd593b4[_0x2db5f4(0x1d5)],_0x33a612[_0x2db5f4(0x1d5)])};}};function localUnsyncedConflict(_0x29d0a5,_0x4299a0){const _0x3f7907=a43_0xe89db0,_0x28647c=_0x29d0a5[_0x3f7907(0x202)][_0x3f7907(0x20b)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x29d0a5[_0x3f7907(0x202)],'filePath':_0x29d0a5[_0x3f7907(0x1d3)],..._0x4299a0!=null?{'remoteId':_0x4299a0}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x3f7907(0x1ca)+_0x29d0a5[_0x3f7907(0x1cd)]+_0x3f7907(0x218)+_0x28647c+_0x3f7907(0x1a1),'requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function formatPullMessage(_0x579346,_0x11cebc,_0x3caf61,_0x18c5e2){const _0x4130c3=a43_0xe89db0,_0x267c6e=[_0x4130c3(0x1f0)+_0x579346+_0x4130c3(0x1ac),_0x11cebc+'\x20skipped'];_0x3caf61>0x0&&_0x267c6e['push'](_0x3caf61+_0x4130c3(0x205)+(_0x3caf61===0x1?'':'s')+'\x20'+(_0x3caf61===0x1?_0x4130c3(0x222):_0x4130c3(0x1ec))+_0x4130c3(0x1b2));if(_0x18c5e2>0x0)_0x267c6e[_0x4130c3(0x1d6)](_0x18c5e2+_0x4130c3(0x1f3));return _0x267c6e[_0x4130c3(0x1c0)](',\x20');}async function hasUnsyncedLocalChanges(_0x3605b6,_0x8bae78,_0x5b470c){const _0x24f1ea=a43_0xe89db0;if(!await fileExists(_0x3605b6))return![];const _0x30f481=await computeFileHash(_0x3605b6);if(!_0x8bae78)return _0x5b470c?_0x30f481!==_0x5b470c:!![];return _0x30f481!==_0x8bae78[_0x24f1ea(0x19f)];}function a43_0x313f(){const _0x275483=['join','read','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','Would\x20inspect\x20','2024394hYUJeC','oldDirectory','functionName','Failed\x20to\x20write\x20local\x20script\x20\x22','lastSync','entries','\x20bff\x20push\x20--type\x20','175Ccymgq','apiDir','type','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','scriptsRootDir','datasetCode','scriptContent','filePath','26278degfoV','length','push','keyChanges','content','values','ENDPOINT','defaultApp','force','bool','delete','stdin','NFC','\x22:\x20its\x20target\x20\x22','sourceFilePathByNewLockKey','Force\x20overwrite\x20local\x20unsynced\x20changes','207486uoMJmR','Remote\x20script\x20missing\x20content.','message','includes','\x22\x20and\x20\x22','.js','oldDirectoryPath','sourceDirectoryPathByNewDirectory','require','appCode','2159836DAVFtz','rollback','Pull\x20complete:\x20','bff','case-rename','\x20failed','pull','would_pull','10191978jlQOMF','get','scriptType','ENOENT','projectedFunctions','\x22\x20from\x20\x22','all','newDirectoryPath','scriptsRoot','\x22:\x20','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','newDirectory','lockKey','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','unresolvable\x20target\x20path','\x20conflict','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','map','conflict','\x22\x20not\x20found\x20after\x20ensureLockScope.','split','some','lockFilePath','apps','Could\x20not\x20restore\x20local\x20script\x20\x22','18pPvpxc','stderr','version','alias','\x22\x20from\x20the\x20lock\x20file.','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','filter','write','\x20--name\x20','newLockKey','migrations','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','profileName','currentApp','operationType','toLowerCase','Remote\x20script\x20missing\x20id.','mergedCli','requires','stringify','string','dev','COMMON','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','str','hookLocation','question','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','\x22;\x20temporary\x20directory\x20\x22','Pull\x20only\x20this\x20script\x20type','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','HOOK','mode','hash','ino','\x20--format\x20compress','\x22\x20to\x20\x22','\x20Recovery\x20errors:\x20','Force\x20pull\x20cancelled.','has','trim','entry','nonInteractive','\x22:\x20both\x20target\x20\x22','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','set','\x20pulled','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','3175632QdIDOE','move','5296410kooQlN','\x20resolution','yes','oldLockKey','HOOK/','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','boolean','code','close','functionNode','validation','selectedAppName','rekey','remoteId','functions'];a43_0x313f=function(){return _0x275483;};return a43_0x313f();}function createPullFileTransaction(){const _0x4ee0aa=new Map(),_0x529550=async(_0x5c2c31,_0x3cc31e)=>{const _0x4587fe=a43_0x57e6;try{if(_0x3cc31e['existed'])await ensureParentDirectory(_0x5c2c31),await writeFile(_0x5c2c31,_0x3cc31e[_0x4587fe(0x1d8)]);else try{await unlink(_0x5c2c31);}catch(_0x4138d4){if(_0x4138d4[_0x4587fe(0x1b8)]!==_0x4587fe(0x1f9))throw _0x4138d4;}return undefined;}catch(_0xc47037){return _0xc47037 instanceof Error?_0xc47037:new Error(String(_0xc47037));}};return{async 'write'(_0x122f6e,_0x13b0aa){const _0x17c556=a43_0x57e6;if(!_0x4ee0aa[_0x17c556(0x1a5)](_0x122f6e))try{_0x4ee0aa[_0x17c556(0x1ab)](_0x122f6e,{'existed':!![],'content':await readFile(_0x122f6e)});}catch(_0x6563c3){if(_0x6563c3['code']!=='ENOENT')throw _0x6563c3;_0x4ee0aa[_0x17c556(0x1ab)](_0x122f6e,{'existed':![]});}try{await ensureParentDirectory(_0x122f6e),await writeFile(_0x122f6e,_0x13b0aa,'utf8');}catch(_0x4d845e){const _0x4f1ec7=await _0x529550(_0x122f6e,_0x4ee0aa[_0x17c556(0x1f7)](_0x122f6e));if(!_0x4f1ec7)_0x4ee0aa[_0x17c556(0x1de)](_0x122f6e);throw withRollbackErrors(_0x4d845e,_0x17c556(0x1c7)+_0x122f6e+'\x22.',_0x4f1ec7?[_0x4f1ec7]:[]);}},async 'rollback'(){const _0x4bca2c=a43_0x57e6,_0x1f0769=[];for(const [_0x3b3449,_0x31e6e9]of[..._0x4ee0aa['entries']()]['reverse']()){const _0x37afed=await _0x529550(_0x3b3449,_0x31e6e9);_0x37afed&&_0x1f0769['push'](new Error(_0x4bca2c(0x20f)+_0x3b3449+_0x4bca2c(0x1ff)+_0x37afed[_0x4bca2c(0x1e6)]));}return _0x1f0769;}};}function withRollbackErrors(_0x1f7caf,_0x4e3a1b,_0x418d11){const _0x4ce090=a43_0xe89db0,_0x2b7c8f=_0x1f7caf instanceof Error?_0x1f7caf:new Error(String(_0x1f7caf));if(_0x418d11['length']===0x0)return _0x2b7c8f;return new AggregateError([_0x2b7c8f,..._0x418d11],_0x4e3a1b+_0x4ce090(0x1a3)+_0x418d11[_0x4ce090(0x208)](_0x525d66=>_0x525d66[_0x4ce090(0x1e6)])[_0x4ce090(0x1c0)](';\x20'));}function buildDatasetCodeToAliasMap(_0x405f52,_0x3061c1,_0xd34ba3){const _0x20d1aa=a43_0xe89db0,_0x12601c=resolveApiModelSource(_0x405f52,_0x3061c1,_0xd34ba3),_0x40d298=loadAliasMap(_0x405f52,undefined,_0x12601c[_0x20d1aa(0x1d3)],_0x12601c[_0x20d1aa(0x21c)]);return assertUnambiguousHookAliases(_0x40d298),new Map(_0x40d298[_0x20d1aa(0x208)](_0x2ba91b=>[_0x2ba91b[_0x20d1aa(0x1d1)]['toLowerCase'](),_0x2ba91b[_0x20d1aa(0x213)]]));}async function planHookDirectoryMigration(_0x1ac5f5,_0x124cfe,_0x5bfd42,_0x157193){const _0x4190cb=a43_0xe89db0,_0x47516c=new Map();for(const [_0x693cd8,_0x31eaf2]of Object[_0x4190cb(0x1c9)](_0x124cfe[_0x4190cb(0x1bf)])){const [_0x51b1a0,_0x3a77fe,_0x83ec3,_0x6a51c2,_0x32b827,..._0xfe7151]=_0x693cd8[_0x4190cb(0x20b)]('/');if(_0x51b1a0!==_0x4190cb(0x19d)||!_0x3a77fe||!_0x83ec3||!_0x6a51c2||!_0x32b827||_0xfe7151[_0x4190cb(0x1d5)]>0x0||!_0x31eaf2[_0x4190cb(0x1d1)])continue;const _0x93dca=_0x5bfd42[_0x4190cb(0x1f7)](_0x31eaf2[_0x4190cb(0x1d1)][_0x4190cb(0x21f)]()),_0x1df6d6=_0x93dca??_0x31eaf2[_0x4190cb(0x1d1)];if(!isSafeHookDirectorySegment(_0x3a77fe))throw CliErrors['validation'](_0x4190cb(0x19c)+_0x3a77fe+_0x4190cb(0x214));if(!isSafeHookDirectorySegment(_0x1df6d6))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x3a77fe+_0x4190cb(0x1ad));if(_0x3a77fe===_0x1df6d6)continue;const _0x147344=_0x47516c[_0x4190cb(0x1f7)](_0x3a77fe)??{'datasetCode':_0x31eaf2[_0x4190cb(0x1d1)],'alias':_0x93dca,'keyChanges':[]};if(_0x147344[_0x4190cb(0x1d1)]!==_0x31eaf2[_0x4190cb(0x1d1)])throw CliErrors[_0x4190cb(0x1bb)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x3a77fe+_0x4190cb(0x1c2));const _0x4683d8=_0x4190cb(0x1b5)+_0x1df6d6+'/'+_0x83ec3+'/'+_0x6a51c2+'/'+_0x32b827;try{resolveLocalFilePathFromLockKey(_0x1ac5f5,_0x693cd8),resolveLocalFilePathFromLockKey(_0x1ac5f5,_0x4683d8);}catch(_0x49cece){throw CliErrors[_0x4190cb(0x1bb)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x693cd8+_0x4190cb(0x1ff)+(_0x49cece instanceof Error?_0x49cece['message']:String(_0x49cece)));}_0x147344[_0x4190cb(0x1d7)][_0x4190cb(0x1d6)]({'oldLockKey':_0x693cd8,'newLockKey':_0x4683d8,'entry':_0x31eaf2}),_0x47516c[_0x4190cb(0x1ab)](_0x3a77fe,_0x147344);}const _0x198182=new Set([..._0x47516c[_0x4190cb(0x1d9)]()]['flatMap'](_0x565c33=>_0x565c33[_0x4190cb(0x1d7)][_0x4190cb(0x208)](_0x1286df=>_0x1286df[_0x4190cb(0x1b4)]))),_0x5388fa=new Map(),_0x5e3789=new Map();for(const [_0x4a3198,_0x38d18e]of _0x47516c){const _0x5270ca=_0x38d18e['alias']??_0x38d18e[_0x4190cb(0x1d1)],_0x1fe02c=hookDirectoryIdentity(_0x5270ca),_0x449652=_0x5388fa[_0x4190cb(0x1f7)](_0x1fe02c);if(_0x449652&&_0x449652!==_0x4a3198)throw CliErrors[_0x4190cb(0x1bb)](_0x4190cb(0x194)+_0x449652+'\x22\x20and\x20\x22'+_0x4a3198+'\x22:\x20both\x20target\x20\x22'+_0x5270ca+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x5388fa[_0x4190cb(0x1ab)](_0x1fe02c,_0x4a3198);for(const _0x180282 of _0x38d18e[_0x4190cb(0x1d7)]){const _0x451306=_0x5e3789['get'](_0x180282[_0x4190cb(0x219)]);if(_0x451306&&_0x451306!==_0x180282[_0x4190cb(0x1b4)])throw CliErrors['validation'](_0x4190cb(0x215)+_0x451306+_0x4190cb(0x1e8)+_0x180282['oldLockKey']+_0x4190cb(0x1a9)+_0x180282[_0x4190cb(0x219)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x198182[_0x4190cb(0x1a5)](_0x180282[_0x4190cb(0x219)]))throw CliErrors[_0x4190cb(0x1bb)](_0x4190cb(0x21b)+_0x180282[_0x4190cb(0x1b4)]+_0x4190cb(0x1e1)+_0x180282['newLockKey']+_0x4190cb(0x203));_0x5e3789[_0x4190cb(0x1ab)](_0x180282[_0x4190cb(0x219)],_0x180282['oldLockKey']);}}const _0xca43bb=new Map();for(const [_0x1914ef,_0x48ea14]of _0x5bfd42){_0xca43bb[_0x4190cb(0x1ab)](hookDirectoryIdentity(_0x48ea14),_0x1914ef);}const _0x4621a9=[];for(const [_0x213edb,_0x83b49a]of _0x47516c){const _0xf1e225=_0x83b49a[_0x4190cb(0x213)]??_0x83b49a[_0x4190cb(0x1d1)],_0x5d7f03=join(_0x1ac5f5[_0x4190cb(0x1d0)],_0x4190cb(0x19d),_0x213edb),_0x15ad33=join(_0x1ac5f5[_0x4190cb(0x1d0)],_0x4190cb(0x19d),_0xf1e225),_0x579cc7=await directoryExists(_0x5d7f03),_0x42cf7c=await directoryExists(_0x15ad33),_0x2307a8=_0x579cc7?_0x42cf7c?await sameDirectory(_0x5d7f03,_0x15ad33)?'case-rename':undefined:_0x4190cb(0x1b0):_0x4190cb(0x1bd);if(!_0x2307a8)throw CliErrors[_0x4190cb(0x1bb)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x213edb+_0x4190cb(0x1a2)+_0xf1e225+_0x4190cb(0x1aa));const _0x28c8bc=_0xca43bb['get'](hookDirectoryIdentity(_0x213edb));if(_0x28c8bc&&_0x28c8bc!==_0x83b49a[_0x4190cb(0x1d1)][_0x4190cb(0x21f)]()){const _0x3a6934=new Set(_0x83b49a[_0x4190cb(0x1d7)][_0x4190cb(0x208)](_0x4230ef=>_0x4230ef[_0x4190cb(0x1b4)])),_0x597bc0=_0x157193[_0x4190cb(0x216)](_0x27adad=>_0x27adad[_0x4190cb(0x1cd)]===_0x4190cb(0x19d)&&_0x27adad[_0x4190cb(0x213)]!=null&&hookDirectoryIdentity(_0x27adad['alias'])===hookDirectoryIdentity(_0x213edb)&&!_0x3a6934[_0x4190cb(0x1a5)](_0x27adad[_0x4190cb(0x202)]));if(_0x597bc0['length']>0x0)throw CliErrors[_0x4190cb(0x1bb)](_0x4190cb(0x1b6)+_0x213edb+_0x4190cb(0x195));}const _0x530347=_0xca43bb[_0x4190cb(0x1f7)](hookDirectoryIdentity(_0xf1e225));if(_0x530347&&_0x530347!==_0x83b49a[_0x4190cb(0x1d1)]['toLowerCase']())throw CliErrors[_0x4190cb(0x1bb)](_0x4190cb(0x1b6)+_0x213edb+_0x4190cb(0x1a2)+_0xf1e225+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x128e5b of _0x83b49a['keyChanges']){const _0x804e1a=_0x124cfe[_0x4190cb(0x1bf)][_0x128e5b[_0x4190cb(0x219)]];if(_0x804e1a&&!_0x198182[_0x4190cb(0x1a5)](_0x128e5b[_0x4190cb(0x219)])&&!sameHookIdentity(_0x128e5b[_0x4190cb(0x1a7)],_0x804e1a))throw CliErrors[_0x4190cb(0x1bb)](_0x4190cb(0x1b6)+_0x213edb+_0x4190cb(0x1a2)+_0xf1e225+_0x4190cb(0x207));}_0x4621a9[_0x4190cb(0x1d6)]({'oldDirectory':_0x213edb,'newDirectory':_0xf1e225,'oldDirectoryPath':_0x5d7f03,'newDirectoryPath':_0x15ad33,'mode':_0x2307a8,'alias':_0x83b49a[_0x4190cb(0x213)],'keyChanges':_0x83b49a['keyChanges']});}const _0x2c32fc={..._0x124cfe[_0x4190cb(0x1bf)]},_0x480283=new Map(),_0x481cfe=new Map();for(const _0x58e107 of _0x4621a9){const _0x1051ea=_0x58e107[_0x4190cb(0x19e)]!==_0x4190cb(0x1bd);_0x1051ea&&_0x481cfe[_0x4190cb(0x1ab)](hookDirectoryIdentity(_0x58e107['newDirectory']),_0x58e107[_0x4190cb(0x1ea)]);for(const _0xe76d36 of _0x58e107[_0x4190cb(0x1d7)]){const _0x1e29e0=_0x2c32fc[_0xe76d36[_0x4190cb(0x219)]],_0x3b06b5=_0x1051ea?_0xe76d36['entry']:_0x1e29e0??_0xe76d36['entry'];_0x2c32fc[_0xe76d36[_0x4190cb(0x219)]]=canonicalizeHookEntry(_0x3b06b5,_0x58e107[_0x4190cb(0x213)]),delete _0x2c32fc[_0xe76d36[_0x4190cb(0x1b4)]],_0x1051ea&&_0x480283[_0x4190cb(0x1ab)](_0xe76d36['newLockKey'],resolveLocalFilePathFromLockKey(_0x1ac5f5,_0xe76d36[_0x4190cb(0x1b4)]));}}return{'migrations':_0x4621a9,'projectedFunctions':_0x2c32fc,'sourceFilePathByNewLockKey':_0x480283,'sourceDirectoryPathByNewDirectory':_0x481cfe};}function resolveMigratedSourceFilePath(_0x37ef02,_0x291045){const _0x28e360=a43_0xe89db0;if(!_0x37ef02||!_0x291045)return undefined;const _0x2aee1a=_0x37ef02[_0x28e360(0x1e2)]['get'](_0x291045[_0x28e360(0x202)]);if(_0x2aee1a)return _0x2aee1a;if(_0x291045['type']!==_0x28e360(0x19d))return undefined;const [,_0x2ba52a,..._0x15a8df]=_0x291045[_0x28e360(0x202)][_0x28e360(0x20b)]('/');if(!_0x2ba52a||_0x15a8df[_0x28e360(0x1d5)]===0x0)return undefined;const _0x513801=_0x37ef02[_0x28e360(0x1eb)]['get'](hookDirectoryIdentity(_0x2ba52a));return _0x513801?join(_0x513801,..._0x15a8df)+_0x28e360(0x1e9):undefined;}function a43_0x57e6(_0x1fc070,_0x53a652){_0x1fc070=_0x1fc070-0x193;const _0x313f58=a43_0x313f();let _0x57e67f=_0x313f58[_0x1fc070];return _0x57e67f;}function sameHookIdentity(_0x299b91,_0x9106c2){const _0x44eeca=a43_0xe89db0;return _0x299b91[_0x44eeca(0x1be)]===_0x9106c2[_0x44eeca(0x1be)]&&_0x299b91[_0x44eeca(0x1d1)]===_0x9106c2[_0x44eeca(0x1d1)]&&_0x299b91[_0x44eeca(0x21e)]===_0x9106c2[_0x44eeca(0x21e)]&&_0x299b91['functionNode']===_0x9106c2['functionNode'];}function canonicalizeHookEntry(_0x139e2e,_0x1d0b48){const {alias:_0x4a1ff2,..._0x59ec87}=_0x139e2e;return _0x1d0b48?{..._0x59ec87,'alias':_0x1d0b48}:_0x59ec87;}function hookDirectoryIdentity(_0xb80866){const _0xc8c422=a43_0xe89db0;return _0xb80866['normalize'](_0xc8c422(0x1e0))['toLowerCase']();}function isSafeHookDirectorySegment(_0x350359){return isSafeLockKeySegment(_0x350359);}async function sameDirectory(_0x52ab1d,_0x397ddc){const _0xe5cc14=a43_0xe89db0,[_0x33563c,_0x434713]=await Promise[_0xe5cc14(0x1fc)]([stat(_0x52ab1d),stat(_0x397ddc)]);return _0x33563c[_0xe5cc14(0x225)]===_0x434713[_0xe5cc14(0x225)]&&_0x33563c[_0xe5cc14(0x1a0)]===_0x434713['ino'];}async function applyHookDirectoryMigration(_0x3af8af,_0x2061ef){const _0x73a84e=a43_0xe89db0,_0x297429=_0x2061ef[_0x73a84e(0x1bf)],_0x2c5c1a=_0x2061ef[_0x73a84e(0x1c8)],_0x452a2f=[],_0x456b08=async()=>{const _0x3a1463=_0x73a84e,_0x28f92c=[];_0x2061ef[_0x3a1463(0x1bf)]=_0x297429,_0x2061ef[_0x3a1463(0x1c8)]=_0x2c5c1a;for(const {migration:_0x465e5e,temporaryPath:_0x40e768}of[..._0x452a2f]['reverse']()){try{_0x40e768?(await rename(_0x465e5e[_0x3a1463(0x1fd)],_0x40e768),await rename(_0x40e768,_0x465e5e[_0x3a1463(0x1ea)])):await rename(_0x465e5e['newDirectoryPath'],_0x465e5e[_0x3a1463(0x1ea)]);}catch(_0x5a9dec){_0x28f92c['push'](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x465e5e[_0x3a1463(0x1c5)]+_0x3a1463(0x1fb)+_0x465e5e['newDirectory']+_0x3a1463(0x1ff)+(_0x5a9dec instanceof Error?_0x5a9dec[_0x3a1463(0x1e6)]:String(_0x5a9dec))));}}return _0x28f92c;};try{for(const _0x4cc6e0 of _0x3af8af[_0x73a84e(0x21a)]){if(_0x4cc6e0['mode']===_0x73a84e(0x1b0))await ensureParentDirectory(_0x4cc6e0[_0x73a84e(0x1fd)]),await rename(_0x4cc6e0[_0x73a84e(0x1ea)],_0x4cc6e0[_0x73a84e(0x1fd)]),_0x452a2f[_0x73a84e(0x1d6)]({'migration':_0x4cc6e0});else{if(_0x4cc6e0[_0x73a84e(0x19e)]===_0x73a84e(0x1f2)){const _0x28aa94=join(dirname(_0x4cc6e0[_0x73a84e(0x1ea)]),'.hook-directory-migrate-'+randomUUID());await rename(_0x4cc6e0[_0x73a84e(0x1ea)],_0x28aa94);try{await rename(_0x28aa94,_0x4cc6e0[_0x73a84e(0x1fd)]);}catch(_0x427340){try{await rename(_0x28aa94,_0x4cc6e0['oldDirectoryPath']);}catch(_0x486234){throw withRollbackErrors(_0x427340,_0x73a84e(0x206)+_0x4cc6e0['oldDirectory']+_0x73a84e(0x1a2)+_0x4cc6e0[_0x73a84e(0x201)]+_0x73a84e(0x19a)+_0x28aa94+'\x22\x20may\x20remain.',[new Error('Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22'+_0x28aa94+_0x73a84e(0x1a2)+_0x4cc6e0[_0x73a84e(0x1c5)]+_0x73a84e(0x1ff)+(_0x486234 instanceof Error?_0x486234[_0x73a84e(0x1e6)]:String(_0x486234)))]);}throw _0x427340;}_0x452a2f['push']({'migration':_0x4cc6e0,'temporaryPath':_0x28aa94});}}}return _0x2061ef[_0x73a84e(0x1bf)]=_0x3af8af[_0x73a84e(0x1fa)],{'rollback':_0x456b08};}catch(_0x1988d8){const _0x540eb1=await _0x456b08();throw withRollbackErrors(_0x1988d8,_0x73a84e(0x1ce),_0x540eb1);}}async function confirmForce(){const _0x449f25=a43_0xe89db0,_0x2ad204=createInterface({'input':process[_0x449f25(0x1df)],'output':process[_0x449f25(0x211)]}),_0x2418f8=await new Promise(_0xd748bb=>{const _0x314031=_0x449f25;_0x2ad204[_0x314031(0x198)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0xd748bb);});return _0x2ad204[_0x449f25(0x1b9)](),['y',_0x449f25(0x1b3)][_0x449f25(0x1e7)](_0x2418f8[_0x449f25(0x1a6)]()[_0x449f25(0x21f)]());}
|
|
1
|
+
const a43_0x14c6a4=a43_0x48c4;(function(_0x341a12,_0x3ea205){const _0x1d1f35=a43_0x48c4,_0x8940e8=_0x341a12();while(!![]){try{const _0x1daa5a=parseInt(_0x1d1f35(0xd1))/0x1+-parseInt(_0x1d1f35(0x112))/0x2*(parseInt(_0x1d1f35(0xe0))/0x3)+-parseInt(_0x1d1f35(0x14f))/0x4+parseInt(_0x1d1f35(0x111))/0x5*(-parseInt(_0x1d1f35(0xe5))/0x6)+parseInt(_0x1d1f35(0xf5))/0x7*(-parseInt(_0x1d1f35(0xfd))/0x8)+-parseInt(_0x1d1f35(0x139))/0x9+parseInt(_0x1d1f35(0xe2))/0xa;if(_0x1daa5a===_0x3ea205)break;else _0x8940e8['push'](_0x8940e8['shift']());}catch(_0x22d30c){_0x8940e8['push'](_0x8940e8['shift']());}}}(a43_0x44ad,0x404ed));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_0x14c6a4(0x154),'command':a43_0x14c6a4(0x145),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':'read','structuredErrors':!![],'flags':[{'name':'type','type':a43_0x14c6a4(0x128),'description':a43_0x14c6a4(0x10a),'enum':['COMMON',a43_0x14c6a4(0xd0),a43_0x14c6a4(0xf7)]},{'name':a43_0x14c6a4(0x146),'type':a43_0x14c6a4(0x10e),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x4a0fa0){const _0x3ae066=a43_0x14c6a4,_0x20f4bb=loadBffProjectConfig(_0x4a0fa0[_0x3ae066(0xed)]),_0x14ba80=await readBffLockFile(_0x20f4bb['lockFilePath']),{appLock:_0x259742}=ensureLockScope(_0x14ba80??createEmptyBffLock(),_0x4a0fa0[_0x3ae066(0xed)],_0x20f4bb[_0x3ae066(0x13d)],_0x3ae066(0x145)),_0x2fbe07=normalizeBffType(_0x4a0fa0['str'](_0x3ae066(0x12b)))??undefined,[_0x340814,_0x3e1020]=await Promise[_0x3ae066(0x132)]([listBffScripts(_0x4a0fa0['appCode'],_0x2fbe07),getBffScriptStatistics(_0x4a0fa0[_0x3ae066(0xed)])]),_0x5f43cd=_0x340814['some'](_0xdda9b6=>normalizeBffType(_0xdda9b6[_0x3ae066(0x14a)])===_0x3ae066(0xf7)),_0x59ba53=_0x5f43cd?buildDatasetCodeToAliasMap(_0x4a0fa0[_0x3ae066(0x120)],_0x4a0fa0[_0x3ae066(0xed)],_0x4a0fa0[_0x3ae066(0x14e)]||_0x4a0fa0[_0x3ae066(0xd7)]?.[_0x3ae066(0x113)]||_0x4a0fa0[_0x3ae066(0xd7)]?.['defaultApp']):new Map(),_0x240ef7=_0x5f43cd?await planHookDirectoryMigration(_0x20f4bb,_0x259742,_0x59ba53,await scanLocalBffFunctions(_0x20f4bb,_0x3ae066(0xf7))):undefined,_0x5f182c=createHookLocationMap(_0x3e1020),_0x558af1=[];for(const _0x269544 of _0x340814){const _0x14c592=resolveRemoteScriptTarget(_0x20f4bb,_0x269544,_0x5f182c,_0x240ef7?.['projectedFunctions']??_0x259742[_0x3ae066(0x15d)],_0x59ba53);if(!_0x14c592){_0x558af1['push']({'scriptType':_0x269544[_0x3ae066(0x14a)],'functionName':_0x269544[_0x3ae066(0xde)]??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x20069d=(_0x240ef7?.[_0x3ae066(0xf2)]??_0x259742[_0x3ae066(0x15d)])[_0x14c592[_0x3ae066(0xff)]],_0x1ee72f=_0x269544[_0x3ae066(0xdd)]!=null?computeContentHash(_0x269544[_0x3ae066(0xdd)]):undefined,_0x1a1671=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x240ef7,_0x14c592)??_0x14c592[_0x3ae066(0xf3)],_0x20069d,_0x1ee72f),_0xa7295e=_0x1a1671?localUnsyncedConflict(_0x14c592,_0x269544['id']):undefined;_0x558af1[_0x3ae066(0xfc)]({'lockKey':_0x14c592[_0x3ae066(0xff)],'filePath':_0x14c592[_0x3ae066(0xf3)],'remoteId':_0x269544['id']??null,'status':_0xa7295e?_0x3ae066(0x10c):_0x3ae066(0x142),..._0xa7295e?{'conflict':_0xa7295e}:{},..._0x14c592[_0x3ae066(0xe1)]?{'alias':_0x14c592[_0x3ae066(0xe1)][_0x3ae066(0x141)]??null,'datasetCode':_0x14c592[_0x3ae066(0xe1)][_0x3ae066(0xeb)],'operationType':_0x14c592['hookLocation'][_0x3ae066(0x103)],'functionNode':_0x14c592[_0x3ae066(0xe1)][_0x3ae066(0x106)]}:{}});}return{'method':_0x3ae066(0x11e),'url':_0x3ae066(0x10f)+_0x4a0fa0[_0x3ae066(0xed)]+(_0x2fbe07?_0x3ae066(0x150)+_0x2fbe07:'')+_0x3ae066(0x14d)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x4a0fa0[_0x3ae066(0xed)],'filterType':_0x2fbe07??null,..._0x240ef7&&_0x240ef7['migrations'][_0x3ae066(0xcb)]>0x0?{'hookDirectoryMigrations':_0x240ef7[_0x3ae066(0xd4)][_0x3ae066(0x131)](_0x3c669a=>({'from':_0x3c669a[_0x3ae066(0x133)],'to':_0x3c669a[_0x3ae066(0x107)]}))}:{},'files':_0x558af1},'description':_0x3ae066(0x10b)+_0x558af1[_0x3ae066(0xcb)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4e0c76){const _0x474349=a43_0x14c6a4,_0x517b94=loadBffProjectConfig(_0x4e0c76['appCode']),_0x288df4=await readBffLockFile(_0x517b94[_0x474349(0x110)]),{lockData:_0x34b587,appLock:_0x2e361c}=ensureLockScope(_0x288df4??createEmptyBffLock(),_0x4e0c76['appCode'],_0x517b94[_0x474349(0x13d)],_0x474349(0x145)),_0x4d132b=normalizeBffType(_0x4e0c76[_0x474349(0xe4)]('type'))??undefined;if(_0x4e0c76[_0x474349(0xe4)](_0x474349(0x12b))&&!_0x4d132b)throw CliErrors[_0x474349(0xc9)](_0x474349(0x124));const [_0xb9ec33,_0xf661f]=await Promise[_0x474349(0x132)]([listBffScripts(_0x4e0c76[_0x474349(0xed)],_0x4d132b),getBffScriptStatistics(_0x4e0c76[_0x474349(0xed)])]);if(_0xb9ec33['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x5ad3ee=_0x4e0c76[_0x474349(0x156)](_0x474349(0x146));if(_0x5ad3ee&&!_0x4e0c76[_0x474349(0x108)]){const _0x9833ec=await confirmForce();if(!_0x9833ec)throw CliErrors[_0x474349(0xf0)](_0x474349(0x11d));}if(_0x5ad3ee&&_0x4e0c76[_0x474349(0x108)]){}const _0x4907dd=_0xb9ec33['some'](_0x2e6a05=>normalizeBffType(_0x2e6a05[_0x474349(0x14a)])===_0x474349(0xf7)),_0x9f7b8a=_0x4907dd?buildDatasetCodeToAliasMap(_0x4e0c76[_0x474349(0x120)],_0x4e0c76['appCode'],_0x4e0c76['selectedAppName']||_0x4e0c76[_0x474349(0xd7)]?.[_0x474349(0x113)]||_0x4e0c76[_0x474349(0xd7)]?.[_0x474349(0x117)]):new Map(),_0x114240=createHookLocationMap(_0xf661f),_0x505025=JSON[_0x474349(0x118)](JSON['stringify'](_0x34b587)),_0x2c8917=_0x4e0c76[_0x474349(0xed)],_0x2131db=_0x505025[_0x474349(0x115)][_0x2c8917];if(!_0x2131db)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x2c8917+_0x474349(0xec));const _0x43bbe9=_0x4907dd?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x517b94,_0x2131db,_0x9f7b8a,await scanLocalBffFunctions(_0x517b94,'HOOK')),_0x2131db):undefined,_0x59434f=createPullFileTransaction(),_0x588551=[],_0x431855=[],_0x3fa2a3=[],_0x315bca=[];for(const _0x194cb7 of _0xb9ec33){const _0xf39705=resolveRemoteScriptTarget(_0x517b94,_0x194cb7,_0x114240,_0x2131db['functions'],_0x9f7b8a);if(!_0xf39705){_0x431855['push']({'lockKey':_0x194cb7['scriptType']+'/'+_0x194cb7['functionName'],'reason':_0x474349(0x116)});continue;}const _0x2975a2=_0x2131db[_0x474349(0x15d)][_0xf39705['lockKey']];try{if(!_0x194cb7['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x194cb7[_0x474349(0xdd)]==null)throw new Error(_0x474349(0x100));const _0x18b34=_0x194cb7[_0x474349(0xdd)],_0x26aa5e=computeContentHash(_0x18b34);if(!_0x5ad3ee){const _0x268b9b=await hasUnsyncedLocalChanges(_0xf39705[_0x474349(0xf3)],_0x2975a2,_0x26aa5e);if(_0x268b9b){_0x3fa2a3['push'](localUnsyncedConflict(_0xf39705,_0x194cb7['id']));continue;}}await _0x59434f[_0x474349(0x12e)](_0xf39705[_0x474349(0xf3)],_0x18b34);const _0x355352={'hash':_0x26aa5e,'remoteId':_0x194cb7['id'],'version':_0x194cb7[_0x474349(0x121)]};_0xf39705[_0x474349(0x12b)]===_0x474349(0xf7)&&_0xf39705[_0x474349(0xe1)]&&(_0x355352[_0x474349(0x141)]=_0xf39705[_0x474349(0xe1)][_0x474349(0x141)],_0x355352[_0x474349(0xeb)]=_0xf39705[_0x474349(0xe1)]['datasetCode'],_0x355352[_0x474349(0x103)]=_0xf39705[_0x474349(0xe1)][_0x474349(0x103)],_0x355352[_0x474349(0x106)]=_0xf39705[_0x474349(0xe1)][_0x474349(0x106)]),_0x2131db['functions'][_0xf39705[_0x474349(0xff)]]=_0x355352,_0x588551[_0x474349(0xfc)]({'lockKey':_0xf39705[_0x474349(0xff)],'remoteId':_0x194cb7['id']});}catch(_0xe5706e){_0x315bca['push']({'lockKey':_0xf39705[_0x474349(0xff)],'error':_0xe5706e instanceof Error?_0xe5706e[_0x474349(0x134)]:String(_0xe5706e)});}}_0x2131db[_0x474349(0xce)]=new Date()[_0x474349(0xe9)]();try{await writeBffLockFile(_0x517b94['lockFilePath'],_0x505025);}catch(_0x2efd58){const _0x5ec9e8=[...await _0x59434f['rollback'](),...await _0x43bbe9?.[_0x474349(0x12a)]()??[]];throw withRollbackErrors(_0x2efd58,_0x474349(0x135),_0x5ec9e8);}return{'ok':_0x315bca[_0x474349(0xcb)]===0x0,'data':{'pulled':_0x588551,'skipped':_0x431855,'conflicts':_0x3fa2a3,'failed':_0x315bca},'message':formatPullMessage(_0x588551[_0x474349(0xcb)],_0x431855['length'],_0x3fa2a3[_0x474349(0xcb)],_0x315bca[_0x474349(0xcb)])};}};function localUnsyncedConflict(_0x2f520d,_0x349a20){const _0x3439bd=a43_0x14c6a4,_0x56ddc2=_0x2f520d[_0x3439bd(0xff)][_0x3439bd(0x11c)]('/')['at'](-0x1);return{'code':_0x3439bd(0x15b),'lockKey':_0x2f520d['lockKey'],'filePath':_0x2f520d[_0x3439bd(0xf3)],..._0x349a20!=null?{'remoteId':_0x349a20}:{},'message':_0x3439bd(0x13e),'nextAction':{'action':_0x3439bd(0x13c),'command':CLI_BIN_NAME+_0x3439bd(0x11a)+_0x2f520d['type']+_0x3439bd(0x155)+_0x56ddc2+_0x3439bd(0x12c),'requiresReview':!![],'message':_0x3439bd(0xfb)}};}function formatPullMessage(_0x403695,_0x3ae79a,_0x10b481,_0x3c0d53){const _0x29eafa=a43_0x14c6a4,_0x20f8ca=[_0x29eafa(0xee)+_0x403695+'\x20pulled',_0x3ae79a+'\x20skipped'];_0x10b481>0x0&&_0x20f8ca[_0x29eafa(0xfc)](_0x10b481+_0x29eafa(0x13a)+(_0x10b481===0x1?'':'s')+'\x20'+(_0x10b481===0x1?_0x29eafa(0x101):_0x29eafa(0x143))+_0x29eafa(0x13f));if(_0x3c0d53>0x0)_0x20f8ca[_0x29eafa(0xfc)](_0x3c0d53+_0x29eafa(0x130));return _0x20f8ca[_0x29eafa(0xdb)](',\x20');}async function hasUnsyncedLocalChanges(_0x1042f3,_0x3273e2,_0x208059){const _0x45e575=a43_0x14c6a4;if(!await fileExists(_0x1042f3))return![];const _0xa183d7=await computeFileHash(_0x1042f3);if(!_0x3273e2)return _0x208059?_0xa183d7!==_0x208059:!![];return _0xa183d7!==_0x3273e2[_0x45e575(0x119)];}function createPullFileTransaction(){const _0x5d5933=new Map(),_0x2617dc=async(_0x26e43a,_0xdc72ab)=>{const _0xa0d116=a43_0x48c4;try{if(_0xdc72ab[_0xa0d116(0xf1)])await ensureParentDirectory(_0x26e43a),await writeFile(_0x26e43a,_0xdc72ab[_0xa0d116(0x104)]);else try{await unlink(_0x26e43a);}catch(_0x14a117){if(_0x14a117[_0xa0d116(0x15c)]!==_0xa0d116(0x11b))throw _0x14a117;}return undefined;}catch(_0x369d69){return _0x369d69 instanceof Error?_0x369d69:new Error(String(_0x369d69));}};return{async 'write'(_0x5a97ef,_0x3a69ef){const _0x3f15f2=a43_0x48c4;if(!_0x5d5933[_0x3f15f2(0xef)](_0x5a97ef))try{_0x5d5933[_0x3f15f2(0x15f)](_0x5a97ef,{'existed':!![],'content':await readFile(_0x5a97ef)});}catch(_0x5472f7){if(_0x5472f7[_0x3f15f2(0x15c)]!==_0x3f15f2(0x11b))throw _0x5472f7;_0x5d5933[_0x3f15f2(0x15f)](_0x5a97ef,{'existed':![]});}try{await ensureParentDirectory(_0x5a97ef),await writeFile(_0x5a97ef,_0x3a69ef,_0x3f15f2(0x109));}catch(_0x508f29){const _0x13f8df=await _0x2617dc(_0x5a97ef,_0x5d5933[_0x3f15f2(0x148)](_0x5a97ef));if(!_0x13f8df)_0x5d5933['delete'](_0x5a97ef);throw withRollbackErrors(_0x508f29,_0x3f15f2(0x122)+_0x5a97ef+'\x22.',_0x13f8df?[_0x13f8df]:[]);}},async 'rollback'(){const _0x589964=a43_0x48c4,_0x5c6a0f=[];for(const [_0x2c7c8f,_0x29ae8f]of[..._0x5d5933[_0x589964(0xe3)]()]['reverse']()){const _0xa71781=await _0x2617dc(_0x2c7c8f,_0x29ae8f);_0xa71781&&_0x5c6a0f[_0x589964(0xfc)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x2c7c8f+'\x22:\x20'+_0xa71781[_0x589964(0x134)]));}return _0x5c6a0f;}};}function a43_0x44ad(){const _0x549806=['selectedAppName','1343980YpKvON','&type=','newLockKey','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','keyChanges','bff','\x20--name\x20','bool','.js','dev','newDirectoryPath','\x22\x20may\x20remain.','BFF_LOCAL_UNSYNCED','code','functions','\x22:\x20both\x20target\x20\x22','set','validation','.hook-directory-migrate-','length','remoteId','mode','lastSync','\x22;\x20temporary\x20directory\x20\x22','ENDPOINT','491475ydBqVf','reverse','HOOK/','migrations','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','mergedCli','trim','\x22:\x20','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','join','\x22\x20to\x20\x22','scriptContent','functionName','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','75MsaITf','hookLocation','10396460pjQXnN','entries','str','1141266YOhdhi','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','sourceDirectoryPathByNewDirectory','question','toISOString','oldDirectoryPath','datasetCode','\x22\x20not\x20found\x20after\x20ensureLockScope.','appCode','Pull\x20complete:\x20','has','cancelled','existed','projectedFunctions','filePath','\x22\x20from\x20\x22','928277zXaWsR','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','HOOK','case-rename','\x20Recovery\x20errors:\x20','scriptsRootDir','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.','push','8bznZHs','flatMap','lockKey','Remote\x20script\x20missing\x20content.','requires','sourceFilePathByNewLockKey','operationType','content','entry','functionNode','newDirectory','nonInteractive','utf8','Pull\x20only\x20this\x20script\x20type','Would\x20inspect\x20','conflict','normalize','boolean','/api/management/library/scripts/list?appCode=','lockFilePath','10OJieFu','15304AjTFqY','currentApp','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','apps','unresolvable\x20target\x20path','defaultApp','parse','hash','\x20bff\x20push\x20--type\x20','ENOENT','split','Force\x20pull\x20cancelled.','GET','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','apiDir','version','Failed\x20to\x20write\x20local\x20script\x20\x22','close','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','includes','\x22\x20and\x20\x22','filter','string','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','rollback','type','\x20--format\x20compress','oldLockKey','write','values','\x20failed','map','all','oldDirectory','message','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','profileName','toLowerCase','2046492dPdRxN','\x20conflict','stderr','push_local','scriptsRoot','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','\x20resolution','yes','alias','would_pull','require','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','pull','force','move','get','stdin','scriptType','\x22:\x20its\x20target\x20\x22','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','¤tPage=1&pageSize='];a43_0x44ad=function(){return _0x549806;};return a43_0x44ad();}function withRollbackErrors(_0x14af7b,_0x1f3d84,_0x2423ff){const _0x485b54=a43_0x14c6a4,_0x51a8e6=_0x14af7b instanceof Error?_0x14af7b:new Error(String(_0x14af7b));if(_0x2423ff[_0x485b54(0xcb)]===0x0)return _0x51a8e6;return new AggregateError([_0x51a8e6,..._0x2423ff],_0x1f3d84+_0x485b54(0xf9)+_0x2423ff[_0x485b54(0x131)](_0x9e1415=>_0x9e1415[_0x485b54(0x134)])[_0x485b54(0xdb)](';\x20'));}function buildDatasetCodeToAliasMap(_0x1452f4,_0x504377,_0x17a6dc){const _0x5d470d=a43_0x14c6a4,_0x4de3fb=resolveApiModelSource(_0x1452f4,_0x504377,_0x17a6dc),_0x1b531e=loadAliasMap(_0x1452f4,undefined,_0x4de3fb['filePath'],_0x4de3fb[_0x5d470d(0x137)]);return assertUnambiguousHookAliases(_0x1b531e),new Map(_0x1b531e[_0x5d470d(0x131)](_0x3c354f=>[_0x3c354f['datasetCode']['toLowerCase'](),_0x3c354f[_0x5d470d(0x141)]]));}async function planHookDirectoryMigration(_0x5e2e9c,_0x5119fe,_0x272f59,_0x50a62f){const _0xe820a7=a43_0x14c6a4,_0x6f154=new Map();for(const [_0x17e187,_0x22d484]of Object['entries'](_0x5119fe['functions'])){const [_0x52ba8d,_0x6c02b7,_0xe79a99,_0x4397ae,_0x56413c,..._0x505806]=_0x17e187['split']('/');if(_0x52ba8d!=='HOOK'||!_0x6c02b7||!_0xe79a99||!_0x4397ae||!_0x56413c||_0x505806[_0xe820a7(0xcb)]>0x0||!_0x22d484['datasetCode'])continue;const _0x18cab2=_0x272f59[_0xe820a7(0x148)](_0x22d484['datasetCode'][_0xe820a7(0x138)]()),_0x3e1d73=_0x18cab2??_0x22d484['datasetCode'];if(!isSafeHookDirectorySegment(_0x6c02b7))throw CliErrors[_0xe820a7(0xc9)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x6c02b7+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x3e1d73))throw CliErrors[_0xe820a7(0xc9)](_0xe820a7(0x11f)+_0x6c02b7+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x6c02b7===_0x3e1d73)continue;const _0x551be9=_0x6f154[_0xe820a7(0x148)](_0x6c02b7)??{'datasetCode':_0x22d484[_0xe820a7(0xeb)],'alias':_0x18cab2,'keyChanges':[]};if(_0x551be9[_0xe820a7(0xeb)]!==_0x22d484['datasetCode'])throw CliErrors[_0xe820a7(0xc9)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x6c02b7+_0xe820a7(0xe6));const _0x30c13f=_0xe820a7(0xd3)+_0x3e1d73+'/'+_0xe79a99+'/'+_0x4397ae+'/'+_0x56413c;try{resolveLocalFilePathFromLockKey(_0x5e2e9c,_0x17e187),resolveLocalFilePathFromLockKey(_0x5e2e9c,_0x30c13f);}catch(_0x140dcc){throw CliErrors['validation']('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x17e187+_0xe820a7(0xd9)+(_0x140dcc instanceof Error?_0x140dcc['message']:String(_0x140dcc)));}_0x551be9[_0xe820a7(0x153)]['push']({'oldLockKey':_0x17e187,'newLockKey':_0x30c13f,'entry':_0x22d484}),_0x6f154['set'](_0x6c02b7,_0x551be9);}const _0x2be16e=new Set([..._0x6f154[_0xe820a7(0x12f)]()][_0xe820a7(0xfe)](_0x3e7be6=>_0x3e7be6['keyChanges'][_0xe820a7(0x131)](_0x238ecc=>_0x238ecc['oldLockKey']))),_0x435d38=new Map(),_0x3d3632=new Map();for(const [_0x3f7a41,_0x41c671]of _0x6f154){const _0x30fa9d=_0x41c671[_0xe820a7(0x141)]??_0x41c671[_0xe820a7(0xeb)],_0x554eea=hookDirectoryIdentity(_0x30fa9d),_0x36b267=_0x435d38[_0xe820a7(0x148)](_0x554eea);if(_0x36b267&&_0x36b267!==_0x3f7a41)throw CliErrors[_0xe820a7(0xc9)](_0xe820a7(0x129)+_0x36b267+_0xe820a7(0x126)+_0x3f7a41+_0xe820a7(0x15e)+_0x30fa9d+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x435d38[_0xe820a7(0x15f)](_0x554eea,_0x3f7a41);for(const _0x458567 of _0x41c671[_0xe820a7(0x153)]){const _0x1ecefd=_0x3d3632[_0xe820a7(0x148)](_0x458567[_0xe820a7(0x151)]);if(_0x1ecefd&&_0x1ecefd!==_0x458567[_0xe820a7(0x12d)])throw CliErrors[_0xe820a7(0xc9)](_0xe820a7(0xda)+_0x1ecefd+_0xe820a7(0x126)+_0x458567['oldLockKey']+_0xe820a7(0x15e)+_0x458567['newLockKey']+_0xe820a7(0x152));if(_0x2be16e[_0xe820a7(0xef)](_0x458567[_0xe820a7(0x151)]))throw CliErrors[_0xe820a7(0xc9)](_0xe820a7(0x114)+_0x458567[_0xe820a7(0x12d)]+_0xe820a7(0x14b)+_0x458567[_0xe820a7(0x151)]+_0xe820a7(0xdf));_0x3d3632['set'](_0x458567['newLockKey'],_0x458567['oldLockKey']);}}const _0x33e73a=new Map();for(const [_0x3c2a38,_0x589c65]of _0x272f59){_0x33e73a['set'](hookDirectoryIdentity(_0x589c65),_0x3c2a38);}const _0x26380c=[];for(const [_0x4fcebc,_0x249772]of _0x6f154){const _0x39a321=_0x249772['alias']??_0x249772['datasetCode'],_0x463ca8=join(_0x5e2e9c[_0xe820a7(0xfa)],'HOOK',_0x4fcebc),_0x14a929=join(_0x5e2e9c[_0xe820a7(0xfa)],_0xe820a7(0xf7),_0x39a321),_0x14a9ef=await directoryExists(_0x463ca8),_0x21edbc=await directoryExists(_0x14a929),_0x35b4b5=_0x14a9ef?_0x21edbc?await sameDirectory(_0x463ca8,_0x14a929)?_0xe820a7(0xf8):undefined:_0xe820a7(0x147):'rekey';if(!_0x35b4b5)throw CliErrors[_0xe820a7(0xc9)](_0xe820a7(0x11f)+_0x4fcebc+_0xe820a7(0xdc)+_0x39a321+_0xe820a7(0x136));const _0x441b0e=_0x33e73a[_0xe820a7(0x148)](hookDirectoryIdentity(_0x4fcebc));if(_0x441b0e&&_0x441b0e!==_0x249772['datasetCode'][_0xe820a7(0x138)]()){const _0x5d782b=new Set(_0x249772[_0xe820a7(0x153)][_0xe820a7(0x131)](_0xc5e0dd=>_0xc5e0dd['oldLockKey'])),_0x40dec5=_0x50a62f[_0xe820a7(0x127)](_0x43a5c6=>_0x43a5c6[_0xe820a7(0x12b)]===_0xe820a7(0xf7)&&_0x43a5c6[_0xe820a7(0x141)]!=null&&hookDirectoryIdentity(_0x43a5c6[_0xe820a7(0x141)])===hookDirectoryIdentity(_0x4fcebc)&&!_0x5d782b['has'](_0x43a5c6[_0xe820a7(0xff)]));if(_0x40dec5[_0xe820a7(0xcb)]>0x0)throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x4fcebc+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x332b10=_0x33e73a[_0xe820a7(0x148)](hookDirectoryIdentity(_0x39a321));if(_0x332b10&&_0x332b10!==_0x249772[_0xe820a7(0xeb)][_0xe820a7(0x138)]())throw CliErrors['validation'](_0xe820a7(0x11f)+_0x4fcebc+_0xe820a7(0xdc)+_0x39a321+_0xe820a7(0xd6));for(const _0x1bea0a of _0x249772['keyChanges']){const _0x435968=_0x5119fe['functions'][_0x1bea0a[_0xe820a7(0x151)]];if(_0x435968&&!_0x2be16e['has'](_0x1bea0a[_0xe820a7(0x151)])&&!sameHookIdentity(_0x1bea0a['entry'],_0x435968))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x4fcebc+'\x22\x20to\x20\x22'+_0x39a321+'\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.');}_0x26380c['push']({'oldDirectory':_0x4fcebc,'newDirectory':_0x39a321,'oldDirectoryPath':_0x463ca8,'newDirectoryPath':_0x14a929,'mode':_0x35b4b5,'alias':_0x249772[_0xe820a7(0x141)],'keyChanges':_0x249772[_0xe820a7(0x153)]});}const _0x2b5906={..._0x5119fe[_0xe820a7(0x15d)]},_0x3aaf20=new Map(),_0x54bf2e=new Map();for(const _0x282851 of _0x26380c){const _0x2b4600=_0x282851[_0xe820a7(0xcd)]!=='rekey';_0x2b4600&&_0x54bf2e[_0xe820a7(0x15f)](hookDirectoryIdentity(_0x282851['newDirectory']),_0x282851[_0xe820a7(0xea)]);for(const _0x3a86ee of _0x282851[_0xe820a7(0x153)]){const _0x152152=_0x2b5906[_0x3a86ee['newLockKey']],_0x1d56ba=_0x2b4600?_0x3a86ee[_0xe820a7(0x105)]:_0x152152??_0x3a86ee[_0xe820a7(0x105)];_0x2b5906[_0x3a86ee['newLockKey']]=canonicalizeHookEntry(_0x1d56ba,_0x282851['alias']),delete _0x2b5906[_0x3a86ee[_0xe820a7(0x12d)]],_0x2b4600&&_0x3aaf20[_0xe820a7(0x15f)](_0x3a86ee[_0xe820a7(0x151)],resolveLocalFilePathFromLockKey(_0x5e2e9c,_0x3a86ee[_0xe820a7(0x12d)]));}}return{'migrations':_0x26380c,'projectedFunctions':_0x2b5906,'sourceFilePathByNewLockKey':_0x3aaf20,'sourceDirectoryPathByNewDirectory':_0x54bf2e};}function a43_0x48c4(_0x1f5d5d,_0x2756ed){_0x1f5d5d=_0x1f5d5d-0xc9;const _0x44adb4=a43_0x44ad();let _0x48c4ff=_0x44adb4[_0x1f5d5d];return _0x48c4ff;}function resolveMigratedSourceFilePath(_0x2729f3,_0xbd9e71){const _0x6efa6a=a43_0x14c6a4;if(!_0x2729f3||!_0xbd9e71)return undefined;const _0x2bca6c=_0x2729f3[_0x6efa6a(0x102)][_0x6efa6a(0x148)](_0xbd9e71[_0x6efa6a(0xff)]);if(_0x2bca6c)return _0x2bca6c;if(_0xbd9e71['type']!==_0x6efa6a(0xf7))return undefined;const [,_0x25b176,..._0x42f0bb]=_0xbd9e71[_0x6efa6a(0xff)][_0x6efa6a(0x11c)]('/');if(!_0x25b176||_0x42f0bb[_0x6efa6a(0xcb)]===0x0)return undefined;const _0xdf503f=_0x2729f3[_0x6efa6a(0xe7)][_0x6efa6a(0x148)](hookDirectoryIdentity(_0x25b176));return _0xdf503f?join(_0xdf503f,..._0x42f0bb)+_0x6efa6a(0x157):undefined;}function sameHookIdentity(_0x3adf3f,_0x20ad8e){const _0x191600=a43_0x14c6a4;return _0x3adf3f['remoteId']===_0x20ad8e[_0x191600(0xcc)]&&_0x3adf3f[_0x191600(0xeb)]===_0x20ad8e[_0x191600(0xeb)]&&_0x3adf3f['operationType']===_0x20ad8e['operationType']&&_0x3adf3f[_0x191600(0x106)]===_0x20ad8e[_0x191600(0x106)];}function canonicalizeHookEntry(_0x2da8db,_0x4e0f0d){const {alias:_0x3487a2,..._0x3efe1b}=_0x2da8db;return _0x4e0f0d?{..._0x3efe1b,'alias':_0x4e0f0d}:_0x3efe1b;}function hookDirectoryIdentity(_0x14fb79){const _0x32b39a=a43_0x14c6a4;return _0x14fb79[_0x32b39a(0x10d)]('NFC')[_0x32b39a(0x138)]();}function isSafeHookDirectorySegment(_0x40bf07){return isSafeLockKeySegment(_0x40bf07);}async function sameDirectory(_0x1ad5a3,_0x5b7825){const _0x1bb820=a43_0x14c6a4,[_0x28057c,_0x4d38a3]=await Promise[_0x1bb820(0x132)]([stat(_0x1ad5a3),stat(_0x5b7825)]);return _0x28057c['dev']===_0x4d38a3[_0x1bb820(0x158)]&&_0x28057c['ino']===_0x4d38a3['ino'];}async function applyHookDirectoryMigration(_0xeb3aeb,_0xc0aa68){const _0x1fcf52=a43_0x14c6a4,_0x4b85f6=_0xc0aa68[_0x1fcf52(0x15d)],_0x503c49=_0xc0aa68[_0x1fcf52(0xce)],_0x3027d6=[],_0x24a515=async()=>{const _0x26c115=_0x1fcf52,_0x365c3c=[];_0xc0aa68[_0x26c115(0x15d)]=_0x4b85f6,_0xc0aa68[_0x26c115(0xce)]=_0x503c49;for(const {migration:_0x20b8f3,temporaryPath:_0x5cf14c}of[..._0x3027d6][_0x26c115(0xd2)]()){try{_0x5cf14c?(await rename(_0x20b8f3[_0x26c115(0x159)],_0x5cf14c),await rename(_0x5cf14c,_0x20b8f3[_0x26c115(0xea)])):await rename(_0x20b8f3[_0x26c115(0x159)],_0x20b8f3[_0x26c115(0xea)]);}catch(_0x21b339){_0x365c3c['push'](new Error(_0x26c115(0xf6)+_0x20b8f3[_0x26c115(0x133)]+_0x26c115(0xf4)+_0x20b8f3['newDirectory']+'\x22:\x20'+(_0x21b339 instanceof Error?_0x21b339['message']:String(_0x21b339))));}}return _0x365c3c;};try{for(const _0x544de5 of _0xeb3aeb[_0x1fcf52(0xd4)]){if(_0x544de5['mode']==='move')await ensureParentDirectory(_0x544de5[_0x1fcf52(0x159)]),await rename(_0x544de5[_0x1fcf52(0xea)],_0x544de5[_0x1fcf52(0x159)]),_0x3027d6[_0x1fcf52(0xfc)]({'migration':_0x544de5});else{if(_0x544de5['mode']===_0x1fcf52(0xf8)){const _0x2d8d1b=join(dirname(_0x544de5[_0x1fcf52(0xea)]),_0x1fcf52(0xca)+randomUUID());await rename(_0x544de5['oldDirectoryPath'],_0x2d8d1b);try{await rename(_0x2d8d1b,_0x544de5[_0x1fcf52(0x159)]);}catch(_0x19fa57){try{await rename(_0x2d8d1b,_0x544de5[_0x1fcf52(0xea)]);}catch(_0x4cd2da){throw withRollbackErrors(_0x19fa57,_0x1fcf52(0x14c)+_0x544de5['oldDirectory']+_0x1fcf52(0xdc)+_0x544de5[_0x1fcf52(0x107)]+_0x1fcf52(0xcf)+_0x2d8d1b+_0x1fcf52(0x15a),[new Error(_0x1fcf52(0x144)+_0x2d8d1b+_0x1fcf52(0xdc)+_0x544de5[_0x1fcf52(0x133)]+'\x22:\x20'+(_0x4cd2da instanceof Error?_0x4cd2da[_0x1fcf52(0x134)]:String(_0x4cd2da)))]);}throw _0x19fa57;}_0x3027d6[_0x1fcf52(0xfc)]({'migration':_0x544de5,'temporaryPath':_0x2d8d1b});}}}return _0xc0aa68['functions']=_0xeb3aeb['projectedFunctions'],{'rollback':_0x24a515};}catch(_0x4af532){const _0x1fe5f7=await _0x24a515();throw withRollbackErrors(_0x4af532,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x1fe5f7);}}async function confirmForce(){const _0x3cf5f0=a43_0x14c6a4,_0x1ecc14=createInterface({'input':process[_0x3cf5f0(0x149)],'output':process[_0x3cf5f0(0x13b)]}),_0x2ac679=await new Promise(_0x36fe30=>{const _0x49cf49=_0x3cf5f0;_0x1ecc14[_0x49cf49(0xe8)](_0x49cf49(0xd5),_0x36fe30);});return _0x1ecc14[_0x3cf5f0(0x123)](),['y',_0x3cf5f0(0x140)][_0x3cf5f0(0x125)](_0x2ac679[_0x3cf5f0(0xd8)]()['toLowerCase']());}
|