@lovrabet/rabetbase-cli 2.5.12-beta.1 → 2.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x4c672b=a34_0x184b;(function(_0x46c2ef,_0x4c2f82){const _0x34ea07=a34_0x184b,_0x3a3f0a=_0x46c2ef();while(!![]){try{const _0xb6ef61=parseInt(_0x34ea07(0xfd))/0x1+parseInt(_0x34ea07(0xe9))/0x2*(parseInt(_0x34ea07(0xeb))/0x3)+-parseInt(_0x34ea07(0xf4))/0x4*(-parseInt(_0x34ea07(0xf2))/0x5)+parseInt(_0x34ea07(0x102))/0x6+parseInt(_0x34ea07(0xfc))/0x7*(-parseInt(_0x34ea07(0xf6))/0x8)+parseInt(_0x34ea07(0xf7))/0x9+-parseInt(_0x34ea07(0x101))/0xa*(parseInt(_0x34ea07(0x100))/0xb);if(_0xb6ef61===_0x4c2f82)break;else _0x3a3f0a['push'](_0x3a3f0a['shift']());}catch(_0x3dfc18){_0x3a3f0a['push'](_0x3a3f0a['shift']());}}}(a34_0x34ef,0xae45c));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a34_0x34ef(){const _0x1acbdc=['number','POST','get','Updated','/smartapi/app-config/create','appCode','255eYJUEi','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','10980eYASkL','set','6649648yODMRJ','5723244cmFaZJ','Read\x20config\x20value\x20from\x20file','string','Created','/smartapi/app-config/update','7hToWTG','1418809SCNpTM',',\x20appCode=','update','20185187eJvoLL','10HFWVKB','1231920sKZgKO','app-config','create','write','tags','626VNkuqu','isFinite','9393cFTKDj'];a34_0x34ef=function(){return _0x1acbdc;};return a34_0x34ef();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a34_0x184b(_0x32aea3,_0x1aee19){_0x32aea3=_0x32aea3-0xe5;const _0x34ef68=a34_0x34ef();let _0x184b3d=_0x34ef68[_0x32aea3];return _0x184b3d;}const CREATE_PATH=a34_0x4c672b(0xf0),UPDATE_PATH=a34_0x4c672b(0xfb);export const appConfigSet={'service':a34_0x4c672b(0xe5),'command':a34_0x4c672b(0xf5),'description':a34_0x4c672b(0xf3),'risk':a34_0x4c672b(0xe7),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':'file','type':a34_0x4c672b(0xf9),'description':a34_0x4c672b(0xf8)}],async 'validate'(_0x4e1cff){readKeyArg(_0x4e1cff),readOptionalTags(_0x4e1cff),assertSingleValueSource(_0x4e1cff);},async 'dryRun'(_0x3d6fb0){const _0x19ce32=a34_0x4c672b,_0x254789=readKeyArg(_0x3d6fb0),_0x1b66db=readOptionalTags(_0x3d6fb0),_0x1eb3bd=assertSingleValueSource(_0x3d6fb0);await assertValueSourceReadable(_0x1eb3bd);const _0x37e366=await withAppConfigApiBoundary(_0x19ce32(0xee),{'appCode':_0x3d6fb0['appCode'],'key':_0x254789},()=>getAppConfigByKey(_0x3d6fb0[_0x19ce32(0xf1)],_0x254789)),_0x183c20=_0x37e366?_0x19ce32(0xff):'create',_0x4fdd26=_0x37e366?projectAppConfig(_0x37e366):null,_0x1023ee=plannedAppConfig({'appCode':_0x3d6fb0[_0x19ce32(0xf1)],'key':_0x254789,'tags':_0x1b66db??_0x37e366?.[_0x19ce32(0xe8)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x183c20,'appCode':_0x3d6fb0['appCode'],'key':_0x254789,'before':_0x4fdd26,'after':_0x1023ee,'dryRun':!![]}),{'method':_0x19ce32(0xed),'url':_0x183c20===_0x19ce32(0xff)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x704073){const _0x485dab=a34_0x4c672b,_0x15ce7b=readKeyArg(_0x704073),_0x201360=readOptionalTags(_0x704073),_0x52b468=await withAppConfigApiBoundary(_0x485dab(0xee),{'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b},()=>getAppConfigByKey(_0x704073[_0x485dab(0xf1)],_0x15ce7b)),_0x5dc6b8=_0x52b468?projectAppConfig(_0x52b468):null,_0x58564=_0x52b468?_0x485dab(0xff):_0x485dab(0xe6),{value:_0x5e3528,warnings:_0x2ce1f1}=await readAppConfigValue(_0x704073),_0x4d8409={'appCode':_0x704073['appCode'],'key':_0x15ce7b,'value':_0x5e3528,'tags':_0x201360??_0x52b468?.[_0x485dab(0xe8)]??undefined};await withAppConfigApiBoundary(_0x58564,{'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b},async()=>{_0x52b468?await updateAppConfig({..._0x4d8409,'id':requireAppConfigId(_0x52b468,_0x15ce7b,_0x704073['appCode'])}):await createAppConfig(_0x4d8409);});const _0x4d440b=await withAppConfigApiBoundary(_0x485dab(0xee),{'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b},()=>getAppConfigByKey(_0x704073[_0x485dab(0xf1)],_0x15ce7b)),_0x10440e=_0x4d440b?projectAppConfig(_0x4d440b):plannedAppConfig({'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b,'tags':_0x4d8409[_0x485dab(0xe8)],'hasValue':_0x5e3528!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x58564,'appCode':_0x704073[_0x485dab(0xf1)],'key':_0x15ce7b,'before':_0x5dc6b8,'after':_0x10440e,'dryRun':![],'warnings':_0x2ce1f1}),'message':(_0x58564===_0x485dab(0xff)?_0x485dab(0xef):_0x485dab(0xfa))+'\x20app\x20config\x20'+_0x15ce7b};}};function requireAppConfigId(_0x56bcdd,_0x4e08d0,_0x54917e){const _0x2f897c=a34_0x4c672b;if(typeof _0x56bcdd['id']===_0x2f897c(0xec)&&Number[_0x2f897c(0xea)](_0x56bcdd['id'])&&_0x56bcdd['id']>0x0)return _0x56bcdd['id'];throw CliErrors['apiError']('App\x20config\x20server\x20id\x20missing\x20for\x20key='+_0x4e08d0+_0x2f897c(0xfe)+_0x54917e);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x3c0d5a=a35_0x2d0d;(function(_0x39cf29,_0x54bef1){const _0x5c2b70=a35_0x2d0d,_0x3f4924=_0x39cf29();while(!![]){try{const _0x149d90=parseInt(_0x5c2b70(0xe7))/0x1*(parseInt(_0x5c2b70(0x118))/0x2)+-parseInt(_0x5c2b70(0x113))/0x3+parseInt(_0x5c2b70(0xec))/0x4+-parseInt(_0x5c2b70(0xfe))/0x5*(-parseInt(_0x5c2b70(0x121))/0x6)+parseInt(_0x5c2b70(0x11b))/0x7+parseInt(_0x5c2b70(0x108))/0x8*(-parseInt(_0x5c2b70(0xf8))/0x9)+-parseInt(_0x5c2b70(0x124))/0xa*(parseInt(_0x5c2b70(0x11a))/0xb);if(_0x149d90===_0x54bef1)break;else _0x3f4924['push'](_0x3f4924['shift']());}catch(_0x58db3c){_0x3f4924['push'](_0x3f4924['shift']());}}}(a35_0x40f0,0x99823));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x3c0d5a(0xea),'description':a35_0x3c0d5a(0xfd),'required':!![]};function a35_0x40f0(){const _0xe52822=['path','value\x20is\x20redacted','dryRun','flag','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','from-env','reveal','210636NnFBoC','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','end','name','App\x20config\x20value\x20source\x20is\x20ambiguous.','Runtime\x20app-config\x20key','1600adINGB','warnings','tags','Read\x20config\x20value\x20from\x20stdin','Config\x20tags\x20for\x20filtering/display\x20metadata','setEncoding','key:\x20','args','Value\x20file\x20is\x20not\x20readable:\x20','boolean','32mPzQqO','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','gmtCreate','push','gmtModified','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','stdin','join','before','kind','value','3485688UPrxVJ','Environment\x20variable\x20is\x20not\x20set:\x20','Missing\x20app-config\x20key.','hasValue','appCode','46WzbURl','error','10047851Gwcrgj','7989975DzxJBY','operation','after','apiError','validation','Failed\x20to\x20','13254QmFlqg','url','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','10jfZaqs','str','slice','once','trim','41027CCEEyJ','env','method','key','length','23192UijlWJ','utf8','\x20app\x20config.','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','file'];a35_0x40f0=function(){return _0xe52822;};return a35_0x40f0();}function a35_0x2d0d(_0x4622da,_0x26dac0){_0x4622da=_0x4622da-0xe5;const _0x40f043=a35_0x40f0();let _0x2d0d7f=_0x40f043[_0x4622da];return _0x2d0d7f;}export const VALUE_ARG={'name':a35_0x3c0d5a(0x112),'description':a35_0x3c0d5a(0xef),'required':![]};export const TAGS_FLAG={'name':a35_0x3c0d5a(0x100),'type':'string','description':a35_0x3c0d5a(0x102)};export const STDIN_FLAG={'name':a35_0x3c0d5a(0x10e),'type':a35_0x3c0d5a(0x107),'description':a35_0x3c0d5a(0x101),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x3c0d5a(0xf6),'type':'string','description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};export const REVEAL_FLAG={'name':a35_0x3c0d5a(0xf7),'type':a35_0x3c0d5a(0x107),'description':a35_0x3c0d5a(0x10d),'default':![]};export function readKeyArg(_0x2dc410){const _0x2604c2=a35_0x3c0d5a,_0x1724f8=_0x2dc410[_0x2604c2(0x105)][0x0]?.['trim']()??'';return validateKey(_0x1724f8),_0x1724f8;}export function readOptionalTags(_0x544810){const _0x5b4320=a35_0x3c0d5a,_0x4dd384=_0x544810[_0x5b4320(0x125)](_0x5b4320(0x100))[_0x5b4320(0xe6)]();if(!_0x4dd384)return undefined;if(_0x4dd384[_0x5b4320(0xeb)]>0x20)throw CliErrors[_0x5b4320(0x11f)]('App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.');return _0x4dd384;}export function validateKey(_0x4240f5){const _0xa3e271=a35_0x3c0d5a;if(!_0x4240f5)throw CliErrors[_0xa3e271(0x11f)](_0xa3e271(0x115));if(_0x4240f5[_0xa3e271(0xeb)]>0x100)throw CliErrors[_0xa3e271(0x11f)](_0xa3e271(0xf9));}export function projectAppConfig(_0x4deff1,_0x1fdf00){const _0x207327=a35_0x3c0d5a,_0x131428=_0x4deff1[_0x207327(0x112)]!==undefined&&_0x4deff1[_0x207327(0x112)]!==null&&_0x4deff1[_0x207327(0x112)]!=='',_0x582aa9={'appCode':_0x4deff1[_0x207327(0x117)],'key':_0x4deff1['key'],'tags':_0x4deff1[_0x207327(0x100)]??undefined,'hasValue':_0x131428,'valueRedacted':_0x131428&&!_0x1fdf00?.[_0x207327(0xf7)],'gmtCreate':_0x4deff1[_0x207327(0x10a)],'gmtModified':_0x4deff1[_0x207327(0x10c)]};return _0x1fdf00?.['reveal']&&(_0x582aa9[_0x207327(0x112)]=_0x4deff1['value']??'',_0x582aa9['valueRedacted']=![]),_0x582aa9;}export function plannedAppConfig(_0x1c7200){const _0x189277=a35_0x3c0d5a,_0x2d7b42=_0x1c7200[_0x189277(0x116)]??!![];return{'appCode':_0x1c7200['appCode'],'key':_0x1c7200[_0x189277(0xea)],'tags':_0x1c7200[_0x189277(0x100)]??undefined,'hasValue':_0x2d7b42,'valueRedacted':_0x2d7b42};}export function buildMutationData(_0xe081c2){const _0x3bb73c=a35_0x3c0d5a;return{'operation':_0xe081c2[_0x3bb73c(0x11c)],'selector':{'appCode':_0xe081c2[_0x3bb73c(0x117)],'key':_0xe081c2[_0x3bb73c(0xea)]},'before':_0xe081c2[_0x3bb73c(0x110)],'after':_0xe081c2[_0x3bb73c(0x11d)],'dryRun':_0xe081c2[_0x3bb73c(0xf3)],'warnings':_0xe081c2[_0x3bb73c(0xff)]??[]};}export async function withAppConfigApiBoundary(_0x230285,_0xd62c76,_0xead381){const _0x12abf4=a35_0x3c0d5a;try{return await _0xead381();}catch{const _0x244d04=['appCode:\x20'+_0xd62c76[_0x12abf4(0x117)]];if(_0xd62c76[_0x12abf4(0xea)])_0x244d04['push'](_0x12abf4(0x104)+_0xd62c76['key']);_0x244d04[_0x12abf4(0x10b)](_0x12abf4(0xf2));throw CliErrors[_0x12abf4(0x11e)](_0x12abf4(0x120)+_0x230285+_0x12abf4(0xee),_0x244d04[_0x12abf4(0x10f)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x5798d8,_0x2e0c72){const _0x531996=a35_0x3c0d5a;return Object['defineProperties'](_0x5798d8,{'method':{'value':_0x2e0c72[_0x531996(0xe9)],'enumerable':![]},'url':{'value':_0x2e0c72[_0x531996(0x122)],'enumerable':![]}});}export function assertSingleValueSource(_0x3096c6){const _0x229f6a=a35_0x3c0d5a,_0x60ef38=[];_0x3096c6[_0x229f6a(0x105)][_0x229f6a(0xeb)]>0x1&&_0x60ef38['push']({'kind':'argument','value':_0x3096c6[_0x229f6a(0x105)][_0x229f6a(0x126)](0x1)[_0x229f6a(0x10f)]('\x20')});const _0x246116=_0x3096c6[_0x229f6a(0xf4)]('value');_0x246116!==undefined&&_0x246116!==null&&_0x60ef38[_0x229f6a(0x10b)]({'kind':'argument','value':String(_0x246116)});_0x3096c6['bool']('stdin')&&_0x60ef38[_0x229f6a(0x10b)]({'kind':_0x229f6a(0x10e)});const _0xad62c9=_0x3096c6[_0x229f6a(0x125)](_0x229f6a(0xf6))[_0x229f6a(0xe6)]();_0xad62c9&&_0x60ef38[_0x229f6a(0x10b)]({'kind':'env','name':_0xad62c9});const _0x98c5c8=_0x3096c6[_0x229f6a(0x125)]('file')[_0x229f6a(0xe6)]();_0x98c5c8&&_0x60ef38[_0x229f6a(0x10b)]({'kind':_0x229f6a(0xf0),'path':_0x98c5c8});if(_0x60ef38['length']===0x0)throw CliErrors[_0x229f6a(0x11f)]('Missing\x20app-config\x20value\x20source.',_0x229f6a(0x123));if(_0x60ef38[_0x229f6a(0xeb)]>0x1)throw CliErrors[_0x229f6a(0x11f)](_0x229f6a(0xfc),_0x229f6a(0x109));return _0x60ef38[0x0];}export async function assertValueSourceReadable(_0x466157){const _0x27cb90=a35_0x3c0d5a;if(_0x466157['kind']===_0x27cb90(0xe8)&&!(_0x466157[_0x27cb90(0xfb)]in process.env))throw CliErrors['validation'](_0x27cb90(0x114)+_0x466157[_0x27cb90(0xfb)]);if(_0x466157[_0x27cb90(0x111)]===_0x27cb90(0xf0))try{await access(_0x466157[_0x27cb90(0xf1)]);}catch{throw CliErrors[_0x27cb90(0x11f)](_0x27cb90(0x106)+_0x466157[_0x27cb90(0xf1)]);}}export async function readAppConfigValue(_0x11a8be){const _0x541e0b=a35_0x3c0d5a,_0x982c5=assertSingleValueSource(_0x11a8be),_0x38c5ec=[];if(_0x982c5['kind']==='argument')return _0x38c5ec[_0x541e0b(0x10b)](_0x541e0b(0xf5)),{'value':_0x982c5[_0x541e0b(0x112)]??'','source':_0x982c5['kind'],'warnings':_0x38c5ec};if(_0x982c5[_0x541e0b(0x111)]==='stdin')return{'value':await readStdin(),'source':_0x982c5[_0x541e0b(0x111)],'warnings':_0x38c5ec};if(_0x982c5['kind']==='env'){if(!(_0x982c5[_0x541e0b(0xfb)]in process.env))throw CliErrors[_0x541e0b(0x11f)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x982c5[_0x541e0b(0xfb)]);return{'value':process.env[_0x982c5.name]??'','source':_0x982c5[_0x541e0b(0x111)],'warnings':_0x38c5ec};}return{'value':await readFile(_0x982c5['path'],_0x541e0b(0xed)),'source':_0x982c5[_0x541e0b(0x111)],'warnings':_0x38c5ec};}function readStdin(){return new Promise((_0x59f382,_0xe0699d)=>{const _0x4812a2=a35_0x2d0d;let _0x2c1f71='';process['stdin'][_0x4812a2(0x103)](_0x4812a2(0xed)),process[_0x4812a2(0x10e)]['on']('data',_0x5206b7=>{_0x2c1f71+=_0x5206b7;}),process[_0x4812a2(0x10e)][_0x4812a2(0xe5)](_0x4812a2(0xfa),()=>_0x59f382(_0x2c1f71)),process[_0x4812a2(0x10e)][_0x4812a2(0xe5)](_0x4812a2(0x119),_0xe0699d);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0xefae40=a36_0x488b;(function(_0x38c68a,_0x604838){const _0x12b2b2=a36_0x488b,_0x118d9b=_0x38c68a();while(!![]){try{const _0x394114=-parseInt(_0x12b2b2(0x123))/0x1*(parseInt(_0x12b2b2(0x12a))/0x2)+-parseInt(_0x12b2b2(0x128))/0x3+parseInt(_0x12b2b2(0x124))/0x4*(-parseInt(_0x12b2b2(0x11b))/0x5)+-parseInt(_0x12b2b2(0x118))/0x6*(parseInt(_0x12b2b2(0x125))/0x7)+-parseInt(_0x12b2b2(0x11f))/0x8+parseInt(_0x12b2b2(0x11d))/0x9+-parseInt(_0x12b2b2(0x127))/0xa*(-parseInt(_0x12b2b2(0x121))/0xb);if(_0x394114===_0x604838)break;else _0x118d9b['push'](_0x118d9b['shift']());}catch(_0x3639c0){_0x118d9b['push'](_0x118d9b['shift']());}}}(a36_0x4f90,0x58ddc));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';function a36_0x4f90(){const _0x39e402=['10GgArCk','1866267IImRDh','log','26282TZUJWq','Login\x20via\x20browser','auth','nonInteractive','logout','!\x20Not\x20logged\x20in','405102kIZYpA','yes','bool','175gfTQOB','Clear\x20login\x20session','4128543ifTDCJ','write','3324184nbZBKB','✓\x20Logged\x20out','19316341aFXSpq','boolean','41gJpJym','15924RzXQlR','14keZyfF','../../auth/auth-server-ui.js'];a36_0x4f90=function(){return _0x39e402;};return a36_0x4f90();}function a36_0x488b(_0x5524cb,_0x596f10){_0x5524cb=_0x5524cb-0x114;const _0x4f9049=a36_0x4f90();let _0x488b73=_0x4f9049[_0x5524cb];return _0x488b73;}export const authDefinitions=[{'service':a36_0xefae40(0x114),'command':'login','description':a36_0xefae40(0x12b),'risk':a36_0xefae40(0x11e),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0xefae40(0x119),'type':a36_0xefae40(0x122),'description':'Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','default':![]}],async 'execute'(_0x2c01a0){const _0x4820bb=a36_0xefae40,{runAuthServer:_0x2ba8d1}=await import(_0x4820bb(0x126));return await _0x2ba8d1({'autoYes':_0x2c01a0[_0x4820bb(0x11a)]('yes'),'nonInteractive':_0x2c01a0[_0x4820bb(0x115)]}),{'ok':!![]};}},{'service':a36_0xefae40(0x114),'command':a36_0xefae40(0x116),'description':a36_0xefae40(0x11c),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x2e839d){const _0x4998a1=a36_0xefae40;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x4998a1(0x129)](_0x4998a1(0x120))):console[_0x4998a1(0x129)](_0x4998a1(0x117)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x5b05a3=a37_0x4cff;(function(_0x5b4521,_0x5d592d){const _0x72b440=a37_0x4cff,_0x472f2c=_0x5b4521();while(!![]){try{const _0x450a30=parseInt(_0x72b440(0x202))/0x1*(parseInt(_0x72b440(0x24e))/0x2)+-parseInt(_0x72b440(0x256))/0x3*(-parseInt(_0x72b440(0x1ff))/0x4)+-parseInt(_0x72b440(0x250))/0x5*(-parseInt(_0x72b440(0x21e))/0x6)+parseInt(_0x72b440(0x1ef))/0x7+parseInt(_0x72b440(0x248))/0x8+-parseInt(_0x72b440(0x222))/0x9*(parseInt(_0x72b440(0x21f))/0xa)+-parseInt(_0x72b440(0x245))/0xb;if(_0x450a30===_0x5d592d)break;else _0x472f2c['push'](_0x472f2c['shift']());}catch(_0x5b0782){_0x472f2c['push'](_0x472f2c['shift']());}}}(a37_0xeae6,0xa5cb4));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x5b05a3(0x212),'command':a37_0x5b05a3(0x22c),'description':a37_0x5b05a3(0x24f),'risk':'read','flags':[{'name':'type','type':a37_0x5b05a3(0x227),'required':!![],'enum':[a37_0x5b05a3(0x1f4),a37_0x5b05a3(0x1f2),a37_0x5b05a3(0x1fe)],'description':a37_0x5b05a3(0x224)},{'name':a37_0x5b05a3(0x21c),'type':a37_0x5b05a3(0x227),'required':!![],'description':a37_0x5b05a3(0x226)},{'name':a37_0x5b05a3(0x230),'type':a37_0x5b05a3(0x227),'description':a37_0x5b05a3(0x23d)},{'name':a37_0x5b05a3(0x242),'type':'string','description':a37_0x5b05a3(0x24c)},{'name':'datasetcode','type':a37_0x5b05a3(0x227),'description':a37_0x5b05a3(0x214)},{'name':a37_0x5b05a3(0x204),'type':a37_0x5b05a3(0x227),'description':a37_0x5b05a3(0x1f3)},{'name':a37_0x5b05a3(0x21d),'type':a37_0x5b05a3(0x227),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':['before',a37_0x5b05a3(0x234)]}],async 'validate'(_0x295ccb){const _0x18ceec=a37_0x5b05a3,_0x570949=_0x295ccb[_0x18ceec(0x218)](_0x18ceec(0x21c));if(!isValidBffFunctionName(_0x570949))throw CliErrors[_0x18ceec(0x243)](_0x18ceec(0x233)+_0x570949+_0x18ceec(0x251));},async 'execute'(_0x28eb57){const _0x277561=a37_0x5b05a3,_0x3357a3=loadBffProjectConfig(_0x28eb57[_0x277561(0x1fd)]),_0x20e24e=_0x28eb57['str'](_0x277561(0x1f6)),_0x35196b=_0x28eb57[_0x277561(0x218)](_0x277561(0x21c)),_0x2202a7=_0x28eb57[_0x277561(0x218)](_0x277561(0x230))||undefined,_0x12b59a=_0x20e24e===_0x277561(0x1fe)?await resolveHookOptions(_0x3357a3,_0x28eb57):undefined,_0x3bf5ff=buildFilePath(_0x3357a3,_0x20e24e,_0x35196b,_0x12b59a);if(await fileExists(_0x3bf5ff))throw CliErrors['validation'](_0x277561(0x20d)+_0x3bf5ff);await mkdir(dirname(_0x3bf5ff),{'recursive':!![]});const _0x26fb43=generateTemplate(_0x20e24e,_0x35196b,_0x28eb57[_0x277561(0x1fd)],_0x2202a7,_0x12b59a);await writeFile(_0x3bf5ff,_0x26fb43,'utf8');const _0x48ca00={'type':_0x20e24e,'name':_0x35196b,'path':_0x3bf5ff};if(_0x2202a7)_0x48ca00[_0x277561(0x230)]=_0x2202a7;if(_0x12b59a){if(_0x12b59a[_0x277561(0x242)])_0x48ca00[_0x277561(0x242)]=_0x12b59a[_0x277561(0x242)];_0x48ca00['datasetCode']=_0x12b59a[_0x277561(0x201)],_0x48ca00[_0x277561(0x22b)]=_0x12b59a['operationType'],_0x48ca00['functionNode']=_0x12b59a['functionNode'];}return{'ok':!![],'data':_0x48ca00,'message':_0x277561(0x244)+_0x20e24e+_0x277561(0x219)+_0x35196b};}};async function resolveHookOptions(_0x5b6eb0,_0x2fd256){const _0x27fe54=a37_0x5b05a3,_0x2f8f59=resolveApiModelSource(_0x2fd256[_0x27fe54(0x253)],_0x2fd256[_0x27fe54(0x1fd)],_0x2fd256['selectedAppName']||_0x2fd256['mergedCli']?.['currentApp']||_0x2fd256[_0x27fe54(0x239)]?.[_0x27fe54(0x24b)]),_0x3c3641=loadAliasMap(_0x2fd256['apiDir'],undefined,_0x2f8f59[_0x27fe54(0x247)],_0x2f8f59[_0x27fe54(0x24a)]),_0x32c22c=_0x3c3641[_0x27fe54(0x206)]>0x0;let _0x187290,_0x39b752,_0x1a1284;const _0xef1128=_0x2fd256[_0x27fe54(0x218)]('alias'),_0x1dd64b=_0x2fd256[_0x27fe54(0x218)](_0x27fe54(0x20e));if(_0xef1128){const _0x1e202c=resolveAlias(_0x2fd256[_0x27fe54(0x253)],_0xef1128,undefined,_0x2f8f59[_0x27fe54(0x247)],_0x2f8f59['profileName']);if(!_0x1e202c){const _0x538628=_0x32c22c?_0x27fe54(0x254)+_0x3c3641[_0x27fe54(0x22d)](_0x371f6f=>_0x371f6f['alias'])[_0x27fe54(0x211)](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors['validation'](_0x27fe54(0x207)+_0xef1128+_0x27fe54(0x23c)+_0x538628);}_0x187290=_0xef1128,_0x39b752=_0x1e202c;}else{if(_0x1dd64b){_0x39b752=_0x1dd64b;const _0x432ec7=_0x3c3641[_0x27fe54(0x1f5)](_0x2a8640=>_0x2a8640[_0x27fe54(0x201)]===_0x1dd64b);_0x187290=_0x432ec7?.[_0x27fe54(0x242)];}else{if(_0x2fd256[_0x27fe54(0x23b)])throw CliErrors['validation'](_0x27fe54(0x217));else{if(_0x32c22c){const _0xf70949=_0x3c3641['map'](_0x3ade99=>_0x3ade99['alias']+'\x20('+_0x3ade99[_0x27fe54(0x241)]+')'),_0x295083=await promptSelect(_0x27fe54(0x258),_0xf70949),_0x19c63b=_0x3c3641[_0x295083];if(!_0x19c63b)throw CliErrors[_0x27fe54(0x243)](_0x27fe54(0x23e));_0x187290=_0x19c63b[_0x27fe54(0x242)],_0x39b752=_0x19c63b['datasetCode'];}else{const _0x322be6=await listDatasets(_0x2fd256[_0x27fe54(0x1fd)]);if(_0x322be6[_0x27fe54(0x206)]===0x0)throw CliErrors[_0x27fe54(0x243)](_0x27fe54(0x237));const _0x46ad7a=_0x322be6['map'](_0x419e94=>_0x419e94['name']+'\x20['+(_0x419e94['source']??'UNKNOWN')+']\x20('+_0x419e94[_0x27fe54(0x246)]+')'),_0x40b094=await promptSelect(_0x27fe54(0x258),_0x46ad7a),_0xad72b8=_0x322be6[_0x40b094];if(!_0xad72b8)throw CliErrors[_0x27fe54(0x243)]('Invalid\x20dataset\x20selection.');_0x39b752=_0xad72b8[_0x27fe54(0x246)],_0x187290=undefined;}}}}const _0x251a65=await listDatasets(_0x2fd256[_0x27fe54(0x1fd)]),_0xd38edd=_0x251a65[_0x27fe54(0x1f5)](_0x1015f6=>_0x1015f6[_0x27fe54(0x246)]===_0x39b752);if(!_0xd38edd)throw CliErrors[_0x27fe54(0x243)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x39b752+_0x27fe54(0x216)+(_0x187290?_0x27fe54(0x220)+CLI_BIN_NAME+_0x27fe54(0x209):''));_0x1a1284=_0xd38edd['id'];const _0x4f403f=_0x187290??_0x39b752,_0x433dc6=await listBffDatasetOperations(_0x2fd256[_0x27fe54(0x1fd)],_0x1a1284),_0x3deddc=_0x433dc6?Object[_0x27fe54(0x257)](_0x433dc6):[];if(_0x3deddc[_0x27fe54(0x206)]===0x0)throw CliErrors[_0x27fe54(0x243)](_0x27fe54(0x22a)+_0x4f403f+'.');let _0x45c655;const _0x402a88=_0x2fd256[_0x27fe54(0x218)](_0x27fe54(0x204));if(_0x402a88){if(!_0x3deddc[_0x27fe54(0x20a)](_0x402a88))throw CliErrors[_0x27fe54(0x243)](_0x27fe54(0x1f8)+_0x402a88+_0x27fe54(0x1fc)+_0x4f403f+'.\x20'+('Available:\x20'+_0x3deddc[_0x27fe54(0x211)](',\x20')));_0x45c655=_0x402a88;}else{if(_0x2fd256[_0x27fe54(0x23b)])throw CliErrors[_0x27fe54(0x243)](_0x27fe54(0x1ee));const _0x33304a=await promptSelect(_0x27fe54(0x23f),_0x3deddc);_0x45c655=_0x3deddc[_0x33304a]??_0x3deddc[0x0];}let _0x159bbf=normalizeHookFunctionNode(_0x2fd256['str'](_0x27fe54(0x21d)));if(!_0x159bbf){if(_0x2fd256[_0x27fe54(0x218)]('function-node'))throw CliErrors[_0x27fe54(0x243)](_0x27fe54(0x24d));if(_0x2fd256[_0x27fe54(0x23b)])throw CliErrors[_0x27fe54(0x243)](_0x27fe54(0x1ed));const _0x2d3bb8=await promptSelect(_0x27fe54(0x1fb),[_0x27fe54(0x223),_0x27fe54(0x234)]);_0x159bbf=['before',_0x27fe54(0x234)][_0x2d3bb8]??_0x27fe54(0x223);}return{'alias':_0x187290,'datasetCode':_0x39b752,'datasetId':_0x1a1284,'operationType':_0x45c655,'functionNode':_0x159bbf};}async function promptSelect(_0x263515,_0x1b0914){const _0x4c3748=a37_0x5b05a3;if(_0x1b0914[_0x4c3748(0x206)]===0x1)return 0x0;for(const [_0x31cfc9,_0x3ada1e]of _0x1b0914[_0x4c3748(0x21a)]()){process['stderr'][_0x4c3748(0x232)]('\x20\x20'+(_0x31cfc9+0x1)+'.\x20'+_0x3ada1e+'\x0a');}const _0x2ea7ab=createInterface({'input':process[_0x4c3748(0x229)],'output':process['stderr']});while(!![]){const _0x7893a6=await new Promise(_0x15f1a8=>{const _0x2e2937=_0x4c3748;_0x2ea7ab[_0x2e2937(0x210)](_0x263515+'\x20',_0x15f1a8);}),_0x37c2cc=Number[_0x4c3748(0x200)](_0x7893a6['trim'](),0xa);if(Number[_0x4c3748(0x225)](_0x37c2cc)&&_0x37c2cc>=0x1&&_0x37c2cc<=_0x1b0914['length'])return _0x2ea7ab[_0x4c3748(0x1f7)](),_0x37c2cc-0x1;process[_0x4c3748(0x231)][_0x4c3748(0x232)](_0x4c3748(0x1f1)+_0x1b0914[_0x4c3748(0x206)]+'.\x0a');}}function a37_0xeae6(){const _0x432058=['\x22.\x20','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','str','\x20function:\x20','entries','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','name','function-node','1214562UEtOwe','370YdJnsV','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','62613knhsks','before','Script\x20type','isInteger','Function\x20name\x20(valid\x20JS\x20identifier)','string','当前响应结果','stdin','No\x20operation\x20types\x20found\x20for\x20dataset\x20','operationType','create','map','functionNode','当前请求参数','description','stderr','write','Invalid\x20function\x20name\x20\x22','after','修改后的请求参数','/ENDPOINT/','No\x20datasets\x20found\x20for\x20this\x20app.','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','mergedCli','.js\x0a\x20*\x20[触发节点]\x20','nonInteractive','\x22\x20not\x20found.\x20','Script\x20description','Invalid\x20dataset\x20selection.','Select\x20operation\x20type:','\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','tableName','alias','validation','Created\x20','14624709iDTFqK','code','filePath','4293384mishHw','\x0a\x20*\x20[平台配置]\x20','profileName','defaultApp','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','806862TPZtLl','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','15fqpoqk','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','\x22,\x20params\x20})\x0a','apiDir','Available\x20aliases:\x20','/**\x0a\x20*\x20','105gFUsas','keys','Select\x20dataset:','/HOOK/','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','2393755zdZiqH','修改后的响应结果','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','ENDPOINT','Operation\x20type\x20(HOOK\x20only)','COMMON','find','type','close','Operation\x20type\x20\x22','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','.js','Select\x20trigger\x20node:','\x22\x20not\x20found\x20for\x20dataset\x20','appCode','HOOK','43048DRnohf','parseInt','datasetCode','1WAjwaH','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','operation-type','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','length','Alias\x20\x22','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x20api\x20pull`\x20to\x20refresh.','includes','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','File\x20already\x20exists:\x20','datasetcode','/data/dataset/','question','join','bff','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','scriptsRootDir'];a37_0xeae6=function(){return _0x432058;};return a37_0xeae6();}function a37_0x4cff(_0x2dc9d7,_0x492859){_0x2dc9d7=_0x2dc9d7-0x1ed;const _0xeae6a4=a37_0xeae6();let _0x4cffa2=_0xeae6a4[_0x2dc9d7];return _0x4cffa2;}function buildFilePath(_0x2e5285,_0x20dc11,_0x159ec3,_0x327992){const _0x3cd8fd=a37_0x5b05a3;if(_0x20dc11==='HOOK'){if(!_0x327992)throw CliErrors[_0x3cd8fd(0x243)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x41669f=_0x327992['alias']??_0x327992[_0x3cd8fd(0x201)];return join(_0x2e5285[_0x3cd8fd(0x215)],_0x3cd8fd(0x1fe),_0x41669f,_0x327992['operationType'],_0x327992[_0x3cd8fd(0x22e)],_0x159ec3+_0x3cd8fd(0x1fa));}return join(_0x2e5285[_0x3cd8fd(0x215)],_0x20dc11,_0x159ec3+_0x3cd8fd(0x1fa));}export function generateTemplate(_0xe6557a,_0x377bf0,_0x2d1c1e,_0x249a6d,_0x2319a2){const _0x222b76=a37_0x5b05a3,_0x5255a1=_0x249a6d?.['trim']()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x4d08b8=getAppBaseUrl(_0x2d1c1e),_0x28adbb='\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)';if(_0xe6557a===_0x222b76(0x1f4))return _0x222b76(0x255)+_0x5255a1+_0x222b76(0x1f9)+_0x377bf0+'\x0a\x20*\x20[平台配置]\x20'+_0x4d08b8+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x2d1c1e+'/COMMON/'+_0x377bf0+_0x222b76(0x20c)+_0x377bf0+_0x222b76(0x252)+_0x28adbb+_0x222b76(0x240)+_0x377bf0+_0x222b76(0x21b);if(_0xe6557a===_0x222b76(0x1f2))return _0x222b76(0x255)+_0x5255a1+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x377bf0+_0x222b76(0x203)+_0x2d1c1e+'/'+_0x377bf0+_0x222b76(0x249)+_0x4d08b8+_0x222b76(0x20b)+_0x2d1c1e+_0x222b76(0x236)+_0x377bf0+'.js\x0a'+_0x28adbb+'\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'+_0x377bf0+_0x222b76(0x21b);if(!_0x2319a2)throw CliErrors[_0x222b76(0x243)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x2515eb=_0x2319a2[_0x222b76(0x242)]??_0x2319a2[_0x222b76(0x201)],_0x2adcb7=_0x2319a2[_0x222b76(0x22e)]===_0x222b76(0x223)?_0x222b76(0x22f):_0x222b76(0x228),_0x249f1b=_0x2319a2[_0x222b76(0x22e)]===_0x222b76(0x223)?_0x222b76(0x235):_0x222b76(0x1f0);return _0x222b76(0x255)+_0x5255a1+_0x222b76(0x213)+_0x377bf0+_0x222b76(0x208)+_0x2d1c1e+'/'+_0x2319a2[_0x222b76(0x201)]+'/'+_0x2319a2[_0x222b76(0x22b)]+_0x222b76(0x249)+_0x4d08b8+_0x222b76(0x20f)+_0x2319a2['datasetId']+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x2d1c1e+_0x222b76(0x259)+_0x2515eb+'/'+_0x2319a2[_0x222b76(0x22b)]+'/'+_0x2319a2['functionNode']+'/'+_0x377bf0+_0x222b76(0x23a)+_0x2319a2[_0x222b76(0x22e)]+'\x0a'+_0x28adbb+_0x222b76(0x238)+_0x2adcb7+_0x222b76(0x221)+_0x249f1b+_0x222b76(0x205)+_0x377bf0+_0x222b76(0x21b);}
|
|
1
|
+
const a37_0x3f9438=a37_0x5388;(function(_0x34151e,_0x26bc2f){const _0x5a161f=a37_0x5388,_0x3add4b=_0x34151e();while(!![]){try{const _0x14a1eb=-parseInt(_0x5a161f(0x183))/0x1+-parseInt(_0x5a161f(0x15b))/0x2*(-parseInt(_0x5a161f(0x163))/0x3)+parseInt(_0x5a161f(0x17b))/0x4+-parseInt(_0x5a161f(0x191))/0x5+-parseInt(_0x5a161f(0x151))/0x6*(parseInt(_0x5a161f(0x1ab))/0x7)+-parseInt(_0x5a161f(0x185))/0x8*(parseInt(_0x5a161f(0x169))/0x9)+parseInt(_0x5a161f(0x19f))/0xa;if(_0x14a1eb===_0x26bc2f)break;else _0x3add4b['push'](_0x3add4b['shift']());}catch(_0x16ae2d){_0x3add4b['push'](_0x3add4b['shift']());}}}(a37_0x285c,0x2529d));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x285c(){const _0xa9b568=['.js','688SmmBuh','\x20api\x20pull`\x20to\x20refresh.','validation','find','read','description','str','keys','datasetCode','ENDPOINT','Available\x20aliases:\x20','datasetId','45180MKLOkL','alias','operationType','name','nonInteractive','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','修改后的响应结果','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','HOOK','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','scriptsRootDir','Trigger\x20node\x20(HOOK\x20only)','No\x20model\x20aliases\x20found.\x20Run\x20`','6267000srhPft','question','operation-type','HOOK\x20requires\x20alias/operation/node\x20options.','datasetcode','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','currentApp','mergedCli','close','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','apiDir','/HOOK/','256179jYFyqK','after','includes','Select\x20trigger\x20node:','No\x20operation\x20types\x20found\x20for\x20dataset\x20','Function\x20name\x20(valid\x20JS\x20identifier)','before',']\x20(','stderr','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','当前请求参数','\x22\x20not\x20found\x20for\x20dataset\x20','/ENDPOINT/','Created\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','selectedAppName','42gOMmIk','\x0a\x20*\x20[平台配置]\x20','/**\x0a\x20*\x20','UNKNOWN','utf8','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','Available:\x20','Invalid\x20dataset\x20selection.','/COMMON/','filePath','2ketYQQ','map','bff','Dataset\x20not\x20found\x20for\x20code\x20\x22','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','\x20function:\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','code','492171ImLWEQ','当前响应结果','/data/dataset/','string','Operation\x20type\x20\x22','Select\x20operation\x20type:','27819CtuXjT','Select\x20dataset:','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','profileName','type','\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','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','trim','write','appCode','Script\x20description','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','join','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','isInteger','Alias\x20\x22','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','functionNode','258640VWNBXE','\x22,\x20params\x20})\x0a','defaultApp','No\x20datasets\x20found\x20for\x20this\x20app.','COMMON','length','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','parseInt','172155yxRckm'];a37_0x285c=function(){return _0xa9b568;};return a37_0x285c();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x5388(_0x2ee6f6,_0x23bb94){_0x2ee6f6=_0x2ee6f6-0x148;const _0x285c83=a37_0x285c();let _0x53880a=_0x285c83[_0x2ee6f6];return _0x53880a;}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x3f9438(0x15d),'command':'create','description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0x3f9438(0x189),'flags':[{'name':a37_0x3f9438(0x16d),'type':a37_0x3f9438(0x166),'required':!![],'enum':[a37_0x3f9438(0x17f),'ENDPOINT',a37_0x3f9438(0x19a)],'description':'Script\x20type'},{'name':a37_0x3f9438(0x194),'type':a37_0x3f9438(0x166),'required':!![],'description':a37_0x3f9438(0x1b0)},{'name':a37_0x3f9438(0x18a),'type':'string','description':a37_0x3f9438(0x173)},{'name':a37_0x3f9438(0x192),'type':a37_0x3f9438(0x166),'description':a37_0x3f9438(0x15f)},{'name':a37_0x3f9438(0x1a3),'type':a37_0x3f9438(0x166),'description':a37_0x3f9438(0x156)},{'name':a37_0x3f9438(0x1a1),'type':'string','description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a37_0x3f9438(0x166),'description':a37_0x3f9438(0x19d),'enum':['before','after']}],async 'validate'(_0x48ddf1){const _0x188dcb=a37_0x3f9438,_0x5d2f69=_0x48ddf1[_0x188dcb(0x18b)](_0x188dcb(0x194));if(!isValidBffFunctionName(_0x5d2f69))throw CliErrors[_0x188dcb(0x187)]('Invalid\x20function\x20name\x20\x22'+_0x5d2f69+_0x188dcb(0x161));},async 'execute'(_0x42ee45){const _0xb32715=a37_0x3f9438,_0x380afe=loadBffProjectConfig(_0x42ee45['appCode']),_0x515349=_0x42ee45[_0xb32715(0x18b)](_0xb32715(0x16d)),_0x16c02f=_0x42ee45[_0xb32715(0x18b)](_0xb32715(0x194)),_0x29d247=_0x42ee45['str'](_0xb32715(0x18a))||undefined,_0x1cb902=_0x515349===_0xb32715(0x19a)?await resolveHookOptions(_0x380afe,_0x42ee45):undefined,_0x4b9435=buildFilePath(_0x380afe,_0x515349,_0x16c02f,_0x1cb902);if(await fileExists(_0x4b9435))throw CliErrors[_0xb32715(0x187)]('File\x20already\x20exists:\x20'+_0x4b9435);await mkdir(dirname(_0x4b9435),{'recursive':!![]});const _0x3f7749=generateTemplate(_0x515349,_0x16c02f,_0x42ee45[_0xb32715(0x172)],_0x29d247,_0x1cb902);await writeFile(_0x4b9435,_0x3f7749,_0xb32715(0x155));const _0x2d301d={'type':_0x515349,'name':_0x16c02f,'path':_0x4b9435};if(_0x29d247)_0x2d301d[_0xb32715(0x18a)]=_0x29d247;if(_0x1cb902){if(_0x1cb902[_0xb32715(0x192)])_0x2d301d[_0xb32715(0x192)]=_0x1cb902[_0xb32715(0x192)];_0x2d301d[_0xb32715(0x18d)]=_0x1cb902[_0xb32715(0x18d)],_0x2d301d[_0xb32715(0x193)]=_0x1cb902['operationType'],_0x2d301d[_0xb32715(0x17a)]=_0x1cb902['functionNode'];}return{'ok':!![],'data':_0x2d301d,'message':_0xb32715(0x14d)+_0x515349+_0xb32715(0x160)+_0x16c02f};}};async function resolveHookOptions(_0x5087bb,_0x4cb988){const _0x3311fd=a37_0x3f9438,_0x2c34fd=resolveApiModelSource(_0x4cb988[_0x3311fd(0x1a9)],_0x4cb988[_0x3311fd(0x172)],_0x4cb988[_0x3311fd(0x150)]||_0x4cb988[_0x3311fd(0x1a6)]?.[_0x3311fd(0x1a5)]||_0x4cb988[_0x3311fd(0x1a6)]?.[_0x3311fd(0x17d)]),_0x6cbdc7=loadAliasMap(_0x4cb988['apiDir'],undefined,_0x2c34fd[_0x3311fd(0x15a)],_0x2c34fd[_0x3311fd(0x16c)]),_0x2768e2=_0x6cbdc7['length']>0x0;let _0x517a9d,_0x2bd758,_0x4977f0;const _0x5ca964=_0x4cb988[_0x3311fd(0x18b)](_0x3311fd(0x192)),_0x51d61b=_0x4cb988[_0x3311fd(0x18b)](_0x3311fd(0x1a3));if(_0x5ca964){const _0x75d36c=resolveAlias(_0x4cb988[_0x3311fd(0x1a9)],_0x5ca964,undefined,_0x2c34fd[_0x3311fd(0x15a)],_0x2c34fd[_0x3311fd(0x16c)]);if(!_0x75d36c){const _0x4bdfe6=_0x2768e2?_0x3311fd(0x18f)+_0x6cbdc7[_0x3311fd(0x15c)](_0x421705=>_0x421705[_0x3311fd(0x192)])['join'](',\x20'):_0x3311fd(0x19e)+CLI_BIN_NAME+_0x3311fd(0x16f);throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x178)+_0x5ca964+'\x22\x20not\x20found.\x20'+_0x4bdfe6);}_0x517a9d=_0x5ca964,_0x2bd758=_0x75d36c;}else{if(_0x51d61b){_0x2bd758=_0x51d61b;const _0x49a0a4=_0x6cbdc7['find'](_0x5937d3=>_0x5937d3[_0x3311fd(0x18d)]===_0x51d61b);_0x517a9d=_0x49a0a4?.[_0x3311fd(0x192)];}else{if(_0x4cb988[_0x3311fd(0x195)])throw CliErrors[_0x3311fd(0x187)]('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x2768e2){const _0x50a775=_0x6cbdc7[_0x3311fd(0x15c)](_0x5a79ec=>_0x5a79ec[_0x3311fd(0x192)]+'\x20('+_0x5a79ec['tableName']+')'),_0x1e4a5f=await promptSelect(_0x3311fd(0x16a),_0x50a775),_0x20169b=_0x6cbdc7[_0x1e4a5f];if(!_0x20169b)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x158));_0x517a9d=_0x20169b['alias'],_0x2bd758=_0x20169b[_0x3311fd(0x18d)];}else{const _0x13be40=await listDatasets(_0x4cb988[_0x3311fd(0x172)]);if(_0x13be40[_0x3311fd(0x180)]===0x0)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x17e));const _0x5adc12=_0x13be40['map'](_0x2f4d08=>_0x2f4d08[_0x3311fd(0x194)]+'\x20['+(_0x2f4d08['source']??_0x3311fd(0x154))+_0x3311fd(0x1b2)+_0x2f4d08[_0x3311fd(0x162)]+')'),_0x489c1f=await promptSelect(_0x3311fd(0x16a),_0x5adc12),_0x5ec956=_0x13be40[_0x489c1f];if(!_0x5ec956)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x158));_0x2bd758=_0x5ec956[_0x3311fd(0x162)],_0x517a9d=undefined;}}}}const _0x16cc5b=await listDatasets(_0x4cb988[_0x3311fd(0x172)]),_0x2d6764=_0x16cc5b[_0x3311fd(0x188)](_0x333faf=>_0x333faf[_0x3311fd(0x162)]===_0x2bd758);if(!_0x2d6764)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x15e)+_0x2bd758+'\x22.\x20'+(_0x517a9d?_0x3311fd(0x197)+CLI_BIN_NAME+_0x3311fd(0x186):''));_0x4977f0=_0x2d6764['id'];const _0x5e2c4d=_0x517a9d??_0x2bd758,_0x18afe3=await listBffDatasetOperations(_0x4cb988['appCode'],_0x4977f0),_0xf3e4a0=_0x18afe3?Object[_0x3311fd(0x18c)](_0x18afe3):[];if(_0xf3e4a0[_0x3311fd(0x180)]===0x0)throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x1af)+_0x5e2c4d+'.');let _0x49bcc;const _0x4810db=_0x4cb988[_0x3311fd(0x18b)](_0x3311fd(0x1a1));if(_0x4810db){if(!_0xf3e4a0[_0x3311fd(0x1ad)](_0x4810db))throw CliErrors['validation'](_0x3311fd(0x167)+_0x4810db+_0x3311fd(0x14b)+_0x5e2c4d+'.\x20'+(_0x3311fd(0x157)+_0xf3e4a0[_0x3311fd(0x175)](',\x20')));_0x49bcc=_0x4810db;}else{if(_0x4cb988[_0x3311fd(0x195)])throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x199));const _0xca6cc8=await promptSelect(_0x3311fd(0x168),_0xf3e4a0);_0x49bcc=_0xf3e4a0[_0xca6cc8]??_0xf3e4a0[0x0];}let _0x2deff3=normalizeHookFunctionNode(_0x4cb988['str']('function-node'));if(!_0x2deff3){if(_0x4cb988[_0x3311fd(0x18b)]('function-node'))throw CliErrors[_0x3311fd(0x187)](_0x3311fd(0x1a4));if(_0x4cb988[_0x3311fd(0x195)])throw CliErrors[_0x3311fd(0x187)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x48579d=await promptSelect(_0x3311fd(0x1ae),[_0x3311fd(0x1b1),_0x3311fd(0x1ac)]);_0x2deff3=[_0x3311fd(0x1b1),_0x3311fd(0x1ac)][_0x48579d]??_0x3311fd(0x1b1);}return{'alias':_0x517a9d,'datasetCode':_0x2bd758,'datasetId':_0x4977f0,'operationType':_0x49bcc,'functionNode':_0x2deff3};}async function promptSelect(_0x39e9e3,_0x19cb26){const _0x2e8e1e=a37_0x3f9438;if(_0x19cb26[_0x2e8e1e(0x180)]===0x1)return 0x0;for(const [_0x5c16d6,_0x53fd62]of _0x19cb26['entries']()){process[_0x2e8e1e(0x148)][_0x2e8e1e(0x171)]('\x20\x20'+(_0x5c16d6+0x1)+'.\x20'+_0x53fd62+'\x0a');}const _0x3b1366=createInterface({'input':process['stdin'],'output':process[_0x2e8e1e(0x148)]});while(!![]){const _0x35ef32=await new Promise(_0x4d99f0=>{const _0x42d081=_0x2e8e1e;_0x3b1366[_0x42d081(0x1a0)](_0x39e9e3+'\x20',_0x4d99f0);}),_0x30fe54=Number[_0x2e8e1e(0x182)](_0x35ef32[_0x2e8e1e(0x170)](),0xa);if(Number[_0x2e8e1e(0x177)](_0x30fe54)&&_0x30fe54>=0x1&&_0x30fe54<=_0x19cb26[_0x2e8e1e(0x180)])return _0x3b1366[_0x2e8e1e(0x1a7)](),_0x30fe54-0x1;process[_0x2e8e1e(0x148)][_0x2e8e1e(0x171)](_0x2e8e1e(0x16b)+_0x19cb26['length']+'.\x0a');}}function buildFilePath(_0x346c92,_0x77fca6,_0x58fc03,_0x30440b){const _0x1ab8fc=a37_0x3f9438;if(_0x77fca6===_0x1ab8fc(0x19a)){if(!_0x30440b)throw CliErrors[_0x1ab8fc(0x187)](_0x1ab8fc(0x1a2));const _0x4bd751=_0x30440b[_0x1ab8fc(0x192)]??_0x30440b[_0x1ab8fc(0x18d)];return join(_0x346c92[_0x1ab8fc(0x19c)],_0x1ab8fc(0x19a),_0x4bd751,_0x30440b[_0x1ab8fc(0x193)],_0x30440b[_0x1ab8fc(0x17a)],_0x58fc03+_0x1ab8fc(0x184));}return join(_0x346c92[_0x1ab8fc(0x19c)],_0x77fca6,_0x58fc03+_0x1ab8fc(0x184));}export function generateTemplate(_0xc9d33f,_0x21f053,_0x50d2de,_0x130078,_0x549055){const _0x359d41=a37_0x3f9438,_0x591b2c=_0x130078?.[_0x359d41(0x170)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3213af=getAppBaseUrl(_0x50d2de),_0x37124d=_0x359d41(0x176);if(_0xc9d33f===_0x359d41(0x17f))return'/**\x0a\x20*\x20'+_0x591b2c+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x21f053+_0x359d41(0x152)+_0x3213af+_0x359d41(0x14e)+_0x50d2de+_0x359d41(0x159)+_0x21f053+_0x359d41(0x179)+_0x21f053+_0x359d41(0x17c)+_0x37124d+_0x359d41(0x16e)+_0x21f053+_0x359d41(0x196);if(_0xc9d33f===_0x359d41(0x18e))return _0x359d41(0x153)+_0x591b2c+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x21f053+_0x359d41(0x14f)+_0x50d2de+'/'+_0x21f053+'\x0a\x20*\x20[平台配置]\x20'+_0x3213af+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x50d2de+_0x359d41(0x14c)+_0x21f053+'.js\x0a'+_0x37124d+'\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'+_0x21f053+_0x359d41(0x196);if(!_0x549055)throw CliErrors['validation'](_0x359d41(0x174));const _0x12cb3b=_0x549055['alias']??_0x549055[_0x359d41(0x18d)],_0x407753=_0x549055[_0x359d41(0x17a)]===_0x359d41(0x1b1)?_0x359d41(0x14a):_0x359d41(0x164),_0x53288a=_0x549055[_0x359d41(0x17a)]===_0x359d41(0x1b1)?'修改后的请求参数':_0x359d41(0x198);return _0x359d41(0x153)+_0x591b2c+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x21f053+_0x359d41(0x181)+_0x50d2de+'/'+_0x549055[_0x359d41(0x18d)]+'/'+_0x549055[_0x359d41(0x193)]+_0x359d41(0x152)+_0x3213af+_0x359d41(0x165)+_0x549055[_0x359d41(0x190)]+_0x359d41(0x149)+_0x50d2de+_0x359d41(0x1aa)+_0x12cb3b+'/'+_0x549055[_0x359d41(0x193)]+'/'+_0x549055[_0x359d41(0x17a)]+'/'+_0x21f053+'.js\x0a\x20*\x20[触发节点]\x20'+_0x549055[_0x359d41(0x17a)]+'\x0a'+_0x37124d+_0x359d41(0x19b)+_0x407753+_0x359d41(0x1a8)+_0x53288a+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x21f053+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x5b005f=a38_0x85dd;(function(_0x4f8b10,_0x5b3965){const _0x4ed2fb=a38_0x85dd,_0x4dbc1e=_0x4f8b10();while(!![]){try{const _0xead74c=-parseInt(_0x4ed2fb(0x1c4))/0x1+-parseInt(_0x4ed2fb(0x1d5))/0x2+-parseInt(_0x4ed2fb(0x1d1))/0x3*(parseInt(_0x4ed2fb(0x1bb))/0x4)+parseInt(_0x4ed2fb(0x1bc))/0x5*(parseInt(_0x4ed2fb(0x1ce))/0x6)+-parseInt(_0x4ed2fb(0x1c0))/0x7*(parseInt(_0x4ed2fb(0x1b9))/0x8)+parseInt(_0x4ed2fb(0x1c6))/0x9+parseInt(_0x4ed2fb(0x1c3))/0xa*(parseInt(_0x4ed2fb(0x1c7))/0xb);if(_0xead74c===_0x5b3965)break;else _0x4dbc1e['push'](_0x4dbc1e['shift']());}catch(_0x447d03){_0x4dbc1e['push'](_0x4dbc1e['shift']());}}}(a38_0x3a58,0x5a512));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a38_0x85dd(_0x54ac14,_0xd50f10){_0x54ac14=_0x54ac14-0x1ad;const _0x3a588a=a38_0x3a58();let _0x85ddd0=_0x3a588a[_0x54ac14];return _0x85ddd0;}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x5b005f(0x1ca),'command':a38_0x5b005f(0x1af),'description':a38_0x5b005f(0x1ba),'risk':'high-risk-write','flags':[{'name':'target','type':'string','required':!![],'description':a38_0x5b005f(0x1ad)}],async 'validate'(_0xb6ec46){const _0xb30b98=a38_0x5b005f,_0x3834f4=loadBffProjectConfig(_0xb6ec46['appCode']),_0x1d67be=await readBffLockFile(_0x3834f4['lockFilePath']);if(!_0x1d67be)throw CliErrors[_0xb30b98(0x1cc)](_0xb30b98(0x1da));},async 'dryRun'(_0xbd62da){const _0x54330c=a38_0x5b005f,_0x7ad9b=loadBffProjectConfig(_0xbd62da['appCode']),_0x2a6551=await readBffLockFile(_0x7ad9b[_0x54330c(0x1d4)]);if(!_0x2a6551)throw CliErrors[_0x54330c(0x1cc)](_0x54330c(0x1d6));const {appLock:_0x334c94}=ensureLockScope(_0x2a6551,_0xbd62da[_0x54330c(0x1b2)],_0x7ad9b['scriptsRoot'],_0x54330c(0x1af)),_0x50ee66=_0xbd62da[_0x54330c(0x1d3)](_0x54330c(0x1be)),_0x1f7b74=Object['keys'](_0x334c94['functions']),_0x231329=resolveDeleteTarget(_0x50ee66,_0x1f7b74),_0x2ff413=_0x334c94[_0x54330c(0x1cf)][_0x231329];if(!_0x2ff413)throw CliErrors[_0x54330c(0x1cc)]('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x231329+'\x22.');const _0x30875d=resolveLocalFilePathFromLockKey(_0x7ad9b,_0x231329),_0x59d186=relative(_0x7ad9b[_0x54330c(0x1b8)],_0x30875d),_0x14d6e1=join(_0x7ad9b[_0x54330c(0x1cd)],'<timestamp>',_0x59d186);return{'method':'POST','url':_0x54330c(0x1c5),'body':{'appCode':_0xbd62da['appCode'],'target':_0x231329,'remoteId':_0x2ff413[_0x54330c(0x1ae)],'localFilePath':_0x30875d,'trashedPath':_0x14d6e1},'description':_0x54330c(0x1b5)+_0x231329+_0x54330c(0x1bd)};},async 'execute'(_0x234f53){const _0x53b99e=a38_0x5b005f,_0x4db2a1=loadBffProjectConfig(_0x234f53[_0x53b99e(0x1b2)]),_0x46efe9=await readBffLockFile(_0x4db2a1[_0x53b99e(0x1d4)]);if(!_0x46efe9)throw CliErrors[_0x53b99e(0x1cc)](_0x53b99e(0x1d6));const {lockData:_0x2c1348,appLock:_0x22eed4}=ensureLockScope(_0x46efe9,_0x234f53[_0x53b99e(0x1b2)],_0x4db2a1[_0x53b99e(0x1b6)],_0x53b99e(0x1af)),_0x13e089=JSON[_0x53b99e(0x1c9)](JSON['stringify'](_0x2c1348)),_0x537199=_0x13e089['apps'][_0x234f53[_0x53b99e(0x1b2)]];if(!_0x537199)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x234f53[_0x53b99e(0x1b2)]+_0x53b99e(0x1d9));const _0x3bab51=_0x234f53['str'](_0x53b99e(0x1be)),_0x5a831d=Object[_0x53b99e(0x1b7)](_0x537199['functions']),_0x46c952=resolveDeleteTarget(_0x3bab51,_0x5a831d),_0x2bebdc=_0x537199[_0x53b99e(0x1cf)][_0x46c952];if(!_0x2bebdc)throw CliErrors[_0x53b99e(0x1cc)](_0x53b99e(0x1cb)+_0x46c952+'\x22.');await deleteBffScript(_0x2bebdc[_0x53b99e(0x1ae)]),delete _0x537199[_0x53b99e(0x1cf)][_0x46c952],_0x537199[_0x53b99e(0x1d2)]=new Date()[_0x53b99e(0x1bf)](),await writeBffLockFile(_0x4db2a1[_0x53b99e(0x1d4)],_0x13e089);const _0x1225a7=resolveLocalFilePathFromLockKey(_0x4db2a1,_0x46c952);let _0x1f98bf;await fileExists(_0x1225a7)&&(_0x1f98bf=await moveToTrash(_0x4db2a1[_0x53b99e(0x1b8)],_0x4db2a1[_0x53b99e(0x1cd)],_0x1225a7),await cleanupEmptyDirectories(dirname(_0x1225a7),_0x4db2a1[_0x53b99e(0x1d7)]));await waitForDeleteSettlement(_0x4db2a1[_0x53b99e(0x1d4)],_0x234f53[_0x53b99e(0x1b2)],_0x46c952,_0x1225a7),await sleep(0x96);const _0x61522b={'deleted':_0x46c952,'remoteId':_0x2bebdc[_0x53b99e(0x1ae)]};if(_0x1f98bf)_0x61522b[_0x53b99e(0x1b0)]=_0x1f98bf;return{'ok':!![],'data':_0x61522b,'message':'Deleted\x20'+_0x46c952+(_0x1f98bf?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x4459c3,_0x5cc52d){const _0x4950fc=a38_0x5b005f;if(_0x4459c3[_0x4950fc(0x1c1)]('/')){const _0xeb008f=_0x5cc52d['find'](_0x27c0c7=>_0x27c0c7===_0x4459c3);if(!_0xeb008f)throw CliErrors['validation'](_0x4950fc(0x1d0)+_0x4459c3);return _0xeb008f;}const _0x5a2b7d=_0x5cc52d[_0x4950fc(0x1b1)](_0x4c9cce=>_0x4c9cce['split']('/')['at'](-0x1)===_0x4459c3);if(_0x5a2b7d[_0x4950fc(0x1db)]===0x0)throw CliErrors[_0x4950fc(0x1cc)](_0x4950fc(0x1d0)+_0x4459c3);if(_0x5a2b7d[_0x4950fc(0x1db)]>0x1)throw CliErrors[_0x4950fc(0x1cc)](_0x4950fc(0x1d8)+_0x4459c3+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x5a2b7d[_0x4950fc(0x1b3)](_0x59002f=>'\x20\x20-\x20'+_0x59002f)['join']('\x0a'));return _0x5a2b7d[0x0];}async function moveToTrash(_0x8fde12,_0x2cdea7,_0x1ed27f){const _0x20450f=a38_0x5b005f,_0x4a94d4=new Date()[_0x20450f(0x1bf)]()[_0x20450f(0x1c2)](/[:.]/g,'-'),_0x1aa5e3=relative(_0x8fde12,_0x1ed27f),_0x3e53c1=join(_0x2cdea7,_0x4a94d4,_0x1aa5e3);return await mkdir(dirname(_0x3e53c1),{'recursive':!![]}),await rename(_0x1ed27f,_0x3e53c1),_0x3e53c1;}async function cleanupEmptyDirectories(_0x119d2e,_0x4fcd7a){const _0x33cfdf=a38_0x5b005f;let _0x13c17c=resolve(_0x119d2e);const _0x10e1de=resolve(_0x4fcd7a);while(_0x13c17c['startsWith'](''+_0x10e1de+sep)||_0x13c17c===_0x10e1de){if(_0x13c17c===_0x10e1de)return;try{const _0x5a9d3e=await readdir(_0x13c17c);if(_0x5a9d3e[_0x33cfdf(0x1db)]>0x0)return;await rmdir(_0x13c17c);}catch{return;}_0x13c17c=dirname(_0x13c17c);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;function a38_0x3a58(){const _0x589b09=['Local\x20delete\x20not\x20settled\x20for\x20','parse','bff','No\x20lock\x20entry\x20found\x20for\x20\x22','validation','trashDir','3647778xXskKH','functions','Function\x20not\x20found:\x20','1431666PjaHPX','lastSync','str','lockFilePath','962150EgMGAS','Backend\x20Function\x20lock\x20file\x20not\x20found.','scriptsRootDir','Multiple\x20functions\x20match\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','length','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','remoteId','delete','trashedTo','filter','appCode','map','apps','Would\x20delete\x20','scriptsRoot','keys','projectRoot','244088VUGWNC','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','4wFkIXt','5cMFwby','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','target','toISOString','98ekhNiq','includes','replace','620ZKhiHj','676908KoRnkU','/api/management/library/scripts/delete','3876840HoIEfn','247247HtZhzi'];a38_0x3a58=function(){return _0x589b09;};return a38_0x3a58();}async function waitForDeleteSettlement(_0x1394f0,_0x3ee9ca,_0x5e9a50,_0xcd630f){const _0x4b206d=a38_0x5b005f;for(let _0x4252b9=0x0;_0x4252b9<DELETE_SETTLE_RETRY_COUNT;_0x4252b9+=0x1){const _0x1a0092=await readBffLockFile(_0x1394f0),_0x3584d=!!_0x1a0092?.[_0x4b206d(0x1b4)]?.[_0x3ee9ca]?.[_0x4b206d(0x1cf)]?.[_0x5e9a50],_0x4e5969=await fileExists(_0xcd630f);if(!_0x3584d&&!_0x4e5969)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x4b206d(0x1c8)+_0x5e9a50+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x11f614=a39_0x257f;function a39_0x46af(){const _0x29a7db=['appCode','verbose','number','scriptType','boolean','32570vCuYGW','2PUruoa','read','version','functionName','238255IjWZUm','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','1602209LyevZO','230Vnpkwo','3208IAwhWp','4dLEGlE','108Bfvotk','Return\x20full\x20raw\x20script\x20object','377lqXDIk','46908AQYEQR','detail','465306YcwwIE','description','num','(none)','539xbpDLm','createdTime','3924MBJape'];a39_0x46af=function(){return _0x29a7db;};return a39_0x46af();}function a39_0x257f(_0x2328eb,_0x2d9c95){_0x2328eb=_0x2328eb-0xe7;const _0x46af60=a39_0x46af();let _0x257f2f=_0x46af60[_0x2328eb];return _0x257f2f;}(function(_0x80ab0,_0x4bb659){const _0x344c4e=a39_0x257f,_0x5efdad=_0x80ab0();while(!![]){try{const _0x37a0ed=-parseInt(_0x344c4e(0xfe))/0x1*(parseInt(_0x344c4e(0xfa))/0x2)+-parseInt(_0x344c4e(0xed))/0x3*(parseInt(_0x344c4e(0xe7))/0x4)+parseInt(_0x344c4e(0x101))/0x5*(parseInt(_0x344c4e(0xeb))/0x6)+parseInt(_0x344c4e(0x100))/0x7+parseInt(_0x344c4e(0x102))/0x8*(parseInt(_0x344c4e(0xf3))/0x9)+-parseInt(_0x344c4e(0xf9))/0xa*(parseInt(_0x344c4e(0xf1))/0xb)+-parseInt(_0x344c4e(0xe8))/0xc*(parseInt(_0x344c4e(0xea))/0xd);if(_0x37a0ed===_0x4bb659)break;else _0x5efdad['push'](_0x5efdad['shift']());}catch(_0x4b0ac2){_0x5efdad['push'](_0x5efdad['shift']());}}}(a39_0x46af,0x334dc));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':a39_0x11f614(0xec),'description':a39_0x11f614(0xff),'risk':a39_0x11f614(0xfb),'flags':[{'name':'id','type':a39_0x11f614(0xf6),'required':!![],'description':'Script\x20ID'},{'name':a39_0x11f614(0xf5),'type':a39_0x11f614(0xf8),'description':a39_0x11f614(0xe9)}],async 'execute'(_0x35f665){const _0x5041ce=a39_0x11f614,_0x39f5dd=await getBffScriptInfo(_0x35f665[_0x5041ce(0xef)]('id')),_0x4f4c7b=_0x35f665['bool']('verbose');if(_0x4f4c7b)return{'ok':!![],'data':_0x39f5dd};return{'ok':!![],'data':{'id':_0x39f5dd['id'],'functionName':_0x39f5dd[_0x5041ce(0xfd)]??'','version':_0x39f5dd[_0x5041ce(0xfc)]??'','updateUserName':_0x39f5dd['updateUserName']??'','appCode':_0x39f5dd[_0x5041ce(0xf4)],'scriptType':_0x39f5dd[_0x5041ce(0xf7)],'description':_0x39f5dd[_0x5041ce(0xee)]||_0x5041ce(0xf0),'createdTime':_0x39f5dd[_0x5041ce(0xf2)]??'','updatedTime':_0x39f5dd['updatedTime']??'','scriptContent':_0x39f5dd['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4363de,_0x428068){const _0x5e86c9=a40_0x1a51,_0x57b5f6=_0x4363de();while(!![]){try{const _0x47aa17=parseInt(_0x5e86c9(0x1cd))/0x1+parseInt(_0x5e86c9(0x1c8))/0x2*(-parseInt(_0x5e86c9(0x1c9))/0x3)+parseInt(_0x5e86c9(0x1d0))/0x4*(parseInt(_0x5e86c9(0x1ce))/0x5)+parseInt(_0x5e86c9(0x1ca))/0x6+-parseInt(_0x5e86c9(0x1cc))/0x7*(parseInt(_0x5e86c9(0x1cb))/0x8)+-parseInt(_0x5e86c9(0x1cf))/0x9+parseInt(_0x5e86c9(0x1c7))/0xa;if(_0x47aa17===_0x428068)break;else _0x57b5f6['push'](_0x57b5f6['shift']());}catch(_0x197ff4){_0x57b5f6['push'](_0x57b5f6['shift']());}}}(a40_0x1624,0xab60e));import{bffList}from'../../commands/bff/list.js';function a40_0x1624(){const _0x23cf8a=['8691907xXnQyY','666521CKBeZv','1135gTERxd','408411GpqCiv','7652oaPQLw','8791540BnHmsg','6114QqfzDT','246EMDskf','1558764idGmRK','8FFiNZn'];a40_0x1624=function(){return _0x23cf8a;};return a40_0x1624();}import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';function a40_0x1a51(_0x16399c,_0x4f4ea1){_0x16399c=_0x16399c-0x1c7;const _0x1624a4=a40_0x1624();let _0x1a51ed=_0x1624a4[_0x16399c];return _0x1a51ed;}import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x1c541d=a41_0x102c;(function(_0x43bc75,_0x38f822){const _0x2cd51f=a41_0x102c,_0x2bc01e=_0x43bc75();while(!![]){try{const _0x87c7a4=parseInt(_0x2cd51f(0x9f))/0x1+parseInt(_0x2cd51f(0x9a))/0x2*(-parseInt(_0x2cd51f(0xb5))/0x3)+parseInt(_0x2cd51f(0xa3))/0x4+-parseInt(_0x2cd51f(0xaa))/0x5+parseInt(_0x2cd51f(0xae))/0x6*(-parseInt(_0x2cd51f(0x98))/0x7)+parseInt(_0x2cd51f(0xa8))/0x8*(parseInt(_0x2cd51f(0x9b))/0x9)+parseInt(_0x2cd51f(0xab))/0xa;if(_0x87c7a4===_0x38f822)break;else _0x2bc01e['push'](_0x2bc01e['shift']());}catch(_0x27d411){_0x2bc01e['push'](_0x2bc01e['shift']());}}}(a41_0x293b,0xb2555));import{listBffScripts}from'../../core/api-client.js';function a41_0x293b(){const _0x52a7ae=['Script\x20type\x20filter','(unnamed)','Return\x20full\x20script\x20objects','appCode','3856soBWAB','scriptType','1103385AAQywK','17631020riKKdb','str','verbose','2739882BiOznG','List\x20Backend\x20Function\x20scripts','string','Filter\x20by\x20script\x20name','COMMON','No\x20Backend\x20Function\x20scripts\x20found.','list','3UWGWNw','map','21oKfvRU','type','1722642IocUGh','9603bQpPxV','name','boolean','bff','327110BrbORK','read','ENDPOINT','functionName','2311544pIbMWo'];a41_0x293b=function(){return _0x52a7ae;};return a41_0x293b();}function a41_0x102c(_0x6d3dd0,_0x55922a){_0x6d3dd0=_0x6d3dd0-0x97;const _0x293b4c=a41_0x293b();let _0x102cde=_0x293b4c[_0x6d3dd0];return _0x102cde;}export const bffList={'service':a41_0x1c541d(0x9e),'command':a41_0x1c541d(0xb4),'description':a41_0x1c541d(0xaf),'risk':a41_0x1c541d(0xa0),'flags':[{'name':a41_0x1c541d(0x99),'type':a41_0x1c541d(0xb0),'description':a41_0x1c541d(0xa4),'default':a41_0x1c541d(0xa1),'enum':[a41_0x1c541d(0xa1),a41_0x1c541d(0xb2)]},{'name':'name','type':'string','description':a41_0x1c541d(0xb1)},{'name':a41_0x1c541d(0xad),'type':a41_0x1c541d(0x9d),'description':a41_0x1c541d(0xa6)}],async 'execute'(_0x44df49){const _0x22db39=a41_0x1c541d,_0x35f576=await listBffScripts(_0x44df49[_0x22db39(0xa7)],_0x44df49[_0x22db39(0xac)](_0x22db39(0x99)),{'scriptName':_0x44df49[_0x22db39(0xac)](_0x22db39(0x9c))||undefined}),_0x2dc9b8=_0x44df49['bool'](_0x22db39(0xad));return{'ok':!![],'data':_0x2dc9b8?_0x35f576:_0x35f576[_0x22db39(0x97)](_0x490ab7=>({'id':_0x490ab7['id'],'functionName':_0x490ab7[_0x22db39(0xa2)]??'','description':_0x490ab7['description']||_0x22db39(0xa5),'scriptType':_0x490ab7[_0x22db39(0xa9)]})),'message':_0x35f576['length']===0x0?_0x22db39(0xb3):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a42_0x3508(_0x525108,_0x4956d7){_0x525108=_0x525108-0x197;const _0x4e1bd9=a42_0x4e1b();let _0x350858=_0x4e1bd9[_0x525108];return _0x350858;}const a42_0x3b43ee=a42_0x3508;(function(_0x2ed6de,_0x1545b6){const _0x2a0d71=a42_0x3508,_0x6593d6=_0x2ed6de();while(!![]){try{const _0x144420=-parseInt(_0x2a0d71(0x1a7))/0x1+parseInt(_0x2a0d71(0x1a0))/0x2*(parseInt(_0x2a0d71(0x1a1))/0x3)+-parseInt(_0x2a0d71(0x1bb))/0x4+-parseInt(_0x2a0d71(0x1b8))/0x5*(-parseInt(_0x2a0d71(0x1a3))/0x6)+-parseInt(_0x2a0d71(0x1a6))/0x7*(parseInt(_0x2a0d71(0x1af))/0x8)+-parseInt(_0x2a0d71(0x19c))/0x9*(parseInt(_0x2a0d71(0x198))/0xa)+parseInt(_0x2a0d71(0x1b6))/0xb*(parseInt(_0x2a0d71(0x1c6))/0xc);if(_0x144420===_0x1545b6)break;else _0x6593d6['push'](_0x6593d6['shift']());}catch(_0x7f2c11){_0x6593d6['push'](_0x6593d6['shift']());}}}(a42_0x4e1b,0xe0e1d));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_0x3b43ee(0x19a),a42_0x3b43ee(0x1aa),a42_0x3b43ee(0x1ba),a42_0x3b43ee(0x1c5)];export function resolveBffLogQuery(_0x4f74fc,_0x232f8e=Date[a42_0x3b43ee(0x1bc)]()){const _0xe80b74=a42_0x3b43ee,_0x88f06a=_0x4f74fc[_0xe80b74(0x1bf)]('since'),_0x436795=_0x4f74fc[_0xe80b74(0x1bf)]('start-time'),_0x4ee878=_0x4f74fc['flag']('end-time');if(_0x88f06a!==undefined&&_0x436795!==undefined)throw CliErrors[_0xe80b74(0x1ab)]('--since\x20cannot\x20be\x20combined\x20with\x20--start-time.');const _0x43cfbc=_0x4ee878===undefined?_0x232f8e:readPositiveInteger(_0x4f74fc['num'](_0xe80b74(0x197)),'--end-time'),_0x116a8c=_0x436795===undefined?_0x43cfbc-readSinceMinutes(_0x4f74fc)*0xea60:readPositiveInteger(_0x4f74fc[_0xe80b74(0x1c0)](_0xe80b74(0x1c1)),_0xe80b74(0x1be));if(_0x116a8c<=0x0)throw CliErrors[_0xe80b74(0x1ab)](_0xe80b74(0x19b));if(_0x116a8c>_0x43cfbc)throw CliErrors[_0xe80b74(0x1ab)](_0xe80b74(0x1b2));const _0x42b4e1=readPositiveInteger(_0x4f74fc[_0xe80b74(0x1c0)](_0xe80b74(0x1b5),DEFAULT_LIMIT),_0xe80b74(0x1c3));if(_0x42b4e1>MAX_LIMIT)throw CliErrors[_0xe80b74(0x1ab)](_0xe80b74(0x1bd)+MAX_LIMIT+'.');const _0x263dbc=_0x4f74fc[_0xe80b74(0x1a4)](_0xe80b74(0x199))['trim']()[_0xe80b74(0x1b4)]()||undefined,_0x4ca7eb=_0x4f74fc[_0xe80b74(0x1a4)](_0xe80b74(0x1c2))['trim']()||undefined;return{'appCode':_0x4f74fc[_0xe80b74(0x1b9)],'startTime':_0x116a8c,'endTime':_0x43cfbc,..._0x436795===undefined?{'sinceMinutes':readSinceMinutes(_0x4f74fc)}:{},..._0x263dbc?{'level':_0x263dbc}:{},..._0x4ca7eb?{'keyword':_0x4ca7eb}:{},'limit':_0x42b4e1};}function readSinceMinutes(_0x4991b5){const _0x4f5090=a42_0x3b43ee;return readPositiveInteger(_0x4991b5[_0x4f5090(0x1c0)](_0x4f5090(0x1b3),DEFAULT_SINCE_MINUTES),_0x4f5090(0x1b7));}function readPositiveInteger(_0x1884ec,_0x5a2901){const _0x3ab3de=a42_0x3b43ee;if(!Number[_0x3ab3de(0x19d)](_0x1884ec)||_0x1884ec<=0x0)throw CliErrors[_0x3ab3de(0x1ab)](_0x5a2901+_0x3ab3de(0x1a5));return _0x1884ec;}function a42_0x4e1b(){const _0x95c393=['bff','number','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','since','toUpperCase','limit','3680974ZaoiFb','--since','15PXVgAk','appCode','WARN','2388220zSGUqq','now','--limit\x20must\x20be\x20between\x201\x20and\x20','--start-time','flag','num','start-time','keyword','--limit','Maximum\x20log\x20lines\x20to\x20return\x20(1-','ERROR','24dDFKBJ','end-time','70AnOvug','level','DEBUG','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','3717WkUlhi','isSafeInteger','Filter\x20by\x20log\x20level','read','68IQYZEW','55467tbDhca','length','2747034DHoIEf','str','\x20must\x20be\x20a\x20positive\x20integer.','7MlUryY','285290vtSqmr','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','string','INFO','validation','\x20Backend\x20Function\x20log\x20line(s).','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','6920464OOKDAG'];a42_0x4e1b=function(){return _0x95c393;};return a42_0x4e1b();}export const bffLogs={'service':a42_0x3b43ee(0x1b0),'command':'logs','description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':a42_0x3b43ee(0x19f),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x3b43ee(0x1b3),'type':a42_0x3b43ee(0x1b1),'description':a42_0x3b43ee(0x1ad)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x3b43ee(0x1c1),'type':a42_0x3b43ee(0x1b1),'description':a42_0x3b43ee(0x1a8)},{'name':a42_0x3b43ee(0x197),'type':a42_0x3b43ee(0x1b1),'description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a42_0x3b43ee(0x199),'type':a42_0x3b43ee(0x1a9),'description':a42_0x3b43ee(0x19e),'enum':LOG_LEVELS},{'name':'keyword','type':a42_0x3b43ee(0x1a9),'description':a42_0x3b43ee(0x1ae)},{'name':a42_0x3b43ee(0x1b5),'type':a42_0x3b43ee(0x1b1),'description':a42_0x3b43ee(0x1c4)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x1c4969){resolveBffLogQuery(_0x1c4969);},async 'execute'(_0x59df66){const _0x3d8f51=a42_0x3b43ee,_0x99c9fc=resolveBffLogQuery(_0x59df66),{sinceMinutes:_0x259dd6,..._0x3ff721}=_0x99c9fc,_0x8650c2=await searchBffScriptLogs(_0x3ff721);return{'ok':!![],'data':{'query':_0x99c9fc,'count':_0x8650c2[_0x3d8f51(0x1a2)],'logs':_0x8650c2},'message':_0x8650c2['length']===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':'Found\x20'+_0x8650c2[_0x3d8f51(0x1a2)]+_0x3d8f51(0x1ac)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x5e2799=a43_0x35d5;(function(_0x4ae0f8,_0x56df36){const _0x5150f6=a43_0x35d5,_0x13d3d2=_0x4ae0f8();while(!![]){try{const _0x41880a=parseInt(_0x5150f6(0xb5))/0x1*(parseInt(_0x5150f6(0xc5))/0x2)+parseInt(_0x5150f6(0xfc))/0x3*(parseInt(_0x5150f6(0xf2))/0x4)+parseInt(_0x5150f6(0xe9))/0x5*(parseInt(_0x5150f6(0x93))/0x6)+parseInt(_0x5150f6(0xd6))/0x7+parseInt(_0x5150f6(0x83))/0x8+parseInt(_0x5150f6(0xe4))/0x9+-parseInt(_0x5150f6(0x102))/0xa;if(_0x41880a===_0x56df36)break;else _0x13d3d2['push'](_0x13d3d2['shift']());}catch(_0x17093f){_0x13d3d2['push'](_0x13d3d2['shift']());}}}(a43_0x2f06,0xbf0fe));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';function a43_0x2f06(){const _0x29757c=['appCode','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','currentApp','flatMap','3KaeZFP','migrations','scriptsRootDir','Remote\x20script\x20missing\x20content.','lastSync','push_local','55787620zmXtbo','rollback','filePath','scriptsRoot','\x22\x20may\x20remain.','push','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.','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','sourceDirectoryPathByNewDirectory','ino','oldDirectoryPath','sourceFilePathByNewLockKey','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','split','apiDir','\x20Recovery\x20errors:\x20','\x20bff\x20push\x20--type\x20','HOOK/','force','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','existed','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','10947920BNJAGr','Pull\x20only\x20this\x20script\x20type','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x22\x20from\x20\x22','.js','&type=','scriptType','string','oldDirectory','dev','hookLocation','content','length','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','stringify','\x22\x20from\x20the\x20lock\x20file.','1083708FrBeOD','apps','Could\x20not\x20restore\x20local\x20script\x20\x22','has','\x20--format\x20compress','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','conflict','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','keyChanges','code','some','toLowerCase','newDirectory','functionNode','newLockKey','lockKey','nonInteractive','\x20failed','join','question','all','normalize','boolean','stderr','trim','Would\x20inspect\x20','profileName','Pull\x20complete:\x20','read','move','remoteId','mergedCli','str','Failed\x20to\x20write\x20local\x20script\x20\x22','8NgNRqg','type','operationType','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','yes','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','projectedFunctions','\x20resolution','\x22\x20to\x20\x22','HOOK','\x22:\x20','bool','map','case-rename','requires','cancelled','61260pUOiOu','parse','message','set','\x20skipped','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','utf8','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','NFC','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','values','¤tPage=1&pageSize=','functions','datasetCode','\x22\x20not\x20found\x20after\x20ensureLockScope.','9970548ukCgNZ','would_pull','\x22:\x20its\x20target\x20\x22','includes','\x20pulled','lockFilePath','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','ENDPOINT','entry','ENOENT','\x22\x20and\x20\x22','delete','reverse','rekey','7707195Cwergq','Force\x20overwrite\x20local\x20unsynced\x20changes','oldLockKey','validation','\x20conflict','25pvmFOH','functionName','pull','\x22:\x20both\x20target\x20\x22','mode','/api/management/library/scripts/list?appCode=','entries','\x22;\x20temporary\x20directory\x20\x22','newDirectoryPath','6256052RluOHv','BFF_LOCAL_UNSYNCED','get','scriptContent','selectedAppName','alias'];a43_0x2f06=function(){return _0x29757c;};return a43_0x2f06();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':a43_0x5e2799(0xeb),'description':a43_0x5e2799(0x10f),'risk':a43_0x5e2799(0xaf),'structuredErrors':!![],'flags':[{'name':a43_0x5e2799(0xb6),'type':a43_0x5e2799(0x8a),'description':a43_0x5e2799(0x84),'enum':['COMMON',a43_0x5e2799(0xdd),'HOOK']},{'name':'force','type':a43_0x5e2799(0xa9),'description':a43_0x5e2799(0xe5)}],async 'dryRun'(_0x797d03){const _0xd6dabe=a43_0x5e2799,_0x38b4d9=loadBffProjectConfig(_0x797d03[_0xd6dabe(0xf8)]),_0x411f6f=await readBffLockFile(_0x38b4d9[_0xd6dabe(0xdb)]),{appLock:_0x51394b}=ensureLockScope(_0x411f6f??createEmptyBffLock(),_0x797d03['appCode'],_0x38b4d9[_0xd6dabe(0x105)],_0xd6dabe(0xeb)),_0x940b8c=normalizeBffType(_0x797d03['str'](_0xd6dabe(0xb6)))??undefined,[_0x4a8247,_0x342c34]=await Promise[_0xd6dabe(0xa7)]([listBffScripts(_0x797d03[_0xd6dabe(0xf8)],_0x940b8c),getBffScriptStatistics(_0x797d03[_0xd6dabe(0xf8)])]),_0x1c70ad=_0x4a8247[_0xd6dabe(0x9d)](_0x194429=>normalizeBffType(_0x194429[_0xd6dabe(0x89)])===_0xd6dabe(0xbe)),_0x1ff0ff=_0x1c70ad?buildDatasetCodeToAliasMap(_0x797d03[_0xd6dabe(0x111)],_0x797d03[_0xd6dabe(0xf8)],_0x797d03[_0xd6dabe(0xf6)]||_0x797d03[_0xd6dabe(0xb2)]?.[_0xd6dabe(0xfa)]||_0x797d03[_0xd6dabe(0xb2)]?.['defaultApp']):new Map(),_0x2e12cf=_0x1c70ad?await planHookDirectoryMigration(_0x38b4d9,_0x51394b,_0x1ff0ff,await scanLocalBffFunctions(_0x38b4d9,'HOOK')):undefined,_0xa7b11c=createHookLocationMap(_0x342c34),_0x3dfb06=[];for(const _0x294b53 of _0x4a8247){const _0x3b5842=resolveRemoteScriptTarget(_0x38b4d9,_0x294b53,_0xa7b11c,_0x2e12cf?.[_0xd6dabe(0xbb)]??_0x51394b[_0xd6dabe(0xd3)],_0x1ff0ff);if(!_0x3b5842){_0x3dfb06[_0xd6dabe(0x107)]({'scriptType':_0x294b53[_0xd6dabe(0x89)],'functionName':_0x294b53['functionName']??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x2ba799=(_0x2e12cf?.[_0xd6dabe(0xbb)]??_0x51394b[_0xd6dabe(0xd3)])[_0x3b5842[_0xd6dabe(0xa2)]],_0x3bbfff=_0x294b53[_0xd6dabe(0xf5)]!=null?computeContentHash(_0x294b53[_0xd6dabe(0xf5)]):undefined,_0x84478d=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x2e12cf,_0x3b5842)??_0x3b5842[_0xd6dabe(0x104)],_0x2ba799,_0x3bbfff),_0x3c9528=_0x84478d?localUnsyncedConflict(_0x3b5842,_0x294b53['id']):undefined;_0x3dfb06['push']({'lockKey':_0x3b5842[_0xd6dabe(0xa2)],'filePath':_0x3b5842['filePath'],'remoteId':_0x294b53['id']??null,'status':_0x3c9528?_0xd6dabe(0x99):_0xd6dabe(0xd7),..._0x3c9528?{'conflict':_0x3c9528}:{},..._0x3b5842['hookLocation']?{'alias':_0x3b5842[_0xd6dabe(0x8d)][_0xd6dabe(0xf7)]??null,'datasetCode':_0x3b5842[_0xd6dabe(0x8d)]['datasetCode'],'operationType':_0x3b5842[_0xd6dabe(0x8d)][_0xd6dabe(0xb7)],'functionNode':_0x3b5842[_0xd6dabe(0x8d)][_0xd6dabe(0xa0)]}:{}});}return{'method':'GET','url':_0xd6dabe(0xee)+_0x797d03[_0xd6dabe(0xf8)]+(_0x940b8c?_0xd6dabe(0x88)+_0x940b8c:'')+_0xd6dabe(0xd2)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x797d03[_0xd6dabe(0xf8)],'filterType':_0x940b8c??null,..._0x2e12cf&&_0x2e12cf[_0xd6dabe(0xfd)][_0xd6dabe(0x8f)]>0x0?{'hookDirectoryMigrations':_0x2e12cf[_0xd6dabe(0xfd)][_0xd6dabe(0xc1)](_0x2eb72f=>({'from':_0x2eb72f['oldDirectory'],'to':_0x2eb72f[_0xd6dabe(0x9f)]}))}:{},'files':_0x3dfb06},'description':_0xd6dabe(0xac)+_0x3dfb06['length']+_0xd6dabe(0xdc)};},async 'execute'(_0x1b3331){const _0x123023=a43_0x5e2799,_0x4ac574=loadBffProjectConfig(_0x1b3331[_0x123023(0xf8)]),_0x16ef84=await readBffLockFile(_0x4ac574['lockFilePath']),{lockData:_0x23ef0a,appLock:_0x5892e9}=ensureLockScope(_0x16ef84??createEmptyBffLock(),_0x1b3331[_0x123023(0xf8)],_0x4ac574[_0x123023(0x105)],_0x123023(0xeb)),_0x5a3b5a=normalizeBffType(_0x1b3331[_0x123023(0xb3)]('type'))??undefined;if(_0x1b3331['str'](_0x123023(0xb6))&&!_0x5a3b5a)throw CliErrors['validation']('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x108fd7,_0x385b97]=await Promise[_0x123023(0xa7)]([listBffScripts(_0x1b3331[_0x123023(0xf8)],_0x5a3b5a),getBffScriptStatistics(_0x1b3331[_0x123023(0xf8)])]);if(_0x108fd7[_0x123023(0x8f)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x123023(0xcd)};const _0x16b5b1=_0x1b3331[_0x123023(0xc0)](_0x123023(0x115));if(_0x16b5b1&&!_0x1b3331[_0x123023(0xa3)]){const _0x324aed=await confirmForce();if(!_0x324aed)throw CliErrors[_0x123023(0xc4)]('Force\x20pull\x20cancelled.');}if(_0x16b5b1&&_0x1b3331['nonInteractive']){}const _0x3378f9=_0x108fd7[_0x123023(0x9d)](_0x2d2522=>normalizeBffType(_0x2d2522['scriptType'])===_0x123023(0xbe)),_0x450531=_0x3378f9?buildDatasetCodeToAliasMap(_0x1b3331['apiDir'],_0x1b3331['appCode'],_0x1b3331[_0x123023(0xf6)]||_0x1b3331['mergedCli']?.[_0x123023(0xfa)]||_0x1b3331[_0x123023(0xb2)]?.['defaultApp']):new Map(),_0x416855=createHookLocationMap(_0x385b97),_0x5501da=JSON[_0x123023(0xc6)](JSON[_0x123023(0x91)](_0x23ef0a)),_0x1bc881=_0x1b3331[_0x123023(0xf8)],_0x207806=_0x5501da[_0x123023(0x94)][_0x1bc881];if(!_0x207806)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x1bc881+_0x123023(0xd5));const _0x3095ca=_0x3378f9?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4ac574,_0x207806,_0x450531,await scanLocalBffFunctions(_0x4ac574,_0x123023(0xbe))),_0x207806):undefined,_0x31877c=createPullFileTransaction(),_0xcd7a3b=[],_0x1a7484=[],_0x41b043=[],_0x2ff60f=[];for(const _0xad3bbb of _0x108fd7){const _0x2092c2=resolveRemoteScriptTarget(_0x4ac574,_0xad3bbb,_0x416855,_0x207806['functions'],_0x450531);if(!_0x2092c2){_0x1a7484['push']({'lockKey':_0xad3bbb['scriptType']+'/'+_0xad3bbb[_0x123023(0xea)],'reason':'unresolvable\x20target\x20path'});continue;}const _0x56dc69=_0x207806['functions'][_0x2092c2[_0x123023(0xa2)]];try{if(!_0xad3bbb['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0xad3bbb[_0x123023(0xf5)]==null)throw new Error(_0x123023(0xff));const _0x57059c=_0xad3bbb['scriptContent'],_0x5dfb57=computeContentHash(_0x57059c);if(!_0x16b5b1){const _0x54c394=await hasUnsyncedLocalChanges(_0x2092c2[_0x123023(0x104)],_0x56dc69,_0x5dfb57);if(_0x54c394){_0x41b043[_0x123023(0x107)](localUnsyncedConflict(_0x2092c2,_0xad3bbb['id']));continue;}}await _0x31877c['write'](_0x2092c2[_0x123023(0x104)],_0x57059c);const _0x299344={'hash':_0x5dfb57,'remoteId':_0xad3bbb['id'],'version':_0xad3bbb['version']};_0x2092c2[_0x123023(0xb6)]===_0x123023(0xbe)&&_0x2092c2[_0x123023(0x8d)]&&(_0x299344[_0x123023(0xf7)]=_0x2092c2['hookLocation'][_0x123023(0xf7)],_0x299344[_0x123023(0xd4)]=_0x2092c2[_0x123023(0x8d)][_0x123023(0xd4)],_0x299344[_0x123023(0xb7)]=_0x2092c2[_0x123023(0x8d)][_0x123023(0xb7)],_0x299344['functionNode']=_0x2092c2[_0x123023(0x8d)][_0x123023(0xa0)]),_0x207806[_0x123023(0xd3)][_0x2092c2['lockKey']]=_0x299344,_0xcd7a3b['push']({'lockKey':_0x2092c2[_0x123023(0xa2)],'remoteId':_0xad3bbb['id']});}catch(_0x568639){_0x2ff60f['push']({'lockKey':_0x2092c2['lockKey'],'error':_0x568639 instanceof Error?_0x568639['message']:String(_0x568639)});}}_0x207806['lastSync']=new Date()['toISOString']();try{await writeBffLockFile(_0x4ac574[_0x123023(0xdb)],_0x5501da);}catch(_0x60c229){const _0x1f4e0f=[...await _0x31877c[_0x123023(0x103)](),...await _0x3095ca?.[_0x123023(0x103)]()??[]];throw withRollbackErrors(_0x60c229,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x1f4e0f);}return{'ok':_0x2ff60f[_0x123023(0x8f)]===0x0,'data':{'pulled':_0xcd7a3b,'skipped':_0x1a7484,'conflicts':_0x41b043,'failed':_0x2ff60f},'message':formatPullMessage(_0xcd7a3b[_0x123023(0x8f)],_0x1a7484['length'],_0x41b043[_0x123023(0x8f)],_0x2ff60f[_0x123023(0x8f)])};}};function a43_0x35d5(_0x385929,_0x269af0){_0x385929=_0x385929-0x80;const _0x2f066d=a43_0x2f06();let _0x35d59d=_0x2f066d[_0x385929];return _0x35d59d;}function localUnsyncedConflict(_0x1f67cf,_0xb6800b){const _0x516db4=a43_0x5e2799,_0x369553=_0x1f67cf[_0x516db4(0xa2)][_0x516db4(0x110)]('/')['at'](-0x1);return{'code':_0x516db4(0xf3),'lockKey':_0x1f67cf[_0x516db4(0xa2)],'filePath':_0x1f67cf[_0x516db4(0x104)],..._0xb6800b!=null?{'remoteId':_0xb6800b}:{},'message':_0x516db4(0x109),'nextAction':{'action':_0x516db4(0x101),'command':CLI_BIN_NAME+_0x516db4(0x113)+_0x1f67cf[_0x516db4(0xb6)]+'\x20--name\x20'+_0x369553+_0x516db4(0x97),'requiresReview':!![],'message':_0x516db4(0x108)}};}function formatPullMessage(_0x4bb318,_0x553ae0,_0x36041d,_0x567632){const _0x2e192f=a43_0x5e2799,_0x16ca18=[_0x2e192f(0xae)+_0x4bb318+_0x2e192f(0xda),_0x553ae0+_0x2e192f(0xc9)];_0x36041d>0x0&&_0x16ca18[_0x2e192f(0x107)](_0x36041d+_0x2e192f(0xe8)+(_0x36041d===0x1?'':'s')+'\x20'+(_0x36041d===0x1?_0x2e192f(0xc3):'require')+_0x2e192f(0xbc));if(_0x567632>0x0)_0x16ca18[_0x2e192f(0x107)](_0x567632+_0x2e192f(0xa4));return _0x16ca18['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x1de41e,_0xf010fd,_0x521075){if(!await fileExists(_0x1de41e))return![];const _0x308081=await computeFileHash(_0x1de41e);if(!_0xf010fd)return _0x521075?_0x308081!==_0x521075:!![];return _0x308081!==_0xf010fd['hash'];}function createPullFileTransaction(){const _0x34c402=new Map(),_0x1f4c59=async(_0x2286a8,_0x2a9bca)=>{const _0x2e8cf9=a43_0x35d5;try{if(_0x2a9bca[_0x2e8cf9(0x81)])await ensureParentDirectory(_0x2286a8),await writeFile(_0x2286a8,_0x2a9bca[_0x2e8cf9(0x8e)]);else try{await unlink(_0x2286a8);}catch(_0x5e7540){if(_0x5e7540[_0x2e8cf9(0x9c)]!==_0x2e8cf9(0xdf))throw _0x5e7540;}return undefined;}catch(_0x233f6e){return _0x233f6e instanceof Error?_0x233f6e:new Error(String(_0x233f6e));}};return{async 'write'(_0xfaa6da,_0x14cdbe){const _0x54ae3f=a43_0x35d5;if(!_0x34c402[_0x54ae3f(0x96)](_0xfaa6da))try{_0x34c402[_0x54ae3f(0xc8)](_0xfaa6da,{'existed':!![],'content':await readFile(_0xfaa6da)});}catch(_0x36d9f8){if(_0x36d9f8[_0x54ae3f(0x9c)]!==_0x54ae3f(0xdf))throw _0x36d9f8;_0x34c402[_0x54ae3f(0xc8)](_0xfaa6da,{'existed':![]});}try{await ensureParentDirectory(_0xfaa6da),await writeFile(_0xfaa6da,_0x14cdbe,_0x54ae3f(0xcb));}catch(_0x16c71a){const _0x22f532=await _0x1f4c59(_0xfaa6da,_0x34c402[_0x54ae3f(0xf4)](_0xfaa6da));if(!_0x22f532)_0x34c402[_0x54ae3f(0xe1)](_0xfaa6da);throw withRollbackErrors(_0x16c71a,_0x54ae3f(0xb4)+_0xfaa6da+'\x22.',_0x22f532?[_0x22f532]:[]);}},async 'rollback'(){const _0x33e483=a43_0x35d5,_0x5d9adb=[];for(const [_0x30b7a5,_0x10f20d]of[..._0x34c402[_0x33e483(0xef)]()][_0x33e483(0xe2)]()){const _0x4c54e8=await _0x1f4c59(_0x30b7a5,_0x10f20d);_0x4c54e8&&_0x5d9adb['push'](new Error(_0x33e483(0x95)+_0x30b7a5+_0x33e483(0xbf)+_0x4c54e8[_0x33e483(0xc7)]));}return _0x5d9adb;}};}function withRollbackErrors(_0x2a77c3,_0x2f103e,_0x5d7fd0){const _0x1497d1=a43_0x5e2799,_0xb8b6fa=_0x2a77c3 instanceof Error?_0x2a77c3:new Error(String(_0x2a77c3));if(_0x5d7fd0[_0x1497d1(0x8f)]===0x0)return _0xb8b6fa;return new AggregateError([_0xb8b6fa,..._0x5d7fd0],_0x2f103e+_0x1497d1(0x112)+_0x5d7fd0[_0x1497d1(0xc1)](_0x57f38e=>_0x57f38e[_0x1497d1(0xc7)])[_0x1497d1(0xa5)](';\x20'));}function buildDatasetCodeToAliasMap(_0x5bd265,_0xcdc171,_0x155bbe){const _0x5d68da=a43_0x5e2799,_0x2f46b2=resolveApiModelSource(_0x5bd265,_0xcdc171,_0x155bbe),_0x4c7b3c=loadAliasMap(_0x5bd265,undefined,_0x2f46b2[_0x5d68da(0x104)],_0x2f46b2[_0x5d68da(0xad)]);return assertUnambiguousHookAliases(_0x4c7b3c),new Map(_0x4c7b3c[_0x5d68da(0xc1)](_0x12fdec=>[_0x12fdec[_0x5d68da(0xd4)][_0x5d68da(0x9e)](),_0x12fdec[_0x5d68da(0xf7)]]));}async function planHookDirectoryMigration(_0x45ca83,_0x261c8f,_0x3c4a72,_0x16bd38){const _0xd9cdf4=a43_0x5e2799,_0x52dca3=new Map();for(const [_0xa0854d,_0x2ae2ff]of Object[_0xd9cdf4(0xef)](_0x261c8f['functions'])){const [_0x3753bc,_0x16ff93,_0x52e889,_0x3a68d5,_0x502019,..._0x498913]=_0xa0854d['split']('/');if(_0x3753bc!==_0xd9cdf4(0xbe)||!_0x16ff93||!_0x52e889||!_0x3a68d5||!_0x502019||_0x498913['length']>0x0||!_0x2ae2ff[_0xd9cdf4(0xd4)])continue;const _0x234dfc=_0x3c4a72[_0xd9cdf4(0xf4)](_0x2ae2ff[_0xd9cdf4(0xd4)][_0xd9cdf4(0x9e)]()),_0x4a2bde=_0x234dfc??_0x2ae2ff[_0xd9cdf4(0xd4)];if(!isSafeHookDirectorySegment(_0x16ff93))throw CliErrors[_0xd9cdf4(0xe7)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x16ff93+_0xd9cdf4(0x92));if(!isSafeHookDirectorySegment(_0x4a2bde))throw CliErrors['validation'](_0xd9cdf4(0x85)+_0x16ff93+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x16ff93===_0x4a2bde)continue;const _0x4e8e28=_0x52dca3[_0xd9cdf4(0xf4)](_0x16ff93)??{'datasetCode':_0x2ae2ff[_0xd9cdf4(0xd4)],'alias':_0x234dfc,'keyChanges':[]};if(_0x4e8e28['datasetCode']!==_0x2ae2ff[_0xd9cdf4(0xd4)])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x16ff93+_0xd9cdf4(0xcc));const _0x24860c=_0xd9cdf4(0x114)+_0x4a2bde+'/'+_0x52e889+'/'+_0x3a68d5+'/'+_0x502019;try{resolveLocalFilePathFromLockKey(_0x45ca83,_0xa0854d),resolveLocalFilePathFromLockKey(_0x45ca83,_0x24860c);}catch(_0x195997){throw CliErrors['validation'](_0xd9cdf4(0x98)+_0xa0854d+_0xd9cdf4(0xbf)+(_0x195997 instanceof Error?_0x195997[_0xd9cdf4(0xc7)]:String(_0x195997)));}_0x4e8e28[_0xd9cdf4(0x9b)][_0xd9cdf4(0x107)]({'oldLockKey':_0xa0854d,'newLockKey':_0x24860c,'entry':_0x2ae2ff}),_0x52dca3[_0xd9cdf4(0xc8)](_0x16ff93,_0x4e8e28);}const _0x3cb079=new Set([..._0x52dca3[_0xd9cdf4(0xd1)]()][_0xd9cdf4(0xfb)](_0x5843ad=>_0x5843ad[_0xd9cdf4(0x9b)][_0xd9cdf4(0xc1)](_0x4197b8=>_0x4197b8[_0xd9cdf4(0xe6)]))),_0x3245f3=new Map(),_0x5de385=new Map();for(const [_0x18655f,_0x73b485]of _0x52dca3){const _0x44b47b=_0x73b485[_0xd9cdf4(0xf7)]??_0x73b485['datasetCode'],_0x51c26c=hookDirectoryIdentity(_0x44b47b),_0x1bd16c=_0x3245f3[_0xd9cdf4(0xf4)](_0x51c26c);if(_0x1bd16c&&_0x1bd16c!==_0x18655f)throw CliErrors['validation'](_0xd9cdf4(0xba)+_0x1bd16c+_0xd9cdf4(0xe0)+_0x18655f+_0xd9cdf4(0xec)+_0x44b47b+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x3245f3['set'](_0x51c26c,_0x18655f);for(const _0x326b5d of _0x73b485[_0xd9cdf4(0x9b)]){const _0x4f8aa8=_0x5de385['get'](_0x326b5d[_0xd9cdf4(0xa1)]);if(_0x4f8aa8&&_0x4f8aa8!==_0x326b5d['oldLockKey'])throw CliErrors[_0xd9cdf4(0xe7)](_0xd9cdf4(0x90)+_0x4f8aa8+_0xd9cdf4(0xe0)+_0x326b5d[_0xd9cdf4(0xe6)]+'\x22:\x20both\x20target\x20\x22'+_0x326b5d[_0xd9cdf4(0xa1)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x3cb079[_0xd9cdf4(0x96)](_0x326b5d[_0xd9cdf4(0xa1)]))throw CliErrors['validation'](_0xd9cdf4(0x82)+_0x326b5d[_0xd9cdf4(0xe6)]+_0xd9cdf4(0xd8)+_0x326b5d[_0xd9cdf4(0xa1)]+_0xd9cdf4(0x9a));_0x5de385['set'](_0x326b5d[_0xd9cdf4(0xa1)],_0x326b5d['oldLockKey']);}}const _0x2bda59=new Map();for(const [_0x2420e9,_0x40af87]of _0x3c4a72){_0x2bda59[_0xd9cdf4(0xc8)](hookDirectoryIdentity(_0x40af87),_0x2420e9);}const _0x14cba7=[];for(const [_0x101ad1,_0x50fbdd]of _0x52dca3){const _0xee7004=_0x50fbdd[_0xd9cdf4(0xf7)]??_0x50fbdd[_0xd9cdf4(0xd4)],_0x52fedc=join(_0x45ca83[_0xd9cdf4(0xfe)],_0xd9cdf4(0xbe),_0x101ad1),_0xf706cf=join(_0x45ca83[_0xd9cdf4(0xfe)],_0xd9cdf4(0xbe),_0xee7004),_0x51339f=await directoryExists(_0x52fedc),_0x93fbd3=await directoryExists(_0xf706cf),_0x4d7af6=_0x51339f?_0x93fbd3?await sameDirectory(_0x52fedc,_0xf706cf)?_0xd9cdf4(0xc2):undefined:'move':'rekey';if(!_0x4d7af6)throw CliErrors['validation'](_0xd9cdf4(0x85)+_0x101ad1+_0xd9cdf4(0xbd)+_0xee7004+_0xd9cdf4(0xd0));const _0x1ef4b4=_0x2bda59['get'](hookDirectoryIdentity(_0x101ad1));if(_0x1ef4b4&&_0x1ef4b4!==_0x50fbdd[_0xd9cdf4(0xd4)][_0xd9cdf4(0x9e)]()){const _0x182958=new Set(_0x50fbdd['keyChanges'][_0xd9cdf4(0xc1)](_0x2ffb04=>_0x2ffb04[_0xd9cdf4(0xe6)])),_0x1f95aa=_0x16bd38['filter'](_0x54473a=>_0x54473a[_0xd9cdf4(0xb6)]==='HOOK'&&_0x54473a[_0xd9cdf4(0xf7)]!=null&&hookDirectoryIdentity(_0x54473a[_0xd9cdf4(0xf7)])===hookDirectoryIdentity(_0x101ad1)&&!_0x182958[_0xd9cdf4(0x96)](_0x54473a[_0xd9cdf4(0xa2)]));if(_0x1f95aa[_0xd9cdf4(0x8f)]>0x0)throw CliErrors['validation'](_0xd9cdf4(0x85)+_0x101ad1+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x2dbfdf=_0x2bda59[_0xd9cdf4(0xf4)](hookDirectoryIdentity(_0xee7004));if(_0x2dbfdf&&_0x2dbfdf!==_0x50fbdd[_0xd9cdf4(0xd4)][_0xd9cdf4(0x9e)]())throw CliErrors[_0xd9cdf4(0xe7)](_0xd9cdf4(0x85)+_0x101ad1+_0xd9cdf4(0xbd)+_0xee7004+_0xd9cdf4(0xca));for(const _0x1b0c5d of _0x50fbdd['keyChanges']){const _0x82cace=_0x261c8f[_0xd9cdf4(0xd3)][_0x1b0c5d[_0xd9cdf4(0xa1)]];if(_0x82cace&&!_0x3cb079[_0xd9cdf4(0x96)](_0x1b0c5d[_0xd9cdf4(0xa1)])&&!sameHookIdentity(_0x1b0c5d[_0xd9cdf4(0xde)],_0x82cace))throw CliErrors[_0xd9cdf4(0xe7)](_0xd9cdf4(0x85)+_0x101ad1+'\x22\x20to\x20\x22'+_0xee7004+'\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.');}_0x14cba7[_0xd9cdf4(0x107)]({'oldDirectory':_0x101ad1,'newDirectory':_0xee7004,'oldDirectoryPath':_0x52fedc,'newDirectoryPath':_0xf706cf,'mode':_0x4d7af6,'alias':_0x50fbdd[_0xd9cdf4(0xf7)],'keyChanges':_0x50fbdd[_0xd9cdf4(0x9b)]});}const _0x117295={..._0x261c8f['functions']},_0x4b5553=new Map(),_0xcf6afc=new Map();for(const _0x2439ca of _0x14cba7){const _0x5ee22d=_0x2439ca[_0xd9cdf4(0xed)]!==_0xd9cdf4(0xe3);_0x5ee22d&&_0xcf6afc[_0xd9cdf4(0xc8)](hookDirectoryIdentity(_0x2439ca[_0xd9cdf4(0x9f)]),_0x2439ca[_0xd9cdf4(0x10d)]);for(const _0x47d024 of _0x2439ca[_0xd9cdf4(0x9b)]){const _0xef39f6=_0x117295[_0x47d024[_0xd9cdf4(0xa1)]],_0x214134=_0x5ee22d?_0x47d024[_0xd9cdf4(0xde)]:_0xef39f6??_0x47d024[_0xd9cdf4(0xde)];_0x117295[_0x47d024[_0xd9cdf4(0xa1)]]=canonicalizeHookEntry(_0x214134,_0x2439ca[_0xd9cdf4(0xf7)]),delete _0x117295[_0x47d024[_0xd9cdf4(0xe6)]],_0x5ee22d&&_0x4b5553[_0xd9cdf4(0xc8)](_0x47d024['newLockKey'],resolveLocalFilePathFromLockKey(_0x45ca83,_0x47d024[_0xd9cdf4(0xe6)]));}}return{'migrations':_0x14cba7,'projectedFunctions':_0x117295,'sourceFilePathByNewLockKey':_0x4b5553,'sourceDirectoryPathByNewDirectory':_0xcf6afc};}function resolveMigratedSourceFilePath(_0x206fd3,_0x47b9c1){const _0x7a7f65=a43_0x5e2799;if(!_0x206fd3||!_0x47b9c1)return undefined;const _0x553fe7=_0x206fd3[_0x7a7f65(0x10e)]['get'](_0x47b9c1[_0x7a7f65(0xa2)]);if(_0x553fe7)return _0x553fe7;if(_0x47b9c1[_0x7a7f65(0xb6)]!==_0x7a7f65(0xbe))return undefined;const [,_0x1c1979,..._0x234caa]=_0x47b9c1[_0x7a7f65(0xa2)][_0x7a7f65(0x110)]('/');if(!_0x1c1979||_0x234caa['length']===0x0)return undefined;const _0x13c9cf=_0x206fd3[_0x7a7f65(0x10b)][_0x7a7f65(0xf4)](hookDirectoryIdentity(_0x1c1979));return _0x13c9cf?join(_0x13c9cf,..._0x234caa)+_0x7a7f65(0x87):undefined;}function sameHookIdentity(_0x56b2ac,_0x3ded91){const _0x1fcb1b=a43_0x5e2799;return _0x56b2ac[_0x1fcb1b(0xb1)]===_0x3ded91['remoteId']&&_0x56b2ac[_0x1fcb1b(0xd4)]===_0x3ded91['datasetCode']&&_0x56b2ac['operationType']===_0x3ded91[_0x1fcb1b(0xb7)]&&_0x56b2ac[_0x1fcb1b(0xa0)]===_0x3ded91['functionNode'];}function canonicalizeHookEntry(_0x462148,_0x87094b){const {alias:_0x3a06a6,..._0xbeb018}=_0x462148;return _0x87094b?{..._0xbeb018,'alias':_0x87094b}:_0xbeb018;}function hookDirectoryIdentity(_0x595c8f){const _0x51e517=a43_0x5e2799;return _0x595c8f[_0x51e517(0xa8)](_0x51e517(0xcf))[_0x51e517(0x9e)]();}function isSafeHookDirectorySegment(_0x2de881){return isSafeLockKeySegment(_0x2de881);}async function sameDirectory(_0x388eba,_0x57060d){const _0x2143f1=a43_0x5e2799,[_0x5819ce,_0x2efd72]=await Promise[_0x2143f1(0xa7)]([stat(_0x388eba),stat(_0x57060d)]);return _0x5819ce['dev']===_0x2efd72[_0x2143f1(0x8c)]&&_0x5819ce['ino']===_0x2efd72[_0x2143f1(0x10c)];}async function applyHookDirectoryMigration(_0x12d402,_0x9d1b6){const _0x2cca64=a43_0x5e2799,_0x4c9482=_0x9d1b6[_0x2cca64(0xd3)],_0x501655=_0x9d1b6[_0x2cca64(0x100)],_0x2ec54c=[],_0x2b850f=async()=>{const _0x465869=_0x2cca64,_0x4126fe=[];_0x9d1b6[_0x465869(0xd3)]=_0x4c9482,_0x9d1b6[_0x465869(0x100)]=_0x501655;for(const {migration:_0xc8df3c,temporaryPath:_0x2cdb03}of[..._0x2ec54c][_0x465869(0xe2)]()){try{_0x2cdb03?(await rename(_0xc8df3c[_0x465869(0xf1)],_0x2cdb03),await rename(_0x2cdb03,_0xc8df3c[_0x465869(0x10d)])):await rename(_0xc8df3c[_0x465869(0xf1)],_0xc8df3c['oldDirectoryPath']);}catch(_0x46aa39){_0x4126fe[_0x465869(0x107)](new Error(_0x465869(0xce)+_0xc8df3c[_0x465869(0x8b)]+_0x465869(0x86)+_0xc8df3c[_0x465869(0x9f)]+'\x22:\x20'+(_0x46aa39 instanceof Error?_0x46aa39['message']:String(_0x46aa39))));}}return _0x4126fe;};try{for(const _0xb3857e of _0x12d402['migrations']){if(_0xb3857e[_0x2cca64(0xed)]===_0x2cca64(0xb0))await ensureParentDirectory(_0xb3857e[_0x2cca64(0xf1)]),await rename(_0xb3857e[_0x2cca64(0x10d)],_0xb3857e['newDirectoryPath']),_0x2ec54c['push']({'migration':_0xb3857e});else{if(_0xb3857e[_0x2cca64(0xed)]===_0x2cca64(0xc2)){const _0x3ba38e=join(dirname(_0xb3857e[_0x2cca64(0x10d)]),'.hook-directory-migrate-'+randomUUID());await rename(_0xb3857e[_0x2cca64(0x10d)],_0x3ba38e);try{await rename(_0x3ba38e,_0xb3857e[_0x2cca64(0xf1)]);}catch(_0x5148b1){try{await rename(_0x3ba38e,_0xb3857e[_0x2cca64(0x10d)]);}catch(_0x144c9c){throw withRollbackErrors(_0x5148b1,_0x2cca64(0xf9)+_0xb3857e[_0x2cca64(0x8b)]+_0x2cca64(0xbd)+_0xb3857e['newDirectory']+_0x2cca64(0xf0)+_0x3ba38e+_0x2cca64(0x106),[new Error(_0x2cca64(0xb8)+_0x3ba38e+'\x22\x20to\x20\x22'+_0xb3857e['oldDirectory']+'\x22:\x20'+(_0x144c9c instanceof Error?_0x144c9c[_0x2cca64(0xc7)]:String(_0x144c9c)))]);}throw _0x5148b1;}_0x2ec54c['push']({'migration':_0xb3857e,'temporaryPath':_0x3ba38e});}}}return _0x9d1b6[_0x2cca64(0xd3)]=_0x12d402[_0x2cca64(0xbb)],{'rollback':_0x2b850f};}catch(_0x3e6a28){const _0x3cdc87=await _0x2b850f();throw withRollbackErrors(_0x3e6a28,_0x2cca64(0x10a),_0x3cdc87);}}async function confirmForce(){const _0x26a1eb=a43_0x5e2799,_0x37059b=createInterface({'input':process['stdin'],'output':process[_0x26a1eb(0xaa)]}),_0xcc9f2c=await new Promise(_0x501f3f=>{const _0x2a0416=_0x26a1eb;_0x37059b[_0x2a0416(0xa6)](_0x2a0416(0x80),_0x501f3f);});return _0x37059b['close'](),['y',_0x26a1eb(0xb9)][_0x26a1eb(0xd9)](_0xcc9f2c[_0x26a1eb(0xab)]()['toLowerCase']());}
|
|
1
|
+
const a43_0x4777d1=a43_0x32a3;(function(_0x17923d,_0x488e53){const _0x30b70b=a43_0x32a3,_0x4d454c=_0x17923d();while(!![]){try{const _0x4bed42=parseInt(_0x30b70b(0x127))/0x1+-parseInt(_0x30b70b(0xf0))/0x2+-parseInt(_0x30b70b(0x107))/0x3+parseInt(_0x30b70b(0xfe))/0x4*(parseInt(_0x30b70b(0xc0))/0x5)+-parseInt(_0x30b70b(0x10e))/0x6*(parseInt(_0x30b70b(0x11c))/0x7)+-parseInt(_0x30b70b(0xef))/0x8+parseInt(_0x30b70b(0xe5))/0x9*(parseInt(_0x30b70b(0xbf))/0xa);if(_0x4bed42===_0x488e53)break;else _0x4d454c['push'](_0x4d454c['shift']());}catch(_0x5dca5e){_0x4d454c['push'](_0x4d454c['shift']());}}}(a43_0x49c5,0xdf57e));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':'bff','command':'pull','description':a43_0x4777d1(0xf3),'risk':a43_0x4777d1(0x120),'structuredErrors':!![],'flags':[{'name':'type','type':'string','description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x4777d1(0x13d),a43_0x4777d1(0xe3),a43_0x4777d1(0xda)]},{'name':a43_0x4777d1(0xe9),'type':'boolean','description':a43_0x4777d1(0xe2)}],async 'dryRun'(_0x75cfe0){const _0xde9dcd=a43_0x4777d1,_0x5e1e61=loadBffProjectConfig(_0x75cfe0[_0xde9dcd(0x104)]),_0x1fd2e0=await readBffLockFile(_0x5e1e61['lockFilePath']),{appLock:_0x420714}=ensureLockScope(_0x1fd2e0??createEmptyBffLock(),_0x75cfe0[_0xde9dcd(0x104)],_0x5e1e61[_0xde9dcd(0xd7)],_0xde9dcd(0x123)),_0x4b5abf=normalizeBffType(_0x75cfe0['str'](_0xde9dcd(0xd6)))??undefined,[_0x2c3b6c,_0xd5fb5c]=await Promise[_0xde9dcd(0xb1)]([listBffScripts(_0x75cfe0[_0xde9dcd(0x104)],_0x4b5abf),getBffScriptStatistics(_0x75cfe0['appCode'])]),_0x4139af=_0x2c3b6c[_0xde9dcd(0x12d)](_0x69daec=>normalizeBffType(_0x69daec[_0xde9dcd(0x10d)])===_0xde9dcd(0xda)),_0x4003db=_0x4139af?buildDatasetCodeToAliasMap(_0x75cfe0[_0xde9dcd(0xd5)],_0x75cfe0[_0xde9dcd(0x104)],_0x75cfe0['selectedAppName']||_0x75cfe0[_0xde9dcd(0x126)]?.[_0xde9dcd(0x10a)]||_0x75cfe0[_0xde9dcd(0x126)]?.['defaultApp']):new Map(),_0x441f22=_0x4139af?await planHookDirectoryMigration(_0x5e1e61,_0x420714,_0x4003db,await scanLocalBffFunctions(_0x5e1e61,_0xde9dcd(0xda))):undefined,_0x34c409=createHookLocationMap(_0xd5fb5c),_0x1bc228=[];for(const _0x49b2a6 of _0x2c3b6c){const _0x24c2eb=resolveRemoteScriptTarget(_0x5e1e61,_0x49b2a6,_0x34c409,_0x441f22?.[_0xde9dcd(0xdd)]??_0x420714[_0xde9dcd(0xba)],_0x4003db);if(!_0x24c2eb){_0x1bc228[_0xde9dcd(0x132)]({'scriptType':_0x49b2a6[_0xde9dcd(0x10d)],'functionName':_0x49b2a6[_0xde9dcd(0x116)]??'','status':_0xde9dcd(0xf8),'reason':'unresolvable\x20target\x20path'});continue;}const _0x210849=(_0x441f22?.[_0xde9dcd(0xdd)]??_0x420714[_0xde9dcd(0xba)])[_0x24c2eb['lockKey']],_0x1abbe9=_0x49b2a6[_0xde9dcd(0xdc)]!=null?computeContentHash(_0x49b2a6[_0xde9dcd(0xdc)]):undefined,_0x204341=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x441f22,_0x24c2eb)??_0x24c2eb['filePath'],_0x210849,_0x1abbe9),_0x58eca4=_0x204341?localUnsyncedConflict(_0x24c2eb,_0x49b2a6['id']):undefined;_0x1bc228[_0xde9dcd(0x132)]({'lockKey':_0x24c2eb['lockKey'],'filePath':_0x24c2eb['filePath'],'remoteId':_0x49b2a6['id']??null,'status':_0x58eca4?_0xde9dcd(0xd1):_0xde9dcd(0xc2),..._0x58eca4?{'conflict':_0x58eca4}:{},..._0x24c2eb[_0xde9dcd(0xc4)]?{'alias':_0x24c2eb['hookLocation'][_0xde9dcd(0x105)]??null,'datasetCode':_0x24c2eb['hookLocation'][_0xde9dcd(0x13b)],'operationType':_0x24c2eb[_0xde9dcd(0xc4)][_0xde9dcd(0x10f)],'functionNode':_0x24c2eb['hookLocation'][_0xde9dcd(0xaf)]}:{}});}return{'method':_0xde9dcd(0xca),'url':_0xde9dcd(0xc5)+_0x75cfe0['appCode']+(_0x4b5abf?'&type='+_0x4b5abf:'')+_0xde9dcd(0xf9)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x75cfe0['appCode'],'filterType':_0x4b5abf??null,..._0x441f22&&_0x441f22['migrations'][_0xde9dcd(0x129)]>0x0?{'hookDirectoryMigrations':_0x441f22[_0xde9dcd(0xd9)]['map'](_0x400485=>({'from':_0x400485['oldDirectory'],'to':_0x400485[_0xde9dcd(0x113)]}))}:{},'files':_0x1bc228},'description':'Would\x20inspect\x20'+_0x1bc228['length']+_0xde9dcd(0xc9)};},async 'execute'(_0x38ebe4){const _0x3b86da=a43_0x4777d1,_0x565610=loadBffProjectConfig(_0x38ebe4[_0x3b86da(0x104)]),_0x593c22=await readBffLockFile(_0x565610['lockFilePath']),{lockData:_0x33599b,appLock:_0x33d249}=ensureLockScope(_0x593c22??createEmptyBffLock(),_0x38ebe4[_0x3b86da(0x104)],_0x565610[_0x3b86da(0xd7)],_0x3b86da(0x123)),_0x37bbda=normalizeBffType(_0x38ebe4[_0x3b86da(0xfc)]('type'))??undefined;if(_0x38ebe4[_0x3b86da(0xfc)](_0x3b86da(0xd6))&&!_0x37bbda)throw CliErrors[_0x3b86da(0x109)]('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x26b425,_0x27a08f]=await Promise[_0x3b86da(0xb1)]([listBffScripts(_0x38ebe4['appCode'],_0x37bbda),getBffScriptStatistics(_0x38ebe4[_0x3b86da(0x104)])]);if(_0x26b425[_0x3b86da(0x129)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x3b86da(0xb5)};const _0x589122=_0x38ebe4[_0x3b86da(0xff)](_0x3b86da(0xe9));if(_0x589122&&!_0x38ebe4[_0x3b86da(0x12f)]){const _0x34173c=await confirmForce();if(!_0x34173c)throw CliErrors['cancelled']('Force\x20pull\x20cancelled.');}if(_0x589122&&_0x38ebe4['nonInteractive']){}const _0x3cd40f=_0x26b425[_0x3b86da(0x12d)](_0x4a5c37=>normalizeBffType(_0x4a5c37[_0x3b86da(0x10d)])===_0x3b86da(0xda)),_0xbe672e=_0x3cd40f?buildDatasetCodeToAliasMap(_0x38ebe4['apiDir'],_0x38ebe4['appCode'],_0x38ebe4['selectedAppName']||_0x38ebe4[_0x3b86da(0x126)]?.['currentApp']||_0x38ebe4['mergedCli']?.[_0x3b86da(0x11a)]):new Map(),_0x3fecf2=createHookLocationMap(_0x27a08f),_0x5f4c86=JSON[_0x3b86da(0x135)](JSON[_0x3b86da(0x124)](_0x33599b)),_0x3736b6=_0x38ebe4['appCode'],_0x1f9edc=_0x5f4c86['apps'][_0x3736b6];if(!_0x1f9edc)throw new Error(_0x3b86da(0x101)+_0x3736b6+_0x3b86da(0x130));const _0x27634e=_0x3cd40f?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x565610,_0x1f9edc,_0xbe672e,await scanLocalBffFunctions(_0x565610,_0x3b86da(0xda))),_0x1f9edc):undefined,_0x1a5dfd=createPullFileTransaction(),_0x5a2090=[],_0x8fe907=[],_0x501c63=[],_0x582025=[];for(const _0x1bd40f of _0x26b425){const _0x3d6b3f=resolveRemoteScriptTarget(_0x565610,_0x1bd40f,_0x3fecf2,_0x1f9edc['functions'],_0xbe672e);if(!_0x3d6b3f){_0x8fe907[_0x3b86da(0x132)]({'lockKey':_0x1bd40f['scriptType']+'/'+_0x1bd40f[_0x3b86da(0x116)],'reason':_0x3b86da(0x138)});continue;}const _0x363e75=_0x1f9edc[_0x3b86da(0xba)][_0x3d6b3f[_0x3b86da(0xe0)]];try{if(!_0x1bd40f['id'])throw new Error(_0x3b86da(0x118));if(_0x1bd40f['scriptContent']==null)throw new Error(_0x3b86da(0xea));const _0x1672a9=_0x1bd40f['scriptContent'],_0x5c6881=computeContentHash(_0x1672a9);if(!_0x589122){const _0x64c043=await hasUnsyncedLocalChanges(_0x3d6b3f['filePath'],_0x363e75,_0x5c6881);if(_0x64c043){_0x501c63[_0x3b86da(0x132)](localUnsyncedConflict(_0x3d6b3f,_0x1bd40f['id']));continue;}}await _0x1a5dfd['write'](_0x3d6b3f[_0x3b86da(0xf1)],_0x1672a9);const _0x4c84e2={'hash':_0x5c6881,'remoteId':_0x1bd40f['id'],'version':_0x1bd40f['version']};_0x3d6b3f[_0x3b86da(0xd6)]===_0x3b86da(0xda)&&_0x3d6b3f['hookLocation']&&(_0x4c84e2[_0x3b86da(0x105)]=_0x3d6b3f['hookLocation'][_0x3b86da(0x105)],_0x4c84e2[_0x3b86da(0x13b)]=_0x3d6b3f[_0x3b86da(0xc4)]['datasetCode'],_0x4c84e2['operationType']=_0x3d6b3f['hookLocation'][_0x3b86da(0x10f)],_0x4c84e2[_0x3b86da(0xaf)]=_0x3d6b3f[_0x3b86da(0xc4)][_0x3b86da(0xaf)]),_0x1f9edc['functions'][_0x3d6b3f[_0x3b86da(0xe0)]]=_0x4c84e2,_0x5a2090[_0x3b86da(0x132)]({'lockKey':_0x3d6b3f[_0x3b86da(0xe0)],'remoteId':_0x1bd40f['id']});}catch(_0x26e91d){_0x582025['push']({'lockKey':_0x3d6b3f[_0x3b86da(0xe0)],'error':_0x26e91d instanceof Error?_0x26e91d[_0x3b86da(0xcd)]:String(_0x26e91d)});}}_0x1f9edc[_0x3b86da(0xfb)]=new Date()[_0x3b86da(0x13e)]();try{await writeBffLockFile(_0x565610[_0x3b86da(0xe4)],_0x5f4c86);}catch(_0x235274){const _0xce63c1=[...await _0x1a5dfd['rollback'](),...await _0x27634e?.['rollback']()??[]];throw withRollbackErrors(_0x235274,_0x3b86da(0x13c),_0xce63c1);}return{'ok':_0x582025[_0x3b86da(0x129)]===0x0,'data':{'pulled':_0x5a2090,'skipped':_0x8fe907,'conflicts':_0x501c63,'failed':_0x582025},'message':formatPullMessage(_0x5a2090[_0x3b86da(0x129)],_0x8fe907[_0x3b86da(0x129)],_0x501c63[_0x3b86da(0x129)],_0x582025[_0x3b86da(0x129)])};}};function localUnsyncedConflict(_0x1795a0,_0xe50fa3){const _0x4119a0=a43_0x4777d1,_0x1b8354=_0x1795a0[_0x4119a0(0xe0)]['split']('/')['at'](-0x1);return{'code':_0x4119a0(0xfd),'lockKey':_0x1795a0[_0x4119a0(0xe0)],'filePath':_0x1795a0[_0x4119a0(0xf1)],..._0xe50fa3!=null?{'remoteId':_0xe50fa3}:{},'message':_0x4119a0(0xf4),'nextAction':{'action':_0x4119a0(0x10b),'command':CLI_BIN_NAME+_0x4119a0(0x102)+_0x1795a0[_0x4119a0(0xd6)]+_0x4119a0(0x136)+_0x1b8354+_0x4119a0(0x112),'requiresReview':!![],'message':_0x4119a0(0xcc)}};}function a43_0x49c5(){const _0x12ac61=['type','scriptsRoot','remoteId','migrations','HOOK','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','scriptContent','projectedFunctions','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','requires','lockKey','\x22\x20from\x20the\x20lock\x20file.','Force\x20overwrite\x20local\x20unsynced\x20changes','ENDPOINT','lockFilePath','27162YYvAxH','entries','oldDirectoryPath','oldDirectory','force','Remote\x20script\x20missing\x20content.','NFC','ino','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','scriptsRootDir','146952LDQBbU','3455594WlJlTY','filePath','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','\x20resolution','toLowerCase','join','skipped','¤tPage=1&pageSize=','move','lastSync','str','BFF_LOCAL_UNSYNCED','142280jNJqkG','bool','rekey','Lock\x20scope\x20for\x20app\x20\x22','\x20bff\x20push\x20--type\x20','hash','appCode','alias','question','356715wKKlEs','profileName','validation','currentApp','push_local','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','scriptType','6yLwsmP','operationType','trim','\x22;\x20temporary\x20directory\x20\x22','\x20--format\x20compress','newDirectory','\x22:\x20its\x20target\x20\x22','.js','functionName','newDirectoryPath','Remote\x20script\x20missing\x20id.','existed','defaultApp','case-rename','12316017GGywbW','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','newLockKey','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','read','reverse','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','pull','stringify','\x20pulled','mergedCli','1793582VakIvE','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','length','stderr','get','includes','some','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','nonInteractive','\x22\x20not\x20found\x20after\x20ensureLockScope.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','push','stdin','\x20skipped','parse','\x20--name\x20','delete','unresolvable\x20target\x20path','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','oldLockKey','datasetCode','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','COMMON','toISOString','keyChanges','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','functionNode','Failed\x20to\x20write\x20local\x20script\x20\x22','all','has','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','map','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x22\x20from\x20\x22','\x20conflict','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','flatMap','functions','normalize','set','\x22:\x20both\x20target\x20\x22','\x22:\x20','8980BpToOb','5gWjZal','HOOK/','would_pull','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','hookLocation','/api/management/library/scripts/list?appCode=','Pull\x20complete:\x20','\x22\x20and\x20\x22','ENOENT','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','GET','mode','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.','message','\x20Recovery\x20errors:\x20','entry','code','conflict','\x22\x20to\x20\x22','split','values','apiDir'];a43_0x49c5=function(){return _0x12ac61;};return a43_0x49c5();}function formatPullMessage(_0x1123e3,_0x4b22c9,_0x5acb28,_0x274b4f){const _0x130ec9=a43_0x4777d1,_0x2baa75=[_0x130ec9(0xc6)+_0x1123e3+_0x130ec9(0x125),_0x4b22c9+_0x130ec9(0x134)];_0x5acb28>0x0&&_0x2baa75['push'](_0x5acb28+_0x130ec9(0xb7)+(_0x5acb28===0x1?'':'s')+'\x20'+(_0x5acb28===0x1?_0x130ec9(0xdf):'require')+_0x130ec9(0xf5));if(_0x274b4f>0x0)_0x2baa75['push'](_0x274b4f+'\x20failed');return _0x2baa75['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x539313,_0x1fb6c9,_0xf3cad7){const _0x2f70b0=a43_0x4777d1;if(!await fileExists(_0x539313))return![];const _0x1e1249=await computeFileHash(_0x539313);if(!_0x1fb6c9)return _0xf3cad7?_0x1e1249!==_0xf3cad7:!![];return _0x1e1249!==_0x1fb6c9[_0x2f70b0(0x103)];}function createPullFileTransaction(){const _0x3df5f5=new Map(),_0x24d3e7=async(_0x1e5680,_0x587a3d)=>{const _0x59ab5b=a43_0x32a3;try{if(_0x587a3d[_0x59ab5b(0x119)])await ensureParentDirectory(_0x1e5680),await writeFile(_0x1e5680,_0x587a3d['content']);else try{await unlink(_0x1e5680);}catch(_0x30fa46){if(_0x30fa46[_0x59ab5b(0xd0)]!==_0x59ab5b(0xc8))throw _0x30fa46;}return undefined;}catch(_0x3882e1){return _0x3882e1 instanceof Error?_0x3882e1:new Error(String(_0x3882e1));}};return{async 'write'(_0x2e0c1e,_0x4c9dc9){const _0x2c2f80=a43_0x32a3;if(!_0x3df5f5[_0x2c2f80(0xb2)](_0x2e0c1e))try{_0x3df5f5['set'](_0x2e0c1e,{'existed':!![],'content':await readFile(_0x2e0c1e)});}catch(_0x38d412){if(_0x38d412[_0x2c2f80(0xd0)]!=='ENOENT')throw _0x38d412;_0x3df5f5[_0x2c2f80(0xbc)](_0x2e0c1e,{'existed':![]});}try{await ensureParentDirectory(_0x2e0c1e),await writeFile(_0x2e0c1e,_0x4c9dc9,'utf8');}catch(_0x2f61cf){const _0x36aaa3=await _0x24d3e7(_0x2e0c1e,_0x3df5f5[_0x2c2f80(0x12b)](_0x2e0c1e));if(!_0x36aaa3)_0x3df5f5[_0x2c2f80(0x137)](_0x2e0c1e);throw withRollbackErrors(_0x2f61cf,_0x2c2f80(0xb0)+_0x2e0c1e+'\x22.',_0x36aaa3?[_0x36aaa3]:[]);}},async 'rollback'(){const _0x36044a=a43_0x32a3,_0xacab0b=[];for(const [_0x23adc2,_0x29ee41]of[..._0x3df5f5[_0x36044a(0xe6)]()]['reverse']()){const _0xacf132=await _0x24d3e7(_0x23adc2,_0x29ee41);_0xacf132&&_0xacab0b['push'](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x23adc2+'\x22:\x20'+_0xacf132['message']));}return _0xacab0b;}};}function withRollbackErrors(_0x304658,_0x10cf0d,_0x3444cb){const _0x3e41d1=a43_0x4777d1,_0x223474=_0x304658 instanceof Error?_0x304658:new Error(String(_0x304658));if(_0x3444cb['length']===0x0)return _0x223474;return new AggregateError([_0x223474,..._0x3444cb],_0x10cf0d+_0x3e41d1(0xce)+_0x3444cb['map'](_0x1bc42c=>_0x1bc42c['message'])[_0x3e41d1(0xf7)](';\x20'));}function a43_0x32a3(_0x1a72ba,_0xa513ec){_0x1a72ba=_0x1a72ba-0xad;const _0x49c5a0=a43_0x49c5();let _0x32a309=_0x49c5a0[_0x1a72ba];return _0x32a309;}function buildDatasetCodeToAliasMap(_0x395d19,_0x509105,_0x3d12d6){const _0x3777c7=a43_0x4777d1,_0xca9ebe=resolveApiModelSource(_0x395d19,_0x509105,_0x3d12d6),_0x3e4086=loadAliasMap(_0x395d19,undefined,_0xca9ebe[_0x3777c7(0xf1)],_0xca9ebe[_0x3777c7(0x108)]);return assertUnambiguousHookAliases(_0x3e4086),new Map(_0x3e4086['map'](_0x233934=>[_0x233934[_0x3777c7(0x13b)]['toLowerCase'](),_0x233934[_0x3777c7(0x105)]]));}async function planHookDirectoryMigration(_0x18e9d0,_0xd2b654,_0x47d028,_0x42f594){const _0x4be73d=a43_0x4777d1,_0x36dfad=new Map();for(const [_0x1b57fb,_0x29052b]of Object[_0x4be73d(0xe6)](_0xd2b654['functions'])){const [_0x3089cf,_0x155094,_0x101048,_0x54eaa0,_0x50108e,..._0x2429bf]=_0x1b57fb[_0x4be73d(0xd3)]('/');if(_0x3089cf!==_0x4be73d(0xda)||!_0x155094||!_0x101048||!_0x54eaa0||!_0x50108e||_0x2429bf[_0x4be73d(0x129)]>0x0||!_0x29052b[_0x4be73d(0x13b)])continue;const _0x29cd4b=_0x47d028[_0x4be73d(0x12b)](_0x29052b['datasetCode'][_0x4be73d(0xf6)]()),_0x27a018=_0x29cd4b??_0x29052b[_0x4be73d(0x13b)];if(!isSafeHookDirectorySegment(_0x155094))throw CliErrors['validation'](_0x4be73d(0x131)+_0x155094+_0x4be73d(0xe1));if(!isSafeHookDirectorySegment(_0x27a018))throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x155094+_0x4be73d(0xc3));if(_0x155094===_0x27a018)continue;const _0x29ab67=_0x36dfad['get'](_0x155094)??{'datasetCode':_0x29052b[_0x4be73d(0x13b)],'alias':_0x29cd4b,'keyChanges':[]};if(_0x29ab67[_0x4be73d(0x13b)]!==_0x29052b[_0x4be73d(0x13b)])throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x155094+_0x4be73d(0xb8));const _0x5ace62=_0x4be73d(0xc1)+_0x27a018+'/'+_0x101048+'/'+_0x54eaa0+'/'+_0x50108e;try{resolveLocalFilePathFromLockKey(_0x18e9d0,_0x1b57fb),resolveLocalFilePathFromLockKey(_0x18e9d0,_0x5ace62);}catch(_0x1435a8){throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xf2)+_0x1b57fb+_0x4be73d(0xbe)+(_0x1435a8 instanceof Error?_0x1435a8[_0x4be73d(0xcd)]:String(_0x1435a8)));}_0x29ab67[_0x4be73d(0xad)][_0x4be73d(0x132)]({'oldLockKey':_0x1b57fb,'newLockKey':_0x5ace62,'entry':_0x29052b}),_0x36dfad[_0x4be73d(0xbc)](_0x155094,_0x29ab67);}const _0x130b7f=new Set([..._0x36dfad[_0x4be73d(0xd4)]()][_0x4be73d(0xb9)](_0x477ef1=>_0x477ef1['keyChanges']['map'](_0x2034bf=>_0x2034bf[_0x4be73d(0x13a)]))),_0x3128cc=new Map(),_0x971b33=new Map();for(const [_0x185a90,_0x364b1d]of _0x36dfad){const _0x77221=_0x364b1d[_0x4be73d(0x105)]??_0x364b1d[_0x4be73d(0x13b)],_0x5eb6d=hookDirectoryIdentity(_0x77221),_0x43cef8=_0x3128cc[_0x4be73d(0x12b)](_0x5eb6d);if(_0x43cef8&&_0x43cef8!==_0x185a90)throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0x11d)+_0x43cef8+_0x4be73d(0xc7)+_0x185a90+_0x4be73d(0xbd)+_0x77221+_0x4be73d(0xae));_0x3128cc[_0x4be73d(0xbc)](_0x5eb6d,_0x185a90);for(const _0x578ac2 of _0x364b1d[_0x4be73d(0xad)]){const _0x6d571=_0x971b33[_0x4be73d(0x12b)](_0x578ac2[_0x4be73d(0x11e)]);if(_0x6d571&&_0x6d571!==_0x578ac2[_0x4be73d(0x13a)])throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0x11f)+_0x6d571+_0x4be73d(0xc7)+_0x578ac2[_0x4be73d(0x13a)]+_0x4be73d(0xbd)+_0x578ac2[_0x4be73d(0x11e)]+_0x4be73d(0x122));if(_0x130b7f['has'](_0x578ac2['newLockKey']))throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xde)+_0x578ac2[_0x4be73d(0x13a)]+_0x4be73d(0x114)+_0x578ac2[_0x4be73d(0x11e)]+_0x4be73d(0x128));_0x971b33[_0x4be73d(0xbc)](_0x578ac2['newLockKey'],_0x578ac2['oldLockKey']);}}const _0x2b7af7=new Map();for(const [_0x298fee,_0x29a16b]of _0x47d028){_0x2b7af7[_0x4be73d(0xbc)](hookDirectoryIdentity(_0x29a16b),_0x298fee);}const _0x2c3f68=[];for(const [_0x1b4da5,_0x23ed68]of _0x36dfad){const _0x4c45d8=_0x23ed68[_0x4be73d(0x105)]??_0x23ed68[_0x4be73d(0x13b)],_0x33379e=join(_0x18e9d0[_0x4be73d(0xee)],_0x4be73d(0xda),_0x1b4da5),_0x56ebee=join(_0x18e9d0[_0x4be73d(0xee)],'HOOK',_0x4c45d8),_0x5ad2b3=await directoryExists(_0x33379e),_0x20d3c3=await directoryExists(_0x56ebee),_0x5e1607=_0x5ad2b3?_0x20d3c3?await sameDirectory(_0x33379e,_0x56ebee)?_0x4be73d(0x11b):undefined:_0x4be73d(0xfa):_0x4be73d(0x100);if(!_0x5e1607)throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x1b4da5+'\x22\x20to\x20\x22'+_0x4c45d8+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x40d649=_0x2b7af7[_0x4be73d(0x12b)](hookDirectoryIdentity(_0x1b4da5));if(_0x40d649&&_0x40d649!==_0x23ed68[_0x4be73d(0x13b)]['toLowerCase']()){const _0xe73089=new Set(_0x23ed68[_0x4be73d(0xad)][_0x4be73d(0xb4)](_0x116a1e=>_0x116a1e[_0x4be73d(0x13a)])),_0x1ef30c=_0x42f594['filter'](_0x14d645=>_0x14d645[_0x4be73d(0xd6)]==='HOOK'&&_0x14d645[_0x4be73d(0x105)]!=null&&hookDirectoryIdentity(_0x14d645[_0x4be73d(0x105)])===hookDirectoryIdentity(_0x1b4da5)&&!_0xe73089[_0x4be73d(0xb2)](_0x14d645[_0x4be73d(0xe0)]));if(_0x1ef30c[_0x4be73d(0x129)]>0x0)throw CliErrors['validation'](_0x4be73d(0xb3)+_0x1b4da5+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x49079d=_0x2b7af7['get'](hookDirectoryIdentity(_0x4c45d8));if(_0x49079d&&_0x49079d!==_0x23ed68['datasetCode'][_0x4be73d(0xf6)]())throw CliErrors[_0x4be73d(0x109)](_0x4be73d(0xb3)+_0x1b4da5+'\x22\x20to\x20\x22'+_0x4c45d8+_0x4be73d(0xdb));for(const _0x4dc7ac of _0x23ed68['keyChanges']){const _0x342486=_0xd2b654[_0x4be73d(0xba)][_0x4dc7ac['newLockKey']];if(_0x342486&&!_0x130b7f[_0x4be73d(0xb2)](_0x4dc7ac[_0x4be73d(0x11e)])&&!sameHookIdentity(_0x4dc7ac[_0x4be73d(0xcf)],_0x342486))throw CliErrors[_0x4be73d(0x109)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x1b4da5+_0x4be73d(0xd2)+_0x4c45d8+_0x4be73d(0xed));}_0x2c3f68[_0x4be73d(0x132)]({'oldDirectory':_0x1b4da5,'newDirectory':_0x4c45d8,'oldDirectoryPath':_0x33379e,'newDirectoryPath':_0x56ebee,'mode':_0x5e1607,'alias':_0x23ed68[_0x4be73d(0x105)],'keyChanges':_0x23ed68['keyChanges']});}const _0x1bcef1={..._0xd2b654[_0x4be73d(0xba)]},_0x5d8e3d=new Map(),_0x1e1d75=new Map();for(const _0x382ba3 of _0x2c3f68){const _0xcccf2a=_0x382ba3[_0x4be73d(0xcb)]!==_0x4be73d(0x100);_0xcccf2a&&_0x1e1d75['set'](hookDirectoryIdentity(_0x382ba3[_0x4be73d(0x113)]),_0x382ba3[_0x4be73d(0xe7)]);for(const _0x17eb23 of _0x382ba3[_0x4be73d(0xad)]){const _0x343c15=_0x1bcef1[_0x17eb23[_0x4be73d(0x11e)]],_0x288f57=_0xcccf2a?_0x17eb23['entry']:_0x343c15??_0x17eb23[_0x4be73d(0xcf)];_0x1bcef1[_0x17eb23[_0x4be73d(0x11e)]]=canonicalizeHookEntry(_0x288f57,_0x382ba3[_0x4be73d(0x105)]),delete _0x1bcef1[_0x17eb23['oldLockKey']],_0xcccf2a&&_0x5d8e3d['set'](_0x17eb23[_0x4be73d(0x11e)],resolveLocalFilePathFromLockKey(_0x18e9d0,_0x17eb23[_0x4be73d(0x13a)]));}}return{'migrations':_0x2c3f68,'projectedFunctions':_0x1bcef1,'sourceFilePathByNewLockKey':_0x5d8e3d,'sourceDirectoryPathByNewDirectory':_0x1e1d75};}function resolveMigratedSourceFilePath(_0x2fc3f9,_0x345f38){const _0x2dd999=a43_0x4777d1;if(!_0x2fc3f9||!_0x345f38)return undefined;const _0x2ef5e1=_0x2fc3f9['sourceFilePathByNewLockKey'][_0x2dd999(0x12b)](_0x345f38[_0x2dd999(0xe0)]);if(_0x2ef5e1)return _0x2ef5e1;if(_0x345f38[_0x2dd999(0xd6)]!=='HOOK')return undefined;const [,_0x2cd456,..._0x5b439f]=_0x345f38[_0x2dd999(0xe0)][_0x2dd999(0xd3)]('/');if(!_0x2cd456||_0x5b439f[_0x2dd999(0x129)]===0x0)return undefined;const _0x356ef9=_0x2fc3f9['sourceDirectoryPathByNewDirectory']['get'](hookDirectoryIdentity(_0x2cd456));return _0x356ef9?join(_0x356ef9,..._0x5b439f)+_0x2dd999(0x115):undefined;}function sameHookIdentity(_0x45cf03,_0x51486b){const _0x15bfaf=a43_0x4777d1;return _0x45cf03[_0x15bfaf(0xd8)]===_0x51486b[_0x15bfaf(0xd8)]&&_0x45cf03[_0x15bfaf(0x13b)]===_0x51486b[_0x15bfaf(0x13b)]&&_0x45cf03[_0x15bfaf(0x10f)]===_0x51486b[_0x15bfaf(0x10f)]&&_0x45cf03[_0x15bfaf(0xaf)]===_0x51486b[_0x15bfaf(0xaf)];}function canonicalizeHookEntry(_0x541d15,_0x35b67b){const {alias:_0x830d62,..._0x4fc672}=_0x541d15;return _0x35b67b?{..._0x4fc672,'alias':_0x35b67b}:_0x4fc672;}function hookDirectoryIdentity(_0x3fe23e){const _0x6e2b38=a43_0x4777d1;return _0x3fe23e[_0x6e2b38(0xbb)](_0x6e2b38(0xeb))[_0x6e2b38(0xf6)]();}function isSafeHookDirectorySegment(_0x52ca2b){return isSafeLockKeySegment(_0x52ca2b);}async function sameDirectory(_0x530b5b,_0x3ca3ed){const _0x17b093=a43_0x4777d1,[_0x41a694,_0xd19d12]=await Promise[_0x17b093(0xb1)]([stat(_0x530b5b),stat(_0x3ca3ed)]);return _0x41a694['dev']===_0xd19d12['dev']&&_0x41a694[_0x17b093(0xec)]===_0xd19d12[_0x17b093(0xec)];}async function applyHookDirectoryMigration(_0x29957a,_0x1e5e64){const _0x69e87=a43_0x4777d1,_0x5df906=_0x1e5e64[_0x69e87(0xba)],_0x5719d1=_0x1e5e64['lastSync'],_0x1d06ad=[],_0x234d54=async()=>{const _0x14bd6b=_0x69e87,_0x214019=[];_0x1e5e64[_0x14bd6b(0xba)]=_0x5df906,_0x1e5e64[_0x14bd6b(0xfb)]=_0x5719d1;for(const {migration:_0x554c7e,temporaryPath:_0x4b352a}of[..._0x1d06ad][_0x14bd6b(0x121)]()){try{_0x4b352a?(await rename(_0x554c7e['newDirectoryPath'],_0x4b352a),await rename(_0x4b352a,_0x554c7e['oldDirectoryPath'])):await rename(_0x554c7e[_0x14bd6b(0x117)],_0x554c7e[_0x14bd6b(0xe7)]);}catch(_0x19d130){_0x214019['push'](new Error(_0x14bd6b(0x10c)+_0x554c7e['oldDirectory']+_0x14bd6b(0xb6)+_0x554c7e['newDirectory']+_0x14bd6b(0xbe)+(_0x19d130 instanceof Error?_0x19d130['message']:String(_0x19d130))));}}return _0x214019;};try{for(const _0x40cf2b of _0x29957a['migrations']){if(_0x40cf2b[_0x69e87(0xcb)]===_0x69e87(0xfa))await ensureParentDirectory(_0x40cf2b[_0x69e87(0x117)]),await rename(_0x40cf2b[_0x69e87(0xe7)],_0x40cf2b['newDirectoryPath']),_0x1d06ad[_0x69e87(0x132)]({'migration':_0x40cf2b});else{if(_0x40cf2b[_0x69e87(0xcb)]===_0x69e87(0x11b)){const _0x36cec6=join(dirname(_0x40cf2b[_0x69e87(0xe7)]),'.hook-directory-migrate-'+randomUUID());await rename(_0x40cf2b['oldDirectoryPath'],_0x36cec6);try{await rename(_0x36cec6,_0x40cf2b[_0x69e87(0x117)]);}catch(_0x50e7fa){try{await rename(_0x36cec6,_0x40cf2b[_0x69e87(0xe7)]);}catch(_0x4c48b3){throw withRollbackErrors(_0x50e7fa,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x40cf2b[_0x69e87(0xe8)]+_0x69e87(0xd2)+_0x40cf2b['newDirectory']+_0x69e87(0x111)+_0x36cec6+'\x22\x20may\x20remain.',[new Error(_0x69e87(0x12e)+_0x36cec6+_0x69e87(0xd2)+_0x40cf2b[_0x69e87(0xe8)]+_0x69e87(0xbe)+(_0x4c48b3 instanceof Error?_0x4c48b3[_0x69e87(0xcd)]:String(_0x4c48b3)))]);}throw _0x50e7fa;}_0x1d06ad['push']({'migration':_0x40cf2b,'temporaryPath':_0x36cec6});}}}return _0x1e5e64['functions']=_0x29957a['projectedFunctions'],{'rollback':_0x234d54};}catch(_0x1ce04e){const _0x1c0c47=await _0x234d54();throw withRollbackErrors(_0x1ce04e,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x1c0c47);}}async function confirmForce(){const _0x27b250=a43_0x4777d1,_0x441fec=createInterface({'input':process[_0x27b250(0x133)],'output':process[_0x27b250(0x12a)]}),_0x3e91eb=await new Promise(_0x2f2e71=>{const _0x4cd171=_0x27b250;_0x441fec[_0x4cd171(0x106)](_0x4cd171(0x139),_0x2f2e71);});return _0x441fec['close'](),['y','yes'][_0x27b250(0x12c)](_0x3e91eb[_0x27b250(0x110)]()['toLowerCase']());}
|