@lovrabet/rabetbase-cli 2.5.11 → 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.d.ts +1 -0
- 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.d.ts +2 -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/references/rabetbase-kb.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
|
-
|
|
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_0xc44fdd=a37_0x38ee;(function(_0x2d9e9d,_0x464449){const _0x3e9359=a37_0x38ee,_0x1ba0c8=_0x2d9e9d();while(!![]){try{const _0xba83d8=parseInt(_0x3e9359(0x1c6))/0x1+-parseInt(_0x3e9359(0x1dd))/0x2+parseInt(_0x3e9359(0x1b6))/0x3+parseInt(_0x3e9359(0x1d5))/0x4*(parseInt(_0x3e9359(0x20b))/0x5)+parseInt(_0x3e9359(0x1c4))/0x6*(-parseInt(_0x3e9359(0x1df))/0x7)+parseInt(_0x3e9359(0x1ae))/0x8*(-parseInt(_0x3e9359(0x1b4))/0x9)+parseInt(_0x3e9359(0x1ff))/0xa;if(_0xba83d8===_0x464449)break;else _0x1ba0c8['push'](_0x1ba0c8['shift']());}catch(_0x2cdbb4){_0x1ba0c8['push'](_0x1ba0c8['shift']());}}}(a37_0x45e6,0xa4cf2));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';function a37_0x45e6(){const _0x8849f0=['stderr','6910980bPfNYZ','\x22\x20not\x20found\x20for\x20dataset\x20','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','after','/ENDPOINT/','datasetCode','tableName','operation-type','/data/dataset/','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','trim','1630675mfIRVz','before','Operation\x20type\x20\x22','alias','\x22.\x20','includes','currentApp','Invalid\x20dataset\x20selection.','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Select\x20operation\x20type:','\x20api\x20pull`\x20to\x20refresh.','appCode','validation','Operation\x20type\x20(HOOK\x20only)','create','close','isInteger','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Function\x20name\x20(valid\x20JS\x20identifier)','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','HOOK','40DkRNxu','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','bff','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Select\x20dataset:','\x20function:\x20','111294YhIEmG','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','1242996IIXhjc','string','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','/HOOK/','/**\x0a\x20*\x20','Created\x20','Select\x20trigger\x20node:','code','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x22,\x20params\x20})\x0a','Invalid\x20function\x20name\x20\x22','4511226LOwaBm','parseInt','173715RmmhSO','join','.js\x0a','HOOK\x20requires\x20alias/operation/node\x20options.','apiDir','nonInteractive','source','question','entries','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Dataset\x20not\x20found\x20for\x20code\x20\x22','Script\x20description','operationType','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','File\x20already\x20exists:\x20','4eicxnq','description','COMMON','No\x20operation\x20types\x20found\x20for\x20dataset\x20','defaultApp','修改后的响应结果','ENDPOINT','datasetcode','233042nhpAZm','No\x20datasets\x20found\x20for\x20this\x20app.','7mgquHg','read','write','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','datasetId','Trigger\x20node\x20(HOOK\x20only)','stdin','name','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','/COMMON/','str','find','map','修改后的请求参数','\x0a\x20*\x20[平台配置]\x20','Available\x20aliases:\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','type','当前响应结果','.js','\x22\x20not\x20found.\x20','mergedCli','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','functionNode','scriptsRootDir','length','UNKNOWN','function-node','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','profileName'];a37_0x45e6=function(){return _0x8849f0;};return a37_0x45e6();}import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';function a37_0x38ee(_0x2a2314,_0x2bf0d4){_0x2a2314=_0x2a2314-0x1a2;const _0x45e6b3=a37_0x45e6();let _0x38ee43=_0x45e6b3[_0x2a2314];return _0x38ee43;}import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0xc44fdd(0x1b0),'command':a37_0xc44fdd(0x1a7),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0xc44fdd(0x1e0),'flags':[{'name':a37_0xc44fdd(0x1f0),'type':'string','required':!![],'enum':[a37_0xc44fdd(0x1d7),a37_0xc44fdd(0x1db),a37_0xc44fdd(0x1ad)],'description':'Script\x20type'},{'name':a37_0xc44fdd(0x1e6),'type':a37_0xc44fdd(0x1b7),'required':!![],'description':a37_0xc44fdd(0x1ab)},{'name':'description','type':'string','description':a37_0xc44fdd(0x1d1)},{'name':a37_0xc44fdd(0x20e),'type':'string','description':a37_0xc44fdd(0x213)},{'name':a37_0xc44fdd(0x1dc),'type':'string','description':a37_0xc44fdd(0x1d3)},{'name':a37_0xc44fdd(0x207),'type':'string','description':a37_0xc44fdd(0x1a6)},{'name':a37_0xc44fdd(0x1fa),'type':'string','description':a37_0xc44fdd(0x1e4),'enum':[a37_0xc44fdd(0x20c),a37_0xc44fdd(0x203)]}],async 'validate'(_0x3130fd){const _0x5ac436=a37_0xc44fdd,_0x1c3159=_0x3130fd[_0x5ac436(0x1e9)](_0x5ac436(0x1e6));if(!isValidBffFunctionName(_0x1c3159))throw CliErrors[_0x5ac436(0x1a5)](_0x5ac436(0x1c3)+_0x1c3159+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x52fb86){const _0x24cf51=a37_0xc44fdd,_0x3a1d87=loadBffProjectConfig(_0x52fb86[_0x24cf51(0x1a4)]),_0x7c616=_0x52fb86['str'](_0x24cf51(0x1f0)),_0xe66623=_0x52fb86[_0x24cf51(0x1e9)](_0x24cf51(0x1e6)),_0xf7b470=_0x52fb86[_0x24cf51(0x1e9)](_0x24cf51(0x1d6))||undefined,_0x30fc83=_0x7c616===_0x24cf51(0x1ad)?await resolveHookOptions(_0x3a1d87,_0x52fb86):undefined,_0x4cbde7=buildFilePath(_0x3a1d87,_0x7c616,_0xe66623,_0x30fc83);if(await fileExists(_0x4cbde7))throw CliErrors[_0x24cf51(0x1a5)](_0x24cf51(0x1d4)+_0x4cbde7);await mkdir(dirname(_0x4cbde7),{'recursive':!![]});const _0x540e90=generateTemplate(_0x7c616,_0xe66623,_0x52fb86['appCode'],_0xf7b470,_0x30fc83);await writeFile(_0x4cbde7,_0x540e90,'utf8');const _0x142e95={'type':_0x7c616,'name':_0xe66623,'path':_0x4cbde7};if(_0xf7b470)_0x142e95['description']=_0xf7b470;if(_0x30fc83){if(_0x30fc83[_0x24cf51(0x20e)])_0x142e95[_0x24cf51(0x20e)]=_0x30fc83[_0x24cf51(0x20e)];_0x142e95[_0x24cf51(0x205)]=_0x30fc83['datasetCode'],_0x142e95[_0x24cf51(0x1d2)]=_0x30fc83[_0x24cf51(0x1d2)],_0x142e95[_0x24cf51(0x1f6)]=_0x30fc83[_0x24cf51(0x1f6)];}return{'ok':!![],'data':_0x142e95,'message':_0x24cf51(0x1bd)+_0x7c616+_0x24cf51(0x1b3)+_0xe66623};}};async function resolveHookOptions(_0x1aef75,_0x5d01f0){const _0x590370=a37_0xc44fdd,_0x2bd291=resolveApiModelSource(_0x5d01f0[_0x590370(0x1ca)],_0x5d01f0[_0x590370(0x1a4)],_0x5d01f0['selectedAppName']||_0x5d01f0['mergedCli']?.[_0x590370(0x211)]||_0x5d01f0[_0x590370(0x1f4)]?.[_0x590370(0x1d9)]),_0x1a631b=loadAliasMap(_0x5d01f0[_0x590370(0x1ca)],undefined,_0x2bd291['filePath'],_0x2bd291[_0x590370(0x1fd)]),_0xd680af=_0x1a631b['length']>0x0;let _0x458d42,_0x4c40a8,_0x136a17;const _0x45dacd=_0x5d01f0[_0x590370(0x1e9)](_0x590370(0x20e)),_0x29c4a5=_0x5d01f0[_0x590370(0x1e9)](_0x590370(0x1dc));if(_0x45dacd){const _0xd9134a=resolveAlias(_0x5d01f0['apiDir'],_0x45dacd,undefined,_0x2bd291['filePath'],_0x2bd291['profileName']);if(!_0xd9134a){const _0x4eeade=_0xd680af?_0x590370(0x1ee)+_0x1a631b[_0x590370(0x1eb)](_0x1e142d=>_0x1e142d[_0x590370(0x20e)])[_0x590370(0x1c7)](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x590370(0x1a5)]('Alias\x20\x22'+_0x45dacd+_0x590370(0x1f3)+_0x4eeade);}_0x458d42=_0x45dacd,_0x4c40a8=_0xd9134a;}else{if(_0x29c4a5){_0x4c40a8=_0x29c4a5;const _0x3eddbf=_0x1a631b[_0x590370(0x1ea)](_0x4aad2a=>_0x4aad2a['datasetCode']===_0x29c4a5);_0x458d42=_0x3eddbf?.[_0x590370(0x20e)];}else{if(_0x5d01f0[_0x590370(0x1cb)])throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1c1));else{if(_0xd680af){const _0x5a5d0d=_0x1a631b['map'](_0x410823=>_0x410823[_0x590370(0x20e)]+'\x20('+_0x410823[_0x590370(0x206)]+')'),_0x32c982=await promptSelect(_0x590370(0x1b2),_0x5a5d0d),_0x3d396e=_0x1a631b[_0x32c982];if(!_0x3d396e)throw CliErrors['validation'](_0x590370(0x212));_0x458d42=_0x3d396e['alias'],_0x4c40a8=_0x3d396e[_0x590370(0x205)];}else{const _0x5766f4=await listDatasets(_0x5d01f0[_0x590370(0x1a4)]);if(_0x5766f4[_0x590370(0x1f8)]===0x0)throw CliErrors['validation'](_0x590370(0x1de));const _0x24c64a=_0x5766f4[_0x590370(0x1eb)](_0x1defcc=>_0x1defcc[_0x590370(0x1e6)]+'\x20['+(_0x1defcc[_0x590370(0x1cc)]??_0x590370(0x1f9))+']\x20('+_0x1defcc[_0x590370(0x1bf)]+')'),_0x116817=await promptSelect(_0x590370(0x1b2),_0x24c64a),_0x1b006e=_0x5766f4[_0x116817];if(!_0x1b006e)throw CliErrors['validation'](_0x590370(0x212));_0x4c40a8=_0x1b006e[_0x590370(0x1bf)],_0x458d42=undefined;}}}}const _0x4b2569=await listDatasets(_0x5d01f0['appCode']),_0x40de6b=_0x4b2569['find'](_0x5c207b=>_0x5c207b[_0x590370(0x1bf)]===_0x4c40a8);if(!_0x40de6b)throw CliErrors['validation'](_0x590370(0x1d0)+_0x4c40a8+_0x590370(0x20f)+(_0x458d42?_0x590370(0x1ba)+CLI_BIN_NAME+_0x590370(0x1a3):''));_0x136a17=_0x40de6b['id'];const _0x3d536c=_0x458d42??_0x4c40a8,_0x592f36=await listBffDatasetOperations(_0x5d01f0[_0x590370(0x1a4)],_0x136a17),_0x10530e=_0x592f36?Object['keys'](_0x592f36):[];if(_0x10530e[_0x590370(0x1f8)]===0x0)throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1d8)+_0x3d536c+'.');let _0x42210d;const _0x2bd6e0=_0x5d01f0[_0x590370(0x1e9)](_0x590370(0x207));if(_0x2bd6e0){if(!_0x10530e[_0x590370(0x210)](_0x2bd6e0))throw CliErrors[_0x590370(0x1a5)](_0x590370(0x20d)+_0x2bd6e0+_0x590370(0x200)+_0x3d536c+'.\x20'+('Available:\x20'+_0x10530e[_0x590370(0x1c7)](',\x20')));_0x42210d=_0x2bd6e0;}else{if(_0x5d01f0[_0x590370(0x1cb)])throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1aa));const _0x1fad3a=await promptSelect(_0x590370(0x1a2),_0x10530e);_0x42210d=_0x10530e[_0x1fad3a]??_0x10530e[0x0];}let _0x446c5c=normalizeHookFunctionNode(_0x5d01f0[_0x590370(0x1e9)]('function-node'));if(!_0x446c5c){if(_0x5d01f0['str'](_0x590370(0x1fa)))throw CliErrors[_0x590370(0x1a5)](_0x590370(0x201));if(_0x5d01f0[_0x590370(0x1cb)])throw CliErrors[_0x590370(0x1a5)](_0x590370(0x1e7));const _0x5ba115=await promptSelect(_0x590370(0x1be),[_0x590370(0x20c),_0x590370(0x203)]);_0x446c5c=['before',_0x590370(0x203)][_0x5ba115]??_0x590370(0x20c);}return{'alias':_0x458d42,'datasetCode':_0x4c40a8,'datasetId':_0x136a17,'operationType':_0x42210d,'functionNode':_0x446c5c};}async function promptSelect(_0xa5294e,_0x14b0ff){const _0x290a7a=a37_0xc44fdd;if(_0x14b0ff[_0x290a7a(0x1f8)]===0x1)return 0x0;for(const [_0x5a1524,_0x40a496]of _0x14b0ff[_0x290a7a(0x1ce)]()){process[_0x290a7a(0x1fe)][_0x290a7a(0x1e1)]('\x20\x20'+(_0x5a1524+0x1)+'.\x20'+_0x40a496+'\x0a');}const _0x79fece=createInterface({'input':process[_0x290a7a(0x1e5)],'output':process[_0x290a7a(0x1fe)]});while(!![]){const _0x2a6196=await new Promise(_0x4e3b1d=>{const _0x497fc6=_0x290a7a;_0x79fece[_0x497fc6(0x1cd)](_0xa5294e+'\x20',_0x4e3b1d);}),_0x403019=Number[_0x290a7a(0x1c5)](_0x2a6196[_0x290a7a(0x20a)](),0xa);if(Number[_0x290a7a(0x1a9)](_0x403019)&&_0x403019>=0x1&&_0x403019<=_0x14b0ff['length'])return _0x79fece[_0x290a7a(0x1a8)](),_0x403019-0x1;process[_0x290a7a(0x1fe)][_0x290a7a(0x1e1)](_0x290a7a(0x1b9)+_0x14b0ff['length']+'.\x0a');}}function buildFilePath(_0x5bd7f7,_0x13d4ea,_0x405230,_0x496431){const _0x1f46a7=a37_0xc44fdd;if(_0x13d4ea===_0x1f46a7(0x1ad)){if(!_0x496431)throw CliErrors[_0x1f46a7(0x1a5)](_0x1f46a7(0x1c9));const _0x6628d2=_0x496431[_0x1f46a7(0x20e)]??_0x496431['datasetCode'];return join(_0x5bd7f7['scriptsRootDir'],_0x1f46a7(0x1ad),_0x6628d2,_0x496431[_0x1f46a7(0x1d2)],_0x496431[_0x1f46a7(0x1f6)],_0x405230+_0x1f46a7(0x1f2));}return join(_0x5bd7f7[_0x1f46a7(0x1f7)],_0x13d4ea,_0x405230+'.js');}export function generateTemplate(_0x50096f,_0x2157d5,_0x40cb54,_0x61b382,_0x402398){const _0x3b96da=a37_0xc44fdd,_0x200c59=_0x61b382?.[_0x3b96da(0x20a)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xe46fe=getAppBaseUrl(_0x40cb54),_0xbab750=_0x3b96da(0x1b5);if(_0x50096f===_0x3b96da(0x1d7))return _0x3b96da(0x1bc)+_0x200c59+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x2157d5+_0x3b96da(0x1ed)+_0xe46fe+_0x3b96da(0x209)+_0x40cb54+_0x3b96da(0x1e8)+_0x2157d5+_0x3b96da(0x1f5)+_0x2157d5+_0x3b96da(0x1c2)+_0xbab750+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x2157d5+_0x3b96da(0x202);if(_0x50096f===_0x3b96da(0x1db))return _0x3b96da(0x1bc)+_0x200c59+_0x3b96da(0x1cf)+_0x2157d5+_0x3b96da(0x1ef)+_0x40cb54+'/'+_0x2157d5+_0x3b96da(0x1ed)+_0xe46fe+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x40cb54+_0x3b96da(0x204)+_0x2157d5+_0x3b96da(0x1c8)+_0xbab750+_0x3b96da(0x1af)+_0x2157d5+_0x3b96da(0x202);if(!_0x402398)throw CliErrors[_0x3b96da(0x1a5)](_0x3b96da(0x1b8));const _0x3cff16=_0x402398['alias']??_0x402398[_0x3b96da(0x205)],_0x322f23=_0x402398['functionNode']===_0x3b96da(0x20c)?'当前请求参数':_0x3b96da(0x1f1),_0x4bee71=_0x402398[_0x3b96da(0x1f6)]===_0x3b96da(0x20c)?_0x3b96da(0x1ec):_0x3b96da(0x1da);return _0x3b96da(0x1bc)+_0x200c59+_0x3b96da(0x1b1)+_0x2157d5+_0x3b96da(0x1fb)+_0x40cb54+'/'+_0x402398[_0x3b96da(0x205)]+'/'+_0x402398['operationType']+_0x3b96da(0x1ed)+_0xe46fe+_0x3b96da(0x208)+_0x402398[_0x3b96da(0x1e3)]+_0x3b96da(0x1c0)+_0x40cb54+_0x3b96da(0x1bb)+_0x3cff16+'/'+_0x402398[_0x3b96da(0x1d2)]+'/'+_0x402398[_0x3b96da(0x1f6)]+'/'+_0x2157d5+'.js\x0a\x20*\x20[触发节点]\x20'+_0x402398['functionNode']+'\x0a'+_0xbab750+_0x3b96da(0x1e2)+_0x322f23+_0x3b96da(0x1ac)+_0x4bee71+_0x3b96da(0x1fc)+_0x2157d5+_0x3b96da(0x202);}
|
|
1
|
+
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
|
-
function
|
|
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
|
-
const
|
|
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_0x54976f=a43_0x510b;(function(_0x1a0188,_0x28c3c1){const _0x29bd38=a43_0x510b,_0xfb992a=_0x1a0188();while(!![]){try{const _0x12ee29=parseInt(_0x29bd38(0x22d))/0x1+parseInt(_0x29bd38(0x26a))/0x2+parseInt(_0x29bd38(0x26f))/0x3+parseInt(_0x29bd38(0x258))/0x4+parseInt(_0x29bd38(0x1ff))/0x5+-parseInt(_0x29bd38(0x257))/0x6*(-parseInt(_0x29bd38(0x25b))/0x7)+parseInt(_0x29bd38(0x202))/0x8*(-parseInt(_0x29bd38(0x246))/0x9);if(_0x12ee29===_0x28c3c1)break;else _0xfb992a['push'](_0xfb992a['shift']());}catch(_0x14f708){_0xfb992a['push'](_0xfb992a['shift']());}}}(a43_0x41eb,0x77ca5));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x54976f(0x276),'command':a43_0x54976f(0x25e),'description':a43_0x54976f(0x260),'risk':a43_0x54976f(0x1fd),'structuredErrors':!![],'flags':[{'name':a43_0x54976f(0x230),'type':a43_0x54976f(0x219),'description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x54976f(0x1f5),'ENDPOINT',a43_0x54976f(0x22a)]},{'name':a43_0x54976f(0x1e6),'type':a43_0x54976f(0x26b),'description':a43_0x54976f(0x255)}],async 'dryRun'(_0x738562){const _0x41fa42=a43_0x54976f,_0x1f232f=loadBffProjectConfig(_0x738562[_0x41fa42(0x20c)]),_0x28d9a5=await readBffLockFile(_0x1f232f['lockFilePath']),{appLock:_0x15be34}=ensureLockScope(_0x28d9a5??createEmptyBffLock(),_0x738562['appCode'],_0x1f232f[_0x41fa42(0x233)],_0x41fa42(0x25e)),_0x44546a=normalizeBffType(_0x738562[_0x41fa42(0x256)](_0x41fa42(0x230)))??undefined,[_0xffcc51,_0x22aa10]=await Promise[_0x41fa42(0x1e3)]([listBffScripts(_0x738562[_0x41fa42(0x20c)],_0x44546a),getBffScriptStatistics(_0x738562[_0x41fa42(0x20c)])]),_0x147cf2=_0xffcc51[_0x41fa42(0x212)](_0x52aace=>normalizeBffType(_0x52aace[_0x41fa42(0x205)])==='HOOK'),_0x1b6704=_0x147cf2?buildDatasetCodeToAliasMap(_0x738562[_0x41fa42(0x1f1)],_0x738562[_0x41fa42(0x20c)],_0x738562[_0x41fa42(0x239)]||_0x738562['mergedCli']?.['currentApp']||_0x738562[_0x41fa42(0x254)]?.[_0x41fa42(0x20f)]):new Map(),_0x2b64cb=_0x147cf2?await planHookDirectoryMigration(_0x1f232f,_0x15be34,_0x1b6704,await scanLocalBffFunctions(_0x1f232f,_0x41fa42(0x22a))):undefined,_0x16e129=createHookLocationMap(_0x22aa10),_0xdbd284=[];for(const _0x34966b of _0xffcc51){const _0x343ba1=resolveRemoteScriptTarget(_0x1f232f,_0x34966b,_0x16e129,_0x2b64cb?.[_0x41fa42(0x275)]??_0x15be34[_0x41fa42(0x244)],_0x1b6704);if(!_0x343ba1){_0xdbd284[_0x41fa42(0x21d)]({'scriptType':_0x34966b[_0x41fa42(0x205)],'functionName':_0x34966b[_0x41fa42(0x20d)]??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x82ac86=(_0x2b64cb?.[_0x41fa42(0x275)]??_0x15be34['functions'])[_0x343ba1[_0x41fa42(0x24f)]],_0x495048=_0x34966b['scriptContent']!=null?computeContentHash(_0x34966b[_0x41fa42(0x23b)]):undefined,_0x4129b8=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x2b64cb,_0x343ba1)??_0x343ba1['filePath'],_0x82ac86,_0x495048),_0x1eaa4a=_0x4129b8?localUnsyncedConflict(_0x343ba1,_0x34966b['id']):undefined;_0xdbd284['push']({'lockKey':_0x343ba1['lockKey'],'filePath':_0x343ba1[_0x41fa42(0x26e)],'remoteId':_0x34966b['id']??null,'status':_0x1eaa4a?_0x41fa42(0x1f4):_0x41fa42(0x1ea),..._0x1eaa4a?{'conflict':_0x1eaa4a}:{},..._0x343ba1['hookLocation']?{'alias':_0x343ba1['hookLocation']['alias']??null,'datasetCode':_0x343ba1[_0x41fa42(0x266)][_0x41fa42(0x249)],'operationType':_0x343ba1[_0x41fa42(0x266)][_0x41fa42(0x226)],'functionNode':_0x343ba1[_0x41fa42(0x266)]['functionNode']}:{}});}return{'method':'GET','url':_0x41fa42(0x20b)+_0x738562[_0x41fa42(0x20c)]+(_0x44546a?_0x41fa42(0x21e)+_0x44546a:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x738562[_0x41fa42(0x20c)],'filterType':_0x44546a??null,..._0x2b64cb&&_0x2b64cb['migrations'][_0x41fa42(0x209)]>0x0?{'hookDirectoryMigrations':_0x2b64cb[_0x41fa42(0x277)][_0x41fa42(0x262)](_0x1cab8b=>({'from':_0x1cab8b[_0x41fa42(0x273)],'to':_0x1cab8b[_0x41fa42(0x22c)]}))}:{},'files':_0xdbd284},'description':_0x41fa42(0x23a)+_0xdbd284[_0x41fa42(0x209)]+_0x41fa42(0x24e)};},async 'execute'(_0x5ebd89){const _0x40d251=a43_0x54976f,_0x6d59f3=loadBffProjectConfig(_0x5ebd89[_0x40d251(0x20c)]),_0x118efd=await readBffLockFile(_0x6d59f3[_0x40d251(0x217)]),{lockData:_0x1cda68,appLock:_0xa09d38}=ensureLockScope(_0x118efd??createEmptyBffLock(),_0x5ebd89[_0x40d251(0x20c)],_0x6d59f3[_0x40d251(0x233)],_0x40d251(0x25e)),_0x5e47b4=normalizeBffType(_0x5ebd89[_0x40d251(0x256)](_0x40d251(0x230)))??undefined;if(_0x5ebd89[_0x40d251(0x256)]('type')&&!_0x5e47b4)throw CliErrors[_0x40d251(0x264)](_0x40d251(0x236));const [_0x187265,_0x391f5e]=await Promise[_0x40d251(0x1e3)]([listBffScripts(_0x5ebd89['appCode'],_0x5e47b4),getBffScriptStatistics(_0x5ebd89['appCode'])]);if(_0x187265[_0x40d251(0x209)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x40d251(0x22f)};const _0x25f572=_0x5ebd89[_0x40d251(0x274)](_0x40d251(0x1e6));if(_0x25f572&&!_0x5ebd89[_0x40d251(0x203)]){const _0x3e7229=await confirmForce();if(!_0x3e7229)throw CliErrors[_0x40d251(0x232)](_0x40d251(0x259));}if(_0x25f572&&_0x5ebd89[_0x40d251(0x203)]){}const _0x3ca6bc=_0x187265[_0x40d251(0x212)](_0x46609f=>normalizeBffType(_0x46609f['scriptType'])===_0x40d251(0x22a)),_0x5d5c12=_0x3ca6bc?buildDatasetCodeToAliasMap(_0x5ebd89['apiDir'],_0x5ebd89['appCode'],_0x5ebd89[_0x40d251(0x239)]||_0x5ebd89[_0x40d251(0x254)]?.['currentApp']||_0x5ebd89['mergedCli']?.['defaultApp']):new Map(),_0x41bf59=createHookLocationMap(_0x391f5e),_0x4fde7d=JSON[_0x40d251(0x25a)](JSON[_0x40d251(0x1ed)](_0x1cda68)),_0x2d1de1=_0x5ebd89[_0x40d251(0x20c)],_0xa0e252=_0x4fde7d[_0x40d251(0x1f8)][_0x2d1de1];if(!_0xa0e252)throw new Error(_0x40d251(0x26d)+_0x2d1de1+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x4c546f=_0x3ca6bc?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x6d59f3,_0xa0e252,_0x5d5c12,await scanLocalBffFunctions(_0x6d59f3,_0x40d251(0x22a))),_0xa0e252):undefined,_0x19bbe4=createPullFileTransaction(),_0x3a72c9=[],_0xf8b0a7=[],_0x41f556=[],_0x2a4d74=[];for(const _0x2ba62f of _0x187265){const _0x14001c=resolveRemoteScriptTarget(_0x6d59f3,_0x2ba62f,_0x41bf59,_0xa0e252['functions'],_0x5d5c12);if(!_0x14001c){_0xf8b0a7['push']({'lockKey':_0x2ba62f[_0x40d251(0x205)]+'/'+_0x2ba62f['functionName'],'reason':_0x40d251(0x207)});continue;}const _0x37052b=_0xa0e252['functions'][_0x14001c[_0x40d251(0x24f)]];try{if(!_0x2ba62f['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x2ba62f[_0x40d251(0x23b)]==null)throw new Error(_0x40d251(0x267));const _0x36c84f=_0x2ba62f[_0x40d251(0x23b)],_0x2980c3=computeContentHash(_0x36c84f);if(!_0x25f572){const _0x2bc51a=await hasUnsyncedLocalChanges(_0x14001c[_0x40d251(0x26e)],_0x37052b,_0x2980c3);if(_0x2bc51a){_0x41f556[_0x40d251(0x21d)](localUnsyncedConflict(_0x14001c,_0x2ba62f['id']));continue;}}await _0x19bbe4[_0x40d251(0x251)](_0x14001c['filePath'],_0x36c84f);const _0x61e71c={'hash':_0x2980c3,'remoteId':_0x2ba62f['id'],'version':_0x2ba62f[_0x40d251(0x204)]};_0x14001c['type']===_0x40d251(0x22a)&&_0x14001c[_0x40d251(0x266)]&&(_0x61e71c['alias']=_0x14001c[_0x40d251(0x266)]['alias'],_0x61e71c[_0x40d251(0x249)]=_0x14001c[_0x40d251(0x266)][_0x40d251(0x249)],_0x61e71c[_0x40d251(0x226)]=_0x14001c[_0x40d251(0x266)][_0x40d251(0x226)],_0x61e71c['functionNode']=_0x14001c[_0x40d251(0x266)][_0x40d251(0x248)]),_0xa0e252['functions'][_0x14001c[_0x40d251(0x24f)]]=_0x61e71c,_0x3a72c9[_0x40d251(0x21d)]({'lockKey':_0x14001c['lockKey'],'remoteId':_0x2ba62f['id']});}catch(_0x1496f4){_0x2a4d74[_0x40d251(0x21d)]({'lockKey':_0x14001c[_0x40d251(0x24f)],'error':_0x1496f4 instanceof Error?_0x1496f4[_0x40d251(0x268)]:String(_0x1496f4)});}}_0xa0e252['lastSync']=new Date()[_0x40d251(0x231)]();try{await writeBffLockFile(_0x6d59f3[_0x40d251(0x217)],_0x4fde7d);}catch(_0x3dbcf4){const _0x281b7b=[...await _0x19bbe4['rollback'](),...await _0x4c546f?.[_0x40d251(0x250)]()??[]];throw withRollbackErrors(_0x3dbcf4,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x281b7b);}return{'ok':_0x2a4d74[_0x40d251(0x209)]===0x0,'data':{'pulled':_0x3a72c9,'skipped':_0xf8b0a7,'conflicts':_0x41f556,'failed':_0x2a4d74},'message':formatPullMessage(_0x3a72c9[_0x40d251(0x209)],_0xf8b0a7[_0x40d251(0x209)],_0x41f556[_0x40d251(0x209)],_0x2a4d74[_0x40d251(0x209)])};}};function localUnsyncedConflict(_0x1bfdc0,_0x4164db){const _0x45828d=a43_0x54976f,_0xc75244=_0x1bfdc0[_0x45828d(0x24f)][_0x45828d(0x269)]('/')['at'](-0x1);return{'code':_0x45828d(0x208),'lockKey':_0x1bfdc0[_0x45828d(0x24f)],'filePath':_0x1bfdc0[_0x45828d(0x26e)],..._0x4164db!=null?{'remoteId':_0x4164db}:{},'message':_0x45828d(0x222),'nextAction':{'action':_0x45828d(0x23c),'command':CLI_BIN_NAME+_0x45828d(0x21f)+_0x1bfdc0[_0x45828d(0x230)]+_0x45828d(0x1fa)+_0xc75244+_0x45828d(0x238),'requiresReview':!![],'message':_0x45828d(0x223)}};}function formatPullMessage(_0xe5e28c,_0x2d0f85,_0x34ddfa,_0x462ad7){const _0x5e44ff=a43_0x54976f,_0x20392c=[_0x5e44ff(0x24d)+_0xe5e28c+_0x5e44ff(0x200),_0x2d0f85+_0x5e44ff(0x253)];_0x34ddfa>0x0&&_0x20392c['push'](_0x34ddfa+_0x5e44ff(0x211)+(_0x34ddfa===0x1?'':'s')+'\x20'+(_0x34ddfa===0x1?_0x5e44ff(0x247):_0x5e44ff(0x263))+_0x5e44ff(0x24a));if(_0x462ad7>0x0)_0x20392c['push'](_0x462ad7+_0x5e44ff(0x228));return _0x20392c[_0x5e44ff(0x224)](',\x20');}async function hasUnsyncedLocalChanges(_0x1cfcef,_0x29ac99,_0x4f730a){if(!await fileExists(_0x1cfcef))return![];const _0x2cdd23=await computeFileHash(_0x1cfcef);if(!_0x29ac99)return _0x4f730a?_0x2cdd23!==_0x4f730a:!![];return _0x2cdd23!==_0x29ac99['hash'];}function createPullFileTransaction(){const _0x14e45e=new Map(),_0x281cfe=async(_0x49a9a0,_0x36779c)=>{const _0x78686d=a43_0x510b;try{if(_0x36779c['existed'])await ensureParentDirectory(_0x49a9a0),await writeFile(_0x49a9a0,_0x36779c[_0x78686d(0x237)]);else try{await unlink(_0x49a9a0);}catch(_0x506dcd){if(_0x506dcd['code']!==_0x78686d(0x1e4))throw _0x506dcd;}return undefined;}catch(_0x5549d6){return _0x5549d6 instanceof Error?_0x5549d6:new Error(String(_0x5549d6));}};return{async 'write'(_0x2e936e,_0x1335d6){const _0x47a519=a43_0x510b;if(!_0x14e45e['has'](_0x2e936e))try{_0x14e45e[_0x47a519(0x245)](_0x2e936e,{'existed':!![],'content':await readFile(_0x2e936e)});}catch(_0x3314fb){if(_0x3314fb[_0x47a519(0x1ef)]!==_0x47a519(0x1e4))throw _0x3314fb;_0x14e45e[_0x47a519(0x245)](_0x2e936e,{'existed':![]});}try{await ensureParentDirectory(_0x2e936e),await writeFile(_0x2e936e,_0x1335d6,_0x47a519(0x1f7));}catch(_0x488a70){const _0x3e4574=await _0x281cfe(_0x2e936e,_0x14e45e['get'](_0x2e936e));if(!_0x3e4574)_0x14e45e[_0x47a519(0x22b)](_0x2e936e);throw withRollbackErrors(_0x488a70,_0x47a519(0x25d)+_0x2e936e+'\x22.',_0x3e4574?[_0x3e4574]:[]);}},async 'rollback'(){const _0x45b0fc=a43_0x510b,_0x267cd9=[];for(const [_0x1dea60,_0xbb8cf6]of[..._0x14e45e[_0x45b0fc(0x214)]()][_0x45b0fc(0x22e)]()){const _0x1f6a8b=await _0x281cfe(_0x1dea60,_0xbb8cf6);_0x1f6a8b&&_0x267cd9[_0x45b0fc(0x21d)](new Error(_0x45b0fc(0x221)+_0x1dea60+_0x45b0fc(0x265)+_0x1f6a8b[_0x45b0fc(0x268)]));}return _0x267cd9;}};}function withRollbackErrors(_0xd097e5,_0x365f55,_0x5e4d4c){const _0x19296e=a43_0x54976f,_0x3517f8=_0xd097e5 instanceof Error?_0xd097e5:new Error(String(_0xd097e5));if(_0x5e4d4c[_0x19296e(0x209)]===0x0)return _0x3517f8;return new AggregateError([_0x3517f8,..._0x5e4d4c],_0x365f55+'\x20Recovery\x20errors:\x20'+_0x5e4d4c[_0x19296e(0x262)](_0x315976=>_0x315976[_0x19296e(0x268)])[_0x19296e(0x224)](';\x20'));}function buildDatasetCodeToAliasMap(_0x518c0a,_0x4a25a0,_0x14d058){const _0x270a09=a43_0x54976f,_0x344f8f=resolveApiModelSource(_0x518c0a,_0x4a25a0,_0x14d058),_0x5b04a1=loadAliasMap(_0x518c0a,undefined,_0x344f8f[_0x270a09(0x26e)],_0x344f8f['profileName']);return assertUnambiguousHookAliases(_0x5b04a1),new Map(_0x5b04a1[_0x270a09(0x262)](_0x414741=>[_0x414741[_0x270a09(0x249)][_0x270a09(0x20a)](),_0x414741[_0x270a09(0x25f)]]));}async function planHookDirectoryMigration(_0x57b0d6,_0x554fd7,_0x1a8580,_0x3b68d9){const _0x3b19a6=a43_0x54976f,_0x2c6299=new Map();for(const [_0x468e8f,_0x2af7d9]of Object[_0x3b19a6(0x214)](_0x554fd7[_0x3b19a6(0x244)])){const [_0x5aa786,_0x4c8276,_0x153801,_0x263495,_0x1f4df4,..._0x1e7c51]=_0x468e8f[_0x3b19a6(0x269)]('/');if(_0x5aa786!==_0x3b19a6(0x22a)||!_0x4c8276||!_0x153801||!_0x263495||!_0x1f4df4||_0x1e7c51[_0x3b19a6(0x209)]>0x0||!_0x2af7d9['datasetCode'])continue;const _0x5e5293=_0x1a8580[_0x3b19a6(0x210)](_0x2af7d9['datasetCode'][_0x3b19a6(0x20a)]()),_0x255fec=_0x5e5293??_0x2af7d9[_0x3b19a6(0x249)];if(!isSafeHookDirectorySegment(_0x4c8276))throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x24c)+_0x4c8276+_0x3b19a6(0x252));if(!isSafeHookDirectorySegment(_0x255fec))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x4c8276+_0x3b19a6(0x241));if(_0x4c8276===_0x255fec)continue;const _0x276ae9=_0x2c6299[_0x3b19a6(0x210)](_0x4c8276)??{'datasetCode':_0x2af7d9[_0x3b19a6(0x249)],'alias':_0x5e5293,'keyChanges':[]};if(_0x276ae9[_0x3b19a6(0x249)]!==_0x2af7d9[_0x3b19a6(0x249)])throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x4c8276+_0x3b19a6(0x243));const _0x1f970a=_0x3b19a6(0x1fe)+_0x255fec+'/'+_0x153801+'/'+_0x263495+'/'+_0x1f4df4;try{resolveLocalFilePathFromLockKey(_0x57b0d6,_0x468e8f),resolveLocalFilePathFromLockKey(_0x57b0d6,_0x1f970a);}catch(_0x227378){throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x272)+_0x468e8f+_0x3b19a6(0x265)+(_0x227378 instanceof Error?_0x227378['message']:String(_0x227378)));}_0x276ae9[_0x3b19a6(0x1f6)][_0x3b19a6(0x21d)]({'oldLockKey':_0x468e8f,'newLockKey':_0x1f970a,'entry':_0x2af7d9}),_0x2c6299[_0x3b19a6(0x245)](_0x4c8276,_0x276ae9);}const _0x57de56=new Set([..._0x2c6299[_0x3b19a6(0x21a)]()][_0x3b19a6(0x1e5)](_0x4ee1f7=>_0x4ee1f7[_0x3b19a6(0x1f6)][_0x3b19a6(0x262)](_0x564c37=>_0x564c37['oldLockKey']))),_0x7770e7=new Map(),_0x1abce9=new Map();for(const [_0xc02a2a,_0x2de086]of _0x2c6299){const _0x48abef=_0x2de086[_0x3b19a6(0x25f)]??_0x2de086['datasetCode'],_0x3c03bf=hookDirectoryIdentity(_0x48abef),_0x37ff82=_0x7770e7['get'](_0x3c03bf);if(_0x37ff82&&_0x37ff82!==_0xc02a2a)throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x23e)+_0x37ff82+_0x3b19a6(0x220)+_0xc02a2a+_0x3b19a6(0x261)+_0x48abef+_0x3b19a6(0x1e2));_0x7770e7[_0x3b19a6(0x245)](_0x3c03bf,_0xc02a2a);for(const _0x1971ad of _0x2de086[_0x3b19a6(0x1f6)]){const _0x328662=_0x1abce9[_0x3b19a6(0x210)](_0x1971ad[_0x3b19a6(0x229)]);if(_0x328662&&_0x328662!==_0x1971ad[_0x3b19a6(0x227)])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x328662+_0x3b19a6(0x220)+_0x1971ad[_0x3b19a6(0x227)]+'\x22:\x20both\x20target\x20\x22'+_0x1971ad[_0x3b19a6(0x229)]+_0x3b19a6(0x1f0));if(_0x57de56['has'](_0x1971ad['newLockKey']))throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x206)+_0x1971ad[_0x3b19a6(0x227)]+'\x22:\x20its\x20target\x20\x22'+_0x1971ad[_0x3b19a6(0x229)]+_0x3b19a6(0x1e1));_0x1abce9[_0x3b19a6(0x245)](_0x1971ad[_0x3b19a6(0x229)],_0x1971ad[_0x3b19a6(0x227)]);}}const _0xd83048=new Map();for(const [_0x84e042,_0xc3d855]of _0x1a8580){_0xd83048[_0x3b19a6(0x245)](hookDirectoryIdentity(_0xc3d855),_0x84e042);}const _0xda566f=[];for(const [_0x5f4f8b,_0x13b51a]of _0x2c6299){const _0x1231fa=_0x13b51a['alias']??_0x13b51a['datasetCode'],_0x3f1ae9=join(_0x57b0d6[_0x3b19a6(0x21b)],_0x3b19a6(0x22a),_0x5f4f8b),_0x25521d=join(_0x57b0d6[_0x3b19a6(0x21b)],'HOOK',_0x1231fa),_0x3a68f2=await directoryExists(_0x3f1ae9),_0x764fd9=await directoryExists(_0x25521d),_0xa6462=_0x3a68f2?_0x764fd9?await sameDirectory(_0x3f1ae9,_0x25521d)?_0x3b19a6(0x1e7):undefined:_0x3b19a6(0x1eb):_0x3b19a6(0x218);if(!_0xa6462)throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+_0x3b19a6(0x1ee)+_0x1231fa+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x35247c=_0xd83048[_0x3b19a6(0x210)](hookDirectoryIdentity(_0x5f4f8b));if(_0x35247c&&_0x35247c!==_0x13b51a[_0x3b19a6(0x249)][_0x3b19a6(0x20a)]()){const _0x3da436=new Set(_0x13b51a[_0x3b19a6(0x1f6)]['map'](_0x1bd4bf=>_0x1bd4bf['oldLockKey'])),_0x433c27=_0x3b68d9['filter'](_0x1391b6=>_0x1391b6['type']===_0x3b19a6(0x22a)&&_0x1391b6[_0x3b19a6(0x25f)]!=null&&hookDirectoryIdentity(_0x1391b6[_0x3b19a6(0x25f)])===hookDirectoryIdentity(_0x5f4f8b)&&!_0x3da436['has'](_0x1391b6[_0x3b19a6(0x24f)]));if(_0x433c27[_0x3b19a6(0x209)]>0x0)throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+_0x3b19a6(0x23f));}const _0x3169a0=_0xd83048[_0x3b19a6(0x210)](hookDirectoryIdentity(_0x1231fa));if(_0x3169a0&&_0x3169a0!==_0x13b51a[_0x3b19a6(0x249)][_0x3b19a6(0x20a)]())throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+_0x3b19a6(0x1ee)+_0x1231fa+_0x3b19a6(0x216));for(const _0x575fba of _0x13b51a[_0x3b19a6(0x1f6)]){const _0x244f70=_0x554fd7[_0x3b19a6(0x244)][_0x575fba[_0x3b19a6(0x229)]];if(_0x244f70&&!_0x57de56[_0x3b19a6(0x1e8)](_0x575fba[_0x3b19a6(0x229)])&&!sameHookIdentity(_0x575fba[_0x3b19a6(0x271)],_0x244f70))throw CliErrors[_0x3b19a6(0x264)](_0x3b19a6(0x234)+_0x5f4f8b+'\x22\x20to\x20\x22'+_0x1231fa+_0x3b19a6(0x1f3));}_0xda566f[_0x3b19a6(0x21d)]({'oldDirectory':_0x5f4f8b,'newDirectory':_0x1231fa,'oldDirectoryPath':_0x3f1ae9,'newDirectoryPath':_0x25521d,'mode':_0xa6462,'alias':_0x13b51a[_0x3b19a6(0x25f)],'keyChanges':_0x13b51a['keyChanges']});}const _0x1f1144={..._0x554fd7['functions']},_0x41a6ae=new Map(),_0x438f2c=new Map();for(const _0x47b7ad of _0xda566f){const _0x57bf78=_0x47b7ad[_0x3b19a6(0x278)]!==_0x3b19a6(0x218);_0x57bf78&&_0x438f2c[_0x3b19a6(0x245)](hookDirectoryIdentity(_0x47b7ad[_0x3b19a6(0x22c)]),_0x47b7ad[_0x3b19a6(0x235)]);for(const _0x4c761e of _0x47b7ad[_0x3b19a6(0x1f6)]){const _0x42c0ef=_0x1f1144[_0x4c761e[_0x3b19a6(0x229)]],_0x3b8060=_0x57bf78?_0x4c761e[_0x3b19a6(0x271)]:_0x42c0ef??_0x4c761e[_0x3b19a6(0x271)];_0x1f1144[_0x4c761e['newLockKey']]=canonicalizeHookEntry(_0x3b8060,_0x47b7ad[_0x3b19a6(0x25f)]),delete _0x1f1144[_0x4c761e[_0x3b19a6(0x227)]],_0x57bf78&&_0x41a6ae[_0x3b19a6(0x245)](_0x4c761e[_0x3b19a6(0x229)],resolveLocalFilePathFromLockKey(_0x57b0d6,_0x4c761e[_0x3b19a6(0x227)]));}}return{'migrations':_0xda566f,'projectedFunctions':_0x1f1144,'sourceFilePathByNewLockKey':_0x41a6ae,'sourceDirectoryPathByNewDirectory':_0x438f2c};}function a43_0x41eb(){const _0x4d6e1f=['Remote\x20script\x20missing\x20content.','message','split','1853584vZfNOO','boolean','lastSync','Lock\x20scope\x20for\x20app\x20\x22','filePath','2323365XLnHrG','newDirectoryPath','entry','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','oldDirectory','bool','projectedFunctions','bff','migrations','mode','close','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','all','ENOENT','flatMap','force','case-rename','has','yes','would_pull','move','sourceDirectoryPathByNewDirectory','stringify','\x22\x20to\x20\x22','code','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','apiDir','remoteId','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','conflict','COMMON','keyChanges','utf8','apps','includes','\x20--name\x20','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','dev','read','HOOK/','1787395LHvBli','\x20pulled','stderr','6607864EXQvaZ','nonInteractive','version','scriptType','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','unresolvable\x20target\x20path','BFF_LOCAL_UNSYNCED','length','toLowerCase','/api/management/library/scripts/list?appCode=','appCode','functionName','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','defaultApp','get','\x20conflict','some','.hook-directory-migrate-','entries','sourceFilePathByNewLockKey','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','lockFilePath','rekey','string','values','scriptsRootDir','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','push','&type=','\x20bff\x20push\x20--type\x20','\x22\x20and\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.','join','stdin','operationType','oldLockKey','\x20failed','newLockKey','HOOK','delete','newDirectory','80396NUWyDs','reverse','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','type','toISOString','cancelled','scriptsRoot','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','oldDirectoryPath','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','content','\x20--format\x20compress','selectedAppName','Would\x20inspect\x20','scriptContent','push_local','.js','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','\x22;\x20temporary\x20directory\x20\x22','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','NFC','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','functions','set','36AuUrpu','requires','functionNode','datasetCode','\x20resolution','ino','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Pull\x20complete:\x20','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','lockKey','rollback','write','\x22\x20from\x20the\x20lock\x20file.','\x20skipped','mergedCli','Force\x20overwrite\x20local\x20unsynced\x20changes','str','6tzBigZ','3825696dVRZSI','Force\x20pull\x20cancelled.','parse','4893329CQySAG','\x22\x20from\x20\x22','Failed\x20to\x20write\x20local\x20script\x20\x22','pull','alias','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','\x22:\x20both\x20target\x20\x22','map','require','validation','\x22:\x20','hookLocation'];a43_0x41eb=function(){return _0x4d6e1f;};return a43_0x41eb();}function resolveMigratedSourceFilePath(_0x444245,_0x54740a){const _0x396f2e=a43_0x54976f;if(!_0x444245||!_0x54740a)return undefined;const _0x33e709=_0x444245[_0x396f2e(0x215)][_0x396f2e(0x210)](_0x54740a['lockKey']);if(_0x33e709)return _0x33e709;if(_0x54740a['type']!==_0x396f2e(0x22a))return undefined;const [,_0x243f58,..._0x57b16d]=_0x54740a[_0x396f2e(0x24f)][_0x396f2e(0x269)]('/');if(!_0x243f58||_0x57b16d['length']===0x0)return undefined;const _0x4d7d4d=_0x444245[_0x396f2e(0x1ec)][_0x396f2e(0x210)](hookDirectoryIdentity(_0x243f58));return _0x4d7d4d?join(_0x4d7d4d,..._0x57b16d)+_0x396f2e(0x23d):undefined;}function sameHookIdentity(_0x20fed6,_0x1f0f55){const _0x53f33c=a43_0x54976f;return _0x20fed6[_0x53f33c(0x1f2)]===_0x1f0f55[_0x53f33c(0x1f2)]&&_0x20fed6[_0x53f33c(0x249)]===_0x1f0f55[_0x53f33c(0x249)]&&_0x20fed6[_0x53f33c(0x226)]===_0x1f0f55[_0x53f33c(0x226)]&&_0x20fed6[_0x53f33c(0x248)]===_0x1f0f55[_0x53f33c(0x248)];}function canonicalizeHookEntry(_0x24fda6,_0x419752){const {alias:_0xfd35db,..._0x5ec793}=_0x24fda6;return _0x419752?{..._0x5ec793,'alias':_0x419752}:_0x5ec793;}function hookDirectoryIdentity(_0x1d1d6f){const _0x1f0e31=a43_0x54976f;return _0x1d1d6f['normalize'](_0x1f0e31(0x242))[_0x1f0e31(0x20a)]();}function isSafeHookDirectorySegment(_0x2b6f07){return isSafeLockKeySegment(_0x2b6f07);}async function sameDirectory(_0x46334f,_0x1d61a2){const _0x5823ae=a43_0x54976f,[_0x3dcafe,_0x3efe12]=await Promise[_0x5823ae(0x1e3)]([stat(_0x46334f),stat(_0x1d61a2)]);return _0x3dcafe[_0x5823ae(0x1fc)]===_0x3efe12['dev']&&_0x3dcafe[_0x5823ae(0x24b)]===_0x3efe12['ino'];}async function applyHookDirectoryMigration(_0x55b785,_0x2830dd){const _0x104ba4=a43_0x54976f,_0x48cfea=_0x2830dd[_0x104ba4(0x244)],_0x475475=_0x2830dd[_0x104ba4(0x26c)],_0x4fcd86=[],_0x59e83f=async()=>{const _0x41829f=_0x104ba4,_0x58171a=[];_0x2830dd[_0x41829f(0x244)]=_0x48cfea,_0x2830dd[_0x41829f(0x26c)]=_0x475475;for(const {migration:_0x2cf2a3,temporaryPath:_0x1c3d69}of[..._0x4fcd86][_0x41829f(0x22e)]()){try{_0x1c3d69?(await rename(_0x2cf2a3[_0x41829f(0x270)],_0x1c3d69),await rename(_0x1c3d69,_0x2cf2a3[_0x41829f(0x235)])):await rename(_0x2cf2a3[_0x41829f(0x270)],_0x2cf2a3[_0x41829f(0x235)]);}catch(_0x4ad7a1){_0x58171a[_0x41829f(0x21d)](new Error(_0x41829f(0x20e)+_0x2cf2a3['oldDirectory']+_0x41829f(0x25c)+_0x2cf2a3[_0x41829f(0x22c)]+_0x41829f(0x265)+(_0x4ad7a1 instanceof Error?_0x4ad7a1[_0x41829f(0x268)]:String(_0x4ad7a1))));}}return _0x58171a;};try{for(const _0x58235b of _0x55b785[_0x104ba4(0x277)]){if(_0x58235b['mode']===_0x104ba4(0x1eb))await ensureParentDirectory(_0x58235b[_0x104ba4(0x270)]),await rename(_0x58235b[_0x104ba4(0x235)],_0x58235b['newDirectoryPath']),_0x4fcd86['push']({'migration':_0x58235b});else{if(_0x58235b[_0x104ba4(0x278)]===_0x104ba4(0x1e7)){const _0x68794=join(dirname(_0x58235b['oldDirectoryPath']),_0x104ba4(0x213)+randomUUID());await rename(_0x58235b['oldDirectoryPath'],_0x68794);try{await rename(_0x68794,_0x58235b['newDirectoryPath']);}catch(_0x7fffde){try{await rename(_0x68794,_0x58235b[_0x104ba4(0x235)]);}catch(_0x1de994){throw withRollbackErrors(_0x7fffde,_0x104ba4(0x27a)+_0x58235b[_0x104ba4(0x273)]+_0x104ba4(0x1ee)+_0x58235b[_0x104ba4(0x22c)]+_0x104ba4(0x240)+_0x68794+'\x22\x20may\x20remain.',[new Error(_0x104ba4(0x1fb)+_0x68794+'\x22\x20to\x20\x22'+_0x58235b[_0x104ba4(0x273)]+'\x22:\x20'+(_0x1de994 instanceof Error?_0x1de994[_0x104ba4(0x268)]:String(_0x1de994)))]);}throw _0x7fffde;}_0x4fcd86['push']({'migration':_0x58235b,'temporaryPath':_0x68794});}}}return _0x2830dd[_0x104ba4(0x244)]=_0x55b785[_0x104ba4(0x275)],{'rollback':_0x59e83f};}catch(_0x4acf31){const _0x14e229=await _0x59e83f();throw withRollbackErrors(_0x4acf31,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x14e229);}}function a43_0x510b(_0x41541f,_0x1e843a){_0x41541f=_0x41541f-0x1e1;const _0x41eb57=a43_0x41eb();let _0x510bbd=_0x41eb57[_0x41541f];return _0x510bbd;}async function confirmForce(){const _0x4c5ec=a43_0x54976f,_0x1df691=createInterface({'input':process[_0x4c5ec(0x225)],'output':process[_0x4c5ec(0x201)]}),_0x7aaa9b=await new Promise(_0x1fa684=>{const _0x55c245=_0x4c5ec;_0x1df691['question'](_0x55c245(0x21c),_0x1fa684);});return _0x1df691[_0x4c5ec(0x279)](),['y',_0x4c5ec(0x1e9)][_0x4c5ec(0x1f9)](_0x7aaa9b['trim']()['toLowerCase']());}
|
|
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']());}
|