@lovrabet/rabetbase-cli 2.5.10-beta.3 → 2.5.10-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/cross-db-analysis-shared.js +1 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +1 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/page-list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +1 -1
- package/lib/services/dataset-design/commands.js +1 -1
- package/lib/services/dataset-design/contract.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +4 -4
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x2ee5d4=a34_0x314b;(function(_0x4db38d,_0x132532){const _0x24244e=a34_0x314b,_0x401ac8=_0x4db38d();while(!![]){try{const _0x1be637=-parseInt(_0x24244e(0x8f))/0x1*(parseInt(_0x24244e(0x83))/0x2)+parseInt(_0x24244e(0x86))/0x3*(-parseInt(_0x24244e(0x89))/0x4)+-parseInt(_0x24244e(0x8b))/0x5+parseInt(_0x24244e(0x85))/0x6*(parseInt(_0x24244e(0x7e))/0x7)+-parseInt(_0x24244e(0x81))/0x8+parseInt(_0x24244e(0x7c))/0x9+parseInt(_0x24244e(0x88))/0xa*(parseInt(_0x24244e(0x7d))/0xb);if(_0x1be637===_0x132532)break;else _0x401ac8['push'](_0x401ac8['shift']());}catch(_0x3ce4ec){_0x401ac8['push'](_0x401ac8['shift']());}}}(a34_0x2160,0xbf47d));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a34_0x314b(_0x3d88e4,_0x39f743){_0x3d88e4=_0x3d88e4-0x74;const _0x2160b1=a34_0x2160();let _0x314b5a=_0x2160b1[_0x3d88e4];return _0x314b5a;}import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';const CREATE_PATH=a34_0x2ee5d4(0x79),UPDATE_PATH=a34_0x2ee5d4(0x75);export const appConfigSet={'service':a34_0x2ee5d4(0x8e),'command':a34_0x2ee5d4(0x91),'description':a34_0x2ee5d4(0x80),'risk':'write','args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x2ee5d4(0x82),'type':a34_0x2ee5d4(0x8d),'description':'Read\x20config\x20value\x20from\x20file'}],async 'validate'(_0x214e58){readKeyArg(_0x214e58),readOptionalTags(_0x214e58),assertSingleValueSource(_0x214e58);},async 'dryRun'(_0x5e47f5){const _0x502f5f=a34_0x2ee5d4,_0x3f36dd=readKeyArg(_0x5e47f5),_0xab5365=readOptionalTags(_0x5e47f5),_0x15f016=assertSingleValueSource(_0x5e47f5);await assertValueSourceReadable(_0x15f016);const _0x55f7ec=await withAppConfigApiBoundary('get',{'appCode':_0x5e47f5[_0x502f5f(0x7a)],'key':_0x3f36dd},()=>getAppConfigByKey(_0x5e47f5[_0x502f5f(0x7a)],_0x3f36dd)),_0x5d3eae=_0x55f7ec?_0x502f5f(0x78):_0x502f5f(0x90),_0x48ddc6=_0x55f7ec?projectAppConfig(_0x55f7ec):null,_0x5982f4=plannedAppConfig({'appCode':_0x5e47f5[_0x502f5f(0x7a)],'key':_0x3f36dd,'tags':_0xab5365??_0x55f7ec?.['tags'],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x5d3eae,'appCode':_0x5e47f5[_0x502f5f(0x7a)],'key':_0x3f36dd,'before':_0x48ddc6,'after':_0x5982f4,'dryRun':!![]}),{'method':_0x502f5f(0x7f),'url':_0x5d3eae===_0x502f5f(0x78)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x1c7a3a){const _0x3bb415=a34_0x2ee5d4,_0x25b4a6=readKeyArg(_0x1c7a3a),_0x1dd0a4=readOptionalTags(_0x1c7a3a),_0x3e4356=await withAppConfigApiBoundary(_0x3bb415(0x77),{'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6},()=>getAppConfigByKey(_0x1c7a3a['appCode'],_0x25b4a6)),_0x333b96=_0x3e4356?projectAppConfig(_0x3e4356):null,_0x4cc34c=_0x3e4356?_0x3bb415(0x78):_0x3bb415(0x90),{value:_0x355e2a,warnings:_0x4fd9da}=await readAppConfigValue(_0x1c7a3a),_0x5050ea={'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6,'value':_0x355e2a,'tags':_0x1dd0a4??_0x3e4356?.[_0x3bb415(0x7b)]??undefined};await withAppConfigApiBoundary(_0x4cc34c,{'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6},async()=>{const _0x4bfeb5=_0x3bb415;_0x3e4356?await updateAppConfig({..._0x5050ea,'id':requireAppConfigId(_0x3e4356,_0x25b4a6,_0x1c7a3a[_0x4bfeb5(0x7a)])}):await createAppConfig(_0x5050ea);});const _0x387638=await withAppConfigApiBoundary('get',{'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6},()=>getAppConfigByKey(_0x1c7a3a[_0x3bb415(0x7a)],_0x25b4a6)),_0x1a51fa=_0x387638?projectAppConfig(_0x387638):plannedAppConfig({'appCode':_0x1c7a3a['appCode'],'key':_0x25b4a6,'tags':_0x5050ea[_0x3bb415(0x7b)],'hasValue':_0x355e2a!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x4cc34c,'appCode':_0x1c7a3a[_0x3bb415(0x7a)],'key':_0x25b4a6,'before':_0x333b96,'after':_0x1a51fa,'dryRun':![],'warnings':_0x4fd9da}),'message':(_0x4cc34c==='update'?_0x3bb415(0x92):_0x3bb415(0x74))+_0x3bb415(0x76)+_0x25b4a6};}};function requireAppConfigId(_0x28c0db,_0xf60de8,_0x35373a){const _0x5e01f1=a34_0x2ee5d4;if(typeof _0x28c0db['id']===_0x5e01f1(0x8a)&&Number[_0x5e01f1(0x8c)](_0x28c0db['id'])&&_0x28c0db['id']>0x0)return _0x28c0db['id'];throw CliErrors['apiError'](_0x5e01f1(0x87)+_0xf60de8+_0x5e01f1(0x84)+_0x35373a);}function a34_0x2160(){const _0x3d15a6=['get','update','/smartapi/app-config/create','appCode','tags','12773718CYeKau','27995kQdoFt','2681lETNKs','POST','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','5794480Mipmrj','file','2699156huxrJB',',\x20appCode=','7974WbohUa','3jwuhXD','App\x20config\x20server\x20id\x20missing\x20for\x20key=','8790kIMZQn','3119076ynENII','number','2641110jcyHta','isFinite','string','app-config','1DGkYVc','create','set','Updated','Created','/smartapi/app-config/update','\x20app\x20config\x20'];a34_0x2160=function(){return _0x3d15a6;};return a34_0x2160();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x257a57=a35_0x2c8a;(function(_0x55581f,_0x592da2){const _0xeb16f=a35_0x2c8a,_0x2e51f7=_0x55581f();while(!![]){try{const _0x362c75=-parseInt(_0xeb16f(0xaf))/0x1+-parseInt(_0xeb16f(0x85))/0x2*(-parseInt(_0xeb16f(0xa8))/0x3)+-parseInt(_0xeb16f(0x88))/0x4+-parseInt(_0xeb16f(0x8c))/0x5*(parseInt(_0xeb16f(0x7f))/0x6)+parseInt(_0xeb16f(0xb5))/0x7*(-parseInt(_0xeb16f(0xb4))/0x8)+parseInt(_0xeb16f(0x93))/0x9*(-parseInt(_0xeb16f(0x98))/0xa)+parseInt(_0xeb16f(0xa0))/0xb;if(_0x362c75===_0x592da2)break;else _0x2e51f7['push'](_0x2e51f7['shift']());}catch(_0x328b98){_0x2e51f7['push'](_0x2e51f7['shift']());}}}(a35_0x2301,0xe8dbe));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';function a35_0x2301(){const _0xabaa8c=['Missing\x20app-config\x20key.','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','length','10IpSUkc','hasValue','warnings','env','Failed\x20to\x20','Missing\x20app-config\x20value\x20source.','flag','args','43766690HZOEfV','end','data','error','utf8','Environment\x20variable\x20is\x20not\x20set:\x20','App\x20config\x20value\x20source\x20is\x20ambiguous.','path','117kZlmwe','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','argument','Runtime\x20app-config\x20key','value\x20is\x20redacted','from-env','url','935983ZfsKiA','apiError','slice','appCode','name','87072AHDaZZ','525gVexoK','once','file','stdin','key','kind','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','push','Read\x20config\x20value\x20from\x20stdin','Value\x20file\x20is\x20not\x20readable:\x20','143268LTEdgn','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','tags','str','trim','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','62198XHVjEQ','valueRedacted','value','4511308UhucWn','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','join','boolean','120yVVtaf','operation','gmtModified','string','reveal','gmtCreate','validation','7062111enPDCe','after'];a35_0x2301=function(){return _0xabaa8c;};return a35_0x2301();}export const KEY_ARG={'name':a35_0x257a57(0xb9),'description':a35_0x257a57(0xab),'required':!![]};export const VALUE_ARG={'name':a35_0x257a57(0x87),'description':'Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','required':![]};export const TAGS_FLAG={'name':'tags','type':a35_0x257a57(0x8f),'description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':a35_0x257a57(0xb8),'type':'boolean','description':a35_0x257a57(0xbd),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x257a57(0xad),'type':a35_0x257a57(0x8f),'description':a35_0x257a57(0xbb)};export const REVEAL_FLAG={'name':a35_0x257a57(0x90),'type':a35_0x257a57(0x8b),'description':a35_0x257a57(0x96),'default':![]};export function readKeyArg(_0x35491f){const _0x336186=a35_0x257a57,_0x51fe42=_0x35491f[_0x336186(0x9f)][0x0]?.[_0x336186(0x83)]()??'';return validateKey(_0x51fe42),_0x51fe42;}export function readOptionalTags(_0xc8d7a8){const _0x4e93e3=a35_0x257a57,_0x1f9af7=_0xc8d7a8[_0x4e93e3(0x82)](_0x4e93e3(0x81))[_0x4e93e3(0x83)]();if(!_0x1f9af7)return undefined;if(_0x1f9af7['length']>0x20)throw CliErrors['validation']('App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.');return _0x1f9af7;}export function validateKey(_0x22fbe5){const _0x4c476d=a35_0x257a57;if(!_0x22fbe5)throw CliErrors['validation'](_0x4c476d(0x95));if(_0x22fbe5[_0x4c476d(0x97)]>0x100)throw CliErrors[_0x4c476d(0x92)](_0x4c476d(0x84));}export function projectAppConfig(_0x589658,_0x4f1b63){const _0x3e7462=a35_0x257a57,_0x547fbf=_0x589658[_0x3e7462(0x87)]!==undefined&&_0x589658[_0x3e7462(0x87)]!==null&&_0x589658[_0x3e7462(0x87)]!=='',_0x4a1f12={'appCode':_0x589658[_0x3e7462(0xb2)],'key':_0x589658[_0x3e7462(0xb9)],'tags':_0x589658[_0x3e7462(0x81)]??undefined,'hasValue':_0x547fbf,'valueRedacted':_0x547fbf&&!_0x4f1b63?.[_0x3e7462(0x90)],'gmtCreate':_0x589658[_0x3e7462(0x91)],'gmtModified':_0x589658[_0x3e7462(0x8e)]};return _0x4f1b63?.[_0x3e7462(0x90)]&&(_0x4a1f12[_0x3e7462(0x87)]=_0x589658[_0x3e7462(0x87)]??'',_0x4a1f12[_0x3e7462(0x86)]=![]),_0x4a1f12;}export function plannedAppConfig(_0xabb819){const _0x42dfad=a35_0x257a57,_0x18c6a6=_0xabb819[_0x42dfad(0x99)]??!![];return{'appCode':_0xabb819[_0x42dfad(0xb2)],'key':_0xabb819[_0x42dfad(0xb9)],'tags':_0xabb819[_0x42dfad(0x81)]??undefined,'hasValue':_0x18c6a6,'valueRedacted':_0x18c6a6};}export function buildMutationData(_0x260ca2){const _0x2780f9=a35_0x257a57;return{'operation':_0x260ca2[_0x2780f9(0x8d)],'selector':{'appCode':_0x260ca2[_0x2780f9(0xb2)],'key':_0x260ca2[_0x2780f9(0xb9)]},'before':_0x260ca2['before'],'after':_0x260ca2[_0x2780f9(0x94)],'dryRun':_0x260ca2['dryRun'],'warnings':_0x260ca2[_0x2780f9(0x9a)]??[]};}export async function withAppConfigApiBoundary(_0x328114,_0x3272d2,_0x3d5d07){const _0xed7d9=a35_0x257a57;try{return await _0x3d5d07();}catch{const _0xdb591b=['appCode:\x20'+_0x3272d2[_0xed7d9(0xb2)]];if(_0x3272d2[_0xed7d9(0xb9)])_0xdb591b['push']('key:\x20'+_0x3272d2[_0xed7d9(0xb9)]);_0xdb591b[_0xed7d9(0xbc)](_0xed7d9(0xac));throw CliErrors[_0xed7d9(0xb0)](_0xed7d9(0x9c)+_0x328114+'\x20app\x20config.',_0xdb591b['join'](';\x20')+'.');}}function a35_0x2c8a(_0x1b93b0,_0x28f3f8){_0x1b93b0=_0x1b93b0-0x7f;const _0x2301ce=a35_0x2301();let _0x2c8a60=_0x2301ce[_0x1b93b0];return _0x2c8a60;}export function asAppConfigDryRunResult(_0x3e660f,_0x44fe09){const _0x2e287f=a35_0x257a57;return Object['defineProperties'](_0x3e660f,{'method':{'value':_0x44fe09['method'],'enumerable':![]},'url':{'value':_0x44fe09[_0x2e287f(0xae)],'enumerable':![]}});}export function assertSingleValueSource(_0x26f598){const _0x24a437=a35_0x257a57,_0x4787d7=[];_0x26f598['args']['length']>0x1&&_0x4787d7[_0x24a437(0xbc)]({'kind':_0x24a437(0xaa),'value':_0x26f598[_0x24a437(0x9f)][_0x24a437(0xb1)](0x1)[_0x24a437(0x8a)]('\x20')});const _0x3f513d=_0x26f598[_0x24a437(0x9e)](_0x24a437(0x87));_0x3f513d!==undefined&&_0x3f513d!==null&&_0x4787d7[_0x24a437(0xbc)]({'kind':'argument','value':String(_0x3f513d)});_0x26f598['bool'](_0x24a437(0xb8))&&_0x4787d7[_0x24a437(0xbc)]({'kind':_0x24a437(0xb8)});const _0x4b8563=_0x26f598[_0x24a437(0x82)](_0x24a437(0xad))[_0x24a437(0x83)]();_0x4b8563&&_0x4787d7[_0x24a437(0xbc)]({'kind':_0x24a437(0x9b),'name':_0x4b8563});const _0x2da5c5=_0x26f598[_0x24a437(0x82)]('file')[_0x24a437(0x83)]();_0x2da5c5&&_0x4787d7['push']({'kind':_0x24a437(0xb7),'path':_0x2da5c5});if(_0x4787d7[_0x24a437(0x97)]===0x0)throw CliErrors['validation'](_0x24a437(0x9d),_0x24a437(0x89));if(_0x4787d7['length']>0x1)throw CliErrors[_0x24a437(0x92)](_0x24a437(0xa6),_0x24a437(0x80));return _0x4787d7[0x0];}export async function assertValueSourceReadable(_0x4c3a87){const _0xc1d764=a35_0x257a57;if(_0x4c3a87[_0xc1d764(0xba)]==='env'&&!(_0x4c3a87[_0xc1d764(0xb3)]in process.env))throw CliErrors[_0xc1d764(0x92)](_0xc1d764(0xa5)+_0x4c3a87[_0xc1d764(0xb3)]);if(_0x4c3a87[_0xc1d764(0xba)]===_0xc1d764(0xb7))try{await access(_0x4c3a87[_0xc1d764(0xa7)]);}catch{throw CliErrors[_0xc1d764(0x92)](_0xc1d764(0xbe)+_0x4c3a87[_0xc1d764(0xa7)]);}}export async function readAppConfigValue(_0x103755){const _0x4f8f22=a35_0x257a57,_0xcb9635=assertSingleValueSource(_0x103755),_0x430400=[];if(_0xcb9635['kind']===_0x4f8f22(0xaa))return _0x430400['push'](_0x4f8f22(0xa9)),{'value':_0xcb9635[_0x4f8f22(0x87)]??'','source':_0xcb9635[_0x4f8f22(0xba)],'warnings':_0x430400};if(_0xcb9635[_0x4f8f22(0xba)]===_0x4f8f22(0xb8))return{'value':await readStdin(),'source':_0xcb9635['kind'],'warnings':_0x430400};if(_0xcb9635['kind']===_0x4f8f22(0x9b)){if(!(_0xcb9635[_0x4f8f22(0xb3)]in process.env))throw CliErrors[_0x4f8f22(0x92)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0xcb9635[_0x4f8f22(0xb3)]);return{'value':process.env[_0xcb9635.name]??'','source':_0xcb9635[_0x4f8f22(0xba)],'warnings':_0x430400};}return{'value':await readFile(_0xcb9635[_0x4f8f22(0xa7)],'utf8'),'source':_0xcb9635[_0x4f8f22(0xba)],'warnings':_0x430400};}function readStdin(){return new Promise((_0x5d2df6,_0x41f93a)=>{const _0x163b4d=a35_0x2c8a;let _0x5f28c6='';process[_0x163b4d(0xb8)]['setEncoding'](_0x163b4d(0xa4)),process['stdin']['on'](_0x163b4d(0xa2),_0x573959=>{_0x5f28c6+=_0x573959;}),process[_0x163b4d(0xb8)]['once'](_0x163b4d(0xa1),()=>_0x5d2df6(_0x5f28c6)),process[_0x163b4d(0xb8)][_0x163b4d(0xb6)](_0x163b4d(0xa3),_0x41f93a);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a36_0x2d21(_0x15bc5b,_0x35a440){_0x15bc5b=_0x15bc5b-0x11b;const _0x154f4d=a36_0x154f();let _0x2d21cb=_0x154f4d[_0x15bc5b];return _0x2d21cb;}function a36_0x154f(){const _0x75db7f=['boolean','1632063NgVTbN','5382459mYfzGV','7338YTpQUJ','3627176vNWzlV','79583bxrgXX','102EPLpXY','logout','✓\x20Logged\x20out','log','bool','write','1612325QkJhdH','nonInteractive','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','190NtQTUO','Clear\x20login\x20session','login','!\x20Not\x20logged\x20in','yes','Login\x20via\x20browser','1058144tbpZeV','../../auth/auth-server-ui.js'];a36_0x154f=function(){return _0x75db7f;};return a36_0x154f();}const a36_0x185b2c=a36_0x2d21;(function(_0x2da89f,_0x37b078){const _0x4a05db=a36_0x2d21,_0x1f85f4=_0x2da89f();while(!![]){try{const _0x81a2b9=-parseInt(_0x4a05db(0x11f))/0x1*(-parseInt(_0x4a05db(0x12b))/0x2)+-parseInt(_0x4a05db(0x11d))/0x3+parseInt(_0x4a05db(0x120))/0x4+-parseInt(_0x4a05db(0x128))/0x5+-parseInt(_0x4a05db(0x122))/0x6*(-parseInt(_0x4a05db(0x121))/0x7)+parseInt(_0x4a05db(0x131))/0x8+-parseInt(_0x4a05db(0x11e))/0x9;if(_0x81a2b9===_0x37b078)break;else _0x1f85f4['push'](_0x1f85f4['shift']());}catch(_0x5c8532){_0x1f85f4['push'](_0x1f85f4['shift']());}}}(a36_0x154f,0x7180c));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':a36_0x185b2c(0x12d),'description':a36_0x185b2c(0x130),'risk':a36_0x185b2c(0x127),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x185b2c(0x12f),'type':a36_0x185b2c(0x11c),'description':a36_0x185b2c(0x12a),'default':![]}],async 'execute'(_0xdc22dd){const _0x2cfb6c=a36_0x185b2c,{runAuthServer:_0x1768eb}=await import(_0x2cfb6c(0x11b));return await _0x1768eb({'autoYes':_0xdc22dd[_0x2cfb6c(0x126)](_0x2cfb6c(0x12f)),'nonInteractive':_0xdc22dd[_0x2cfb6c(0x129)]}),{'ok':!![]};}},{'service':'auth','command':a36_0x185b2c(0x123),'description':a36_0x185b2c(0x12c),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x4edc15){const _0x50a6c9=a36_0x185b2c;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x50a6c9(0x125)](_0x50a6c9(0x124))):console[_0x50a6c9(0x125)](_0x50a6c9(0x12e)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x501c99=a37_0x2d92;(function(_0x17627a,_0x5d3213){const _0x3629d0=a37_0x2d92,_0x4775d1=_0x17627a();while(!![]){try{const _0x468240=-parseInt(_0x3629d0(0x105))/0x1+-parseInt(_0x3629d0(0x127))/0x2+-parseInt(_0x3629d0(0xf3))/0x3+parseInt(_0x3629d0(0x101))/0x4+-parseInt(_0x3629d0(0x146))/0x5+parseInt(_0x3629d0(0xfd))/0x6*(parseInt(_0x3629d0(0x12a))/0x7)+parseInt(_0x3629d0(0x145))/0x8;if(_0x468240===_0x5d3213)break;else _0x4775d1['push'](_0x4775d1['shift']());}catch(_0x37d360){_0x4775d1['push'](_0x4775d1['shift']());}}}(a37_0x1e4a,0xb2d7b));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_0x1e4a(){const _0x259edd=['\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','HOOK\x20requires\x20alias/operation/node\x20options.','Operation\x20type\x20(HOOK\x20only)','selectedAppName','datasetcode','entries','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','source','7592040uDZiMK','1216900ZfCVqh','datasetId','Function\x20name\x20(valid\x20JS\x20identifier)','appCode','name','.js\x0a','UNKNOWN',']\x20(','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','当前请求参数','\x0a\x20*\x20[平台配置]\x20','mergedCli','COMMON','description','ENDPOINT','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','type','length','nonInteractive','before','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','datasetCode','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','707946vnKcME','stdin','Select\x20dataset:','profileName','Dataset\x20not\x20found\x20for\x20code\x20\x22','validation','\x20function:\x20','Invalid\x20function\x20name\x20\x22','Select\x20trigger\x20node:','functionNode','5109114UzQSst','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','\x22\x20not\x20found\x20for\x20dataset\x20','apiDir','4780724psoUse','Available:\x20','Available\x20aliases:\x20','after','469563IiStRX','No\x20datasets\x20found\x20for\x20this\x20app.','Trigger\x20node\x20(HOOK\x20only)','function-node','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','.js','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','HOOK','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','keys','string','scriptsRootDir','trim','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','tableName','No\x20operation\x20types\x20found\x20for\x20dataset\x20','File\x20already\x20exists:\x20','write','join','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','/COMMON/','\x22\x20not\x20found.\x20','code','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','find','alias','operation-type','修改后的请求参数','Invalid\x20dataset\x20selection.','create','isInteger','close','2628482KjbujO','Operation\x20type\x20\x22','No\x20model\x20aliases\x20found.\x20Run\x20`','7iOgfiv','/**\x0a\x20*\x20','bff','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','stderr','filePath','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Created\x20','str','utf8','parseInt','map','修改后的响应结果','operationType','\x22.\x20','\x20api\x20pull`\x20to\x20refresh.','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','\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','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'];a37_0x1e4a=function(){return _0x259edd;};return a37_0x1e4a();}function a37_0x2d92(_0x656473,_0x2033e2){_0x656473=_0x656473-0xe6;const _0x1e4a13=a37_0x1e4a();let _0x2d9281=_0x1e4a13[_0x656473];return _0x2d9281;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x501c99(0x12c),'command':a37_0x501c99(0x124),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':'read','flags':[{'name':a37_0x501c99(0xec),'type':'string','required':!![],'enum':[a37_0x501c99(0xe8),a37_0x501c99(0xea),'HOOK'],'description':'Script\x20type'},{'name':a37_0x501c99(0x14a),'type':a37_0x501c99(0x110),'required':!![],'description':a37_0x501c99(0x148)},{'name':'description','type':a37_0x501c99(0x110),'description':'Script\x20description'},{'name':a37_0x501c99(0x120),'type':'string','description':a37_0x501c99(0x13a)},{'name':a37_0x501c99(0x141),'type':a37_0x501c99(0x110),'description':a37_0x501c99(0x114)},{'name':'operation-type','type':a37_0x501c99(0x110),'description':a37_0x501c99(0x13f)},{'name':a37_0x501c99(0x108),'type':a37_0x501c99(0x110),'description':a37_0x501c99(0x107),'enum':[a37_0x501c99(0xef),a37_0x501c99(0x104)]}],async 'validate'(_0x527de6){const _0x113c48=a37_0x501c99,_0x2a3987=_0x527de6[_0x113c48(0x132)](_0x113c48(0x14a));if(!isValidBffFunctionName(_0x2a3987))throw CliErrors[_0x113c48(0xf8)](_0x113c48(0xfa)+_0x2a3987+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x38cbee){const _0x3b7125=a37_0x501c99,_0xa9c7ec=loadBffProjectConfig(_0x38cbee[_0x3b7125(0x149)]),_0x495a63=_0x38cbee['str']('type'),_0x185e33=_0x38cbee[_0x3b7125(0x132)](_0x3b7125(0x14a)),_0x4e99ca=_0x38cbee[_0x3b7125(0x132)](_0x3b7125(0xe9))||undefined,_0x174b53=_0x495a63==='HOOK'?await resolveHookOptions(_0xa9c7ec,_0x38cbee):undefined,_0x2f6538=buildFilePath(_0xa9c7ec,_0x495a63,_0x185e33,_0x174b53);if(await fileExists(_0x2f6538))throw CliErrors[_0x3b7125(0xf8)](_0x3b7125(0x117)+_0x2f6538);await mkdir(dirname(_0x2f6538),{'recursive':!![]});const _0x3e6ab8=generateTemplate(_0x495a63,_0x185e33,_0x38cbee[_0x3b7125(0x149)],_0x4e99ca,_0x174b53);await writeFile(_0x2f6538,_0x3e6ab8,_0x3b7125(0x133));const _0xd71f7a={'type':_0x495a63,'name':_0x185e33,'path':_0x2f6538};if(_0x4e99ca)_0xd71f7a[_0x3b7125(0xe9)]=_0x4e99ca;if(_0x174b53){if(_0x174b53['alias'])_0xd71f7a[_0x3b7125(0x120)]=_0x174b53[_0x3b7125(0x120)];_0xd71f7a[_0x3b7125(0xf1)]=_0x174b53[_0x3b7125(0xf1)],_0xd71f7a[_0x3b7125(0x137)]=_0x174b53[_0x3b7125(0x137)],_0xd71f7a[_0x3b7125(0xfc)]=_0x174b53[_0x3b7125(0xfc)];}return{'ok':!![],'data':_0xd71f7a,'message':_0x3b7125(0x131)+_0x495a63+_0x3b7125(0xf9)+_0x185e33};}};async function resolveHookOptions(_0x337bcb,_0x3bf0b8){const _0x1c9e9a=a37_0x501c99,_0x5a3100=resolveApiModelSource(_0x3bf0b8[_0x1c9e9a(0x100)],_0x3bf0b8[_0x1c9e9a(0x149)],_0x3bf0b8[_0x1c9e9a(0x140)]||_0x3bf0b8[_0x1c9e9a(0xe7)]?.['currentApp']||_0x3bf0b8[_0x1c9e9a(0xe7)]?.['defaultApp']),_0x50ab2e=loadAliasMap(_0x3bf0b8['apiDir'],undefined,_0x5a3100[_0x1c9e9a(0x12f)],_0x5a3100[_0x1c9e9a(0xf6)]),_0x281d8d=_0x50ab2e[_0x1c9e9a(0xed)]>0x0;let _0x32c0db,_0x267526,_0x471786;const _0x2c6703=_0x3bf0b8['str'](_0x1c9e9a(0x120)),_0x118b7e=_0x3bf0b8[_0x1c9e9a(0x132)](_0x1c9e9a(0x141));if(_0x2c6703){const _0x1d02b6=resolveAlias(_0x3bf0b8['apiDir'],_0x2c6703,undefined,_0x5a3100['filePath'],_0x5a3100[_0x1c9e9a(0xf6)]);if(!_0x1d02b6){const _0x4331b1=_0x281d8d?_0x1c9e9a(0x103)+_0x50ab2e[_0x1c9e9a(0x135)](_0x28e613=>_0x28e613[_0x1c9e9a(0x120)])[_0x1c9e9a(0x119)](',\x20'):_0x1c9e9a(0x129)+CLI_BIN_NAME+_0x1c9e9a(0xfe);throw CliErrors[_0x1c9e9a(0xf8)]('Alias\x20\x22'+_0x2c6703+_0x1c9e9a(0x11c)+_0x4331b1);}_0x32c0db=_0x2c6703,_0x267526=_0x1d02b6;}else{if(_0x118b7e){_0x267526=_0x118b7e;const _0x11780c=_0x50ab2e[_0x1c9e9a(0x11f)](_0x182d21=>_0x182d21[_0x1c9e9a(0xf1)]===_0x118b7e);_0x32c0db=_0x11780c?.[_0x1c9e9a(0x120)];}else{if(_0x3bf0b8[_0x1c9e9a(0xee)])throw CliErrors['validation'](_0x1c9e9a(0x113));else{if(_0x281d8d){const _0x5d2160=_0x50ab2e[_0x1c9e9a(0x135)](_0x2b8d50=>_0x2b8d50[_0x1c9e9a(0x120)]+'\x20('+_0x2b8d50[_0x1c9e9a(0x115)]+')'),_0x74b285=await promptSelect(_0x1c9e9a(0xf5),_0x5d2160),_0x34f165=_0x50ab2e[_0x74b285];if(!_0x34f165)throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x123));_0x32c0db=_0x34f165[_0x1c9e9a(0x120)],_0x267526=_0x34f165[_0x1c9e9a(0xf1)];}else{const _0x59f49d=await listDatasets(_0x3bf0b8[_0x1c9e9a(0x149)]);if(_0x59f49d[_0x1c9e9a(0xed)]===0x0)throw CliErrors['validation'](_0x1c9e9a(0x106));const _0x37baef=_0x59f49d[_0x1c9e9a(0x135)](_0x132811=>_0x132811[_0x1c9e9a(0x14a)]+'\x20['+(_0x132811[_0x1c9e9a(0x144)]??_0x1c9e9a(0x14c))+_0x1c9e9a(0x14d)+_0x132811[_0x1c9e9a(0x11d)]+')'),_0x2560de=await promptSelect(_0x1c9e9a(0xf5),_0x37baef),_0xcdb2b8=_0x59f49d[_0x2560de];if(!_0xcdb2b8)throw CliErrors['validation'](_0x1c9e9a(0x123));_0x267526=_0xcdb2b8[_0x1c9e9a(0x11d)],_0x32c0db=undefined;}}}}const _0x2aae54=await listDatasets(_0x3bf0b8['appCode']),_0x26a17d=_0x2aae54['find'](_0x556a7a=>_0x556a7a['code']===_0x267526);if(!_0x26a17d)throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0xf7)+_0x267526+_0x1c9e9a(0x138)+(_0x32c0db?_0x1c9e9a(0x13c)+CLI_BIN_NAME+_0x1c9e9a(0x139):''));_0x471786=_0x26a17d['id'];const _0x385bc6=_0x32c0db??_0x267526,_0x38c41d=await listBffDatasetOperations(_0x3bf0b8[_0x1c9e9a(0x149)],_0x471786),_0x40ef9b=_0x38c41d?Object[_0x1c9e9a(0x10f)](_0x38c41d):[];if(_0x40ef9b[_0x1c9e9a(0xed)]===0x0)throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x116)+_0x385bc6+'.');let _0x4d8269;const _0x176b9d=_0x3bf0b8[_0x1c9e9a(0x132)](_0x1c9e9a(0x121));if(_0x176b9d){if(!_0x40ef9b['includes'](_0x176b9d))throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x128)+_0x176b9d+_0x1c9e9a(0xff)+_0x385bc6+'.\x20'+(_0x1c9e9a(0x102)+_0x40ef9b[_0x1c9e9a(0x119)](',\x20')));_0x4d8269=_0x176b9d;}else{if(_0x3bf0b8[_0x1c9e9a(0xee)])throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0xf0));const _0x2bc755=await promptSelect('Select\x20operation\x20type:',_0x40ef9b);_0x4d8269=_0x40ef9b[_0x2bc755]??_0x40ef9b[0x0];}let _0x5dfb4a=normalizeHookFunctionNode(_0x3bf0b8[_0x1c9e9a(0x132)]('function-node'));if(!_0x5dfb4a){if(_0x3bf0b8['str'](_0x1c9e9a(0x108)))throw CliErrors[_0x1c9e9a(0xf8)](_0x1c9e9a(0x10b));if(_0x3bf0b8[_0x1c9e9a(0xee)])throw CliErrors['validation'](_0x1c9e9a(0xf2));const _0x800c3f=await promptSelect(_0x1c9e9a(0xfb),[_0x1c9e9a(0xef),'after']);_0x5dfb4a=['before',_0x1c9e9a(0x104)][_0x800c3f]??_0x1c9e9a(0xef);}return{'alias':_0x32c0db,'datasetCode':_0x267526,'datasetId':_0x471786,'operationType':_0x4d8269,'functionNode':_0x5dfb4a};}async function promptSelect(_0xfbef3e,_0x325f90){const _0x4f62e8=a37_0x501c99;if(_0x325f90['length']===0x1)return 0x0;for(const [_0x5db411,_0x5a8fef]of _0x325f90[_0x4f62e8(0x142)]()){process[_0x4f62e8(0x12e)][_0x4f62e8(0x118)]('\x20\x20'+(_0x5db411+0x1)+'.\x20'+_0x5a8fef+'\x0a');}const _0x4e174e=createInterface({'input':process[_0x4f62e8(0xf4)],'output':process[_0x4f62e8(0x12e)]});while(!![]){const _0x3fb48a=await new Promise(_0x3a3867=>{_0x4e174e['question'](_0xfbef3e+'\x20',_0x3a3867);}),_0x53fce4=Number[_0x4f62e8(0x134)](_0x3fb48a['trim'](),0xa);if(Number[_0x4f62e8(0x125)](_0x53fce4)&&_0x53fce4>=0x1&&_0x53fce4<=_0x325f90[_0x4f62e8(0xed)])return _0x4e174e[_0x4f62e8(0x126)](),_0x53fce4-0x1;process['stderr'][_0x4f62e8(0x118)]('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x325f90[_0x4f62e8(0xed)]+'.\x0a');}}function buildFilePath(_0x5c7b66,_0x198589,_0xfb4cf9,_0x4ffba4){const _0x583907=a37_0x501c99;if(_0x198589===_0x583907(0x10d)){if(!_0x4ffba4)throw CliErrors[_0x583907(0xf8)](_0x583907(0x13e));const _0x35fc2e=_0x4ffba4[_0x583907(0x120)]??_0x4ffba4[_0x583907(0xf1)];return join(_0x5c7b66[_0x583907(0x111)],_0x583907(0x10d),_0x35fc2e,_0x4ffba4[_0x583907(0x137)],_0x4ffba4[_0x583907(0xfc)],_0xfb4cf9+_0x583907(0x10a));}return join(_0x5c7b66[_0x583907(0x111)],_0x198589,_0xfb4cf9+_0x583907(0x10a));}export function generateTemplate(_0x103074,_0x10122e,_0x277b75,_0x232dc2,_0x190385){const _0x994413=a37_0x501c99,_0x83be32=_0x232dc2?.[_0x994413(0x112)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x118ae6=getAppBaseUrl(_0x277b75),_0x4894e4=_0x994413(0x109);if(_0x103074===_0x994413(0xe8))return'/**\x0a\x20*\x20'+_0x83be32+_0x994413(0x130)+_0x10122e+_0x994413(0xe6)+_0x118ae6+_0x994413(0x11a)+_0x277b75+_0x994413(0x11b)+_0x10122e+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x10122e+'\x22,\x20params\x20})\x0a'+_0x4894e4+'\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'+_0x10122e+_0x994413(0x14e);if(_0x103074===_0x994413(0xea))return _0x994413(0x12b)+_0x83be32+_0x994413(0x12d)+_0x10122e+_0x994413(0xeb)+_0x277b75+'/'+_0x10122e+_0x994413(0xe6)+_0x118ae6+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x277b75+'/ENDPOINT/'+_0x10122e+_0x994413(0x14b)+_0x4894e4+_0x994413(0x13b)+_0x10122e+_0x994413(0x14e);if(!_0x190385)throw CliErrors[_0x994413(0xf8)](_0x994413(0x10e));const _0xbf6626=_0x190385[_0x994413(0x120)]??_0x190385[_0x994413(0xf1)],_0x513685=_0x190385[_0x994413(0xfc)]==='before'?_0x994413(0x14f):'当前响应结果',_0xa10c5a=_0x190385[_0x994413(0xfc)]===_0x994413(0xef)?_0x994413(0x122):_0x994413(0x136);return _0x994413(0x12b)+_0x83be32+_0x994413(0x13d)+_0x10122e+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x277b75+'/'+_0x190385[_0x994413(0xf1)]+'/'+_0x190385[_0x994413(0x137)]+_0x994413(0xe6)+_0x118ae6+'/data/dataset/'+_0x190385[_0x994413(0x147)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x277b75+'/HOOK/'+_0xbf6626+'/'+_0x190385[_0x994413(0x137)]+'/'+_0x190385['functionNode']+'/'+_0x10122e+'.js\x0a\x20*\x20[触发节点]\x20'+_0x190385[_0x994413(0xfc)]+'\x0a'+_0x4894e4+_0x994413(0x11e)+_0x513685+_0x994413(0x10c)+_0xa10c5a+_0x994413(0x143)+_0x10122e+_0x994413(0x14e);}
|
|
1
|
+
function a37_0x3eef(){const _0x419761=['90FLbSEy','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','/HOOK/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Created\x20','Alias\x20\x22','Dataset\x20not\x20found\x20for\x20code\x20\x22','datasetcode','3249336VEeseM','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','entries','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','currentApp','function-node','2206425HlgWyZ','alias','\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','Invalid\x20dataset\x20selection.','operationType','6525FiAiKs','Trigger\x20node\x20(HOOK\x20only)','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Script\x20type','Available:\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','209hCsRzh','/ENDPOINT/','datasetCode','修改后的响应结果','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','map','str','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','write','keys','isInteger','length','operation-type','\x0a\x20*\x20[平台配置]\x20','functionNode','73409RdUPXE','type','/data/dataset/','/**\x0a\x20*\x20','33amuQPv','scriptsRootDir','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','after','before','string','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','description','parseInt','selectedAppName','COMMON','bff','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','.js\x0a\x20*\x20[触发节点]\x20','8ClaZIT','filePath','\x22.\x20','join','tableName','UNKNOWN','appCode','read','Invalid\x20function\x20name\x20\x22','Operation\x20type\x20\x22','\x20function:\x20','name','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20',']\x20(','Script\x20description','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','create','No\x20datasets\x20found\x20for\x20this\x20app.','code','Operation\x20type\x20(HOOK\x20only)','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Select\x20operation\x20type:','修改后的请求参数','ENDPOINT','datasetId','nonInteractive','validation','stderr','679330HgNFaJ','apiDir','source','HOOK\x20requires\x20alias/operation/node\x20options.','316326jhFBcn','mergedCli','当前响应结果','/COMMON/','HOOK','\x22,\x20params\x20})\x0a','find','profileName','3484pUGhPJ','trim','utf8','.js','File\x20already\x20exists:\x20','7568yjTnyX','Select\x20dataset:'];a37_0x3eef=function(){return _0x419761;};return a37_0x3eef();}const a37_0x16b259=a37_0x663e;(function(_0x3e407b,_0x353b9c){const _0x2b2846=a37_0x663e,_0x20b18e=_0x3e407b();while(!![]){try{const _0x30dddd=parseInt(_0x2b2846(0x1a9))/0x1*(parseInt(_0x2b2846(0x1f4))/0x2)+-parseInt(_0x2b2846(0x1ec))/0x3*(-parseInt(_0x2b2846(0x1ca))/0x4)+parseInt(_0x2b2846(0x19e))/0x5+-parseInt(_0x2b2846(0x1fb))/0x6*(-parseInt(_0x2b2846(0x1b8))/0x7)+parseInt(_0x2b2846(0x1f9))/0x8*(-parseInt(_0x2b2846(0x1a3))/0x9)+parseInt(_0x2b2846(0x1e8))/0xa*(parseInt(_0x2b2846(0x1bc))/0xb)+-parseInt(_0x2b2846(0x198))/0xc;if(_0x30dddd===_0x353b9c)break;else _0x20b18e['push'](_0x20b18e['shift']());}catch(_0x84d5a3){_0x20b18e['push'](_0x20b18e['shift']());}}}(a37_0x3eef,0x66b73));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x663e(_0xb995ac,_0x1af432){_0xb995ac=_0xb995ac-0x192;const _0x3eefc9=a37_0x3eef();let _0x663e22=_0x3eefc9[_0xb995ac];return _0x663e22;}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x16b259(0x1c7),'command':a37_0x16b259(0x1da),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0x16b259(0x1d1),'flags':[{'name':a37_0x16b259(0x1b9),'type':a37_0x16b259(0x1c1),'required':!![],'enum':[a37_0x16b259(0x1c6),'ENDPOINT',a37_0x16b259(0x1f0)],'description':a37_0x16b259(0x1a6)},{'name':a37_0x16b259(0x1d5),'type':a37_0x16b259(0x1c1),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x16b259(0x1c3),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1d8)},{'name':'alias','type':a37_0x16b259(0x1c1),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a37_0x16b259(0x197),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1d9)},{'name':'operation-type','type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1dd)},{'name':a37_0x16b259(0x19d),'type':a37_0x16b259(0x1c1),'description':a37_0x16b259(0x1a4),'enum':[a37_0x16b259(0x1c0),a37_0x16b259(0x1bf)]}],async 'validate'(_0x7098ad){const _0x4cbb09=a37_0x16b259,_0x2e4ae1=_0x7098ad[_0x4cbb09(0x1af)]('name');if(!isValidBffFunctionName(_0x2e4ae1))throw CliErrors[_0x4cbb09(0x1e6)](_0x4cbb09(0x1d2)+_0x2e4ae1+_0x4cbb09(0x1fc));},async 'execute'(_0x5331cd){const _0x11f538=a37_0x16b259,_0x33d36c=loadBffProjectConfig(_0x5331cd['appCode']),_0x3727bb=_0x5331cd[_0x11f538(0x1af)]('type'),_0x1a6da1=_0x5331cd[_0x11f538(0x1af)](_0x11f538(0x1d5)),_0x45e66d=_0x5331cd[_0x11f538(0x1af)](_0x11f538(0x1c3))||undefined,_0x22c3c5=_0x3727bb===_0x11f538(0x1f0)?await resolveHookOptions(_0x33d36c,_0x5331cd):undefined,_0x35a5b5=buildFilePath(_0x33d36c,_0x3727bb,_0x1a6da1,_0x22c3c5);if(await fileExists(_0x35a5b5))throw CliErrors['validation'](_0x11f538(0x1f8)+_0x35a5b5);await mkdir(dirname(_0x35a5b5),{'recursive':!![]});const _0x30f73f=generateTemplate(_0x3727bb,_0x1a6da1,_0x5331cd['appCode'],_0x45e66d,_0x22c3c5);await writeFile(_0x35a5b5,_0x30f73f,_0x11f538(0x1f6));const _0x2d1ea4={'type':_0x3727bb,'name':_0x1a6da1,'path':_0x35a5b5};if(_0x45e66d)_0x2d1ea4[_0x11f538(0x1c3)]=_0x45e66d;if(_0x22c3c5){if(_0x22c3c5[_0x11f538(0x19f)])_0x2d1ea4[_0x11f538(0x19f)]=_0x22c3c5[_0x11f538(0x19f)];_0x2d1ea4[_0x11f538(0x1ab)]=_0x22c3c5[_0x11f538(0x1ab)],_0x2d1ea4['operationType']=_0x22c3c5['operationType'],_0x2d1ea4['functionNode']=_0x22c3c5['functionNode'];}return{'ok':!![],'data':_0x2d1ea4,'message':_0x11f538(0x194)+_0x3727bb+_0x11f538(0x1d4)+_0x1a6da1};}};async function resolveHookOptions(_0x345396,_0x5bed8f){const _0x146675=a37_0x16b259,_0xf4bbd7=resolveApiModelSource(_0x5bed8f[_0x146675(0x1e9)],_0x5bed8f[_0x146675(0x1d0)],_0x5bed8f[_0x146675(0x1c5)]||_0x5bed8f[_0x146675(0x1ed)]?.[_0x146675(0x19c)]||_0x5bed8f['mergedCli']?.['defaultApp']),_0x379f5c=loadAliasMap(_0x5bed8f[_0x146675(0x1e9)],undefined,_0xf4bbd7[_0x146675(0x1cb)],_0xf4bbd7['profileName']),_0x2263dd=_0x379f5c[_0x146675(0x1b4)]>0x0;let _0x116ab4,_0x34b2e7,_0xf63863;const _0x3dfd0a=_0x5bed8f[_0x146675(0x1af)](_0x146675(0x19f)),_0x2ac7d7=_0x5bed8f[_0x146675(0x1af)](_0x146675(0x197));if(_0x3dfd0a){const _0x1544f1=resolveAlias(_0x5bed8f['apiDir'],_0x3dfd0a,undefined,_0xf4bbd7[_0x146675(0x1cb)],_0xf4bbd7[_0x146675(0x1f3)]);if(!_0x1544f1){const _0x298249=_0x2263dd?'Available\x20aliases:\x20'+_0x379f5c[_0x146675(0x1ae)](_0x5111ed=>_0x5111ed[_0x146675(0x19f)])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x146675(0x1a5);throw CliErrors['validation'](_0x146675(0x195)+_0x3dfd0a+'\x22\x20not\x20found.\x20'+_0x298249);}_0x116ab4=_0x3dfd0a,_0x34b2e7=_0x1544f1;}else{if(_0x2ac7d7){_0x34b2e7=_0x2ac7d7;const _0x59b148=_0x379f5c[_0x146675(0x1f2)](_0x553a45=>_0x553a45[_0x146675(0x1ab)]===_0x2ac7d7);_0x116ab4=_0x59b148?.[_0x146675(0x19f)];}else{if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1de));else{if(_0x2263dd){const _0x4757cc=_0x379f5c[_0x146675(0x1ae)](_0x5eed00=>_0x5eed00[_0x146675(0x19f)]+'\x20('+_0x5eed00[_0x146675(0x1ce)]+')'),_0xc1c6d5=await promptSelect(_0x146675(0x1fa),_0x4757cc),_0x4e5579=_0x379f5c[_0xc1c6d5];if(!_0x4e5579)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1a1));_0x116ab4=_0x4e5579[_0x146675(0x19f)],_0x34b2e7=_0x4e5579[_0x146675(0x1ab)];}else{const _0x521514=await listDatasets(_0x5bed8f[_0x146675(0x1d0)]);if(_0x521514[_0x146675(0x1b4)]===0x0)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1db));const _0x16c3bb=_0x521514[_0x146675(0x1ae)](_0x170e32=>_0x170e32['name']+'\x20['+(_0x170e32[_0x146675(0x1ea)]??_0x146675(0x1cf))+_0x146675(0x1d7)+_0x170e32[_0x146675(0x1dc)]+')'),_0x2e6789=await promptSelect(_0x146675(0x1fa),_0x16c3bb),_0x55d227=_0x521514[_0x2e6789];if(!_0x55d227)throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1a1));_0x34b2e7=_0x55d227['code'],_0x116ab4=undefined;}}}}const _0x333524=await listDatasets(_0x5bed8f[_0x146675(0x1d0)]),_0x1c041f=_0x333524[_0x146675(0x1f2)](_0x18f386=>_0x18f386[_0x146675(0x1dc)]===_0x34b2e7);if(!_0x1c041f)throw CliErrors['validation'](_0x146675(0x196)+_0x34b2e7+_0x146675(0x1cc)+(_0x116ab4?_0x146675(0x1df)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0xf63863=_0x1c041f['id'];const _0x55e1c2=_0x116ab4??_0x34b2e7,_0x1ee03d=await listBffDatasetOperations(_0x5bed8f['appCode'],_0xf63863),_0x452439=_0x1ee03d?Object[_0x146675(0x1b2)](_0x1ee03d):[];if(_0x452439[_0x146675(0x1b4)]===0x0)throw CliErrors[_0x146675(0x1e6)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x55e1c2+'.');let _0x28356b;const _0x9e607a=_0x5bed8f['str'](_0x146675(0x1b5));if(_0x9e607a){if(!_0x452439['includes'](_0x9e607a))throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1d3)+_0x9e607a+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x55e1c2+'.\x20'+(_0x146675(0x1a7)+_0x452439[_0x146675(0x1cd)](',\x20')));_0x28356b=_0x9e607a;}else{if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1be));const _0x4b6a31=await promptSelect(_0x146675(0x1e1),_0x452439);_0x28356b=_0x452439[_0x4b6a31]??_0x452439[0x0];}let _0x3fbd4f=normalizeHookFunctionNode(_0x5bed8f[_0x146675(0x1af)]('function-node'));if(!_0x3fbd4f){if(_0x5bed8f[_0x146675(0x1af)](_0x146675(0x19d)))throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1e0));if(_0x5bed8f[_0x146675(0x1e5)])throw CliErrors[_0x146675(0x1e6)](_0x146675(0x1b0));const _0x7647be=await promptSelect('Select\x20trigger\x20node:',[_0x146675(0x1c0),_0x146675(0x1bf)]);_0x3fbd4f=[_0x146675(0x1c0),_0x146675(0x1bf)][_0x7647be]??_0x146675(0x1c0);}return{'alias':_0x116ab4,'datasetCode':_0x34b2e7,'datasetId':_0xf63863,'operationType':_0x28356b,'functionNode':_0x3fbd4f};}async function promptSelect(_0x3362ac,_0x472466){const _0x30d236=a37_0x16b259;if(_0x472466['length']===0x1)return 0x0;for(const [_0x2645c7,_0x5da07e]of _0x472466[_0x30d236(0x19a)]()){process[_0x30d236(0x1e7)]['write']('\x20\x20'+(_0x2645c7+0x1)+'.\x20'+_0x5da07e+'\x0a');}const _0x3bdb3c=createInterface({'input':process['stdin'],'output':process[_0x30d236(0x1e7)]});while(!![]){const _0x2f195b=await new Promise(_0x2ad028=>{_0x3bdb3c['question'](_0x3362ac+'\x20',_0x2ad028);}),_0x1ab56f=Number[_0x30d236(0x1c4)](_0x2f195b['trim'](),0xa);if(Number[_0x30d236(0x1b3)](_0x1ab56f)&&_0x1ab56f>=0x1&&_0x1ab56f<=_0x472466[_0x30d236(0x1b4)])return _0x3bdb3c['close'](),_0x1ab56f-0x1;process[_0x30d236(0x1e7)][_0x30d236(0x1b1)](_0x30d236(0x1c2)+_0x472466[_0x30d236(0x1b4)]+'.\x0a');}}function buildFilePath(_0x3e585e,_0x381d84,_0x541416,_0x827ae8){const _0x4170b5=a37_0x16b259;if(_0x381d84==='HOOK'){if(!_0x827ae8)throw CliErrors[_0x4170b5(0x1e6)](_0x4170b5(0x1eb));const _0x6daf29=_0x827ae8[_0x4170b5(0x19f)]??_0x827ae8[_0x4170b5(0x1ab)];return join(_0x3e585e[_0x4170b5(0x1bd)],_0x4170b5(0x1f0),_0x6daf29,_0x827ae8[_0x4170b5(0x1a2)],_0x827ae8[_0x4170b5(0x1b7)],_0x541416+_0x4170b5(0x1f7));}return join(_0x3e585e['scriptsRootDir'],_0x381d84,_0x541416+_0x4170b5(0x1f7));}export function generateTemplate(_0x71ce88,_0x3d87e7,_0x2ff443,_0x26535a,_0x555129){const _0x24c493=a37_0x16b259,_0x7b6472=_0x26535a?.[_0x24c493(0x1f5)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3b9e88=getAppBaseUrl(_0x2ff443),_0x25c06d='\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)';if(_0x71ce88==='COMMON')return _0x24c493(0x1bb)+_0x7b6472+_0x24c493(0x193)+_0x3d87e7+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x199)+_0x2ff443+_0x24c493(0x1ef)+_0x3d87e7+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x3d87e7+_0x24c493(0x1f1)+_0x25c06d+_0x24c493(0x1a0)+_0x3d87e7+_0x24c493(0x19b);if(_0x71ce88===_0x24c493(0x1e3))return _0x24c493(0x1bb)+_0x7b6472+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x3d87e7+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x2ff443+'/'+_0x3d87e7+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x199)+_0x2ff443+_0x24c493(0x1aa)+_0x3d87e7+'.js\x0a'+_0x25c06d+'\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'+_0x3d87e7+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x555129)throw CliErrors['validation']('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x28e266=_0x555129[_0x24c493(0x19f)]??_0x555129[_0x24c493(0x1ab)],_0x10e072=_0x555129[_0x24c493(0x1b7)]===_0x24c493(0x1c0)?'当前请求参数':_0x24c493(0x1ee),_0x336c4c=_0x555129[_0x24c493(0x1b7)]===_0x24c493(0x1c0)?_0x24c493(0x1e2):_0x24c493(0x1ac);return'/**\x0a\x20*\x20'+_0x7b6472+_0x24c493(0x192)+_0x3d87e7+_0x24c493(0x1ad)+_0x2ff443+'/'+_0x555129[_0x24c493(0x1ab)]+'/'+_0x555129[_0x24c493(0x1a2)]+_0x24c493(0x1b6)+_0x3b9e88+_0x24c493(0x1ba)+_0x555129[_0x24c493(0x1e4)]+_0x24c493(0x1c8)+_0x2ff443+_0x24c493(0x1fd)+_0x28e266+'/'+_0x555129[_0x24c493(0x1a2)]+'/'+_0x555129['functionNode']+'/'+_0x3d87e7+_0x24c493(0x1c9)+_0x555129[_0x24c493(0x1b7)]+'\x0a'+_0x25c06d+_0x24c493(0x1a8)+_0x10e072+_0x24c493(0x1d6)+_0x336c4c+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x3d87e7+_0x24c493(0x19b);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x27ef82=a38_0x3240;(function(_0x1796f7,_0x2908d4){const _0x31d843=a38_0x3240,_0x4268c3=_0x1796f7();while(!![]){try{const _0xc5782e=parseInt(_0x31d843(0x175))/0x1*(parseInt(_0x31d843(0x16b))/0x2)+parseInt(_0x31d843(0x171))/0x3*(-parseInt(_0x31d843(0x177))/0x4)+parseInt(_0x31d843(0x15a))/0x5+parseInt(_0x31d843(0x164))/0x6+parseInt(_0x31d843(0x16d))/0x7+-parseInt(_0x31d843(0x151))/0x8+parseInt(_0x31d843(0x17b))/0x9*(-parseInt(_0x31d843(0x17c))/0xa);if(_0xc5782e===_0x2908d4)break;else _0x4268c3['push'](_0x4268c3['shift']());}catch(_0x41c437){_0x4268c3['push'](_0x4268c3['shift']());}}}(a38_0x3e0c,0xb9109));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a38_0x3e0c(){const _0x4c1340=['replace','target','functions','Would\x20delete\x20','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','22SoHWWr','/api/management/library/scripts/delete','7071953FTKuQL','str','validation','join','3666009hkLtjx','keys','scriptsRootDir','startsWith','58361OBVnVu','trashedTo','4hHGQVg','remoteId','apps','\x20(local\x20file\x20moved\x20to\x20trash)','60867dReUJc','2650HuPykk','projectRoot','map','Function\x20not\x20found:\x20','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','appCode','toISOString','\x22\x20not\x20found\x20after\x20ensureLockScope.','bff','314976syKcxX','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','length','find','Lock\x20scope\x20for\x20app\x20\x22','Deleted\x20','high-risk-write','split','Local\x20delete\x20not\x20settled\x20for\x20','3537995akBwkN','lockFilePath','Backend\x20Function\x20lock\x20file\x20not\x20found.','trashDir','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','scriptsRoot','string','lastSync','Multiple\x20functions\x20match\x20\x22','delete','8710476pBXMkl','No\x20lock\x20entry\x20found\x20for\x20\x22'];a38_0x3e0c=function(){return _0x4c1340;};return a38_0x3e0c();}import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a38_0x27ef82(0x150),'command':'delete','description':a38_0x27ef82(0x16a),'risk':a38_0x27ef82(0x157),'flags':[{'name':a38_0x27ef82(0x167),'type':a38_0x27ef82(0x160),'required':!![],'description':a38_0x27ef82(0x15e)}],async 'validate'(_0x334ea5){const _0x42069f=a38_0x27ef82,_0x2e40d5=loadBffProjectConfig(_0x334ea5[_0x42069f(0x14d)]),_0x4b58c4=await readBffLockFile(_0x2e40d5['lockFilePath']);if(!_0x4b58c4)throw CliErrors[_0x42069f(0x16f)](_0x42069f(0x152));},async 'dryRun'(_0x186daf){const _0x50670b=a38_0x27ef82,_0x1d17bb=loadBffProjectConfig(_0x186daf[_0x50670b(0x14d)]),_0x2f9000=await readBffLockFile(_0x1d17bb[_0x50670b(0x15b)]);if(!_0x2f9000)throw CliErrors['validation'](_0x50670b(0x15c));const {appLock:_0x277eef}=ensureLockScope(_0x2f9000,_0x186daf[_0x50670b(0x14d)],_0x1d17bb[_0x50670b(0x15f)],_0x50670b(0x163)),_0x1ad542=_0x186daf[_0x50670b(0x16e)](_0x50670b(0x167)),_0x1fa66f=Object[_0x50670b(0x172)](_0x277eef['functions']),_0x2ee6ce=resolveDeleteTarget(_0x1ad542,_0x1fa66f),_0x301787=_0x277eef[_0x50670b(0x168)][_0x2ee6ce];if(!_0x301787)throw CliErrors[_0x50670b(0x16f)](_0x50670b(0x165)+_0x2ee6ce+'\x22.');const _0x2363d3=resolveLocalFilePathFromLockKey(_0x1d17bb,_0x2ee6ce),_0x92ad89=relative(_0x1d17bb['projectRoot'],_0x2363d3),_0x42f645=join(_0x1d17bb['trashDir'],'<timestamp>',_0x92ad89);return{'method':'POST','url':_0x50670b(0x16c),'body':{'appCode':_0x186daf[_0x50670b(0x14d)],'target':_0x2ee6ce,'remoteId':_0x301787[_0x50670b(0x178)],'localFilePath':_0x2363d3,'trashedPath':_0x42f645},'description':_0x50670b(0x169)+_0x2ee6ce+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash'};},async 'execute'(_0x3cb6bf){const _0xc685e3=a38_0x27ef82,_0x13e9c5=loadBffProjectConfig(_0x3cb6bf[_0xc685e3(0x14d)]),_0x3023e6=await readBffLockFile(_0x13e9c5[_0xc685e3(0x15b)]);if(!_0x3023e6)throw CliErrors[_0xc685e3(0x16f)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x18355d,appLock:_0x178c5f}=ensureLockScope(_0x3023e6,_0x3cb6bf[_0xc685e3(0x14d)],_0x13e9c5[_0xc685e3(0x15f)],_0xc685e3(0x163)),_0x212ff0=JSON['parse'](JSON['stringify'](_0x18355d)),_0x598eae=_0x212ff0[_0xc685e3(0x179)][_0x3cb6bf[_0xc685e3(0x14d)]];if(!_0x598eae)throw new Error(_0xc685e3(0x155)+_0x3cb6bf[_0xc685e3(0x14d)]+_0xc685e3(0x14f));const _0x2813fd=_0x3cb6bf[_0xc685e3(0x16e)](_0xc685e3(0x167)),_0x52c131=Object['keys'](_0x598eae[_0xc685e3(0x168)]),_0xdfecf6=resolveDeleteTarget(_0x2813fd,_0x52c131),_0x15b7fb=_0x598eae[_0xc685e3(0x168)][_0xdfecf6];if(!_0x15b7fb)throw CliErrors['validation'](_0xc685e3(0x165)+_0xdfecf6+'\x22.');await deleteBffScript(_0x15b7fb[_0xc685e3(0x178)]),delete _0x598eae[_0xc685e3(0x168)][_0xdfecf6],_0x598eae[_0xc685e3(0x161)]=new Date()[_0xc685e3(0x14e)](),await writeBffLockFile(_0x13e9c5['lockFilePath'],_0x212ff0);const _0x4b24a0=resolveLocalFilePathFromLockKey(_0x13e9c5,_0xdfecf6);let _0x19c315;await fileExists(_0x4b24a0)&&(_0x19c315=await moveToTrash(_0x13e9c5[_0xc685e3(0x149)],_0x13e9c5[_0xc685e3(0x15d)],_0x4b24a0),await cleanupEmptyDirectories(dirname(_0x4b24a0),_0x13e9c5[_0xc685e3(0x173)]));await waitForDeleteSettlement(_0x13e9c5[_0xc685e3(0x15b)],_0x3cb6bf['appCode'],_0xdfecf6,_0x4b24a0),await sleep(0x96);const _0x439ef8={'deleted':_0xdfecf6,'remoteId':_0x15b7fb['remoteId']};if(_0x19c315)_0x439ef8[_0xc685e3(0x176)]=_0x19c315;return{'ok':!![],'data':_0x439ef8,'message':_0xc685e3(0x156)+_0xdfecf6+(_0x19c315?_0xc685e3(0x17a):'')};}};function a38_0x3240(_0x1297af,_0x2554fc){_0x1297af=_0x1297af-0x149;const _0x3e0c03=a38_0x3e0c();let _0x3240e1=_0x3e0c03[_0x1297af];return _0x3240e1;}function resolveDeleteTarget(_0x31dfa9,_0x2cd21a){const _0x4871f4=a38_0x27ef82;if(_0x31dfa9['includes']('/')){const _0x4a91ab=_0x2cd21a[_0x4871f4(0x154)](_0x5c415a=>_0x5c415a===_0x31dfa9);if(!_0x4a91ab)throw CliErrors[_0x4871f4(0x16f)](_0x4871f4(0x14b)+_0x31dfa9);return _0x4a91ab;}const _0x2a88c9=_0x2cd21a['filter'](_0x1f257a=>_0x1f257a[_0x4871f4(0x158)]('/')['at'](-0x1)===_0x31dfa9);if(_0x2a88c9[_0x4871f4(0x153)]===0x0)throw CliErrors[_0x4871f4(0x16f)](_0x4871f4(0x14b)+_0x31dfa9);if(_0x2a88c9[_0x4871f4(0x153)]>0x1)throw CliErrors[_0x4871f4(0x16f)](_0x4871f4(0x162)+_0x31dfa9+_0x4871f4(0x14c)+_0x2a88c9[_0x4871f4(0x14a)](_0x2fda2a=>'\x20\x20-\x20'+_0x2fda2a)[_0x4871f4(0x170)]('\x0a'));return _0x2a88c9[0x0];}async function moveToTrash(_0x5effde,_0x536539,_0x4499bb){const _0x521494=a38_0x27ef82,_0x569e8b=new Date()[_0x521494(0x14e)]()[_0x521494(0x166)](/[:.]/g,'-'),_0xc8f346=relative(_0x5effde,_0x4499bb),_0x3ad6e0=join(_0x536539,_0x569e8b,_0xc8f346);return await mkdir(dirname(_0x3ad6e0),{'recursive':!![]}),await rename(_0x4499bb,_0x3ad6e0),_0x3ad6e0;}async function cleanupEmptyDirectories(_0x617e7f,_0x14fc0e){const _0x3f2fa2=a38_0x27ef82;let _0x1828de=resolve(_0x617e7f);const _0x10ae1e=resolve(_0x14fc0e);while(_0x1828de[_0x3f2fa2(0x174)](''+_0x10ae1e+sep)||_0x1828de===_0x10ae1e){if(_0x1828de===_0x10ae1e)return;try{const _0x55d14d=await readdir(_0x1828de);if(_0x55d14d['length']>0x0)return;await rmdir(_0x1828de);}catch{return;}_0x1828de=dirname(_0x1828de);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x54c5a9,_0x517876,_0x2203e9,_0x1cc85e){const _0x1e9a89=a38_0x27ef82;for(let _0x3c52eb=0x0;_0x3c52eb<DELETE_SETTLE_RETRY_COUNT;_0x3c52eb+=0x1){const _0x32371b=await readBffLockFile(_0x54c5a9),_0x598ab1=!!_0x32371b?.['apps']?.[_0x517876]?.[_0x1e9a89(0x168)]?.[_0x2203e9],_0x12e2fa=await fileExists(_0x1cc85e);if(!_0x598ab1&&!_0x12e2fa)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x1e9a89(0x159)+_0x2203e9+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a39_0x3dbef7=a39_0x1c9d;(function(_0x5b8d58,_0x44bdff){const _0x2df26b=a39_0x1c9d,_0x257135=_0x5b8d58();while(!![]){try{const _0x82a45d=parseInt(_0x2df26b(0x99))/0x1+parseInt(_0x2df26b(0x95))/0x2*(-parseInt(_0x2df26b(0x9c))/0x3)+-parseInt(_0x2df26b(0xa1))/0x4+parseInt(_0x2df26b(0x9d))/0x5+-parseInt(_0x2df26b(0x9f))/0x6+-parseInt(_0x2df26b(0xa2))/0x7+parseInt(_0x2df26b(0x97))/0x8*(parseInt(_0x2df26b(0x9e))/0x9);if(_0x82a45d===_0x44bdff)break;else _0x257135['push'](_0x257135['shift']());}catch(_0x150f53){_0x257135['push'](_0x257135['shift']());}}}(a39_0xb457,0xc4a23));import{getBffScriptInfo}from'../../core/api-client.js';function a39_0xb457(){const _0x30fc32=['Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','version','num','bool','description','updateUserName','read','Script\x20ID','createdTime','43652WQBDxh','Return\x20full\x20raw\x20script\x20object','8hdGDjl','updatedTime','1164933wfXDas','number','detail','102RVTzAy','2707595iEGlEj','16274673CsyJRl','5540058oMgMlB','verbose','1333140BRKTTI','4974382QlYoNB'];a39_0xb457=function(){return _0x30fc32;};return a39_0xb457();}function a39_0x1c9d(_0x5898b8,_0x3f2ad4){_0x5898b8=_0x5898b8-0x8c;const _0xb457de=a39_0xb457();let _0x1c9d33=_0xb457de[_0x5898b8];return _0x1c9d33;}export const bffDetail={'service':'bff','command':a39_0x3dbef7(0x9b),'description':a39_0x3dbef7(0x8c),'risk':a39_0x3dbef7(0x92),'flags':[{'name':'id','type':a39_0x3dbef7(0x9a),'required':!![],'description':a39_0x3dbef7(0x93)},{'name':a39_0x3dbef7(0xa0),'type':'boolean','description':a39_0x3dbef7(0x96)}],async 'execute'(_0x4803fc){const _0x53019d=a39_0x3dbef7,_0x275c4c=await getBffScriptInfo(_0x4803fc[_0x53019d(0x8e)]('id')),_0x2eb260=_0x4803fc[_0x53019d(0x8f)](_0x53019d(0xa0));if(_0x2eb260)return{'ok':!![],'data':_0x275c4c};return{'ok':!![],'data':{'id':_0x275c4c['id'],'functionName':_0x275c4c['functionName']??'','version':_0x275c4c[_0x53019d(0x8d)]??'','updateUserName':_0x275c4c[_0x53019d(0x91)]??'','appCode':_0x275c4c['appCode'],'scriptType':_0x275c4c['scriptType'],'description':_0x275c4c[_0x53019d(0x90)]||'(none)','createdTime':_0x275c4c[_0x53019d(0x94)]??'','updatedTime':_0x275c4c[_0x53019d(0x98)]??'','scriptContent':_0x275c4c['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xc77381,_0x222af4){const _0x42c0b6=a40_0x152a,_0x800d43=_0xc77381();while(!![]){try{const _0x1b2d3e=parseInt(_0x42c0b6(0x1ef))/0x1+-parseInt(_0x42c0b6(0x1ee))/0x2+-parseInt(_0x42c0b6(0x1f0))/0x3+parseInt(_0x42c0b6(0x1f3))/0x4+parseInt(_0x42c0b6(0x1f2))/0x5+-parseInt(_0x42c0b6(0x1f1))/0x6+-parseInt(_0x42c0b6(0x1f4))/0x7;if(_0x1b2d3e===_0x222af4)break;else _0x800d43['push'](_0x800d43['shift']());}catch(_0x545938){_0x800d43['push'](_0x800d43['shift']());}}}(a40_0x1ba3,0x5bc42));function a40_0x1ba3(){const _0x57d573=['1401393zkYskd','329930ShurYB','574994uEwyOK','1877010GCYTZd','3176550CSgbNd','3123030NzMBjg','2786132lDRhVh'];a40_0x1ba3=function(){return _0x57d573;};return a40_0x1ba3();}import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';function a40_0x152a(_0x185361,_0x5d8c2d){_0x185361=_0x185361-0x1ee;const _0x1ba307=a40_0x1ba3();let _0x152adc=_0x1ba307[_0x185361];return _0x152adc;}import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x79e349=a41_0x3216;(function(_0x3b549f,_0x9913ee){const _0x2df532=a41_0x3216,_0x1bc997=_0x3b549f();while(!![]){try{const _0x391bc9=-parseInt(_0x2df532(0x1e0))/0x1*(parseInt(_0x2df532(0x1ea))/0x2)+parseInt(_0x2df532(0x1f0))/0x3*(parseInt(_0x2df532(0x1fa))/0x4)+parseInt(_0x2df532(0x1f7))/0x5*(parseInt(_0x2df532(0x1eb))/0x6)+parseInt(_0x2df532(0x1f5))/0x7*(-parseInt(_0x2df532(0x1f6))/0x8)+-parseInt(_0x2df532(0x1f9))/0x9+parseInt(_0x2df532(0x1f2))/0xa*(-parseInt(_0x2df532(0x1df))/0xb)+parseInt(_0x2df532(0x1e8))/0xc;if(_0x391bc9===_0x9913ee)break;else _0x1bc997['push'](_0x1bc997['shift']());}catch(_0x51052e){_0x1bc997['push'](_0x1bc997['shift']());}}}(a41_0x5f2f,0x87ca0));function a41_0x3216(_0x397872,_0x443e3f){_0x397872=_0x397872-0x1de;const _0x5f2fdb=a41_0x5f2f();let _0x3216de=_0x5f2fdb[_0x397872];return _0x3216de;}function a41_0x5f2f(){const _0x287f60=['str','list','string','20142zCxazF','Script\x20type\x20filter','30BqaDOJ','verbose','description','1519qiGaAD','33272MPAauX','65OcEYXS','length','7089201IyPBQb','224BZnVFR','Return\x20full\x20script\x20objects','functionName','name','bool','147037FsnGgl','2QZWiYX','read','No\x20Backend\x20Function\x20scripts\x20found.','Filter\x20by\x20script\x20name','type','scriptType','List\x20Backend\x20Function\x20scripts','ENDPOINT','17863512RJgLyn','bff','12962kfUAzS','200694kBmXIC','map'];a41_0x5f2f=function(){return _0x287f60;};return a41_0x5f2f();}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x79e349(0x1e9),'command':a41_0x79e349(0x1ee),'description':a41_0x79e349(0x1e6),'risk':a41_0x79e349(0x1e1),'flags':[{'name':a41_0x79e349(0x1e4),'type':a41_0x79e349(0x1ef),'description':a41_0x79e349(0x1f1),'default':'ENDPOINT','enum':[a41_0x79e349(0x1e7),'COMMON']},{'name':a41_0x79e349(0x1fd),'type':a41_0x79e349(0x1ef),'description':a41_0x79e349(0x1e3)},{'name':a41_0x79e349(0x1f3),'type':'boolean','description':a41_0x79e349(0x1fb)}],async 'execute'(_0x2ffab8){const _0xd811b=a41_0x79e349,_0x5d2618=await listBffScripts(_0x2ffab8['appCode'],_0x2ffab8[_0xd811b(0x1ed)](_0xd811b(0x1e4)),{'scriptName':_0x2ffab8[_0xd811b(0x1ed)]('name')||undefined}),_0x417573=_0x2ffab8[_0xd811b(0x1de)](_0xd811b(0x1f3));return{'ok':!![],'data':_0x417573?_0x5d2618:_0x5d2618[_0xd811b(0x1ec)](_0x1ba21d=>({'id':_0x1ba21d['id'],'functionName':_0x1ba21d[_0xd811b(0x1fc)]??'','description':_0x1ba21d[_0xd811b(0x1f4)]||'(unnamed)','scriptType':_0x1ba21d[_0xd811b(0x1e5)]})),'message':_0x5d2618[_0xd811b(0x1f8)]===0x0?_0xd811b(0x1e2):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x30fb4a=a42_0x3383;(function(_0x258c1e,_0x574127){const _0x110f2d=a42_0x3383,_0x47208d=_0x258c1e();while(!![]){try{const _0x21114f=parseInt(_0x110f2d(0x106))/0x1*(parseInt(_0x110f2d(0x125))/0x2)+-parseInt(_0x110f2d(0x101))/0x3*(-parseInt(_0x110f2d(0x10a))/0x4)+parseInt(_0x110f2d(0x11a))/0x5+-parseInt(_0x110f2d(0x105))/0x6*(parseInt(_0x110f2d(0x11f))/0x7)+-parseInt(_0x110f2d(0xfe))/0x8+-parseInt(_0x110f2d(0x10c))/0x9*(-parseInt(_0x110f2d(0x107))/0xa)+parseInt(_0x110f2d(0x10d))/0xb*(-parseInt(_0x110f2d(0x104))/0xc);if(_0x21114f===_0x574127)break;else _0x47208d['push'](_0x47208d['shift']());}catch(_0x46a563){_0x47208d['push'](_0x47208d['shift']());}}}(a42_0x440f,0x2adda));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';function a42_0x3383(_0x76fd9e,_0x5248ca){_0x76fd9e=_0x76fd9e-0xfb;const _0x440fc4=a42_0x440f();let _0x33837f=_0x440fc4[_0x76fd9e];return _0x33837f;}import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x30fb4a(0x100),a42_0x30fb4a(0x119),a42_0x30fb4a(0x116),a42_0x30fb4a(0x124)];export function resolveBffLogQuery(_0x3fddea,_0x55b124=Date[a42_0x30fb4a(0x108)]()){const _0x137c82=a42_0x30fb4a,_0x4d7744=_0x3fddea['flag'](_0x137c82(0x11c)),_0x142eaf=_0x3fddea[_0x137c82(0x112)]('start-time'),_0xf3278e=_0x3fddea['flag']('end-time');if(_0x4d7744!==undefined&&_0x142eaf!==undefined)throw CliErrors[_0x137c82(0x109)](_0x137c82(0xfc));const _0x2b0f21=_0xf3278e===undefined?_0x55b124:readPositiveInteger(_0x3fddea[_0x137c82(0x113)](_0x137c82(0x111)),_0x137c82(0xff)),_0x480f13=_0x142eaf===undefined?_0x2b0f21-readSinceMinutes(_0x3fddea)*0xea60:readPositiveInteger(_0x3fddea[_0x137c82(0x113)](_0x137c82(0x11d)),'--start-time');if(_0x480f13<=0x0)throw CliErrors['validation']('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x480f13>_0x2b0f21)throw CliErrors['validation'](_0x137c82(0x11e));const _0x4bfedb=readPositiveInteger(_0x3fddea['num'](_0x137c82(0x102),DEFAULT_LIMIT),_0x137c82(0x120));if(_0x4bfedb>MAX_LIMIT)throw CliErrors[_0x137c82(0x109)](_0x137c82(0x12c)+MAX_LIMIT+'.');const _0x35d653=_0x3fddea[_0x137c82(0x115)](_0x137c82(0x10f))[_0x137c82(0x114)]()['toUpperCase']()||undefined,_0xbab03f=_0x3fddea['str'](_0x137c82(0x10b))['trim']()||undefined;return{'appCode':_0x3fddea[_0x137c82(0x118)],'startTime':_0x480f13,'endTime':_0x2b0f21,..._0x142eaf===undefined?{'sinceMinutes':readSinceMinutes(_0x3fddea)}:{},..._0x35d653?{'level':_0x35d653}:{},..._0xbab03f?{'keyword':_0xbab03f}:{},'limit':_0x4bfedb};}function readSinceMinutes(_0x104a9b){const _0x320a03=a42_0x30fb4a;return readPositiveInteger(_0x104a9b[_0x320a03(0x113)]('since',DEFAULT_SINCE_MINUTES),_0x320a03(0xfb));}function readPositiveInteger(_0xd3c918,_0x30e44e){const _0x251d2b=a42_0x30fb4a;if(!Number[_0x251d2b(0x110)](_0xd3c918)||_0xd3c918<=0x0)throw CliErrors['validation'](_0x30e44e+_0x251d2b(0x11b));return _0xd3c918;}function a42_0x440f(){const _0x4893da=['--since','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','2774208UOHtmY','--end-time','DEBUG','39Wcaxhf','limit','Found\x20','1818660eVeZGd','36TPZxwu','88qjwtJx','170pSiwKB','now','validation','105236OGWzIV','keyword','91215xSklin','11AQfEWu','string','level','isSafeInteger','end-time','flag','num','trim','str','WARN','\x20Backend\x20Function\x20log\x20line(s).','appCode','INFO','973085pSBgpN','\x20must\x20be\x20a\x20positive\x20integer.','since','start-time','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','65086JxckBm','--limit','number','read','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','ERROR','472KtKhQz','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','Maximum\x20log\x20lines\x20to\x20return\x20(1-','length','bff','--limit\x20must\x20be\x20between\x201\x20and\x20'];a42_0x440f=function(){return _0x4893da;};return a42_0x440f();}export const bffLogs={'service':a42_0x30fb4a(0x12b),'command':'logs','description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':a42_0x30fb4a(0x122),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':'since','type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x123)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x30fb4a(0x11d),'type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x128)},{'name':a42_0x30fb4a(0x111),'type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x126)},{'name':a42_0x30fb4a(0x10f),'type':a42_0x30fb4a(0x10e),'description':'Filter\x20by\x20log\x20level','enum':LOG_LEVELS},{'name':'keyword','type':a42_0x30fb4a(0x10e),'description':a42_0x30fb4a(0xfd)},{'name':a42_0x30fb4a(0x102),'type':a42_0x30fb4a(0x121),'description':a42_0x30fb4a(0x129)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x3c579e){resolveBffLogQuery(_0x3c579e);},async 'execute'(_0x39f5f4){const _0x38d097=a42_0x30fb4a,_0x5c3bca=resolveBffLogQuery(_0x39f5f4),{sinceMinutes:_0x44916b,..._0x12d926}=_0x5c3bca,_0x48c291=await searchBffScriptLogs(_0x12d926);return{'ok':!![],'data':{'query':_0x5c3bca,'count':_0x48c291[_0x38d097(0x12a)],'logs':_0x48c291},'message':_0x48c291[_0x38d097(0x12a)]===0x0?_0x38d097(0x127):_0x38d097(0x103)+_0x48c291[_0x38d097(0x12a)]+_0x38d097(0x117)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a43_0x1830(_0x5d2a39,_0x244548){_0x5d2a39=_0x5d2a39-0x87;const _0x547eb8=a43_0x547e();let _0x18304f=_0x547eb8[_0x5d2a39];return _0x18304f;}const a43_0x1d3bc7=a43_0x1830;(function(_0x2038a8,_0x3c33a4){const _0x3ed6b6=a43_0x1830,_0x5552d1=_0x2038a8();while(!![]){try{const _0x455db2=-parseInt(_0x3ed6b6(0x117))/0x1+parseInt(_0x3ed6b6(0xb9))/0x2*(-parseInt(_0x3ed6b6(0xe2))/0x3)+-parseInt(_0x3ed6b6(0xa9))/0x4*(parseInt(_0x3ed6b6(0xa3))/0x5)+-parseInt(_0x3ed6b6(0x115))/0x6*(parseInt(_0x3ed6b6(0x119))/0x7)+parseInt(_0x3ed6b6(0x111))/0x8+parseInt(_0x3ed6b6(0xdf))/0x9+parseInt(_0x3ed6b6(0xcb))/0xa*(parseInt(_0x3ed6b6(0xca))/0xb);if(_0x455db2===_0x3c33a4)break;else _0x5552d1['push'](_0x5552d1['shift']());}catch(_0x482151){_0x5552d1['push'](_0x5552d1['shift']());}}}(a43_0x547e,0xa2fe2));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';function a43_0x547e(){const _0x14659c=['.hook-directory-migrate-','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','entry','stderr','join','set','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','includes','code','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','boolean','ENDPOINT','has','Pull\x20complete:\x20','require','¤tPage=1&pageSize=','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x20conflict','dev','nonInteractive','rekey','flatMap','split','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','read','toLowerCase','scriptType','move','\x22\x20to\x20\x22','functionName','Pull\x20only\x20this\x20script\x20type','type','lockKey','message','941944CetinU','all','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.','values','6PLNGMK','scriptContent','1242468ukfnBl','filePath','2614052JHWsXk','push_local','would_pull','NFC','oldDirectory','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','datasetCode','\x20resolution','Failed\x20to\x20write\x20local\x20script\x20\x22','\x20--name\x20','\x22:\x20','\x22:\x20both\x20target\x20\x22','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','content','Lock\x20scope\x20for\x20app\x20\x22','mode','lastSync','pull','lockFilePath','map','toISOString','selectedAppName','bff','requires','HOOK','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','hookLocation','operationType','conflict','keyChanges','defaultApp','389770WsBiyO','newDirectory','currentApp','scriptsRootDir','\x22:\x20its\x20target\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','44tGymuL','ENOENT','rollback','bool','functions','\x20--format\x20compress','utf8','\x22\x20from\x20\x22','case-rename','some','get','\x22\x20from\x20the\x20lock\x20file.','\x22\x20and\x20\x22','entries','close','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','46MjZJtX','existed','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','\x20Recovery\x20errors:\x20','stdin','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','normalize','GET','\x20skipped','oldLockKey','oldDirectoryPath','appCode','newLockKey','reverse','apps','length','&type=','39089875PDtFjl','10fKLfMi','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','remoteId','unresolvable\x20target\x20path','alias','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','string','projectedFunctions','\x20bff\x20push\x20--type\x20','push','Force\x20pull\x20cancelled.','HOOK/','validation','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','functionNode','str','yes','754353snGAQo','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','filter','80109HnqaYw','newDirectoryPath','mergedCli','ino','Remote\x20script\x20missing\x20id.','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','\x22;\x20temporary\x20directory\x20\x22','force','hash','\x20pulled','cancelled','apiDir','\x20failed'];a43_0x547e=function(){return _0x14659c;};return a43_0x547e();}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_0x1d3bc7(0x9a),'command':'pull','description':a43_0x1d3bc7(0xcf),'risk':a43_0x1d3bc7(0x107),'structuredErrors':!![],'flags':[{'name':a43_0x1d3bc7(0x10e),'type':a43_0x1d3bc7(0xd4),'description':a43_0x1d3bc7(0x10d),'enum':['COMMON',a43_0x1d3bc7(0xfa),a43_0x1d3bc7(0x9c)]},{'name':a43_0x1d3bc7(0xe9),'type':a43_0x1d3bc7(0xf9),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x12dd4c){const _0x31aa13=a43_0x1d3bc7,_0x16bfa2=loadBffProjectConfig(_0x12dd4c[_0x31aa13(0xc4)]),_0x25e32d=await readBffLockFile(_0x16bfa2[_0x31aa13(0x96)]),{appLock:_0x72983c}=ensureLockScope(_0x25e32d??createEmptyBffLock(),_0x12dd4c[_0x31aa13(0xc4)],_0x16bfa2['scriptsRoot'],_0x31aa13(0x95)),_0x34f8e6=normalizeBffType(_0x12dd4c[_0x31aa13(0xdd)](_0x31aa13(0x10e)))??undefined,[_0x220b2f,_0x30a30e]=await Promise['all']([listBffScripts(_0x12dd4c['appCode'],_0x34f8e6),getBffScriptStatistics(_0x12dd4c[_0x31aa13(0xc4)])]),_0x5c1b04=_0x220b2f[_0x31aa13(0xb2)](_0x32a2fc=>normalizeBffType(_0x32a2fc[_0x31aa13(0x109)])===_0x31aa13(0x9c)),_0x5626f6=_0x5c1b04?buildDatasetCodeToAliasMap(_0x12dd4c['apiDir'],_0x12dd4c[_0x31aa13(0xc4)],_0x12dd4c[_0x31aa13(0x99)]||_0x12dd4c['mergedCli']?.[_0x31aa13(0xa5)]||_0x12dd4c[_0x31aa13(0xe4)]?.[_0x31aa13(0xa2)]):new Map(),_0x21e4c5=_0x5c1b04?await planHookDirectoryMigration(_0x16bfa2,_0x72983c,_0x5626f6,await scanLocalBffFunctions(_0x16bfa2,_0x31aa13(0x9c))):undefined,_0x59ef64=createHookLocationMap(_0x30a30e),_0x4e25a8=[];for(const _0x168eb5 of _0x220b2f){const _0x3bc8fa=resolveRemoteScriptTarget(_0x16bfa2,_0x168eb5,_0x59ef64,_0x21e4c5?.[_0x31aa13(0xd5)]??_0x72983c[_0x31aa13(0xad)],_0x5626f6);if(!_0x3bc8fa){_0x4e25a8['push']({'scriptType':_0x168eb5[_0x31aa13(0x109)],'functionName':_0x168eb5[_0x31aa13(0x10c)]??'','status':'skipped','reason':_0x31aa13(0xd1)});continue;}const _0x5e68e3=(_0x21e4c5?.['projectedFunctions']??_0x72983c['functions'])[_0x3bc8fa[_0x31aa13(0x10f)]],_0x5c9f14=_0x168eb5[_0x31aa13(0x116)]!=null?computeContentHash(_0x168eb5[_0x31aa13(0x116)]):undefined,_0x468857=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x21e4c5,_0x3bc8fa)??_0x3bc8fa[_0x31aa13(0x118)],_0x5e68e3,_0x5c9f14),_0xb70a76=_0x468857?localUnsyncedConflict(_0x3bc8fa,_0x168eb5['id']):undefined;_0x4e25a8[_0x31aa13(0xd7)]({'lockKey':_0x3bc8fa[_0x31aa13(0x10f)],'filePath':_0x3bc8fa[_0x31aa13(0x118)],'remoteId':_0x168eb5['id']??null,'status':_0xb70a76?_0x31aa13(0xa0):_0x31aa13(0x11b),..._0xb70a76?{'conflict':_0xb70a76}:{},..._0x3bc8fa['hookLocation']?{'alias':_0x3bc8fa['hookLocation'][_0x31aa13(0xd2)]??null,'datasetCode':_0x3bc8fa['hookLocation'][_0x31aa13(0x8a)],'operationType':_0x3bc8fa[_0x31aa13(0x9e)][_0x31aa13(0x9f)],'functionNode':_0x3bc8fa[_0x31aa13(0x9e)][_0x31aa13(0xdc)]}:{}});}return{'method':_0x31aa13(0xc0),'url':'/api/management/library/scripts/list?appCode='+_0x12dd4c['appCode']+(_0x34f8e6?_0x31aa13(0xc9)+_0x34f8e6:'')+_0x31aa13(0xfe)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x12dd4c[_0x31aa13(0xc4)],'filterType':_0x34f8e6??null,..._0x21e4c5&&_0x21e4c5['migrations']['length']>0x0?{'hookDirectoryMigrations':_0x21e4c5['migrations'][_0x31aa13(0x97)](_0x42e449=>({'from':_0x42e449[_0x31aa13(0x87)],'to':_0x42e449['newDirectory']}))}:{},'files':_0x4e25a8},'description':'Would\x20inspect\x20'+_0x4e25a8[_0x31aa13(0xc8)]+_0x31aa13(0x106)};},async 'execute'(_0x507202){const _0x3e584d=a43_0x1d3bc7,_0x1fe713=loadBffProjectConfig(_0x507202[_0x3e584d(0xc4)]),_0x47d691=await readBffLockFile(_0x1fe713[_0x3e584d(0x96)]),{lockData:_0x2e1ade,appLock:_0xd6eb1d}=ensureLockScope(_0x47d691??createEmptyBffLock(),_0x507202[_0x3e584d(0xc4)],_0x1fe713['scriptsRoot'],'pull'),_0x5e2257=normalizeBffType(_0x507202[_0x3e584d(0xdd)](_0x3e584d(0x10e)))??undefined;if(_0x507202['str']('type')&&!_0x5e2257)throw CliErrors[_0x3e584d(0xda)](_0x3e584d(0xf8));const [_0x1dd0df,_0x2abccc]=await Promise[_0x3e584d(0x112)]([listBffScripts(_0x507202[_0x3e584d(0xc4)],_0x5e2257),getBffScriptStatistics(_0x507202[_0x3e584d(0xc4)])]);if(_0x1dd0df['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x5eb692=_0x507202[_0x3e584d(0xac)](_0x3e584d(0xe9));if(_0x5eb692&&!_0x507202[_0x3e584d(0x102)]){const _0x2e080f=await confirmForce();if(!_0x2e080f)throw CliErrors[_0x3e584d(0xec)](_0x3e584d(0xd8));}if(_0x5eb692&&_0x507202[_0x3e584d(0x102)]){}const _0x5e988f=_0x1dd0df[_0x3e584d(0xb2)](_0x4f4382=>normalizeBffType(_0x4f4382['scriptType'])===_0x3e584d(0x9c)),_0x2f9971=_0x5e988f?buildDatasetCodeToAliasMap(_0x507202[_0x3e584d(0xed)],_0x507202['appCode'],_0x507202[_0x3e584d(0x99)]||_0x507202[_0x3e584d(0xe4)]?.[_0x3e584d(0xa5)]||_0x507202[_0x3e584d(0xe4)]?.['defaultApp']):new Map(),_0x215a12=createHookLocationMap(_0x2abccc),_0x249575=JSON['parse'](JSON['stringify'](_0x2e1ade)),_0x3d45e9=_0x507202['appCode'],_0x53250a=_0x249575[_0x3e584d(0xc7)][_0x3d45e9];if(!_0x53250a)throw new Error(_0x3e584d(0x92)+_0x3d45e9+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0xb3ca0c=_0x5e988f?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x1fe713,_0x53250a,_0x2f9971,await scanLocalBffFunctions(_0x1fe713,_0x3e584d(0x9c))),_0x53250a):undefined,_0x3e340a=createPullFileTransaction(),_0x199554=[],_0x5a9517=[],_0x688946=[],_0x4f6355=[];for(const _0x121883 of _0x1dd0df){const _0x19e6ef=resolveRemoteScriptTarget(_0x1fe713,_0x121883,_0x215a12,_0x53250a[_0x3e584d(0xad)],_0x2f9971);if(!_0x19e6ef){_0x5a9517[_0x3e584d(0xd7)]({'lockKey':_0x121883[_0x3e584d(0x109)]+'/'+_0x121883[_0x3e584d(0x10c)],'reason':_0x3e584d(0xd1)});continue;}const _0x1160c4=_0x53250a[_0x3e584d(0xad)][_0x19e6ef[_0x3e584d(0x10f)]];try{if(!_0x121883['id'])throw new Error(_0x3e584d(0xe6));if(_0x121883[_0x3e584d(0x116)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x469041=_0x121883['scriptContent'],_0x3ab339=computeContentHash(_0x469041);if(!_0x5eb692){const _0xe29a06=await hasUnsyncedLocalChanges(_0x19e6ef[_0x3e584d(0x118)],_0x1160c4,_0x3ab339);if(_0xe29a06){_0x688946['push'](localUnsyncedConflict(_0x19e6ef,_0x121883['id']));continue;}}await _0x3e340a['write'](_0x19e6ef[_0x3e584d(0x118)],_0x469041);const _0x58aae0={'hash':_0x3ab339,'remoteId':_0x121883['id'],'version':_0x121883['version']};_0x19e6ef[_0x3e584d(0x10e)]===_0x3e584d(0x9c)&&_0x19e6ef['hookLocation']&&(_0x58aae0[_0x3e584d(0xd2)]=_0x19e6ef[_0x3e584d(0x9e)]['alias'],_0x58aae0[_0x3e584d(0x8a)]=_0x19e6ef[_0x3e584d(0x9e)][_0x3e584d(0x8a)],_0x58aae0[_0x3e584d(0x9f)]=_0x19e6ef['hookLocation'][_0x3e584d(0x9f)],_0x58aae0['functionNode']=_0x19e6ef[_0x3e584d(0x9e)][_0x3e584d(0xdc)]),_0x53250a[_0x3e584d(0xad)][_0x19e6ef[_0x3e584d(0x10f)]]=_0x58aae0,_0x199554[_0x3e584d(0xd7)]({'lockKey':_0x19e6ef[_0x3e584d(0x10f)],'remoteId':_0x121883['id']});}catch(_0x41e8e5){_0x4f6355[_0x3e584d(0xd7)]({'lockKey':_0x19e6ef[_0x3e584d(0x10f)],'error':_0x41e8e5 instanceof Error?_0x41e8e5[_0x3e584d(0x110)]:String(_0x41e8e5)});}}_0x53250a[_0x3e584d(0x94)]=new Date()[_0x3e584d(0x98)]();try{await writeBffLockFile(_0x1fe713[_0x3e584d(0x96)],_0x249575);}catch(_0x1d45a2){const _0x49d13c=[...await _0x3e340a[_0x3e584d(0xab)](),...await _0xb3ca0c?.[_0x3e584d(0xab)]()??[]];throw withRollbackErrors(_0x1d45a2,_0x3e584d(0x90),_0x49d13c);}return{'ok':_0x4f6355[_0x3e584d(0xc8)]===0x0,'data':{'pulled':_0x199554,'skipped':_0x5a9517,'conflicts':_0x688946,'failed':_0x4f6355},'message':formatPullMessage(_0x199554[_0x3e584d(0xc8)],_0x5a9517[_0x3e584d(0xc8)],_0x688946[_0x3e584d(0xc8)],_0x4f6355[_0x3e584d(0xc8)])};}};function localUnsyncedConflict(_0x5b3af6,_0x1b2f64){const _0x5932ec=a43_0x1d3bc7,_0x1b12a6=_0x5b3af6[_0x5932ec(0x10f)]['split']('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x5b3af6[_0x5932ec(0x10f)],'filePath':_0x5b3af6[_0x5932ec(0x118)],..._0x1b2f64!=null?{'remoteId':_0x1b2f64}:{},'message':_0x5932ec(0xf5),'nextAction':{'action':_0x5932ec(0x11a),'command':CLI_BIN_NAME+_0x5932ec(0xd6)+_0x5b3af6['type']+_0x5932ec(0x8d)+_0x1b12a6+_0x5932ec(0xae),'requiresReview':!![],'message':_0x5932ec(0x113)}};}function formatPullMessage(_0x22dc18,_0x18f21c,_0x325a31,_0x5df1aa){const _0x5be3a5=a43_0x1d3bc7,_0xc2e11c=[_0x5be3a5(0xfc)+_0x22dc18+_0x5be3a5(0xeb),_0x18f21c+_0x5be3a5(0xc1)];_0x325a31>0x0&&_0xc2e11c[_0x5be3a5(0xd7)](_0x325a31+_0x5be3a5(0x100)+(_0x325a31===0x1?'':'s')+'\x20'+(_0x325a31===0x1?_0x5be3a5(0x9b):_0x5be3a5(0xfd))+_0x5be3a5(0x8b));if(_0x5df1aa>0x0)_0xc2e11c[_0x5be3a5(0xd7)](_0x5df1aa+_0x5be3a5(0xee));return _0xc2e11c[_0x5be3a5(0xf3)](',\x20');}async function hasUnsyncedLocalChanges(_0xb806de,_0xb2a394,_0x45b1aa){const _0xb5557f=a43_0x1d3bc7;if(!await fileExists(_0xb806de))return![];const _0x44459c=await computeFileHash(_0xb806de);if(!_0xb2a394)return _0x45b1aa?_0x44459c!==_0x45b1aa:!![];return _0x44459c!==_0xb2a394[_0xb5557f(0xea)];}function createPullFileTransaction(){const _0x4b51c5=new Map(),_0x3094b1=async(_0x488377,_0x11be09)=>{const _0x339096=a43_0x1830;try{if(_0x11be09[_0x339096(0xba)])await ensureParentDirectory(_0x488377),await writeFile(_0x488377,_0x11be09[_0x339096(0x91)]);else try{await unlink(_0x488377);}catch(_0x5ccf5d){if(_0x5ccf5d[_0x339096(0xf7)]!==_0x339096(0xaa))throw _0x5ccf5d;}return undefined;}catch(_0x332e99){return _0x332e99 instanceof Error?_0x332e99:new Error(String(_0x332e99));}};return{async 'write'(_0x3d8c2c,_0xc0b57b){const _0x54e1a9=a43_0x1830;if(!_0x4b51c5[_0x54e1a9(0xfb)](_0x3d8c2c))try{_0x4b51c5[_0x54e1a9(0xf4)](_0x3d8c2c,{'existed':!![],'content':await readFile(_0x3d8c2c)});}catch(_0xe35ec8){if(_0xe35ec8[_0x54e1a9(0xf7)]!=='ENOENT')throw _0xe35ec8;_0x4b51c5[_0x54e1a9(0xf4)](_0x3d8c2c,{'existed':![]});}try{await ensureParentDirectory(_0x3d8c2c),await writeFile(_0x3d8c2c,_0xc0b57b,_0x54e1a9(0xaf));}catch(_0xd28b81){const _0x34bcfa=await _0x3094b1(_0x3d8c2c,_0x4b51c5['get'](_0x3d8c2c));if(!_0x34bcfa)_0x4b51c5['delete'](_0x3d8c2c);throw withRollbackErrors(_0xd28b81,_0x54e1a9(0x8c)+_0x3d8c2c+'\x22.',_0x34bcfa?[_0x34bcfa]:[]);}},async 'rollback'(){const _0x5e2776=a43_0x1830,_0x1c6760=[];for(const [_0x27eac6,_0x1a3e07]of[..._0x4b51c5['entries']()][_0x5e2776(0xc6)]()){const _0x2fd437=await _0x3094b1(_0x27eac6,_0x1a3e07);_0x2fd437&&_0x1c6760[_0x5e2776(0xd7)](new Error(_0x5e2776(0xa8)+_0x27eac6+_0x5e2776(0x8e)+_0x2fd437[_0x5e2776(0x110)]));}return _0x1c6760;}};}function withRollbackErrors(_0x7c8e65,_0x5b8017,_0xc1ee5f){const _0x5c8144=a43_0x1d3bc7,_0x46d577=_0x7c8e65 instanceof Error?_0x7c8e65:new Error(String(_0x7c8e65));if(_0xc1ee5f[_0x5c8144(0xc8)]===0x0)return _0x46d577;return new AggregateError([_0x46d577,..._0xc1ee5f],_0x5b8017+_0x5c8144(0xbc)+_0xc1ee5f[_0x5c8144(0x97)](_0x1c1334=>_0x1c1334[_0x5c8144(0x110)])[_0x5c8144(0xf3)](';\x20'));}function buildDatasetCodeToAliasMap(_0xa2de36,_0x196002,_0x385d98){const _0x3162a7=a43_0x1d3bc7,_0x50eb15=resolveApiModelSource(_0xa2de36,_0x196002,_0x385d98),_0x51e4aa=loadAliasMap(_0xa2de36,undefined,_0x50eb15['filePath'],_0x50eb15['profileName']);return assertUnambiguousHookAliases(_0x51e4aa),new Map(_0x51e4aa[_0x3162a7(0x97)](_0x4c7c0e=>[_0x4c7c0e[_0x3162a7(0x8a)][_0x3162a7(0x108)](),_0x4c7c0e['alias']]));}async function planHookDirectoryMigration(_0x33dd7a,_0x388f1a,_0x517c18,_0x1b2cd5){const _0x2e513d=a43_0x1d3bc7,_0x2c6e68=new Map();for(const [_0xeae7cc,_0x478228]of Object[_0x2e513d(0xb6)](_0x388f1a[_0x2e513d(0xad)])){const [_0x1dde0a,_0x43d85c,_0x5dc916,_0x34c958,_0x1178c7,..._0x323b0b]=_0xeae7cc[_0x2e513d(0x105)]('/');if(_0x1dde0a!==_0x2e513d(0x9c)||!_0x43d85c||!_0x5dc916||!_0x34c958||!_0x1178c7||_0x323b0b['length']>0x0||!_0x478228['datasetCode'])continue;const _0x484ba2=_0x517c18[_0x2e513d(0xb3)](_0x478228['datasetCode'][_0x2e513d(0x108)]()),_0x13065f=_0x484ba2??_0x478228['datasetCode'];if(!isSafeHookDirectorySegment(_0x43d85c))throw CliErrors[_0x2e513d(0xda)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x43d85c+_0x2e513d(0xb4));if(!isSafeHookDirectorySegment(_0x13065f))throw CliErrors[_0x2e513d(0xda)](_0x2e513d(0x9d)+_0x43d85c+_0x2e513d(0xbe));if(_0x43d85c===_0x13065f)continue;const _0x23a107=_0x2c6e68[_0x2e513d(0xb3)](_0x43d85c)??{'datasetCode':_0x478228[_0x2e513d(0x8a)],'alias':_0x484ba2,'keyChanges':[]};if(_0x23a107['datasetCode']!==_0x478228['datasetCode'])throw CliErrors['validation'](_0x2e513d(0x9d)+_0x43d85c+_0x2e513d(0xf0));const _0x34f87a=_0x2e513d(0xd9)+_0x13065f+'/'+_0x5dc916+'/'+_0x34c958+'/'+_0x1178c7;try{resolveLocalFilePathFromLockKey(_0x33dd7a,_0xeae7cc),resolveLocalFilePathFromLockKey(_0x33dd7a,_0x34f87a);}catch(_0x371cd7){throw CliErrors[_0x2e513d(0xda)](_0x2e513d(0xdb)+_0xeae7cc+'\x22:\x20'+(_0x371cd7 instanceof Error?_0x371cd7[_0x2e513d(0x110)]:String(_0x371cd7)));}_0x23a107['keyChanges']['push']({'oldLockKey':_0xeae7cc,'newLockKey':_0x34f87a,'entry':_0x478228}),_0x2c6e68[_0x2e513d(0xf4)](_0x43d85c,_0x23a107);}const _0x908966=new Set([..._0x2c6e68[_0x2e513d(0x114)]()][_0x2e513d(0x104)](_0x5025ce=>_0x5025ce[_0x2e513d(0xa1)][_0x2e513d(0x97)](_0x270c1d=>_0x270c1d[_0x2e513d(0xc2)]))),_0x2d1819=new Map(),_0xc4b884=new Map();for(const [_0x204565,_0x2a7453]of _0x2c6e68){const _0x23b37e=_0x2a7453[_0x2e513d(0xd2)]??_0x2a7453[_0x2e513d(0x8a)],_0x17fb1f=hookDirectoryIdentity(_0x23b37e),_0x4d5d78=_0x2d1819['get'](_0x17fb1f);if(_0x4d5d78&&_0x4d5d78!==_0x204565)throw CliErrors['validation'](_0x2e513d(0xe7)+_0x4d5d78+_0x2e513d(0xb5)+_0x204565+_0x2e513d(0x8f)+_0x23b37e+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x2d1819[_0x2e513d(0xf4)](_0x17fb1f,_0x204565);for(const _0x146863 of _0x2a7453[_0x2e513d(0xa1)]){const _0x501c68=_0xc4b884[_0x2e513d(0xb3)](_0x146863['newLockKey']);if(_0x501c68&&_0x501c68!==_0x146863['oldLockKey'])throw CliErrors['validation'](_0x2e513d(0x88)+_0x501c68+'\x22\x20and\x20\x22'+_0x146863['oldLockKey']+'\x22:\x20both\x20target\x20\x22'+_0x146863[_0x2e513d(0xc5)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x908966[_0x2e513d(0xfb)](_0x146863[_0x2e513d(0xc5)]))throw CliErrors[_0x2e513d(0xda)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x146863[_0x2e513d(0xc2)]+_0x2e513d(0xa7)+_0x146863[_0x2e513d(0xc5)]+_0x2e513d(0xbb));_0xc4b884[_0x2e513d(0xf4)](_0x146863[_0x2e513d(0xc5)],_0x146863[_0x2e513d(0xc2)]);}}const _0x54cb17=new Map();for(const [_0x93b019,_0xb1ad35]of _0x517c18){_0x54cb17['set'](hookDirectoryIdentity(_0xb1ad35),_0x93b019);}const _0x12bbe8=[];for(const [_0xaaa9c2,_0x7b07c7]of _0x2c6e68){const _0x337832=_0x7b07c7[_0x2e513d(0xd2)]??_0x7b07c7[_0x2e513d(0x8a)],_0x32704c=join(_0x33dd7a[_0x2e513d(0xa6)],_0x2e513d(0x9c),_0xaaa9c2),_0x3ee084=join(_0x33dd7a[_0x2e513d(0xa6)],_0x2e513d(0x9c),_0x337832),_0x2971ae=await directoryExists(_0x32704c),_0x2d27e2=await directoryExists(_0x3ee084),_0x504774=_0x2971ae?_0x2d27e2?await sameDirectory(_0x32704c,_0x3ee084)?_0x2e513d(0xb1):undefined:_0x2e513d(0x10a):_0x2e513d(0x103);if(!_0x504774)throw CliErrors['validation'](_0x2e513d(0x9d)+_0xaaa9c2+_0x2e513d(0x10b)+_0x337832+_0x2e513d(0xb8));const _0x554710=_0x54cb17['get'](hookDirectoryIdentity(_0xaaa9c2));if(_0x554710&&_0x554710!==_0x7b07c7[_0x2e513d(0x8a)][_0x2e513d(0x108)]()){const _0x3236e8=new Set(_0x7b07c7[_0x2e513d(0xa1)]['map'](_0x2bf1a2=>_0x2bf1a2[_0x2e513d(0xc2)])),_0x245753=_0x1b2cd5[_0x2e513d(0xe1)](_0x491a45=>_0x491a45[_0x2e513d(0x10e)]==='HOOK'&&_0x491a45[_0x2e513d(0xd2)]!=null&&hookDirectoryIdentity(_0x491a45[_0x2e513d(0xd2)])===hookDirectoryIdentity(_0xaaa9c2)&&!_0x3236e8[_0x2e513d(0xfb)](_0x491a45[_0x2e513d(0x10f)]));if(_0x245753[_0x2e513d(0xc8)]>0x0)throw CliErrors['validation'](_0x2e513d(0x9d)+_0xaaa9c2+_0x2e513d(0xcc));}const _0x3efa29=_0x54cb17[_0x2e513d(0xb3)](hookDirectoryIdentity(_0x337832));if(_0x3efa29&&_0x3efa29!==_0x7b07c7[_0x2e513d(0x8a)][_0x2e513d(0x108)]())throw CliErrors[_0x2e513d(0xda)](_0x2e513d(0x9d)+_0xaaa9c2+_0x2e513d(0x10b)+_0x337832+_0x2e513d(0xd3));for(const _0xe53c2 of _0x7b07c7['keyChanges']){const _0x18a3e2=_0x388f1a['functions'][_0xe53c2['newLockKey']];if(_0x18a3e2&&!_0x908966[_0x2e513d(0xfb)](_0xe53c2[_0x2e513d(0xc5)])&&!sameHookIdentity(_0xe53c2[_0x2e513d(0xf1)],_0x18a3e2))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0xaaa9c2+_0x2e513d(0x10b)+_0x337832+_0x2e513d(0x89));}_0x12bbe8[_0x2e513d(0xd7)]({'oldDirectory':_0xaaa9c2,'newDirectory':_0x337832,'oldDirectoryPath':_0x32704c,'newDirectoryPath':_0x3ee084,'mode':_0x504774,'alias':_0x7b07c7[_0x2e513d(0xd2)],'keyChanges':_0x7b07c7[_0x2e513d(0xa1)]});}const _0x468337={..._0x388f1a[_0x2e513d(0xad)]},_0x54429c=new Map(),_0x2ea376=new Map();for(const _0x3f0edb of _0x12bbe8){const _0x6c75d5=_0x3f0edb[_0x2e513d(0x93)]!==_0x2e513d(0x103);_0x6c75d5&&_0x2ea376[_0x2e513d(0xf4)](hookDirectoryIdentity(_0x3f0edb[_0x2e513d(0xa4)]),_0x3f0edb[_0x2e513d(0xc3)]);for(const _0x202339 of _0x3f0edb[_0x2e513d(0xa1)]){const _0x577a24=_0x468337[_0x202339[_0x2e513d(0xc5)]],_0x4c032c=_0x6c75d5?_0x202339[_0x2e513d(0xf1)]:_0x577a24??_0x202339[_0x2e513d(0xf1)];_0x468337[_0x202339['newLockKey']]=canonicalizeHookEntry(_0x4c032c,_0x3f0edb[_0x2e513d(0xd2)]),delete _0x468337[_0x202339[_0x2e513d(0xc2)]],_0x6c75d5&&_0x54429c['set'](_0x202339[_0x2e513d(0xc5)],resolveLocalFilePathFromLockKey(_0x33dd7a,_0x202339[_0x2e513d(0xc2)]));}}return{'migrations':_0x12bbe8,'projectedFunctions':_0x468337,'sourceFilePathByNewLockKey':_0x54429c,'sourceDirectoryPathByNewDirectory':_0x2ea376};}function resolveMigratedSourceFilePath(_0x4b102a,_0x3cf7c){const _0x133a04=a43_0x1d3bc7;if(!_0x4b102a||!_0x3cf7c)return undefined;const _0x2c2c1d=_0x4b102a['sourceFilePathByNewLockKey'][_0x133a04(0xb3)](_0x3cf7c['lockKey']);if(_0x2c2c1d)return _0x2c2c1d;if(_0x3cf7c[_0x133a04(0x10e)]!==_0x133a04(0x9c))return undefined;const [,_0x450041,..._0xfdb3e3]=_0x3cf7c[_0x133a04(0x10f)][_0x133a04(0x105)]('/');if(!_0x450041||_0xfdb3e3[_0x133a04(0xc8)]===0x0)return undefined;const _0x504682=_0x4b102a['sourceDirectoryPathByNewDirectory']['get'](hookDirectoryIdentity(_0x450041));return _0x504682?join(_0x504682,..._0xfdb3e3)+'.js':undefined;}function sameHookIdentity(_0x517485,_0x16dd45){const _0x317e4f=a43_0x1d3bc7;return _0x517485[_0x317e4f(0xd0)]===_0x16dd45[_0x317e4f(0xd0)]&&_0x517485[_0x317e4f(0x8a)]===_0x16dd45['datasetCode']&&_0x517485['operationType']===_0x16dd45[_0x317e4f(0x9f)]&&_0x517485['functionNode']===_0x16dd45[_0x317e4f(0xdc)];}function canonicalizeHookEntry(_0x1154a7,_0x201cf9){const {alias:_0x13e10d,..._0x2611d1}=_0x1154a7;return _0x201cf9?{..._0x2611d1,'alias':_0x201cf9}:_0x2611d1;}function hookDirectoryIdentity(_0x47e6af){const _0x1fc034=a43_0x1d3bc7;return _0x47e6af[_0x1fc034(0xbf)](_0x1fc034(0x11c))[_0x1fc034(0x108)]();}function isSafeHookDirectorySegment(_0x29b99c){return isSafeLockKeySegment(_0x29b99c);}async function sameDirectory(_0x3592a0,_0x322c02){const _0x14b2e7=a43_0x1d3bc7,[_0x1afc62,_0x53cd6a]=await Promise[_0x14b2e7(0x112)]([stat(_0x3592a0),stat(_0x322c02)]);return _0x1afc62[_0x14b2e7(0x101)]===_0x53cd6a[_0x14b2e7(0x101)]&&_0x1afc62[_0x14b2e7(0xe5)]===_0x53cd6a['ino'];}async function applyHookDirectoryMigration(_0x1b8ddf,_0xb84354){const _0x121895=a43_0x1d3bc7,_0x5b6f74=_0xb84354[_0x121895(0xad)],_0x21e833=_0xb84354[_0x121895(0x94)],_0x2b9594=[],_0x4656e8=async()=>{const _0x436d3f=_0x121895,_0xf096f5=[];_0xb84354[_0x436d3f(0xad)]=_0x5b6f74,_0xb84354[_0x436d3f(0x94)]=_0x21e833;for(const {migration:_0x2b860b,temporaryPath:_0x1d7409}of[..._0x2b9594][_0x436d3f(0xc6)]()){try{_0x1d7409?(await rename(_0x2b860b['newDirectoryPath'],_0x1d7409),await rename(_0x1d7409,_0x2b860b[_0x436d3f(0xc3)])):await rename(_0x2b860b[_0x436d3f(0xe3)],_0x2b860b[_0x436d3f(0xc3)]);}catch(_0x3a3f12){_0xf096f5[_0x436d3f(0xd7)](new Error(_0x436d3f(0xce)+_0x2b860b[_0x436d3f(0x87)]+_0x436d3f(0xb0)+_0x2b860b[_0x436d3f(0xa4)]+_0x436d3f(0x8e)+(_0x3a3f12 instanceof Error?_0x3a3f12[_0x436d3f(0x110)]:String(_0x3a3f12))));}}return _0xf096f5;};try{for(const _0x655560 of _0x1b8ddf['migrations']){if(_0x655560[_0x121895(0x93)]===_0x121895(0x10a))await ensureParentDirectory(_0x655560[_0x121895(0xe3)]),await rename(_0x655560['oldDirectoryPath'],_0x655560['newDirectoryPath']),_0x2b9594[_0x121895(0xd7)]({'migration':_0x655560});else{if(_0x655560['mode']===_0x121895(0xb1)){const _0x591bda=join(dirname(_0x655560[_0x121895(0xc3)]),_0x121895(0xef)+randomUUID());await rename(_0x655560['oldDirectoryPath'],_0x591bda);try{await rename(_0x591bda,_0x655560[_0x121895(0xe3)]);}catch(_0x59f44a){try{await rename(_0x591bda,_0x655560[_0x121895(0xc3)]);}catch(_0x6f2753){throw withRollbackErrors(_0x59f44a,_0x121895(0xff)+_0x655560[_0x121895(0x87)]+_0x121895(0x10b)+_0x655560['newDirectory']+_0x121895(0xe8)+_0x591bda+'\x22\x20may\x20remain.',[new Error(_0x121895(0xcd)+_0x591bda+_0x121895(0x10b)+_0x655560[_0x121895(0x87)]+_0x121895(0x8e)+(_0x6f2753 instanceof Error?_0x6f2753[_0x121895(0x110)]:String(_0x6f2753)))]);}throw _0x59f44a;}_0x2b9594['push']({'migration':_0x655560,'temporaryPath':_0x591bda});}}}return _0xb84354[_0x121895(0xad)]=_0x1b8ddf[_0x121895(0xd5)],{'rollback':_0x4656e8};}catch(_0x4fc03a){const _0x1eecc3=await _0x4656e8();throw withRollbackErrors(_0x4fc03a,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x1eecc3);}}async function confirmForce(){const _0x114fdf=a43_0x1d3bc7,_0x32f546=createInterface({'input':process[_0x114fdf(0xbd)],'output':process[_0x114fdf(0xf2)]}),_0x4fc0fa=await new Promise(_0x5960e2=>{const _0x44aaad=_0x114fdf;_0x32f546['question'](_0x44aaad(0xe0),_0x5960e2);});return _0x32f546[_0x114fdf(0xb7)](),['y',_0x114fdf(0xde)][_0x114fdf(0xf6)](_0x4fc0fa['trim']()[_0x114fdf(0x108)]());}
|
|
1
|
+
const a43_0x4d5031=a43_0x1a84;(function(_0xf7319c,_0x4e959b){const _0x5b6823=a43_0x1a84,_0x419645=_0xf7319c();while(!![]){try{const _0x21fe1c=-parseInt(_0x5b6823(0x1b6))/0x1+-parseInt(_0x5b6823(0x1c1))/0x2*(-parseInt(_0x5b6823(0x1ba))/0x3)+-parseInt(_0x5b6823(0x1d4))/0x4+-parseInt(_0x5b6823(0x1c7))/0x5*(parseInt(_0x5b6823(0x1cb))/0x6)+parseInt(_0x5b6823(0x1e4))/0x7+parseInt(_0x5b6823(0x1d9))/0x8*(parseInt(_0x5b6823(0x1fe))/0x9)+parseInt(_0x5b6823(0x1b4))/0xa;if(_0x21fe1c===_0x4e959b)break;else _0x419645['push'](_0x419645['shift']());}catch(_0x2ab385){_0x419645['push'](_0x419645['shift']());}}}(a43_0x1ae3,0x8bd26));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';function a43_0x1a84(_0x1f6c96,_0x57a0ef){_0x1f6c96=_0x1f6c96-0x179;const _0x1ae37e=a43_0x1ae3();let _0x1a84c2=_0x1ae37e[_0x1f6c96];return _0x1a84c2;}import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';function a43_0x1ae3(){const _0x1d0585=['\x22:\x20','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','str','\x20skipped','mergedCli','Remote\x20script\x20missing\x20id.','stderr','selectedAppName','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','skipped','case-rename','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x20bff\x20push\x20--type\x20','scriptType','stringify','utf8','alias','COMMON','.js','ENDPOINT','\x22\x20to\x20\x22','map','write','operationType','45ggQuQh','HOOK','Remote\x20script\x20missing\x20content.','\x20Recovery\x20errors:\x20','code','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','requires','hookLocation','Pull\x20only\x20this\x20script\x20type','functions','BFF_LOCAL_UNSYNCED','entry','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','string','some','GET','newDirectoryPath','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','newDirectory','cancelled','set','lastSync','values','boolean','/api/management/library/scripts/list?appCode=','apiDir','migrations','profileName','\x20pulled','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','\x20resolution','version','dev','force','\x20failed','Force\x20pull\x20cancelled.','&type=','includes','push_local','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x20--format\x20compress','bool','\x22\x20may\x20remain.','.hook-directory-migrate-','pull','lockKey','\x22\x20and\x20\x22','Failed\x20to\x20write\x20local\x20script\x20\x22','\x22:\x20its\x20target\x20\x22','sourceDirectoryPathByNewDirectory','defaultApp','entries','scriptsRootDir','rollback','rekey','datasetCode','conflict','newLockKey','\x22:\x20both\x20target\x20\x22','scriptContent','ENOENT','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x22\x20from\x20\x22','split','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','functionName','scriptsRoot','toLowerCase','message','oldDirectory','4332070AUxwNW','\x22;\x20temporary\x20directory\x20\x22','420602ShBpOA','reverse','oldDirectoryPath','question','21309rydajq','nonInteractive','length','toISOString','normalize','delete','content','112eTYbcp','\x22\x20from\x20the\x20lock\x20file.','get','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','all','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','5zxNlkK','\x22\x20not\x20found\x20after\x20ensureLockScope.','move','type','2524260cbDtFR','oldLockKey','has','ino','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','lockFilePath','projectedFunctions','3140672cqrLGc','¤tPage=1&pageSize=','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.','functionNode','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','609608tZnjdb','mode','filePath','trim','keyChanges','unresolvable\x20target\x20path','validation','NFC','appCode','push','require','6910470IVlAam'];a43_0x1ae3=function(){return _0x1d0585;};return a43_0x1ae3();}import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':a43_0x4d5031(0x19a),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':'read','structuredErrors':!![],'flags':[{'name':a43_0x4d5031(0x1ca),'type':a43_0x4d5031(0x17b),'description':a43_0x4d5031(0x206),'enum':[a43_0x4d5031(0x1f7),a43_0x4d5031(0x1f9),a43_0x4d5031(0x1ff)]},{'name':a43_0x4d5031(0x18f),'type':a43_0x4d5031(0x185),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x24fb81){const _0x3f4790=a43_0x4d5031,_0x3394a1=loadBffProjectConfig(_0x24fb81['appCode']),_0x729e2c=await readBffLockFile(_0x3394a1[_0x3f4790(0x1d2)]),{appLock:_0x504b24}=ensureLockScope(_0x729e2c??createEmptyBffLock(),_0x24fb81['appCode'],_0x3394a1[_0x3f4790(0x1b0)],_0x3f4790(0x19a)),_0x579805=normalizeBffType(_0x24fb81['str'](_0x3f4790(0x1ca)))??undefined,[_0x327173,_0x49796e]=await Promise['all']([listBffScripts(_0x24fb81['appCode'],_0x579805),getBffScriptStatistics(_0x24fb81['appCode'])]),_0xfb7866=_0x327173['some'](_0x51958d=>normalizeBffType(_0x51958d[_0x3f4790(0x1f3)])==='HOOK'),_0x35ba94=_0xfb7866?buildDatasetCodeToAliasMap(_0x24fb81[_0x3f4790(0x187)],_0x24fb81['appCode'],_0x24fb81['selectedAppName']||_0x24fb81[_0x3f4790(0x1e9)]?.['currentApp']||_0x24fb81[_0x3f4790(0x1e9)]?.['defaultApp']):new Map(),_0xcf831e=_0xfb7866?await planHookDirectoryMigration(_0x3394a1,_0x504b24,_0x35ba94,await scanLocalBffFunctions(_0x3394a1,_0x3f4790(0x1ff))):undefined,_0x4df1a7=createHookLocationMap(_0x49796e),_0x439675=[];for(const _0x5eea18 of _0x327173){const _0x11cbae=resolveRemoteScriptTarget(_0x3394a1,_0x5eea18,_0x4df1a7,_0xcf831e?.[_0x3f4790(0x1d3)]??_0x504b24['functions'],_0x35ba94);if(!_0x11cbae){_0x439675[_0x3f4790(0x1e2)]({'scriptType':_0x5eea18[_0x3f4790(0x1f3)],'functionName':_0x5eea18[_0x3f4790(0x1af)]??'','status':_0x3f4790(0x1ee),'reason':'unresolvable\x20target\x20path'});continue;}const _0x18b61e=(_0xcf831e?.['projectedFunctions']??_0x504b24[_0x3f4790(0x207)])[_0x11cbae[_0x3f4790(0x19b)]],_0x493da9=_0x5eea18[_0x3f4790(0x1a9)]!=null?computeContentHash(_0x5eea18[_0x3f4790(0x1a9)]):undefined,_0x426351=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0xcf831e,_0x11cbae)??_0x11cbae[_0x3f4790(0x1db)],_0x18b61e,_0x493da9),_0x442d50=_0x426351?localUnsyncedConflict(_0x11cbae,_0x5eea18['id']):undefined;_0x439675[_0x3f4790(0x1e2)]({'lockKey':_0x11cbae[_0x3f4790(0x19b)],'filePath':_0x11cbae['filePath'],'remoteId':_0x5eea18['id']??null,'status':_0x442d50?_0x3f4790(0x1a6):'would_pull',..._0x442d50?{'conflict':_0x442d50}:{},..._0x11cbae[_0x3f4790(0x205)]?{'alias':_0x11cbae[_0x3f4790(0x205)]['alias']??null,'datasetCode':_0x11cbae[_0x3f4790(0x205)][_0x3f4790(0x1a5)],'operationType':_0x11cbae[_0x3f4790(0x205)][_0x3f4790(0x1fd)],'functionNode':_0x11cbae[_0x3f4790(0x205)]['functionNode']}:{}});}return{'method':_0x3f4790(0x17d),'url':_0x3f4790(0x186)+_0x24fb81[_0x3f4790(0x1e1)]+(_0x579805?_0x3f4790(0x192)+_0x579805:'')+_0x3f4790(0x1d5)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x24fb81[_0x3f4790(0x1e1)],'filterType':_0x579805??null,..._0xcf831e&&_0xcf831e[_0x3f4790(0x188)]['length']>0x0?{'hookDirectoryMigrations':_0xcf831e[_0x3f4790(0x188)][_0x3f4790(0x1fb)](_0x2fb1d6=>({'from':_0x2fb1d6[_0x3f4790(0x1b3)],'to':_0x2fb1d6[_0x3f4790(0x180)]}))}:{},'files':_0x439675},'description':'Would\x20inspect\x20'+_0x439675[_0x3f4790(0x1bc)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x237ade){const _0x4f9bb4=a43_0x4d5031,_0x3563a3=loadBffProjectConfig(_0x237ade[_0x4f9bb4(0x1e1)]),_0x22c256=await readBffLockFile(_0x3563a3[_0x4f9bb4(0x1d2)]),{lockData:_0x4ec4c9,appLock:_0x33202b}=ensureLockScope(_0x22c256??createEmptyBffLock(),_0x237ade[_0x4f9bb4(0x1e1)],_0x3563a3['scriptsRoot'],_0x4f9bb4(0x19a)),_0x4ddb5f=normalizeBffType(_0x237ade[_0x4f9bb4(0x1e7)]('type'))??undefined;if(_0x237ade[_0x4f9bb4(0x1e7)](_0x4f9bb4(0x1ca))&&!_0x4ddb5f)throw CliErrors['validation'](_0x4f9bb4(0x1cf));const [_0x9848b6,_0xf4be6a]=await Promise[_0x4f9bb4(0x1c5)]([listBffScripts(_0x237ade[_0x4f9bb4(0x1e1)],_0x4ddb5f),getBffScriptStatistics(_0x237ade[_0x4f9bb4(0x1e1)])]);if(_0x9848b6[_0x4f9bb4(0x1bc)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x4f9bb4(0x1f1)};const _0x4edfe4=_0x237ade[_0x4f9bb4(0x197)](_0x4f9bb4(0x18f));if(_0x4edfe4&&!_0x237ade[_0x4f9bb4(0x1bb)]){const _0x1a69aa=await confirmForce();if(!_0x1a69aa)throw CliErrors[_0x4f9bb4(0x181)](_0x4f9bb4(0x191));}if(_0x4edfe4&&_0x237ade[_0x4f9bb4(0x1bb)]){}const _0x5b5603=_0x9848b6[_0x4f9bb4(0x17c)](_0x194e21=>normalizeBffType(_0x194e21[_0x4f9bb4(0x1f3)])===_0x4f9bb4(0x1ff)),_0x5cf257=_0x5b5603?buildDatasetCodeToAliasMap(_0x237ade[_0x4f9bb4(0x187)],_0x237ade[_0x4f9bb4(0x1e1)],_0x237ade[_0x4f9bb4(0x1ec)]||_0x237ade[_0x4f9bb4(0x1e9)]?.['currentApp']||_0x237ade[_0x4f9bb4(0x1e9)]?.[_0x4f9bb4(0x1a0)]):new Map(),_0xb042d=createHookLocationMap(_0xf4be6a),_0x487bc1=JSON['parse'](JSON[_0x4f9bb4(0x1f4)](_0x4ec4c9)),_0x507ba0=_0x237ade[_0x4f9bb4(0x1e1)],_0x51281f=_0x487bc1['apps'][_0x507ba0];if(!_0x51281f)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x507ba0+_0x4f9bb4(0x1c8));const _0x5bfa67=_0x5b5603?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x3563a3,_0x51281f,_0x5cf257,await scanLocalBffFunctions(_0x3563a3,_0x4f9bb4(0x1ff))),_0x51281f):undefined,_0x435967=createPullFileTransaction(),_0x44b17a=[],_0x33cacc=[],_0x3c6f44=[],_0x46bdfa=[];for(const _0x562079 of _0x9848b6){const _0x34d8b0=resolveRemoteScriptTarget(_0x3563a3,_0x562079,_0xb042d,_0x51281f[_0x4f9bb4(0x207)],_0x5cf257);if(!_0x34d8b0){_0x33cacc[_0x4f9bb4(0x1e2)]({'lockKey':_0x562079[_0x4f9bb4(0x1f3)]+'/'+_0x562079[_0x4f9bb4(0x1af)],'reason':_0x4f9bb4(0x1de)});continue;}const _0x222ad2=_0x51281f['functions'][_0x34d8b0['lockKey']];try{if(!_0x562079['id'])throw new Error(_0x4f9bb4(0x1ea));if(_0x562079['scriptContent']==null)throw new Error(_0x4f9bb4(0x200));const _0x47f06a=_0x562079['scriptContent'],_0x4e20f6=computeContentHash(_0x47f06a);if(!_0x4edfe4){const _0x39b19c=await hasUnsyncedLocalChanges(_0x34d8b0[_0x4f9bb4(0x1db)],_0x222ad2,_0x4e20f6);if(_0x39b19c){_0x3c6f44[_0x4f9bb4(0x1e2)](localUnsyncedConflict(_0x34d8b0,_0x562079['id']));continue;}}await _0x435967[_0x4f9bb4(0x1fc)](_0x34d8b0[_0x4f9bb4(0x1db)],_0x47f06a);const _0x42809c={'hash':_0x4e20f6,'remoteId':_0x562079['id'],'version':_0x562079[_0x4f9bb4(0x18d)]};_0x34d8b0[_0x4f9bb4(0x1ca)]===_0x4f9bb4(0x1ff)&&_0x34d8b0[_0x4f9bb4(0x205)]&&(_0x42809c[_0x4f9bb4(0x1f6)]=_0x34d8b0['hookLocation']['alias'],_0x42809c[_0x4f9bb4(0x1a5)]=_0x34d8b0['hookLocation'][_0x4f9bb4(0x1a5)],_0x42809c['operationType']=_0x34d8b0['hookLocation']['operationType'],_0x42809c['functionNode']=_0x34d8b0[_0x4f9bb4(0x205)][_0x4f9bb4(0x1d7)]),_0x51281f[_0x4f9bb4(0x207)][_0x34d8b0['lockKey']]=_0x42809c,_0x44b17a[_0x4f9bb4(0x1e2)]({'lockKey':_0x34d8b0[_0x4f9bb4(0x19b)],'remoteId':_0x562079['id']});}catch(_0x1cb533){_0x46bdfa[_0x4f9bb4(0x1e2)]({'lockKey':_0x34d8b0[_0x4f9bb4(0x19b)],'error':_0x1cb533 instanceof Error?_0x1cb533[_0x4f9bb4(0x1b2)]:String(_0x1cb533)});}}_0x51281f[_0x4f9bb4(0x183)]=new Date()[_0x4f9bb4(0x1bd)]();try{await writeBffLockFile(_0x3563a3[_0x4f9bb4(0x1d2)],_0x487bc1);}catch(_0x370dc4){const _0x8bfb04=[...await _0x435967['rollback'](),...await _0x5bfa67?.[_0x4f9bb4(0x1a3)]()??[]];throw withRollbackErrors(_0x370dc4,_0x4f9bb4(0x17a),_0x8bfb04);}return{'ok':_0x46bdfa[_0x4f9bb4(0x1bc)]===0x0,'data':{'pulled':_0x44b17a,'skipped':_0x33cacc,'conflicts':_0x3c6f44,'failed':_0x46bdfa},'message':formatPullMessage(_0x44b17a[_0x4f9bb4(0x1bc)],_0x33cacc['length'],_0x3c6f44['length'],_0x46bdfa[_0x4f9bb4(0x1bc)])};}};function localUnsyncedConflict(_0x219241,_0x18e852){const _0x421ae4=a43_0x4d5031,_0x4894c7=_0x219241['lockKey']['split']('/')['at'](-0x1);return{'code':_0x421ae4(0x208),'lockKey':_0x219241[_0x421ae4(0x19b)],'filePath':_0x219241[_0x421ae4(0x1db)],..._0x18e852!=null?{'remoteId':_0x18e852}:{},'message':_0x421ae4(0x18b),'nextAction':{'action':_0x421ae4(0x194),'command':CLI_BIN_NAME+_0x421ae4(0x1f2)+_0x219241['type']+'\x20--name\x20'+_0x4894c7+_0x421ae4(0x196),'requiresReview':!![],'message':_0x421ae4(0x1d6)}};}function formatPullMessage(_0x108efd,_0x5c0020,_0x2f4504,_0x2d5986){const _0x28c865=a43_0x4d5031,_0x447d18=['Pull\x20complete:\x20'+_0x108efd+_0x28c865(0x18a),_0x5c0020+_0x28c865(0x1e8)];_0x2f4504>0x0&&_0x447d18['push'](_0x2f4504+'\x20conflict'+(_0x2f4504===0x1?'':'s')+'\x20'+(_0x2f4504===0x1?_0x28c865(0x204):_0x28c865(0x1e3))+_0x28c865(0x18c));if(_0x2d5986>0x0)_0x447d18[_0x28c865(0x1e2)](_0x2d5986+_0x28c865(0x190));return _0x447d18['join'](',\x20');}async function hasUnsyncedLocalChanges(_0xf97c74,_0x16abe1,_0x2fa2b6){if(!await fileExists(_0xf97c74))return![];const _0x378c2f=await computeFileHash(_0xf97c74);if(!_0x16abe1)return _0x2fa2b6?_0x378c2f!==_0x2fa2b6:!![];return _0x378c2f!==_0x16abe1['hash'];}function createPullFileTransaction(){const _0x443751=new Map(),_0xdad84b=async(_0x4835cd,_0x409fd4)=>{const _0x4d814b=a43_0x1a84;try{if(_0x409fd4['existed'])await ensureParentDirectory(_0x4835cd),await writeFile(_0x4835cd,_0x409fd4[_0x4d814b(0x1c0)]);else try{await unlink(_0x4835cd);}catch(_0x35e471){if(_0x35e471['code']!=='ENOENT')throw _0x35e471;}return undefined;}catch(_0x45fa84){return _0x45fa84 instanceof Error?_0x45fa84:new Error(String(_0x45fa84));}};return{async 'write'(_0x5370dc,_0x16f9a0){const _0x34541f=a43_0x1a84;if(!_0x443751[_0x34541f(0x1cd)](_0x5370dc))try{_0x443751['set'](_0x5370dc,{'existed':!![],'content':await readFile(_0x5370dc)});}catch(_0x5db3e5){if(_0x5db3e5[_0x34541f(0x202)]!==_0x34541f(0x1aa))throw _0x5db3e5;_0x443751[_0x34541f(0x182)](_0x5370dc,{'existed':![]});}try{await ensureParentDirectory(_0x5370dc),await writeFile(_0x5370dc,_0x16f9a0,_0x34541f(0x1f5));}catch(_0x4ffea7){const _0x23ecce=await _0xdad84b(_0x5370dc,_0x443751[_0x34541f(0x1c3)](_0x5370dc));if(!_0x23ecce)_0x443751[_0x34541f(0x1bf)](_0x5370dc);throw withRollbackErrors(_0x4ffea7,_0x34541f(0x19d)+_0x5370dc+'\x22.',_0x23ecce?[_0x23ecce]:[]);}},async 'rollback'(){const _0x2b7d38=a43_0x1a84,_0x1b38d5=[];for(const [_0x3581fc,_0x3d3765]of[..._0x443751[_0x2b7d38(0x1a1)]()][_0x2b7d38(0x1b7)]()){const _0x11191b=await _0xdad84b(_0x3581fc,_0x3d3765);_0x11191b&&_0x1b38d5[_0x2b7d38(0x1e2)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x3581fc+_0x2b7d38(0x1e5)+_0x11191b[_0x2b7d38(0x1b2)]));}return _0x1b38d5;}};}function withRollbackErrors(_0x31fa14,_0x13dac8,_0x3b6466){const _0x4fcf7f=a43_0x4d5031,_0x5b193b=_0x31fa14 instanceof Error?_0x31fa14:new Error(String(_0x31fa14));if(_0x3b6466[_0x4fcf7f(0x1bc)]===0x0)return _0x5b193b;return new AggregateError([_0x5b193b,..._0x3b6466],_0x13dac8+_0x4fcf7f(0x201)+_0x3b6466[_0x4fcf7f(0x1fb)](_0x394fe6=>_0x394fe6[_0x4fcf7f(0x1b2)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x321afd,_0x5912c0,_0x50ceaf){const _0x5d8f73=a43_0x4d5031,_0x6787d3=resolveApiModelSource(_0x321afd,_0x5912c0,_0x50ceaf),_0x3dc457=loadAliasMap(_0x321afd,undefined,_0x6787d3[_0x5d8f73(0x1db)],_0x6787d3[_0x5d8f73(0x189)]);return assertUnambiguousHookAliases(_0x3dc457),new Map(_0x3dc457[_0x5d8f73(0x1fb)](_0x4bce66=>[_0x4bce66['datasetCode'][_0x5d8f73(0x1b1)](),_0x4bce66[_0x5d8f73(0x1f6)]]));}async function planHookDirectoryMigration(_0x3cc375,_0x41c776,_0x25a712,_0x1f112f){const _0x407a04=a43_0x4d5031,_0x4153be=new Map();for(const [_0x2be8e7,_0x4af453]of Object[_0x407a04(0x1a1)](_0x41c776[_0x407a04(0x207)])){const [_0x4da008,_0x53ef7f,_0x295187,_0x346f99,_0x1ddd4b,..._0x349d69]=_0x2be8e7[_0x407a04(0x1ad)]('/');if(_0x4da008!==_0x407a04(0x1ff)||!_0x53ef7f||!_0x295187||!_0x346f99||!_0x1ddd4b||_0x349d69[_0x407a04(0x1bc)]>0x0||!_0x4af453[_0x407a04(0x1a5)])continue;const _0x4c7c1a=_0x25a712[_0x407a04(0x1c3)](_0x4af453[_0x407a04(0x1a5)][_0x407a04(0x1b1)]()),_0x321fb0=_0x4c7c1a??_0x4af453[_0x407a04(0x1a5)];if(!isSafeHookDirectorySegment(_0x53ef7f))throw CliErrors['validation'](_0x407a04(0x1d1)+_0x53ef7f+_0x407a04(0x1c2));if(!isSafeHookDirectorySegment(_0x321fb0))throw CliErrors['validation'](_0x407a04(0x1ab)+_0x53ef7f+_0x407a04(0x203));if(_0x53ef7f===_0x321fb0)continue;const _0x310728=_0x4153be[_0x407a04(0x1c3)](_0x53ef7f)??{'datasetCode':_0x4af453['datasetCode'],'alias':_0x4c7c1a,'keyChanges':[]};if(_0x310728[_0x407a04(0x1a5)]!==_0x4af453[_0x407a04(0x1a5)])throw CliErrors['validation'](_0x407a04(0x1ab)+_0x53ef7f+_0x407a04(0x1d8));const _0x2d7f1a='HOOK/'+_0x321fb0+'/'+_0x295187+'/'+_0x346f99+'/'+_0x1ddd4b;try{resolveLocalFilePathFromLockKey(_0x3cc375,_0x2be8e7),resolveLocalFilePathFromLockKey(_0x3cc375,_0x2d7f1a);}catch(_0x39128b){throw CliErrors[_0x407a04(0x1df)](_0x407a04(0x1d0)+_0x2be8e7+_0x407a04(0x1e5)+(_0x39128b instanceof Error?_0x39128b[_0x407a04(0x1b2)]:String(_0x39128b)));}_0x310728[_0x407a04(0x1dd)][_0x407a04(0x1e2)]({'oldLockKey':_0x2be8e7,'newLockKey':_0x2d7f1a,'entry':_0x4af453}),_0x4153be['set'](_0x53ef7f,_0x310728);}const _0x597fbc=new Set([..._0x4153be[_0x407a04(0x184)]()]['flatMap'](_0x2e64e8=>_0x2e64e8[_0x407a04(0x1dd)]['map'](_0x2b0a12=>_0x2b0a12[_0x407a04(0x1cc)]))),_0x32c5c6=new Map(),_0x281a50=new Map();for(const [_0xaf5444,_0x201413]of _0x4153be){const _0x77d14f=_0x201413[_0x407a04(0x1f6)]??_0x201413['datasetCode'],_0x4873c7=hookDirectoryIdentity(_0x77d14f),_0x24b928=_0x32c5c6[_0x407a04(0x1c3)](_0x4873c7);if(_0x24b928&&_0x24b928!==_0xaf5444)throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x24b928+_0x407a04(0x19c)+_0xaf5444+'\x22:\x20both\x20target\x20\x22'+_0x77d14f+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x32c5c6[_0x407a04(0x182)](_0x4873c7,_0xaf5444);for(const _0x11818f of _0x201413['keyChanges']){const _0x2dbce1=_0x281a50[_0x407a04(0x1c3)](_0x11818f['newLockKey']);if(_0x2dbce1&&_0x2dbce1!==_0x11818f['oldLockKey'])throw CliErrors[_0x407a04(0x1df)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x2dbce1+'\x22\x20and\x20\x22'+_0x11818f[_0x407a04(0x1cc)]+_0x407a04(0x1a8)+_0x11818f[_0x407a04(0x1a7)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x597fbc[_0x407a04(0x1cd)](_0x11818f[_0x407a04(0x1a7)]))throw CliErrors[_0x407a04(0x1df)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x11818f[_0x407a04(0x1cc)]+_0x407a04(0x19e)+_0x11818f[_0x407a04(0x1a7)]+_0x407a04(0x1ae));_0x281a50[_0x407a04(0x182)](_0x11818f[_0x407a04(0x1a7)],_0x11818f[_0x407a04(0x1cc)]);}}const _0x4e8389=new Map();for(const [_0x3feabf,_0x8f28b7]of _0x25a712){_0x4e8389[_0x407a04(0x182)](hookDirectoryIdentity(_0x8f28b7),_0x3feabf);}const _0x3e78f7=[];for(const [_0x44a22f,_0x43cf61]of _0x4153be){const _0x553956=_0x43cf61[_0x407a04(0x1f6)]??_0x43cf61['datasetCode'],_0x595fb6=join(_0x3cc375[_0x407a04(0x1a2)],'HOOK',_0x44a22f),_0x2ea5da=join(_0x3cc375[_0x407a04(0x1a2)],_0x407a04(0x1ff),_0x553956),_0xd5d1ca=await directoryExists(_0x595fb6),_0x222258=await directoryExists(_0x2ea5da),_0x5280e5=_0xd5d1ca?_0x222258?await sameDirectory(_0x595fb6,_0x2ea5da)?'case-rename':undefined:_0x407a04(0x1c9):'rekey';if(!_0x5280e5)throw CliErrors[_0x407a04(0x1df)](_0x407a04(0x1ab)+_0x44a22f+_0x407a04(0x1fa)+_0x553956+_0x407a04(0x1ed));const _0x1fa73f=_0x4e8389[_0x407a04(0x1c3)](hookDirectoryIdentity(_0x44a22f));if(_0x1fa73f&&_0x1fa73f!==_0x43cf61[_0x407a04(0x1a5)][_0x407a04(0x1b1)]()){const _0x144344=new Set(_0x43cf61[_0x407a04(0x1dd)][_0x407a04(0x1fb)](_0x454690=>_0x454690[_0x407a04(0x1cc)])),_0x184262=_0x1f112f['filter'](_0x428c17=>_0x428c17[_0x407a04(0x1ca)]===_0x407a04(0x1ff)&&_0x428c17['alias']!=null&&hookDirectoryIdentity(_0x428c17['alias'])===hookDirectoryIdentity(_0x44a22f)&&!_0x144344[_0x407a04(0x1cd)](_0x428c17[_0x407a04(0x19b)]));if(_0x184262['length']>0x0)throw CliErrors['validation'](_0x407a04(0x1ab)+_0x44a22f+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x51f3d1=_0x4e8389[_0x407a04(0x1c3)](hookDirectoryIdentity(_0x553956));if(_0x51f3d1&&_0x51f3d1!==_0x43cf61['datasetCode'][_0x407a04(0x1b1)]())throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x44a22f+'\x22\x20to\x20\x22'+_0x553956+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x354dd8 of _0x43cf61[_0x407a04(0x1dd)]){const _0x1d8572=_0x41c776[_0x407a04(0x207)][_0x354dd8['newLockKey']];if(_0x1d8572&&!_0x597fbc[_0x407a04(0x1cd)](_0x354dd8['newLockKey'])&&!sameHookIdentity(_0x354dd8[_0x407a04(0x179)],_0x1d8572))throw CliErrors['validation'](_0x407a04(0x1ab)+_0x44a22f+_0x407a04(0x1fa)+_0x553956+_0x407a04(0x17f));}_0x3e78f7[_0x407a04(0x1e2)]({'oldDirectory':_0x44a22f,'newDirectory':_0x553956,'oldDirectoryPath':_0x595fb6,'newDirectoryPath':_0x2ea5da,'mode':_0x5280e5,'alias':_0x43cf61[_0x407a04(0x1f6)],'keyChanges':_0x43cf61[_0x407a04(0x1dd)]});}const _0x76675d={..._0x41c776[_0x407a04(0x207)]},_0x5e3bea=new Map(),_0x1c3585=new Map();for(const _0x31b91e of _0x3e78f7){const _0x373d5a=_0x31b91e[_0x407a04(0x1da)]!==_0x407a04(0x1a4);_0x373d5a&&_0x1c3585[_0x407a04(0x182)](hookDirectoryIdentity(_0x31b91e[_0x407a04(0x180)]),_0x31b91e[_0x407a04(0x1b8)]);for(const _0x54a53d of _0x31b91e[_0x407a04(0x1dd)]){const _0x19ec6d=_0x76675d[_0x54a53d['newLockKey']],_0x56d8d0=_0x373d5a?_0x54a53d[_0x407a04(0x179)]:_0x19ec6d??_0x54a53d[_0x407a04(0x179)];_0x76675d[_0x54a53d[_0x407a04(0x1a7)]]=canonicalizeHookEntry(_0x56d8d0,_0x31b91e[_0x407a04(0x1f6)]),delete _0x76675d[_0x54a53d['oldLockKey']],_0x373d5a&&_0x5e3bea[_0x407a04(0x182)](_0x54a53d['newLockKey'],resolveLocalFilePathFromLockKey(_0x3cc375,_0x54a53d['oldLockKey']));}}return{'migrations':_0x3e78f7,'projectedFunctions':_0x76675d,'sourceFilePathByNewLockKey':_0x5e3bea,'sourceDirectoryPathByNewDirectory':_0x1c3585};}function resolveMigratedSourceFilePath(_0xa6c5e,_0x1273b7){const _0x8265bc=a43_0x4d5031;if(!_0xa6c5e||!_0x1273b7)return undefined;const _0x443980=_0xa6c5e['sourceFilePathByNewLockKey'][_0x8265bc(0x1c3)](_0x1273b7['lockKey']);if(_0x443980)return _0x443980;if(_0x1273b7[_0x8265bc(0x1ca)]!=='HOOK')return undefined;const [,_0xa6081f,..._0x24d465]=_0x1273b7[_0x8265bc(0x19b)][_0x8265bc(0x1ad)]('/');if(!_0xa6081f||_0x24d465[_0x8265bc(0x1bc)]===0x0)return undefined;const _0x48cf55=_0xa6c5e[_0x8265bc(0x19f)]['get'](hookDirectoryIdentity(_0xa6081f));return _0x48cf55?join(_0x48cf55,..._0x24d465)+_0x8265bc(0x1f8):undefined;}function sameHookIdentity(_0x27c371,_0x557a82){const _0x8fa0ca=a43_0x4d5031;return _0x27c371['remoteId']===_0x557a82['remoteId']&&_0x27c371[_0x8fa0ca(0x1a5)]===_0x557a82[_0x8fa0ca(0x1a5)]&&_0x27c371[_0x8fa0ca(0x1fd)]===_0x557a82[_0x8fa0ca(0x1fd)]&&_0x27c371['functionNode']===_0x557a82[_0x8fa0ca(0x1d7)];}function canonicalizeHookEntry(_0x32481d,_0x599812){const {alias:_0xea534,..._0x4cfb8b}=_0x32481d;return _0x599812?{..._0x4cfb8b,'alias':_0x599812}:_0x4cfb8b;}function hookDirectoryIdentity(_0xd8bd31){const _0x168221=a43_0x4d5031;return _0xd8bd31[_0x168221(0x1be)](_0x168221(0x1e0))[_0x168221(0x1b1)]();}function isSafeHookDirectorySegment(_0x2f68cc){return isSafeLockKeySegment(_0x2f68cc);}async function sameDirectory(_0x56dbed,_0x8eda8f){const _0x1a3f87=a43_0x4d5031,[_0x1d752a,_0x619a08]=await Promise[_0x1a3f87(0x1c5)]([stat(_0x56dbed),stat(_0x8eda8f)]);return _0x1d752a[_0x1a3f87(0x18e)]===_0x619a08['dev']&&_0x1d752a[_0x1a3f87(0x1ce)]===_0x619a08[_0x1a3f87(0x1ce)];}async function applyHookDirectoryMigration(_0x294a25,_0x4bb9df){const _0x130123=a43_0x4d5031,_0x1bcc7d=_0x4bb9df['functions'],_0x46c531=_0x4bb9df['lastSync'],_0x42acaa=[],_0x907faf=async()=>{const _0x62f458=a43_0x1a84,_0x55cc94=[];_0x4bb9df[_0x62f458(0x207)]=_0x1bcc7d,_0x4bb9df[_0x62f458(0x183)]=_0x46c531;for(const {migration:_0x4d3601,temporaryPath:_0x4cd6f7}of[..._0x42acaa]['reverse']()){try{_0x4cd6f7?(await rename(_0x4d3601['newDirectoryPath'],_0x4cd6f7),await rename(_0x4cd6f7,_0x4d3601[_0x62f458(0x1b8)])):await rename(_0x4d3601['newDirectoryPath'],_0x4d3601[_0x62f458(0x1b8)]);}catch(_0x14a739){_0x55cc94[_0x62f458(0x1e2)](new Error(_0x62f458(0x1c4)+_0x4d3601[_0x62f458(0x1b3)]+_0x62f458(0x1ac)+_0x4d3601['newDirectory']+_0x62f458(0x1e5)+(_0x14a739 instanceof Error?_0x14a739['message']:String(_0x14a739))));}}return _0x55cc94;};try{for(const _0x134e83 of _0x294a25[_0x130123(0x188)]){if(_0x134e83['mode']==='move')await ensureParentDirectory(_0x134e83[_0x130123(0x17e)]),await rename(_0x134e83[_0x130123(0x1b8)],_0x134e83[_0x130123(0x17e)]),_0x42acaa[_0x130123(0x1e2)]({'migration':_0x134e83});else{if(_0x134e83['mode']===_0x130123(0x1ef)){const _0x54c0cb=join(dirname(_0x134e83[_0x130123(0x1b8)]),_0x130123(0x199)+randomUUID());await rename(_0x134e83[_0x130123(0x1b8)],_0x54c0cb);try{await rename(_0x54c0cb,_0x134e83[_0x130123(0x17e)]);}catch(_0x4a4630){try{await rename(_0x54c0cb,_0x134e83[_0x130123(0x1b8)]);}catch(_0x5a0ec6){throw withRollbackErrors(_0x4a4630,_0x130123(0x195)+_0x134e83['oldDirectory']+_0x130123(0x1fa)+_0x134e83[_0x130123(0x180)]+_0x130123(0x1b5)+_0x54c0cb+_0x130123(0x198),[new Error(_0x130123(0x1c6)+_0x54c0cb+_0x130123(0x1fa)+_0x134e83['oldDirectory']+_0x130123(0x1e5)+(_0x5a0ec6 instanceof Error?_0x5a0ec6[_0x130123(0x1b2)]:String(_0x5a0ec6)))]);}throw _0x4a4630;}_0x42acaa['push']({'migration':_0x134e83,'temporaryPath':_0x54c0cb});}}}return _0x4bb9df[_0x130123(0x207)]=_0x294a25['projectedFunctions'],{'rollback':_0x907faf};}catch(_0x152841){const _0x5bff65=await _0x907faf();throw withRollbackErrors(_0x152841,_0x130123(0x1e6),_0x5bff65);}}async function confirmForce(){const _0x42054d=a43_0x4d5031,_0x117669=createInterface({'input':process['stdin'],'output':process[_0x42054d(0x1eb)]}),_0x5758f0=await new Promise(_0x424aa5=>{const _0x1d8e57=_0x42054d;_0x117669[_0x1d8e57(0x1b9)](_0x1d8e57(0x1f0),_0x424aa5);});return _0x117669['close'](),['y','yes'][_0x42054d(0x193)](_0x5758f0[_0x42054d(0x1dc)]()[_0x42054d(0x1b1)]());}
|