@lovrabet/rabetbase-cli 2.5.7 → 2.5.8-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.d.ts +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 +2 -2
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-management-client.d.ts +19 -0
- package/lib/core/kb-management-client.js +1 -0
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +2 -2
- package/skills/rabetbase/references/rabetbase-kb.md +7 -6
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x5d18a4=a34_0x4dd7;(function(_0x1251f5,_0x3b050d){const _0xb99934=a34_0x4dd7,_0x2f12f9=_0x1251f5();while(!![]){try{const _0x452ba8=parseInt(_0xb99934(0x70))/0x1+parseInt(_0xb99934(0x81))/0x2*(parseInt(_0xb99934(0x7b))/0x3)+parseInt(_0xb99934(0x6d))/0x4+parseInt(_0xb99934(0x6f))/0x5+-parseInt(_0xb99934(0x67))/0x6+parseInt(_0xb99934(0x73))/0x7+-parseInt(_0xb99934(0x78))/0x8;if(_0x452ba8===_0x3b050d)break;else _0x2f12f9['push'](_0x2f12f9['shift']());}catch(_0x3126d8){_0x2f12f9['push'](_0x2f12f9['shift']());}}}(a34_0x5ccc,0x83ac0));function a34_0x4dd7(_0x3cc480,_0x4f61b9){_0x3cc480=_0x3cc480-0x67;const _0x5ccc4c=a34_0x5ccc();let _0x4dd7b2=_0x5ccc4c[_0x3cc480];return _0x4dd7b2;}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';const CREATE_PATH='/smartapi/app-config/create',UPDATE_PATH=a34_0x5d18a4(0x6e);export const appConfigSet={'service':'app-config','command':a34_0x5d18a4(0x6b),'description':a34_0x5d18a4(0x7f),'risk':a34_0x5d18a4(0x7d),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x5d18a4(0x69),'type':a34_0x5d18a4(0x7a),'description':a34_0x5d18a4(0x76)}],async 'validate'(_0x59e3e0){readKeyArg(_0x59e3e0),readOptionalTags(_0x59e3e0),assertSingleValueSource(_0x59e3e0);},async 'dryRun'(_0x5037d7){const _0x183f72=a34_0x5d18a4,_0x31b3ca=readKeyArg(_0x5037d7),_0x51eb87=readOptionalTags(_0x5037d7),_0x180a99=assertSingleValueSource(_0x5037d7);await assertValueSourceReadable(_0x180a99);const _0x5bad52=await withAppConfigApiBoundary(_0x183f72(0x74),{'appCode':_0x5037d7[_0x183f72(0x77)],'key':_0x31b3ca},()=>getAppConfigByKey(_0x5037d7[_0x183f72(0x77)],_0x31b3ca)),_0x167fc0=_0x5bad52?_0x183f72(0x80):_0x183f72(0x72),_0x39f0da=_0x5bad52?projectAppConfig(_0x5bad52):null,_0x43a52e=plannedAppConfig({'appCode':_0x5037d7[_0x183f72(0x77)],'key':_0x31b3ca,'tags':_0x51eb87??_0x5bad52?.[_0x183f72(0x71)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x167fc0,'appCode':_0x5037d7[_0x183f72(0x77)],'key':_0x31b3ca,'before':_0x39f0da,'after':_0x43a52e,'dryRun':!![]}),{'method':_0x183f72(0x68),'url':_0x167fc0===_0x183f72(0x80)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0xd47e18){const _0x4ecf7c=a34_0x5d18a4,_0xed3f17=readKeyArg(_0xd47e18),_0x436baa=readOptionalTags(_0xd47e18),_0xe03dc7=await withAppConfigApiBoundary(_0x4ecf7c(0x74),{'appCode':_0xd47e18[_0x4ecf7c(0x77)],'key':_0xed3f17},()=>getAppConfigByKey(_0xd47e18[_0x4ecf7c(0x77)],_0xed3f17)),_0x249202=_0xe03dc7?projectAppConfig(_0xe03dc7):null,_0x24fb2a=_0xe03dc7?'update':_0x4ecf7c(0x72),{value:_0x458b4c,warnings:_0x25feb0}=await readAppConfigValue(_0xd47e18),_0x12c5cc={'appCode':_0xd47e18[_0x4ecf7c(0x77)],'key':_0xed3f17,'value':_0x458b4c,'tags':_0x436baa??_0xe03dc7?.[_0x4ecf7c(0x71)]??undefined};await withAppConfigApiBoundary(_0x24fb2a,{'appCode':_0xd47e18[_0x4ecf7c(0x77)],'key':_0xed3f17},async()=>{_0xe03dc7?await updateAppConfig({..._0x12c5cc,'id':requireAppConfigId(_0xe03dc7,_0xed3f17,_0xd47e18['appCode'])}):await createAppConfig(_0x12c5cc);});const _0x47dd23=await withAppConfigApiBoundary(_0x4ecf7c(0x74),{'appCode':_0xd47e18[_0x4ecf7c(0x77)],'key':_0xed3f17},()=>getAppConfigByKey(_0xd47e18[_0x4ecf7c(0x77)],_0xed3f17)),_0x4d11fb=_0x47dd23?projectAppConfig(_0x47dd23):plannedAppConfig({'appCode':_0xd47e18[_0x4ecf7c(0x77)],'key':_0xed3f17,'tags':_0x12c5cc[_0x4ecf7c(0x71)],'hasValue':_0x458b4c!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x24fb2a,'appCode':_0xd47e18[_0x4ecf7c(0x77)],'key':_0xed3f17,'before':_0x249202,'after':_0x4d11fb,'dryRun':![],'warnings':_0x25feb0}),'message':(_0x24fb2a==='update'?_0x4ecf7c(0x79):_0x4ecf7c(0x75))+_0x4ecf7c(0x6a)+_0xed3f17};}};function a34_0x5ccc(){const _0x4187ef=['update','40310opkvLK','App\x20config\x20server\x20id\x20missing\x20for\x20key=','5581188oSJBos','POST','file','\x20app\x20config\x20','set','number','3834596UnjpnD','/smartapi/app-config/update','2294665cUwQua','375209YWdxRn','tags','create','3247699yMZiXM','get','Created','Read\x20config\x20value\x20from\x20file','appCode','13069856anhYCS','Updated','string','126AYgQGz','apiError','write',',\x20appCode=','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key'];a34_0x5ccc=function(){return _0x4187ef;};return a34_0x5ccc();}function requireAppConfigId(_0x46b96c,_0x3ebec1,_0x467ef3){const _0x2507d6=a34_0x5d18a4;if(typeof _0x46b96c['id']===_0x2507d6(0x6c)&&Number['isFinite'](_0x46b96c['id'])&&_0x46b96c['id']>0x0)return _0x46b96c['id'];throw CliErrors[_0x2507d6(0x7c)](_0x2507d6(0x82)+_0x3ebec1+_0x2507d6(0x7e)+_0x467ef3);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x80c0bb=a35_0xa21c;(function(_0x3001ec,_0x50bf1d){const _0x4c3436=a35_0xa21c,_0x4bb3b7=_0x3001ec();while(!![]){try{const _0x1f1993=parseInt(_0x4c3436(0x101))/0x1+parseInt(_0x4c3436(0xf6))/0x2+parseInt(_0x4c3436(0xef))/0x3*(parseInt(_0x4c3436(0xd5))/0x4)+-parseInt(_0x4c3436(0xe6))/0x5+-parseInt(_0x4c3436(0xf2))/0x6+-parseInt(_0x4c3436(0xd0))/0x7*(-parseInt(_0x4c3436(0xfe))/0x8)+parseInt(_0x4c3436(0xca))/0x9*(-parseInt(_0x4c3436(0xd3))/0xa);if(_0x1f1993===_0x50bf1d)break;else _0x4bb3b7['push'](_0x4bb3b7['shift']());}catch(_0x11cb53){_0x4bb3b7['push'](_0x4bb3b7['shift']());}}}(a35_0x3abd,0x4f5d7));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x80c0bb(0xcf),'description':'Runtime\x20app-config\x20key','required':!![]};export const VALUE_ARG={'name':a35_0x80c0bb(0xea),'description':'Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','required':![]};export const TAGS_FLAG={'name':a35_0x80c0bb(0xfd),'type':a35_0x80c0bb(0xc8),'description':a35_0x80c0bb(0xf9)};export const STDIN_FLAG={'name':a35_0x80c0bb(0xf0),'type':a35_0x80c0bb(0xf3),'description':'Read\x20config\x20value\x20from\x20stdin','default':![]};export const FROM_ENV_FLAG={'name':a35_0x80c0bb(0xde),'type':a35_0x80c0bb(0xc8),'description':a35_0x80c0bb(0xd9)};export const REVEAL_FLAG={'name':a35_0x80c0bb(0xe4),'type':'boolean','description':'Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','default':![]};export function readKeyArg(_0x1beea6){const _0xfc9dfa=a35_0x80c0bb,_0x4dc8fe=_0x1beea6['args'][0x0]?.[_0xfc9dfa(0xce)]()??'';return validateKey(_0x4dc8fe),_0x4dc8fe;}export function readOptionalTags(_0x189ad4){const _0x24df74=a35_0x80c0bb,_0x52a0c1=_0x189ad4[_0x24df74(0xe1)](_0x24df74(0xfd))['trim']();if(!_0x52a0c1)return undefined;if(_0x52a0c1[_0x24df74(0xe9)]>0x20)throw CliErrors[_0x24df74(0xf8)]('App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.');return _0x52a0c1;}export function validateKey(_0x1533c6){const _0x45ffb0=a35_0x80c0bb;if(!_0x1533c6)throw CliErrors['validation']('Missing\x20app-config\x20key.');if(_0x1533c6[_0x45ffb0(0xe9)]>0x100)throw CliErrors[_0x45ffb0(0xf8)](_0x45ffb0(0xe0));}export function projectAppConfig(_0xe929d0,_0x4616fd){const _0x3bd107=a35_0x80c0bb,_0x1c60c9=_0xe929d0[_0x3bd107(0xea)]!==undefined&&_0xe929d0[_0x3bd107(0xea)]!==null&&_0xe929d0[_0x3bd107(0xea)]!=='',_0x4f0fd1={'appCode':_0xe929d0[_0x3bd107(0xd2)],'key':_0xe929d0[_0x3bd107(0xcf)],'tags':_0xe929d0[_0x3bd107(0xfd)]??undefined,'hasValue':_0x1c60c9,'valueRedacted':_0x1c60c9&&!_0x4616fd?.['reveal'],'gmtCreate':_0xe929d0[_0x3bd107(0xfa)],'gmtModified':_0xe929d0[_0x3bd107(0xdd)]};return _0x4616fd?.['reveal']&&(_0x4f0fd1[_0x3bd107(0xea)]=_0xe929d0[_0x3bd107(0xea)]??'',_0x4f0fd1[_0x3bd107(0xec)]=![]),_0x4f0fd1;}function a35_0x3abd(){const _0x5c2c2d=['1201606znRPGT','args','validation','Config\x20tags\x20for\x20filtering/display\x20metadata','gmtCreate','push','appCode:\x20','tags','568440bCMABp','slice','end','528176DFTFTh','value\x20is\x20redacted','url','string','after','335754CRSzrl','file','argument','method','trim','key','21UVkger','setEncoding','appCode','150binPSg','data','44pgNSRR','join','error','Environment\x20variable\x20is\x20not\x20set:\x20','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','operation','kind','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','gmtModified','from-env','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','str','\x20app\x20config.','once','reveal','utf8','1054560ESogVD','key:\x20','env','length','value','dryRun','valueRedacted','name','hasValue','9732ENVfPI','stdin','path','1693482MmvDOK','boolean','App\x20config\x20value\x20source\x20is\x20ambiguous.','Failed\x20to\x20'];a35_0x3abd=function(){return _0x5c2c2d;};return a35_0x3abd();}export function plannedAppConfig(_0x6eb5fe){const _0xc26d9c=a35_0x80c0bb,_0x337c9c=_0x6eb5fe[_0xc26d9c(0xee)]??!![];return{'appCode':_0x6eb5fe[_0xc26d9c(0xd2)],'key':_0x6eb5fe[_0xc26d9c(0xcf)],'tags':_0x6eb5fe['tags']??undefined,'hasValue':_0x337c9c,'valueRedacted':_0x337c9c};}function a35_0xa21c(_0x463851,_0x13f77d){_0x463851=_0x463851-0xc7;const _0x3abd18=a35_0x3abd();let _0xa21cb4=_0x3abd18[_0x463851];return _0xa21cb4;}export function buildMutationData(_0x33db1a){const _0x2a67c4=a35_0x80c0bb;return{'operation':_0x33db1a[_0x2a67c4(0xda)],'selector':{'appCode':_0x33db1a[_0x2a67c4(0xd2)],'key':_0x33db1a['key']},'before':_0x33db1a['before'],'after':_0x33db1a[_0x2a67c4(0xc9)],'dryRun':_0x33db1a[_0x2a67c4(0xeb)],'warnings':_0x33db1a['warnings']??[]};}export async function withAppConfigApiBoundary(_0x5a5845,_0x32b826,_0x5e9d56){const _0x20c5ef=a35_0x80c0bb;try{return await _0x5e9d56();}catch{const _0x2d5c89=[_0x20c5ef(0xfc)+_0x32b826['appCode']];if(_0x32b826[_0x20c5ef(0xcf)])_0x2d5c89[_0x20c5ef(0xfb)](_0x20c5ef(0xe7)+_0x32b826[_0x20c5ef(0xcf)]);_0x2d5c89[_0x20c5ef(0xfb)](_0x20c5ef(0x102));throw CliErrors['apiError'](_0x20c5ef(0xf5)+_0x5a5845+_0x20c5ef(0xe2),_0x2d5c89[_0x20c5ef(0xd6)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0xf31e25,_0x21f907){const _0x3d715c=a35_0x80c0bb;return Object['defineProperties'](_0xf31e25,{'method':{'value':_0x21f907[_0x3d715c(0xcd)],'enumerable':![]},'url':{'value':_0x21f907[_0x3d715c(0xc7)],'enumerable':![]}});}export function assertSingleValueSource(_0x54929f){const _0x3f2f12=a35_0x80c0bb,_0x8ffaa5=[];_0x54929f[_0x3f2f12(0xf7)][_0x3f2f12(0xe9)]>0x1&&_0x8ffaa5['push']({'kind':_0x3f2f12(0xcc),'value':_0x54929f[_0x3f2f12(0xf7)][_0x3f2f12(0xff)](0x1)[_0x3f2f12(0xd6)]('\x20')});const _0x16ce29=_0x54929f['flag'](_0x3f2f12(0xea));_0x16ce29!==undefined&&_0x16ce29!==null&&_0x8ffaa5[_0x3f2f12(0xfb)]({'kind':'argument','value':String(_0x16ce29)});_0x54929f['bool']('stdin')&&_0x8ffaa5['push']({'kind':_0x3f2f12(0xf0)});const _0x5a7e6f=_0x54929f['str'](_0x3f2f12(0xde))[_0x3f2f12(0xce)]();_0x5a7e6f&&_0x8ffaa5[_0x3f2f12(0xfb)]({'kind':_0x3f2f12(0xe8),'name':_0x5a7e6f});const _0x231165=_0x54929f[_0x3f2f12(0xe1)](_0x3f2f12(0xcb))[_0x3f2f12(0xce)]();_0x231165&&_0x8ffaa5[_0x3f2f12(0xfb)]({'kind':_0x3f2f12(0xcb),'path':_0x231165});if(_0x8ffaa5[_0x3f2f12(0xe9)]===0x0)throw CliErrors[_0x3f2f12(0xf8)]('Missing\x20app-config\x20value\x20source.',_0x3f2f12(0xdf));if(_0x8ffaa5[_0x3f2f12(0xe9)]>0x1)throw CliErrors[_0x3f2f12(0xf8)](_0x3f2f12(0xf4),_0x3f2f12(0xdc));return _0x8ffaa5[0x0];}export async function assertValueSourceReadable(_0x357288){const _0x2b11a4=a35_0x80c0bb;if(_0x357288[_0x2b11a4(0xdb)]===_0x2b11a4(0xe8)&&!(_0x357288[_0x2b11a4(0xed)]in process.env))throw CliErrors[_0x2b11a4(0xf8)](_0x2b11a4(0xd8)+_0x357288[_0x2b11a4(0xed)]);if(_0x357288[_0x2b11a4(0xdb)]===_0x2b11a4(0xcb))try{await access(_0x357288[_0x2b11a4(0xf1)]);}catch{throw CliErrors[_0x2b11a4(0xf8)]('Value\x20file\x20is\x20not\x20readable:\x20'+_0x357288[_0x2b11a4(0xf1)]);}}export async function readAppConfigValue(_0x4d187f){const _0x293483=a35_0x80c0bb,_0x22cb80=assertSingleValueSource(_0x4d187f),_0x12a411=[];if(_0x22cb80[_0x293483(0xdb)]===_0x293483(0xcc))return _0x12a411['push']('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0x22cb80[_0x293483(0xea)]??'','source':_0x22cb80[_0x293483(0xdb)],'warnings':_0x12a411};if(_0x22cb80[_0x293483(0xdb)]===_0x293483(0xf0))return{'value':await readStdin(),'source':_0x22cb80[_0x293483(0xdb)],'warnings':_0x12a411};if(_0x22cb80['kind']===_0x293483(0xe8)){if(!(_0x22cb80[_0x293483(0xed)]in process.env))throw CliErrors[_0x293483(0xf8)](_0x293483(0xd8)+_0x22cb80[_0x293483(0xed)]);return{'value':process.env[_0x22cb80.name]??'','source':_0x22cb80[_0x293483(0xdb)],'warnings':_0x12a411};}return{'value':await readFile(_0x22cb80[_0x293483(0xf1)],_0x293483(0xe5)),'source':_0x22cb80[_0x293483(0xdb)],'warnings':_0x12a411};}function readStdin(){return new Promise((_0x382eab,_0x42c42a)=>{const _0x10e272=a35_0xa21c;let _0x214083='';process['stdin'][_0x10e272(0xd1)](_0x10e272(0xe5)),process['stdin']['on'](_0x10e272(0xd4),_0x58367e=>{_0x214083+=_0x58367e;}),process[_0x10e272(0xf0)][_0x10e272(0xe3)](_0x10e272(0x100),()=>_0x382eab(_0x214083)),process[_0x10e272(0xf0)]['once'](_0x10e272(0xd7),_0x42c42a);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x1d6bf7=a36_0x4bbe;function a36_0x4bbe(_0x300072,_0x12f6c1){_0x300072=_0x300072-0x1ed;const _0x2ef286=a36_0x2ef2();let _0x4bbe10=_0x2ef286[_0x300072];return _0x4bbe10;}(function(_0x5e81a5,_0x35ec96){const _0x2a80e5=a36_0x4bbe,_0x22a476=_0x5e81a5();while(!![]){try{const _0x573d5b=-parseInt(_0x2a80e5(0x1ff))/0x1*(-parseInt(_0x2a80e5(0x1fd))/0x2)+-parseInt(_0x2a80e5(0x1fb))/0x3+parseInt(_0x2a80e5(0x1fe))/0x4+parseInt(_0x2a80e5(0x1f2))/0x5*(parseInt(_0x2a80e5(0x1f1))/0x6)+parseInt(_0x2a80e5(0x1ee))/0x7*(parseInt(_0x2a80e5(0x1f5))/0x8)+parseInt(_0x2a80e5(0x1f4))/0x9*(parseInt(_0x2a80e5(0x1f7))/0xa)+-parseInt(_0x2a80e5(0x1f8))/0xb*(parseInt(_0x2a80e5(0x201))/0xc);if(_0x573d5b===_0x35ec96)break;else _0x22a476['push'](_0x22a476['shift']());}catch(_0x166dd8){_0x22a476['push'](_0x22a476['shift']());}}}(a36_0x2ef2,0x3d7b2));import{unlinkSync,existsSync}from'node:fs';function a36_0x2ef2(){const _0x8c9654=['auth','nonInteractive','151739uTyqxT','write','✓\x20Logged\x20out','654HkPLdt','14785WoNjpM','boolean','27xwGSpU','104xNKuZf','../../auth/auth-server-ui.js','1525870WYCoWK','415316ODtejn','login','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','1265997JgpvkV','yes','5462rSRaqn','188260dRpEnt','131OhdjrY','bool','252GVZXjx','Login\x20via\x20browser','logout'];a36_0x2ef2=function(){return _0x8c9654;};return a36_0x2ef2();}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a36_0x1d6bf7(0x204),'command':a36_0x1d6bf7(0x1f9),'description':a36_0x1d6bf7(0x202),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x1d6bf7(0x1fc),'type':a36_0x1d6bf7(0x1f3),'description':a36_0x1d6bf7(0x1fa),'default':![]}],async 'execute'(_0x11aa38){const _0x4b07a4=a36_0x1d6bf7,{runAuthServer:_0xe7cc0d}=await import(_0x4b07a4(0x1f6));return await _0xe7cc0d({'autoYes':_0x11aa38[_0x4b07a4(0x200)](_0x4b07a4(0x1fc)),'nonInteractive':_0x11aa38[_0x4b07a4(0x1ed)]}),{'ok':!![]};}},{'service':'auth','command':a36_0x1d6bf7(0x203),'description':'Clear\x20login\x20session','risk':a36_0x1d6bf7(0x1ef),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x198642){const _0x1966cb=a36_0x1d6bf7;return existsSync(cookieFile)?(unlinkSync(cookieFile),console['log'](_0x1966cb(0x1f0))):console['log']('!\x20Not\x20logged\x20in'),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x552261=a37_0x48a4;(function(_0x7c6f29,_0x1c5e08){const _0x2d4b66=a37_0x48a4,_0x2b7667=_0x7c6f29();while(!![]){try{const _0x2916f5=parseInt(_0x2d4b66(0xd9))/0x1*(-parseInt(_0x2d4b66(0xaa))/0x2)+-parseInt(_0x2d4b66(0xfd))/0x3*(-parseInt(_0x2d4b66(0xe0))/0x4)+parseInt(_0x2d4b66(0xde))/0x5*(parseInt(_0x2d4b66(0xf8))/0x6)+-parseInt(_0x2d4b66(0xfa))/0x7*(-parseInt(_0x2d4b66(0xc1))/0x8)+parseInt(_0x2d4b66(0xaf))/0x9*(-parseInt(_0x2d4b66(0xb3))/0xa)+-parseInt(_0x2d4b66(0xe3))/0xb+parseInt(_0x2d4b66(0xc7))/0xc;if(_0x2916f5===_0x1c5e08)break;else _0x2b7667['push'](_0x2b7667['shift']());}catch(_0x60cf11){_0x2b7667['push'](_0x2b7667['shift']());}}}(a37_0xc7a3,0x6a7a6));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';function a37_0x48a4(_0x186388,_0x2f20d4){_0x186388=_0x186388-0xa8;const _0xc7a3c6=a37_0xc7a3();let _0x48a4f9=_0xc7a3c6[_0x186388];return _0x48a4f9;}import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';function a37_0xc7a3(){const _0xc49e8f=['ENDPOINT','\x22\x20not\x20found\x20for\x20dataset\x20','code','nonInteractive','functionNode','filePath','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','/ENDPOINT/','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','appCode','description','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','修改后的响应结果','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','/data/dataset/','validation','22Xghvww','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','tableName','Select\x20operation\x20type:','File\x20already\x20exists:\x20','873CymPlZ','\x22\x20not\x20found.\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','.js','47910LziZFE','join','defaultApp','Script\x20description','datasetCode','datasetcode','after','\x22,\x20params\x20})\x0a','before','string','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Created\x20','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','424VVtZKJ','operationType','Available\x20aliases:\x20','map','find','operation-type','8586408kJFxPb','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','keys','write','name','UNKNOWN','Alias\x20\x22','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\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','No\x20datasets\x20found\x20for\x20this\x20app.','parseInt','bff','close','/**\x0a\x20*\x20','apiDir','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','59231tEhNoN','selectedAppName','trim','HOOK\x20requires\x20alias/operation/node\x20options.','type','5nufvjf','alias','12128XuCyVL','当前请求参数','\x0a\x20*\x20[平台配置]\x20','5221810ctCEnl','source','\x20function:\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','includes','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','profileName','当前响应结果','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','isInteger','Invalid\x20dataset\x20selection.','str','\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','function-node','create','.js\x0a','scriptsRootDir','read','Operation\x20type\x20\x22','修改后的请求参数','Trigger\x20node\x20(HOOK\x20only)','2225082gWdzPB','HOOK','47761pFqIiP','\x22.\x20','length','573zYZAtq','Select\x20trigger\x20node:','No\x20model\x20aliases\x20found.\x20Run\x20`','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','mergedCli','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','Available:\x20','utf8'];a37_0xc7a3=function(){return _0xc49e8f;};return a37_0xc7a3();}import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x552261(0xd3),'command':a37_0x552261(0xf1),'description':a37_0x552261(0x103),'risk':a37_0x552261(0xf4),'flags':[{'name':a37_0x552261(0xdd),'type':a37_0x552261(0xbc),'required':!![],'enum':['COMMON','ENDPOINT',a37_0x552261(0xf9)],'description':'Script\x20type'},{'name':'name','type':'string','required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x552261(0x112),'type':a37_0x552261(0xbc),'description':a37_0x552261(0xb6)},{'name':'alias','type':a37_0x552261(0xbc),'description':a37_0x552261(0xe6)},{'name':a37_0x552261(0xb8),'type':a37_0x552261(0xbc),'description':a37_0x552261(0x10d)},{'name':a37_0x552261(0xc6),'type':a37_0x552261(0xbc),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a37_0x552261(0xbc),'description':a37_0x552261(0xf7),'enum':[a37_0x552261(0xbb),a37_0x552261(0xb9)]}],async 'validate'(_0x3ecfd3){const _0x1d4532=a37_0x552261,_0x382caf=_0x3ecfd3[_0x1d4532(0xee)]('name');if(!isValidBffFunctionName(_0x382caf))throw CliErrors['validation']('Invalid\x20function\x20name\x20\x22'+_0x382caf+_0x1d4532(0xb1));},async 'execute'(_0x792531){const _0x156880=a37_0x552261,_0x52a354=loadBffProjectConfig(_0x792531[_0x156880(0x111)]),_0x41cbb7=_0x792531[_0x156880(0xee)](_0x156880(0xdd)),_0x152850=_0x792531[_0x156880(0xee)](_0x156880(0xcb)),_0x59c37d=_0x792531[_0x156880(0xee)](_0x156880(0x112))||undefined,_0x469563=_0x41cbb7===_0x156880(0xf9)?await resolveHookOptions(_0x52a354,_0x792531):undefined,_0x2339c0=buildFilePath(_0x52a354,_0x41cbb7,_0x152850,_0x469563);if(await fileExists(_0x2339c0))throw CliErrors['validation'](_0x156880(0xae)+_0x2339c0);await mkdir(dirname(_0x2339c0),{'recursive':!![]});const _0x1cd0d8=generateTemplate(_0x41cbb7,_0x152850,_0x792531[_0x156880(0x111)],_0x59c37d,_0x469563);await writeFile(_0x2339c0,_0x1cd0d8,_0x156880(0x105));const _0x574977={'type':_0x41cbb7,'name':_0x152850,'path':_0x2339c0};if(_0x59c37d)_0x574977[_0x156880(0x112)]=_0x59c37d;if(_0x469563){if(_0x469563['alias'])_0x574977[_0x156880(0xdf)]=_0x469563[_0x156880(0xdf)];_0x574977[_0x156880(0xb7)]=_0x469563[_0x156880(0xb7)],_0x574977[_0x156880(0xc2)]=_0x469563[_0x156880(0xc2)],_0x574977['functionNode']=_0x469563[_0x156880(0x10a)];}return{'ok':!![],'data':_0x574977,'message':_0x156880(0xbe)+_0x41cbb7+_0x156880(0xe5)+_0x152850};}};async function resolveHookOptions(_0x4201a4,_0x104876){const _0x293907=a37_0x552261,_0x657863=resolveApiModelSource(_0x104876[_0x293907(0xd6)],_0x104876[_0x293907(0x111)],_0x104876[_0x293907(0xda)]||_0x104876[_0x293907(0x102)]?.['currentApp']||_0x104876[_0x293907(0x102)]?.[_0x293907(0xb5)]),_0x320dde=loadAliasMap(_0x104876['apiDir'],undefined,_0x657863[_0x293907(0x10b)],_0x657863[_0x293907(0xe9)]),_0x317b45=_0x320dde[_0x293907(0xfc)]>0x0;let _0x557dc2,_0x2aea78,_0x83f0eb;const _0x28f8e0=_0x104876[_0x293907(0xee)](_0x293907(0xdf)),_0x2df469=_0x104876[_0x293907(0xee)](_0x293907(0xb8));if(_0x28f8e0){const _0x2742ee=resolveAlias(_0x104876[_0x293907(0xd6)],_0x28f8e0,undefined,_0x657863['filePath'],_0x657863['profileName']);if(!_0x2742ee){const _0x511ba2=_0x317b45?_0x293907(0xc3)+_0x320dde[_0x293907(0xc4)](_0x372a57=>_0x372a57[_0x293907(0xdf)])[_0x293907(0xb4)](',\x20'):_0x293907(0xff)+CLI_BIN_NAME+_0x293907(0x10c);throw CliErrors[_0x293907(0xa9)](_0x293907(0xcd)+_0x28f8e0+_0x293907(0xb0)+_0x511ba2);}_0x557dc2=_0x28f8e0,_0x2aea78=_0x2742ee;}else{if(_0x2df469){_0x2aea78=_0x2df469;const _0x397eb6=_0x320dde[_0x293907(0xc5)](_0x160d70=>_0x160d70[_0x293907(0xb7)]===_0x2df469);_0x557dc2=_0x397eb6?.[_0x293907(0xdf)];}else{if(_0x104876['nonInteractive'])throw CliErrors[_0x293907(0xa9)](_0x293907(0x113));else{if(_0x317b45){const _0x4bdf1d=_0x320dde['map'](_0x40dafa=>_0x40dafa[_0x293907(0xdf)]+'\x20('+_0x40dafa[_0x293907(0xac)]+')'),_0x59e3a1=await promptSelect('Select\x20dataset:',_0x4bdf1d),_0x1cc5c3=_0x320dde[_0x59e3a1];if(!_0x1cc5c3)throw CliErrors['validation'](_0x293907(0xed));_0x557dc2=_0x1cc5c3[_0x293907(0xdf)],_0x2aea78=_0x1cc5c3[_0x293907(0xb7)];}else{const _0x42fbeb=await listDatasets(_0x104876[_0x293907(0x111)]);if(_0x42fbeb[_0x293907(0xfc)]===0x0)throw CliErrors[_0x293907(0xa9)](_0x293907(0xd1));const _0x4c4c2d=_0x42fbeb['map'](_0x1cd8f3=>_0x1cd8f3[_0x293907(0xcb)]+'\x20['+(_0x1cd8f3[_0x293907(0xe4)]??_0x293907(0xcc))+']\x20('+_0x1cd8f3['code']+')'),_0x3d9d48=await promptSelect('Select\x20dataset:',_0x4c4c2d),_0x57b26e=_0x42fbeb[_0x3d9d48];if(!_0x57b26e)throw CliErrors['validation']('Invalid\x20dataset\x20selection.');_0x2aea78=_0x57b26e[_0x293907(0x108)],_0x557dc2=undefined;}}}}const _0x4b9202=await listDatasets(_0x104876['appCode']),_0x1aa6bb=_0x4b9202['find'](_0x9e6c5c=>_0x9e6c5c[_0x293907(0x108)]===_0x2aea78);if(!_0x1aa6bb)throw CliErrors['validation'](_0x293907(0xd7)+_0x2aea78+_0x293907(0xfb)+(_0x557dc2?_0x293907(0x101)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x83f0eb=_0x1aa6bb['id'];const _0x348f89=_0x557dc2??_0x2aea78,_0xe80394=await listBffDatasetOperations(_0x104876[_0x293907(0x111)],_0x83f0eb),_0x1df325=_0xe80394?Object[_0x293907(0xc9)](_0xe80394):[];if(_0x1df325[_0x293907(0xfc)]===0x0)throw CliErrors[_0x293907(0xa9)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x348f89+'.');let _0x4167bd;const _0xa5fdc7=_0x104876['str'](_0x293907(0xc6));if(_0xa5fdc7){if(!_0x1df325[_0x293907(0xe7)](_0xa5fdc7))throw CliErrors[_0x293907(0xa9)](_0x293907(0xf5)+_0xa5fdc7+_0x293907(0x107)+_0x348f89+'.\x20'+(_0x293907(0x104)+_0x1df325[_0x293907(0xb4)](',\x20')));_0x4167bd=_0xa5fdc7;}else{if(_0x104876[_0x293907(0x109)])throw CliErrors[_0x293907(0xa9)](_0x293907(0xe8));const _0x590b27=await promptSelect(_0x293907(0xad),_0x1df325);_0x4167bd=_0x1df325[_0x590b27]??_0x1df325[0x0];}let _0x2f10c8=normalizeHookFunctionNode(_0x104876[_0x293907(0xee)](_0x293907(0xf0)));if(!_0x2f10c8){if(_0x104876['str']('function-node'))throw CliErrors[_0x293907(0xa9)](_0x293907(0xce));if(_0x104876['nonInteractive'])throw CliErrors[_0x293907(0xa9)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x20c009=await promptSelect(_0x293907(0xfe),[_0x293907(0xbb),_0x293907(0xb9)]);_0x2f10c8=[_0x293907(0xbb),_0x293907(0xb9)][_0x20c009]??_0x293907(0xbb);}return{'alias':_0x557dc2,'datasetCode':_0x2aea78,'datasetId':_0x83f0eb,'operationType':_0x4167bd,'functionNode':_0x2f10c8};}async function promptSelect(_0x12959b,_0x29bf6a){const _0x307ce2=a37_0x552261;if(_0x29bf6a['length']===0x1)return 0x0;for(const [_0x121982,_0x29a623]of _0x29bf6a['entries']()){process['stderr'][_0x307ce2(0xca)]('\x20\x20'+(_0x121982+0x1)+'.\x20'+_0x29a623+'\x0a');}const _0x4daa7d=createInterface({'input':process['stdin'],'output':process[_0x307ce2(0xbf)]});while(!![]){const _0x2dc43e=await new Promise(_0x11ed47=>{_0x4daa7d['question'](_0x12959b+'\x20',_0x11ed47);}),_0x51768e=Number[_0x307ce2(0xd2)](_0x2dc43e['trim'](),0xa);if(Number[_0x307ce2(0xec)](_0x51768e)&&_0x51768e>=0x1&&_0x51768e<=_0x29bf6a[_0x307ce2(0xfc)])return _0x4daa7d[_0x307ce2(0xd4)](),_0x51768e-0x1;process['stderr'][_0x307ce2(0xca)](_0x307ce2(0x115)+_0x29bf6a[_0x307ce2(0xfc)]+'.\x0a');}}function buildFilePath(_0x313efd,_0x295564,_0x3cf281,_0x16cb79){const _0x1f354a=a37_0x552261;if(_0x295564==='HOOK'){if(!_0x16cb79)throw CliErrors[_0x1f354a(0xa9)](_0x1f354a(0xdc));const _0x456bed=_0x16cb79[_0x1f354a(0xdf)]??_0x16cb79[_0x1f354a(0xb7)];return join(_0x313efd[_0x1f354a(0xf3)],_0x1f354a(0xf9),_0x456bed,_0x16cb79[_0x1f354a(0xc2)],_0x16cb79['functionNode'],_0x3cf281+_0x1f354a(0xb2));}return join(_0x313efd[_0x1f354a(0xf3)],_0x295564,_0x3cf281+_0x1f354a(0xb2));}export function generateTemplate(_0x414bd0,_0x32e863,_0x483eb1,_0x1c58bd,_0x35fbd4){const _0x3269b0=a37_0x552261,_0x2d8283=_0x1c58bd?.[_0x3269b0(0xdb)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x47695f=getAppBaseUrl(_0x483eb1),_0xd6c767=_0x3269b0(0xeb);if(_0x414bd0==='COMMON')return _0x3269b0(0xd5)+_0x2d8283+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x32e863+_0x3269b0(0xe2)+_0x47695f+_0x3269b0(0x100)+_0x483eb1+'/COMMON/'+_0x32e863+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x32e863+_0x3269b0(0xba)+_0xd6c767+_0x3269b0(0xef)+_0x32e863+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x414bd0===_0x3269b0(0x106))return _0x3269b0(0xd5)+_0x2d8283+_0x3269b0(0xcf)+_0x32e863+_0x3269b0(0x110)+_0x483eb1+'/'+_0x32e863+_0x3269b0(0xe2)+_0x47695f+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x483eb1+_0x3269b0(0x10e)+_0x32e863+_0x3269b0(0xf2)+_0xd6c767+_0x3269b0(0xc0)+_0x32e863+_0x3269b0(0xbd);if(!_0x35fbd4)throw CliErrors[_0x3269b0(0xa9)](_0x3269b0(0xab));const _0xdc5b97=_0x35fbd4[_0x3269b0(0xdf)]??_0x35fbd4[_0x3269b0(0xb7)],_0x5d9d1a=_0x35fbd4[_0x3269b0(0x10a)]===_0x3269b0(0xbb)?_0x3269b0(0xe1):_0x3269b0(0xea),_0xeba16=_0x35fbd4[_0x3269b0(0x10a)]===_0x3269b0(0xbb)?_0x3269b0(0xf6):_0x3269b0(0x114);return _0x3269b0(0xd5)+_0x2d8283+_0x3269b0(0xd8)+_0x32e863+_0x3269b0(0x10f)+_0x483eb1+'/'+_0x35fbd4[_0x3269b0(0xb7)]+'/'+_0x35fbd4[_0x3269b0(0xc2)]+_0x3269b0(0xe2)+_0x47695f+_0x3269b0(0xa8)+_0x35fbd4['datasetId']+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x483eb1+'/HOOK/'+_0xdc5b97+'/'+_0x35fbd4['operationType']+'/'+_0x35fbd4[_0x3269b0(0x10a)]+'/'+_0x32e863+'.js\x0a\x20*\x20[触发节点]\x20'+_0x35fbd4['functionNode']+'\x0a'+_0xd6c767+_0x3269b0(0xd0)+_0x5d9d1a+_0x3269b0(0xc8)+_0xeba16+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x32e863+_0x3269b0(0xbd);}
|
|
1
|
+
const a37_0x502755=a37_0x562d;(function(_0x5148a0,_0x299638){const _0x5e6378=a37_0x562d,_0x1a5b64=_0x5148a0();while(!![]){try{const _0x45c2c7=parseInt(_0x5e6378(0x188))/0x1*(-parseInt(_0x5e6378(0x181))/0x2)+-parseInt(_0x5e6378(0x1d3))/0x3*(parseInt(_0x5e6378(0x182))/0x4)+-parseInt(_0x5e6378(0x1e9))/0x5+-parseInt(_0x5e6378(0x1c2))/0x6*(-parseInt(_0x5e6378(0x1ba))/0x7)+parseInt(_0x5e6378(0x186))/0x8+parseInt(_0x5e6378(0x1e0))/0x9+parseInt(_0x5e6378(0x1df))/0xa;if(_0x45c2c7===_0x299638)break;else _0x1a5b64['push'](_0x1a5b64['shift']());}catch(_0x25c54){_0x1a5b64['push'](_0x1a5b64['shift']());}}}(a37_0x28ac,0x543e6));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x28ac(){const _0x42ba92=['Invalid\x20function\x20name\x20\x22','当前请求参数','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','4309470Xulqba','5427099inObNj','HOOK\x20requires\x20alias/operation/node\x20options.','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','Dataset\x20not\x20found\x20for\x20code\x20\x22','\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','filePath','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','UNKNOWN','2093535nnctrd','join','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','/COMMON/','修改后的响应结果','\x22\x20not\x20found.\x20','18CEzlTt','29408ZhBqvC','当前响应结果','write','selectedAppName','3311656RbNmCs','\x22\x20not\x20found\x20for\x20dataset\x20','59498fidQbo','code','stdin','source','appCode','tableName','\x0a\x20*\x20[平台配置]\x20','before','map','No\x20operation\x20types\x20found\x20for\x20dataset\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','Script\x20description','defaultApp','Available:\x20','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','No\x20model\x20aliases\x20found.\x20Run\x20`','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','/ENDPOINT/','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','length','utf8','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','currentApp','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','keys','mergedCli','find','nonInteractive','alias','stderr','Operation\x20type\x20\x22','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','description','validation','File\x20already\x20exists:\x20','operation-type','Select\x20operation\x20type:','Script\x20type','\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','includes','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','create','HOOK','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','\x20api\x20pull`\x20to\x20refresh.','entries','.js','112fhxVGH','scriptsRootDir','function-node','/data/dataset/','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','str','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','/**\x0a\x20*\x20','18690HHXHDK','string','read','parseInt','datasetId','修改后的请求参数','functionNode','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Created\x20','apiDir','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','.js\x0a','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','name','Select\x20dataset:','Select\x20trigger\x20node:','Operation\x20type\x20(HOOK\x20only)','81UrOhUe','profileName','/HOOK/','COMMON','close','datasetCode','trim','operationType','after'];a37_0x28ac=function(){return _0x42ba92;};return a37_0x28ac();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x562d(_0x5c35c7,_0x4169fe){_0x5c35c7=_0x5c35c7-0x17d;const _0x28ac3d=a37_0x28ac();let _0x562d73=_0x28ac3d[_0x5c35c7];return _0x562d73;}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a37_0x502755(0x1b3),'description':a37_0x502755(0x1e7),'risk':a37_0x502755(0x1c4),'flags':[{'name':'type','type':a37_0x502755(0x1c3),'required':!![],'enum':[a37_0x502755(0x1d6),'ENDPOINT',a37_0x502755(0x1b4)],'description':a37_0x502755(0x1af)},{'name':a37_0x502755(0x1cf),'type':a37_0x502755(0x1c3),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x502755(0x1aa),'type':a37_0x502755(0x1c3),'description':a37_0x502755(0x194)},{'name':a37_0x502755(0x1a6),'type':'string','description':a37_0x502755(0x1ce)},{'name':a37_0x502755(0x1e5),'type':a37_0x502755(0x1c3),'description':a37_0x502755(0x1b5)},{'name':a37_0x502755(0x1ad),'type':a37_0x502755(0x1c3),'description':a37_0x502755(0x1d2)},{'name':a37_0x502755(0x1bc),'type':a37_0x502755(0x1c3),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a37_0x502755(0x18f),a37_0x502755(0x1db)]}],async 'validate'(_0x4331be){const _0x5728b3=a37_0x502755,_0x1b5f9e=_0x4331be[_0x5728b3(0x1bf)](_0x5728b3(0x1cf));if(!isValidBffFunctionName(_0x1b5f9e))throw CliErrors[_0x5728b3(0x1ab)](_0x5728b3(0x1dc)+_0x1b5f9e+_0x5728b3(0x1b6));},async 'execute'(_0x2bda03){const _0x5b389f=a37_0x502755,_0x10a668=loadBffProjectConfig(_0x2bda03[_0x5b389f(0x18c)]),_0x3beca5=_0x2bda03[_0x5b389f(0x1bf)]('type'),_0xeff969=_0x2bda03['str']('name'),_0x2ddc07=_0x2bda03[_0x5b389f(0x1bf)](_0x5b389f(0x1aa))||undefined,_0x49d44b=_0x3beca5==='HOOK'?await resolveHookOptions(_0x10a668,_0x2bda03):undefined,_0x5b8738=buildFilePath(_0x10a668,_0x3beca5,_0xeff969,_0x49d44b);if(await fileExists(_0x5b8738))throw CliErrors['validation'](_0x5b389f(0x1ac)+_0x5b8738);await mkdir(dirname(_0x5b8738),{'recursive':!![]});const _0x1dcf30=generateTemplate(_0x3beca5,_0xeff969,_0x2bda03['appCode'],_0x2ddc07,_0x49d44b);await writeFile(_0x5b8738,_0x1dcf30,_0x5b389f(0x19d));const _0x20d024={'type':_0x3beca5,'name':_0xeff969,'path':_0x5b8738};if(_0x2ddc07)_0x20d024[_0x5b389f(0x1aa)]=_0x2ddc07;if(_0x49d44b){if(_0x49d44b[_0x5b389f(0x1a6)])_0x20d024['alias']=_0x49d44b['alias'];_0x20d024['datasetCode']=_0x49d44b['datasetCode'],_0x20d024[_0x5b389f(0x1da)]=_0x49d44b[_0x5b389f(0x1da)],_0x20d024[_0x5b389f(0x1c8)]=_0x49d44b[_0x5b389f(0x1c8)];}return{'ok':!![],'data':_0x20d024,'message':_0x5b389f(0x1ca)+_0x3beca5+'\x20function:\x20'+_0xeff969};}};async function resolveHookOptions(_0x168b85,_0x375bcf){const _0x45706d=a37_0x502755,_0x4ac109=resolveApiModelSource(_0x375bcf[_0x45706d(0x1cb)],_0x375bcf[_0x45706d(0x18c)],_0x375bcf[_0x45706d(0x185)]||_0x375bcf[_0x45706d(0x1a3)]?.[_0x45706d(0x1a0)]||_0x375bcf[_0x45706d(0x1a3)]?.[_0x45706d(0x195)]),_0x5a86b8=loadAliasMap(_0x375bcf[_0x45706d(0x1cb)],undefined,_0x4ac109[_0x45706d(0x1e6)],_0x4ac109[_0x45706d(0x1d4)]),_0x2bb3f7=_0x5a86b8[_0x45706d(0x19c)]>0x0;let _0x1941aa,_0x19bd73,_0x119777;const _0x8bfe1e=_0x375bcf[_0x45706d(0x1bf)](_0x45706d(0x1a6)),_0x775bd8=_0x375bcf[_0x45706d(0x1bf)]('datasetcode');if(_0x8bfe1e){const _0x2fd3cf=resolveAlias(_0x375bcf['apiDir'],_0x8bfe1e,undefined,_0x4ac109['filePath'],_0x4ac109[_0x45706d(0x1d4)]);if(!_0x2fd3cf){const _0x23e4d7=_0x2bb3f7?'Available\x20aliases:\x20'+_0x5a86b8['map'](_0x3144e6=>_0x3144e6[_0x45706d(0x1a6)])[_0x45706d(0x1ea)](',\x20'):_0x45706d(0x198)+CLI_BIN_NAME+_0x45706d(0x192);throw CliErrors[_0x45706d(0x1ab)]('Alias\x20\x22'+_0x8bfe1e+_0x45706d(0x180)+_0x23e4d7);}_0x1941aa=_0x8bfe1e,_0x19bd73=_0x2fd3cf;}else{if(_0x775bd8){_0x19bd73=_0x775bd8;const _0xa9493d=_0x5a86b8['find'](_0x2f066b=>_0x2f066b[_0x45706d(0x1d8)]===_0x775bd8);_0x1941aa=_0xa9493d?.[_0x45706d(0x1a6)];}else{if(_0x375bcf[_0x45706d(0x1a5)])throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1a1));else{if(_0x2bb3f7){const _0x3fbd64=_0x5a86b8[_0x45706d(0x190)](_0x140cb5=>_0x140cb5[_0x45706d(0x1a6)]+'\x20('+_0x140cb5[_0x45706d(0x18d)]+')'),_0x2c6cdb=await promptSelect('Select\x20dataset:',_0x3fbd64),_0x27cae4=_0x5a86b8[_0x2c6cdb];if(!_0x27cae4)throw CliErrors[_0x45706d(0x1ab)]('Invalid\x20dataset\x20selection.');_0x1941aa=_0x27cae4[_0x45706d(0x1a6)],_0x19bd73=_0x27cae4['datasetCode'];}else{const _0x3a8ba8=await listDatasets(_0x375bcf[_0x45706d(0x18c)]);if(_0x3a8ba8[_0x45706d(0x19c)]===0x0)throw CliErrors[_0x45706d(0x1ab)]('No\x20datasets\x20found\x20for\x20this\x20app.');const _0x14380c=_0x3a8ba8[_0x45706d(0x190)](_0x1659bd=>_0x1659bd[_0x45706d(0x1cf)]+'\x20['+(_0x1659bd[_0x45706d(0x18b)]??_0x45706d(0x1e8))+']\x20('+_0x1659bd[_0x45706d(0x189)]+')'),_0x2cacba=await promptSelect(_0x45706d(0x1d0),_0x14380c),_0x2822b5=_0x3a8ba8[_0x2cacba];if(!_0x2822b5)throw CliErrors[_0x45706d(0x1ab)]('Invalid\x20dataset\x20selection.');_0x19bd73=_0x2822b5[_0x45706d(0x189)],_0x1941aa=undefined;}}}}const _0x4ee9c7=await listDatasets(_0x375bcf['appCode']),_0x53d88f=_0x4ee9c7[_0x45706d(0x1a4)](_0x4772fd=>_0x4772fd['code']===_0x19bd73);if(!_0x53d88f)throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1e3)+_0x19bd73+'\x22.\x20'+(_0x1941aa?_0x45706d(0x193)+CLI_BIN_NAME+_0x45706d(0x1b7):''));_0x119777=_0x53d88f['id'];const _0x2c1625=_0x1941aa??_0x19bd73,_0x5ebf90=await listBffDatasetOperations(_0x375bcf['appCode'],_0x119777),_0xc8d19f=_0x5ebf90?Object[_0x45706d(0x1a2)](_0x5ebf90):[];if(_0xc8d19f[_0x45706d(0x19c)]===0x0)throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x191)+_0x2c1625+'.');let _0x2929e3;const _0x45c9cc=_0x375bcf[_0x45706d(0x1bf)](_0x45706d(0x1ad));if(_0x45c9cc){if(!_0xc8d19f[_0x45706d(0x1b1)](_0x45c9cc))throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1a8)+_0x45c9cc+_0x45706d(0x187)+_0x2c1625+'.\x20'+(_0x45706d(0x196)+_0xc8d19f[_0x45706d(0x1ea)](',\x20')));_0x2929e3=_0x45c9cc;}else{if(_0x375bcf[_0x45706d(0x1a5)])throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x17d));const _0x519025=await promptSelect(_0x45706d(0x1ae),_0xc8d19f);_0x2929e3=_0xc8d19f[_0x519025]??_0xc8d19f[0x0];}let _0x5ad76c=normalizeHookFunctionNode(_0x375bcf[_0x45706d(0x1bf)]('function-node'));if(!_0x5ad76c){if(_0x375bcf['str'](_0x45706d(0x1bc)))throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x197));if(_0x375bcf['nonInteractive'])throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1c9));const _0x4953ff=await promptSelect(_0x45706d(0x1d1),[_0x45706d(0x18f),'after']);_0x5ad76c=['before',_0x45706d(0x1db)][_0x4953ff]??_0x45706d(0x18f);}return{'alias':_0x1941aa,'datasetCode':_0x19bd73,'datasetId':_0x119777,'operationType':_0x2929e3,'functionNode':_0x5ad76c};}async function promptSelect(_0x49035f,_0x3b95fa){const _0x3fcb80=a37_0x502755;if(_0x3b95fa[_0x3fcb80(0x19c)]===0x1)return 0x0;for(const [_0x2ff909,_0x12c61e]of _0x3b95fa[_0x3fcb80(0x1b8)]()){process[_0x3fcb80(0x1a7)][_0x3fcb80(0x184)]('\x20\x20'+(_0x2ff909+0x1)+'.\x20'+_0x12c61e+'\x0a');}const _0x3ddbde=createInterface({'input':process[_0x3fcb80(0x18a)],'output':process[_0x3fcb80(0x1a7)]});while(!![]){const _0x3d079c=await new Promise(_0x1d7a16=>{_0x3ddbde['question'](_0x49035f+'\x20',_0x1d7a16);}),_0x346315=Number[_0x3fcb80(0x1c5)](_0x3d079c[_0x3fcb80(0x1d9)](),0xa);if(Number['isInteger'](_0x346315)&&_0x346315>=0x1&&_0x346315<=_0x3b95fa[_0x3fcb80(0x19c)])return _0x3ddbde[_0x3fcb80(0x1d7)](),_0x346315-0x1;process[_0x3fcb80(0x1a7)]['write'](_0x3fcb80(0x1cc)+_0x3b95fa[_0x3fcb80(0x19c)]+'.\x0a');}}function buildFilePath(_0x5d65cd,_0x3028d1,_0x382073,_0xcce540){const _0x465ddd=a37_0x502755;if(_0x3028d1===_0x465ddd(0x1b4)){if(!_0xcce540)throw CliErrors[_0x465ddd(0x1ab)](_0x465ddd(0x1e1));const _0x5eaf02=_0xcce540[_0x465ddd(0x1a6)]??_0xcce540['datasetCode'];return join(_0x5d65cd['scriptsRootDir'],'HOOK',_0x5eaf02,_0xcce540[_0x465ddd(0x1da)],_0xcce540[_0x465ddd(0x1c8)],_0x382073+_0x465ddd(0x1b9));}return join(_0x5d65cd[_0x465ddd(0x1bb)],_0x3028d1,_0x382073+'.js');}export function generateTemplate(_0x934b2d,_0x34aab0,_0x38a2ae,_0x2922ca,_0x30cab8){const _0x2b25b6=a37_0x502755,_0x345e44=_0x2922ca?.[_0x2b25b6(0x1d9)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x4c4cfc=getAppBaseUrl(_0x38a2ae),_0x3b986a=_0x2b25b6(0x19b);if(_0x934b2d===_0x2b25b6(0x1d6))return'/**\x0a\x20*\x20'+_0x345e44+_0x2b25b6(0x19e)+_0x34aab0+_0x2b25b6(0x18e)+_0x4c4cfc+_0x2b25b6(0x19f)+_0x38a2ae+_0x2b25b6(0x17e)+_0x34aab0+_0x2b25b6(0x1be)+_0x34aab0+'\x22,\x20params\x20})\x0a'+_0x3b986a+_0x2b25b6(0x1e4)+_0x34aab0+_0x2b25b6(0x1b2);if(_0x934b2d==='ENDPOINT')return'/**\x0a\x20*\x20'+_0x345e44+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x34aab0+_0x2b25b6(0x1a9)+_0x38a2ae+'/'+_0x34aab0+_0x2b25b6(0x18e)+_0x4c4cfc+_0x2b25b6(0x19f)+_0x38a2ae+_0x2b25b6(0x19a)+_0x34aab0+_0x2b25b6(0x1cd)+_0x3b986a+_0x2b25b6(0x1b0)+_0x34aab0+_0x2b25b6(0x1b2);if(!_0x30cab8)throw CliErrors[_0x2b25b6(0x1ab)](_0x2b25b6(0x1e2));const _0x508e72=_0x30cab8[_0x2b25b6(0x1a6)]??_0x30cab8[_0x2b25b6(0x1d8)],_0x3a12f6=_0x30cab8[_0x2b25b6(0x1c8)]===_0x2b25b6(0x18f)?_0x2b25b6(0x1dd):_0x2b25b6(0x183),_0x312b8d=_0x30cab8[_0x2b25b6(0x1c8)]==='before'?_0x2b25b6(0x1c7):_0x2b25b6(0x17f);return _0x2b25b6(0x1c1)+_0x345e44+_0x2b25b6(0x1de)+_0x34aab0+_0x2b25b6(0x1c0)+_0x38a2ae+'/'+_0x30cab8[_0x2b25b6(0x1d8)]+'/'+_0x30cab8['operationType']+'\x0a\x20*\x20[平台配置]\x20'+_0x4c4cfc+_0x2b25b6(0x1bd)+_0x30cab8[_0x2b25b6(0x1c6)]+_0x2b25b6(0x1eb)+_0x38a2ae+_0x2b25b6(0x1d5)+_0x508e72+'/'+_0x30cab8[_0x2b25b6(0x1da)]+'/'+_0x30cab8[_0x2b25b6(0x1c8)]+'/'+_0x34aab0+'.js\x0a\x20*\x20[触发节点]\x20'+_0x30cab8['functionNode']+'\x0a'+_0x3b986a+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x3a12f6+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x312b8d+_0x2b25b6(0x199)+_0x34aab0+_0x2b25b6(0x1b2);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a38_0x44a9(_0x2150d4,_0x3c0c85){_0x2150d4=_0x2150d4-0x17e;const _0x274662=a38_0x2746();let _0x44a96e=_0x274662[_0x2150d4];return _0x44a96e;}const a38_0x5ed038=a38_0x44a9;(function(_0x200587,_0xf8fcfa){const _0x53fe49=a38_0x44a9,_0x84d95a=_0x200587();while(!![]){try{const _0x4862f3=-parseInt(_0x53fe49(0x191))/0x1+-parseInt(_0x53fe49(0x1a5))/0x2+parseInt(_0x53fe49(0x1a7))/0x3+-parseInt(_0x53fe49(0x194))/0x4+-parseInt(_0x53fe49(0x181))/0x5+-parseInt(_0x53fe49(0x183))/0x6+-parseInt(_0x53fe49(0x18a))/0x7*(-parseInt(_0x53fe49(0x189))/0x8);if(_0x4862f3===_0xf8fcfa)break;else _0x84d95a['push'](_0x84d95a['shift']());}catch(_0x3dbbe2){_0x84d95a['push'](_0x84d95a['shift']());}}}(a38_0x2746,0x297fb));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';function a38_0x2746(){const _0x2d4b5b=['projectRoot','appCode','split','Deleted\x20','1422880iQfnOh','Function\x20not\x20found:\x20','429366AMOKnB','/api/management/library/scripts/delete','apps','includes','map','length','248xwrvIe','182861SuNPIe','Local\x20delete\x20not\x20settled\x20for\x20','Would\x20delete\x20','remoteId','join','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','lockFilePath','138182vAZowu','\x20\x20-\x20','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','977500nuDhSj','Backend\x20Function\x20lock\x20file\x20not\x20found.','find','str','high-risk-write','parse','<timestamp>','string','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','replace','stringify','Multiple\x20functions\x20match\x20\x22','Lock\x20scope\x20for\x20app\x20\x22','toISOString','trashDir','validation','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','93666RcwoIz','keys','437079YoPclF','functions','trashedTo','delete','scriptsRootDir','POST','scriptsRoot','target','No\x20lock\x20entry\x20found\x20for\x20\x22'];a38_0x2746=function(){return _0x2d4b5b;};return a38_0x2746();}export const bffDelete={'service':'bff','command':'delete','description':a38_0x5ed038(0x193),'risk':a38_0x5ed038(0x198),'flags':[{'name':a38_0x5ed038(0x1ae),'type':a38_0x5ed038(0x19b),'required':!![],'description':a38_0x5ed038(0x1a4)}],async 'validate'(_0x47aedc){const _0x20802d=a38_0x5ed038,_0xf4188a=loadBffProjectConfig(_0x47aedc[_0x20802d(0x17e)]),_0x22e6a6=await readBffLockFile(_0xf4188a[_0x20802d(0x190)]);if(!_0x22e6a6)throw CliErrors[_0x20802d(0x1a3)]('Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.');},async 'dryRun'(_0x2eeb0e){const _0x78aac4=a38_0x5ed038,_0x4ac444=loadBffProjectConfig(_0x2eeb0e[_0x78aac4(0x17e)]),_0x36fbb5=await readBffLockFile(_0x4ac444[_0x78aac4(0x190)]);if(!_0x36fbb5)throw CliErrors[_0x78aac4(0x1a3)](_0x78aac4(0x195));const {appLock:_0x2f8d35}=ensureLockScope(_0x36fbb5,_0x2eeb0e['appCode'],_0x4ac444[_0x78aac4(0x1ad)],_0x78aac4(0x1aa)),_0x318f00=_0x2eeb0e['str'](_0x78aac4(0x1ae)),_0x3c0254=Object[_0x78aac4(0x1a6)](_0x2f8d35['functions']),_0x2d71d5=resolveDeleteTarget(_0x318f00,_0x3c0254),_0x5713f1=_0x2f8d35[_0x78aac4(0x1a8)][_0x2d71d5];if(!_0x5713f1)throw CliErrors['validation'](_0x78aac4(0x1af)+_0x2d71d5+'\x22.');const _0xf778f5=resolveLocalFilePathFromLockKey(_0x4ac444,_0x2d71d5),_0x3b562c=relative(_0x4ac444[_0x78aac4(0x1b0)],_0xf778f5),_0x15b222=join(_0x4ac444['trashDir'],_0x78aac4(0x19a),_0x3b562c);return{'method':_0x78aac4(0x1ac),'url':_0x78aac4(0x184),'body':{'appCode':_0x2eeb0e[_0x78aac4(0x17e)],'target':_0x2d71d5,'remoteId':_0x5713f1[_0x78aac4(0x18d)],'localFilePath':_0xf778f5,'trashedPath':_0x15b222},'description':_0x78aac4(0x18c)+_0x2d71d5+_0x78aac4(0x18f)};},async 'execute'(_0x291523){const _0x5c8ff1=a38_0x5ed038,_0x47198e=loadBffProjectConfig(_0x291523[_0x5c8ff1(0x17e)]),_0x2364e3=await readBffLockFile(_0x47198e[_0x5c8ff1(0x190)]);if(!_0x2364e3)throw CliErrors['validation'](_0x5c8ff1(0x195));const {lockData:_0xb15af4,appLock:_0x1cb2dd}=ensureLockScope(_0x2364e3,_0x291523[_0x5c8ff1(0x17e)],_0x47198e[_0x5c8ff1(0x1ad)],_0x5c8ff1(0x1aa)),_0x140f22=JSON[_0x5c8ff1(0x199)](JSON[_0x5c8ff1(0x19e)](_0xb15af4)),_0x355815=_0x140f22[_0x5c8ff1(0x185)][_0x291523['appCode']];if(!_0x355815)throw new Error(_0x5c8ff1(0x1a0)+_0x291523[_0x5c8ff1(0x17e)]+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x36c6b0=_0x291523[_0x5c8ff1(0x197)](_0x5c8ff1(0x1ae)),_0x12f766=Object[_0x5c8ff1(0x1a6)](_0x355815[_0x5c8ff1(0x1a8)]),_0x59ab65=resolveDeleteTarget(_0x36c6b0,_0x12f766),_0xa7596=_0x355815['functions'][_0x59ab65];if(!_0xa7596)throw CliErrors['validation'](_0x5c8ff1(0x1af)+_0x59ab65+'\x22.');await deleteBffScript(_0xa7596[_0x5c8ff1(0x18d)]),delete _0x355815[_0x5c8ff1(0x1a8)][_0x59ab65],_0x355815['lastSync']=new Date()[_0x5c8ff1(0x1a1)](),await writeBffLockFile(_0x47198e[_0x5c8ff1(0x190)],_0x140f22);const _0x11fa03=resolveLocalFilePathFromLockKey(_0x47198e,_0x59ab65);let _0x222de4;await fileExists(_0x11fa03)&&(_0x222de4=await moveToTrash(_0x47198e[_0x5c8ff1(0x1b0)],_0x47198e[_0x5c8ff1(0x1a2)],_0x11fa03),await cleanupEmptyDirectories(dirname(_0x11fa03),_0x47198e[_0x5c8ff1(0x1ab)]));await waitForDeleteSettlement(_0x47198e[_0x5c8ff1(0x190)],_0x291523[_0x5c8ff1(0x17e)],_0x59ab65,_0x11fa03),await sleep(0x96);const _0x15a0bc={'deleted':_0x59ab65,'remoteId':_0xa7596[_0x5c8ff1(0x18d)]};if(_0x222de4)_0x15a0bc[_0x5c8ff1(0x1a9)]=_0x222de4;return{'ok':!![],'data':_0x15a0bc,'message':_0x5c8ff1(0x180)+_0x59ab65+(_0x222de4?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x9b6f75,_0x37ae98){const _0x3b4346=a38_0x5ed038;if(_0x9b6f75[_0x3b4346(0x186)]('/')){const _0x726711=_0x37ae98[_0x3b4346(0x196)](_0x3778c4=>_0x3778c4===_0x9b6f75);if(!_0x726711)throw CliErrors[_0x3b4346(0x1a3)](_0x3b4346(0x182)+_0x9b6f75);return _0x726711;}const _0x4404c5=_0x37ae98['filter'](_0x9f617f=>_0x9f617f[_0x3b4346(0x17f)]('/')['at'](-0x1)===_0x9b6f75);if(_0x4404c5['length']===0x0)throw CliErrors[_0x3b4346(0x1a3)]('Function\x20not\x20found:\x20'+_0x9b6f75);if(_0x4404c5[_0x3b4346(0x188)]>0x1)throw CliErrors[_0x3b4346(0x1a3)](_0x3b4346(0x19f)+_0x9b6f75+_0x3b4346(0x19c)+_0x4404c5[_0x3b4346(0x187)](_0x39f589=>_0x3b4346(0x192)+_0x39f589)[_0x3b4346(0x18e)]('\x0a'));return _0x4404c5[0x0];}async function moveToTrash(_0x8674d5,_0xd7f326,_0x43d116){const _0x17ffe6=a38_0x5ed038,_0x531406=new Date()[_0x17ffe6(0x1a1)]()[_0x17ffe6(0x19d)](/[:.]/g,'-'),_0x5deeff=relative(_0x8674d5,_0x43d116),_0x4841d5=join(_0xd7f326,_0x531406,_0x5deeff);return await mkdir(dirname(_0x4841d5),{'recursive':!![]}),await rename(_0x43d116,_0x4841d5),_0x4841d5;}async function cleanupEmptyDirectories(_0x1437f0,_0x5f738){const _0x2a5187=a38_0x5ed038;let _0x184774=resolve(_0x1437f0);const _0x5371e7=resolve(_0x5f738);while(_0x184774['startsWith'](''+_0x5371e7+sep)||_0x184774===_0x5371e7){if(_0x184774===_0x5371e7)return;try{const _0x1466e9=await readdir(_0x184774);if(_0x1466e9[_0x2a5187(0x188)]>0x0)return;await rmdir(_0x184774);}catch{return;}_0x184774=dirname(_0x184774);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x6e4ddd,_0x50f434,_0x340c5c,_0x54aaf4){const _0x170fad=a38_0x5ed038;for(let _0x19694f=0x0;_0x19694f<DELETE_SETTLE_RETRY_COUNT;_0x19694f+=0x1){const _0x3ec082=await readBffLockFile(_0x6e4ddd),_0x5ee74a=!!_0x3ec082?.[_0x170fad(0x185)]?.[_0x50f434]?.[_0x170fad(0x1a8)]?.[_0x340c5c],_0x4887e2=await fileExists(_0x54aaf4);if(!_0x5ee74a&&!_0x4887e2)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x170fad(0x18b)+_0x340c5c+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x49c111=a39_0x1d32;function a39_0x2159(){const _0x30a1d3=['2289528VJNUQG','description','num','scriptType','(none)','appCode','20Eqpdds','detail','50dBkpef','verbose','101559zXfkCE','8038112CEbrQW','553578SsoyKN','version','functionName','createdTime','bool','954673uOqVdY','bff','4250064lJyKMa','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','Script\x20ID','number','updatedTime','257236gpQBEr','scriptContent'];a39_0x2159=function(){return _0x30a1d3;};return a39_0x2159();}(function(_0x54bfd5,_0x76f7f9){const _0x1c6c82=a39_0x1d32,_0x494046=_0x54bfd5();while(!![]){try{const _0x60e39f=parseInt(_0x1c6c82(0x1f0))/0x1+-parseInt(_0x1c6c82(0x1f7))/0x2+parseInt(_0x1c6c82(0x1e9))/0x3*(parseInt(_0x1c6c82(0x1e5))/0x4)+-parseInt(_0x1c6c82(0x1e7))/0x5*(-parseInt(_0x1c6c82(0x1eb))/0x6)+-parseInt(_0x1c6c82(0x1f2))/0x7+-parseInt(_0x1c6c82(0x1ea))/0x8+parseInt(_0x1c6c82(0x1f9))/0x9;if(_0x60e39f===_0x76f7f9)break;else _0x494046['push'](_0x494046['shift']());}catch(_0x52f15c){_0x494046['push'](_0x494046['shift']());}}}(a39_0x2159,0x88d2a));function a39_0x1d32(_0x38765e,_0x36dc2c){_0x38765e=_0x38765e-0x1e2;const _0x21592f=a39_0x2159();let _0x1d3250=_0x21592f[_0x38765e];return _0x1d3250;}import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a39_0x49c111(0x1f1),'command':a39_0x49c111(0x1e6),'description':a39_0x49c111(0x1f3),'risk':'read','flags':[{'name':'id','type':a39_0x49c111(0x1f5),'required':!![],'description':a39_0x49c111(0x1f4)},{'name':a39_0x49c111(0x1e8),'type':'boolean','description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x3ab758){const _0xd1bb9b=a39_0x49c111,_0x38a199=await getBffScriptInfo(_0x3ab758[_0xd1bb9b(0x1fb)]('id')),_0x30dd0d=_0x3ab758[_0xd1bb9b(0x1ef)]('verbose');if(_0x30dd0d)return{'ok':!![],'data':_0x38a199};return{'ok':!![],'data':{'id':_0x38a199['id'],'functionName':_0x38a199[_0xd1bb9b(0x1ed)]??'','version':_0x38a199[_0xd1bb9b(0x1ec)]??'','updateUserName':_0x38a199['updateUserName']??'','appCode':_0x38a199[_0xd1bb9b(0x1e4)],'scriptType':_0x38a199[_0xd1bb9b(0x1e2)],'description':_0x38a199[_0xd1bb9b(0x1fa)]||_0xd1bb9b(0x1e3),'createdTime':_0x38a199[_0xd1bb9b(0x1ee)]??'','updatedTime':_0x38a199[_0xd1bb9b(0x1f6)]??'','scriptContent':_0x38a199[_0xd1bb9b(0x1f8)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xd826,_0x4faa9b){const _0xfdcec3=a40_0x1738,_0x5a5d20=_0xd826();while(!![]){try{const _0x40e84e=-parseInt(_0xfdcec3(0x17a))/0x1+-parseInt(_0xfdcec3(0x178))/0x2+-parseInt(_0xfdcec3(0x172))/0x3*(parseInt(_0xfdcec3(0x177))/0x4)+parseInt(_0xfdcec3(0x179))/0x5+parseInt(_0xfdcec3(0x175))/0x6*(-parseInt(_0xfdcec3(0x171))/0x7)+parseInt(_0xfdcec3(0x173))/0x8*(-parseInt(_0xfdcec3(0x176))/0x9)+parseInt(_0xfdcec3(0x174))/0xa;if(_0x40e84e===_0x4faa9b)break;else _0x5a5d20['push'](_0x5a5d20['shift']());}catch(_0x423b0d){_0x5a5d20['push'](_0x5a5d20['shift']());}}}(a40_0x286b,0x9e005));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';function a40_0x286b(){const _0x2f6c5f=['2699022OxJBFR','33471bfYZKu','1756lVwQno','746520DlnIxJ','2542830TZjzQD','10596PFMIzZ','14FYLjLU','843iUeKUC','184GwsebH','16310330YMecOu'];a40_0x286b=function(){return _0x2f6c5f;};return a40_0x286b();}import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';function a40_0x1738(_0x3b202b,_0x1d3047){_0x3b202b=_0x3b202b-0x171;const _0x286b9b=a40_0x286b();let _0x173816=_0x286b9b[_0x3b202b];return _0x173816;}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
|
-
|
|
1
|
+
const a41_0x8f9ec0=a41_0x39a0;(function(_0x58fa82,_0x54cba3){const _0x351707=a41_0x39a0,_0x3f060c=_0x58fa82();while(!![]){try{const _0x390353=parseInt(_0x351707(0xaa))/0x1*(-parseInt(_0x351707(0xab))/0x2)+-parseInt(_0x351707(0xac))/0x3+-parseInt(_0x351707(0xad))/0x4+-parseInt(_0x351707(0xc2))/0x5*(-parseInt(_0x351707(0xb1))/0x6)+-parseInt(_0x351707(0xbf))/0x7+parseInt(_0x351707(0xae))/0x8*(-parseInt(_0x351707(0xb9))/0x9)+parseInt(_0x351707(0xc6))/0xa*(parseInt(_0x351707(0xc4))/0xb);if(_0x390353===_0x54cba3)break;else _0x3f060c['push'](_0x3f060c['shift']());}catch(_0xeb0e0a){_0x3f060c['push'](_0x3f060c['shift']());}}}(a41_0x3fe4,0xcc50b));function a41_0x39a0(_0xe2412,_0x30ff05){_0xe2412=_0xe2412-0xaa;const _0x3fe4a9=a41_0x3fe4();let _0x39a097=_0x3fe4a9[_0xe2412];return _0x39a097;}function a41_0x3fe4(){const _0x35ecd0=['str','11mQWWBJ','appCode','35371180cTvtET','Filter\x20by\x20script\x20name','bool','75963HhNNBD','32DySJkZ','811113ghUpyD','622932PTUfXc','8HUqFiN','length','verbose','16602yUPDeu','Script\x20type\x20filter','List\x20Backend\x20Function\x20scripts','Return\x20full\x20script\x20objects','boolean','COMMON','string','read','9867618xsJuza','bff','ENDPOINT','description','No\x20Backend\x20Function\x20scripts\x20found.','name','8064973poqhZH','type','scriptType','2150gJYmwt'];a41_0x3fe4=function(){return _0x35ecd0;};return a41_0x3fe4();}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x8f9ec0(0xba),'command':'list','description':a41_0x8f9ec0(0xb3),'risk':a41_0x8f9ec0(0xb8),'flags':[{'name':a41_0x8f9ec0(0xc0),'type':'string','description':a41_0x8f9ec0(0xb2),'default':a41_0x8f9ec0(0xbb),'enum':['ENDPOINT',a41_0x8f9ec0(0xb6)]},{'name':a41_0x8f9ec0(0xbe),'type':a41_0x8f9ec0(0xb7),'description':a41_0x8f9ec0(0xc7)},{'name':a41_0x8f9ec0(0xb0),'type':a41_0x8f9ec0(0xb5),'description':a41_0x8f9ec0(0xb4)}],async 'execute'(_0x46c4f8){const _0x5a40f8=a41_0x8f9ec0,_0x2f4f22=await listBffScripts(_0x46c4f8[_0x5a40f8(0xc5)],_0x46c4f8[_0x5a40f8(0xc3)](_0x5a40f8(0xc0)),{'scriptName':_0x46c4f8[_0x5a40f8(0xc3)](_0x5a40f8(0xbe))||undefined}),_0x3fcbb5=_0x46c4f8[_0x5a40f8(0xc8)](_0x5a40f8(0xb0));return{'ok':!![],'data':_0x3fcbb5?_0x2f4f22:_0x2f4f22['map'](_0x2b74cc=>({'id':_0x2b74cc['id'],'functionName':_0x2b74cc['functionName']??'','description':_0x2b74cc[_0x5a40f8(0xbc)]||'(unnamed)','scriptType':_0x2b74cc[_0x5a40f8(0xc1)]})),'message':_0x2f4f22[_0x5a40f8(0xaf)]===0x0?_0x5a40f8(0xbd):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x1ff863=a42_0x3e8e;(function(_0x3b785c,_0x597812){const _0x22add7=a42_0x3e8e,_0x18bd96=_0x3b785c();while(!![]){try{const _0x41ab6a=-parseInt(_0x22add7(0x107))/0x1*(parseInt(_0x22add7(0xdb))/0x2)+-parseInt(_0x22add7(0xef))/0x3+parseInt(_0x22add7(0x104))/0x4+-parseInt(_0x22add7(0xdd))/0x5*(-parseInt(_0x22add7(0xea))/0x6)+parseInt(_0x22add7(0xe2))/0x7*(-parseInt(_0x22add7(0xfd))/0x8)+parseInt(_0x22add7(0xfc))/0x9*(parseInt(_0x22add7(0xf8))/0xa)+parseInt(_0x22add7(0xf4))/0xb;if(_0x41ab6a===_0x597812)break;else _0x18bd96['push'](_0x18bd96['shift']());}catch(_0x518889){_0x18bd96['push'](_0x18bd96['shift']());}}}(a42_0x4e94,0x3429b));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';function a42_0x3e8e(_0x59baf6,_0x5b6b95){_0x59baf6=_0x59baf6-0xda;const _0x4e94ce=a42_0x4e94();let _0x3e8ee6=_0x4e94ce[_0x59baf6];return _0x3e8ee6;}import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x1ff863(0xe5),a42_0x1ff863(0xff),'WARN',a42_0x1ff863(0xf3)];export function resolveBffLogQuery(_0x20cf5f,_0x5f48fa=Date['now']()){const _0x573d24=a42_0x1ff863,_0x5bf648=_0x20cf5f[_0x573d24(0xe4)]('since'),_0x262b51=_0x20cf5f[_0x573d24(0xe4)](_0x573d24(0xec)),_0xa8bfa=_0x20cf5f['flag'](_0x573d24(0xde));if(_0x5bf648!==undefined&&_0x262b51!==undefined)throw CliErrors[_0x573d24(0xf6)](_0x573d24(0xe1));const _0x4b1386=_0xa8bfa===undefined?_0x5f48fa:readPositiveInteger(_0x20cf5f[_0x573d24(0xf0)]('end-time'),_0x573d24(0xe0)),_0x4a0a4f=_0x262b51===undefined?_0x4b1386-readSinceMinutes(_0x20cf5f)*0xea60:readPositiveInteger(_0x20cf5f[_0x573d24(0xf0)]('start-time'),_0x573d24(0xe3));if(_0x4a0a4f<=0x0)throw CliErrors[_0x573d24(0xf6)](_0x573d24(0xda));if(_0x4a0a4f>_0x4b1386)throw CliErrors[_0x573d24(0xf6)](_0x573d24(0xed));const _0x1f9d63=readPositiveInteger(_0x20cf5f[_0x573d24(0xf0)](_0x573d24(0xfa),DEFAULT_LIMIT),_0x573d24(0xee));if(_0x1f9d63>MAX_LIMIT)throw CliErrors['validation'](_0x573d24(0x102)+MAX_LIMIT+'.');const _0x1454d5=_0x20cf5f['str'](_0x573d24(0x101))['trim']()[_0x573d24(0xe6)]()||undefined,_0x3ee090=_0x20cf5f[_0x573d24(0xdf)](_0x573d24(0xeb))['trim']()||undefined;return{'appCode':_0x20cf5f[_0x573d24(0xfb)],'startTime':_0x4a0a4f,'endTime':_0x4b1386,..._0x262b51===undefined?{'sinceMinutes':readSinceMinutes(_0x20cf5f)}:{},..._0x1454d5?{'level':_0x1454d5}:{},..._0x3ee090?{'keyword':_0x3ee090}:{},'limit':_0x1f9d63};}function readSinceMinutes(_0x5c8f0c){const _0x3e2154=a42_0x1ff863;return readPositiveInteger(_0x5c8f0c['num']('since',DEFAULT_SINCE_MINUTES),_0x3e2154(0x106));}function a42_0x4e94(){const _0x21f78f=['string','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','165956bCzmeb','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','1865vpNnNe','end-time','str','--end-time','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','114163dqKzyX','--start-time','flag','DEBUG','toUpperCase','logs','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','length','6168QLJPdT','keyword','start-time','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','--limit','549783IfbEBr','num','number','Filter\x20by\x20log\x20level','ERROR','2760230qEsPdA','\x20Backend\x20Function\x20log\x20line(s).','validation','\x20must\x20be\x20a\x20positive\x20integer.','10ngcJTT','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','limit','appCode','394029ksJteL','136kWUIPc','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','INFO','read','level','--limit\x20must\x20be\x20between\x201\x20and\x20','since','315984BRvsjz','bff','--since','1GfKLSg'];a42_0x4e94=function(){return _0x21f78f;};return a42_0x4e94();}function readPositiveInteger(_0x5d41b3,_0x28c9bb){const _0x189bb5=a42_0x1ff863;if(!Number['isSafeInteger'](_0x5d41b3)||_0x5d41b3<=0x0)throw CliErrors['validation'](_0x28c9bb+_0x189bb5(0xf7));return _0x5d41b3;}export const bffLogs={'service':a42_0x1ff863(0x105),'command':a42_0x1ff863(0xe7),'description':a42_0x1ff863(0xf9),'risk':a42_0x1ff863(0x100),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x1ff863(0x103),'type':a42_0x1ff863(0xf1),'description':a42_0x1ff863(0xfe)+DEFAULT_SINCE_MINUTES+')'},{'name':'start-time','type':a42_0x1ff863(0xf1),'description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a42_0x1ff863(0xde),'type':'number','description':a42_0x1ff863(0xdc)},{'name':a42_0x1ff863(0x101),'type':a42_0x1ff863(0x108),'description':a42_0x1ff863(0xf2),'enum':LOG_LEVELS},{'name':a42_0x1ff863(0xeb),'type':a42_0x1ff863(0x108),'description':a42_0x1ff863(0xe8)},{'name':a42_0x1ff863(0xfa),'type':a42_0x1ff863(0xf1),'description':'Maximum\x20log\x20lines\x20to\x20return\x20(1-'+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x225833){resolveBffLogQuery(_0x225833);},async 'execute'(_0xf4413c){const _0xf9f31b=a42_0x1ff863,_0x2d4db8=resolveBffLogQuery(_0xf4413c),{sinceMinutes:_0x16ddff,..._0xe0ab71}=_0x2d4db8,_0x166c63=await searchBffScriptLogs(_0xe0ab71);return{'ok':!![],'data':{'query':_0x2d4db8,'count':_0x166c63[_0xf9f31b(0xe9)],'logs':_0x166c63},'message':_0x166c63['length']===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':'Found\x20'+_0x166c63[_0xf9f31b(0xe9)]+_0xf9f31b(0xf5)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x530a46=a43_0x31e3;(function(_0x28bc96,_0x409fc0){const _0x4bee76=a43_0x31e3,_0x3fe388=_0x28bc96();while(!![]){try{const _0x24a748=parseInt(_0x4bee76(0x1d5))/0x1+parseInt(_0x4bee76(0x190))/0x2*(-parseInt(_0x4bee76(0x210))/0x3)+parseInt(_0x4bee76(0x1fe))/0x4*(parseInt(_0x4bee76(0x1c8))/0x5)+-parseInt(_0x4bee76(0x202))/0x6+-parseInt(_0x4bee76(0x219))/0x7*(parseInt(_0x4bee76(0x1f3))/0x8)+-parseInt(_0x4bee76(0x1ac))/0x9+-parseInt(_0x4bee76(0x1f4))/0xa*(-parseInt(_0x4bee76(0x1b2))/0xb);if(_0x24a748===_0x409fc0)break;else _0x3fe388['push'](_0x3fe388['shift']());}catch(_0x1c6288){_0x3fe388['push'](_0x3fe388['shift']());}}}(a43_0x370c,0x2aa8b));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';function a43_0x370c(){const _0x3a788c=['all','nonInteractive','scriptContent','str','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','parse','split','read','datasetCode','close','string','pull','\x20conflict','bool','Failed\x20to\x20write\x20local\x20script\x20\x22','\x20--format\x20compress','map','newDirectory','/api/management/library/scripts/list?appCode=','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','&type=','GET','BFF_LOCAL_UNSYNCED','includes','scriptType','1794708oDzxzu','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','stderr','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','.hook-directory-migrate-','trim','132QEvJvc','length','cancelled','conflict','requires','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Lock\x20scope\x20for\x20app\x20\x22','COMMON','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','sourceDirectoryPathByNewDirectory','projectedFunctions','rekey','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','newLockKey','alias','keyChanges','\x22:\x20its\x20target\x20\x22','scriptsRootDir','\x20pulled','oldDirectory','lockFilePath','1669555uKdbiU','get','toLowerCase','apps','oldDirectoryPath','\x20failed','filePath','bff','mergedCli','ino','lastSync','entry','\x20bff\x20push\x20--type\x20','206525fDdQvG','type','HOOK','question','.js','scriptsRoot','\x20resolution','entries','set','reverse','delete','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','skipped','yes','existed','apiDir','require','case-rename','code','would_pull','ENOENT','some','hookLocation','\x20skipped','mode','lockKey','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','newDirectoryPath','stdin','868304uaOWSl','364020CJNXwu','\x22:\x20','\x22\x20and\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','Remote\x20script\x20missing\x20id.','\x22:\x20both\x20target\x20\x22','Pull\x20only\x20this\x20script\x20type','\x22;\x20temporary\x20directory\x20\x22','dev','4eLNOxo','\x22\x20to\x20\x22','move','unresolvable\x20target\x20path','1542870XVNFmM','selectedAppName','rollback','force','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','defaultApp','push','hash','Force\x20pull\x20cancelled.','profileName','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','currentApp','sourceFilePathByNewLockKey','join','3tNsfBv','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Could\x20not\x20restore\x20local\x20script\x20\x22','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','functions','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','utf8','push_local','\x22\x20from\x20the\x20lock\x20file.','7HGZCaW','\x22\x20may\x20remain.','write','toISOString','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','functionNode','message','oldLockKey','remoteId','validation','appCode','operationType','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','474868TeQETT','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','has'];a43_0x370c=function(){return _0x3a788c;};return a43_0x370c();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x530a46(0x1cf),'command':'pull','description':a43_0x530a46(0x1f7),'risk':a43_0x530a46(0x19a),'structuredErrors':!![],'flags':[{'name':a43_0x530a46(0x1d6),'type':a43_0x530a46(0x19d),'description':a43_0x530a46(0x1fb),'enum':[a43_0x530a46(0x1ba),'ENDPOINT','HOOK']},{'name':a43_0x530a46(0x205),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x136f83){const _0x10fe09=a43_0x530a46,_0x42be3f=loadBffProjectConfig(_0x136f83['appCode']),_0x234183=await readBffLockFile(_0x42be3f['lockFilePath']),{appLock:_0x2bb415}=ensureLockScope(_0x234183??createEmptyBffLock(),_0x136f83[_0x10fe09(0x18d)],_0x42be3f[_0x10fe09(0x1da)],_0x10fe09(0x19e)),_0x2ef955=normalizeBffType(_0x136f83[_0x10fe09(0x196)](_0x10fe09(0x1d6)))??undefined,[_0x3e71e2,_0x1a591a]=await Promise[_0x10fe09(0x193)]([listBffScripts(_0x136f83[_0x10fe09(0x18d)],_0x2ef955),getBffScriptStatistics(_0x136f83['appCode'])]),_0x5761cb=_0x3e71e2[_0x10fe09(0x1eb)](_0x23e470=>normalizeBffType(_0x23e470[_0x10fe09(0x1ab)])===_0x10fe09(0x1d7)),_0x14ee40=_0x5761cb?buildDatasetCodeToAliasMap(_0x136f83[_0x10fe09(0x1e5)],_0x136f83['appCode'],_0x136f83[_0x10fe09(0x203)]||_0x136f83[_0x10fe09(0x1d0)]?.[_0x10fe09(0x20d)]||_0x136f83[_0x10fe09(0x1d0)]?.[_0x10fe09(0x207)]):new Map(),_0x4f7d4e=_0x5761cb?await planHookDirectoryMigration(_0x42be3f,_0x2bb415,_0x14ee40,await scanLocalBffFunctions(_0x42be3f,'HOOK')):undefined,_0x245751=createHookLocationMap(_0x1a591a),_0x35bc0e=[];for(const _0x2ef483 of _0x3e71e2){const _0x23ad7c=resolveRemoteScriptTarget(_0x42be3f,_0x2ef483,_0x245751,_0x4f7d4e?.[_0x10fe09(0x1bd)]??_0x2bb415[_0x10fe09(0x214)],_0x14ee40);if(!_0x23ad7c){_0x35bc0e[_0x10fe09(0x208)]({'scriptType':_0x2ef483['scriptType'],'functionName':_0x2ef483['functionName']??'','status':_0x10fe09(0x1e2),'reason':_0x10fe09(0x201)});continue;}const _0x7e1c4b=(_0x4f7d4e?.['projectedFunctions']??_0x2bb415[_0x10fe09(0x214)])[_0x23ad7c[_0x10fe09(0x1ef)]],_0x33368a=_0x2ef483['scriptContent']!=null?computeContentHash(_0x2ef483['scriptContent']):undefined,_0x8d7c08=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x4f7d4e,_0x23ad7c)??_0x23ad7c[_0x10fe09(0x1ce)],_0x7e1c4b,_0x33368a),_0x570cc2=_0x8d7c08?localUnsyncedConflict(_0x23ad7c,_0x2ef483['id']):undefined;_0x35bc0e[_0x10fe09(0x208)]({'lockKey':_0x23ad7c[_0x10fe09(0x1ef)],'filePath':_0x23ad7c[_0x10fe09(0x1ce)],'remoteId':_0x2ef483['id']??null,'status':_0x570cc2?_0x10fe09(0x1b5):_0x10fe09(0x1e9),..._0x570cc2?{'conflict':_0x570cc2}:{},..._0x23ad7c['hookLocation']?{'alias':_0x23ad7c['hookLocation'][_0x10fe09(0x1c1)]??null,'datasetCode':_0x23ad7c[_0x10fe09(0x1ec)][_0x10fe09(0x19b)],'operationType':_0x23ad7c[_0x10fe09(0x1ec)][_0x10fe09(0x18e)],'functionNode':_0x23ad7c[_0x10fe09(0x1ec)]['functionNode']}:{}});}return{'method':_0x10fe09(0x1a8),'url':_0x10fe09(0x1a5)+_0x136f83['appCode']+(_0x2ef955?_0x10fe09(0x1a7)+_0x2ef955:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x136f83[_0x10fe09(0x18d)],'filterType':_0x2ef955??null,..._0x4f7d4e&&_0x4f7d4e['migrations'][_0x10fe09(0x1b3)]>0x0?{'hookDirectoryMigrations':_0x4f7d4e['migrations'][_0x10fe09(0x1a3)](_0x4fa8e4=>({'from':_0x4fa8e4['oldDirectory'],'to':_0x4fa8e4[_0x10fe09(0x1a4)]}))}:{},'files':_0x35bc0e},'description':'Would\x20inspect\x20'+_0x35bc0e['length']+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x138b30){const _0x1f6d2d=a43_0x530a46,_0x2e9552=loadBffProjectConfig(_0x138b30[_0x1f6d2d(0x18d)]),_0x43d88d=await readBffLockFile(_0x2e9552[_0x1f6d2d(0x1c7)]),{lockData:_0x325b29,appLock:_0x6d4966}=ensureLockScope(_0x43d88d??createEmptyBffLock(),_0x138b30[_0x1f6d2d(0x18d)],_0x2e9552[_0x1f6d2d(0x1da)],_0x1f6d2d(0x19e)),_0x439951=normalizeBffType(_0x138b30[_0x1f6d2d(0x196)](_0x1f6d2d(0x1d6)))??undefined;if(_0x138b30[_0x1f6d2d(0x196)](_0x1f6d2d(0x1d6))&&!_0x439951)throw CliErrors[_0x1f6d2d(0x18c)](_0x1f6d2d(0x1bf));const [_0x50c1f8,_0x580d02]=await Promise['all']([listBffScripts(_0x138b30[_0x1f6d2d(0x18d)],_0x439951),getBffScriptStatistics(_0x138b30[_0x1f6d2d(0x18d)])]);if(_0x50c1f8[_0x1f6d2d(0x1b3)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x2217e3=_0x138b30[_0x1f6d2d(0x1a0)](_0x1f6d2d(0x205));if(_0x2217e3&&!_0x138b30[_0x1f6d2d(0x194)]){const _0x28c82d=await confirmForce();if(!_0x28c82d)throw CliErrors[_0x1f6d2d(0x1b4)](_0x1f6d2d(0x20a));}if(_0x2217e3&&_0x138b30['nonInteractive']){}const _0x48720f=_0x50c1f8[_0x1f6d2d(0x1eb)](_0x53def1=>normalizeBffType(_0x53def1[_0x1f6d2d(0x1ab)])==='HOOK'),_0x115d1d=_0x48720f?buildDatasetCodeToAliasMap(_0x138b30['apiDir'],_0x138b30['appCode'],_0x138b30[_0x1f6d2d(0x203)]||_0x138b30['mergedCli']?.[_0x1f6d2d(0x20d)]||_0x138b30[_0x1f6d2d(0x1d0)]?.[_0x1f6d2d(0x207)]):new Map(),_0x18afd6=createHookLocationMap(_0x580d02),_0x1fe634=JSON[_0x1f6d2d(0x198)](JSON['stringify'](_0x325b29)),_0x22ad9a=_0x138b30[_0x1f6d2d(0x18d)],_0x2c3802=_0x1fe634[_0x1f6d2d(0x1cb)][_0x22ad9a];if(!_0x2c3802)throw new Error(_0x1f6d2d(0x1b9)+_0x22ad9a+_0x1f6d2d(0x1e1));const _0x27c88b=_0x48720f?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x2e9552,_0x2c3802,_0x115d1d,await scanLocalBffFunctions(_0x2e9552,_0x1f6d2d(0x1d7))),_0x2c3802):undefined,_0xb915f2=createPullFileTransaction(),_0x12f0f3=[],_0x49d2f4=[],_0x5e6746=[],_0x2f264f=[];for(const _0x1d4cb6 of _0x50c1f8){const _0x4d08e2=resolveRemoteScriptTarget(_0x2e9552,_0x1d4cb6,_0x18afd6,_0x2c3802[_0x1f6d2d(0x214)],_0x115d1d);if(!_0x4d08e2){_0x49d2f4[_0x1f6d2d(0x208)]({'lockKey':_0x1d4cb6[_0x1f6d2d(0x1ab)]+'/'+_0x1d4cb6['functionName'],'reason':_0x1f6d2d(0x201)});continue;}const _0x2e7eca=_0x2c3802[_0x1f6d2d(0x214)][_0x4d08e2[_0x1f6d2d(0x1ef)]];try{if(!_0x1d4cb6['id'])throw new Error(_0x1f6d2d(0x1f9));if(_0x1d4cb6[_0x1f6d2d(0x195)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x3a6ba9=_0x1d4cb6[_0x1f6d2d(0x195)],_0x432c64=computeContentHash(_0x3a6ba9);if(!_0x2217e3){const _0x194b56=await hasUnsyncedLocalChanges(_0x4d08e2[_0x1f6d2d(0x1ce)],_0x2e7eca,_0x432c64);if(_0x194b56){_0x5e6746['push'](localUnsyncedConflict(_0x4d08e2,_0x1d4cb6['id']));continue;}}await _0xb915f2[_0x1f6d2d(0x185)](_0x4d08e2[_0x1f6d2d(0x1ce)],_0x3a6ba9);const _0x340377={'hash':_0x432c64,'remoteId':_0x1d4cb6['id'],'version':_0x1d4cb6['version']};_0x4d08e2[_0x1f6d2d(0x1d6)]===_0x1f6d2d(0x1d7)&&_0x4d08e2[_0x1f6d2d(0x1ec)]&&(_0x340377[_0x1f6d2d(0x1c1)]=_0x4d08e2[_0x1f6d2d(0x1ec)][_0x1f6d2d(0x1c1)],_0x340377[_0x1f6d2d(0x19b)]=_0x4d08e2['hookLocation']['datasetCode'],_0x340377[_0x1f6d2d(0x18e)]=_0x4d08e2[_0x1f6d2d(0x1ec)]['operationType'],_0x340377[_0x1f6d2d(0x188)]=_0x4d08e2[_0x1f6d2d(0x1ec)][_0x1f6d2d(0x188)]),_0x2c3802[_0x1f6d2d(0x214)][_0x4d08e2['lockKey']]=_0x340377,_0x12f0f3[_0x1f6d2d(0x208)]({'lockKey':_0x4d08e2[_0x1f6d2d(0x1ef)],'remoteId':_0x1d4cb6['id']});}catch(_0x270618){_0x2f264f[_0x1f6d2d(0x208)]({'lockKey':_0x4d08e2[_0x1f6d2d(0x1ef)],'error':_0x270618 instanceof Error?_0x270618[_0x1f6d2d(0x189)]:String(_0x270618)});}}_0x2c3802[_0x1f6d2d(0x1d2)]=new Date()[_0x1f6d2d(0x186)]();try{await writeBffLockFile(_0x2e9552[_0x1f6d2d(0x1c7)],_0x1fe634);}catch(_0x2b0c9a){const _0x41b349=[...await _0xb915f2['rollback'](),...await _0x27c88b?.[_0x1f6d2d(0x204)]()??[]];throw withRollbackErrors(_0x2b0c9a,_0x1f6d2d(0x211),_0x41b349);}return{'ok':_0x2f264f[_0x1f6d2d(0x1b3)]===0x0,'data':{'pulled':_0x12f0f3,'skipped':_0x49d2f4,'conflicts':_0x5e6746,'failed':_0x2f264f},'message':formatPullMessage(_0x12f0f3[_0x1f6d2d(0x1b3)],_0x49d2f4[_0x1f6d2d(0x1b3)],_0x5e6746['length'],_0x2f264f[_0x1f6d2d(0x1b3)])};}};function localUnsyncedConflict(_0x537654,_0x57e838){const _0x2e276e=a43_0x530a46,_0x224ccb=_0x537654[_0x2e276e(0x1ef)][_0x2e276e(0x199)]('/')['at'](-0x1);return{'code':_0x2e276e(0x1a9),'lockKey':_0x537654[_0x2e276e(0x1ef)],'filePath':_0x537654[_0x2e276e(0x1ce)],..._0x57e838!=null?{'remoteId':_0x57e838}:{},'message':_0x2e276e(0x1ad),'nextAction':{'action':_0x2e276e(0x217),'command':CLI_BIN_NAME+_0x2e276e(0x1d4)+_0x537654[_0x2e276e(0x1d6)]+'\x20--name\x20'+_0x224ccb+_0x2e276e(0x1a2),'requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function formatPullMessage(_0x16b670,_0x38a327,_0x396b28,_0x188782){const _0x1e5c3d=a43_0x530a46,_0x43db9a=['Pull\x20complete:\x20'+_0x16b670+_0x1e5c3d(0x1c5),_0x38a327+_0x1e5c3d(0x1ed)];_0x396b28>0x0&&_0x43db9a[_0x1e5c3d(0x208)](_0x396b28+_0x1e5c3d(0x19f)+(_0x396b28===0x1?'':'s')+'\x20'+(_0x396b28===0x1?_0x1e5c3d(0x1b6):_0x1e5c3d(0x1e6))+_0x1e5c3d(0x1db));if(_0x188782>0x0)_0x43db9a[_0x1e5c3d(0x208)](_0x188782+_0x1e5c3d(0x1cd));return _0x43db9a[_0x1e5c3d(0x20f)](',\x20');}async function hasUnsyncedLocalChanges(_0x23f2a6,_0x24624e,_0x4b3c68){const _0x2b4b73=a43_0x530a46;if(!await fileExists(_0x23f2a6))return![];const _0x4eb319=await computeFileHash(_0x23f2a6);if(!_0x24624e)return _0x4b3c68?_0x4eb319!==_0x4b3c68:!![];return _0x4eb319!==_0x24624e[_0x2b4b73(0x209)];}function createPullFileTransaction(){const _0x57c37a=new Map(),_0x30faec=async(_0x557c82,_0xf740bd)=>{const _0x406d09=a43_0x31e3;try{if(_0xf740bd[_0x406d09(0x1e4)])await ensureParentDirectory(_0x557c82),await writeFile(_0x557c82,_0xf740bd['content']);else try{await unlink(_0x557c82);}catch(_0x4ad46f){if(_0x4ad46f[_0x406d09(0x1e8)]!==_0x406d09(0x1ea))throw _0x4ad46f;}return undefined;}catch(_0x719591){return _0x719591 instanceof Error?_0x719591:new Error(String(_0x719591));}};return{async 'write'(_0x504066,_0x361170){const _0x5708e5=a43_0x31e3;if(!_0x57c37a[_0x5708e5(0x192)](_0x504066))try{_0x57c37a[_0x5708e5(0x1dd)](_0x504066,{'existed':!![],'content':await readFile(_0x504066)});}catch(_0x276fb8){if(_0x276fb8[_0x5708e5(0x1e8)]!==_0x5708e5(0x1ea))throw _0x276fb8;_0x57c37a[_0x5708e5(0x1dd)](_0x504066,{'existed':![]});}try{await ensureParentDirectory(_0x504066),await writeFile(_0x504066,_0x361170,_0x5708e5(0x216));}catch(_0x193da2){const _0x2e327b=await _0x30faec(_0x504066,_0x57c37a[_0x5708e5(0x1c9)](_0x504066));if(!_0x2e327b)_0x57c37a[_0x5708e5(0x1df)](_0x504066);throw withRollbackErrors(_0x193da2,_0x5708e5(0x1a1)+_0x504066+'\x22.',_0x2e327b?[_0x2e327b]:[]);}},async 'rollback'(){const _0x549d1e=a43_0x31e3,_0x531d0d=[];for(const [_0x2f447c,_0x32059c]of[..._0x57c37a[_0x549d1e(0x1dc)]()][_0x549d1e(0x1de)]()){const _0x226f65=await _0x30faec(_0x2f447c,_0x32059c);_0x226f65&&_0x531d0d[_0x549d1e(0x208)](new Error(_0x549d1e(0x212)+_0x2f447c+_0x549d1e(0x1f5)+_0x226f65['message']));}return _0x531d0d;}};}function withRollbackErrors(_0x315f17,_0x4e693f,_0x41f450){const _0x5a66dd=a43_0x530a46,_0x3d7038=_0x315f17 instanceof Error?_0x315f17:new Error(String(_0x315f17));if(_0x41f450[_0x5a66dd(0x1b3)]===0x0)return _0x3d7038;return new AggregateError([_0x3d7038,..._0x41f450],_0x4e693f+'\x20Recovery\x20errors:\x20'+_0x41f450[_0x5a66dd(0x1a3)](_0x351376=>_0x351376[_0x5a66dd(0x189)])[_0x5a66dd(0x20f)](';\x20'));}function buildDatasetCodeToAliasMap(_0x719b65,_0x4747de,_0x2a4f0f){const _0x2ba562=a43_0x530a46,_0x44b87e=resolveApiModelSource(_0x719b65,_0x4747de,_0x2a4f0f),_0x136c59=loadAliasMap(_0x719b65,undefined,_0x44b87e['filePath'],_0x44b87e[_0x2ba562(0x20b)]);return assertUnambiguousHookAliases(_0x136c59),new Map(_0x136c59[_0x2ba562(0x1a3)](_0x4e17b2=>[_0x4e17b2['datasetCode'][_0x2ba562(0x1ca)](),_0x4e17b2[_0x2ba562(0x1c1)]]));}async function planHookDirectoryMigration(_0xa0935,_0x5b2993,_0x1caf52,_0x59ba1c){const _0x1b8c19=a43_0x530a46,_0x4ef383=new Map();for(const [_0x69e6a3,_0x1be4e2]of Object[_0x1b8c19(0x1dc)](_0x5b2993[_0x1b8c19(0x214)])){const [_0x1be07e,_0x593bce,_0x193d34,_0x15f67e,_0x93f413,..._0x4e5b14]=_0x69e6a3[_0x1b8c19(0x199)]('/');if(_0x1be07e!==_0x1b8c19(0x1d7)||!_0x593bce||!_0x193d34||!_0x15f67e||!_0x93f413||_0x4e5b14[_0x1b8c19(0x1b3)]>0x0||!_0x1be4e2['datasetCode'])continue;const _0x1d9047=_0x1caf52['get'](_0x1be4e2[_0x1b8c19(0x19b)][_0x1b8c19(0x1ca)]()),_0xc8f91a=_0x1d9047??_0x1be4e2[_0x1b8c19(0x19b)];if(!isSafeHookDirectorySegment(_0x593bce))throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1f0)+_0x593bce+_0x1b8c19(0x218));if(!isSafeHookDirectorySegment(_0xc8f91a))throw CliErrors['validation'](_0x1b8c19(0x1e0)+_0x593bce+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x593bce===_0xc8f91a)continue;const _0x3212f8=_0x4ef383[_0x1b8c19(0x1c9)](_0x593bce)??{'datasetCode':_0x1be4e2['datasetCode'],'alias':_0x1d9047,'keyChanges':[]};if(_0x3212f8[_0x1b8c19(0x19b)]!==_0x1be4e2[_0x1b8c19(0x19b)])throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1e0)+_0x593bce+_0x1b8c19(0x213));const _0x2ea045='HOOK/'+_0xc8f91a+'/'+_0x193d34+'/'+_0x15f67e+'/'+_0x93f413;try{resolveLocalFilePathFromLockKey(_0xa0935,_0x69e6a3),resolveLocalFilePathFromLockKey(_0xa0935,_0x2ea045);}catch(_0x1a70aa){throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1a6)+_0x69e6a3+_0x1b8c19(0x1f5)+(_0x1a70aa instanceof Error?_0x1a70aa[_0x1b8c19(0x189)]:String(_0x1a70aa)));}_0x3212f8[_0x1b8c19(0x1c2)][_0x1b8c19(0x208)]({'oldLockKey':_0x69e6a3,'newLockKey':_0x2ea045,'entry':_0x1be4e2}),_0x4ef383[_0x1b8c19(0x1dd)](_0x593bce,_0x3212f8);}const _0x329ffc=new Set([..._0x4ef383['values']()]['flatMap'](_0x4556f6=>_0x4556f6[_0x1b8c19(0x1c2)]['map'](_0x3fd922=>_0x3fd922['oldLockKey']))),_0x1f8d0a=new Map(),_0x12f974=new Map();for(const [_0x107b9c,_0x504d72]of _0x4ef383){const _0x4cce68=_0x504d72[_0x1b8c19(0x1c1)]??_0x504d72['datasetCode'],_0x48c9a2=hookDirectoryIdentity(_0x4cce68),_0x211c0f=_0x1f8d0a['get'](_0x48c9a2);if(_0x211c0f&&_0x211c0f!==_0x107b9c)throw CliErrors[_0x1b8c19(0x18c)]('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x211c0f+_0x1b8c19(0x1f6)+_0x107b9c+_0x1b8c19(0x1fa)+_0x4cce68+_0x1b8c19(0x1bb));_0x1f8d0a[_0x1b8c19(0x1dd)](_0x48c9a2,_0x107b9c);for(const _0x5da1cb of _0x504d72[_0x1b8c19(0x1c2)]){const _0xcafaa5=_0x12f974[_0x1b8c19(0x1c9)](_0x5da1cb[_0x1b8c19(0x1c0)]);if(_0xcafaa5&&_0xcafaa5!==_0x5da1cb['oldLockKey'])throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x197)+_0xcafaa5+_0x1b8c19(0x1f6)+_0x5da1cb[_0x1b8c19(0x18a)]+_0x1b8c19(0x1fa)+_0x5da1cb[_0x1b8c19(0x1c0)]+_0x1b8c19(0x1b8));if(_0x329ffc[_0x1b8c19(0x192)](_0x5da1cb[_0x1b8c19(0x1c0)]))throw CliErrors[_0x1b8c19(0x18c)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x5da1cb[_0x1b8c19(0x18a)]+_0x1b8c19(0x1c3)+_0x5da1cb['newLockKey']+_0x1b8c19(0x1af));_0x12f974[_0x1b8c19(0x1dd)](_0x5da1cb[_0x1b8c19(0x1c0)],_0x5da1cb[_0x1b8c19(0x18a)]);}}const _0xcbf2e6=new Map();for(const [_0x29297f,_0x45e9f5]of _0x1caf52){_0xcbf2e6['set'](hookDirectoryIdentity(_0x45e9f5),_0x29297f);}const _0x561c12=[];for(const [_0x4f2cdc,_0x55f268]of _0x4ef383){const _0x55da22=_0x55f268[_0x1b8c19(0x1c1)]??_0x55f268['datasetCode'],_0x533d6a=join(_0xa0935[_0x1b8c19(0x1c4)],_0x1b8c19(0x1d7),_0x4f2cdc),_0x1fa809=join(_0xa0935[_0x1b8c19(0x1c4)],_0x1b8c19(0x1d7),_0x55da22),_0x586486=await directoryExists(_0x533d6a),_0x17c111=await directoryExists(_0x1fa809),_0x32864b=_0x586486?_0x17c111?await sameDirectory(_0x533d6a,_0x1fa809)?_0x1b8c19(0x1e7):undefined:'move':_0x1b8c19(0x1be);if(!_0x32864b)throw CliErrors[_0x1b8c19(0x18c)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x4f2cdc+_0x1b8c19(0x1ff)+_0x55da22+_0x1b8c19(0x187));const _0x4bc0ad=_0xcbf2e6['get'](hookDirectoryIdentity(_0x4f2cdc));if(_0x4bc0ad&&_0x4bc0ad!==_0x55f268[_0x1b8c19(0x19b)][_0x1b8c19(0x1ca)]()){const _0x400d60=new Set(_0x55f268['keyChanges'][_0x1b8c19(0x1a3)](_0x2055fc=>_0x2055fc[_0x1b8c19(0x18a)])),_0x1d0e9c=_0x59ba1c['filter'](_0x394e97=>_0x394e97[_0x1b8c19(0x1d6)]===_0x1b8c19(0x1d7)&&_0x394e97['alias']!=null&&hookDirectoryIdentity(_0x394e97[_0x1b8c19(0x1c1)])===hookDirectoryIdentity(_0x4f2cdc)&&!_0x400d60[_0x1b8c19(0x192)](_0x394e97[_0x1b8c19(0x1ef)]));if(_0x1d0e9c[_0x1b8c19(0x1b3)]>0x0)throw CliErrors['validation'](_0x1b8c19(0x1e0)+_0x4f2cdc+_0x1b8c19(0x206));}const _0x591956=_0xcbf2e6[_0x1b8c19(0x1c9)](hookDirectoryIdentity(_0x55da22));if(_0x591956&&_0x591956!==_0x55f268[_0x1b8c19(0x19b)][_0x1b8c19(0x1ca)]())throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1e0)+_0x4f2cdc+_0x1b8c19(0x1ff)+_0x55da22+_0x1b8c19(0x191));for(const _0x164d9c of _0x55f268['keyChanges']){const _0x18d5cf=_0x5b2993[_0x1b8c19(0x214)][_0x164d9c['newLockKey']];if(_0x18d5cf&&!_0x329ffc[_0x1b8c19(0x192)](_0x164d9c[_0x1b8c19(0x1c0)])&&!sameHookIdentity(_0x164d9c['entry'],_0x18d5cf))throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1e0)+_0x4f2cdc+_0x1b8c19(0x1ff)+_0x55da22+_0x1b8c19(0x20c));}_0x561c12['push']({'oldDirectory':_0x4f2cdc,'newDirectory':_0x55da22,'oldDirectoryPath':_0x533d6a,'newDirectoryPath':_0x1fa809,'mode':_0x32864b,'alias':_0x55f268[_0x1b8c19(0x1c1)],'keyChanges':_0x55f268[_0x1b8c19(0x1c2)]});}const _0x57c0e3={..._0x5b2993['functions']},_0xc6058e=new Map(),_0x253fd5=new Map();for(const _0x427402 of _0x561c12){const _0x35bd14=_0x427402['mode']!=='rekey';_0x35bd14&&_0x253fd5[_0x1b8c19(0x1dd)](hookDirectoryIdentity(_0x427402[_0x1b8c19(0x1a4)]),_0x427402[_0x1b8c19(0x1cc)]);for(const _0xd0c760 of _0x427402['keyChanges']){const _0x25cf5b=_0x57c0e3[_0xd0c760['newLockKey']],_0x2aeafb=_0x35bd14?_0xd0c760[_0x1b8c19(0x1d3)]:_0x25cf5b??_0xd0c760[_0x1b8c19(0x1d3)];_0x57c0e3[_0xd0c760[_0x1b8c19(0x1c0)]]=canonicalizeHookEntry(_0x2aeafb,_0x427402['alias']),delete _0x57c0e3[_0xd0c760['oldLockKey']],_0x35bd14&&_0xc6058e[_0x1b8c19(0x1dd)](_0xd0c760[_0x1b8c19(0x1c0)],resolveLocalFilePathFromLockKey(_0xa0935,_0xd0c760['oldLockKey']));}}return{'migrations':_0x561c12,'projectedFunctions':_0x57c0e3,'sourceFilePathByNewLockKey':_0xc6058e,'sourceDirectoryPathByNewDirectory':_0x253fd5};}function resolveMigratedSourceFilePath(_0x184894,_0x5b43bd){const _0x5d72ce=a43_0x530a46;if(!_0x184894||!_0x5b43bd)return undefined;const _0x58ca4e=_0x184894[_0x5d72ce(0x20e)]['get'](_0x5b43bd[_0x5d72ce(0x1ef)]);if(_0x58ca4e)return _0x58ca4e;if(_0x5b43bd[_0x5d72ce(0x1d6)]!==_0x5d72ce(0x1d7))return undefined;const [,_0x5d1279,..._0x246ae4]=_0x5b43bd[_0x5d72ce(0x1ef)]['split']('/');if(!_0x5d1279||_0x246ae4[_0x5d72ce(0x1b3)]===0x0)return undefined;const _0x595fcf=_0x184894[_0x5d72ce(0x1bc)][_0x5d72ce(0x1c9)](hookDirectoryIdentity(_0x5d1279));return _0x595fcf?join(_0x595fcf,..._0x246ae4)+_0x5d72ce(0x1d9):undefined;}function sameHookIdentity(_0x15ef0a,_0x406ef6){const _0x5fbb45=a43_0x530a46;return _0x15ef0a[_0x5fbb45(0x18b)]===_0x406ef6[_0x5fbb45(0x18b)]&&_0x15ef0a[_0x5fbb45(0x19b)]===_0x406ef6[_0x5fbb45(0x19b)]&&_0x15ef0a[_0x5fbb45(0x18e)]===_0x406ef6[_0x5fbb45(0x18e)]&&_0x15ef0a['functionNode']===_0x406ef6[_0x5fbb45(0x188)];}function canonicalizeHookEntry(_0x5e1f00,_0xc0624e){const {alias:_0xcde7bf,..._0x3f0dbc}=_0x5e1f00;return _0xc0624e?{..._0x3f0dbc,'alias':_0xc0624e}:_0x3f0dbc;}function hookDirectoryIdentity(_0xe5b00a){const _0x29d959=a43_0x530a46;return _0xe5b00a['normalize']('NFC')[_0x29d959(0x1ca)]();}function isSafeHookDirectorySegment(_0x579591){return isSafeLockKeySegment(_0x579591);}function a43_0x31e3(_0x4b8c21,_0x20bb78){_0x4b8c21=_0x4b8c21-0x185;const _0x370c5f=a43_0x370c();let _0x31e3dd=_0x370c5f[_0x4b8c21];return _0x31e3dd;}async function sameDirectory(_0x3632a3,_0x3c5371){const _0x52f585=a43_0x530a46,[_0x515a7c,_0x2d9533]=await Promise[_0x52f585(0x193)]([stat(_0x3632a3),stat(_0x3c5371)]);return _0x515a7c[_0x52f585(0x1fd)]===_0x2d9533[_0x52f585(0x1fd)]&&_0x515a7c['ino']===_0x2d9533[_0x52f585(0x1d1)];}async function applyHookDirectoryMigration(_0x39060f,_0x3337f9){const _0x300c42=a43_0x530a46,_0x44011d=_0x3337f9[_0x300c42(0x214)],_0x3ab158=_0x3337f9['lastSync'],_0x39fa9f=[],_0x35cbf0=async()=>{const _0x3aaf6e=_0x300c42,_0x168851=[];_0x3337f9['functions']=_0x44011d,_0x3337f9[_0x3aaf6e(0x1d2)]=_0x3ab158;for(const {migration:_0x192f5e,temporaryPath:_0x32ba72}of[..._0x39fa9f]['reverse']()){try{_0x32ba72?(await rename(_0x192f5e[_0x3aaf6e(0x1f1)],_0x32ba72),await rename(_0x32ba72,_0x192f5e[_0x3aaf6e(0x1cc)])):await rename(_0x192f5e['newDirectoryPath'],_0x192f5e[_0x3aaf6e(0x1cc)]);}catch(_0x13faaf){_0x168851[_0x3aaf6e(0x208)](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x192f5e[_0x3aaf6e(0x1c6)]+'\x22\x20from\x20\x22'+_0x192f5e[_0x3aaf6e(0x1a4)]+_0x3aaf6e(0x1f5)+(_0x13faaf instanceof Error?_0x13faaf['message']:String(_0x13faaf))));}}return _0x168851;};try{for(const _0x242207 of _0x39060f['migrations']){if(_0x242207[_0x300c42(0x1ee)]===_0x300c42(0x200))await ensureParentDirectory(_0x242207[_0x300c42(0x1f1)]),await rename(_0x242207['oldDirectoryPath'],_0x242207['newDirectoryPath']),_0x39fa9f[_0x300c42(0x208)]({'migration':_0x242207});else{if(_0x242207['mode']===_0x300c42(0x1e7)){const _0x51818d=join(dirname(_0x242207['oldDirectoryPath']),_0x300c42(0x1b0)+randomUUID());await rename(_0x242207[_0x300c42(0x1cc)],_0x51818d);try{await rename(_0x51818d,_0x242207['newDirectoryPath']);}catch(_0x270da){try{await rename(_0x51818d,_0x242207[_0x300c42(0x1cc)]);}catch(_0x3f7ddd){throw withRollbackErrors(_0x270da,_0x300c42(0x1f8)+_0x242207[_0x300c42(0x1c6)]+_0x300c42(0x1ff)+_0x242207[_0x300c42(0x1a4)]+_0x300c42(0x1fc)+_0x51818d+_0x300c42(0x21a),[new Error(_0x300c42(0x1b7)+_0x51818d+_0x300c42(0x1ff)+_0x242207[_0x300c42(0x1c6)]+_0x300c42(0x1f5)+(_0x3f7ddd instanceof Error?_0x3f7ddd[_0x300c42(0x189)]:String(_0x3f7ddd)))]);}throw _0x270da;}_0x39fa9f[_0x300c42(0x208)]({'migration':_0x242207,'temporaryPath':_0x51818d});}}}return _0x3337f9[_0x300c42(0x214)]=_0x39060f[_0x300c42(0x1bd)],{'rollback':_0x35cbf0};}catch(_0xa1bfd6){const _0x345a67=await _0x35cbf0();throw withRollbackErrors(_0xa1bfd6,_0x300c42(0x18f),_0x345a67);}}async function confirmForce(){const _0x42a0d3=a43_0x530a46,_0xcbda96=createInterface({'input':process[_0x42a0d3(0x1f2)],'output':process[_0x42a0d3(0x1ae)]}),_0x1254cf=await new Promise(_0x3d6f6b=>{const _0x2ef422=_0x42a0d3;_0xcbda96[_0x2ef422(0x1d8)](_0x2ef422(0x215),_0x3d6f6b);});return _0xcbda96[_0x42a0d3(0x19c)](),['y',_0x42a0d3(0x1e3)][_0x42a0d3(0x1aa)](_0x1254cf[_0x42a0d3(0x1b1)]()['toLowerCase']());}
|
|
1
|
+
const a43_0x39c143=a43_0x220a;(function(_0x207299,_0xb183c3){const _0x5d71e3=a43_0x220a,_0x37d4f3=_0x207299();while(!![]){try{const _0x430f87=parseInt(_0x5d71e3(0x1ae))/0x1+parseInt(_0x5d71e3(0x138))/0x2+-parseInt(_0x5d71e3(0x18b))/0x3+parseInt(_0x5d71e3(0x196))/0x4+parseInt(_0x5d71e3(0x14f))/0x5+-parseInt(_0x5d71e3(0x12a))/0x6*(parseInt(_0x5d71e3(0x162))/0x7)+-parseInt(_0x5d71e3(0x121))/0x8;if(_0x430f87===_0xb183c3)break;else _0x37d4f3['push'](_0x37d4f3['shift']());}catch(_0x5a45f2){_0x37d4f3['push'](_0x37d4f3['shift']());}}}(a43_0x4124,0x952de));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_0x39c143(0x1a0),'command':a43_0x39c143(0x12b),'description':a43_0x39c143(0x123),'risk':a43_0x39c143(0x13b),'structuredErrors':!![],'flags':[{'name':a43_0x39c143(0x15c),'type':'string','description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x39c143(0x18d),a43_0x39c143(0x18f),a43_0x39c143(0x14e)]},{'name':a43_0x39c143(0x16c),'type':'boolean','description':a43_0x39c143(0x197)}],async 'dryRun'(_0x18a95c){const _0x487645=a43_0x39c143,_0x317e00=loadBffProjectConfig(_0x18a95c[_0x487645(0x173)]),_0x4588f4=await readBffLockFile(_0x317e00['lockFilePath']),{appLock:_0x584ec1}=ensureLockScope(_0x4588f4??createEmptyBffLock(),_0x18a95c[_0x487645(0x173)],_0x317e00[_0x487645(0x181)],_0x487645(0x12b)),_0x1d6ff2=normalizeBffType(_0x18a95c['str'](_0x487645(0x15c)))??undefined,[_0x3cc2d8,_0x19eb32]=await Promise[_0x487645(0x187)]([listBffScripts(_0x18a95c[_0x487645(0x173)],_0x1d6ff2),getBffScriptStatistics(_0x18a95c[_0x487645(0x173)])]),_0x3c0c09=_0x3cc2d8['some'](_0x12ee4c=>normalizeBffType(_0x12ee4c['scriptType'])===_0x487645(0x14e)),_0x59126d=_0x3c0c09?buildDatasetCodeToAliasMap(_0x18a95c[_0x487645(0x167)],_0x18a95c[_0x487645(0x173)],_0x18a95c['selectedAppName']||_0x18a95c[_0x487645(0x1ac)]?.[_0x487645(0x13a)]||_0x18a95c['mergedCli']?.[_0x487645(0x11c)]):new Map(),_0xac021=_0x3c0c09?await planHookDirectoryMigration(_0x317e00,_0x584ec1,_0x59126d,await scanLocalBffFunctions(_0x317e00,_0x487645(0x14e))):undefined,_0xd0a002=createHookLocationMap(_0x19eb32),_0x1cfac5=[];for(const _0x4d9001 of _0x3cc2d8){const _0x269634=resolveRemoteScriptTarget(_0x317e00,_0x4d9001,_0xd0a002,_0xac021?.[_0x487645(0x133)]??_0x584ec1[_0x487645(0x17c)],_0x59126d);if(!_0x269634){_0x1cfac5['push']({'scriptType':_0x4d9001[_0x487645(0x120)],'functionName':_0x4d9001['functionName']??'','status':_0x487645(0x189),'reason':_0x487645(0x160)});continue;}const _0xc50c87=(_0xac021?.['projectedFunctions']??_0x584ec1[_0x487645(0x17c)])[_0x269634[_0x487645(0x180)]],_0x4f0ee3=_0x4d9001[_0x487645(0x182)]!=null?computeContentHash(_0x4d9001['scriptContent']):undefined,_0x36ad51=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0xac021,_0x269634)??_0x269634[_0x487645(0x19b)],_0xc50c87,_0x4f0ee3),_0x410eb4=_0x36ad51?localUnsyncedConflict(_0x269634,_0x4d9001['id']):undefined;_0x1cfac5[_0x487645(0x198)]({'lockKey':_0x269634[_0x487645(0x180)],'filePath':_0x269634[_0x487645(0x19b)],'remoteId':_0x4d9001['id']??null,'status':_0x410eb4?_0x487645(0x136):_0x487645(0x175),..._0x410eb4?{'conflict':_0x410eb4}:{},..._0x269634[_0x487645(0x150)]?{'alias':_0x269634[_0x487645(0x150)][_0x487645(0x143)]??null,'datasetCode':_0x269634[_0x487645(0x150)]['datasetCode'],'operationType':_0x269634[_0x487645(0x150)][_0x487645(0x16b)],'functionNode':_0x269634[_0x487645(0x150)][_0x487645(0x1a4)]}:{}});}return{'method':_0x487645(0x147),'url':_0x487645(0x151)+_0x18a95c[_0x487645(0x173)]+(_0x1d6ff2?_0x487645(0x1a9)+_0x1d6ff2:'')+_0x487645(0x134)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x18a95c[_0x487645(0x173)],'filterType':_0x1d6ff2??null,..._0xac021&&_0xac021[_0x487645(0x15d)][_0x487645(0x163)]>0x0?{'hookDirectoryMigrations':_0xac021['migrations'][_0x487645(0x1a3)](_0x42972b=>({'from':_0x42972b[_0x487645(0x174)],'to':_0x42972b[_0x487645(0x11a)]}))}:{},'files':_0x1cfac5},'description':_0x487645(0x170)+_0x1cfac5[_0x487645(0x163)]+_0x487645(0x172)};},async 'execute'(_0x287969){const _0x916454=a43_0x39c143,_0x281974=loadBffProjectConfig(_0x287969['appCode']),_0x2e781b=await readBffLockFile(_0x281974['lockFilePath']),{lockData:_0x1101d3,appLock:_0x11605f}=ensureLockScope(_0x2e781b??createEmptyBffLock(),_0x287969[_0x916454(0x173)],_0x281974['scriptsRoot'],_0x916454(0x12b)),_0x17a5f5=normalizeBffType(_0x287969[_0x916454(0x185)](_0x916454(0x15c)))??undefined;if(_0x287969['str'](_0x916454(0x15c))&&!_0x17a5f5)throw CliErrors[_0x916454(0x186)]('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x47aff5,_0x232777]=await Promise['all']([listBffScripts(_0x287969[_0x916454(0x173)],_0x17a5f5),getBffScriptStatistics(_0x287969[_0x916454(0x173)])]);if(_0x47aff5[_0x916454(0x163)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x916454(0x15a)};const _0x37fe58=_0x287969[_0x916454(0x1aa)](_0x916454(0x16c));if(_0x37fe58&&!_0x287969['nonInteractive']){const _0x550e27=await confirmForce();if(!_0x550e27)throw CliErrors[_0x916454(0x11f)](_0x916454(0x178));}if(_0x37fe58&&_0x287969['nonInteractive']){}const _0x42f0b6=_0x47aff5['some'](_0x2e1d28=>normalizeBffType(_0x2e1d28[_0x916454(0x120)])===_0x916454(0x14e)),_0x508555=_0x42f0b6?buildDatasetCodeToAliasMap(_0x287969['apiDir'],_0x287969[_0x916454(0x173)],_0x287969[_0x916454(0x18c)]||_0x287969[_0x916454(0x1ac)]?.['currentApp']||_0x287969[_0x916454(0x1ac)]?.[_0x916454(0x11c)]):new Map(),_0x1b0257=createHookLocationMap(_0x232777),_0xb32364=JSON[_0x916454(0x135)](JSON[_0x916454(0x12d)](_0x1101d3)),_0x5697dc=_0x287969[_0x916454(0x173)],_0x5b6b82=_0xb32364['apps'][_0x5697dc];if(!_0x5b6b82)throw new Error(_0x916454(0x1a1)+_0x5697dc+_0x916454(0x146));const _0x49c412=_0x42f0b6?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x281974,_0x5b6b82,_0x508555,await scanLocalBffFunctions(_0x281974,_0x916454(0x14e))),_0x5b6b82):undefined,_0x3600e8=createPullFileTransaction(),_0x2584c7=[],_0x7f6b5b=[],_0x580e0a=[],_0x52fe3c=[];for(const _0x1c224e of _0x47aff5){const _0x1542c0=resolveRemoteScriptTarget(_0x281974,_0x1c224e,_0x1b0257,_0x5b6b82[_0x916454(0x17c)],_0x508555);if(!_0x1542c0){_0x7f6b5b['push']({'lockKey':_0x1c224e[_0x916454(0x120)]+'/'+_0x1c224e[_0x916454(0x158)],'reason':_0x916454(0x160)});continue;}const _0x1f3893=_0x5b6b82['functions'][_0x1542c0[_0x916454(0x180)]];try{if(!_0x1c224e['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x1c224e['scriptContent']==null)throw new Error(_0x916454(0x14a));const _0x4e9113=_0x1c224e[_0x916454(0x182)],_0xdb989f=computeContentHash(_0x4e9113);if(!_0x37fe58){const _0x1dccf2=await hasUnsyncedLocalChanges(_0x1542c0['filePath'],_0x1f3893,_0xdb989f);if(_0x1dccf2){_0x580e0a[_0x916454(0x198)](localUnsyncedConflict(_0x1542c0,_0x1c224e['id']));continue;}}await _0x3600e8[_0x916454(0x12c)](_0x1542c0[_0x916454(0x19b)],_0x4e9113);const _0x4d5fd2={'hash':_0xdb989f,'remoteId':_0x1c224e['id'],'version':_0x1c224e[_0x916454(0x16e)]};_0x1542c0[_0x916454(0x15c)]==='HOOK'&&_0x1542c0['hookLocation']&&(_0x4d5fd2[_0x916454(0x143)]=_0x1542c0[_0x916454(0x150)]['alias'],_0x4d5fd2[_0x916454(0x1ad)]=_0x1542c0[_0x916454(0x150)][_0x916454(0x1ad)],_0x4d5fd2[_0x916454(0x16b)]=_0x1542c0[_0x916454(0x150)]['operationType'],_0x4d5fd2[_0x916454(0x1a4)]=_0x1542c0['hookLocation'][_0x916454(0x1a4)]),_0x5b6b82[_0x916454(0x17c)][_0x1542c0['lockKey']]=_0x4d5fd2,_0x2584c7[_0x916454(0x198)]({'lockKey':_0x1542c0[_0x916454(0x180)],'remoteId':_0x1c224e['id']});}catch(_0x241958){_0x52fe3c[_0x916454(0x198)]({'lockKey':_0x1542c0['lockKey'],'error':_0x241958 instanceof Error?_0x241958[_0x916454(0x125)]:String(_0x241958)});}}_0x5b6b82[_0x916454(0x1a6)]=new Date()[_0x916454(0x128)]();try{await writeBffLockFile(_0x281974[_0x916454(0x177)],_0xb32364);}catch(_0x30e4ba){const _0xc5b081=[...await _0x3600e8[_0x916454(0x17b)](),...await _0x49c412?.[_0x916454(0x17b)]()??[]];throw withRollbackErrors(_0x30e4ba,_0x916454(0x190),_0xc5b081);}return{'ok':_0x52fe3c[_0x916454(0x163)]===0x0,'data':{'pulled':_0x2584c7,'skipped':_0x7f6b5b,'conflicts':_0x580e0a,'failed':_0x52fe3c},'message':formatPullMessage(_0x2584c7[_0x916454(0x163)],_0x7f6b5b[_0x916454(0x163)],_0x580e0a['length'],_0x52fe3c[_0x916454(0x163)])};}};function localUnsyncedConflict(_0x24d22f,_0x11a7b5){const _0x1a461a=a43_0x39c143,_0x1975b7=_0x24d22f[_0x1a461a(0x180)]['split']('/')['at'](-0x1);return{'code':_0x1a461a(0x11e),'lockKey':_0x24d22f[_0x1a461a(0x180)],'filePath':_0x24d22f['filePath'],..._0x11a7b5!=null?{'remoteId':_0x11a7b5}:{},'message':_0x1a461a(0x188),'nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x1a461a(0x19a)+_0x24d22f['type']+_0x1a461a(0x157)+_0x1975b7+_0x1a461a(0x164),'requiresReview':!![],'message':_0x1a461a(0x127)}};}function formatPullMessage(_0xc44cd5,_0x1e5aef,_0x3fe688,_0x3319a7){const _0x408b87=a43_0x39c143,_0x372cb9=[_0x408b87(0x126)+_0xc44cd5+_0x408b87(0x15b),_0x1e5aef+_0x408b87(0x169)];_0x3fe688>0x0&&_0x372cb9[_0x408b87(0x198)](_0x3fe688+_0x408b87(0x155)+(_0x3fe688===0x1?'':'s')+'\x20'+(_0x3fe688===0x1?'requires':'require')+_0x408b87(0x19e));if(_0x3319a7>0x0)_0x372cb9[_0x408b87(0x198)](_0x3319a7+'\x20failed');return _0x372cb9['join'](',\x20');}function a43_0x220a(_0x953e5d,_0x103554){_0x953e5d=_0x953e5d-0x11a;const _0x412484=a43_0x4124();let _0x220a5e=_0x412484[_0x953e5d];return _0x220a5e;}async function hasUnsyncedLocalChanges(_0x4be9f4,_0x2edeca,_0x5920f8){const _0x221437=a43_0x39c143;if(!await fileExists(_0x4be9f4))return![];const _0x4663a7=await computeFileHash(_0x4be9f4);if(!_0x2edeca)return _0x5920f8?_0x4663a7!==_0x5920f8:!![];return _0x4663a7!==_0x2edeca[_0x221437(0x124)];}function a43_0x4124(){const _0x5a4f97=['flatMap','\x20skipped','rekey','operationType','force','reverse','version','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','Would\x20inspect\x20','question','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','appCode','oldDirectory','would_pull','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','lockFilePath','Force\x20pull\x20cancelled.','toLowerCase','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','rollback','functions','oldLockKey','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','split','lockKey','scriptsRoot','scriptContent','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','has','str','validation','all','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','skipped','oldDirectoryPath','2281851hsDYww','selectedAppName','COMMON','\x22\x20and\x20\x22','ENDPOINT','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','remoteId','\x22\x20to\x20\x22','\x22\x20from\x20\x22','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','move','1927016sIqoZE','Force\x20overwrite\x20local\x20unsynced\x20changes','push','.js','\x20bff\x20push\x20--type\x20','filePath','stderr','sourceFilePathByNewLockKey','\x20resolution','utf8','bff','Lock\x20scope\x20for\x20app\x20\x22','profileName','map','functionNode','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','lastSync','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','newDirectoryPath','&type=','bool','trim','mergedCli','datasetCode','785925FEvNBC','entry','newDirectory','\x22;\x20temporary\x20directory\x20\x22','defaultApp','\x22:\x20its\x20target\x20\x22','BFF_LOCAL_UNSYNCED','cancelled','scriptType','1664760jXRgsv','dev','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','hash','message','Pull\x20complete:\x20','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.','toISOString','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','24IUpRwG','pull','write','stringify','code','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','\x22\x20may\x20remain.','Could\x20not\x20restore\x20local\x20script\x20\x22','projectedFunctions','¤tPage=1&pageSize=','parse','conflict','existed','1951432qEvBfO','mode','currentApp','read','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','case-rename','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','\x20Recovery\x20errors:\x20','\x22:\x20both\x20target\x20\x22','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','stdin','alias','newLockKey','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','GET','\x22\x20from\x20the\x20lock\x20file.','keyChanges','Remote\x20script\x20missing\x20content.','delete','scriptsRootDir','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','HOOK','87395Nxhinc','hookLocation','/api/management/library/scripts/list?appCode=','ino','filter','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x20conflict','HOOK/','\x20--name\x20','functionName','set','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x20pulled','type','migrations','get','Failed\x20to\x20write\x20local\x20script\x20\x22','unresolvable\x20target\x20path','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','1191967DkTUXV','length','\x20--format\x20compress','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','apiDir'];a43_0x4124=function(){return _0x5a4f97;};return a43_0x4124();}function createPullFileTransaction(){const _0x365fd9=new Map(),_0x74f87b=async(_0x251adf,_0x4d7662)=>{const _0x4922b6=a43_0x220a;try{if(_0x4d7662[_0x4922b6(0x137)])await ensureParentDirectory(_0x251adf),await writeFile(_0x251adf,_0x4d7662['content']);else try{await unlink(_0x251adf);}catch(_0x2a64d4){if(_0x2a64d4[_0x4922b6(0x12e)]!=='ENOENT')throw _0x2a64d4;}return undefined;}catch(_0x45c448){return _0x45c448 instanceof Error?_0x45c448:new Error(String(_0x45c448));}};return{async 'write'(_0x463ae1,_0x384d7d){const _0xaa5408=a43_0x220a;if(!_0x365fd9['has'](_0x463ae1))try{_0x365fd9[_0xaa5408(0x159)](_0x463ae1,{'existed':!![],'content':await readFile(_0x463ae1)});}catch(_0x4bd33c){if(_0x4bd33c[_0xaa5408(0x12e)]!=='ENOENT')throw _0x4bd33c;_0x365fd9[_0xaa5408(0x159)](_0x463ae1,{'existed':![]});}try{await ensureParentDirectory(_0x463ae1),await writeFile(_0x463ae1,_0x384d7d,_0xaa5408(0x19f));}catch(_0x2b74de){const _0x2d1b4c=await _0x74f87b(_0x463ae1,_0x365fd9[_0xaa5408(0x15e)](_0x463ae1));if(!_0x2d1b4c)_0x365fd9[_0xaa5408(0x14b)](_0x463ae1);throw withRollbackErrors(_0x2b74de,_0xaa5408(0x15f)+_0x463ae1+'\x22.',_0x2d1b4c?[_0x2d1b4c]:[]);}},async 'rollback'(){const _0x2e1946=a43_0x220a,_0xae06e2=[];for(const [_0x364408,_0x586c87]of[..._0x365fd9['entries']()][_0x2e1946(0x16d)]()){const _0x3938f2=await _0x74f87b(_0x364408,_0x586c87);_0x3938f2&&_0xae06e2[_0x2e1946(0x198)](new Error(_0x2e1946(0x132)+_0x364408+'\x22:\x20'+_0x3938f2[_0x2e1946(0x125)]));}return _0xae06e2;}};}function withRollbackErrors(_0x578021,_0x1a20ca,_0x4c8659){const _0x5ebf3a=a43_0x39c143,_0x57d91a=_0x578021 instanceof Error?_0x578021:new Error(String(_0x578021));if(_0x4c8659[_0x5ebf3a(0x163)]===0x0)return _0x57d91a;return new AggregateError([_0x57d91a,..._0x4c8659],_0x1a20ca+_0x5ebf3a(0x13f)+_0x4c8659[_0x5ebf3a(0x1a3)](_0x548077=>_0x548077[_0x5ebf3a(0x125)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x31e8b3,_0xb0c9fb,_0x62cf26){const _0x520ae8=a43_0x39c143,_0x1a3713=resolveApiModelSource(_0x31e8b3,_0xb0c9fb,_0x62cf26),_0xa399e3=loadAliasMap(_0x31e8b3,undefined,_0x1a3713['filePath'],_0x1a3713[_0x520ae8(0x1a2)]);return assertUnambiguousHookAliases(_0xa399e3),new Map(_0xa399e3[_0x520ae8(0x1a3)](_0x5e2b1d=>[_0x5e2b1d['datasetCode']['toLowerCase'](),_0x5e2b1d[_0x520ae8(0x143)]]));}async function planHookDirectoryMigration(_0x5a0503,_0x1a5360,_0x4f950d,_0x514f1c){const _0x5613c3=a43_0x39c143,_0x554b2b=new Map();for(const [_0x1849db,_0x19e1a5]of Object['entries'](_0x1a5360[_0x5613c3(0x17c)])){const [_0x6df3d5,_0x5df896,_0x30fa77,_0x3e35f6,_0x1c5013,..._0x15faf6]=_0x1849db[_0x5613c3(0x17f)]('/');if(_0x6df3d5!==_0x5613c3(0x14e)||!_0x5df896||!_0x30fa77||!_0x3e35f6||!_0x1c5013||_0x15faf6['length']>0x0||!_0x19e1a5[_0x5613c3(0x1ad)])continue;const _0x4ce180=_0x4f950d['get'](_0x19e1a5[_0x5613c3(0x1ad)]['toLowerCase']()),_0x2fea53=_0x4ce180??_0x19e1a5[_0x5613c3(0x1ad)];if(!isSafeHookDirectorySegment(_0x5df896))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x17e)+_0x5df896+_0x5613c3(0x148));if(!isSafeHookDirectorySegment(_0x2fea53))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x5df896+_0x5613c3(0x12f));if(_0x5df896===_0x2fea53)continue;const _0x10cf9b=_0x554b2b[_0x5613c3(0x15e)](_0x5df896)??{'datasetCode':_0x19e1a5[_0x5613c3(0x1ad)],'alias':_0x4ce180,'keyChanges':[]};if(_0x10cf9b['datasetCode']!==_0x19e1a5[_0x5613c3(0x1ad)])throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x5df896+_0x5613c3(0x16f));const _0x17b19c=_0x5613c3(0x156)+_0x2fea53+'/'+_0x30fa77+'/'+_0x3e35f6+'/'+_0x1c5013;try{resolveLocalFilePathFromLockKey(_0x5a0503,_0x1849db),resolveLocalFilePathFromLockKey(_0x5a0503,_0x17b19c);}catch(_0xbe3797){throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x1a5)+_0x1849db+'\x22:\x20'+(_0xbe3797 instanceof Error?_0xbe3797[_0x5613c3(0x125)]:String(_0xbe3797)));}_0x10cf9b['keyChanges'][_0x5613c3(0x198)]({'oldLockKey':_0x1849db,'newLockKey':_0x17b19c,'entry':_0x19e1a5}),_0x554b2b[_0x5613c3(0x159)](_0x5df896,_0x10cf9b);}const _0x46b74d=new Set([..._0x554b2b['values']()][_0x5613c3(0x168)](_0x24919c=>_0x24919c['keyChanges'][_0x5613c3(0x1a3)](_0x23cd6e=>_0x23cd6e['oldLockKey']))),_0x2a2322=new Map(),_0x28da3=new Map();for(const [_0x7ccf08,_0x183b26]of _0x554b2b){const _0x24882f=_0x183b26[_0x5613c3(0x143)]??_0x183b26['datasetCode'],_0x348ef4=hookDirectoryIdentity(_0x24882f),_0x92bb3f=_0x2a2322['get'](_0x348ef4);if(_0x92bb3f&&_0x92bb3f!==_0x7ccf08)throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x176)+_0x92bb3f+_0x5613c3(0x18e)+_0x7ccf08+_0x5613c3(0x140)+_0x24882f+_0x5613c3(0x17a));_0x2a2322['set'](_0x348ef4,_0x7ccf08);for(const _0x5b95c3 of _0x183b26['keyChanges']){const _0x9a8a89=_0x28da3[_0x5613c3(0x15e)](_0x5b95c3[_0x5613c3(0x144)]);if(_0x9a8a89&&_0x9a8a89!==_0x5b95c3[_0x5613c3(0x17d)])throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x130)+_0x9a8a89+_0x5613c3(0x18e)+_0x5b95c3[_0x5613c3(0x17d)]+'\x22:\x20both\x20target\x20\x22'+_0x5b95c3[_0x5613c3(0x144)]+_0x5613c3(0x141));if(_0x46b74d[_0x5613c3(0x184)](_0x5b95c3[_0x5613c3(0x144)]))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x14d)+_0x5b95c3[_0x5613c3(0x17d)]+_0x5613c3(0x11d)+_0x5b95c3[_0x5613c3(0x144)]+_0x5613c3(0x161));_0x28da3[_0x5613c3(0x159)](_0x5b95c3[_0x5613c3(0x144)],_0x5b95c3[_0x5613c3(0x17d)]);}}const _0x4f8ca8=new Map();for(const [_0x56e44b,_0x2a4926]of _0x4f950d){_0x4f8ca8[_0x5613c3(0x159)](hookDirectoryIdentity(_0x2a4926),_0x56e44b);}const _0x38b7dc=[];for(const [_0x4eff6b,_0x4f7a55]of _0x554b2b){const _0x1dc2d2=_0x4f7a55['alias']??_0x4f7a55['datasetCode'],_0x7bbe59=join(_0x5a0503['scriptsRootDir'],_0x5613c3(0x14e),_0x4eff6b),_0x56da17=join(_0x5a0503[_0x5613c3(0x14c)],_0x5613c3(0x14e),_0x1dc2d2),_0x4c61d=await directoryExists(_0x7bbe59),_0x4aff2a=await directoryExists(_0x56da17),_0x343097=_0x4c61d?_0x4aff2a?await sameDirectory(_0x7bbe59,_0x56da17)?_0x5613c3(0x13d):undefined:'move':_0x5613c3(0x16a);if(!_0x343097)throw CliErrors['validation'](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x192)+_0x1dc2d2+_0x5613c3(0x13e));const _0x5c6b22=_0x4f8ca8[_0x5613c3(0x15e)](hookDirectoryIdentity(_0x4eff6b));if(_0x5c6b22&&_0x5c6b22!==_0x4f7a55[_0x5613c3(0x1ad)][_0x5613c3(0x179)]()){const _0x313e27=new Set(_0x4f7a55[_0x5613c3(0x149)][_0x5613c3(0x1a3)](_0x2a7540=>_0x2a7540[_0x5613c3(0x17d)])),_0xcf4dc6=_0x514f1c[_0x5613c3(0x153)](_0x14c373=>_0x14c373['type']==='HOOK'&&_0x14c373[_0x5613c3(0x143)]!=null&&hookDirectoryIdentity(_0x14c373[_0x5613c3(0x143)])===hookDirectoryIdentity(_0x4eff6b)&&!_0x313e27[_0x5613c3(0x184)](_0x14c373[_0x5613c3(0x180)]));if(_0xcf4dc6[_0x5613c3(0x163)]>0x0)throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x183));}const _0x3fb02d=_0x4f8ca8['get'](hookDirectoryIdentity(_0x1dc2d2));if(_0x3fb02d&&_0x3fb02d!==_0x4f7a55[_0x5613c3(0x1ad)][_0x5613c3(0x179)]())throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x192)+_0x1dc2d2+_0x5613c3(0x129));for(const _0x50b89a of _0x4f7a55[_0x5613c3(0x149)]){const _0x4f40fb=_0x1a5360[_0x5613c3(0x17c)][_0x50b89a[_0x5613c3(0x144)]];if(_0x4f40fb&&!_0x46b74d['has'](_0x50b89a[_0x5613c3(0x144)])&&!sameHookIdentity(_0x50b89a[_0x5613c3(0x1af)],_0x4f40fb))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x192)+_0x1dc2d2+_0x5613c3(0x154));}_0x38b7dc[_0x5613c3(0x198)]({'oldDirectory':_0x4eff6b,'newDirectory':_0x1dc2d2,'oldDirectoryPath':_0x7bbe59,'newDirectoryPath':_0x56da17,'mode':_0x343097,'alias':_0x4f7a55[_0x5613c3(0x143)],'keyChanges':_0x4f7a55[_0x5613c3(0x149)]});}const _0x3d2c8b={..._0x1a5360['functions']},_0x15a2e5=new Map(),_0xf5438c=new Map();for(const _0x100727 of _0x38b7dc){const _0x594280=_0x100727['mode']!=='rekey';_0x594280&&_0xf5438c[_0x5613c3(0x159)](hookDirectoryIdentity(_0x100727[_0x5613c3(0x11a)]),_0x100727[_0x5613c3(0x18a)]);for(const _0x551105 of _0x100727[_0x5613c3(0x149)]){const _0x1d5800=_0x3d2c8b[_0x551105[_0x5613c3(0x144)]],_0x3e7bf2=_0x594280?_0x551105[_0x5613c3(0x1af)]:_0x1d5800??_0x551105['entry'];_0x3d2c8b[_0x551105[_0x5613c3(0x144)]]=canonicalizeHookEntry(_0x3e7bf2,_0x100727[_0x5613c3(0x143)]),delete _0x3d2c8b[_0x551105[_0x5613c3(0x17d)]],_0x594280&&_0x15a2e5[_0x5613c3(0x159)](_0x551105[_0x5613c3(0x144)],resolveLocalFilePathFromLockKey(_0x5a0503,_0x551105['oldLockKey']));}}return{'migrations':_0x38b7dc,'projectedFunctions':_0x3d2c8b,'sourceFilePathByNewLockKey':_0x15a2e5,'sourceDirectoryPathByNewDirectory':_0xf5438c};}function resolveMigratedSourceFilePath(_0x47c175,_0x4a7f4f){const _0x283d23=a43_0x39c143;if(!_0x47c175||!_0x4a7f4f)return undefined;const _0x3e4f9a=_0x47c175[_0x283d23(0x19d)][_0x283d23(0x15e)](_0x4a7f4f[_0x283d23(0x180)]);if(_0x3e4f9a)return _0x3e4f9a;if(_0x4a7f4f['type']!==_0x283d23(0x14e))return undefined;const [,_0xef5c6c,..._0x40db01]=_0x4a7f4f[_0x283d23(0x180)]['split']('/');if(!_0xef5c6c||_0x40db01[_0x283d23(0x163)]===0x0)return undefined;const _0x1c8e54=_0x47c175['sourceDirectoryPathByNewDirectory'][_0x283d23(0x15e)](hookDirectoryIdentity(_0xef5c6c));return _0x1c8e54?join(_0x1c8e54,..._0x40db01)+_0x283d23(0x199):undefined;}function sameHookIdentity(_0xb81684,_0x4f0d3d){const _0xf2d236=a43_0x39c143;return _0xb81684[_0xf2d236(0x191)]===_0x4f0d3d[_0xf2d236(0x191)]&&_0xb81684['datasetCode']===_0x4f0d3d[_0xf2d236(0x1ad)]&&_0xb81684[_0xf2d236(0x16b)]===_0x4f0d3d[_0xf2d236(0x16b)]&&_0xb81684[_0xf2d236(0x1a4)]===_0x4f0d3d['functionNode'];}function canonicalizeHookEntry(_0x509fbf,_0x14c2c7){const {alias:_0x12d37f,..._0x4c77ff}=_0x509fbf;return _0x14c2c7?{..._0x4c77ff,'alias':_0x14c2c7}:_0x4c77ff;}function hookDirectoryIdentity(_0x458255){const _0x75b125=a43_0x39c143;return _0x458255['normalize']('NFC')[_0x75b125(0x179)]();}function isSafeHookDirectorySegment(_0x1b9dcf){return isSafeLockKeySegment(_0x1b9dcf);}async function sameDirectory(_0x4ba62a,_0x1f4d13){const _0x292111=a43_0x39c143,[_0x1f5d45,_0x988180]=await Promise[_0x292111(0x187)]([stat(_0x4ba62a),stat(_0x1f4d13)]);return _0x1f5d45[_0x292111(0x122)]===_0x988180[_0x292111(0x122)]&&_0x1f5d45[_0x292111(0x152)]===_0x988180[_0x292111(0x152)];}async function applyHookDirectoryMigration(_0x1b7a03,_0x5e02ce){const _0x4392ea=a43_0x39c143,_0x58e5a2=_0x5e02ce[_0x4392ea(0x17c)],_0x1bf617=_0x5e02ce[_0x4392ea(0x1a6)],_0x20d68a=[],_0x3c4d23=async()=>{const _0x5063d5=_0x4392ea,_0xf83419=[];_0x5e02ce['functions']=_0x58e5a2,_0x5e02ce[_0x5063d5(0x1a6)]=_0x1bf617;for(const {migration:_0x50e179,temporaryPath:_0x57153f}of[..._0x20d68a]['reverse']()){try{_0x57153f?(await rename(_0x50e179['newDirectoryPath'],_0x57153f),await rename(_0x57153f,_0x50e179['oldDirectoryPath'])):await rename(_0x50e179[_0x5063d5(0x1a8)],_0x50e179[_0x5063d5(0x18a)]);}catch(_0x55244f){_0xf83419[_0x5063d5(0x198)](new Error(_0x5063d5(0x1a7)+_0x50e179[_0x5063d5(0x174)]+_0x5063d5(0x193)+_0x50e179[_0x5063d5(0x11a)]+'\x22:\x20'+(_0x55244f instanceof Error?_0x55244f['message']:String(_0x55244f))));}}return _0xf83419;};try{for(const _0x5a439f of _0x1b7a03[_0x4392ea(0x15d)]){if(_0x5a439f[_0x4392ea(0x139)]===_0x4392ea(0x195))await ensureParentDirectory(_0x5a439f[_0x4392ea(0x1a8)]),await rename(_0x5a439f[_0x4392ea(0x18a)],_0x5a439f['newDirectoryPath']),_0x20d68a[_0x4392ea(0x198)]({'migration':_0x5a439f});else{if(_0x5a439f[_0x4392ea(0x139)]===_0x4392ea(0x13d)){const _0x2aca31=join(dirname(_0x5a439f['oldDirectoryPath']),'.hook-directory-migrate-'+randomUUID());await rename(_0x5a439f['oldDirectoryPath'],_0x2aca31);try{await rename(_0x2aca31,_0x5a439f['newDirectoryPath']);}catch(_0x64e464){try{await rename(_0x2aca31,_0x5a439f[_0x4392ea(0x18a)]);}catch(_0x49cee5){throw withRollbackErrors(_0x64e464,_0x4392ea(0x145)+_0x5a439f['oldDirectory']+_0x4392ea(0x192)+_0x5a439f['newDirectory']+_0x4392ea(0x11b)+_0x2aca31+_0x4392ea(0x131),[new Error(_0x4392ea(0x13c)+_0x2aca31+_0x4392ea(0x192)+_0x5a439f[_0x4392ea(0x174)]+'\x22:\x20'+(_0x49cee5 instanceof Error?_0x49cee5[_0x4392ea(0x125)]:String(_0x49cee5)))]);}throw _0x64e464;}_0x20d68a[_0x4392ea(0x198)]({'migration':_0x5a439f,'temporaryPath':_0x2aca31});}}}return _0x5e02ce[_0x4392ea(0x17c)]=_0x1b7a03[_0x4392ea(0x133)],{'rollback':_0x3c4d23};}catch(_0xd503af){const _0x37984b=await _0x3c4d23();throw withRollbackErrors(_0xd503af,_0x4392ea(0x165),_0x37984b);}}async function confirmForce(){const _0x2e80fa=a43_0x39c143,_0xd9044c=createInterface({'input':process[_0x2e80fa(0x142)],'output':process[_0x2e80fa(0x19c)]}),_0x271e08=await new Promise(_0x13fcf6=>{const _0x7e8c09=_0x2e80fa;_0xd9044c[_0x7e8c09(0x171)](_0x7e8c09(0x194),_0x13fcf6);});return _0xd9044c['close'](),['y','yes']['includes'](_0x271e08[_0x2e80fa(0x1ab)]()['toLowerCase']());}
|