@lovrabet/rabetbase-cli 2.5.5 → 2.5.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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.d.ts +40 -0
- package/lib/commands/db/cross-db-analysis-shared.js +1 -0
- package/lib/commands/db/cross-db-analyze-latest.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-latest.js +1 -0
- package/lib/commands/db/cross-db-analyze-start.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-start.js +1 -0
- package/lib/commands/db/cross-db-analyze-status.d.ts +2 -0
- package/lib/commands/db/cross-db-analyze-status.js +1 -0
- 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/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +7 -0
- 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.d.ts +17 -0
- package/lib/core/cross-db-analysis.js +1 -0
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +6 -4
- package/skills/rabetbase/guides/database-connection-workflow.md +12 -3
- package/skills/rabetbase/guides/independent-deployment.md +10 -2
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-analyze.md +2 -0
- package/skills/rabetbase/references/rabetbase-db-cross-analyze.md +78 -0
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a34_0x4646ea=a34_0x114b;(function(_0x5dd1d0,_0x468c47){const _0x4ed723=a34_0x114b,_0x164c02=_0x5dd1d0();while(!![]){try{const _0x252814=parseInt(_0x4ed723(0x1cd))/0x1+parseInt(_0x4ed723(0x1da))/0x2*(parseInt(_0x4ed723(0x1e4))/0x3)+parseInt(_0x4ed723(0x1dd))/0x4+-parseInt(_0x4ed723(0x1d8))/0x5+parseInt(_0x4ed723(0x1de))/0x6*(parseInt(_0x4ed723(0x1d7))/0x7)+parseInt(_0x4ed723(0x1e1))/0x8*(-parseInt(_0x4ed723(0x1db))/0x9)+-parseInt(_0x4ed723(0x1d5))/0xa*(parseInt(_0x4ed723(0x1d9))/0xb);if(_0x252814===_0x468c47)break;else _0x164c02['push'](_0x164c02['shift']());}catch(_0x528026){_0x164c02['push'](_0x164c02['shift']());}}}(a34_0x605e,0xd9af8));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a34_0x605e(){const _0x4d1388=['Created','get','122432XvATAY','number','appCode','39cukNbM','write','App\x20config\x20server\x20id\x20missing\x20for\x20key=','file','588814qBrsEQ','tags','/smartapi/app-config/update','isFinite',',\x20appCode=','apiError','set','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','20AztSox','update','5607fiRdxK','3083375QmlcpR','9815531lojsLz','59362hAAqDn','594WYaTNG','create','6447244WcHVAW','12858xLmYaP'];a34_0x605e=function(){return _0x4d1388;};return a34_0x605e();}function a34_0x114b(_0x5a519e,_0x4010a3){_0x5a519e=_0x5a519e-0x1cc;const _0x605eac=a34_0x605e();let _0x114b47=_0x605eac[_0x5a519e];return _0x114b47;}const CREATE_PATH='/smartapi/app-config/create',UPDATE_PATH=a34_0x4646ea(0x1cf);export const appConfigSet={'service':'app-config','command':a34_0x4646ea(0x1d3),'description':a34_0x4646ea(0x1d4),'risk':a34_0x4646ea(0x1e5),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x4646ea(0x1cc),'type':'string','description':'Read\x20config\x20value\x20from\x20file'}],async 'validate'(_0x84a2ef){readKeyArg(_0x84a2ef),readOptionalTags(_0x84a2ef),assertSingleValueSource(_0x84a2ef);},async 'dryRun'(_0x50a8a3){const _0x3c8c43=a34_0x4646ea,_0x3610ca=readKeyArg(_0x50a8a3),_0x471535=readOptionalTags(_0x50a8a3),_0x93974f=assertSingleValueSource(_0x50a8a3);await assertValueSourceReadable(_0x93974f);const _0x4d0986=await withAppConfigApiBoundary(_0x3c8c43(0x1e0),{'appCode':_0x50a8a3[_0x3c8c43(0x1e3)],'key':_0x3610ca},()=>getAppConfigByKey(_0x50a8a3[_0x3c8c43(0x1e3)],_0x3610ca)),_0x106a85=_0x4d0986?_0x3c8c43(0x1d6):_0x3c8c43(0x1dc),_0x45d8e0=_0x4d0986?projectAppConfig(_0x4d0986):null,_0x131bd4=plannedAppConfig({'appCode':_0x50a8a3[_0x3c8c43(0x1e3)],'key':_0x3610ca,'tags':_0x471535??_0x4d0986?.['tags'],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x106a85,'appCode':_0x50a8a3[_0x3c8c43(0x1e3)],'key':_0x3610ca,'before':_0x45d8e0,'after':_0x131bd4,'dryRun':!![]}),{'method':'POST','url':_0x106a85===_0x3c8c43(0x1d6)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x1c9f94){const _0x54353c=a34_0x4646ea,_0x1e9285=readKeyArg(_0x1c9f94),_0x48dd07=readOptionalTags(_0x1c9f94),_0x364ccf=await withAppConfigApiBoundary(_0x54353c(0x1e0),{'appCode':_0x1c9f94[_0x54353c(0x1e3)],'key':_0x1e9285},()=>getAppConfigByKey(_0x1c9f94[_0x54353c(0x1e3)],_0x1e9285)),_0x342a47=_0x364ccf?projectAppConfig(_0x364ccf):null,_0x56f803=_0x364ccf?_0x54353c(0x1d6):_0x54353c(0x1dc),{value:_0x6b1b72,warnings:_0x2231bd}=await readAppConfigValue(_0x1c9f94),_0x21b1e1={'appCode':_0x1c9f94[_0x54353c(0x1e3)],'key':_0x1e9285,'value':_0x6b1b72,'tags':_0x48dd07??_0x364ccf?.[_0x54353c(0x1ce)]??undefined};await withAppConfigApiBoundary(_0x56f803,{'appCode':_0x1c9f94[_0x54353c(0x1e3)],'key':_0x1e9285},async()=>{const _0x4209a4=_0x54353c;_0x364ccf?await updateAppConfig({..._0x21b1e1,'id':requireAppConfigId(_0x364ccf,_0x1e9285,_0x1c9f94[_0x4209a4(0x1e3)])}):await createAppConfig(_0x21b1e1);});const _0xd92c75=await withAppConfigApiBoundary('get',{'appCode':_0x1c9f94['appCode'],'key':_0x1e9285},()=>getAppConfigByKey(_0x1c9f94[_0x54353c(0x1e3)],_0x1e9285)),_0x22fd96=_0xd92c75?projectAppConfig(_0xd92c75):plannedAppConfig({'appCode':_0x1c9f94['appCode'],'key':_0x1e9285,'tags':_0x21b1e1[_0x54353c(0x1ce)],'hasValue':_0x6b1b72!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x56f803,'appCode':_0x1c9f94[_0x54353c(0x1e3)],'key':_0x1e9285,'before':_0x342a47,'after':_0x22fd96,'dryRun':![],'warnings':_0x2231bd}),'message':(_0x56f803===_0x54353c(0x1d6)?'Updated':_0x54353c(0x1df))+'\x20app\x20config\x20'+_0x1e9285};}};function requireAppConfigId(_0x43f0fd,_0x1d3bd1,_0x2cbcf4){const _0x1fcee0=a34_0x4646ea;if(typeof _0x43f0fd['id']===_0x1fcee0(0x1e2)&&Number[_0x1fcee0(0x1d0)](_0x43f0fd['id'])&&_0x43f0fd['id']>0x0)return _0x43f0fd['id'];throw CliErrors[_0x1fcee0(0x1d2)](_0x1fcee0(0x1e6)+_0x1d3bd1+_0x1fcee0(0x1d1)+_0x2cbcf4);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x1010fe=a35_0x2f87;(function(_0xdae61c,_0x16ac9b){const _0xee08f0=a35_0x2f87,_0x2ade45=_0xdae61c();while(!![]){try{const _0x27d021=-parseInt(_0xee08f0(0x1f3))/0x1*(-parseInt(_0xee08f0(0x20e))/0x2)+-parseInt(_0xee08f0(0x1d9))/0x3*(-parseInt(_0xee08f0(0x1dc))/0x4)+-parseInt(_0xee08f0(0x1e8))/0x5*(-parseInt(_0xee08f0(0x1f6))/0x6)+-parseInt(_0xee08f0(0x21c))/0x7*(-parseInt(_0xee08f0(0x1e1))/0x8)+-parseInt(_0xee08f0(0x1e2))/0x9+-parseInt(_0xee08f0(0x202))/0xa*(-parseInt(_0xee08f0(0x1fd))/0xb)+-parseInt(_0xee08f0(0x1fe))/0xc;if(_0x27d021===_0x16ac9b)break;else _0x2ade45['push'](_0x2ade45['shift']());}catch(_0x162a66){_0x2ade45['push'](_0x2ade45['shift']());}}}(a35_0x34eb,0xbc6e5));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x1010fe(0x206),'description':a35_0x1010fe(0x1d8),'required':!![]};export const VALUE_ARG={'name':a35_0x1010fe(0x20f),'description':a35_0x1010fe(0x214),'required':![]};export const TAGS_FLAG={'name':a35_0x1010fe(0x21d),'type':'string','description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':a35_0x1010fe(0x213),'type':a35_0x1010fe(0x1f1),'description':a35_0x1010fe(0x1f7),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x1010fe(0x218),'type':a35_0x1010fe(0x1f2),'description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};export const REVEAL_FLAG={'name':a35_0x1010fe(0x1df),'type':a35_0x1010fe(0x1f1),'description':a35_0x1010fe(0x1eb),'default':![]};export function readKeyArg(_0x5e59bd){const _0xa3fc33=a35_0x1010fe,_0x326f77=_0x5e59bd[_0xa3fc33(0x1e7)][0x0]?.['trim']()??'';return validateKey(_0x326f77),_0x326f77;}function a35_0x2f87(_0x2b720e,_0x2b0ff5){_0x2b720e=_0x2b720e-0x1d8;const _0x34ebae=a35_0x34eb();let _0x2f8714=_0x34ebae[_0x2b720e];return _0x2f8714;}export function readOptionalTags(_0x513278){const _0x4e493b=a35_0x1010fe,_0x2c9f6b=_0x513278[_0x4e493b(0x1f5)](_0x4e493b(0x21d))['trim']();if(!_0x2c9f6b)return undefined;if(_0x2c9f6b[_0x4e493b(0x1ee)]>0x20)throw CliErrors[_0x4e493b(0x215)](_0x4e493b(0x1e9));return _0x2c9f6b;}export function validateKey(_0x32d22f){const _0x1c4d54=a35_0x1010fe;if(!_0x32d22f)throw CliErrors[_0x1c4d54(0x215)](_0x1c4d54(0x1fb));if(_0x32d22f[_0x1c4d54(0x1ee)]>0x100)throw CliErrors[_0x1c4d54(0x215)](_0x1c4d54(0x1e6));}export function projectAppConfig(_0x8d100d,_0x47c8f5){const _0x332a71=a35_0x1010fe,_0x53088d=_0x8d100d[_0x332a71(0x20f)]!==undefined&&_0x8d100d[_0x332a71(0x20f)]!==null&&_0x8d100d[_0x332a71(0x20f)]!=='',_0x533af5={'appCode':_0x8d100d['appCode'],'key':_0x8d100d[_0x332a71(0x206)],'tags':_0x8d100d[_0x332a71(0x21d)]??undefined,'hasValue':_0x53088d,'valueRedacted':_0x53088d&&!_0x47c8f5?.[_0x332a71(0x1df)],'gmtCreate':_0x8d100d[_0x332a71(0x205)],'gmtModified':_0x8d100d[_0x332a71(0x20b)]};return _0x47c8f5?.['reveal']&&(_0x533af5['value']=_0x8d100d[_0x332a71(0x20f)]??'',_0x533af5[_0x332a71(0x204)]=![]),_0x533af5;}export function plannedAppConfig(_0x54d8be){const _0x465a78=a35_0x1010fe,_0x4aa1d2=_0x54d8be[_0x465a78(0x1de)]??!![];return{'appCode':_0x54d8be[_0x465a78(0x217)],'key':_0x54d8be[_0x465a78(0x206)],'tags':_0x54d8be[_0x465a78(0x21d)]??undefined,'hasValue':_0x4aa1d2,'valueRedacted':_0x4aa1d2};}export function buildMutationData(_0x3135e5){const _0x498809=a35_0x1010fe;return{'operation':_0x3135e5['operation'],'selector':{'appCode':_0x3135e5[_0x498809(0x217)],'key':_0x3135e5[_0x498809(0x206)]},'before':_0x3135e5['before'],'after':_0x3135e5[_0x498809(0x1fc)],'dryRun':_0x3135e5[_0x498809(0x219)],'warnings':_0x3135e5[_0x498809(0x1da)]??[]};}export async function withAppConfigApiBoundary(_0x1c8fd7,_0x29023f,_0x287419){const _0x9fb566=a35_0x1010fe;try{return await _0x287419();}catch{const _0x3ea68a=[_0x9fb566(0x1f8)+_0x29023f['appCode']];if(_0x29023f[_0x9fb566(0x206)])_0x3ea68a[_0x9fb566(0x203)](_0x9fb566(0x1f4)+_0x29023f[_0x9fb566(0x206)]);_0x3ea68a[_0x9fb566(0x203)]('value\x20is\x20redacted');throw CliErrors[_0x9fb566(0x1ec)](_0x9fb566(0x1fa)+_0x1c8fd7+_0x9fb566(0x1ed),_0x3ea68a[_0x9fb566(0x200)](';\x20')+'.');}}function a35_0x34eb(){const _0x574c4d=['Missing\x20app-config\x20value\x20source.','40152WPMjff','tags','Runtime\x20app-config\x20key','516462jaVEaD','warnings','utf8','8wCbLLw','argument','hasValue','reveal','setEncoding','728XadoKl','5644332UoPbvt','App\x20config\x20value\x20source\x20is\x20ambiguous.','kind','trim','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','args','7569915HuqGzd','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','url','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','apiError','\x20app\x20config.','length','path','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','boolean','string','1Ycnoyi','key:\x20','str','6WGLXvg','Read\x20config\x20value\x20from\x20stdin','appCode:\x20','flag','Failed\x20to\x20','Missing\x20app-config\x20key.','after','26521sAUXQY','23764080ezSCYY','Value\x20file\x20is\x20not\x20readable:\x20','join','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','160dWCfnW','push','valueRedacted','gmtCreate','key','method','end','slice','once','gmtModified','data','error','1920916IYVbqf','value','name','file','defineProperties','stdin','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','validation','bool','appCode','from-env','dryRun','Environment\x20variable\x20is\x20not\x20set:\x20'];a35_0x34eb=function(){return _0x574c4d;};return a35_0x34eb();}export function asAppConfigDryRunResult(_0x5dec69,_0x30c4d9){const _0x60b323=a35_0x1010fe;return Object[_0x60b323(0x212)](_0x5dec69,{'method':{'value':_0x30c4d9[_0x60b323(0x207)],'enumerable':![]},'url':{'value':_0x30c4d9[_0x60b323(0x1ea)],'enumerable':![]}});}export function assertSingleValueSource(_0x40d8b4){const _0x3f9641=a35_0x1010fe,_0x40689a=[];_0x40d8b4[_0x3f9641(0x1e7)][_0x3f9641(0x1ee)]>0x1&&_0x40689a[_0x3f9641(0x203)]({'kind':_0x3f9641(0x1dd),'value':_0x40d8b4['args'][_0x3f9641(0x209)](0x1)[_0x3f9641(0x200)]('\x20')});const _0x4724c7=_0x40d8b4[_0x3f9641(0x1f9)](_0x3f9641(0x20f));_0x4724c7!==undefined&&_0x4724c7!==null&&_0x40689a[_0x3f9641(0x203)]({'kind':_0x3f9641(0x1dd),'value':String(_0x4724c7)});_0x40d8b4[_0x3f9641(0x216)]('stdin')&&_0x40689a[_0x3f9641(0x203)]({'kind':_0x3f9641(0x213)});const _0x3cc6b1=_0x40d8b4[_0x3f9641(0x1f5)]('from-env')[_0x3f9641(0x1e5)]();_0x3cc6b1&&_0x40689a[_0x3f9641(0x203)]({'kind':'env','name':_0x3cc6b1});const _0x426639=_0x40d8b4[_0x3f9641(0x1f5)](_0x3f9641(0x211))[_0x3f9641(0x1e5)]();_0x426639&&_0x40689a[_0x3f9641(0x203)]({'kind':'file','path':_0x426639});if(_0x40689a['length']===0x0)throw CliErrors[_0x3f9641(0x215)](_0x3f9641(0x21b),'Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0x40689a[_0x3f9641(0x1ee)]>0x1)throw CliErrors['validation'](_0x3f9641(0x1e3),_0x3f9641(0x1f0));return _0x40689a[0x0];}export async function assertValueSourceReadable(_0x328e95){const _0x323c49=a35_0x1010fe;if(_0x328e95['kind']==='env'&&!(_0x328e95[_0x323c49(0x210)]in process.env))throw CliErrors[_0x323c49(0x215)](_0x323c49(0x21a)+_0x328e95[_0x323c49(0x210)]);if(_0x328e95['kind']===_0x323c49(0x211))try{await access(_0x328e95[_0x323c49(0x1ef)]);}catch{throw CliErrors[_0x323c49(0x215)](_0x323c49(0x1ff)+_0x328e95['path']);}}export async function readAppConfigValue(_0x5bbc98){const _0x2452da=a35_0x1010fe,_0x446bac=assertSingleValueSource(_0x5bbc98),_0x5c63c5=[];if(_0x446bac[_0x2452da(0x1e4)]==='argument')return _0x5c63c5[_0x2452da(0x203)](_0x2452da(0x201)),{'value':_0x446bac[_0x2452da(0x20f)]??'','source':_0x446bac[_0x2452da(0x1e4)],'warnings':_0x5c63c5};if(_0x446bac[_0x2452da(0x1e4)]===_0x2452da(0x213))return{'value':await readStdin(),'source':_0x446bac['kind'],'warnings':_0x5c63c5};if(_0x446bac[_0x2452da(0x1e4)]==='env'){if(!(_0x446bac[_0x2452da(0x210)]in process.env))throw CliErrors[_0x2452da(0x215)](_0x2452da(0x21a)+_0x446bac['name']);return{'value':process.env[_0x446bac.name]??'','source':_0x446bac['kind'],'warnings':_0x5c63c5};}return{'value':await readFile(_0x446bac['path'],'utf8'),'source':_0x446bac[_0x2452da(0x1e4)],'warnings':_0x5c63c5};}function readStdin(){return new Promise((_0x1929fc,_0x59660c)=>{const _0x290746=a35_0x2f87;let _0x4e7bd8='';process[_0x290746(0x213)][_0x290746(0x1e0)](_0x290746(0x1db)),process[_0x290746(0x213)]['on'](_0x290746(0x20c),_0x1186aa=>{_0x4e7bd8+=_0x1186aa;}),process[_0x290746(0x213)][_0x290746(0x20a)](_0x290746(0x208),()=>_0x1929fc(_0x4e7bd8)),process['stdin']['once'](_0x290746(0x20d),_0x59660c);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a36_0x22859a=a36_0x549d;(function(_0x26cace,_0x4b2e5b){const _0x4d9e79=a36_0x549d,_0x33eddc=_0x26cace();while(!![]){try{const _0x4cd797=parseInt(_0x4d9e79(0x15a))/0x1*(parseInt(_0x4d9e79(0x16e))/0x2)+parseInt(_0x4d9e79(0x158))/0x3+parseInt(_0x4d9e79(0x165))/0x4+-parseInt(_0x4d9e79(0x16d))/0x5+parseInt(_0x4d9e79(0x167))/0x6*(-parseInt(_0x4d9e79(0x164))/0x7)+-parseInt(_0x4d9e79(0x163))/0x8+-parseInt(_0x4d9e79(0x159))/0x9*(-parseInt(_0x4d9e79(0x160))/0xa);if(_0x4cd797===_0x4b2e5b)break;else _0x33eddc['push'](_0x33eddc['shift']());}catch(_0x140440){_0x33eddc['push'](_0x33eddc['shift']());}}}(a36_0x157e,0x1bbe3));import{unlinkSync,existsSync}from'node:fs';function a36_0x549d(_0x412c86,_0x2aebbb){_0x412c86=_0x412c86-0x158;const _0x157e80=a36_0x157e();let _0x549d2a=_0x157e80[_0x412c86];return _0x549d2a;}import{cookieFile}from'../../auth/constant.js';function a36_0x157e(){const _0x15b790=['bool','nonInteractive','login','auth','yes','10eQDnMD','../../auth/auth-server-ui.js','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','1688376hnqJMp','664769ymzbnh','507100TEDujD','Login\x20via\x20browser','12JPcSGj','✓\x20Logged\x20out','log','!\x20Not\x20logged\x20in','write','boolean','812130UBmpdY','334AlfKVB','Clear\x20login\x20session','425670YULyuH','1936422ChVnHq','1157jfRhKt'];a36_0x157e=function(){return _0x15b790;};return a36_0x157e();}export const authDefinitions=[{'service':'auth','command':a36_0x22859a(0x15d),'description':a36_0x22859a(0x166),'risk':a36_0x22859a(0x16b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x22859a(0x15f),'type':a36_0x22859a(0x16c),'description':a36_0x22859a(0x162),'default':![]}],async 'execute'(_0xfa853c){const _0xeabd9c=a36_0x22859a,{runAuthServer:_0xdfdfe1}=await import(_0xeabd9c(0x161));return await _0xdfdfe1({'autoYes':_0xfa853c[_0xeabd9c(0x15b)](_0xeabd9c(0x15f)),'nonInteractive':_0xfa853c[_0xeabd9c(0x15c)]}),{'ok':!![]};}},{'service':a36_0x22859a(0x15e),'command':'logout','description':a36_0x22859a(0x16f),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0xc4801b){const _0x1c6700=a36_0x22859a;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x1c6700(0x169)](_0x1c6700(0x168))):console[_0x1c6700(0x169)](_0x1c6700(0x16a)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x538221=a37_0x1409;(function(_0xd0a997,_0x543bcf){const _0x2577cb=a37_0x1409,_0x599f6f=_0xd0a997();while(!![]){try{const _0x241624=-parseInt(_0x2577cb(0x104))/0x1*(parseInt(_0x2577cb(0xd4))/0x2)+-parseInt(_0x2577cb(0x119))/0x3+-parseInt(_0x2577cb(0xf5))/0x4+parseInt(_0x2577cb(0x106))/0x5*(parseInt(_0x2577cb(0xf7))/0x6)+-parseInt(_0x2577cb(0xeb))/0x7*(parseInt(_0x2577cb(0xf3))/0x8)+parseInt(_0x2577cb(0xb9))/0x9*(-parseInt(_0x2577cb(0x116))/0xa)+parseInt(_0x2577cb(0xdb))/0xb;if(_0x241624===_0x543bcf)break;else _0x599f6f['push'](_0x599f6f['shift']());}catch(_0x1981b7){_0x599f6f['push'](_0x599f6f['shift']());}}}(a37_0x157c,0xda0c8));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a37_0x1409(_0x20e7f6,_0x4833bb){_0x20e7f6=_0x20e7f6-0xb4;const _0x157c0b=a37_0x157c();let _0x140931=_0x157c0b[_0x20e7f6];return _0x140931;}import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a37_0x538221(0xea),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':'read','flags':[{'name':'type','type':a37_0x538221(0xc6),'required':!![],'enum':['COMMON',a37_0x538221(0xd3),a37_0x538221(0xf9)],'description':a37_0x538221(0xbd)},{'name':a37_0x538221(0x109),'type':a37_0x538221(0xc6),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x538221(0xfe),'type':a37_0x538221(0xc6),'description':a37_0x538221(0x113)},{'name':a37_0x538221(0xe5),'type':a37_0x538221(0xc6),'description':a37_0x538221(0xb7)},{'name':a37_0x538221(0xd0),'type':'string','description':a37_0x538221(0xd9)},{'name':a37_0x538221(0xd8),'type':a37_0x538221(0xc6),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':'string','description':'Trigger\x20node\x20(HOOK\x20only)','enum':['before',a37_0x538221(0xfc)]}],async 'validate'(_0x4f4ec6){const _0xa7c966=a37_0x538221,_0xd7571f=_0x4f4ec6[_0xa7c966(0xe9)]('name');if(!isValidBffFunctionName(_0xd7571f))throw CliErrors['validation'](_0xa7c966(0xed)+_0xd7571f+_0xa7c966(0xde));},async 'execute'(_0x36eb53){const _0x5963d5=a37_0x538221,_0x186ca1=loadBffProjectConfig(_0x36eb53[_0x5963d5(0xdf)]),_0x4d5c7e=_0x36eb53['str'](_0x5963d5(0x10a)),_0x14da7c=_0x36eb53[_0x5963d5(0xe9)](_0x5963d5(0x109)),_0xdaf733=_0x36eb53[_0x5963d5(0xe9)](_0x5963d5(0xfe))||undefined,_0x399d4e=_0x4d5c7e==='HOOK'?await resolveHookOptions(_0x186ca1,_0x36eb53):undefined,_0x2a6857=buildFilePath(_0x186ca1,_0x4d5c7e,_0x14da7c,_0x399d4e);if(await fileExists(_0x2a6857))throw CliErrors[_0x5963d5(0xd6)](_0x5963d5(0xfa)+_0x2a6857);await mkdir(dirname(_0x2a6857),{'recursive':!![]});const _0x26c09d=generateTemplate(_0x4d5c7e,_0x14da7c,_0x36eb53['appCode'],_0xdaf733,_0x399d4e);await writeFile(_0x2a6857,_0x26c09d,'utf8');const _0x92c8df={'type':_0x4d5c7e,'name':_0x14da7c,'path':_0x2a6857};if(_0xdaf733)_0x92c8df['description']=_0xdaf733;if(_0x399d4e){if(_0x399d4e[_0x5963d5(0xe5)])_0x92c8df[_0x5963d5(0xe5)]=_0x399d4e[_0x5963d5(0xe5)];_0x92c8df['datasetCode']=_0x399d4e['datasetCode'],_0x92c8df['operationType']=_0x399d4e[_0x5963d5(0x10b)],_0x92c8df[_0x5963d5(0xc1)]=_0x399d4e[_0x5963d5(0xc1)];}return{'ok':!![],'data':_0x92c8df,'message':_0x5963d5(0x10e)+_0x4d5c7e+_0x5963d5(0xda)+_0x14da7c};}};function a37_0x157c(){const _0x50db7d=['179IpqhDw','code','4865BRycCA','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','datasetId','name','type','operationType','nonInteractive','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Created\x20','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','entries','before','\x20api\x20pull`\x20to\x20refresh.','Script\x20description','trim','mergedCli','70BFrbUM','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','includes','612759VMirnm','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','\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','Select\x20dataset:','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','当前请求参数','68868juADRs','profileName','No\x20operation\x20types\x20found\x20for\x20dataset\x20','defaultApp','Script\x20type','Select\x20trigger\x20node:','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','No\x20datasets\x20found\x20for\x20this\x20app.','functionNode','修改后的请求参数','Invalid\x20dataset\x20selection.','keys','datasetCode','string','find','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','COMMON','stderr','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','join','/**\x0a\x20*\x20','apiDir','\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','datasetcode','.js','\x0a\x20*\x20[平台配置]\x20','ENDPOINT','19462RkhPin','当前响应结果','validation','source','operation-type','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x20function:\x20','49392211BpFlcX','.js\x0a','No\x20model\x20aliases\x20found.\x20Run\x20`','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','appCode','function-node','修改后的响应结果','close',']\x20(','UNKNOWN','alias','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','/ENDPOINT/','Available:\x20','str','create','7jvCPYS','\x22,\x20params\x20})\x0a','Invalid\x20function\x20name\x20\x22','/HOOK/','parseInt','selectedAppName','write','currentApp','5966536xJJgRa','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','5017648TcHZie','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','2484oAuHTb','map','HOOK','File\x20already\x20exists:\x20','stdin','after','Dataset\x20not\x20found\x20for\x20code\x20\x22','description','Available\x20aliases:\x20','scriptsRootDir','/COMMON/','length','\x0a\x20*\x20[接口路径]\x20POST\x20/api/'];a37_0x157c=function(){return _0x50db7d;};return a37_0x157c();}async function resolveHookOptions(_0x59f0d7,_0x3920b9){const _0x17a868=a37_0x538221,_0x3266d5=resolveApiModelSource(_0x3920b9[_0x17a868(0xce)],_0x3920b9[_0x17a868(0xdf)],_0x3920b9[_0x17a868(0xf0)]||_0x3920b9[_0x17a868(0x115)]?.[_0x17a868(0xf2)]||_0x3920b9[_0x17a868(0x115)]?.[_0x17a868(0xbc)]),_0x3c3694=loadAliasMap(_0x3920b9[_0x17a868(0xce)],undefined,_0x3266d5['filePath'],_0x3266d5['profileName']),_0x498034=_0x3c3694[_0x17a868(0x102)]>0x0;let _0x30c800,_0x316d8f,_0x2573df;const _0x5e0a2c=_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xe5)),_0x2bd05c=_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xd0));if(_0x5e0a2c){const _0x3e454a=resolveAlias(_0x3920b9[_0x17a868(0xce)],_0x5e0a2c,undefined,_0x3266d5['filePath'],_0x3266d5[_0x17a868(0xba)]);if(!_0x3e454a){const _0x49af84=_0x498034?_0x17a868(0xff)+_0x3c3694['map'](_0x52351a=>_0x52351a['alias'])[_0x17a868(0xcc)](',\x20'):_0x17a868(0xdd)+CLI_BIN_NAME+_0x17a868(0xb6);throw CliErrors['validation']('Alias\x20\x22'+_0x5e0a2c+'\x22\x20not\x20found.\x20'+_0x49af84);}_0x30c800=_0x5e0a2c,_0x316d8f=_0x3e454a;}else{if(_0x2bd05c){_0x316d8f=_0x2bd05c;const _0x18121e=_0x3c3694[_0x17a868(0xc7)](_0x1e597b=>_0x1e597b[_0x17a868(0xc5)]===_0x2bd05c);_0x30c800=_0x18121e?.[_0x17a868(0xe5)];}else{if(_0x3920b9['nonInteractive'])throw CliErrors[_0x17a868(0xd6)]('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x498034){const _0x156aa7=_0x3c3694[_0x17a868(0xf8)](_0x5c2e63=>_0x5c2e63[_0x17a868(0xe5)]+'\x20('+_0x5c2e63['tableName']+')'),_0x402354=await promptSelect(_0x17a868(0xb5),_0x156aa7),_0x1e44f4=_0x3c3694[_0x402354];if(!_0x1e44f4)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xc3));_0x30c800=_0x1e44f4['alias'],_0x316d8f=_0x1e44f4[_0x17a868(0xc5)];}else{const _0x2f537f=await listDatasets(_0x3920b9[_0x17a868(0xdf)]);if(_0x2f537f[_0x17a868(0x102)]===0x0)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xc0));const _0x3d9149=_0x2f537f[_0x17a868(0xf8)](_0x4a17e5=>_0x4a17e5[_0x17a868(0x109)]+'\x20['+(_0x4a17e5[_0x17a868(0xd7)]??_0x17a868(0xe4))+_0x17a868(0xe3)+_0x4a17e5[_0x17a868(0x105)]+')'),_0x245b70=await promptSelect(_0x17a868(0xb5),_0x3d9149),_0x447133=_0x2f537f[_0x245b70];if(!_0x447133)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xc3));_0x316d8f=_0x447133['code'],_0x30c800=undefined;}}}}const _0x2ba811=await listDatasets(_0x3920b9[_0x17a868(0xdf)]),_0xd71cae=_0x2ba811[_0x17a868(0xc7)](_0x4a59ec=>_0x4a59ec[_0x17a868(0x105)]===_0x316d8f);if(!_0xd71cae)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xfd)+_0x316d8f+'\x22.\x20'+(_0x30c800?'The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0x17a868(0x112):''));_0x2573df=_0xd71cae['id'];const _0x23cb08=_0x30c800??_0x316d8f,_0x5a73c1=await listBffDatasetOperations(_0x3920b9[_0x17a868(0xdf)],_0x2573df),_0x2876c8=_0x5a73c1?Object[_0x17a868(0xc4)](_0x5a73c1):[];if(_0x2876c8[_0x17a868(0x102)]===0x0)throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xbb)+_0x23cb08+'.');let _0x588f5b;const _0x14ef59=_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xd8));if(_0x14ef59){if(!_0x2876c8[_0x17a868(0x118)](_0x14ef59))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x14ef59+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x23cb08+'.\x20'+(_0x17a868(0xe8)+_0x2876c8[_0x17a868(0xcc)](',\x20')));_0x588f5b=_0x14ef59;}else{if(_0x3920b9[_0x17a868(0x10c)])throw CliErrors['validation']('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x5c0e0=await promptSelect('Select\x20operation\x20type:',_0x2876c8);_0x588f5b=_0x2876c8[_0x5c0e0]??_0x2876c8[0x0];}let _0x2e95c3=normalizeHookFunctionNode(_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xe0)));if(!_0x2e95c3){if(_0x3920b9[_0x17a868(0xe9)](_0x17a868(0xe0)))throw CliErrors[_0x17a868(0xd6)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x3920b9[_0x17a868(0x10c)])throw CliErrors[_0x17a868(0xd6)](_0x17a868(0xf4));const _0xe154aa=await promptSelect(_0x17a868(0xbe),['before',_0x17a868(0xfc)]);_0x2e95c3=[_0x17a868(0x111),_0x17a868(0xfc)][_0xe154aa]??_0x17a868(0x111);}return{'alias':_0x30c800,'datasetCode':_0x316d8f,'datasetId':_0x2573df,'operationType':_0x588f5b,'functionNode':_0x2e95c3};}async function promptSelect(_0xe2c5e4,_0x2249cb){const _0x397a97=a37_0x538221;if(_0x2249cb[_0x397a97(0x102)]===0x1)return 0x0;for(const [_0x2668d2,_0x58561b]of _0x2249cb[_0x397a97(0x110)]()){process[_0x397a97(0xca)][_0x397a97(0xf1)]('\x20\x20'+(_0x2668d2+0x1)+'.\x20'+_0x58561b+'\x0a');}const _0x6c028b=createInterface({'input':process[_0x397a97(0xfb)],'output':process[_0x397a97(0xca)]});while(!![]){const _0x193d29=await new Promise(_0x226ef6=>{_0x6c028b['question'](_0xe2c5e4+'\x20',_0x226ef6);}),_0xdcc614=Number[_0x397a97(0xef)](_0x193d29[_0x397a97(0x114)](),0xa);if(Number['isInteger'](_0xdcc614)&&_0xdcc614>=0x1&&_0xdcc614<=_0x2249cb[_0x397a97(0x102)])return _0x6c028b[_0x397a97(0xe2)](),_0xdcc614-0x1;process['stderr'][_0x397a97(0xf1)](_0x397a97(0x107)+_0x2249cb['length']+'.\x0a');}}function buildFilePath(_0x2f91df,_0x12c3ec,_0x183510,_0xa8cd1c){const _0x148c4f=a37_0x538221;if(_0x12c3ec===_0x148c4f(0xf9)){if(!_0xa8cd1c)throw CliErrors[_0x148c4f(0xd6)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x141267=_0xa8cd1c[_0x148c4f(0xe5)]??_0xa8cd1c[_0x148c4f(0xc5)];return join(_0x2f91df[_0x148c4f(0x100)],_0x148c4f(0xf9),_0x141267,_0xa8cd1c[_0x148c4f(0x10b)],_0xa8cd1c[_0x148c4f(0xc1)],_0x183510+_0x148c4f(0xd1));}return join(_0x2f91df[_0x148c4f(0x100)],_0x12c3ec,_0x183510+'.js');}export function generateTemplate(_0x2708f8,_0xd54088,_0xa0e00e,_0x5b5d62,_0x5bcf71){const _0x503cd8=a37_0x538221,_0x32b284=_0x5b5d62?.[_0x503cd8(0x114)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3397cb=getAppBaseUrl(_0xa0e00e),_0xeb3997=_0x503cd8(0xbf);if(_0x2708f8===_0x503cd8(0xc9))return'/**\x0a\x20*\x20'+_0x32b284+_0x503cd8(0x11a)+_0xd54088+_0x503cd8(0xd2)+_0x3397cb+_0x503cd8(0xe6)+_0xa0e00e+_0x503cd8(0x101)+_0xd54088+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0xd54088+_0x503cd8(0xec)+_0xeb3997+_0x503cd8(0xcf)+_0xd54088+_0x503cd8(0xcb);if(_0x2708f8===_0x503cd8(0xd3))return _0x503cd8(0xcd)+_0x32b284+_0x503cd8(0x10d)+_0xd54088+_0x503cd8(0xc8)+_0xa0e00e+'/'+_0xd54088+_0x503cd8(0xd2)+_0x3397cb+_0x503cd8(0xe6)+_0xa0e00e+_0x503cd8(0xe7)+_0xd54088+_0x503cd8(0xdc)+_0xeb3997+_0x503cd8(0xb4)+_0xd54088+_0x503cd8(0xcb);if(!_0x5bcf71)throw CliErrors[_0x503cd8(0xd6)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x262c67=_0x5bcf71['alias']??_0x5bcf71[_0x503cd8(0xc5)],_0x3262b1=_0x5bcf71['functionNode']===_0x503cd8(0x111)?_0x503cd8(0xb8):_0x503cd8(0xd5),_0x4f8731=_0x5bcf71[_0x503cd8(0xc1)]===_0x503cd8(0x111)?_0x503cd8(0xc2):_0x503cd8(0xe1);return _0x503cd8(0xcd)+_0x32b284+_0x503cd8(0xf6)+_0xd54088+_0x503cd8(0x103)+_0xa0e00e+'/'+_0x5bcf71['datasetCode']+'/'+_0x5bcf71[_0x503cd8(0x10b)]+'\x0a\x20*\x20[平台配置]\x20'+_0x3397cb+'/data/dataset/'+_0x5bcf71[_0x503cd8(0x108)]+_0x503cd8(0x10f)+_0xa0e00e+_0x503cd8(0xee)+_0x262c67+'/'+_0x5bcf71['operationType']+'/'+_0x5bcf71['functionNode']+'/'+_0xd54088+'.js\x0a\x20*\x20[触发节点]\x20'+_0x5bcf71['functionNode']+'\x0a'+_0xeb3997+_0x503cd8(0x11b)+_0x3262b1+_0x503cd8(0x11c)+_0x4f8731+_0x503cd8(0x117)+_0xd54088+_0x503cd8(0xcb);}
|
|
1
|
+
const a37_0x6f81a6=a37_0x18a8;(function(_0x3dd742,_0x2caaea){const _0x40796e=a37_0x18a8,_0x354dfa=_0x3dd742();while(!![]){try{const _0x512934=-parseInt(_0x40796e(0x1e4))/0x1*(parseInt(_0x40796e(0x1d4))/0x2)+parseInt(_0x40796e(0x232))/0x3*(parseInt(_0x40796e(0x1ce))/0x4)+parseInt(_0x40796e(0x22f))/0x5*(parseInt(_0x40796e(0x1f1))/0x6)+-parseInt(_0x40796e(0x231))/0x7+-parseInt(_0x40796e(0x224))/0x8*(-parseInt(_0x40796e(0x1d3))/0x9)+-parseInt(_0x40796e(0x20f))/0xa+parseInt(_0x40796e(0x22a))/0xb;if(_0x512934===_0x2caaea)break;else _0x354dfa['push'](_0x354dfa['shift']());}catch(_0x40c29e){_0x354dfa['push'](_0x354dfa['shift']());}}}(a37_0x2eed,0x26b05));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';function a37_0x2eed(){const _0x1adf5a=['521997KrXnhJ','17409KiscHZ','File\x20already\x20exists:\x20','Script\x20description','stderr','\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','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','HOOK','Invalid\x20function\x20name\x20\x22','close','ENDPOINT','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','string','No\x20operation\x20types\x20found\x20for\x20dataset\x20','scriptsRootDir','Function\x20name\x20(valid\x20JS\x20identifier)','COMMON','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','88GPmCZK','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','apiDir','Select\x20dataset:','\x20api\x20pull`\x20to\x20refresh.','8694ycdScT','4ghcOmB','profileName','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','operation-type','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','name','validation','write','/HOOK/','\x22\x20not\x20found\x20for\x20dataset\x20','before','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','.js\x0a','\x0a\x20*\x20[平台配置]\x20','mergedCli','117805DbTMup','selectedAppName','functionNode','修改后的响应结果','Dataset\x20not\x20found\x20for\x20code\x20\x22','/data/dataset/','code','datasetCode','parseInt','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','find','description','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','132kiJKOH','trim','function-node','datasetId','entries','\x22\x20not\x20found.\x20','source','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','datasetcode','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','create','after','Select\x20trigger\x20node:','.js','Operation\x20type\x20\x22','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','UNKNOWN','Available\x20aliases:\x20','\x20function:\x20','nonInteractive','length','keys','str','map','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','/COMMON/','currentApp','3059490klTcTi','/**\x0a\x20*\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','includes','Created\x20','defaultApp','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','join','appCode','No\x20datasets\x20found\x20for\x20this\x20app.','Select\x20operation\x20type:','Invalid\x20dataset\x20selection.','operationType','type','filePath','\x22.\x20','/ENDPOINT/','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','No\x20model\x20aliases\x20found.\x20Run\x20`','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','1192unnHOJ','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','alias','.js\x0a\x20*\x20[触发节点]\x20','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Trigger\x20node\x20(HOOK\x20only)','4969371pdIpaI','question','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Available:\x20','utf8','11645MeAxqI','修改后的请求参数'];a37_0x2eed=function(){return _0x1adf5a;};return a37_0x2eed();}import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x18a8(_0x15f958,_0x174e48){_0x15f958=_0x15f958-0x1c0;const _0x2eed2e=a37_0x2eed();let _0x18a846=_0x2eed2e[_0x15f958];return _0x18a846;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a37_0x6f81a6(0x1fb),'description':a37_0x6f81a6(0x1f0),'risk':'read','flags':[{'name':a37_0x6f81a6(0x21d),'type':a37_0x6f81a6(0x1c8),'required':!![],'enum':[a37_0x6f81a6(0x1cc),a37_0x6f81a6(0x1c6),a37_0x6f81a6(0x1c3)],'description':'Script\x20type'},{'name':a37_0x6f81a6(0x1da),'type':a37_0x6f81a6(0x1c8),'required':!![],'description':a37_0x6f81a6(0x1cb)},{'name':a37_0x6f81a6(0x1ef),'type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x234)},{'name':'alias','type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x221)},{'name':a37_0x6f81a6(0x1f9),'type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x1fa)},{'name':a37_0x6f81a6(0x1d8),'type':a37_0x6f81a6(0x1c8),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a37_0x6f81a6(0x1f3),'type':a37_0x6f81a6(0x1c8),'description':a37_0x6f81a6(0x229),'enum':['before','after']}],async 'validate'(_0x31c80b){const _0x3f4982=a37_0x6f81a6,_0x551383=_0x31c80b['str']('name');if(!isValidBffFunctionName(_0x551383))throw CliErrors[_0x3f4982(0x1db)](_0x3f4982(0x1c4)+_0x551383+_0x3f4982(0x1d7));},async 'execute'(_0x3e707d){const _0x2f057d=a37_0x6f81a6,_0x1144f3=loadBffProjectConfig(_0x3e707d['appCode']),_0x572bb4=_0x3e707d[_0x2f057d(0x207)](_0x2f057d(0x21d)),_0x5c4f47=_0x3e707d[_0x2f057d(0x207)](_0x2f057d(0x1da)),_0x324521=_0x3e707d[_0x2f057d(0x207)]('description')||undefined,_0x14461c=_0x572bb4===_0x2f057d(0x1c3)?await resolveHookOptions(_0x1144f3,_0x3e707d):undefined,_0x21df5e=buildFilePath(_0x1144f3,_0x572bb4,_0x5c4f47,_0x14461c);if(await fileExists(_0x21df5e))throw CliErrors[_0x2f057d(0x1db)](_0x2f057d(0x233)+_0x21df5e);await mkdir(dirname(_0x21df5e),{'recursive':!![]});const _0x10be28=generateTemplate(_0x572bb4,_0x5c4f47,_0x3e707d[_0x2f057d(0x218)],_0x324521,_0x14461c);await writeFile(_0x21df5e,_0x10be28,_0x2f057d(0x22e));const _0xacc30c={'type':_0x572bb4,'name':_0x5c4f47,'path':_0x21df5e};if(_0x324521)_0xacc30c[_0x2f057d(0x1ef)]=_0x324521;if(_0x14461c){if(_0x14461c[_0x2f057d(0x226)])_0xacc30c[_0x2f057d(0x226)]=_0x14461c[_0x2f057d(0x226)];_0xacc30c['datasetCode']=_0x14461c[_0x2f057d(0x1eb)],_0xacc30c['operationType']=_0x14461c[_0x2f057d(0x21c)],_0xacc30c[_0x2f057d(0x1e6)]=_0x14461c['functionNode'];}return{'ok':!![],'data':_0xacc30c,'message':_0x2f057d(0x213)+_0x572bb4+_0x2f057d(0x203)+_0x5c4f47};}};async function resolveHookOptions(_0x39f610,_0x1581f1){const _0x287e34=a37_0x6f81a6,_0x4d09db=resolveApiModelSource(_0x1581f1[_0x287e34(0x1d0)],_0x1581f1['appCode'],_0x1581f1[_0x287e34(0x1e5)]||_0x1581f1['mergedCli']?.[_0x287e34(0x20e)]||_0x1581f1[_0x287e34(0x1e3)]?.[_0x287e34(0x214)]),_0x355da1=loadAliasMap(_0x1581f1[_0x287e34(0x1d0)],undefined,_0x4d09db[_0x287e34(0x21e)],_0x4d09db['profileName']),_0x331529=_0x355da1['length']>0x0;let _0x26ee28,_0x1d030b,_0x135ee0;const _0x58e317=_0x1581f1[_0x287e34(0x207)]('alias'),_0x2550fd=_0x1581f1[_0x287e34(0x207)](_0x287e34(0x1f9));if(_0x58e317){const _0x3b2ef4=resolveAlias(_0x1581f1[_0x287e34(0x1d0)],_0x58e317,undefined,_0x4d09db[_0x287e34(0x21e)],_0x4d09db[_0x287e34(0x1d5)]);if(!_0x3b2ef4){const _0x29f6f3=_0x331529?_0x287e34(0x202)+_0x355da1[_0x287e34(0x208)](_0x10ee6c=>_0x10ee6c[_0x287e34(0x226)])[_0x287e34(0x217)](',\x20'):_0x287e34(0x222)+CLI_BIN_NAME+_0x287e34(0x1cf);throw CliErrors['validation']('Alias\x20\x22'+_0x58e317+_0x287e34(0x1f6)+_0x29f6f3);}_0x26ee28=_0x58e317,_0x1d030b=_0x3b2ef4;}else{if(_0x2550fd){_0x1d030b=_0x2550fd;const _0x757dbd=_0x355da1[_0x287e34(0x1ee)](_0x480c10=>_0x480c10[_0x287e34(0x1eb)]===_0x2550fd);_0x26ee28=_0x757dbd?.['alias'];}else{if(_0x1581f1[_0x287e34(0x204)])throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x200));else{if(_0x331529){const _0x416a31=_0x355da1['map'](_0x43c65d=>_0x43c65d['alias']+'\x20('+_0x43c65d['tableName']+')'),_0x10ffce=await promptSelect(_0x287e34(0x1d1),_0x416a31),_0x4046cd=_0x355da1[_0x10ffce];if(!_0x4046cd)throw CliErrors['validation'](_0x287e34(0x21b));_0x26ee28=_0x4046cd[_0x287e34(0x226)],_0x1d030b=_0x4046cd['datasetCode'];}else{const _0x3c96e7=await listDatasets(_0x1581f1[_0x287e34(0x218)]);if(_0x3c96e7[_0x287e34(0x205)]===0x0)throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x219));const _0x4a34c3=_0x3c96e7[_0x287e34(0x208)](_0x152f7f=>_0x152f7f[_0x287e34(0x1da)]+'\x20['+(_0x152f7f[_0x287e34(0x1f7)]??_0x287e34(0x201))+']\x20('+_0x152f7f[_0x287e34(0x1ea)]+')'),_0x3ed633=await promptSelect(_0x287e34(0x1d1),_0x4a34c3),_0x520bcb=_0x3c96e7[_0x3ed633];if(!_0x520bcb)throw CliErrors['validation'](_0x287e34(0x21b));_0x1d030b=_0x520bcb[_0x287e34(0x1ea)],_0x26ee28=undefined;}}}}const _0x1335bb=await listDatasets(_0x1581f1[_0x287e34(0x218)]),_0x36ec12=_0x1335bb[_0x287e34(0x1ee)](_0x305bcf=>_0x305bcf[_0x287e34(0x1ea)]===_0x1d030b);if(!_0x36ec12)throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x1e8)+_0x1d030b+_0x287e34(0x21f)+(_0x26ee28?_0x287e34(0x1ed)+CLI_BIN_NAME+_0x287e34(0x1d2):''));_0x135ee0=_0x36ec12['id'];const _0x5794c4=_0x26ee28??_0x1d030b,_0x4510fd=await listBffDatasetOperations(_0x1581f1[_0x287e34(0x218)],_0x135ee0),_0x4c39df=_0x4510fd?Object[_0x287e34(0x206)](_0x4510fd):[];if(_0x4c39df[_0x287e34(0x205)]===0x0)throw CliErrors['validation'](_0x287e34(0x1c9)+_0x5794c4+'.');let _0x70cb3b;const _0x1b246f=_0x1581f1[_0x287e34(0x207)]('operation-type');if(_0x1b246f){if(!_0x4c39df[_0x287e34(0x212)](_0x1b246f))throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x1ff)+_0x1b246f+_0x287e34(0x1de)+_0x5794c4+'.\x20'+(_0x287e34(0x22d)+_0x4c39df[_0x287e34(0x217)](',\x20')));_0x70cb3b=_0x1b246f;}else{if(_0x1581f1[_0x287e34(0x204)])throw CliErrors['validation'](_0x287e34(0x20c));const _0x158e46=await promptSelect(_0x287e34(0x21a),_0x4c39df);_0x70cb3b=_0x4c39df[_0x158e46]??_0x4c39df[0x0];}let _0x4c68df=normalizeHookFunctionNode(_0x1581f1[_0x287e34(0x207)]('function-node'));if(!_0x4c68df){if(_0x1581f1['str']('function-node'))throw CliErrors[_0x287e34(0x1db)](_0x287e34(0x1d6));if(_0x1581f1['nonInteractive'])throw CliErrors['validation'](_0x287e34(0x1f8));const _0xdb3b78=await promptSelect(_0x287e34(0x1fd),[_0x287e34(0x1df),_0x287e34(0x1fc)]);_0x4c68df=[_0x287e34(0x1df),_0x287e34(0x1fc)][_0xdb3b78]??'before';}return{'alias':_0x26ee28,'datasetCode':_0x1d030b,'datasetId':_0x135ee0,'operationType':_0x70cb3b,'functionNode':_0x4c68df};}async function promptSelect(_0x13eab8,_0x4c4bf3){const _0x3632d2=a37_0x6f81a6;if(_0x4c4bf3[_0x3632d2(0x205)]===0x1)return 0x0;for(const [_0x2d7cfb,_0x2e887e]of _0x4c4bf3[_0x3632d2(0x1f5)]()){process[_0x3632d2(0x1c0)]['write']('\x20\x20'+(_0x2d7cfb+0x1)+'.\x20'+_0x2e887e+'\x0a');}const _0x1c6e80=createInterface({'input':process['stdin'],'output':process[_0x3632d2(0x1c0)]});while(!![]){const _0x45bafe=await new Promise(_0x5310ad=>{const _0x508c71=_0x3632d2;_0x1c6e80[_0x508c71(0x22b)](_0x13eab8+'\x20',_0x5310ad);}),_0x42f2fd=Number[_0x3632d2(0x1ec)](_0x45bafe[_0x3632d2(0x1f2)](),0xa);if(Number['isInteger'](_0x42f2fd)&&_0x42f2fd>=0x1&&_0x42f2fd<=_0x4c4bf3[_0x3632d2(0x205)])return _0x1c6e80[_0x3632d2(0x1c5)](),_0x42f2fd-0x1;process[_0x3632d2(0x1c0)][_0x3632d2(0x1dc)](_0x3632d2(0x223)+_0x4c4bf3['length']+'.\x0a');}}function buildFilePath(_0x42c563,_0x10ef68,_0x12a605,_0x5f4189){const _0x1539ac=a37_0x6f81a6;if(_0x10ef68===_0x1539ac(0x1c3)){if(!_0x5f4189)throw CliErrors[_0x1539ac(0x1db)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x36477e=_0x5f4189['alias']??_0x5f4189[_0x1539ac(0x1eb)];return join(_0x42c563[_0x1539ac(0x1ca)],_0x1539ac(0x1c3),_0x36477e,_0x5f4189[_0x1539ac(0x21c)],_0x5f4189[_0x1539ac(0x1e6)],_0x12a605+_0x1539ac(0x1fe));}return join(_0x42c563[_0x1539ac(0x1ca)],_0x10ef68,_0x12a605+_0x1539ac(0x1fe));}export function generateTemplate(_0x527172,_0x158061,_0x46d2b1,_0xe874e6,_0x474809){const _0x2fe1bc=a37_0x6f81a6,_0x12cb5b=_0xe874e6?.[_0x2fe1bc(0x1f2)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3fb0da=getAppBaseUrl(_0x46d2b1),_0x1c4c54=_0x2fe1bc(0x215);if(_0x527172===_0x2fe1bc(0x1cc))return'/**\x0a\x20*\x20'+_0x12cb5b+_0x2fe1bc(0x1c2)+_0x158061+_0x2fe1bc(0x1e2)+_0x3fb0da+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x46d2b1+_0x2fe1bc(0x20d)+_0x158061+_0x2fe1bc(0x216)+_0x158061+'\x22,\x20params\x20})\x0a'+_0x1c4c54+_0x2fe1bc(0x211)+_0x158061+_0x2fe1bc(0x228);if(_0x527172===_0x2fe1bc(0x1c6))return _0x2fe1bc(0x210)+_0x12cb5b+_0x2fe1bc(0x225)+_0x158061+_0x2fe1bc(0x209)+_0x46d2b1+'/'+_0x158061+'\x0a\x20*\x20[平台配置]\x20'+_0x3fb0da+_0x2fe1bc(0x20a)+_0x46d2b1+_0x2fe1bc(0x220)+_0x158061+_0x2fe1bc(0x1e1)+_0x1c4c54+_0x2fe1bc(0x1c1)+_0x158061+_0x2fe1bc(0x228);if(!_0x474809)throw CliErrors[_0x2fe1bc(0x1db)](_0x2fe1bc(0x20b));const _0x3ae318=_0x474809['alias']??_0x474809['datasetCode'],_0x38722b=_0x474809[_0x2fe1bc(0x1e6)]===_0x2fe1bc(0x1df)?'当前请求参数':'当前响应结果',_0x47c57c=_0x474809[_0x2fe1bc(0x1e6)]===_0x2fe1bc(0x1df)?_0x2fe1bc(0x230):_0x2fe1bc(0x1e7);return _0x2fe1bc(0x210)+_0x12cb5b+_0x2fe1bc(0x22c)+_0x158061+_0x2fe1bc(0x1c7)+_0x46d2b1+'/'+_0x474809[_0x2fe1bc(0x1eb)]+'/'+_0x474809[_0x2fe1bc(0x21c)]+_0x2fe1bc(0x1e2)+_0x3fb0da+_0x2fe1bc(0x1e9)+_0x474809[_0x2fe1bc(0x1f4)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x46d2b1+_0x2fe1bc(0x1dd)+_0x3ae318+'/'+_0x474809['operationType']+'/'+_0x474809[_0x2fe1bc(0x1e6)]+'/'+_0x158061+_0x2fe1bc(0x227)+_0x474809[_0x2fe1bc(0x1e6)]+'\x0a'+_0x1c4c54+_0x2fe1bc(0x1d9)+_0x38722b+_0x2fe1bc(0x1cd)+_0x47c57c+_0x2fe1bc(0x1e0)+_0x158061+_0x2fe1bc(0x228);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x426733=a38_0x5163;(function(_0x21fd2c,_0x55a17b){const _0x2cca4d=a38_0x5163,_0x2f9619=_0x21fd2c();while(!![]){try{const _0x33b10c=-parseInt(_0x2cca4d(0x146))/0x1+-parseInt(_0x2cca4d(0x130))/0x2*(-parseInt(_0x2cca4d(0x14c))/0x3)+-parseInt(_0x2cca4d(0x14b))/0x4+-parseInt(_0x2cca4d(0x152))/0x5+parseInt(_0x2cca4d(0x149))/0x6*(parseInt(_0x2cca4d(0x12c))/0x7)+parseInt(_0x2cca4d(0x13a))/0x8+parseInt(_0x2cca4d(0x12f))/0x9;if(_0x33b10c===_0x55a17b)break;else _0x2f9619['push'](_0x2f9619['shift']());}catch(_0x27a4af){_0x2f9619['push'](_0x2f9619['shift']());}}}(a38_0x3a37,0xc0ac1));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a38_0x3a37(){const _0x48cb75=['apps','bff','toISOString','appCode','target','POST','No\x20lock\x20entry\x20found\x20for\x20\x22','774533jqSNzJ','join','remoteId','386292vSmHzy','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','781388zpeGMN','33HJoJui','functions','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','scriptsRoot','trashedTo','validation','6607280zGPaZz','/api/management/library/scripts/delete','scriptsRootDir','stringify','trashDir','\x22\x20not\x20found\x20after\x20ensureLockScope.','lockFilePath','high-risk-write','28dWfrLS','\x20(local\x20file\x20moved\x20to\x20trash)','str','6947676OPUJWU','233196kMcVcv','length','find','projectRoot','parse','Lock\x20scope\x20for\x20app\x20\x22','\x20\x20-\x20','Function\x20not\x20found:\x20','Deleted\x20','startsWith','6147608bnIXSM','delete','keys','<timestamp>','Local\x20delete\x20not\x20settled\x20for\x20'];a38_0x3a37=function(){return _0x48cb75;};return a38_0x3a37();}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';function a38_0x5163(_0x33a07e,_0x51eee6){_0x33a07e=_0x33a07e-0x128;const _0x3a3706=a38_0x3a37();let _0x516315=_0x3a3706[_0x33a07e];return _0x516315;}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_0x426733(0x140),'command':a38_0x426733(0x13b),'description':'Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','risk':a38_0x426733(0x12b),'flags':[{'name':'target','type':'string','required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x381b29){const _0x2b03a7=a38_0x426733,_0xa14b2f=loadBffProjectConfig(_0x381b29[_0x2b03a7(0x142)]),_0x576cbb=await readBffLockFile(_0xa14b2f[_0x2b03a7(0x12a)]);if(!_0x576cbb)throw CliErrors[_0x2b03a7(0x151)](_0x2b03a7(0x14a));},async 'dryRun'(_0x4e35bf){const _0x38423=a38_0x426733,_0x48229e=loadBffProjectConfig(_0x4e35bf[_0x38423(0x142)]),_0x3d953c=await readBffLockFile(_0x48229e[_0x38423(0x12a)]);if(!_0x3d953c)throw CliErrors['validation']('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {appLock:_0x3c9a25}=ensureLockScope(_0x3d953c,_0x4e35bf['appCode'],_0x48229e[_0x38423(0x14f)],_0x38423(0x13b)),_0x29ff76=_0x4e35bf[_0x38423(0x12e)](_0x38423(0x143)),_0x30b975=Object[_0x38423(0x13c)](_0x3c9a25[_0x38423(0x14d)]),_0x2a89d9=resolveDeleteTarget(_0x29ff76,_0x30b975),_0x49f6ad=_0x3c9a25[_0x38423(0x14d)][_0x2a89d9];if(!_0x49f6ad)throw CliErrors[_0x38423(0x151)](_0x38423(0x145)+_0x2a89d9+'\x22.');const _0x48e764=resolveLocalFilePathFromLockKey(_0x48229e,_0x2a89d9),_0x328c25=relative(_0x48229e['projectRoot'],_0x48e764),_0x319460=join(_0x48229e[_0x38423(0x128)],_0x38423(0x13d),_0x328c25);return{'method':_0x38423(0x144),'url':_0x38423(0x153),'body':{'appCode':_0x4e35bf[_0x38423(0x142)],'target':_0x2a89d9,'remoteId':_0x49f6ad['remoteId'],'localFilePath':_0x48e764,'trashedPath':_0x319460},'description':'Would\x20delete\x20'+_0x2a89d9+_0x38423(0x14e)};},async 'execute'(_0x22c4d1){const _0x9077ac=a38_0x426733,_0x1af3ef=loadBffProjectConfig(_0x22c4d1[_0x9077ac(0x142)]),_0x36e02c=await readBffLockFile(_0x1af3ef[_0x9077ac(0x12a)]);if(!_0x36e02c)throw CliErrors[_0x9077ac(0x151)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x3c452f,appLock:_0x5062fd}=ensureLockScope(_0x36e02c,_0x22c4d1[_0x9077ac(0x142)],_0x1af3ef[_0x9077ac(0x14f)],_0x9077ac(0x13b)),_0x562a15=JSON[_0x9077ac(0x134)](JSON[_0x9077ac(0x155)](_0x3c452f)),_0x55ae69=_0x562a15[_0x9077ac(0x13f)][_0x22c4d1[_0x9077ac(0x142)]];if(!_0x55ae69)throw new Error(_0x9077ac(0x135)+_0x22c4d1['appCode']+_0x9077ac(0x129));const _0xa00000=_0x22c4d1[_0x9077ac(0x12e)](_0x9077ac(0x143)),_0x548d4f=Object[_0x9077ac(0x13c)](_0x55ae69[_0x9077ac(0x14d)]),_0x5d3529=resolveDeleteTarget(_0xa00000,_0x548d4f),_0x26bbbc=_0x55ae69[_0x9077ac(0x14d)][_0x5d3529];if(!_0x26bbbc)throw CliErrors['validation'](_0x9077ac(0x145)+_0x5d3529+'\x22.');await deleteBffScript(_0x26bbbc[_0x9077ac(0x148)]),delete _0x55ae69['functions'][_0x5d3529],_0x55ae69['lastSync']=new Date()[_0x9077ac(0x141)](),await writeBffLockFile(_0x1af3ef[_0x9077ac(0x12a)],_0x562a15);const _0x30cd5c=resolveLocalFilePathFromLockKey(_0x1af3ef,_0x5d3529);let _0x39aabb;await fileExists(_0x30cd5c)&&(_0x39aabb=await moveToTrash(_0x1af3ef[_0x9077ac(0x133)],_0x1af3ef[_0x9077ac(0x128)],_0x30cd5c),await cleanupEmptyDirectories(dirname(_0x30cd5c),_0x1af3ef[_0x9077ac(0x154)]));await waitForDeleteSettlement(_0x1af3ef[_0x9077ac(0x12a)],_0x22c4d1['appCode'],_0x5d3529,_0x30cd5c),await sleep(0x96);const _0x7d95bd={'deleted':_0x5d3529,'remoteId':_0x26bbbc[_0x9077ac(0x148)]};if(_0x39aabb)_0x7d95bd[_0x9077ac(0x150)]=_0x39aabb;return{'ok':!![],'data':_0x7d95bd,'message':_0x9077ac(0x138)+_0x5d3529+(_0x39aabb?_0x9077ac(0x12d):'')};}};function resolveDeleteTarget(_0x477865,_0x4f9d3c){const _0x4cc250=a38_0x426733;if(_0x477865['includes']('/')){const _0x436f83=_0x4f9d3c[_0x4cc250(0x132)](_0x1cb151=>_0x1cb151===_0x477865);if(!_0x436f83)throw CliErrors[_0x4cc250(0x151)](_0x4cc250(0x137)+_0x477865);return _0x436f83;}const _0x6752a9=_0x4f9d3c['filter'](_0x176caf=>_0x176caf['split']('/')['at'](-0x1)===_0x477865);if(_0x6752a9['length']===0x0)throw CliErrors[_0x4cc250(0x151)]('Function\x20not\x20found:\x20'+_0x477865);if(_0x6752a9['length']>0x1)throw CliErrors[_0x4cc250(0x151)]('Multiple\x20functions\x20match\x20\x22'+_0x477865+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x6752a9['map'](_0x21bbb2=>_0x4cc250(0x136)+_0x21bbb2)[_0x4cc250(0x147)]('\x0a'));return _0x6752a9[0x0];}async function moveToTrash(_0xe8e0d,_0x10fb4b,_0x40dc92){const _0x2d945b=a38_0x426733,_0x44fc04=new Date()[_0x2d945b(0x141)]()['replace'](/[:.]/g,'-'),_0x1e44e5=relative(_0xe8e0d,_0x40dc92),_0x55973b=join(_0x10fb4b,_0x44fc04,_0x1e44e5);return await mkdir(dirname(_0x55973b),{'recursive':!![]}),await rename(_0x40dc92,_0x55973b),_0x55973b;}async function cleanupEmptyDirectories(_0x225257,_0x358b24){const _0x454c44=a38_0x426733;let _0x558cde=resolve(_0x225257);const _0x773a07=resolve(_0x358b24);while(_0x558cde[_0x454c44(0x139)](''+_0x773a07+sep)||_0x558cde===_0x773a07){if(_0x558cde===_0x773a07)return;try{const _0x3169a9=await readdir(_0x558cde);if(_0x3169a9[_0x454c44(0x131)]>0x0)return;await rmdir(_0x558cde);}catch{return;}_0x558cde=dirname(_0x558cde);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x594f74,_0x5790d8,_0x441033,_0x54ce62){const _0x1c45fc=a38_0x426733;for(let _0x346293=0x0;_0x346293<DELETE_SETTLE_RETRY_COUNT;_0x346293+=0x1){const _0x496270=await readBffLockFile(_0x594f74),_0x287a20=!!_0x496270?.[_0x1c45fc(0x13f)]?.[_0x5790d8]?.[_0x1c45fc(0x14d)]?.[_0x441033],_0x542d3e=await fileExists(_0x54ce62);if(!_0x287a20&&!_0x542d3e)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x1c45fc(0x13e)+_0x441033+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x46d44f=a39_0x5abf;function a39_0x5abf(_0x530808,_0xf12855){_0x530808=_0x530808-0x167;const _0x54be78=a39_0x54be();let _0x5abf94=_0x54be78[_0x530808];return _0x5abf94;}(function(_0x1e2126,_0x2e22c7){const _0x25dbfd=a39_0x5abf,_0x5d2bab=_0x1e2126();while(!![]){try{const _0x2a76f8=-parseInt(_0x25dbfd(0x174))/0x1+parseInt(_0x25dbfd(0x167))/0x2*(parseInt(_0x25dbfd(0x17b))/0x3)+-parseInt(_0x25dbfd(0x17a))/0x4*(parseInt(_0x25dbfd(0x17c))/0x5)+-parseInt(_0x25dbfd(0x179))/0x6*(-parseInt(_0x25dbfd(0x17e))/0x7)+parseInt(_0x25dbfd(0x17f))/0x8+-parseInt(_0x25dbfd(0x16b))/0x9+parseInt(_0x25dbfd(0x16e))/0xa;if(_0x2a76f8===_0x2e22c7)break;else _0x5d2bab['push'](_0x5d2bab['shift']());}catch(_0x12e99e){_0x5d2bab['push'](_0x5d2bab['shift']());}}}(a39_0x54be,0xe4822));function a39_0x54be(){const _0x353b91=['Return\x20full\x20raw\x20script\x20object','functionName','84riIRyz','8jeVGsU','3686853ItNTeZ','3634895EmKEXm','verbose','754145xlIXgS','4645848MhLnGb','2wDmSiG','updateUserName','num','bff','5277393PmVddI','read','updatedTime','6149170nxfBEK','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','detail','bool','boolean','appCode','956584OeRDRH','createdTime','Script\x20ID'];a39_0x54be=function(){return _0x353b91;};return a39_0x54be();}import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x46d44f(0x16a),'command':a39_0x46d44f(0x170),'description':a39_0x46d44f(0x16f),'risk':a39_0x46d44f(0x16c),'flags':[{'name':'id','type':'number','required':!![],'description':a39_0x46d44f(0x176)},{'name':'verbose','type':a39_0x46d44f(0x172),'description':a39_0x46d44f(0x177)}],async 'execute'(_0x1c39f4){const _0x368025=a39_0x46d44f,_0x382363=await getBffScriptInfo(_0x1c39f4[_0x368025(0x169)]('id')),_0x5bcc26=_0x1c39f4[_0x368025(0x171)](_0x368025(0x17d));if(_0x5bcc26)return{'ok':!![],'data':_0x382363};return{'ok':!![],'data':{'id':_0x382363['id'],'functionName':_0x382363[_0x368025(0x178)]??'','version':_0x382363['version']??'','updateUserName':_0x382363[_0x368025(0x168)]??'','appCode':_0x382363[_0x368025(0x173)],'scriptType':_0x382363['scriptType'],'description':_0x382363['description']||'(none)','createdTime':_0x382363[_0x368025(0x175)]??'','updatedTime':_0x382363[_0x368025(0x16d)]??'','scriptContent':_0x382363['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x196301,_0x3e015f){const _0x3d62d6=a40_0x4008,_0x31f3be=_0x196301();while(!![]){try{const _0x201084=parseInt(_0x3d62d6(0x19e))/0x1+parseInt(_0x3d62d6(0x19a))/0x2+parseInt(_0x3d62d6(0x19f))/0x3*(-parseInt(_0x3d62d6(0x199))/0x4)+parseInt(_0x3d62d6(0x19c))/0x5+-parseInt(_0x3d62d6(0x198))/0x6+parseInt(_0x3d62d6(0x19b))/0x7+-parseInt(_0x3d62d6(0x19d))/0x8;if(_0x201084===_0x3e015f)break;else _0x31f3be['push'](_0x31f3be['shift']());}catch(_0x48c4d7){_0x31f3be['push'](_0x31f3be['shift']());}}}(a40_0x3909,0xc2051));import{bffList}from'../../commands/bff/list.js';function a40_0x4008(_0x2bfebc,_0x184a7a){_0x2bfebc=_0x2bfebc-0x198;const _0x3909ae=a40_0x3909();let _0x400871=_0x3909ae[_0x2bfebc];return _0x400871;}import{bffDetail}from'../../commands/bff/detail.js';function a40_0x3909(){const _0x37b445=['6682758lutGbR','116EGxZSh','678152yFlNKp','3012163ofXQAD','3849245qwCZTO','6340904GlcRhC','1236059jUmAwr','7674lWpSLg'];a40_0x3909=function(){return _0x37b445;};return a40_0x3909();}import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';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_0x1c215b=a41_0x2ab5;(function(_0x3dcf22,_0x40a138){const _0x241525=a41_0x2ab5,_0x1dfc32=_0x3dcf22();while(!![]){try{const _0x53b7b4=-parseInt(_0x241525(0x132))/0x1*(parseInt(_0x241525(0x14b))/0x2)+parseInt(_0x241525(0x143))/0x3+-parseInt(_0x241525(0x142))/0x4*(parseInt(_0x241525(0x13f))/0x5)+parseInt(_0x241525(0x141))/0x6*(parseInt(_0x241525(0x146))/0x7)+-parseInt(_0x241525(0x136))/0x8+parseInt(_0x241525(0x135))/0x9+-parseInt(_0x241525(0x14a))/0xa*(-parseInt(_0x241525(0x139))/0xb);if(_0x53b7b4===_0x40a138)break;else _0x1dfc32['push'](_0x1dfc32['shift']());}catch(_0x65ef7b){_0x1dfc32['push'](_0x1dfc32['shift']());}}}(a41_0x1223,0xbd388));function a41_0x2ab5(_0x2b1d0f,_0x144902){_0x2b1d0f=_0x2b1d0f-0x132;const _0x12235f=a41_0x1223();let _0x2ab56d=_0x12235f[_0x2b1d0f];return _0x2ab56d;}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':'bff','command':'list','description':a41_0x1c215b(0x14c),'risk':'read','flags':[{'name':'type','type':'string','description':a41_0x1c215b(0x138),'default':a41_0x1c215b(0x13e),'enum':['ENDPOINT',a41_0x1c215b(0x145)]},{'name':a41_0x1c215b(0x140),'type':a41_0x1c215b(0x134),'description':a41_0x1c215b(0x13d)},{'name':a41_0x1c215b(0x137),'type':a41_0x1c215b(0x144),'description':a41_0x1c215b(0x13b)}],async 'execute'(_0x57f775){const _0x48cd01=a41_0x1c215b,_0x28dcaa=await listBffScripts(_0x57f775[_0x48cd01(0x14e)],_0x57f775[_0x48cd01(0x133)]('type'),{'scriptName':_0x57f775['str'](_0x48cd01(0x140))||undefined}),_0x2bd608=_0x57f775['bool'](_0x48cd01(0x137));return{'ok':!![],'data':_0x2bd608?_0x28dcaa:_0x28dcaa[_0x48cd01(0x147)](_0x4497e1=>({'id':_0x4497e1['id'],'functionName':_0x4497e1[_0x48cd01(0x13c)]??'','description':_0x4497e1[_0x48cd01(0x13a)]||_0x48cd01(0x149),'scriptType':_0x4497e1['scriptType']})),'message':_0x28dcaa[_0x48cd01(0x14d)]===0x0?_0x48cd01(0x148):undefined};}};function a41_0x1223(){const _0x1c5f56=['name','6dSRUTG','2504aGAMgl','3009360ejmnty','boolean','COMMON','9802856XAECoS','map','No\x20Backend\x20Function\x20scripts\x20found.','(unnamed)','170gdtNTx','2WeyQYW','List\x20Backend\x20Function\x20scripts','length','appCode','1236839AmxWBI','str','string','2211984Khqsbl','11836960SFwBQx','verbose','Script\x20type\x20filter','1241251jMqMjn','description','Return\x20full\x20script\x20objects','functionName','Filter\x20by\x20script\x20name','ENDPOINT','8595WVvrMh'];a41_0x1223=function(){return _0x1c5f56;};return a41_0x1223();}
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a42_0x541e(_0x462e92,_0x23812a){_0x462e92=_0x462e92-0xb9;const _0x3ba7ce=a42_0x3ba7();let _0x541e9b=_0x3ba7ce[_0x462e92];return _0x541e9b;}const a42_0x7a1b7f=a42_0x541e;(function(_0x5b1bc3,_0x1c6179){const _0x50c92d=a42_0x541e,_0x549a5b=_0x5b1bc3();while(!![]){try{const _0x3aadf3=-parseInt(_0x50c92d(0xbe))/0x1+-parseInt(_0x50c92d(0xce))/0x2+parseInt(_0x50c92d(0xd6))/0x3+-parseInt(_0x50c92d(0xd3))/0x4*(parseInt(_0x50c92d(0xc3))/0x5)+parseInt(_0x50c92d(0xc5))/0x6+-parseInt(_0x50c92d(0xdb))/0x7*(parseInt(_0x50c92d(0xb9))/0x8)+parseInt(_0x50c92d(0xbb))/0x9*(parseInt(_0x50c92d(0xc9))/0xa);if(_0x3aadf3===_0x1c6179)break;else _0x549a5b['push'](_0x549a5b['shift']());}catch(_0x5c056f){_0x549a5b['push'](_0x549a5b['shift']());}}}(a42_0x3ba7,0x64b2e));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=['DEBUG','INFO',a42_0x7a1b7f(0xd0),a42_0x7a1b7f(0xc8)];function a42_0x3ba7(){const _0xc28a18=['isSafeInteger','bff','6340VIZhtf','start-time','limit','2382363eUoIcd','logs','validation','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','--limit\x20must\x20be\x20between\x201\x20and\x20','119qNEiwx','--limit','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','keyword','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','level','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','end-time','Filter\x20by\x20log\x20level','193328nDMqXz','flag','9nAGLub','length','read','168340spmVIt','Found\x20','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','string','trim','695dwLbcb','since','4936254ORukHc','num','\x20Backend\x20Function\x20log\x20line(s).','ERROR','1937960nQsQLR','number','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','toUpperCase','1197374dcJmIj','\x20must\x20be\x20a\x20positive\x20integer.','WARN'];a42_0x3ba7=function(){return _0xc28a18;};return a42_0x3ba7();}export function resolveBffLogQuery(_0x11681e,_0x59f237=Date['now']()){const _0xa91c72=a42_0x7a1b7f,_0x534f46=_0x11681e[_0xa91c72(0xba)](_0xa91c72(0xc4)),_0x3b7a20=_0x11681e[_0xa91c72(0xba)](_0xa91c72(0xd4)),_0x5f1d82=_0x11681e['flag']('end-time');if(_0x534f46!==undefined&&_0x3b7a20!==undefined)throw CliErrors[_0xa91c72(0xd8)](_0xa91c72(0xcb));const _0x59b63c=_0x5f1d82===undefined?_0x59f237:readPositiveInteger(_0x11681e[_0xa91c72(0xc6)]('end-time'),'--end-time'),_0x1fb206=_0x3b7a20===undefined?_0x59b63c-readSinceMinutes(_0x11681e)*0xea60:readPositiveInteger(_0x11681e[_0xa91c72(0xc6)]('start-time'),'--start-time');if(_0x1fb206<=0x0)throw CliErrors['validation'](_0xa91c72(0xe1));if(_0x1fb206>_0x59b63c)throw CliErrors['validation'](_0xa91c72(0xc0));const _0x2e4030=readPositiveInteger(_0x11681e[_0xa91c72(0xc6)](_0xa91c72(0xd5),DEFAULT_LIMIT),_0xa91c72(0xdc));if(_0x2e4030>MAX_LIMIT)throw CliErrors['validation'](_0xa91c72(0xda)+MAX_LIMIT+'.');const _0x1dfa9a=_0x11681e['str'](_0xa91c72(0xe0))['trim']()[_0xa91c72(0xcd)]()||undefined,_0x151049=_0x11681e['str'](_0xa91c72(0xde))[_0xa91c72(0xc2)]()||undefined;return{'appCode':_0x11681e['appCode'],'startTime':_0x1fb206,'endTime':_0x59b63c,..._0x3b7a20===undefined?{'sinceMinutes':readSinceMinutes(_0x11681e)}:{},..._0x1dfa9a?{'level':_0x1dfa9a}:{},..._0x151049?{'keyword':_0x151049}:{},'limit':_0x2e4030};}function readSinceMinutes(_0x365c7f){const _0x19baed=a42_0x7a1b7f;return readPositiveInteger(_0x365c7f[_0x19baed(0xc6)]('since',DEFAULT_SINCE_MINUTES),'--since');}function readPositiveInteger(_0x2e78c6,_0x51dd65){const _0x458348=a42_0x7a1b7f;if(!Number[_0x458348(0xd1)](_0x2e78c6)||_0x2e78c6<=0x0)throw CliErrors[_0x458348(0xd8)](_0x51dd65+_0x458348(0xcf));return _0x2e78c6;}export const bffLogs={'service':a42_0x7a1b7f(0xd2),'command':a42_0x7a1b7f(0xd7),'description':a42_0x7a1b7f(0xdf),'risk':a42_0x7a1b7f(0xbd),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x7a1b7f(0xc4),'type':a42_0x7a1b7f(0xca),'description':a42_0x7a1b7f(0xcc)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x7a1b7f(0xd4),'type':a42_0x7a1b7f(0xca),'description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a42_0x7a1b7f(0xe2),'type':'number','description':a42_0x7a1b7f(0xd9)},{'name':a42_0x7a1b7f(0xe0),'type':a42_0x7a1b7f(0xc1),'description':a42_0x7a1b7f(0xe3),'enum':LOG_LEVELS},{'name':a42_0x7a1b7f(0xde),'type':a42_0x7a1b7f(0xc1),'description':a42_0x7a1b7f(0xdd)},{'name':a42_0x7a1b7f(0xd5),'type':a42_0x7a1b7f(0xca),'description':'Maximum\x20log\x20lines\x20to\x20return\x20(1-'+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0xe73678){resolveBffLogQuery(_0xe73678);},async 'execute'(_0xd38bec){const _0x17f512=a42_0x7a1b7f,_0x1f9c76=resolveBffLogQuery(_0xd38bec),{sinceMinutes:_0x29b344,..._0x3f0b75}=_0x1f9c76,_0x83f8bb=await searchBffScriptLogs(_0x3f0b75);return{'ok':!![],'data':{'query':_0x1f9c76,'count':_0x83f8bb[_0x17f512(0xbc)],'logs':_0x83f8bb},'message':_0x83f8bb[_0x17f512(0xbc)]===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':_0x17f512(0xbf)+_0x83f8bb[_0x17f512(0xbc)]+_0x17f512(0xc7)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x3d35be=a43_0x73b8;(function(_0x4aa9d1,_0x4a3ca4){const _0x5408e2=a43_0x73b8,_0x443e20=_0x4aa9d1();while(!![]){try{const _0x454527=-parseInt(_0x5408e2(0xb6))/0x1+parseInt(_0x5408e2(0x11d))/0x2*(parseInt(_0x5408e2(0xcf))/0x3)+parseInt(_0x5408e2(0x118))/0x4*(-parseInt(_0x5408e2(0x115))/0x5)+parseInt(_0x5408e2(0xc0))/0x6*(-parseInt(_0x5408e2(0xec))/0x7)+parseInt(_0x5408e2(0x10b))/0x8*(parseInt(_0x5408e2(0xcb))/0x9)+-parseInt(_0x5408e2(0x121))/0xa+parseInt(_0x5408e2(0xe6))/0xb;if(_0x454527===_0x4a3ca4)break;else _0x443e20['push'](_0x443e20['shift']());}catch(_0x269244){_0x443e20['push'](_0x443e20['shift']());}}}(a43_0x79aa,0x86908));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';function a43_0x73b8(_0x237e92,_0x209179){_0x237e92=_0x237e92-0xb1;const _0x79aa3e=a43_0x79aa();let _0x73b860=_0x79aa3e[_0x237e92];return _0x73b860;}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_0x3d35be(0xe2),'command':a43_0x3d35be(0x108),'description':a43_0x3d35be(0x146),'risk':a43_0x3d35be(0xb3),'structuredErrors':!![],'flags':[{'name':a43_0x3d35be(0x139),'type':a43_0x3d35be(0x12c),'description':a43_0x3d35be(0x102),'enum':['COMMON','ENDPOINT',a43_0x3d35be(0x13f)]},{'name':a43_0x3d35be(0xed),'type':a43_0x3d35be(0xd5),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x1262bc){const _0xf10050=a43_0x3d35be,_0x432ed0=loadBffProjectConfig(_0x1262bc[_0xf10050(0x132)]),_0x105fd7=await readBffLockFile(_0x432ed0[_0xf10050(0xd7)]),{appLock:_0x2feb73}=ensureLockScope(_0x105fd7??createEmptyBffLock(),_0x1262bc[_0xf10050(0x132)],_0x432ed0[_0xf10050(0x111)],'pull'),_0x154cec=normalizeBffType(_0x1262bc[_0xf10050(0xba)]('type'))??undefined,[_0x44f433,_0x2d09fd]=await Promise[_0xf10050(0xbd)]([listBffScripts(_0x1262bc[_0xf10050(0x132)],_0x154cec),getBffScriptStatistics(_0x1262bc['appCode'])]),_0x22afbd=_0x44f433[_0xf10050(0x12f)](_0x48f9e7=>normalizeBffType(_0x48f9e7[_0xf10050(0xb2)])==='HOOK'),_0x4873f3=_0x22afbd?buildDatasetCodeToAliasMap(_0x1262bc[_0xf10050(0x112)],_0x1262bc[_0xf10050(0x132)],_0x1262bc[_0xf10050(0x104)]||_0x1262bc[_0xf10050(0x109)]?.[_0xf10050(0xd9)]||_0x1262bc[_0xf10050(0x109)]?.[_0xf10050(0xca)]):new Map(),_0x55f45f=_0x22afbd?await planHookDirectoryMigration(_0x432ed0,_0x2feb73,_0x4873f3,await scanLocalBffFunctions(_0x432ed0,'HOOK')):undefined,_0x46d321=createHookLocationMap(_0x2d09fd),_0x2e3f00=[];for(const _0x293d23 of _0x44f433){const _0x504de=resolveRemoteScriptTarget(_0x432ed0,_0x293d23,_0x46d321,_0x55f45f?.['projectedFunctions']??_0x2feb73['functions'],_0x4873f3);if(!_0x504de){_0x2e3f00['push']({'scriptType':_0x293d23[_0xf10050(0xb2)],'functionName':_0x293d23[_0xf10050(0x13a)]??'','status':_0xf10050(0x128),'reason':_0xf10050(0x130)});continue;}const _0x40dfc4=(_0x55f45f?.[_0xf10050(0xde)]??_0x2feb73['functions'])[_0x504de['lockKey']],_0x507384=_0x293d23[_0xf10050(0x12d)]!=null?computeContentHash(_0x293d23[_0xf10050(0x12d)]):undefined,_0x580892=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x55f45f,_0x504de)??_0x504de[_0xf10050(0x113)],_0x40dfc4,_0x507384),_0x2c8b12=_0x580892?localUnsyncedConflict(_0x504de,_0x293d23['id']):undefined;_0x2e3f00[_0xf10050(0xce)]({'lockKey':_0x504de[_0xf10050(0x11c)],'filePath':_0x504de[_0xf10050(0x113)],'remoteId':_0x293d23['id']??null,'status':_0x2c8b12?_0xf10050(0x13c):'would_pull',..._0x2c8b12?{'conflict':_0x2c8b12}:{},..._0x504de['hookLocation']?{'alias':_0x504de['hookLocation'][_0xf10050(0xf8)]??null,'datasetCode':_0x504de[_0xf10050(0x125)][_0xf10050(0xef)],'operationType':_0x504de[_0xf10050(0x125)]['operationType'],'functionNode':_0x504de[_0xf10050(0x125)]['functionNode']}:{}});}return{'method':_0xf10050(0x133),'url':_0xf10050(0xdc)+_0x1262bc[_0xf10050(0x132)]+(_0x154cec?_0xf10050(0x131)+_0x154cec:'')+_0xf10050(0x119)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x1262bc[_0xf10050(0x132)],'filterType':_0x154cec??null,..._0x55f45f&&_0x55f45f[_0xf10050(0x110)][_0xf10050(0x10c)]>0x0?{'hookDirectoryMigrations':_0x55f45f[_0xf10050(0x110)][_0xf10050(0xbc)](_0x5ba4a7=>({'from':_0x5ba4a7[_0xf10050(0xfe)],'to':_0x5ba4a7[_0xf10050(0x142)]}))}:{},'files':_0x2e3f00},'description':_0xf10050(0xdf)+_0x2e3f00[_0xf10050(0x10c)]+_0xf10050(0x123)};},async 'execute'(_0x41be60){const _0x309960=a43_0x3d35be,_0x110a84=loadBffProjectConfig(_0x41be60[_0x309960(0x132)]),_0x191d45=await readBffLockFile(_0x110a84['lockFilePath']),{lockData:_0x132958,appLock:_0x53851b}=ensureLockScope(_0x191d45??createEmptyBffLock(),_0x41be60[_0x309960(0x132)],_0x110a84[_0x309960(0x111)],_0x309960(0x108)),_0x182daf=normalizeBffType(_0x41be60[_0x309960(0xba)](_0x309960(0x139)))??undefined;if(_0x41be60[_0x309960(0xba)](_0x309960(0x139))&&!_0x182daf)throw CliErrors[_0x309960(0x10a)](_0x309960(0xdb));const [_0x3610d5,_0x303257]=await Promise['all']([listBffScripts(_0x41be60[_0x309960(0x132)],_0x182daf),getBffScriptStatistics(_0x41be60[_0x309960(0x132)])]);if(_0x3610d5[_0x309960(0x10c)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x54a4cd=_0x41be60[_0x309960(0xc1)](_0x309960(0xed));if(_0x54a4cd&&!_0x41be60['nonInteractive']){const _0x15d477=await confirmForce();if(!_0x15d477)throw CliErrors[_0x309960(0xf4)](_0x309960(0xfa));}if(_0x54a4cd&&_0x41be60[_0x309960(0xfc)]){}const _0x3c0e5a=_0x3610d5[_0x309960(0x12f)](_0x199cf6=>normalizeBffType(_0x199cf6[_0x309960(0xb2)])==='HOOK'),_0x439d39=_0x3c0e5a?buildDatasetCodeToAliasMap(_0x41be60[_0x309960(0x112)],_0x41be60['appCode'],_0x41be60[_0x309960(0x104)]||_0x41be60[_0x309960(0x109)]?.[_0x309960(0xd9)]||_0x41be60[_0x309960(0x109)]?.[_0x309960(0xca)]):new Map(),_0x3b4459=createHookLocationMap(_0x303257),_0x42dcba=JSON[_0x309960(0xf2)](JSON[_0x309960(0x129)](_0x132958)),_0x33a04b=_0x41be60[_0x309960(0x132)],_0x4f9909=_0x42dcba[_0x309960(0xd4)][_0x33a04b];if(!_0x4f9909)throw new Error(_0x309960(0xcc)+_0x33a04b+_0x309960(0x12a));const _0x4669f2=_0x3c0e5a?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x110a84,_0x4f9909,_0x439d39,await scanLocalBffFunctions(_0x110a84,_0x309960(0x13f))),_0x4f9909):undefined,_0x3f08e9=createPullFileTransaction(),_0x505331=[],_0x795c8b=[],_0x583dac=[],_0x5596c0=[];for(const _0x4730b9 of _0x3610d5){const _0x4d0aea=resolveRemoteScriptTarget(_0x110a84,_0x4730b9,_0x3b4459,_0x4f9909[_0x309960(0xd8)],_0x439d39);if(!_0x4d0aea){_0x795c8b[_0x309960(0xce)]({'lockKey':_0x4730b9['scriptType']+'/'+_0x4730b9['functionName'],'reason':'unresolvable\x20target\x20path'});continue;}const _0x164084=_0x4f9909['functions'][_0x4d0aea[_0x309960(0x11c)]];try{if(!_0x4730b9['id'])throw new Error(_0x309960(0xd2));if(_0x4730b9[_0x309960(0x12d)]==null)throw new Error(_0x309960(0x120));const _0x249360=_0x4730b9[_0x309960(0x12d)],_0x362b98=computeContentHash(_0x249360);if(!_0x54a4cd){const _0x260d44=await hasUnsyncedLocalChanges(_0x4d0aea[_0x309960(0x113)],_0x164084,_0x362b98);if(_0x260d44){_0x583dac[_0x309960(0xce)](localUnsyncedConflict(_0x4d0aea,_0x4730b9['id']));continue;}}await _0x3f08e9[_0x309960(0x140)](_0x4d0aea['filePath'],_0x249360);const _0x4e5fc3={'hash':_0x362b98,'remoteId':_0x4730b9['id'],'version':_0x4730b9[_0x309960(0xf9)]};_0x4d0aea['type']===_0x309960(0x13f)&&_0x4d0aea[_0x309960(0x125)]&&(_0x4e5fc3[_0x309960(0xf8)]=_0x4d0aea['hookLocation'][_0x309960(0xf8)],_0x4e5fc3[_0x309960(0xef)]=_0x4d0aea[_0x309960(0x125)][_0x309960(0xef)],_0x4e5fc3[_0x309960(0xb5)]=_0x4d0aea[_0x309960(0x125)][_0x309960(0xb5)],_0x4e5fc3[_0x309960(0xe4)]=_0x4d0aea[_0x309960(0x125)][_0x309960(0xe4)]),_0x4f9909[_0x309960(0xd8)][_0x4d0aea[_0x309960(0x11c)]]=_0x4e5fc3,_0x505331[_0x309960(0xce)]({'lockKey':_0x4d0aea['lockKey'],'remoteId':_0x4730b9['id']});}catch(_0x2f3988){_0x5596c0[_0x309960(0xce)]({'lockKey':_0x4d0aea['lockKey'],'error':_0x2f3988 instanceof Error?_0x2f3988[_0x309960(0x145)]:String(_0x2f3988)});}}_0x4f9909['lastSync']=new Date()[_0x309960(0x117)]();try{await writeBffLockFile(_0x110a84[_0x309960(0xd7)],_0x42dcba);}catch(_0x44ad0e){const _0x21215a=[...await _0x3f08e9['rollback'](),...await _0x4669f2?.[_0x309960(0xf1)]()??[]];throw withRollbackErrors(_0x44ad0e,_0x309960(0x10f),_0x21215a);}return{'ok':_0x5596c0[_0x309960(0x10c)]===0x0,'data':{'pulled':_0x505331,'skipped':_0x795c8b,'conflicts':_0x583dac,'failed':_0x5596c0},'message':formatPullMessage(_0x505331[_0x309960(0x10c)],_0x795c8b['length'],_0x583dac[_0x309960(0x10c)],_0x5596c0['length'])};}};function a43_0x79aa(){const _0x25a467=['scriptType','read','set','operationType','492346ywSScI','\x20--name\x20','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','\x22\x20may\x20remain.','str','content','map','all','ino','require','993666AQzaiu','bool','\x20pulled','move','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','entries','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','stdin','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','sourceFilePathByNewLockKey','defaultApp','200493spKYkb','Lock\x20scope\x20for\x20app\x20\x22','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','push','1464591cSaQIn','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','remoteId','Remote\x20script\x20missing\x20id.','Could\x20not\x20restore\x20local\x20script\x20\x22','apps','boolean','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','lockFilePath','functions','currentApp','\x20failed','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','/api/management/library/scripts/list?appCode=','case-rename','projectedFunctions','Would\x20inspect\x20','\x22;\x20temporary\x20directory\x20\x22','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','bff','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','functionNode','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','4617624fSloLF','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.','delete','yes','Failed\x20to\x20write\x20local\x20script\x20\x22','stderr','7iyVyFJ','force','trim','datasetCode','\x20conflict','rollback','parse','toLowerCase','cancelled','requires','ENOENT','\x22\x20to\x20\x22','alias','version','Force\x20pull\x20cancelled.','split','nonInteractive','.hook-directory-migrate-','oldDirectory','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','has','entry','Pull\x20only\x20this\x20script\x20type','\x22:\x20','selectedAppName','oldDirectoryPath','question','Pull\x20complete:\x20','pull','mergedCli','validation','256gKfbSU','length','scriptsRootDir','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','migrations','scriptsRoot','apiDir','filePath','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','603870ULNEkf','get','toISOString','24GFqhhu','¤tPage=1&pageSize=','reverse','HOOK/','lockKey','4tuAzGU','\x22\x20from\x20\x22','newDirectoryPath','Remote\x20script\x20missing\x20content.','1752650BUXvEn','flatMap','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','lastSync','hookLocation','dev','normalize','skipped','stringify','\x22\x20not\x20found\x20after\x20ensureLockScope.','mode','string','scriptContent','newLockKey','some','unresolvable\x20target\x20path','&type=','appCode','GET','sourceDirectoryPathByNewDirectory','keyChanges','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22:\x20both\x20target\x20\x22','join','type','functionName','values','conflict','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','close','HOOK','write','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','newDirectory','push_local','oldLockKey','message','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','code'];a43_0x79aa=function(){return _0x25a467;};return a43_0x79aa();}function localUnsyncedConflict(_0x5684bb,_0x151bba){const _0x4f1b70=a43_0x3d35be,_0x5997b7=_0x5684bb[_0x4f1b70(0x11c)][_0x4f1b70(0xfb)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x5684bb[_0x4f1b70(0x11c)],'filePath':_0x5684bb[_0x4f1b70(0x113)],..._0x151bba!=null?{'remoteId':_0x151bba}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':_0x4f1b70(0x143),'command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x5684bb[_0x4f1b70(0x139)]+_0x4f1b70(0xb7)+_0x5997b7+'\x20--format\x20compress','requiresReview':!![],'message':_0x4f1b70(0xe7)}};}function formatPullMessage(_0x39ba64,_0x2dee51,_0x20ad36,_0x61702c){const _0x48ac2f=a43_0x3d35be,_0x52bf5c=[_0x48ac2f(0x107)+_0x39ba64+_0x48ac2f(0xc2),_0x2dee51+'\x20skipped'];_0x20ad36>0x0&&_0x52bf5c[_0x48ac2f(0xce)](_0x20ad36+_0x48ac2f(0xf0)+(_0x20ad36===0x1?'':'s')+'\x20'+(_0x20ad36===0x1?_0x48ac2f(0xf5):_0x48ac2f(0xbf))+'\x20resolution');if(_0x61702c>0x0)_0x52bf5c[_0x48ac2f(0xce)](_0x61702c+_0x48ac2f(0xda));return _0x52bf5c[_0x48ac2f(0x138)](',\x20');}async function hasUnsyncedLocalChanges(_0x4322ce,_0x46a90d,_0x1c4a86){if(!await fileExists(_0x4322ce))return![];const _0x155273=await computeFileHash(_0x4322ce);if(!_0x46a90d)return _0x1c4a86?_0x155273!==_0x1c4a86:!![];return _0x155273!==_0x46a90d['hash'];}function createPullFileTransaction(){const _0x23c938=new Map(),_0xc6859a=async(_0x1c727f,_0x236bbf)=>{const _0x30743c=a43_0x73b8;try{if(_0x236bbf['existed'])await ensureParentDirectory(_0x1c727f),await writeFile(_0x1c727f,_0x236bbf[_0x30743c(0xbb)]);else try{await unlink(_0x1c727f);}catch(_0x5669fa){if(_0x5669fa[_0x30743c(0xb1)]!==_0x30743c(0xf6))throw _0x5669fa;}return undefined;}catch(_0x228946){return _0x228946 instanceof Error?_0x228946:new Error(String(_0x228946));}};return{async 'write'(_0x448719,_0x274fac){const _0x46ae6b=a43_0x73b8;if(!_0x23c938[_0x46ae6b(0x100)](_0x448719))try{_0x23c938[_0x46ae6b(0xb4)](_0x448719,{'existed':!![],'content':await readFile(_0x448719)});}catch(_0x2f410f){if(_0x2f410f['code']!==_0x46ae6b(0xf6))throw _0x2f410f;_0x23c938['set'](_0x448719,{'existed':![]});}try{await ensureParentDirectory(_0x448719),await writeFile(_0x448719,_0x274fac,'utf8');}catch(_0x2a21dc){const _0x2662be=await _0xc6859a(_0x448719,_0x23c938[_0x46ae6b(0x116)](_0x448719));if(!_0x2662be)_0x23c938[_0x46ae6b(0xe8)](_0x448719);throw withRollbackErrors(_0x2a21dc,_0x46ae6b(0xea)+_0x448719+'\x22.',_0x2662be?[_0x2662be]:[]);}},async 'rollback'(){const _0x11dc36=a43_0x73b8,_0x405c86=[];for(const [_0x4e2650,_0x191860]of[..._0x23c938[_0x11dc36(0xc5)]()]['reverse']()){const _0x4a88cd=await _0xc6859a(_0x4e2650,_0x191860);_0x4a88cd&&_0x405c86[_0x11dc36(0xce)](new Error(_0x11dc36(0xd3)+_0x4e2650+_0x11dc36(0x103)+_0x4a88cd[_0x11dc36(0x145)]));}return _0x405c86;}};}function withRollbackErrors(_0x316f46,_0x177d53,_0xa0f85f){const _0x2a52fc=a43_0x3d35be,_0x5aadcf=_0x316f46 instanceof Error?_0x316f46:new Error(String(_0x316f46));if(_0xa0f85f['length']===0x0)return _0x5aadcf;return new AggregateError([_0x5aadcf,..._0xa0f85f],_0x177d53+'\x20Recovery\x20errors:\x20'+_0xa0f85f[_0x2a52fc(0xbc)](_0x386bd5=>_0x386bd5[_0x2a52fc(0x145)])[_0x2a52fc(0x138)](';\x20'));}function buildDatasetCodeToAliasMap(_0x13cc2e,_0x2ebcdb,_0x2448f7){const _0x5f4703=a43_0x3d35be,_0x5ebc6b=resolveApiModelSource(_0x13cc2e,_0x2ebcdb,_0x2448f7),_0x959d62=loadAliasMap(_0x13cc2e,undefined,_0x5ebc6b['filePath'],_0x5ebc6b['profileName']);return assertUnambiguousHookAliases(_0x959d62),new Map(_0x959d62[_0x5f4703(0xbc)](_0x25dda7=>[_0x25dda7[_0x5f4703(0xef)][_0x5f4703(0xf3)](),_0x25dda7[_0x5f4703(0xf8)]]));}async function planHookDirectoryMigration(_0xd22ca7,_0x4f63fa,_0x221bb1,_0x15b831){const _0x228a1b=a43_0x3d35be,_0x32222a=new Map();for(const [_0x1a730c,_0x4c5822]of Object[_0x228a1b(0xc5)](_0x4f63fa[_0x228a1b(0xd8)])){const [_0x1d73a7,_0x35121a,_0xe6f95c,_0xce39e2,_0x717363,..._0x3193c2]=_0x1a730c[_0x228a1b(0xfb)]('/');if(_0x1d73a7!==_0x228a1b(0x13f)||!_0x35121a||!_0xe6f95c||!_0xce39e2||!_0x717363||_0x3193c2[_0x228a1b(0x10c)]>0x0||!_0x4c5822[_0x228a1b(0xef)])continue;const _0x34c0cd=_0x221bb1['get'](_0x4c5822[_0x228a1b(0xef)][_0x228a1b(0xf3)]()),_0x5999fc=_0x34c0cd??_0x4c5822[_0x228a1b(0xef)];if(!isSafeHookDirectorySegment(_0x35121a))throw CliErrors['validation']('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x35121a+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x5999fc))throw CliErrors['validation'](_0x228a1b(0xd0)+_0x35121a+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x35121a===_0x5999fc)continue;const _0x42e238=_0x32222a[_0x228a1b(0x116)](_0x35121a)??{'datasetCode':_0x4c5822['datasetCode'],'alias':_0x34c0cd,'keyChanges':[]};if(_0x42e238[_0x228a1b(0xef)]!==_0x4c5822[_0x228a1b(0xef)])throw CliErrors['validation'](_0x228a1b(0xd0)+_0x35121a+_0x228a1b(0xcd));const _0x2be28b=_0x228a1b(0x11b)+_0x5999fc+'/'+_0xe6f95c+'/'+_0xce39e2+'/'+_0x717363;try{resolveLocalFilePathFromLockKey(_0xd22ca7,_0x1a730c),resolveLocalFilePathFromLockKey(_0xd22ca7,_0x2be28b);}catch(_0x3149fc){throw CliErrors[_0x228a1b(0x10a)](_0x228a1b(0xb8)+_0x1a730c+_0x228a1b(0x103)+(_0x3149fc instanceof Error?_0x3149fc[_0x228a1b(0x145)]:String(_0x3149fc)));}_0x42e238[_0x228a1b(0x135)][_0x228a1b(0xce)]({'oldLockKey':_0x1a730c,'newLockKey':_0x2be28b,'entry':_0x4c5822}),_0x32222a[_0x228a1b(0xb4)](_0x35121a,_0x42e238);}const _0x4b1702=new Set([..._0x32222a[_0x228a1b(0x13b)]()][_0x228a1b(0x122)](_0x234a0d=>_0x234a0d[_0x228a1b(0x135)][_0x228a1b(0xbc)](_0x416710=>_0x416710['oldLockKey']))),_0x1657a7=new Map(),_0x38ef50=new Map();for(const [_0x5b4b86,_0x4daea5]of _0x32222a){const _0x174e51=_0x4daea5[_0x228a1b(0xf8)]??_0x4daea5[_0x228a1b(0xef)],_0x44a717=hookDirectoryIdentity(_0x174e51),_0x4b0d4e=_0x1657a7[_0x228a1b(0x116)](_0x44a717);if(_0x4b0d4e&&_0x4b0d4e!==_0x5b4b86)throw CliErrors['validation'](_0x228a1b(0x10e)+_0x4b0d4e+'\x22\x20and\x20\x22'+_0x5b4b86+'\x22:\x20both\x20target\x20\x22'+_0x174e51+_0x228a1b(0x141));_0x1657a7[_0x228a1b(0xb4)](_0x44a717,_0x5b4b86);for(const _0x27eb08 of _0x4daea5[_0x228a1b(0x135)]){const _0x19315e=_0x38ef50[_0x228a1b(0x116)](_0x27eb08[_0x228a1b(0x12e)]);if(_0x19315e&&_0x19315e!==_0x27eb08[_0x228a1b(0x144)])throw CliErrors['validation'](_0x228a1b(0xe1)+_0x19315e+'\x22\x20and\x20\x22'+_0x27eb08[_0x228a1b(0x144)]+_0x228a1b(0x137)+_0x27eb08[_0x228a1b(0x12e)]+_0x228a1b(0xc8));if(_0x4b1702[_0x228a1b(0x100)](_0x27eb08[_0x228a1b(0x12e)]))throw CliErrors['validation'](_0x228a1b(0xd6)+_0x27eb08[_0x228a1b(0x144)]+'\x22:\x20its\x20target\x20\x22'+_0x27eb08[_0x228a1b(0x12e)]+'\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');_0x38ef50[_0x228a1b(0xb4)](_0x27eb08[_0x228a1b(0x12e)],_0x27eb08[_0x228a1b(0x144)]);}}const _0x420fca=new Map();for(const [_0x1acbb3,_0x1aa4e6]of _0x221bb1){_0x420fca[_0x228a1b(0xb4)](hookDirectoryIdentity(_0x1aa4e6),_0x1acbb3);}const _0x230ac3=[];for(const [_0x409e7b,_0x4518e8]of _0x32222a){const _0x10564b=_0x4518e8[_0x228a1b(0xf8)]??_0x4518e8['datasetCode'],_0x5790f2=join(_0xd22ca7['scriptsRootDir'],'HOOK',_0x409e7b),_0x31ec6a=join(_0xd22ca7[_0x228a1b(0x10d)],_0x228a1b(0x13f),_0x10564b),_0x1ac286=await directoryExists(_0x5790f2),_0x11a7e5=await directoryExists(_0x31ec6a),_0x5aa88d=_0x1ac286?_0x11a7e5?await sameDirectory(_0x5790f2,_0x31ec6a)?'case-rename':undefined:'move':'rekey';if(!_0x5aa88d)throw CliErrors[_0x228a1b(0x10a)](_0x228a1b(0xd0)+_0x409e7b+_0x228a1b(0xf7)+_0x10564b+_0x228a1b(0x13d));const _0x25d2ca=_0x420fca[_0x228a1b(0x116)](hookDirectoryIdentity(_0x409e7b));if(_0x25d2ca&&_0x25d2ca!==_0x4518e8[_0x228a1b(0xef)][_0x228a1b(0xf3)]()){const _0x111b4c=new Set(_0x4518e8[_0x228a1b(0x135)][_0x228a1b(0xbc)](_0x290ccc=>_0x290ccc[_0x228a1b(0x144)])),_0x5a2f6f=_0x15b831['filter'](_0x266b90=>_0x266b90[_0x228a1b(0x139)]===_0x228a1b(0x13f)&&_0x266b90[_0x228a1b(0xf8)]!=null&&hookDirectoryIdentity(_0x266b90[_0x228a1b(0xf8)])===hookDirectoryIdentity(_0x409e7b)&&!_0x111b4c[_0x228a1b(0x100)](_0x266b90['lockKey']));if(_0x5a2f6f[_0x228a1b(0x10c)]>0x0)throw CliErrors[_0x228a1b(0x10a)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x409e7b+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x5071cd=_0x420fca['get'](hookDirectoryIdentity(_0x10564b));if(_0x5071cd&&_0x5071cd!==_0x4518e8['datasetCode'][_0x228a1b(0xf3)]())throw CliErrors['validation'](_0x228a1b(0xd0)+_0x409e7b+'\x22\x20to\x20\x22'+_0x10564b+_0x228a1b(0xff));for(const _0x5cfcec of _0x4518e8[_0x228a1b(0x135)]){const _0x5cf604=_0x4f63fa[_0x228a1b(0xd8)][_0x5cfcec['newLockKey']];if(_0x5cf604&&!_0x4b1702['has'](_0x5cfcec[_0x228a1b(0x12e)])&&!sameHookIdentity(_0x5cfcec[_0x228a1b(0x101)],_0x5cf604))throw CliErrors['validation'](_0x228a1b(0xd0)+_0x409e7b+_0x228a1b(0xf7)+_0x10564b+_0x228a1b(0xe3));}_0x230ac3[_0x228a1b(0xce)]({'oldDirectory':_0x409e7b,'newDirectory':_0x10564b,'oldDirectoryPath':_0x5790f2,'newDirectoryPath':_0x31ec6a,'mode':_0x5aa88d,'alias':_0x4518e8['alias'],'keyChanges':_0x4518e8[_0x228a1b(0x135)]});}const _0x59283f={..._0x4f63fa['functions']},_0x3867e5=new Map(),_0x139feb=new Map();for(const _0x3cdc31 of _0x230ac3){const _0x40977f=_0x3cdc31['mode']!=='rekey';_0x40977f&&_0x139feb[_0x228a1b(0xb4)](hookDirectoryIdentity(_0x3cdc31[_0x228a1b(0x142)]),_0x3cdc31[_0x228a1b(0x105)]);for(const _0x4a1dbf of _0x3cdc31[_0x228a1b(0x135)]){const _0x1402fc=_0x59283f[_0x4a1dbf[_0x228a1b(0x12e)]],_0x5d7f9c=_0x40977f?_0x4a1dbf[_0x228a1b(0x101)]:_0x1402fc??_0x4a1dbf['entry'];_0x59283f[_0x4a1dbf[_0x228a1b(0x12e)]]=canonicalizeHookEntry(_0x5d7f9c,_0x3cdc31[_0x228a1b(0xf8)]),delete _0x59283f[_0x4a1dbf[_0x228a1b(0x144)]],_0x40977f&&_0x3867e5['set'](_0x4a1dbf[_0x228a1b(0x12e)],resolveLocalFilePathFromLockKey(_0xd22ca7,_0x4a1dbf[_0x228a1b(0x144)]));}}return{'migrations':_0x230ac3,'projectedFunctions':_0x59283f,'sourceFilePathByNewLockKey':_0x3867e5,'sourceDirectoryPathByNewDirectory':_0x139feb};}function resolveMigratedSourceFilePath(_0x4290e4,_0x4d41a5){const _0x1fadb1=a43_0x3d35be;if(!_0x4290e4||!_0x4d41a5)return undefined;const _0x6bf234=_0x4290e4[_0x1fadb1(0xc9)][_0x1fadb1(0x116)](_0x4d41a5[_0x1fadb1(0x11c)]);if(_0x6bf234)return _0x6bf234;if(_0x4d41a5['type']!==_0x1fadb1(0x13f))return undefined;const [,_0x140540,..._0x1a2c8f]=_0x4d41a5[_0x1fadb1(0x11c)][_0x1fadb1(0xfb)]('/');if(!_0x140540||_0x1a2c8f[_0x1fadb1(0x10c)]===0x0)return undefined;const _0x2676bf=_0x4290e4[_0x1fadb1(0x134)]['get'](hookDirectoryIdentity(_0x140540));return _0x2676bf?join(_0x2676bf,..._0x1a2c8f)+'.js':undefined;}function sameHookIdentity(_0x1c78d2,_0x491df3){const _0x1a045b=a43_0x3d35be;return _0x1c78d2[_0x1a045b(0xd1)]===_0x491df3[_0x1a045b(0xd1)]&&_0x1c78d2[_0x1a045b(0xef)]===_0x491df3[_0x1a045b(0xef)]&&_0x1c78d2[_0x1a045b(0xb5)]===_0x491df3[_0x1a045b(0xb5)]&&_0x1c78d2[_0x1a045b(0xe4)]===_0x491df3[_0x1a045b(0xe4)];}function canonicalizeHookEntry(_0x5f4dd9,_0x381b65){const {alias:_0xe31a78,..._0x41cacf}=_0x5f4dd9;return _0x381b65?{..._0x41cacf,'alias':_0x381b65}:_0x41cacf;}function hookDirectoryIdentity(_0x2d51b0){const _0x83b3ec=a43_0x3d35be;return _0x2d51b0[_0x83b3ec(0x127)]('NFC')[_0x83b3ec(0xf3)]();}function isSafeHookDirectorySegment(_0x555a92){return isSafeLockKeySegment(_0x555a92);}async function sameDirectory(_0x540046,_0xf330a3){const _0x3bbfc2=a43_0x3d35be,[_0x3e10f8,_0x238c8b]=await Promise[_0x3bbfc2(0xbd)]([stat(_0x540046),stat(_0xf330a3)]);return _0x3e10f8['dev']===_0x238c8b[_0x3bbfc2(0x126)]&&_0x3e10f8['ino']===_0x238c8b[_0x3bbfc2(0xbe)];}async function applyHookDirectoryMigration(_0x157d97,_0x5a9975){const _0x369835=a43_0x3d35be,_0x58b427=_0x5a9975[_0x369835(0xd8)],_0x2e0c70=_0x5a9975[_0x369835(0x124)],_0x4d74fb=[],_0x119855=async()=>{const _0x5718be=_0x369835,_0x4ace4d=[];_0x5a9975[_0x5718be(0xd8)]=_0x58b427,_0x5a9975[_0x5718be(0x124)]=_0x2e0c70;for(const {migration:_0x3a8462,temporaryPath:_0x3f1ccd}of[..._0x4d74fb][_0x5718be(0x11a)]()){try{_0x3f1ccd?(await rename(_0x3a8462[_0x5718be(0x11f)],_0x3f1ccd),await rename(_0x3f1ccd,_0x3a8462[_0x5718be(0x105)])):await rename(_0x3a8462['newDirectoryPath'],_0x3a8462[_0x5718be(0x105)]);}catch(_0x3849cc){_0x4ace4d['push'](new Error(_0x5718be(0x114)+_0x3a8462['oldDirectory']+_0x5718be(0x11e)+_0x3a8462['newDirectory']+_0x5718be(0x103)+(_0x3849cc instanceof Error?_0x3849cc['message']:String(_0x3849cc))));}}return _0x4ace4d;};try{for(const _0x4bb80f of _0x157d97[_0x369835(0x110)]){if(_0x4bb80f[_0x369835(0x12b)]===_0x369835(0xc3))await ensureParentDirectory(_0x4bb80f[_0x369835(0x11f)]),await rename(_0x4bb80f[_0x369835(0x105)],_0x4bb80f['newDirectoryPath']),_0x4d74fb[_0x369835(0xce)]({'migration':_0x4bb80f});else{if(_0x4bb80f['mode']===_0x369835(0xdd)){const _0x42b9a9=join(dirname(_0x4bb80f[_0x369835(0x105)]),_0x369835(0xfd)+randomUUID());await rename(_0x4bb80f['oldDirectoryPath'],_0x42b9a9);try{await rename(_0x42b9a9,_0x4bb80f['newDirectoryPath']);}catch(_0x436011){try{await rename(_0x42b9a9,_0x4bb80f[_0x369835(0x105)]);}catch(_0x1f95cf){throw withRollbackErrors(_0x436011,_0x369835(0xc6)+_0x4bb80f[_0x369835(0xfe)]+_0x369835(0xf7)+_0x4bb80f[_0x369835(0x142)]+_0x369835(0xe0)+_0x42b9a9+_0x369835(0xb9),[new Error(_0x369835(0x136)+_0x42b9a9+_0x369835(0xf7)+_0x4bb80f[_0x369835(0xfe)]+_0x369835(0x103)+(_0x1f95cf instanceof Error?_0x1f95cf[_0x369835(0x145)]:String(_0x1f95cf)))]);}throw _0x436011;}_0x4d74fb[_0x369835(0xce)]({'migration':_0x4bb80f,'temporaryPath':_0x42b9a9});}}}return _0x5a9975[_0x369835(0xd8)]=_0x157d97[_0x369835(0xde)],{'rollback':_0x119855};}catch(_0x3a134a){const _0x177d01=await _0x119855();throw withRollbackErrors(_0x3a134a,_0x369835(0xe5),_0x177d01);}}async function confirmForce(){const _0xe1ff76=a43_0x3d35be,_0x32ea8d=createInterface({'input':process[_0xe1ff76(0xc7)],'output':process[_0xe1ff76(0xeb)]}),_0x17ac39=await new Promise(_0xbae3d6=>{const _0x123890=_0xe1ff76;_0x32ea8d[_0x123890(0x106)](_0x123890(0xc4),_0xbae3d6);});return _0x32ea8d[_0xe1ff76(0x13e)](),['y',_0xe1ff76(0xe9)]['includes'](_0x17ac39[_0xe1ff76(0xee)]()[_0xe1ff76(0xf3)]());}
|
|
1
|
+
const a43_0x212d3a=a43_0x27bf;(function(_0x12a9b6,_0x167b49){const _0x49f0d1=a43_0x27bf,_0x430087=_0x12a9b6();while(!![]){try{const _0x22d5b0=parseInt(_0x49f0d1(0xbf))/0x1+-parseInt(_0x49f0d1(0x11a))/0x2+-parseInt(_0x49f0d1(0xfa))/0x3*(-parseInt(_0x49f0d1(0xca))/0x4)+-parseInt(_0x49f0d1(0xaf))/0x5*(parseInt(_0x49f0d1(0xc4))/0x6)+parseInt(_0x49f0d1(0x95))/0x7*(parseInt(_0x49f0d1(0xe6))/0x8)+parseInt(_0x49f0d1(0xd5))/0x9+parseInt(_0x49f0d1(0x9c))/0xa*(-parseInt(_0x49f0d1(0x9f))/0xb);if(_0x22d5b0===_0x167b49)break;else _0x430087['push'](_0x430087['shift']());}catch(_0x21981a){_0x430087['push'](_0x430087['shift']());}}}(a43_0x4d9a,0x2566b));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_0x212d3a(0x98),'command':'pull','description':a43_0x212d3a(0xe4),'risk':a43_0x212d3a(0xa2),'structuredErrors':!![],'flags':[{'name':'type','type':a43_0x212d3a(0x11b),'description':a43_0x212d3a(0xe8),'enum':[a43_0x212d3a(0xbe),'ENDPOINT','HOOK']},{'name':a43_0x212d3a(0xe7),'type':a43_0x212d3a(0xe1),'description':a43_0x212d3a(0xa1)}],async 'dryRun'(_0x546329){const _0x29e3ca=a43_0x212d3a,_0x5d1c10=loadBffProjectConfig(_0x546329[_0x29e3ca(0xf7)]),_0x1d9829=await readBffLockFile(_0x5d1c10[_0x29e3ca(0x10c)]),{appLock:_0x289d39}=ensureLockScope(_0x1d9829??createEmptyBffLock(),_0x546329[_0x29e3ca(0xf7)],_0x5d1c10[_0x29e3ca(0x11c)],_0x29e3ca(0xaa)),_0x26103d=normalizeBffType(_0x546329['str'](_0x29e3ca(0xfd)))??undefined,[_0x1619de,_0x14534a]=await Promise[_0x29e3ca(0xa6)]([listBffScripts(_0x546329[_0x29e3ca(0xf7)],_0x26103d),getBffScriptStatistics(_0x546329[_0x29e3ca(0xf7)])]),_0x1d8ee3=_0x1619de[_0x29e3ca(0x9a)](_0x15002b=>normalizeBffType(_0x15002b[_0x29e3ca(0x11d)])==='HOOK'),_0x647919=_0x1d8ee3?buildDatasetCodeToAliasMap(_0x546329['apiDir'],_0x546329[_0x29e3ca(0xf7)],_0x546329[_0x29e3ca(0xd6)]||_0x546329[_0x29e3ca(0xde)]?.[_0x29e3ca(0x118)]||_0x546329['mergedCli']?.['defaultApp']):new Map(),_0x50888d=_0x1d8ee3?await planHookDirectoryMigration(_0x5d1c10,_0x289d39,_0x647919,await scanLocalBffFunctions(_0x5d1c10,_0x29e3ca(0xb1))):undefined,_0x4d710a=createHookLocationMap(_0x14534a),_0x226ede=[];for(const _0x48f375 of _0x1619de){const _0x193efe=resolveRemoteScriptTarget(_0x5d1c10,_0x48f375,_0x4d710a,_0x50888d?.[_0x29e3ca(0xeb)]??_0x289d39[_0x29e3ca(0xb2)],_0x647919);if(!_0x193efe){_0x226ede[_0x29e3ca(0x107)]({'scriptType':_0x48f375[_0x29e3ca(0x11d)],'functionName':_0x48f375['functionName']??'','status':_0x29e3ca(0x9d),'reason':_0x29e3ca(0x104)});continue;}const _0x52bfe8=(_0x50888d?.[_0x29e3ca(0xeb)]??_0x289d39[_0x29e3ca(0xb2)])[_0x193efe['lockKey']],_0x36d663=_0x48f375[_0x29e3ca(0xfc)]!=null?computeContentHash(_0x48f375['scriptContent']):undefined,_0x332597=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x50888d,_0x193efe)??_0x193efe['filePath'],_0x52bfe8,_0x36d663),_0x1b537e=_0x332597?localUnsyncedConflict(_0x193efe,_0x48f375['id']):undefined;_0x226ede[_0x29e3ca(0x107)]({'lockKey':_0x193efe[_0x29e3ca(0xbc)],'filePath':_0x193efe['filePath'],'remoteId':_0x48f375['id']??null,'status':_0x1b537e?_0x29e3ca(0x93):'would_pull',..._0x1b537e?{'conflict':_0x1b537e}:{},..._0x193efe[_0x29e3ca(0xb4)]?{'alias':_0x193efe[_0x29e3ca(0xb4)][_0x29e3ca(0xc7)]??null,'datasetCode':_0x193efe[_0x29e3ca(0xb4)][_0x29e3ca(0xd1)],'operationType':_0x193efe[_0x29e3ca(0xb4)]['operationType'],'functionNode':_0x193efe[_0x29e3ca(0xb4)]['functionNode']}:{}});}return{'method':'GET','url':_0x29e3ca(0xdf)+_0x546329[_0x29e3ca(0xf7)]+(_0x26103d?_0x29e3ca(0xea)+_0x26103d:'')+_0x29e3ca(0xec)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x546329[_0x29e3ca(0xf7)],'filterType':_0x26103d??null,..._0x50888d&&_0x50888d[_0x29e3ca(0x9e)][_0x29e3ca(0x10a)]>0x0?{'hookDirectoryMigrations':_0x50888d['migrations'][_0x29e3ca(0x111)](_0x5c0983=>({'from':_0x5c0983['oldDirectory'],'to':_0x5c0983[_0x29e3ca(0xa9)]}))}:{},'files':_0x226ede},'description':_0x29e3ca(0x119)+_0x226ede[_0x29e3ca(0x10a)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4a6311){const _0x345897=a43_0x212d3a,_0x10b6db=loadBffProjectConfig(_0x4a6311[_0x345897(0xf7)]),_0x1e4312=await readBffLockFile(_0x10b6db[_0x345897(0x10c)]),{lockData:_0x3a4a70,appLock:_0x1c5976}=ensureLockScope(_0x1e4312??createEmptyBffLock(),_0x4a6311[_0x345897(0xf7)],_0x10b6db[_0x345897(0x11c)],_0x345897(0xaa)),_0x4e4576=normalizeBffType(_0x4a6311[_0x345897(0xbd)](_0x345897(0xfd)))??undefined;if(_0x4a6311[_0x345897(0xbd)](_0x345897(0xfd))&&!_0x4e4576)throw CliErrors[_0x345897(0xf2)](_0x345897(0x121));const [_0x2b7574,_0x146320]=await Promise['all']([listBffScripts(_0x4a6311[_0x345897(0xf7)],_0x4e4576),getBffScriptStatistics(_0x4a6311['appCode'])]);if(_0x2b7574[_0x345897(0x10a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x58142d=_0x4a6311[_0x345897(0x10e)](_0x345897(0xe7));if(_0x58142d&&!_0x4a6311[_0x345897(0xcb)]){const _0x54d5e0=await confirmForce();if(!_0x54d5e0)throw CliErrors[_0x345897(0xad)](_0x345897(0x123));}if(_0x58142d&&_0x4a6311[_0x345897(0xcb)]){}const _0x31c8dc=_0x2b7574['some'](_0x410a10=>normalizeBffType(_0x410a10[_0x345897(0x11d)])===_0x345897(0xb1)),_0x1ac434=_0x31c8dc?buildDatasetCodeToAliasMap(_0x4a6311[_0x345897(0x9b)],_0x4a6311[_0x345897(0xf7)],_0x4a6311['selectedAppName']||_0x4a6311[_0x345897(0xde)]?.[_0x345897(0x118)]||_0x4a6311[_0x345897(0xde)]?.[_0x345897(0x99)]):new Map(),_0x17f61b=createHookLocationMap(_0x146320),_0x57e061=JSON[_0x345897(0xac)](JSON[_0x345897(0xf1)](_0x3a4a70)),_0x5663aa=_0x4a6311['appCode'],_0x518e06=_0x57e061[_0x345897(0x91)][_0x5663aa];if(!_0x518e06)throw new Error(_0x345897(0x94)+_0x5663aa+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x369eb1=_0x31c8dc?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x10b6db,_0x518e06,_0x1ac434,await scanLocalBffFunctions(_0x10b6db,'HOOK')),_0x518e06):undefined,_0x24aa3b=createPullFileTransaction(),_0x2c5e3a=[],_0x426357=[],_0xd22fa7=[],_0x4ea248=[];for(const _0x408fad of _0x2b7574){const _0x257e70=resolveRemoteScriptTarget(_0x10b6db,_0x408fad,_0x17f61b,_0x518e06[_0x345897(0xb2)],_0x1ac434);if(!_0x257e70){_0x426357[_0x345897(0x107)]({'lockKey':_0x408fad[_0x345897(0x11d)]+'/'+_0x408fad[_0x345897(0x10b)],'reason':_0x345897(0x104)});continue;}const _0x227c8d=_0x518e06['functions'][_0x257e70[_0x345897(0xbc)]];try{if(!_0x408fad['id'])throw new Error(_0x345897(0xda));if(_0x408fad[_0x345897(0xfc)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x2167f6=_0x408fad['scriptContent'],_0x493bd4=computeContentHash(_0x2167f6);if(!_0x58142d){const _0x26f036=await hasUnsyncedLocalChanges(_0x257e70[_0x345897(0x114)],_0x227c8d,_0x493bd4);if(_0x26f036){_0xd22fa7['push'](localUnsyncedConflict(_0x257e70,_0x408fad['id']));continue;}}await _0x24aa3b[_0x345897(0xdb)](_0x257e70[_0x345897(0x114)],_0x2167f6);const _0x591093={'hash':_0x493bd4,'remoteId':_0x408fad['id'],'version':_0x408fad[_0x345897(0xd7)]};_0x257e70['type']===_0x345897(0xb1)&&_0x257e70['hookLocation']&&(_0x591093['alias']=_0x257e70[_0x345897(0xb4)][_0x345897(0xc7)],_0x591093[_0x345897(0xd1)]=_0x257e70[_0x345897(0xb4)][_0x345897(0xd1)],_0x591093[_0x345897(0xbb)]=_0x257e70[_0x345897(0xb4)][_0x345897(0xbb)],_0x591093[_0x345897(0xa8)]=_0x257e70[_0x345897(0xb4)][_0x345897(0xa8)]),_0x518e06[_0x345897(0xb2)][_0x257e70[_0x345897(0xbc)]]=_0x591093,_0x2c5e3a['push']({'lockKey':_0x257e70['lockKey'],'remoteId':_0x408fad['id']});}catch(_0x86deae){_0x4ea248[_0x345897(0x107)]({'lockKey':_0x257e70['lockKey'],'error':_0x86deae instanceof Error?_0x86deae['message']:String(_0x86deae)});}}_0x518e06[_0x345897(0xf5)]=new Date()['toISOString']();try{await writeBffLockFile(_0x10b6db[_0x345897(0x10c)],_0x57e061);}catch(_0x1b1cbd){const _0x197692=[...await _0x24aa3b[_0x345897(0xed)](),...await _0x369eb1?.[_0x345897(0xed)]()??[]];throw withRollbackErrors(_0x1b1cbd,_0x345897(0xf8),_0x197692);}return{'ok':_0x4ea248[_0x345897(0x10a)]===0x0,'data':{'pulled':_0x2c5e3a,'skipped':_0x426357,'conflicts':_0xd22fa7,'failed':_0x4ea248},'message':formatPullMessage(_0x2c5e3a['length'],_0x426357[_0x345897(0x10a)],_0xd22fa7[_0x345897(0x10a)],_0x4ea248[_0x345897(0x10a)])};}};function localUnsyncedConflict(_0x3b3886,_0xa7b8f9){const _0x54c803=a43_0x212d3a,_0x29b52a=_0x3b3886['lockKey'][_0x54c803(0x117)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x3b3886[_0x54c803(0xbc)],'filePath':_0x3b3886[_0x54c803(0x114)],..._0xa7b8f9!=null?{'remoteId':_0xa7b8f9}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x54c803(0xf9)+_0x3b3886[_0x54c803(0xfd)]+_0x54c803(0x11e)+_0x29b52a+_0x54c803(0xce),'requiresReview':!![],'message':_0x54c803(0xa4)}};}function formatPullMessage(_0x408be5,_0x31bf11,_0x5457ae,_0x186d70){const _0x273a3c=a43_0x212d3a,_0x5c51ee=[_0x273a3c(0xf4)+_0x408be5+_0x273a3c(0x129),_0x31bf11+_0x273a3c(0x113)];_0x5457ae>0x0&&_0x5c51ee[_0x273a3c(0x107)](_0x5457ae+'\x20conflict'+(_0x5457ae===0x1?'':'s')+'\x20'+(_0x5457ae===0x1?_0x273a3c(0xe2):'require')+_0x273a3c(0xa5));if(_0x186d70>0x0)_0x5c51ee['push'](_0x186d70+_0x273a3c(0xc8));return _0x5c51ee[_0x273a3c(0xfe)](',\x20');}async function hasUnsyncedLocalChanges(_0x573614,_0x5df793,_0x12ca8e){const _0x322e1a=a43_0x212d3a;if(!await fileExists(_0x573614))return![];const _0x1f7c30=await computeFileHash(_0x573614);if(!_0x5df793)return _0x12ca8e?_0x1f7c30!==_0x12ca8e:!![];return _0x1f7c30!==_0x5df793[_0x322e1a(0xcc)];}function createPullFileTransaction(){const _0x971428=new Map(),_0x597cb6=async(_0x480ffe,_0x15af9d)=>{const _0x4dbb5f=a43_0x27bf;try{if(_0x15af9d[_0x4dbb5f(0x96)])await ensureParentDirectory(_0x480ffe),await writeFile(_0x480ffe,_0x15af9d[_0x4dbb5f(0xae)]);else try{await unlink(_0x480ffe);}catch(_0x228c66){if(_0x228c66[_0x4dbb5f(0x127)]!=='ENOENT')throw _0x228c66;}return undefined;}catch(_0x27d1f6){return _0x27d1f6 instanceof Error?_0x27d1f6:new Error(String(_0x27d1f6));}};return{async 'write'(_0x2610ec,_0x250a21){const _0x20aec2=a43_0x27bf;if(!_0x971428[_0x20aec2(0xd2)](_0x2610ec))try{_0x971428[_0x20aec2(0xd3)](_0x2610ec,{'existed':!![],'content':await readFile(_0x2610ec)});}catch(_0x3b7d46){if(_0x3b7d46[_0x20aec2(0x127)]!==_0x20aec2(0xb8))throw _0x3b7d46;_0x971428[_0x20aec2(0xd3)](_0x2610ec,{'existed':![]});}try{await ensureParentDirectory(_0x2610ec),await writeFile(_0x2610ec,_0x250a21,_0x20aec2(0x120));}catch(_0x31950d){const _0x1d8752=await _0x597cb6(_0x2610ec,_0x971428[_0x20aec2(0x97)](_0x2610ec));if(!_0x1d8752)_0x971428[_0x20aec2(0xf0)](_0x2610ec);throw withRollbackErrors(_0x31950d,_0x20aec2(0x115)+_0x2610ec+'\x22.',_0x1d8752?[_0x1d8752]:[]);}},async 'rollback'(){const _0x3a43d4=a43_0x27bf,_0x43d874=[];for(const [_0x4ec47b,_0x2c5a8f]of[..._0x971428['entries']()][_0x3a43d4(0x110)]()){const _0x540c4a=await _0x597cb6(_0x4ec47b,_0x2c5a8f);_0x540c4a&&_0x43d874[_0x3a43d4(0x107)](new Error(_0x3a43d4(0xb7)+_0x4ec47b+_0x3a43d4(0x103)+_0x540c4a[_0x3a43d4(0xb0)]));}return _0x43d874;}};}function withRollbackErrors(_0x2cba30,_0x363c23,_0x51c6a0){const _0x5303d6=a43_0x212d3a,_0x47694d=_0x2cba30 instanceof Error?_0x2cba30:new Error(String(_0x2cba30));if(_0x51c6a0[_0x5303d6(0x10a)]===0x0)return _0x47694d;return new AggregateError([_0x47694d,..._0x51c6a0],_0x363c23+'\x20Recovery\x20errors:\x20'+_0x51c6a0[_0x5303d6(0x111)](_0x367117=>_0x367117[_0x5303d6(0xb0)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x39df03,_0x1b8811,_0x479a48){const _0x9b04b8=a43_0x212d3a,_0x10a60c=resolveApiModelSource(_0x39df03,_0x1b8811,_0x479a48),_0x5eeda6=loadAliasMap(_0x39df03,undefined,_0x10a60c[_0x9b04b8(0x114)],_0x10a60c['profileName']);return assertUnambiguousHookAliases(_0x5eeda6),new Map(_0x5eeda6[_0x9b04b8(0x111)](_0x412a98=>[_0x412a98[_0x9b04b8(0xd1)][_0x9b04b8(0xe9)](),_0x412a98[_0x9b04b8(0xc7)]]));}function a43_0x4d9a(){const _0x1c5488=['.js','parse','cancelled','content','15JImXqc','message','HOOK','functions','.hook-directory-migrate-','hookLocation','sourceDirectoryPathByNewDirectory','\x22\x20to\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','ENOENT','trim','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','operationType','lockKey','str','COMMON','229722QsRWRh','\x22:\x20both\x20target\x20\x22','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','case-rename','scriptsRootDir','147222LjThOJ','oldDirectory','\x22\x20may\x20remain.','alias','\x20failed','\x22\x20from\x20the\x20lock\x20file.','25888VbUKko','nonInteractive','hash','dev','\x20--format\x20compress','NFC','entries','datasetCode','has','set','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','2331378bPpfMD','selectedAppName','version','values','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Remote\x20script\x20missing\x20id.','write','close','newLockKey','mergedCli','/api/management/library/scripts/list?appCode=','normalize','boolean','requires','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','328sChocA','force','Pull\x20only\x20this\x20script\x20type','toLowerCase','&type=','projectedFunctions','¤tPage=1&pageSize=','rollback','flatMap','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','delete','stringify','validation','oldDirectoryPath','Pull\x20complete:\x20','lastSync','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','appCode','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x20bff\x20push\x20--type\x20','60spahKY','entry','scriptContent','type','join','sourceFilePathByNewLockKey','mode','stdin','newDirectoryPath','\x22:\x20','unresolvable\x20target\x20path','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','rekey','push','remoteId','HOOK/','length','functionName','lockFilePath','stderr','bool','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','reverse','map','filter','\x20skipped','filePath','Failed\x20to\x20write\x20local\x20script\x20\x22','yes','split','currentApp','Would\x20inspect\x20','413720Nxfbis','string','scriptsRoot','scriptType','\x20--name\x20','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','utf8','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Force\x20pull\x20cancelled.','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','oldLockKey','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','code','\x22;\x20temporary\x20directory\x20\x22','\x20pulled','keyChanges','move','apps','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','conflict','Lock\x20scope\x20for\x20app\x20\x22','42721MuJzaC','existed','get','bff','defaultApp','some','apiDir','10YRRHph','skipped','migrations','4782371WblIGa','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','Force\x20overwrite\x20local\x20unsynced\x20changes','read','\x22\x20and\x20\x22','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.','\x20resolution','all','ino','functionNode','newDirectory','pull'];a43_0x4d9a=function(){return _0x1c5488;};return a43_0x4d9a();}function a43_0x27bf(_0x273379,_0x322399){_0x273379=_0x273379-0x8f;const _0x4d9ae0=a43_0x4d9a();let _0x27bf1c=_0x4d9ae0[_0x273379];return _0x27bf1c;}async function planHookDirectoryMigration(_0x4dfa8b,_0x482882,_0xb2d396,_0xe0aa13){const _0x198620=a43_0x212d3a,_0x10b53a=new Map();for(const [_0x3d978f,_0x59ea0f]of Object[_0x198620(0xd0)](_0x482882[_0x198620(0xb2)])){const [_0x2f9e67,_0x6c8dc3,_0x19e899,_0x31460f,_0x3cb653,..._0x66e41b]=_0x3d978f[_0x198620(0x117)]('/');if(_0x2f9e67!==_0x198620(0xb1)||!_0x6c8dc3||!_0x19e899||!_0x31460f||!_0x3cb653||_0x66e41b[_0x198620(0x10a)]>0x0||!_0x59ea0f['datasetCode'])continue;const _0x36cf34=_0xb2d396['get'](_0x59ea0f[_0x198620(0xd1)]['toLowerCase']()),_0x5a36ce=_0x36cf34??_0x59ea0f[_0x198620(0xd1)];if(!isSafeHookDirectorySegment(_0x6c8dc3))throw CliErrors[_0x198620(0xf2)](_0x198620(0x122)+_0x6c8dc3+_0x198620(0xc9));if(!isSafeHookDirectorySegment(_0x5a36ce))throw CliErrors[_0x198620(0xf2)](_0x198620(0xc1)+_0x6c8dc3+_0x198620(0xa0));if(_0x6c8dc3===_0x5a36ce)continue;const _0x574740=_0x10b53a[_0x198620(0x97)](_0x6c8dc3)??{'datasetCode':_0x59ea0f[_0x198620(0xd1)],'alias':_0x36cf34,'keyChanges':[]};if(_0x574740['datasetCode']!==_0x59ea0f['datasetCode'])throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x6c8dc3+_0x198620(0x124));const _0x52973b=_0x198620(0x109)+_0x5a36ce+'/'+_0x19e899+'/'+_0x31460f+'/'+_0x3cb653;try{resolveLocalFilePathFromLockKey(_0x4dfa8b,_0x3d978f),resolveLocalFilePathFromLockKey(_0x4dfa8b,_0x52973b);}catch(_0x552015){throw CliErrors[_0x198620(0xf2)](_0x198620(0x92)+_0x3d978f+_0x198620(0x103)+(_0x552015 instanceof Error?_0x552015[_0x198620(0xb0)]:String(_0x552015)));}_0x574740['keyChanges'][_0x198620(0x107)]({'oldLockKey':_0x3d978f,'newLockKey':_0x52973b,'entry':_0x59ea0f}),_0x10b53a[_0x198620(0xd3)](_0x6c8dc3,_0x574740);}const _0x3ddd95=new Set([..._0x10b53a[_0x198620(0xd8)]()][_0x198620(0xee)](_0x56aeb7=>_0x56aeb7[_0x198620(0x8f)][_0x198620(0x111)](_0x5908d8=>_0x5908d8['oldLockKey']))),_0x26bcca=new Map(),_0xc0c41a=new Map();for(const [_0x157062,_0x54bd1b]of _0x10b53a){const _0x1a7db5=_0x54bd1b[_0x198620(0xc7)]??_0x54bd1b[_0x198620(0xd1)],_0x5555ed=hookDirectoryIdentity(_0x1a7db5),_0xd7bf97=_0x26bcca[_0x198620(0x97)](_0x5555ed);if(_0xd7bf97&&_0xd7bf97!==_0x157062)throw CliErrors['validation'](_0x198620(0x105)+_0xd7bf97+_0x198620(0xa3)+_0x157062+_0x198620(0xc0)+_0x1a7db5+_0x198620(0xef));_0x26bcca[_0x198620(0xd3)](_0x5555ed,_0x157062);for(const _0x1c0590 of _0x54bd1b[_0x198620(0x8f)]){const _0x5309f6=_0xc0c41a[_0x198620(0x97)](_0x1c0590[_0x198620(0xdd)]);if(_0x5309f6&&_0x5309f6!==_0x1c0590[_0x198620(0x125)])throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x5309f6+_0x198620(0xa3)+_0x1c0590[_0x198620(0x125)]+_0x198620(0xc0)+_0x1c0590[_0x198620(0xdd)]+_0x198620(0x11f));if(_0x3ddd95['has'](_0x1c0590[_0x198620(0xdd)]))throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x1c0590['oldLockKey']+'\x22:\x20its\x20target\x20\x22'+_0x1c0590[_0x198620(0xdd)]+_0x198620(0x10f));_0xc0c41a[_0x198620(0xd3)](_0x1c0590[_0x198620(0xdd)],_0x1c0590[_0x198620(0x125)]);}}const _0x2e8a83=new Map();for(const [_0x1049b2,_0x5e0664]of _0xb2d396){_0x2e8a83[_0x198620(0xd3)](hookDirectoryIdentity(_0x5e0664),_0x1049b2);}const _0x9bf980=[];for(const [_0x2ff2cf,_0x307b92]of _0x10b53a){const _0x30d663=_0x307b92[_0x198620(0xc7)]??_0x307b92[_0x198620(0xd1)],_0x23413e=join(_0x4dfa8b[_0x198620(0xc3)],_0x198620(0xb1),_0x2ff2cf),_0x31aba1=join(_0x4dfa8b[_0x198620(0xc3)],_0x198620(0xb1),_0x30d663),_0x59cc84=await directoryExists(_0x23413e),_0x52d861=await directoryExists(_0x31aba1),_0x19365d=_0x59cc84?_0x52d861?await sameDirectory(_0x23413e,_0x31aba1)?_0x198620(0xc2):undefined:_0x198620(0x90):_0x198620(0x106);if(!_0x19365d)throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x2ff2cf+_0x198620(0xb6)+_0x30d663+_0x198620(0x126));const _0x1aa842=_0x2e8a83['get'](hookDirectoryIdentity(_0x2ff2cf));if(_0x1aa842&&_0x1aa842!==_0x307b92[_0x198620(0xd1)]['toLowerCase']()){const _0x506aa0=new Set(_0x307b92[_0x198620(0x8f)][_0x198620(0x111)](_0x472960=>_0x472960[_0x198620(0x125)])),_0x22f84e=_0xe0aa13[_0x198620(0x112)](_0x41c4ad=>_0x41c4ad[_0x198620(0xfd)]===_0x198620(0xb1)&&_0x41c4ad[_0x198620(0xc7)]!=null&&hookDirectoryIdentity(_0x41c4ad[_0x198620(0xc7)])===hookDirectoryIdentity(_0x2ff2cf)&&!_0x506aa0[_0x198620(0xd2)](_0x41c4ad[_0x198620(0xbc)]));if(_0x22f84e['length']>0x0)throw CliErrors[_0x198620(0xf2)](_0x198620(0xc1)+_0x2ff2cf+_0x198620(0xd9));}const _0x3735f1=_0x2e8a83[_0x198620(0x97)](hookDirectoryIdentity(_0x30d663));if(_0x3735f1&&_0x3735f1!==_0x307b92[_0x198620(0xd1)]['toLowerCase']())throw CliErrors[_0x198620(0xf2)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x2ff2cf+_0x198620(0xb6)+_0x30d663+_0x198620(0xe5));for(const _0x414979 of _0x307b92[_0x198620(0x8f)]){const _0x5beb42=_0x482882[_0x198620(0xb2)][_0x414979[_0x198620(0xdd)]];if(_0x5beb42&&!_0x3ddd95[_0x198620(0xd2)](_0x414979[_0x198620(0xdd)])&&!sameHookIdentity(_0x414979['entry'],_0x5beb42))throw CliErrors['validation'](_0x198620(0xc1)+_0x2ff2cf+_0x198620(0xb6)+_0x30d663+_0x198620(0xf6));}_0x9bf980[_0x198620(0x107)]({'oldDirectory':_0x2ff2cf,'newDirectory':_0x30d663,'oldDirectoryPath':_0x23413e,'newDirectoryPath':_0x31aba1,'mode':_0x19365d,'alias':_0x307b92[_0x198620(0xc7)],'keyChanges':_0x307b92['keyChanges']});}const _0x22bbe7={..._0x482882[_0x198620(0xb2)]},_0x4c27dc=new Map(),_0x529084=new Map();for(const _0x245dec of _0x9bf980){const _0x30c525=_0x245dec[_0x198620(0x100)]!=='rekey';_0x30c525&&_0x529084['set'](hookDirectoryIdentity(_0x245dec[_0x198620(0xa9)]),_0x245dec[_0x198620(0xf3)]);for(const _0x39d8f8 of _0x245dec[_0x198620(0x8f)]){const _0x2806fd=_0x22bbe7[_0x39d8f8[_0x198620(0xdd)]],_0x3e9fa0=_0x30c525?_0x39d8f8[_0x198620(0xfb)]:_0x2806fd??_0x39d8f8[_0x198620(0xfb)];_0x22bbe7[_0x39d8f8[_0x198620(0xdd)]]=canonicalizeHookEntry(_0x3e9fa0,_0x245dec[_0x198620(0xc7)]),delete _0x22bbe7[_0x39d8f8[_0x198620(0x125)]],_0x30c525&&_0x4c27dc[_0x198620(0xd3)](_0x39d8f8[_0x198620(0xdd)],resolveLocalFilePathFromLockKey(_0x4dfa8b,_0x39d8f8[_0x198620(0x125)]));}}return{'migrations':_0x9bf980,'projectedFunctions':_0x22bbe7,'sourceFilePathByNewLockKey':_0x4c27dc,'sourceDirectoryPathByNewDirectory':_0x529084};}function resolveMigratedSourceFilePath(_0x4f117b,_0x2c7acf){const _0xab652c=a43_0x212d3a;if(!_0x4f117b||!_0x2c7acf)return undefined;const _0x3a74ec=_0x4f117b[_0xab652c(0xff)][_0xab652c(0x97)](_0x2c7acf[_0xab652c(0xbc)]);if(_0x3a74ec)return _0x3a74ec;if(_0x2c7acf[_0xab652c(0xfd)]!==_0xab652c(0xb1))return undefined;const [,_0x573808,..._0x5be6f5]=_0x2c7acf['lockKey'][_0xab652c(0x117)]('/');if(!_0x573808||_0x5be6f5[_0xab652c(0x10a)]===0x0)return undefined;const _0x1c2e2f=_0x4f117b[_0xab652c(0xb5)][_0xab652c(0x97)](hookDirectoryIdentity(_0x573808));return _0x1c2e2f?join(_0x1c2e2f,..._0x5be6f5)+_0xab652c(0xab):undefined;}function sameHookIdentity(_0x6a7aee,_0x158522){const _0x2e0db7=a43_0x212d3a;return _0x6a7aee[_0x2e0db7(0x108)]===_0x158522[_0x2e0db7(0x108)]&&_0x6a7aee[_0x2e0db7(0xd1)]===_0x158522[_0x2e0db7(0xd1)]&&_0x6a7aee['operationType']===_0x158522[_0x2e0db7(0xbb)]&&_0x6a7aee[_0x2e0db7(0xa8)]===_0x158522[_0x2e0db7(0xa8)];}function canonicalizeHookEntry(_0x398a08,_0x589cb3){const {alias:_0x42da2c,..._0x3a25f9}=_0x398a08;return _0x589cb3?{..._0x3a25f9,'alias':_0x589cb3}:_0x3a25f9;}function hookDirectoryIdentity(_0x416e8a){const _0x4032e4=a43_0x212d3a;return _0x416e8a[_0x4032e4(0xe0)](_0x4032e4(0xcf))[_0x4032e4(0xe9)]();}function isSafeHookDirectorySegment(_0x33a640){return isSafeLockKeySegment(_0x33a640);}async function sameDirectory(_0x1a3645,_0xac2cce){const _0x5a8c30=a43_0x212d3a,[_0x1294eb,_0x257acd]=await Promise[_0x5a8c30(0xa6)]([stat(_0x1a3645),stat(_0xac2cce)]);return _0x1294eb[_0x5a8c30(0xcd)]===_0x257acd['dev']&&_0x1294eb[_0x5a8c30(0xa7)]===_0x257acd[_0x5a8c30(0xa7)];}async function applyHookDirectoryMigration(_0x2b3462,_0x304026){const _0x4bfae1=a43_0x212d3a,_0x22036c=_0x304026[_0x4bfae1(0xb2)],_0x53aa02=_0x304026[_0x4bfae1(0xf5)],_0x1d9bed=[],_0x1afd84=async()=>{const _0x1c7024=_0x4bfae1,_0x11c825=[];_0x304026[_0x1c7024(0xb2)]=_0x22036c,_0x304026[_0x1c7024(0xf5)]=_0x53aa02;for(const {migration:_0x326bd6,temporaryPath:_0x49eb50}of[..._0x1d9bed][_0x1c7024(0x110)]()){try{_0x49eb50?(await rename(_0x326bd6[_0x1c7024(0x102)],_0x49eb50),await rename(_0x49eb50,_0x326bd6[_0x1c7024(0xf3)])):await rename(_0x326bd6[_0x1c7024(0x102)],_0x326bd6['oldDirectoryPath']);}catch(_0x2f7de3){_0x11c825[_0x1c7024(0x107)](new Error(_0x1c7024(0xe3)+_0x326bd6[_0x1c7024(0xc5)]+'\x22\x20from\x20\x22'+_0x326bd6[_0x1c7024(0xa9)]+_0x1c7024(0x103)+(_0x2f7de3 instanceof Error?_0x2f7de3[_0x1c7024(0xb0)]:String(_0x2f7de3))));}}return _0x11c825;};try{for(const _0x215229 of _0x2b3462[_0x4bfae1(0x9e)]){if(_0x215229[_0x4bfae1(0x100)]===_0x4bfae1(0x90))await ensureParentDirectory(_0x215229[_0x4bfae1(0x102)]),await rename(_0x215229[_0x4bfae1(0xf3)],_0x215229['newDirectoryPath']),_0x1d9bed[_0x4bfae1(0x107)]({'migration':_0x215229});else{if(_0x215229[_0x4bfae1(0x100)]===_0x4bfae1(0xc2)){const _0x11ef47=join(dirname(_0x215229[_0x4bfae1(0xf3)]),_0x4bfae1(0xb3)+randomUUID());await rename(_0x215229[_0x4bfae1(0xf3)],_0x11ef47);try{await rename(_0x11ef47,_0x215229[_0x4bfae1(0x102)]);}catch(_0x55f8ba){try{await rename(_0x11ef47,_0x215229['oldDirectoryPath']);}catch(_0x1947df){throw withRollbackErrors(_0x55f8ba,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x215229['oldDirectory']+'\x22\x20to\x20\x22'+_0x215229[_0x4bfae1(0xa9)]+_0x4bfae1(0x128)+_0x11ef47+_0x4bfae1(0xc6),[new Error(_0x4bfae1(0xd4)+_0x11ef47+_0x4bfae1(0xb6)+_0x215229['oldDirectory']+'\x22:\x20'+(_0x1947df instanceof Error?_0x1947df[_0x4bfae1(0xb0)]:String(_0x1947df)))]);}throw _0x55f8ba;}_0x1d9bed[_0x4bfae1(0x107)]({'migration':_0x215229,'temporaryPath':_0x11ef47});}}}return _0x304026[_0x4bfae1(0xb2)]=_0x2b3462['projectedFunctions'],{'rollback':_0x1afd84};}catch(_0xc16cef){const _0x7297c7=await _0x1afd84();throw withRollbackErrors(_0xc16cef,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x7297c7);}}async function confirmForce(){const _0x56eb32=a43_0x212d3a,_0x53845a=createInterface({'input':process[_0x56eb32(0x101)],'output':process[_0x56eb32(0x10d)]}),_0x2781cb=await new Promise(_0x1864c1=>{const _0x5b9d00=_0x56eb32;_0x53845a['question'](_0x5b9d00(0xba),_0x1864c1);});return _0x53845a[_0x56eb32(0xdc)](),['y',_0x56eb32(0x116)]['includes'](_0x2781cb[_0x56eb32(0xb9)]()[_0x56eb32(0xe9)]());}
|