@lovrabet/rabetbase-cli 2.5.8-beta.2 → 2.5.8
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/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-management-client.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/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +1 -1
- package/skills/rabetbase/SKILL.md +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
|
+
function a34_0x36e4(_0x324799,_0x1b1e12){_0x324799=_0x324799-0xaa;const _0x12dd99=a34_0x12dd();let _0x36e4f7=_0x12dd99[_0x324799];return _0x36e4f7;}const a34_0x29e900=a34_0x36e4;function a34_0x12dd(){const _0x2c0ceb=['Updated','Created','App\x20config\x20server\x20id\x20missing\x20for\x20key=',',\x20appCode=','number','set','update','984560NzSLAB','1120486ogspMo','write','/smartapi/app-config/create','3GjtPTX','app-config','Read\x20config\x20value\x20from\x20file','372648cJLVDm','820578JUKTKB','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','appCode','/smartapi/app-config/update','2610328YnPJeH','create','4217500KULKTr','file','10SEoaXW','string','get','tags','7144620vjCGNQ','9mGYFBC','POST'];a34_0x12dd=function(){return _0x2c0ceb;};return a34_0x12dd();}(function(_0x265136,_0x428475){const _0x406e48=a34_0x36e4,_0x3eb815=_0x265136();while(!![]){try{const _0x2f6c68=parseInt(_0x406e48(0xbb))/0x1+-parseInt(_0x406e48(0xb5))/0x2*(parseInt(_0x406e48(0xb8))/0x3)+parseInt(_0x406e48(0xc0))/0x4*(parseInt(_0x406e48(0xc4))/0x5)+parseInt(_0x406e48(0xbc))/0x6+-parseInt(_0x406e48(0xaa))/0x7+parseInt(_0x406e48(0xb4))/0x8*(parseInt(_0x406e48(0xab))/0x9)+parseInt(_0x406e48(0xc2))/0xa;if(_0x2f6c68===_0x428475)break;else _0x3eb815['push'](_0x3eb815['shift']());}catch(_0x253e75){_0x3eb815['push'](_0x3eb815['shift']());}}}(a34_0x12dd,0xbe0fc));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';const CREATE_PATH=a34_0x29e900(0xb7),UPDATE_PATH=a34_0x29e900(0xbf);export const appConfigSet={'service':a34_0x29e900(0xb9),'command':a34_0x29e900(0xb2),'description':a34_0x29e900(0xbd),'risk':a34_0x29e900(0xb6),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x29e900(0xc3),'type':a34_0x29e900(0xc5),'description':a34_0x29e900(0xba)}],async 'validate'(_0x4c33e3){readKeyArg(_0x4c33e3),readOptionalTags(_0x4c33e3),assertSingleValueSource(_0x4c33e3);},async 'dryRun'(_0x8e7960){const _0x1e1f16=a34_0x29e900,_0x5a2db2=readKeyArg(_0x8e7960),_0xedf82e=readOptionalTags(_0x8e7960),_0x5a4fb3=assertSingleValueSource(_0x8e7960);await assertValueSourceReadable(_0x5a4fb3);const _0x52f10a=await withAppConfigApiBoundary(_0x1e1f16(0xc6),{'appCode':_0x8e7960[_0x1e1f16(0xbe)],'key':_0x5a2db2},()=>getAppConfigByKey(_0x8e7960[_0x1e1f16(0xbe)],_0x5a2db2)),_0x37f860=_0x52f10a?'update':_0x1e1f16(0xc1),_0x140d77=_0x52f10a?projectAppConfig(_0x52f10a):null,_0xf797f1=plannedAppConfig({'appCode':_0x8e7960[_0x1e1f16(0xbe)],'key':_0x5a2db2,'tags':_0xedf82e??_0x52f10a?.[_0x1e1f16(0xc7)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x37f860,'appCode':_0x8e7960['appCode'],'key':_0x5a2db2,'before':_0x140d77,'after':_0xf797f1,'dryRun':!![]}),{'method':_0x1e1f16(0xac),'url':_0x37f860===_0x1e1f16(0xb3)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x1ba54e){const _0x1915b4=a34_0x29e900,_0x5bfc7c=readKeyArg(_0x1ba54e),_0x9fc0d9=readOptionalTags(_0x1ba54e),_0x332ebf=await withAppConfigApiBoundary(_0x1915b4(0xc6),{'appCode':_0x1ba54e['appCode'],'key':_0x5bfc7c},()=>getAppConfigByKey(_0x1ba54e[_0x1915b4(0xbe)],_0x5bfc7c)),_0x3b4217=_0x332ebf?projectAppConfig(_0x332ebf):null,_0x474d5b=_0x332ebf?_0x1915b4(0xb3):_0x1915b4(0xc1),{value:_0x109bb0,warnings:_0x5636fb}=await readAppConfigValue(_0x1ba54e),_0x200a9d={'appCode':_0x1ba54e[_0x1915b4(0xbe)],'key':_0x5bfc7c,'value':_0x109bb0,'tags':_0x9fc0d9??_0x332ebf?.[_0x1915b4(0xc7)]??undefined};await withAppConfigApiBoundary(_0x474d5b,{'appCode':_0x1ba54e[_0x1915b4(0xbe)],'key':_0x5bfc7c},async()=>{const _0x41673a=_0x1915b4;_0x332ebf?await updateAppConfig({..._0x200a9d,'id':requireAppConfigId(_0x332ebf,_0x5bfc7c,_0x1ba54e[_0x41673a(0xbe)])}):await createAppConfig(_0x200a9d);});const _0x27a383=await withAppConfigApiBoundary('get',{'appCode':_0x1ba54e[_0x1915b4(0xbe)],'key':_0x5bfc7c},()=>getAppConfigByKey(_0x1ba54e[_0x1915b4(0xbe)],_0x5bfc7c)),_0x3b42a0=_0x27a383?projectAppConfig(_0x27a383):plannedAppConfig({'appCode':_0x1ba54e[_0x1915b4(0xbe)],'key':_0x5bfc7c,'tags':_0x200a9d[_0x1915b4(0xc7)],'hasValue':_0x109bb0!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x474d5b,'appCode':_0x1ba54e[_0x1915b4(0xbe)],'key':_0x5bfc7c,'before':_0x3b4217,'after':_0x3b42a0,'dryRun':![],'warnings':_0x5636fb}),'message':(_0x474d5b===_0x1915b4(0xb3)?_0x1915b4(0xad):_0x1915b4(0xae))+'\x20app\x20config\x20'+_0x5bfc7c};}};function requireAppConfigId(_0x1553d5,_0x76dcdc,_0x558885){const _0x2bafc5=a34_0x29e900;if(typeof _0x1553d5['id']===_0x2bafc5(0xb1)&&Number['isFinite'](_0x1553d5['id'])&&_0x1553d5['id']>0x0)return _0x1553d5['id'];throw CliErrors['apiError'](_0x2bafc5(0xaf)+_0x76dcdc+_0x2bafc5(0xb0)+_0x558885);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x387968=a35_0x2052;(function(_0x529600,_0x2a9c91){const _0x4f37cf=a35_0x2052,_0x4e22e1=_0x529600();while(!![]){try{const _0x38c1c0=parseInt(_0x4f37cf(0x101))/0x1*(parseInt(_0x4f37cf(0xd6))/0x2)+-parseInt(_0x4f37cf(0xf6))/0x3+parseInt(_0x4f37cf(0xf4))/0x4*(parseInt(_0x4f37cf(0xf1))/0x5)+parseInt(_0x4f37cf(0xea))/0x6+parseInt(_0x4f37cf(0x10f))/0x7*(parseInt(_0x4f37cf(0x10d))/0x8)+-parseInt(_0x4f37cf(0xd1))/0x9*(parseInt(_0x4f37cf(0xee))/0xa)+parseInt(_0x4f37cf(0xda))/0xb*(parseInt(_0x4f37cf(0xfb))/0xc);if(_0x38c1c0===_0x2a9c91)break;else _0x4e22e1['push'](_0x4e22e1['shift']());}catch(_0x2da5d9){_0x4e22e1['push'](_0x4e22e1['shift']());}}}(a35_0x57dc,0x270b5));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x387968(0xe6),'description':a35_0x387968(0xfe),'required':!![]};export const VALUE_ARG={'name':a35_0x387968(0x10c),'description':a35_0x387968(0xd7),'required':![]};export const TAGS_FLAG={'name':a35_0x387968(0xff),'type':a35_0x387968(0x108),'description':a35_0x387968(0xf0)};function a35_0x2052(_0x54e800,_0x421b96){_0x54e800=_0x54e800-0xce;const _0x57dc32=a35_0x57dc();let _0x20521b=_0x57dc32[_0x54e800];return _0x20521b;}export const STDIN_FLAG={'name':a35_0x387968(0xe2),'type':'boolean','description':'Read\x20config\x20value\x20from\x20stdin','default':![]};function a35_0x57dc(){const _0x327633=['operation','Environment\x20variable\x20is\x20not\x20set:\x20','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','defineProperties','9fJHHwR','slice','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','dryRun','appCode:\x20','3860MYsjOe','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','length','warnings','143vwAkVq','reveal','boolean','trim','value\x20is\x20redacted','appCode','\x20app\x20config.','once','stdin','data','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','after','key','error','push','gmtCreate','1606722cRrRNX','bool','utf8','validation','3068360oyrXVM','path','Config\x20tags\x20for\x20filtering/display\x20metadata','81880ZikAzE','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','file','56beAPBp','args','840078kXRTIg','join','before','from-env','name','93180YFwIZA','apiError','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','Runtime\x20app-config\x20key','tags','str','30eCkYfX','argument','kind','method','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','Value\x20file\x20is\x20not\x20readable:\x20','setEncoding','string','App\x20config\x20value\x20source\x20is\x20ambiguous.','env','Failed\x20to\x20','value','727128UyPmLl','gmtModified','7deOmeM','flag','hasValue'];a35_0x57dc=function(){return _0x327633;};return a35_0x57dc();}export const FROM_ENV_FLAG={'name':a35_0x387968(0xf9),'type':a35_0x387968(0x108),'description':a35_0x387968(0x105)};export const REVEAL_FLAG={'name':a35_0x387968(0xdb),'type':a35_0x387968(0xdc),'description':a35_0x387968(0xfd),'default':![]};export function readKeyArg(_0x9812a4){const _0x3936e2=a35_0x387968,_0xca0abd=_0x9812a4[_0x3936e2(0xf5)][0x0]?.[_0x3936e2(0xdd)]()??'';return validateKey(_0xca0abd),_0xca0abd;}export function readOptionalTags(_0x3184b3){const _0x2780f7=a35_0x387968,_0x59df85=_0x3184b3[_0x2780f7(0x100)](_0x2780f7(0xff))['trim']();if(!_0x59df85)return undefined;if(_0x59df85[_0x2780f7(0xd8)]>0x20)throw CliErrors[_0x2780f7(0xed)](_0x2780f7(0xcf));return _0x59df85;}export function validateKey(_0x3cea3f){const _0x1a846d=a35_0x387968;if(!_0x3cea3f)throw CliErrors[_0x1a846d(0xed)]('Missing\x20app-config\x20key.');if(_0x3cea3f[_0x1a846d(0xd8)]>0x100)throw CliErrors[_0x1a846d(0xed)](_0x1a846d(0xf2));}export function projectAppConfig(_0xac68ce,_0x5e5a5e){const _0x1290de=a35_0x387968,_0x4ff5bb=_0xac68ce[_0x1290de(0x10c)]!==undefined&&_0xac68ce[_0x1290de(0x10c)]!==null&&_0xac68ce[_0x1290de(0x10c)]!=='',_0x4b0bb4={'appCode':_0xac68ce[_0x1290de(0xdf)],'key':_0xac68ce[_0x1290de(0xe6)],'tags':_0xac68ce['tags']??undefined,'hasValue':_0x4ff5bb,'valueRedacted':_0x4ff5bb&&!_0x5e5a5e?.[_0x1290de(0xdb)],'gmtCreate':_0xac68ce[_0x1290de(0xe9)],'gmtModified':_0xac68ce[_0x1290de(0x10e)]};return _0x5e5a5e?.['reveal']&&(_0x4b0bb4[_0x1290de(0x10c)]=_0xac68ce[_0x1290de(0x10c)]??'',_0x4b0bb4['valueRedacted']=![]),_0x4b0bb4;}export function plannedAppConfig(_0x513688){const _0x1f94b6=a35_0x387968,_0x16faf7=_0x513688[_0x1f94b6(0x111)]??!![];return{'appCode':_0x513688[_0x1f94b6(0xdf)],'key':_0x513688[_0x1f94b6(0xe6)],'tags':_0x513688[_0x1f94b6(0xff)]??undefined,'hasValue':_0x16faf7,'valueRedacted':_0x16faf7};}export function buildMutationData(_0x270f92){const _0x5e56c8=a35_0x387968;return{'operation':_0x270f92[_0x5e56c8(0x112)],'selector':{'appCode':_0x270f92['appCode'],'key':_0x270f92[_0x5e56c8(0xe6)]},'before':_0x270f92[_0x5e56c8(0xf8)],'after':_0x270f92[_0x5e56c8(0xe5)],'dryRun':_0x270f92[_0x5e56c8(0xd4)],'warnings':_0x270f92[_0x5e56c8(0xd9)]??[]};}export async function withAppConfigApiBoundary(_0x47a4f6,_0x4f049b,_0x2641d6){const _0x10e744=a35_0x387968;try{return await _0x2641d6();}catch{const _0x3cbfe4=[_0x10e744(0xd5)+_0x4f049b['appCode']];if(_0x4f049b[_0x10e744(0xe6)])_0x3cbfe4[_0x10e744(0xe8)]('key:\x20'+_0x4f049b[_0x10e744(0xe6)]);_0x3cbfe4[_0x10e744(0xe8)](_0x10e744(0xde));throw CliErrors[_0x10e744(0xfc)](_0x10e744(0x10b)+_0x47a4f6+_0x10e744(0xe0),_0x3cbfe4[_0x10e744(0xf7)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x21b880,_0x39cdfa){const _0x58cde1=a35_0x387968;return Object[_0x58cde1(0xd0)](_0x21b880,{'method':{'value':_0x39cdfa[_0x58cde1(0x104)],'enumerable':![]},'url':{'value':_0x39cdfa['url'],'enumerable':![]}});}export function assertSingleValueSource(_0x77b8c3){const _0x4af89e=a35_0x387968,_0x2221d9=[];_0x77b8c3[_0x4af89e(0xf5)][_0x4af89e(0xd8)]>0x1&&_0x2221d9[_0x4af89e(0xe8)]({'kind':_0x4af89e(0x102),'value':_0x77b8c3[_0x4af89e(0xf5)][_0x4af89e(0xd2)](0x1)[_0x4af89e(0xf7)]('\x20')});const _0x1c0ef1=_0x77b8c3[_0x4af89e(0x110)](_0x4af89e(0x10c));_0x1c0ef1!==undefined&&_0x1c0ef1!==null&&_0x2221d9[_0x4af89e(0xe8)]({'kind':_0x4af89e(0x102),'value':String(_0x1c0ef1)});_0x77b8c3[_0x4af89e(0xeb)](_0x4af89e(0xe2))&&_0x2221d9[_0x4af89e(0xe8)]({'kind':_0x4af89e(0xe2)});const _0x328a7e=_0x77b8c3['str'](_0x4af89e(0xf9))['trim']();_0x328a7e&&_0x2221d9[_0x4af89e(0xe8)]({'kind':'env','name':_0x328a7e});const _0x33967c=_0x77b8c3[_0x4af89e(0x100)](_0x4af89e(0xf3))[_0x4af89e(0xdd)]();_0x33967c&&_0x2221d9[_0x4af89e(0xe8)]({'kind':_0x4af89e(0xf3),'path':_0x33967c});if(_0x2221d9[_0x4af89e(0xd8)]===0x0)throw CliErrors[_0x4af89e(0xed)]('Missing\x20app-config\x20value\x20source.',_0x4af89e(0xe4));if(_0x2221d9[_0x4af89e(0xd8)]>0x1)throw CliErrors[_0x4af89e(0xed)](_0x4af89e(0x109),_0x4af89e(0xd3));return _0x2221d9[0x0];}export async function assertValueSourceReadable(_0x33f28d){const _0x33eccf=a35_0x387968;if(_0x33f28d['kind']===_0x33eccf(0x10a)&&!(_0x33f28d[_0x33eccf(0xfa)]in process.env))throw CliErrors[_0x33eccf(0xed)](_0x33eccf(0xce)+_0x33f28d[_0x33eccf(0xfa)]);if(_0x33f28d[_0x33eccf(0x103)]===_0x33eccf(0xf3))try{await access(_0x33f28d['path']);}catch{throw CliErrors[_0x33eccf(0xed)](_0x33eccf(0x106)+_0x33f28d[_0x33eccf(0xef)]);}}export async function readAppConfigValue(_0x3b1fa4){const _0x5d7343=a35_0x387968,_0x4a29e2=assertSingleValueSource(_0x3b1fa4),_0x5e0db0=[];if(_0x4a29e2['kind']===_0x5d7343(0x102))return _0x5e0db0['push']('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0x4a29e2[_0x5d7343(0x10c)]??'','source':_0x4a29e2[_0x5d7343(0x103)],'warnings':_0x5e0db0};if(_0x4a29e2[_0x5d7343(0x103)]===_0x5d7343(0xe2))return{'value':await readStdin(),'source':_0x4a29e2[_0x5d7343(0x103)],'warnings':_0x5e0db0};if(_0x4a29e2[_0x5d7343(0x103)]===_0x5d7343(0x10a)){if(!(_0x4a29e2[_0x5d7343(0xfa)]in process.env))throw CliErrors['validation'](_0x5d7343(0xce)+_0x4a29e2['name']);return{'value':process.env[_0x4a29e2.name]??'','source':_0x4a29e2['kind'],'warnings':_0x5e0db0};}return{'value':await readFile(_0x4a29e2[_0x5d7343(0xef)],_0x5d7343(0xec)),'source':_0x4a29e2[_0x5d7343(0x103)],'warnings':_0x5e0db0};}function readStdin(){return new Promise((_0x3c3587,_0x412ae2)=>{const _0x1421c6=a35_0x2052;let _0x5c3364='';process[_0x1421c6(0xe2)][_0x1421c6(0x107)](_0x1421c6(0xec)),process[_0x1421c6(0xe2)]['on'](_0x1421c6(0xe3),_0x20c539=>{_0x5c3364+=_0x20c539;}),process['stdin'][_0x1421c6(0xe1)]('end',()=>_0x3c3587(_0x5c3364)),process['stdin'][_0x1421c6(0xe1)](_0x1421c6(0xe7),_0x412ae2);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x50ac0a=a36_0x10cd;(function(_0x323a59,_0x506a8b){const _0x2b74ee=a36_0x10cd,_0x515da4=_0x323a59();while(!![]){try{const _0x3b101e=-parseInt(_0x2b74ee(0x94))/0x1+parseInt(_0x2b74ee(0x96))/0x2*(-parseInt(_0x2b74ee(0x9a))/0x3)+-parseInt(_0x2b74ee(0xa5))/0x4*(-parseInt(_0x2b74ee(0xa3))/0x5)+-parseInt(_0x2b74ee(0x9b))/0x6+-parseInt(_0x2b74ee(0x98))/0x7+parseInt(_0x2b74ee(0xa2))/0x8*(parseInt(_0x2b74ee(0xa7))/0x9)+parseInt(_0x2b74ee(0xa4))/0xa;if(_0x3b101e===_0x506a8b)break;else _0x515da4['push'](_0x515da4['shift']());}catch(_0xbc5e57){_0x515da4['push'](_0x515da4['shift']());}}}(a36_0x5517,0xec12b));import{unlinkSync,existsSync}from'node:fs';function a36_0x10cd(_0x2d3ad3,_0x51824f){_0x2d3ad3=_0x2d3ad3-0x93;const _0x551723=a36_0x5517();let _0x10cd94=_0x551723[_0x2d3ad3];return _0x10cd94;}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a36_0x50ac0a(0x95),'command':a36_0x50ac0a(0xa8),'description':a36_0x50ac0a(0xa9),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'yes','type':'boolean','description':a36_0x50ac0a(0x9f),'default':![]}],async 'execute'(_0x2400a8){const _0x3b56a9=a36_0x50ac0a,{runAuthServer:_0x1ec446}=await import(_0x3b56a9(0xa6));return await _0x1ec446({'autoYes':_0x2400a8[_0x3b56a9(0x93)](_0x3b56a9(0x99)),'nonInteractive':_0x2400a8[_0x3b56a9(0x9e)]}),{'ok':!![]};}},{'service':a36_0x50ac0a(0x95),'command':a36_0x50ac0a(0xa1),'description':a36_0x50ac0a(0xa0),'risk':a36_0x50ac0a(0x9c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x240b10){const _0x470fa1=a36_0x50ac0a;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x470fa1(0x97)]('✓\x20Logged\x20out')):console['log'](_0x470fa1(0x9d)),{'ok':!![]};}}];function a36_0x5517(){const _0x597c69=['56076770wvQAfH','129848oVoQXi','../../auth/auth-server-ui.js','141111rONdiN','login','Login\x20via\x20browser','bool','223852SpVobM','auth','22582ythQBN','log','7347816AobKld','yes','468tzYnGa','10770228qqogxL','write','!\x20Not\x20logged\x20in','nonInteractive','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','Clear\x20login\x20session','logout','80YelmFK','5LBaZTN'];a36_0x5517=function(){return _0x597c69;};return a36_0x5517();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x502755=a37_0x562d;(function(_0x5148a0,_0x299638){const _0x5e6378=a37_0x562d,_0x1a5b64=_0x5148a0();while(!![]){try{const _0x45c2c7=parseInt(_0x5e6378(0x188))/0x1*(-parseInt(_0x5e6378(0x181))/0x2)+-parseInt(_0x5e6378(0x1d3))/0x3*(parseInt(_0x5e6378(0x182))/0x4)+-parseInt(_0x5e6378(0x1e9))/0x5+-parseInt(_0x5e6378(0x1c2))/0x6*(-parseInt(_0x5e6378(0x1ba))/0x7)+parseInt(_0x5e6378(0x186))/0x8+parseInt(_0x5e6378(0x1e0))/0x9+parseInt(_0x5e6378(0x1df))/0xa;if(_0x45c2c7===_0x299638)break;else _0x1a5b64['push'](_0x1a5b64['shift']());}catch(_0x25c54){_0x1a5b64['push'](_0x1a5b64['shift']());}}}(a37_0x28ac,0x543e6));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x28ac(){const _0x42ba92=['Invalid\x20function\x20name\x20\x22','当前请求参数','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','4309470Xulqba','5427099inObNj','HOOK\x20requires\x20alias/operation/node\x20options.','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','datasetcode','filePath','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','UNKNOWN','2093535nnctrd','join','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','/COMMON/','修改后的响应结果','\x22\x20not\x20found.\x20','18CEzlTt','29408ZhBqvC','当前响应结果','write','selectedAppName','3311656RbNmCs','\x22\x20not\x20found\x20for\x20dataset\x20','59498fidQbo','code','stdin','source','appCode','tableName','\x0a\x20*\x20[平台配置]\x20','before','map','No\x20operation\x20types\x20found\x20for\x20dataset\x20','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','Script\x20description','defaultApp','Available:\x20','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','No\x20model\x20aliases\x20found.\x20Run\x20`','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','/ENDPOINT/','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','length','utf8','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','currentApp','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','keys','mergedCli','find','nonInteractive','alias','stderr','Operation\x20type\x20\x22','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','description','validation','File\x20already\x20exists:\x20','operation-type','Select\x20operation\x20type:','Script\x20type','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','includes','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','create','HOOK','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','\x20api\x20pull`\x20to\x20refresh.','entries','.js','112fhxVGH','scriptsRootDir','function-node','/data/dataset/','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','str','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','/**\x0a\x20*\x20','18690HHXHDK','string','read','parseInt','datasetId','修改后的请求参数','functionNode','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Created\x20','apiDir','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','.js\x0a','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','name','Select\x20dataset:','Select\x20trigger\x20node:','Operation\x20type\x20(HOOK\x20only)','81UrOhUe','profileName','/HOOK/','COMMON','close','datasetCode','trim','operationType','after'];a37_0x28ac=function(){return _0x42ba92;};return a37_0x28ac();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a37_0x562d(_0x5c35c7,_0x4169fe){_0x5c35c7=_0x5c35c7-0x17d;const _0x28ac3d=a37_0x28ac();let _0x562d73=_0x28ac3d[_0x5c35c7];return _0x562d73;}import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a37_0x502755(0x1b3),'description':a37_0x502755(0x1e7),'risk':a37_0x502755(0x1c4),'flags':[{'name':'type','type':a37_0x502755(0x1c3),'required':!![],'enum':[a37_0x502755(0x1d6),'ENDPOINT',a37_0x502755(0x1b4)],'description':a37_0x502755(0x1af)},{'name':a37_0x502755(0x1cf),'type':a37_0x502755(0x1c3),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x502755(0x1aa),'type':a37_0x502755(0x1c3),'description':a37_0x502755(0x194)},{'name':a37_0x502755(0x1a6),'type':'string','description':a37_0x502755(0x1ce)},{'name':a37_0x502755(0x1e5),'type':a37_0x502755(0x1c3),'description':a37_0x502755(0x1b5)},{'name':a37_0x502755(0x1ad),'type':a37_0x502755(0x1c3),'description':a37_0x502755(0x1d2)},{'name':a37_0x502755(0x1bc),'type':a37_0x502755(0x1c3),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a37_0x502755(0x18f),a37_0x502755(0x1db)]}],async 'validate'(_0x4331be){const _0x5728b3=a37_0x502755,_0x1b5f9e=_0x4331be[_0x5728b3(0x1bf)](_0x5728b3(0x1cf));if(!isValidBffFunctionName(_0x1b5f9e))throw CliErrors[_0x5728b3(0x1ab)](_0x5728b3(0x1dc)+_0x1b5f9e+_0x5728b3(0x1b6));},async 'execute'(_0x2bda03){const _0x5b389f=a37_0x502755,_0x10a668=loadBffProjectConfig(_0x2bda03[_0x5b389f(0x18c)]),_0x3beca5=_0x2bda03[_0x5b389f(0x1bf)]('type'),_0xeff969=_0x2bda03['str']('name'),_0x2ddc07=_0x2bda03[_0x5b389f(0x1bf)](_0x5b389f(0x1aa))||undefined,_0x49d44b=_0x3beca5==='HOOK'?await resolveHookOptions(_0x10a668,_0x2bda03):undefined,_0x5b8738=buildFilePath(_0x10a668,_0x3beca5,_0xeff969,_0x49d44b);if(await fileExists(_0x5b8738))throw CliErrors['validation'](_0x5b389f(0x1ac)+_0x5b8738);await mkdir(dirname(_0x5b8738),{'recursive':!![]});const _0x1dcf30=generateTemplate(_0x3beca5,_0xeff969,_0x2bda03['appCode'],_0x2ddc07,_0x49d44b);await writeFile(_0x5b8738,_0x1dcf30,_0x5b389f(0x19d));const _0x20d024={'type':_0x3beca5,'name':_0xeff969,'path':_0x5b8738};if(_0x2ddc07)_0x20d024[_0x5b389f(0x1aa)]=_0x2ddc07;if(_0x49d44b){if(_0x49d44b[_0x5b389f(0x1a6)])_0x20d024['alias']=_0x49d44b['alias'];_0x20d024['datasetCode']=_0x49d44b['datasetCode'],_0x20d024[_0x5b389f(0x1da)]=_0x49d44b[_0x5b389f(0x1da)],_0x20d024[_0x5b389f(0x1c8)]=_0x49d44b[_0x5b389f(0x1c8)];}return{'ok':!![],'data':_0x20d024,'message':_0x5b389f(0x1ca)+_0x3beca5+'\x20function:\x20'+_0xeff969};}};async function resolveHookOptions(_0x168b85,_0x375bcf){const _0x45706d=a37_0x502755,_0x4ac109=resolveApiModelSource(_0x375bcf[_0x45706d(0x1cb)],_0x375bcf[_0x45706d(0x18c)],_0x375bcf[_0x45706d(0x185)]||_0x375bcf[_0x45706d(0x1a3)]?.[_0x45706d(0x1a0)]||_0x375bcf[_0x45706d(0x1a3)]?.[_0x45706d(0x195)]),_0x5a86b8=loadAliasMap(_0x375bcf[_0x45706d(0x1cb)],undefined,_0x4ac109[_0x45706d(0x1e6)],_0x4ac109[_0x45706d(0x1d4)]),_0x2bb3f7=_0x5a86b8[_0x45706d(0x19c)]>0x0;let _0x1941aa,_0x19bd73,_0x119777;const _0x8bfe1e=_0x375bcf[_0x45706d(0x1bf)](_0x45706d(0x1a6)),_0x775bd8=_0x375bcf[_0x45706d(0x1bf)]('datasetcode');if(_0x8bfe1e){const _0x2fd3cf=resolveAlias(_0x375bcf['apiDir'],_0x8bfe1e,undefined,_0x4ac109['filePath'],_0x4ac109[_0x45706d(0x1d4)]);if(!_0x2fd3cf){const _0x23e4d7=_0x2bb3f7?'Available\x20aliases:\x20'+_0x5a86b8['map'](_0x3144e6=>_0x3144e6[_0x45706d(0x1a6)])[_0x45706d(0x1ea)](',\x20'):_0x45706d(0x198)+CLI_BIN_NAME+_0x45706d(0x192);throw CliErrors[_0x45706d(0x1ab)]('Alias\x20\x22'+_0x8bfe1e+_0x45706d(0x180)+_0x23e4d7);}_0x1941aa=_0x8bfe1e,_0x19bd73=_0x2fd3cf;}else{if(_0x775bd8){_0x19bd73=_0x775bd8;const _0xa9493d=_0x5a86b8['find'](_0x2f066b=>_0x2f066b[_0x45706d(0x1d8)]===_0x775bd8);_0x1941aa=_0xa9493d?.[_0x45706d(0x1a6)];}else{if(_0x375bcf[_0x45706d(0x1a5)])throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1a1));else{if(_0x2bb3f7){const _0x3fbd64=_0x5a86b8[_0x45706d(0x190)](_0x140cb5=>_0x140cb5[_0x45706d(0x1a6)]+'\x20('+_0x140cb5[_0x45706d(0x18d)]+')'),_0x2c6cdb=await promptSelect('Select\x20dataset:',_0x3fbd64),_0x27cae4=_0x5a86b8[_0x2c6cdb];if(!_0x27cae4)throw CliErrors[_0x45706d(0x1ab)]('Invalid\x20dataset\x20selection.');_0x1941aa=_0x27cae4[_0x45706d(0x1a6)],_0x19bd73=_0x27cae4['datasetCode'];}else{const _0x3a8ba8=await listDatasets(_0x375bcf[_0x45706d(0x18c)]);if(_0x3a8ba8[_0x45706d(0x19c)]===0x0)throw CliErrors[_0x45706d(0x1ab)]('No\x20datasets\x20found\x20for\x20this\x20app.');const _0x14380c=_0x3a8ba8[_0x45706d(0x190)](_0x1659bd=>_0x1659bd[_0x45706d(0x1cf)]+'\x20['+(_0x1659bd[_0x45706d(0x18b)]??_0x45706d(0x1e8))+']\x20('+_0x1659bd[_0x45706d(0x189)]+')'),_0x2cacba=await promptSelect(_0x45706d(0x1d0),_0x14380c),_0x2822b5=_0x3a8ba8[_0x2cacba];if(!_0x2822b5)throw CliErrors[_0x45706d(0x1ab)]('Invalid\x20dataset\x20selection.');_0x19bd73=_0x2822b5[_0x45706d(0x189)],_0x1941aa=undefined;}}}}const _0x4ee9c7=await listDatasets(_0x375bcf['appCode']),_0x53d88f=_0x4ee9c7[_0x45706d(0x1a4)](_0x4772fd=>_0x4772fd['code']===_0x19bd73);if(!_0x53d88f)throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1e3)+_0x19bd73+'\x22.\x20'+(_0x1941aa?_0x45706d(0x193)+CLI_BIN_NAME+_0x45706d(0x1b7):''));_0x119777=_0x53d88f['id'];const _0x2c1625=_0x1941aa??_0x19bd73,_0x5ebf90=await listBffDatasetOperations(_0x375bcf['appCode'],_0x119777),_0xc8d19f=_0x5ebf90?Object[_0x45706d(0x1a2)](_0x5ebf90):[];if(_0xc8d19f[_0x45706d(0x19c)]===0x0)throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x191)+_0x2c1625+'.');let _0x2929e3;const _0x45c9cc=_0x375bcf[_0x45706d(0x1bf)](_0x45706d(0x1ad));if(_0x45c9cc){if(!_0xc8d19f[_0x45706d(0x1b1)](_0x45c9cc))throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1a8)+_0x45c9cc+_0x45706d(0x187)+_0x2c1625+'.\x20'+(_0x45706d(0x196)+_0xc8d19f[_0x45706d(0x1ea)](',\x20')));_0x2929e3=_0x45c9cc;}else{if(_0x375bcf[_0x45706d(0x1a5)])throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x17d));const _0x519025=await promptSelect(_0x45706d(0x1ae),_0xc8d19f);_0x2929e3=_0xc8d19f[_0x519025]??_0xc8d19f[0x0];}let _0x5ad76c=normalizeHookFunctionNode(_0x375bcf[_0x45706d(0x1bf)]('function-node'));if(!_0x5ad76c){if(_0x375bcf['str'](_0x45706d(0x1bc)))throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x197));if(_0x375bcf['nonInteractive'])throw CliErrors[_0x45706d(0x1ab)](_0x45706d(0x1c9));const _0x4953ff=await promptSelect(_0x45706d(0x1d1),[_0x45706d(0x18f),'after']);_0x5ad76c=['before',_0x45706d(0x1db)][_0x4953ff]??_0x45706d(0x18f);}return{'alias':_0x1941aa,'datasetCode':_0x19bd73,'datasetId':_0x119777,'operationType':_0x2929e3,'functionNode':_0x5ad76c};}async function promptSelect(_0x49035f,_0x3b95fa){const _0x3fcb80=a37_0x502755;if(_0x3b95fa[_0x3fcb80(0x19c)]===0x1)return 0x0;for(const [_0x2ff909,_0x12c61e]of _0x3b95fa[_0x3fcb80(0x1b8)]()){process[_0x3fcb80(0x1a7)][_0x3fcb80(0x184)]('\x20\x20'+(_0x2ff909+0x1)+'.\x20'+_0x12c61e+'\x0a');}const _0x3ddbde=createInterface({'input':process[_0x3fcb80(0x18a)],'output':process[_0x3fcb80(0x1a7)]});while(!![]){const _0x3d079c=await new Promise(_0x1d7a16=>{_0x3ddbde['question'](_0x49035f+'\x20',_0x1d7a16);}),_0x346315=Number[_0x3fcb80(0x1c5)](_0x3d079c[_0x3fcb80(0x1d9)](),0xa);if(Number['isInteger'](_0x346315)&&_0x346315>=0x1&&_0x346315<=_0x3b95fa[_0x3fcb80(0x19c)])return _0x3ddbde[_0x3fcb80(0x1d7)](),_0x346315-0x1;process[_0x3fcb80(0x1a7)]['write'](_0x3fcb80(0x1cc)+_0x3b95fa[_0x3fcb80(0x19c)]+'.\x0a');}}function buildFilePath(_0x5d65cd,_0x3028d1,_0x382073,_0xcce540){const _0x465ddd=a37_0x502755;if(_0x3028d1===_0x465ddd(0x1b4)){if(!_0xcce540)throw CliErrors[_0x465ddd(0x1ab)](_0x465ddd(0x1e1));const _0x5eaf02=_0xcce540[_0x465ddd(0x1a6)]??_0xcce540['datasetCode'];return join(_0x5d65cd['scriptsRootDir'],'HOOK',_0x5eaf02,_0xcce540[_0x465ddd(0x1da)],_0xcce540[_0x465ddd(0x1c8)],_0x382073+_0x465ddd(0x1b9));}return join(_0x5d65cd[_0x465ddd(0x1bb)],_0x3028d1,_0x382073+'.js');}export function generateTemplate(_0x934b2d,_0x34aab0,_0x38a2ae,_0x2922ca,_0x30cab8){const _0x2b25b6=a37_0x502755,_0x345e44=_0x2922ca?.[_0x2b25b6(0x1d9)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x4c4cfc=getAppBaseUrl(_0x38a2ae),_0x3b986a=_0x2b25b6(0x19b);if(_0x934b2d===_0x2b25b6(0x1d6))return'/**\x0a\x20*\x20'+_0x345e44+_0x2b25b6(0x19e)+_0x34aab0+_0x2b25b6(0x18e)+_0x4c4cfc+_0x2b25b6(0x19f)+_0x38a2ae+_0x2b25b6(0x17e)+_0x34aab0+_0x2b25b6(0x1be)+_0x34aab0+'\x22,\x20params\x20})\x0a'+_0x3b986a+_0x2b25b6(0x1e4)+_0x34aab0+_0x2b25b6(0x1b2);if(_0x934b2d==='ENDPOINT')return'/**\x0a\x20*\x20'+_0x345e44+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x34aab0+_0x2b25b6(0x1a9)+_0x38a2ae+'/'+_0x34aab0+_0x2b25b6(0x18e)+_0x4c4cfc+_0x2b25b6(0x19f)+_0x38a2ae+_0x2b25b6(0x19a)+_0x34aab0+_0x2b25b6(0x1cd)+_0x3b986a+_0x2b25b6(0x1b0)+_0x34aab0+_0x2b25b6(0x1b2);if(!_0x30cab8)throw CliErrors[_0x2b25b6(0x1ab)](_0x2b25b6(0x1e2));const _0x508e72=_0x30cab8[_0x2b25b6(0x1a6)]??_0x30cab8[_0x2b25b6(0x1d8)],_0x3a12f6=_0x30cab8[_0x2b25b6(0x1c8)]===_0x2b25b6(0x18f)?_0x2b25b6(0x1dd):_0x2b25b6(0x183),_0x312b8d=_0x30cab8[_0x2b25b6(0x1c8)]==='before'?_0x2b25b6(0x1c7):_0x2b25b6(0x17f);return _0x2b25b6(0x1c1)+_0x345e44+_0x2b25b6(0x1de)+_0x34aab0+_0x2b25b6(0x1c0)+_0x38a2ae+'/'+_0x30cab8[_0x2b25b6(0x1d8)]+'/'+_0x30cab8['operationType']+'\x0a\x20*\x20[平台配置]\x20'+_0x4c4cfc+_0x2b25b6(0x1bd)+_0x30cab8[_0x2b25b6(0x1c6)]+_0x2b25b6(0x1eb)+_0x38a2ae+_0x2b25b6(0x1d5)+_0x508e72+'/'+_0x30cab8[_0x2b25b6(0x1da)]+'/'+_0x30cab8[_0x2b25b6(0x1c8)]+'/'+_0x34aab0+'.js\x0a\x20*\x20[触发节点]\x20'+_0x30cab8['functionNode']+'\x0a'+_0x3b986a+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x3a12f6+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x312b8d+_0x2b25b6(0x199)+_0x34aab0+_0x2b25b6(0x1b2);}
|
|
1
|
+
const a37_0x5a9b19=a37_0x2404;(function(_0x5ec64a,_0x295d0f){const _0x57d8e2=a37_0x2404,_0x183146=_0x5ec64a();while(!![]){try{const _0x82ff43=-parseInt(_0x57d8e2(0x1fc))/0x1*(parseInt(_0x57d8e2(0x203))/0x2)+parseInt(_0x57d8e2(0x1fb))/0x3*(parseInt(_0x57d8e2(0x20b))/0x4)+-parseInt(_0x57d8e2(0x213))/0x5+parseInt(_0x57d8e2(0x1fd))/0x6*(parseInt(_0x57d8e2(0x22b))/0x7)+-parseInt(_0x57d8e2(0x21a))/0x8+parseInt(_0x57d8e2(0x224))/0x9+parseInt(_0x57d8e2(0x20d))/0xa;if(_0x82ff43===_0x295d0f)break;else _0x183146['push'](_0x183146['shift']());}catch(_0x48594e){_0x183146['push'](_0x183146['shift']());}}}(a37_0x3696,0xd634b));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';function a37_0x2404(_0x3a0e30,_0x53b4cd){_0x3a0e30=_0x3a0e30-0x1ce;const _0x36966f=a37_0x3696();let _0x240408=_0x36966f[_0x3a0e30];return _0x240408;}import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x5a9b19(0x226),'command':a37_0x5a9b19(0x20e),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a37_0x5a9b19(0x21d),'flags':[{'name':'type','type':'string','required':!![],'enum':[a37_0x5a9b19(0x1e5),a37_0x5a9b19(0x235),a37_0x5a9b19(0x1cf)],'description':a37_0x5a9b19(0x1f9)},{'name':a37_0x5a9b19(0x220),'type':a37_0x5a9b19(0x1f5),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':'description','type':a37_0x5a9b19(0x1f5),'description':a37_0x5a9b19(0x1f6)},{'name':a37_0x5a9b19(0x1ec),'type':a37_0x5a9b19(0x1f5),'description':a37_0x5a9b19(0x207)},{'name':a37_0x5a9b19(0x222),'type':a37_0x5a9b19(0x1f5),'description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a37_0x5a9b19(0x1f7),'type':a37_0x5a9b19(0x1f5),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a37_0x5a9b19(0x1f3),'type':a37_0x5a9b19(0x1f5),'description':a37_0x5a9b19(0x230),'enum':['before',a37_0x5a9b19(0x1f2)]}],async 'validate'(_0x242618){const _0x4483ca=a37_0x5a9b19,_0x47c710=_0x242618[_0x4483ca(0x214)](_0x4483ca(0x220));if(!isValidBffFunctionName(_0x47c710))throw CliErrors[_0x4483ca(0x219)]('Invalid\x20function\x20name\x20\x22'+_0x47c710+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x9ff01b){const _0x40aaaf=a37_0x5a9b19,_0x26e257=loadBffProjectConfig(_0x9ff01b[_0x40aaaf(0x1e3)]),_0x2787d5=_0x9ff01b[_0x40aaaf(0x214)](_0x40aaaf(0x1d0)),_0xda9573=_0x9ff01b[_0x40aaaf(0x214)](_0x40aaaf(0x220)),_0x2c59df=_0x9ff01b[_0x40aaaf(0x214)]('description')||undefined,_0x4f6508=_0x2787d5==='HOOK'?await resolveHookOptions(_0x26e257,_0x9ff01b):undefined,_0x280672=buildFilePath(_0x26e257,_0x2787d5,_0xda9573,_0x4f6508);if(await fileExists(_0x280672))throw CliErrors[_0x40aaaf(0x219)](_0x40aaaf(0x1d1)+_0x280672);await mkdir(dirname(_0x280672),{'recursive':!![]});const _0x33feaf=generateTemplate(_0x2787d5,_0xda9573,_0x9ff01b[_0x40aaaf(0x1e3)],_0x2c59df,_0x4f6508);await writeFile(_0x280672,_0x33feaf,_0x40aaaf(0x1df));const _0x32b8ba={'type':_0x2787d5,'name':_0xda9573,'path':_0x280672};if(_0x2c59df)_0x32b8ba[_0x40aaaf(0x1fa)]=_0x2c59df;if(_0x4f6508){if(_0x4f6508['alias'])_0x32b8ba['alias']=_0x4f6508[_0x40aaaf(0x1ec)];_0x32b8ba[_0x40aaaf(0x1e0)]=_0x4f6508['datasetCode'],_0x32b8ba['operationType']=_0x4f6508[_0x40aaaf(0x200)],_0x32b8ba[_0x40aaaf(0x1db)]=_0x4f6508[_0x40aaaf(0x1db)];}return{'ok':!![],'data':_0x32b8ba,'message':_0x40aaaf(0x1d5)+_0x2787d5+_0x40aaaf(0x22c)+_0xda9573};}};async function resolveHookOptions(_0x4ecbff,_0x2fc0cd){const _0x343819=a37_0x5a9b19,_0x4deb7d=resolveApiModelSource(_0x2fc0cd[_0x343819(0x1f0)],_0x2fc0cd[_0x343819(0x1e3)],_0x2fc0cd['selectedAppName']||_0x2fc0cd[_0x343819(0x234)]?.[_0x343819(0x210)]||_0x2fc0cd[_0x343819(0x234)]?.['defaultApp']),_0x1b6de8=loadAliasMap(_0x2fc0cd['apiDir'],undefined,_0x4deb7d[_0x343819(0x215)],_0x4deb7d[_0x343819(0x1d4)]),_0x1b7b23=_0x1b6de8[_0x343819(0x21e)]>0x0;let _0x3be8c3,_0x385e93,_0xa3c33d;const _0x7237da=_0x2fc0cd[_0x343819(0x214)]('alias'),_0x1ac734=_0x2fc0cd['str'](_0x343819(0x222));if(_0x7237da){const _0x589be5=resolveAlias(_0x2fc0cd[_0x343819(0x1f0)],_0x7237da,undefined,_0x4deb7d['filePath'],_0x4deb7d['profileName']);if(!_0x589be5){const _0x308d12=_0x1b7b23?_0x343819(0x1d8)+_0x1b6de8[_0x343819(0x1d9)](_0x2f0ce9=>_0x2f0ce9['alias'])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x343819(0x1f1);throw CliErrors['validation']('Alias\x20\x22'+_0x7237da+_0x343819(0x1d2)+_0x308d12);}_0x3be8c3=_0x7237da,_0x385e93=_0x589be5;}else{if(_0x1ac734){_0x385e93=_0x1ac734;const _0x58969b=_0x1b6de8[_0x343819(0x1e6)](_0x88309=>_0x88309[_0x343819(0x1e0)]===_0x1ac734);_0x3be8c3=_0x58969b?.[_0x343819(0x1ec)];}else{if(_0x2fc0cd[_0x343819(0x20c)])throw CliErrors[_0x343819(0x219)]('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x1b7b23){const _0x43a66c=_0x1b6de8[_0x343819(0x1d9)](_0x50bb64=>_0x50bb64[_0x343819(0x1ec)]+'\x20('+_0x50bb64[_0x343819(0x1dc)]+')'),_0x41af36=await promptSelect(_0x343819(0x231),_0x43a66c),_0x3111c9=_0x1b6de8[_0x41af36];if(!_0x3111c9)throw CliErrors[_0x343819(0x219)](_0x343819(0x205));_0x3be8c3=_0x3111c9[_0x343819(0x1ec)],_0x385e93=_0x3111c9[_0x343819(0x1e0)];}else{const _0x3a51f5=await listDatasets(_0x2fc0cd[_0x343819(0x1e3)]);if(_0x3a51f5[_0x343819(0x21e)]===0x0)throw CliErrors[_0x343819(0x219)]('No\x20datasets\x20found\x20for\x20this\x20app.');const _0x498e83=_0x3a51f5['map'](_0x46510f=>_0x46510f['name']+'\x20['+(_0x46510f['source']??_0x343819(0x21f))+']\x20('+_0x46510f[_0x343819(0x1e8)]+')'),_0x77e487=await promptSelect(_0x343819(0x231),_0x498e83),_0x335ad2=_0x3a51f5[_0x77e487];if(!_0x335ad2)throw CliErrors[_0x343819(0x219)](_0x343819(0x205));_0x385e93=_0x335ad2[_0x343819(0x1e8)],_0x3be8c3=undefined;}}}}const _0x2daa45=await listDatasets(_0x2fc0cd[_0x343819(0x1e3)]),_0x244d92=_0x2daa45[_0x343819(0x1e6)](_0x241adb=>_0x241adb[_0x343819(0x1e8)]===_0x385e93);if(!_0x244d92)throw CliErrors[_0x343819(0x219)](_0x343819(0x232)+_0x385e93+_0x343819(0x21b)+(_0x3be8c3?_0x343819(0x1e1)+CLI_BIN_NAME+_0x343819(0x223):''));_0xa3c33d=_0x244d92['id'];const _0x4e9df7=_0x3be8c3??_0x385e93,_0x150ab2=await listBffDatasetOperations(_0x2fc0cd[_0x343819(0x1e3)],_0xa3c33d),_0x2c6772=_0x150ab2?Object[_0x343819(0x236)](_0x150ab2):[];if(_0x2c6772[_0x343819(0x21e)]===0x0)throw CliErrors[_0x343819(0x219)](_0x343819(0x22e)+_0x4e9df7+'.');let _0x2a8de7;const _0x4f92e5=_0x2fc0cd['str'](_0x343819(0x1f7));if(_0x4f92e5){if(!_0x2c6772[_0x343819(0x225)](_0x4f92e5))throw CliErrors[_0x343819(0x219)](_0x343819(0x233)+_0x4f92e5+_0x343819(0x1ed)+_0x4e9df7+'.\x20'+(_0x343819(0x1d3)+_0x2c6772[_0x343819(0x227)](',\x20')));_0x2a8de7=_0x4f92e5;}else{if(_0x2fc0cd[_0x343819(0x20c)])throw CliErrors[_0x343819(0x219)](_0x343819(0x22f));const _0x1db47d=await promptSelect('Select\x20operation\x20type:',_0x2c6772);_0x2a8de7=_0x2c6772[_0x1db47d]??_0x2c6772[0x0];}let _0x15d02a=normalizeHookFunctionNode(_0x2fc0cd[_0x343819(0x214)]('function-node'));if(!_0x15d02a){if(_0x2fc0cd[_0x343819(0x214)](_0x343819(0x1f3)))throw CliErrors['validation'](_0x343819(0x204));if(_0x2fc0cd['nonInteractive'])throw CliErrors['validation'](_0x343819(0x228));const _0x182ec7=await promptSelect(_0x343819(0x1dd),[_0x343819(0x221),_0x343819(0x1f2)]);_0x15d02a=['before',_0x343819(0x1f2)][_0x182ec7]??_0x343819(0x221);}return{'alias':_0x3be8c3,'datasetCode':_0x385e93,'datasetId':_0xa3c33d,'operationType':_0x2a8de7,'functionNode':_0x15d02a};}function a37_0x3696(){const _0x322914=['operation-type','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Script\x20type','description','27mNicrv','128903teqArL','708iHDimk','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x22,\x20params\x20})\x0a','operationType','\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','datasetId','8voMNBa','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Invalid\x20dataset\x20selection.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','\x0a\x20*\x20[平台配置]\x20','.js','/**\x0a\x20*\x20','271564MywVTC','nonInteractive','8369890GRteBx','create','trim','currentApp','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','6799960LrioGJ','str','filePath','question','/data/dataset/','write','validation','2465272hWnGaz','\x22.\x20','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','read','length','UNKNOWN','name','before','datasetcode','\x20api\x20pull`\x20to\x20refresh.','2944602VVnqGE','includes','bff','join','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','isInteger','/ENDPOINT/','76286dhMnfl','\x20function:\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','No\x20operation\x20types\x20found\x20for\x20dataset\x20','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Trigger\x20node\x20(HOOK\x20only)','Select\x20dataset:','Dataset\x20not\x20found\x20for\x20code\x20\x22','Operation\x20type\x20\x22','mergedCli','ENDPOINT','keys','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','HOOK','type','File\x20already\x20exists:\x20','\x22\x20not\x20found.\x20','Available:\x20','profileName','Created\x20','/HOOK/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Available\x20aliases:\x20','map','stderr','functionNode','tableName','Select\x20trigger\x20node:','/COMMON/','utf8','datasetCode','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','stdin','appCode','修改后的响应结果','COMMON','find','scriptsRootDir','code','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','修改后的请求参数','parseInt','alias','\x22\x20not\x20found\x20for\x20dataset\x20','当前响应结果','.js\x0a\x20*\x20[触发节点]\x20','apiDir','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','after','function-node','HOOK\x20requires\x20alias/operation/node\x20options.','string','Script\x20description'];a37_0x3696=function(){return _0x322914;};return a37_0x3696();}async function promptSelect(_0x4ca818,_0x527178){const _0x57ea13=a37_0x5a9b19;if(_0x527178[_0x57ea13(0x21e)]===0x1)return 0x0;for(const [_0x5b5b7e,_0x260aaf]of _0x527178['entries']()){process[_0x57ea13(0x1da)][_0x57ea13(0x218)]('\x20\x20'+(_0x5b5b7e+0x1)+'.\x20'+_0x260aaf+'\x0a');}const _0x4e4e06=createInterface({'input':process[_0x57ea13(0x1e2)],'output':process['stderr']});while(!![]){const _0x45ed81=await new Promise(_0x51adbf=>{const _0x561ee6=_0x57ea13;_0x4e4e06[_0x561ee6(0x216)](_0x4ca818+'\x20',_0x51adbf);}),_0x20576d=Number[_0x57ea13(0x1eb)](_0x45ed81['trim'](),0xa);if(Number[_0x57ea13(0x229)](_0x20576d)&&_0x20576d>=0x1&&_0x20576d<=_0x527178[_0x57ea13(0x21e)])return _0x4e4e06['close'](),_0x20576d-0x1;process[_0x57ea13(0x1da)]['write'](_0x57ea13(0x1ce)+_0x527178[_0x57ea13(0x21e)]+'.\x0a');}}function buildFilePath(_0x291a50,_0x54cf1e,_0x58bbd7,_0x27f7f7){const _0x30ce52=a37_0x5a9b19;if(_0x54cf1e===_0x30ce52(0x1cf)){if(!_0x27f7f7)throw CliErrors[_0x30ce52(0x219)](_0x30ce52(0x1f4));const _0x25db5f=_0x27f7f7['alias']??_0x27f7f7[_0x30ce52(0x1e0)];return join(_0x291a50[_0x30ce52(0x1e7)],'HOOK',_0x25db5f,_0x27f7f7[_0x30ce52(0x200)],_0x27f7f7[_0x30ce52(0x1db)],_0x58bbd7+_0x30ce52(0x209));}return join(_0x291a50[_0x30ce52(0x1e7)],_0x54cf1e,_0x58bbd7+_0x30ce52(0x209));}export function generateTemplate(_0x48e2e1,_0x14a8ce,_0x4ecc47,_0x4a61bc,_0x3e481f){const _0x1ec3b2=a37_0x5a9b19,_0x2898f5=_0x4a61bc?.[_0x1ec3b2(0x20f)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x2e9df0=getAppBaseUrl(_0x4ecc47),_0x98279=_0x1ec3b2(0x211);if(_0x48e2e1===_0x1ec3b2(0x1e5))return _0x1ec3b2(0x20a)+_0x2898f5+_0x1ec3b2(0x206)+_0x14a8ce+'\x0a\x20*\x20[平台配置]\x20'+_0x2e9df0+_0x1ec3b2(0x1fe)+_0x4ecc47+_0x1ec3b2(0x1de)+_0x14a8ce+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x14a8ce+_0x1ec3b2(0x1ff)+_0x98279+'\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'+_0x14a8ce+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x48e2e1===_0x1ec3b2(0x235))return _0x1ec3b2(0x20a)+_0x2898f5+_0x1ec3b2(0x1d7)+_0x14a8ce+_0x1ec3b2(0x212)+_0x4ecc47+'/'+_0x14a8ce+_0x1ec3b2(0x208)+_0x2e9df0+_0x1ec3b2(0x1fe)+_0x4ecc47+_0x1ec3b2(0x22a)+_0x14a8ce+'.js\x0a'+_0x98279+_0x1ec3b2(0x201)+_0x14a8ce+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x3e481f)throw CliErrors[_0x1ec3b2(0x219)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x51ba62=_0x3e481f[_0x1ec3b2(0x1ec)]??_0x3e481f['datasetCode'],_0x5b339d=_0x3e481f['functionNode']===_0x1ec3b2(0x221)?'当前请求参数':_0x1ec3b2(0x1ee),_0x258fb8=_0x3e481f['functionNode']===_0x1ec3b2(0x221)?_0x1ec3b2(0x1ea):_0x1ec3b2(0x1e4);return _0x1ec3b2(0x20a)+_0x2898f5+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20'+_0x14a8ce+_0x1ec3b2(0x22d)+_0x4ecc47+'/'+_0x3e481f[_0x1ec3b2(0x1e0)]+'/'+_0x3e481f[_0x1ec3b2(0x200)]+_0x1ec3b2(0x208)+_0x2e9df0+_0x1ec3b2(0x217)+_0x3e481f[_0x1ec3b2(0x202)]+_0x1ec3b2(0x1e9)+_0x4ecc47+_0x1ec3b2(0x1d6)+_0x51ba62+'/'+_0x3e481f['operationType']+'/'+_0x3e481f[_0x1ec3b2(0x1db)]+'/'+_0x14a8ce+_0x1ec3b2(0x1ef)+_0x3e481f[_0x1ec3b2(0x1db)]+'\x0a'+_0x98279+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x5b339d+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x258fb8+_0x1ec3b2(0x1f8)+_0x14a8ce+_0x1ec3b2(0x21c);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a38_0x26dd(_0x580f47,_0xea9715){_0x580f47=_0x580f47-0x15a;const _0x154019=a38_0x1540();let _0x26dd60=_0x154019[_0x580f47];return _0x26dd60;}const a38_0x469518=a38_0x26dd;(function(_0x175775,_0x10cb7f){const _0x1de85c=a38_0x26dd,_0x13d0c3=_0x175775();while(!![]){try{const _0x51bb57=-parseInt(_0x1de85c(0x18a))/0x1*(-parseInt(_0x1de85c(0x15c))/0x2)+-parseInt(_0x1de85c(0x176))/0x3*(-parseInt(_0x1de85c(0x17e))/0x4)+-parseInt(_0x1de85c(0x15f))/0x5+-parseInt(_0x1de85c(0x162))/0x6+-parseInt(_0x1de85c(0x168))/0x7*(parseInt(_0x1de85c(0x17a))/0x8)+-parseInt(_0x1de85c(0x169))/0x9*(-parseInt(_0x1de85c(0x17f))/0xa)+parseInt(_0x1de85c(0x175))/0xb;if(_0x51bb57===_0x10cb7f)break;else _0x13d0c3['push'](_0x13d0c3['shift']());}catch(_0x192a0d){_0x13d0c3['push'](_0x13d0c3['shift']());}}}(a38_0x1540,0xc367a));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';function a38_0x1540(){const _0xbd31e4=['2562900WSsLCF','split','bff','6767448FnVaFY','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','Deleted\x20','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','Lock\x20scope\x20for\x20app\x20\x22','lastSync','1827ilIcLr','129627wLznUe','functions','startsWith','apps','scriptsRootDir','target','join','toISOString','POST','Backend\x20Function\x20lock\x20file\x20not\x20found.','<timestamp>','map','16072320SSxpJN','3QbCUqx','validation','trashDir','string','14792CxAqTz','appCode','filter','delete','2195132ZoaFJA','410RheEuI','parse','includes','Local\x20delete\x20not\x20settled\x20for\x20','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','keys','trashedTo','find','remoteId','/api/management/library/scripts/delete','No\x20lock\x20entry\x20found\x20for\x20\x22','7OgBxAr','projectRoot','Would\x20delete\x20','\x22\x20not\x20found\x20after\x20ensureLockScope.','Multiple\x20functions\x20match\x20\x22','str','length','scriptsRoot','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','92294FBTAoM','lockFilePath','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'];a38_0x1540=function(){return _0xbd31e4;};return a38_0x1540();}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_0x469518(0x161),'command':a38_0x469518(0x17d),'description':a38_0x469518(0x165),'risk':'high-risk-write','flags':[{'name':a38_0x469518(0x16e),'type':a38_0x469518(0x179),'required':!![],'description':a38_0x469518(0x15e)}],async 'validate'(_0x2ecefc){const _0x37dbd6=a38_0x469518,_0xb91d0=loadBffProjectConfig(_0x2ecefc['appCode']),_0x426d72=await readBffLockFile(_0xb91d0[_0x37dbd6(0x15d)]);if(!_0x426d72)throw CliErrors[_0x37dbd6(0x177)](_0x37dbd6(0x15b));},async 'dryRun'(_0x357a50){const _0x11c7ea=a38_0x469518,_0x25aa12=loadBffProjectConfig(_0x357a50[_0x11c7ea(0x17b)]),_0x241215=await readBffLockFile(_0x25aa12[_0x11c7ea(0x15d)]);if(!_0x241215)throw CliErrors['validation'](_0x11c7ea(0x172));const {appLock:_0x587811}=ensureLockScope(_0x241215,_0x357a50[_0x11c7ea(0x17b)],_0x25aa12['scriptsRoot'],_0x11c7ea(0x17d)),_0x4f60ad=_0x357a50[_0x11c7ea(0x18f)]('target'),_0x16a31a=Object['keys'](_0x587811[_0x11c7ea(0x16a)]),_0x464087=resolveDeleteTarget(_0x4f60ad,_0x16a31a),_0x2d271b=_0x587811[_0x11c7ea(0x16a)][_0x464087];if(!_0x2d271b)throw CliErrors[_0x11c7ea(0x177)](_0x11c7ea(0x189)+_0x464087+'\x22.');const _0x2704fa=resolveLocalFilePathFromLockKey(_0x25aa12,_0x464087),_0x5b5b15=relative(_0x25aa12[_0x11c7ea(0x18b)],_0x2704fa),_0x421c44=join(_0x25aa12[_0x11c7ea(0x178)],_0x11c7ea(0x173),_0x5b5b15);return{'method':_0x11c7ea(0x171),'url':_0x11c7ea(0x188),'body':{'appCode':_0x357a50[_0x11c7ea(0x17b)],'target':_0x464087,'remoteId':_0x2d271b[_0x11c7ea(0x187)],'localFilePath':_0x2704fa,'trashedPath':_0x421c44},'description':_0x11c7ea(0x18c)+_0x464087+_0x11c7ea(0x183)};},async 'execute'(_0x57f1b8){const _0x54d683=a38_0x469518,_0x4966a0=loadBffProjectConfig(_0x57f1b8[_0x54d683(0x17b)]),_0x4c94a8=await readBffLockFile(_0x4966a0[_0x54d683(0x15d)]);if(!_0x4c94a8)throw CliErrors[_0x54d683(0x177)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x552b0e,appLock:_0x3c117a}=ensureLockScope(_0x4c94a8,_0x57f1b8[_0x54d683(0x17b)],_0x4966a0[_0x54d683(0x15a)],_0x54d683(0x17d)),_0x115865=JSON[_0x54d683(0x180)](JSON['stringify'](_0x552b0e)),_0xa41d0d=_0x115865['apps'][_0x57f1b8[_0x54d683(0x17b)]];if(!_0xa41d0d)throw new Error(_0x54d683(0x166)+_0x57f1b8[_0x54d683(0x17b)]+_0x54d683(0x18d));const _0x1f04c0=_0x57f1b8[_0x54d683(0x18f)](_0x54d683(0x16e)),_0x112b3b=Object[_0x54d683(0x184)](_0xa41d0d[_0x54d683(0x16a)]),_0x5ce3c2=resolveDeleteTarget(_0x1f04c0,_0x112b3b),_0x39f2cf=_0xa41d0d[_0x54d683(0x16a)][_0x5ce3c2];if(!_0x39f2cf)throw CliErrors['validation'](_0x54d683(0x189)+_0x5ce3c2+'\x22.');await deleteBffScript(_0x39f2cf['remoteId']),delete _0xa41d0d['functions'][_0x5ce3c2],_0xa41d0d[_0x54d683(0x167)]=new Date()[_0x54d683(0x170)](),await writeBffLockFile(_0x4966a0['lockFilePath'],_0x115865);const _0x12998e=resolveLocalFilePathFromLockKey(_0x4966a0,_0x5ce3c2);let _0x4b0bdb;await fileExists(_0x12998e)&&(_0x4b0bdb=await moveToTrash(_0x4966a0['projectRoot'],_0x4966a0[_0x54d683(0x178)],_0x12998e),await cleanupEmptyDirectories(dirname(_0x12998e),_0x4966a0[_0x54d683(0x16d)]));await waitForDeleteSettlement(_0x4966a0[_0x54d683(0x15d)],_0x57f1b8['appCode'],_0x5ce3c2,_0x12998e),await sleep(0x96);const _0x3fce71={'deleted':_0x5ce3c2,'remoteId':_0x39f2cf[_0x54d683(0x187)]};if(_0x4b0bdb)_0x3fce71[_0x54d683(0x185)]=_0x4b0bdb;return{'ok':!![],'data':_0x3fce71,'message':_0x54d683(0x164)+_0x5ce3c2+(_0x4b0bdb?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x4ad35d,_0x1996d0){const _0x29510e=a38_0x469518;if(_0x4ad35d[_0x29510e(0x181)]('/')){const _0x353d08=_0x1996d0[_0x29510e(0x186)](_0x6bc0d0=>_0x6bc0d0===_0x4ad35d);if(!_0x353d08)throw CliErrors['validation']('Function\x20not\x20found:\x20'+_0x4ad35d);return _0x353d08;}const _0x594b70=_0x1996d0[_0x29510e(0x17c)](_0x216cf1=>_0x216cf1[_0x29510e(0x160)]('/')['at'](-0x1)===_0x4ad35d);if(_0x594b70[_0x29510e(0x190)]===0x0)throw CliErrors[_0x29510e(0x177)]('Function\x20not\x20found:\x20'+_0x4ad35d);if(_0x594b70['length']>0x1)throw CliErrors[_0x29510e(0x177)](_0x29510e(0x18e)+_0x4ad35d+_0x29510e(0x163)+_0x594b70[_0x29510e(0x174)](_0x411e36=>'\x20\x20-\x20'+_0x411e36)[_0x29510e(0x16f)]('\x0a'));return _0x594b70[0x0];}async function moveToTrash(_0x2ffddc,_0x475503,_0x43c103){const _0x3a085b=a38_0x469518,_0x106433=new Date()[_0x3a085b(0x170)]()['replace'](/[:.]/g,'-'),_0x210164=relative(_0x2ffddc,_0x43c103),_0xd4141a=join(_0x475503,_0x106433,_0x210164);return await mkdir(dirname(_0xd4141a),{'recursive':!![]}),await rename(_0x43c103,_0xd4141a),_0xd4141a;}async function cleanupEmptyDirectories(_0x2b34ad,_0x31ab7a){const _0x5beedd=a38_0x469518;let _0x1493f6=resolve(_0x2b34ad);const _0x25268f=resolve(_0x31ab7a);while(_0x1493f6[_0x5beedd(0x16b)](''+_0x25268f+sep)||_0x1493f6===_0x25268f){if(_0x1493f6===_0x25268f)return;try{const _0x499d48=await readdir(_0x1493f6);if(_0x499d48['length']>0x0)return;await rmdir(_0x1493f6);}catch{return;}_0x1493f6=dirname(_0x1493f6);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x3cebef,_0x1c0420,_0x32e6f9,_0x593305){const _0x25f35f=a38_0x469518;for(let _0x18f891=0x0;_0x18f891<DELETE_SETTLE_RETRY_COUNT;_0x18f891+=0x1){const _0x25259c=await readBffLockFile(_0x3cebef),_0xb28b38=!!_0x25259c?.[_0x25f35f(0x16c)]?.[_0x1c0420]?.[_0x25f35f(0x16a)]?.[_0x32e6f9],_0x4ab27c=await fileExists(_0x593305);if(!_0xb28b38&&!_0x4ab27c)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x25f35f(0x182)+_0x32e6f9+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x452427=a39_0x12be;(function(_0x443ded,_0x483d82){const _0x2b8826=a39_0x12be,_0x1b6cbb=_0x443ded();while(!![]){try{const _0x158f69=-parseInt(_0x2b8826(0x176))/0x1*(parseInt(_0x2b8826(0x175))/0x2)+-parseInt(_0x2b8826(0x180))/0x3*(parseInt(_0x2b8826(0x17a))/0x4)+parseInt(_0x2b8826(0x17d))/0x5+parseInt(_0x2b8826(0x178))/0x6+parseInt(_0x2b8826(0x16f))/0x7+parseInt(_0x2b8826(0x17f))/0x8*(parseInt(_0x2b8826(0x173))/0x9)+-parseInt(_0x2b8826(0x183))/0xa;if(_0x158f69===_0x483d82)break;else _0x1b6cbb['push'](_0x1b6cbb['shift']());}catch(_0x16c403){_0x1b6cbb['push'](_0x1b6cbb['shift']());}}}(a39_0x85a0,0xb6681));function a39_0x12be(_0x17cb9e,_0x1bf302){_0x17cb9e=_0x17cb9e-0x16f;const _0x85a01d=a39_0x85a0();let _0x12befd=_0x85a01d[_0x17cb9e];return _0x12befd;}import{getBffScriptInfo}from'../../core/api-client.js';function a39_0x85a0(){const _0x1d5562=['1315985mzZyNT','scriptContent','457712dcsvPh','3DPDRgH','read','scriptType','806110mJQJfG','bool','4340665klXzAE','number','verbose','description','207vfozoz','appCode','18KkaUQQ','121139VUPepQ','Script\x20ID','3473352cFuBeU','(none)','3440428XHSRYs','boolean','detail'];a39_0x85a0=function(){return _0x1d5562;};return a39_0x85a0();}export const bffDetail={'service':'bff','command':a39_0x452427(0x17c),'description':'Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','risk':a39_0x452427(0x181),'flags':[{'name':'id','type':a39_0x452427(0x170),'required':!![],'description':a39_0x452427(0x177)},{'name':a39_0x452427(0x171),'type':a39_0x452427(0x17b),'description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x49d218){const _0x36b647=a39_0x452427,_0x36b09e=await getBffScriptInfo(_0x49d218['num']('id')),_0x3bda8c=_0x49d218[_0x36b647(0x184)](_0x36b647(0x171));if(_0x3bda8c)return{'ok':!![],'data':_0x36b09e};return{'ok':!![],'data':{'id':_0x36b09e['id'],'functionName':_0x36b09e['functionName']??'','version':_0x36b09e['version']??'','updateUserName':_0x36b09e['updateUserName']??'','appCode':_0x36b09e[_0x36b647(0x174)],'scriptType':_0x36b09e[_0x36b647(0x182)],'description':_0x36b09e[_0x36b647(0x172)]||_0x36b647(0x179),'createdTime':_0x36b09e['createdTime']??'','updatedTime':_0x36b09e['updatedTime']??'','scriptContent':_0x36b09e[_0x36b647(0x17e)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x384507,_0x539e29){const _0x4608b1=a40_0x36d1,_0x1d4f6b=_0x384507();while(!![]){try{const _0x4a8b38=-parseInt(_0x4608b1(0x142))/0x1+-parseInt(_0x4608b1(0x144))/0x2*(-parseInt(_0x4608b1(0x141))/0x3)+-parseInt(_0x4608b1(0x13f))/0x4*(parseInt(_0x4608b1(0x13c))/0x5)+-parseInt(_0x4608b1(0x13e))/0x6+parseInt(_0x4608b1(0x143))/0x7+-parseInt(_0x4608b1(0x140))/0x8*(parseInt(_0x4608b1(0x146))/0x9)+-parseInt(_0x4608b1(0x13d))/0xa*(-parseInt(_0x4608b1(0x145))/0xb);if(_0x4a8b38===_0x539e29)break;else _0x1d4f6b['push'](_0x1d4f6b['shift']());}catch(_0x2b7538){_0x1d4f6b['push'](_0x1d4f6b['shift']());}}}(a40_0x21ff,0x90c27));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';function a40_0x36d1(_0x32fbec,_0x1133a4){_0x32fbec=_0x32fbec-0x13c;const _0x21ff3d=a40_0x21ff();let _0x36d1f0=_0x21ff3d[_0x32fbec];return _0x36d1f0;}import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';function a40_0x21ff(){const _0x1aa813=['996669DyqjTc','155iByWIQ','60kOdgDU','1006722Ofcuif','14296UnxUDh','48MlHVSR','6aYoPmo','112823jRNZEQ','663089XtrDpV','604354dYqEPH','1741124lxFURz'];a40_0x21ff=function(){return _0x1aa813;};return a40_0x21ff();}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_0xd52243=a41_0x1ecc;(function(_0x8e95ee,_0x483a02){const _0x15e705=a41_0x1ecc,_0x439cf8=_0x8e95ee();while(!![]){try{const _0x3d2b92=parseInt(_0x15e705(0x129))/0x1*(-parseInt(_0x15e705(0x138))/0x2)+parseInt(_0x15e705(0x131))/0x3*(parseInt(_0x15e705(0x128))/0x4)+-parseInt(_0x15e705(0x124))/0x5+-parseInt(_0x15e705(0x12e))/0x6+parseInt(_0x15e705(0x143))/0x7*(parseInt(_0x15e705(0x13d))/0x8)+parseInt(_0x15e705(0x136))/0x9*(parseInt(_0x15e705(0x13f))/0xa)+-parseInt(_0x15e705(0x137))/0xb;if(_0x3d2b92===_0x483a02)break;else _0x439cf8['push'](_0x439cf8['shift']());}catch(_0x5f3594){_0x439cf8['push'](_0x439cf8['shift']());}}}(a41_0x467f,0xd164f));function a41_0x1ecc(_0x100ce4,_0x594054){_0x100ce4=_0x100ce4-0x124;const _0x467f6d=a41_0x467f();let _0x1eccf3=_0x467f6d[_0x100ce4];return _0x1eccf3;}import{listBffScripts}from'../../core/api-client.js';function a41_0x467f(){const _0x11792=['scriptType','bff','name','Script\x20type\x20filter','248YdovuZ','verbose','1958150ARLdTX','read','(unnamed)','appCode','164969sjSBIS','functionName','COMMON','4596075VKgGqS','string','str','Return\x20full\x20script\x20objects','84cQZNfV','368UGwpQS','type','bool','description','boolean','1368456izkKvu','No\x20Backend\x20Function\x20scripts\x20found.','List\x20Backend\x20Function\x20scripts','151740WuOfIs','map','ENDPOINT','length','list','45AMfrsE','1602458ehMJjP','3376ylEfLn'];a41_0x467f=function(){return _0x11792;};return a41_0x467f();}export const bffList={'service':a41_0xd52243(0x13a),'command':a41_0xd52243(0x135),'description':a41_0xd52243(0x130),'risk':a41_0xd52243(0x140),'flags':[{'name':a41_0xd52243(0x12a),'type':a41_0xd52243(0x125),'description':a41_0xd52243(0x13c),'default':a41_0xd52243(0x133),'enum':['ENDPOINT',a41_0xd52243(0x145)]},{'name':'name','type':a41_0xd52243(0x125),'description':'Filter\x20by\x20script\x20name'},{'name':a41_0xd52243(0x13e),'type':a41_0xd52243(0x12d),'description':a41_0xd52243(0x127)}],async 'execute'(_0x59a4d2){const _0x2417b0=a41_0xd52243,_0x4fa77c=await listBffScripts(_0x59a4d2[_0x2417b0(0x142)],_0x59a4d2[_0x2417b0(0x126)](_0x2417b0(0x12a)),{'scriptName':_0x59a4d2['str'](_0x2417b0(0x13b))||undefined}),_0xf0b3fc=_0x59a4d2[_0x2417b0(0x12b)]('verbose');return{'ok':!![],'data':_0xf0b3fc?_0x4fa77c:_0x4fa77c[_0x2417b0(0x132)](_0x473e24=>({'id':_0x473e24['id'],'functionName':_0x473e24[_0x2417b0(0x144)]??'','description':_0x473e24[_0x2417b0(0x12c)]||_0x2417b0(0x141),'scriptType':_0x473e24[_0x2417b0(0x139)]})),'message':_0x4fa77c[_0x2417b0(0x134)]===0x0?_0x2417b0(0x12f):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x4aa3aa=a42_0x381d;function a42_0x381d(_0x94e981,_0x1043bd){_0x94e981=_0x94e981-0x1e7;const _0x13a7b6=a42_0x13a7();let _0x381d78=_0x13a7b6[_0x94e981];return _0x381d78;}(function(_0x5dd287,_0x564669){const _0x3a67a7=a42_0x381d,_0x1b8b87=_0x5dd287();while(!![]){try{const _0x31c290=parseInt(_0x3a67a7(0x1ea))/0x1+parseInt(_0x3a67a7(0x20d))/0x2+parseInt(_0x3a67a7(0x1f3))/0x3*(-parseInt(_0x3a67a7(0x1fb))/0x4)+parseInt(_0x3a67a7(0x20f))/0x5+parseInt(_0x3a67a7(0x1f1))/0x6*(-parseInt(_0x3a67a7(0x1eb))/0x7)+-parseInt(_0x3a67a7(0x1ee))/0x8+parseInt(_0x3a67a7(0x206))/0x9*(parseInt(_0x3a67a7(0x200))/0xa);if(_0x31c290===_0x564669)break;else _0x1b8b87['push'](_0x1b8b87['shift']());}catch(_0x7ab3c8){_0x1b8b87['push'](_0x1b8b87['shift']());}}}(a42_0x13a7,0xa83a8));function a42_0x13a7(){const _0x4a6507=['5547cLryyY','length','end-time','bff','isSafeInteger','logs','limit','\x20must\x20be\x20a\x20positive\x20integer.','1668cNDMOc','ERROR','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','\x20Backend\x20Function\x20log\x20line(s).','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','12434830zOsOlM','since','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','Found\x20','level','str','9LXtEQi','WARN','DEBUG','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','Filter\x20by\x20log\x20level','--end-time','trim','466794rRhhnp','start-time','989905jnHLJy','appCode','validation','num','--limit\x20must\x20be\x20between\x201\x20and\x20','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','601949lewGWT','7aMFrSK','read','--start-time','1939832HrdzAT','number','flag','3445404TsOulB','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.'];a42_0x13a7=function(){return _0x4a6507;};return a42_0x13a7();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0x4aa3aa(0x208),'INFO',a42_0x4aa3aa(0x207),a42_0x4aa3aa(0x1fc)];export function resolveBffLogQuery(_0x501cf3,_0x46029c=Date['now']()){const _0x57cffb=a42_0x4aa3aa,_0x2571dc=_0x501cf3['flag'](_0x57cffb(0x201)),_0x3c73ae=_0x501cf3[_0x57cffb(0x1f0)](_0x57cffb(0x20e)),_0x3065ed=_0x501cf3[_0x57cffb(0x1f0)](_0x57cffb(0x1f5));if(_0x2571dc!==undefined&&_0x3c73ae!==undefined)throw CliErrors[_0x57cffb(0x211)](_0x57cffb(0x1ff));const _0x4e0f44=_0x3065ed===undefined?_0x46029c:readPositiveInteger(_0x501cf3[_0x57cffb(0x1e7)]('end-time'),_0x57cffb(0x20b)),_0x567493=_0x3c73ae===undefined?_0x4e0f44-readSinceMinutes(_0x501cf3)*0xea60:readPositiveInteger(_0x501cf3['num'](_0x57cffb(0x20e)),_0x57cffb(0x1ed));if(_0x567493<=0x0)throw CliErrors[_0x57cffb(0x211)]('The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.');if(_0x567493>_0x4e0f44)throw CliErrors['validation']('--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.');const _0x59af87=readPositiveInteger(_0x501cf3[_0x57cffb(0x1e7)]('limit',DEFAULT_LIMIT),'--limit');if(_0x59af87>MAX_LIMIT)throw CliErrors[_0x57cffb(0x211)](_0x57cffb(0x1e8)+MAX_LIMIT+'.');const _0x4ad747=_0x501cf3[_0x57cffb(0x205)](_0x57cffb(0x204))[_0x57cffb(0x20c)]()['toUpperCase']()||undefined,_0x284d43=_0x501cf3[_0x57cffb(0x205)]('keyword')[_0x57cffb(0x20c)]()||undefined;return{'appCode':_0x501cf3[_0x57cffb(0x210)],'startTime':_0x567493,'endTime':_0x4e0f44,..._0x3c73ae===undefined?{'sinceMinutes':readSinceMinutes(_0x501cf3)}:{},..._0x4ad747?{'level':_0x4ad747}:{},..._0x284d43?{'keyword':_0x284d43}:{},'limit':_0x59af87};}function readSinceMinutes(_0x4e9ec5){const _0x3f2416=a42_0x4aa3aa;return readPositiveInteger(_0x4e9ec5[_0x3f2416(0x1e7)]('since',DEFAULT_SINCE_MINUTES),'--since');}function readPositiveInteger(_0x53d962,_0x34cbdc){const _0x4aa61c=a42_0x4aa3aa;if(!Number[_0x4aa61c(0x1f7)](_0x53d962)||_0x53d962<=0x0)throw CliErrors[_0x4aa61c(0x211)](_0x34cbdc+_0x4aa61c(0x1fa));return _0x53d962;}export const bffLogs={'service':a42_0x4aa3aa(0x1f6),'command':a42_0x4aa3aa(0x1f8),'description':a42_0x4aa3aa(0x209),'risk':a42_0x4aa3aa(0x1ec),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x4aa3aa(0x201),'type':a42_0x4aa3aa(0x1ef),'description':a42_0x4aa3aa(0x1e9)+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x4aa3aa(0x20e),'type':a42_0x4aa3aa(0x1ef),'description':a42_0x4aa3aa(0x1fd)},{'name':a42_0x4aa3aa(0x1f5),'type':a42_0x4aa3aa(0x1ef),'description':a42_0x4aa3aa(0x202)},{'name':a42_0x4aa3aa(0x204),'type':'string','description':a42_0x4aa3aa(0x20a),'enum':LOG_LEVELS},{'name':'keyword','type':'string','description':'Filter\x20formatted\x20log\x20lines\x20by\x20keyword'},{'name':a42_0x4aa3aa(0x1f9),'type':'number','description':'Maximum\x20log\x20lines\x20to\x20return\x20(1-'+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x4de4dd){resolveBffLogQuery(_0x4de4dd);},async 'execute'(_0x5da0ba){const _0x50f08e=a42_0x4aa3aa,_0x5354a1=resolveBffLogQuery(_0x5da0ba),{sinceMinutes:_0x311d6a,..._0x2ba9d2}=_0x5354a1,_0x4c44e6=await searchBffScriptLogs(_0x2ba9d2);return{'ok':!![],'data':{'query':_0x5354a1,'count':_0x4c44e6['length'],'logs':_0x4c44e6},'message':_0x4c44e6[_0x50f08e(0x1f4)]===0x0?_0x50f08e(0x1f2):_0x50f08e(0x203)+_0x4c44e6[_0x50f08e(0x1f4)]+_0x50f08e(0x1fe)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x39c143=a43_0x220a;(function(_0x207299,_0xb183c3){const _0x5d71e3=a43_0x220a,_0x37d4f3=_0x207299();while(!![]){try{const _0x430f87=parseInt(_0x5d71e3(0x1ae))/0x1+parseInt(_0x5d71e3(0x138))/0x2+-parseInt(_0x5d71e3(0x18b))/0x3+parseInt(_0x5d71e3(0x196))/0x4+parseInt(_0x5d71e3(0x14f))/0x5+-parseInt(_0x5d71e3(0x12a))/0x6*(parseInt(_0x5d71e3(0x162))/0x7)+-parseInt(_0x5d71e3(0x121))/0x8;if(_0x430f87===_0xb183c3)break;else _0x37d4f3['push'](_0x37d4f3['shift']());}catch(_0x5a45f2){_0x37d4f3['push'](_0x37d4f3['shift']());}}}(a43_0x4124,0x952de));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x39c143(0x1a0),'command':a43_0x39c143(0x12b),'description':a43_0x39c143(0x123),'risk':a43_0x39c143(0x13b),'structuredErrors':!![],'flags':[{'name':a43_0x39c143(0x15c),'type':'string','description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x39c143(0x18d),a43_0x39c143(0x18f),a43_0x39c143(0x14e)]},{'name':a43_0x39c143(0x16c),'type':'boolean','description':a43_0x39c143(0x197)}],async 'dryRun'(_0x18a95c){const _0x487645=a43_0x39c143,_0x317e00=loadBffProjectConfig(_0x18a95c[_0x487645(0x173)]),_0x4588f4=await readBffLockFile(_0x317e00['lockFilePath']),{appLock:_0x584ec1}=ensureLockScope(_0x4588f4??createEmptyBffLock(),_0x18a95c[_0x487645(0x173)],_0x317e00[_0x487645(0x181)],_0x487645(0x12b)),_0x1d6ff2=normalizeBffType(_0x18a95c['str'](_0x487645(0x15c)))??undefined,[_0x3cc2d8,_0x19eb32]=await Promise[_0x487645(0x187)]([listBffScripts(_0x18a95c[_0x487645(0x173)],_0x1d6ff2),getBffScriptStatistics(_0x18a95c[_0x487645(0x173)])]),_0x3c0c09=_0x3cc2d8['some'](_0x12ee4c=>normalizeBffType(_0x12ee4c['scriptType'])===_0x487645(0x14e)),_0x59126d=_0x3c0c09?buildDatasetCodeToAliasMap(_0x18a95c[_0x487645(0x167)],_0x18a95c[_0x487645(0x173)],_0x18a95c['selectedAppName']||_0x18a95c[_0x487645(0x1ac)]?.[_0x487645(0x13a)]||_0x18a95c['mergedCli']?.[_0x487645(0x11c)]):new Map(),_0xac021=_0x3c0c09?await planHookDirectoryMigration(_0x317e00,_0x584ec1,_0x59126d,await scanLocalBffFunctions(_0x317e00,_0x487645(0x14e))):undefined,_0xd0a002=createHookLocationMap(_0x19eb32),_0x1cfac5=[];for(const _0x4d9001 of _0x3cc2d8){const _0x269634=resolveRemoteScriptTarget(_0x317e00,_0x4d9001,_0xd0a002,_0xac021?.[_0x487645(0x133)]??_0x584ec1[_0x487645(0x17c)],_0x59126d);if(!_0x269634){_0x1cfac5['push']({'scriptType':_0x4d9001[_0x487645(0x120)],'functionName':_0x4d9001['functionName']??'','status':_0x487645(0x189),'reason':_0x487645(0x160)});continue;}const _0xc50c87=(_0xac021?.['projectedFunctions']??_0x584ec1[_0x487645(0x17c)])[_0x269634[_0x487645(0x180)]],_0x4f0ee3=_0x4d9001[_0x487645(0x182)]!=null?computeContentHash(_0x4d9001['scriptContent']):undefined,_0x36ad51=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0xac021,_0x269634)??_0x269634[_0x487645(0x19b)],_0xc50c87,_0x4f0ee3),_0x410eb4=_0x36ad51?localUnsyncedConflict(_0x269634,_0x4d9001['id']):undefined;_0x1cfac5[_0x487645(0x198)]({'lockKey':_0x269634[_0x487645(0x180)],'filePath':_0x269634[_0x487645(0x19b)],'remoteId':_0x4d9001['id']??null,'status':_0x410eb4?_0x487645(0x136):_0x487645(0x175),..._0x410eb4?{'conflict':_0x410eb4}:{},..._0x269634[_0x487645(0x150)]?{'alias':_0x269634[_0x487645(0x150)][_0x487645(0x143)]??null,'datasetCode':_0x269634[_0x487645(0x150)]['datasetCode'],'operationType':_0x269634[_0x487645(0x150)][_0x487645(0x16b)],'functionNode':_0x269634[_0x487645(0x150)][_0x487645(0x1a4)]}:{}});}return{'method':_0x487645(0x147),'url':_0x487645(0x151)+_0x18a95c[_0x487645(0x173)]+(_0x1d6ff2?_0x487645(0x1a9)+_0x1d6ff2:'')+_0x487645(0x134)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x18a95c[_0x487645(0x173)],'filterType':_0x1d6ff2??null,..._0xac021&&_0xac021[_0x487645(0x15d)][_0x487645(0x163)]>0x0?{'hookDirectoryMigrations':_0xac021['migrations'][_0x487645(0x1a3)](_0x42972b=>({'from':_0x42972b[_0x487645(0x174)],'to':_0x42972b[_0x487645(0x11a)]}))}:{},'files':_0x1cfac5},'description':_0x487645(0x170)+_0x1cfac5[_0x487645(0x163)]+_0x487645(0x172)};},async 'execute'(_0x287969){const _0x916454=a43_0x39c143,_0x281974=loadBffProjectConfig(_0x287969['appCode']),_0x2e781b=await readBffLockFile(_0x281974['lockFilePath']),{lockData:_0x1101d3,appLock:_0x11605f}=ensureLockScope(_0x2e781b??createEmptyBffLock(),_0x287969[_0x916454(0x173)],_0x281974['scriptsRoot'],_0x916454(0x12b)),_0x17a5f5=normalizeBffType(_0x287969[_0x916454(0x185)](_0x916454(0x15c)))??undefined;if(_0x287969['str'](_0x916454(0x15c))&&!_0x17a5f5)throw CliErrors[_0x916454(0x186)]('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x47aff5,_0x232777]=await Promise['all']([listBffScripts(_0x287969[_0x916454(0x173)],_0x17a5f5),getBffScriptStatistics(_0x287969[_0x916454(0x173)])]);if(_0x47aff5[_0x916454(0x163)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x916454(0x15a)};const _0x37fe58=_0x287969[_0x916454(0x1aa)](_0x916454(0x16c));if(_0x37fe58&&!_0x287969['nonInteractive']){const _0x550e27=await confirmForce();if(!_0x550e27)throw CliErrors[_0x916454(0x11f)](_0x916454(0x178));}if(_0x37fe58&&_0x287969['nonInteractive']){}const _0x42f0b6=_0x47aff5['some'](_0x2e1d28=>normalizeBffType(_0x2e1d28[_0x916454(0x120)])===_0x916454(0x14e)),_0x508555=_0x42f0b6?buildDatasetCodeToAliasMap(_0x287969['apiDir'],_0x287969[_0x916454(0x173)],_0x287969[_0x916454(0x18c)]||_0x287969[_0x916454(0x1ac)]?.['currentApp']||_0x287969[_0x916454(0x1ac)]?.[_0x916454(0x11c)]):new Map(),_0x1b0257=createHookLocationMap(_0x232777),_0xb32364=JSON[_0x916454(0x135)](JSON[_0x916454(0x12d)](_0x1101d3)),_0x5697dc=_0x287969[_0x916454(0x173)],_0x5b6b82=_0xb32364['apps'][_0x5697dc];if(!_0x5b6b82)throw new Error(_0x916454(0x1a1)+_0x5697dc+_0x916454(0x146));const _0x49c412=_0x42f0b6?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x281974,_0x5b6b82,_0x508555,await scanLocalBffFunctions(_0x281974,_0x916454(0x14e))),_0x5b6b82):undefined,_0x3600e8=createPullFileTransaction(),_0x2584c7=[],_0x7f6b5b=[],_0x580e0a=[],_0x52fe3c=[];for(const _0x1c224e of _0x47aff5){const _0x1542c0=resolveRemoteScriptTarget(_0x281974,_0x1c224e,_0x1b0257,_0x5b6b82[_0x916454(0x17c)],_0x508555);if(!_0x1542c0){_0x7f6b5b['push']({'lockKey':_0x1c224e[_0x916454(0x120)]+'/'+_0x1c224e[_0x916454(0x158)],'reason':_0x916454(0x160)});continue;}const _0x1f3893=_0x5b6b82['functions'][_0x1542c0[_0x916454(0x180)]];try{if(!_0x1c224e['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x1c224e['scriptContent']==null)throw new Error(_0x916454(0x14a));const _0x4e9113=_0x1c224e[_0x916454(0x182)],_0xdb989f=computeContentHash(_0x4e9113);if(!_0x37fe58){const _0x1dccf2=await hasUnsyncedLocalChanges(_0x1542c0['filePath'],_0x1f3893,_0xdb989f);if(_0x1dccf2){_0x580e0a[_0x916454(0x198)](localUnsyncedConflict(_0x1542c0,_0x1c224e['id']));continue;}}await _0x3600e8[_0x916454(0x12c)](_0x1542c0[_0x916454(0x19b)],_0x4e9113);const _0x4d5fd2={'hash':_0xdb989f,'remoteId':_0x1c224e['id'],'version':_0x1c224e[_0x916454(0x16e)]};_0x1542c0[_0x916454(0x15c)]==='HOOK'&&_0x1542c0['hookLocation']&&(_0x4d5fd2[_0x916454(0x143)]=_0x1542c0[_0x916454(0x150)]['alias'],_0x4d5fd2[_0x916454(0x1ad)]=_0x1542c0[_0x916454(0x150)][_0x916454(0x1ad)],_0x4d5fd2[_0x916454(0x16b)]=_0x1542c0[_0x916454(0x150)]['operationType'],_0x4d5fd2[_0x916454(0x1a4)]=_0x1542c0['hookLocation'][_0x916454(0x1a4)]),_0x5b6b82[_0x916454(0x17c)][_0x1542c0['lockKey']]=_0x4d5fd2,_0x2584c7[_0x916454(0x198)]({'lockKey':_0x1542c0[_0x916454(0x180)],'remoteId':_0x1c224e['id']});}catch(_0x241958){_0x52fe3c[_0x916454(0x198)]({'lockKey':_0x1542c0['lockKey'],'error':_0x241958 instanceof Error?_0x241958[_0x916454(0x125)]:String(_0x241958)});}}_0x5b6b82[_0x916454(0x1a6)]=new Date()[_0x916454(0x128)]();try{await writeBffLockFile(_0x281974[_0x916454(0x177)],_0xb32364);}catch(_0x30e4ba){const _0xc5b081=[...await _0x3600e8[_0x916454(0x17b)](),...await _0x49c412?.[_0x916454(0x17b)]()??[]];throw withRollbackErrors(_0x30e4ba,_0x916454(0x190),_0xc5b081);}return{'ok':_0x52fe3c[_0x916454(0x163)]===0x0,'data':{'pulled':_0x2584c7,'skipped':_0x7f6b5b,'conflicts':_0x580e0a,'failed':_0x52fe3c},'message':formatPullMessage(_0x2584c7[_0x916454(0x163)],_0x7f6b5b[_0x916454(0x163)],_0x580e0a['length'],_0x52fe3c[_0x916454(0x163)])};}};function localUnsyncedConflict(_0x24d22f,_0x11a7b5){const _0x1a461a=a43_0x39c143,_0x1975b7=_0x24d22f[_0x1a461a(0x180)]['split']('/')['at'](-0x1);return{'code':_0x1a461a(0x11e),'lockKey':_0x24d22f[_0x1a461a(0x180)],'filePath':_0x24d22f['filePath'],..._0x11a7b5!=null?{'remoteId':_0x11a7b5}:{},'message':_0x1a461a(0x188),'nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x1a461a(0x19a)+_0x24d22f['type']+_0x1a461a(0x157)+_0x1975b7+_0x1a461a(0x164),'requiresReview':!![],'message':_0x1a461a(0x127)}};}function formatPullMessage(_0xc44cd5,_0x1e5aef,_0x3fe688,_0x3319a7){const _0x408b87=a43_0x39c143,_0x372cb9=[_0x408b87(0x126)+_0xc44cd5+_0x408b87(0x15b),_0x1e5aef+_0x408b87(0x169)];_0x3fe688>0x0&&_0x372cb9[_0x408b87(0x198)](_0x3fe688+_0x408b87(0x155)+(_0x3fe688===0x1?'':'s')+'\x20'+(_0x3fe688===0x1?'requires':'require')+_0x408b87(0x19e));if(_0x3319a7>0x0)_0x372cb9[_0x408b87(0x198)](_0x3319a7+'\x20failed');return _0x372cb9['join'](',\x20');}function a43_0x220a(_0x953e5d,_0x103554){_0x953e5d=_0x953e5d-0x11a;const _0x412484=a43_0x4124();let _0x220a5e=_0x412484[_0x953e5d];return _0x220a5e;}async function hasUnsyncedLocalChanges(_0x4be9f4,_0x2edeca,_0x5920f8){const _0x221437=a43_0x39c143;if(!await fileExists(_0x4be9f4))return![];const _0x4663a7=await computeFileHash(_0x4be9f4);if(!_0x2edeca)return _0x5920f8?_0x4663a7!==_0x5920f8:!![];return _0x4663a7!==_0x2edeca[_0x221437(0x124)];}function a43_0x4124(){const _0x5a4f97=['flatMap','\x20skipped','rekey','operationType','force','reverse','version','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','Would\x20inspect\x20','question','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','appCode','oldDirectory','would_pull','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','lockFilePath','Force\x20pull\x20cancelled.','toLowerCase','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','rollback','functions','oldLockKey','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','split','lockKey','scriptsRoot','scriptContent','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','has','str','validation','all','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','skipped','oldDirectoryPath','2281851hsDYww','selectedAppName','COMMON','\x22\x20and\x20\x22','ENDPOINT','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','remoteId','\x22\x20to\x20\x22','\x22\x20from\x20\x22','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','move','1927016sIqoZE','Force\x20overwrite\x20local\x20unsynced\x20changes','push','.js','\x20bff\x20push\x20--type\x20','filePath','stderr','sourceFilePathByNewLockKey','\x20resolution','utf8','bff','Lock\x20scope\x20for\x20app\x20\x22','profileName','map','functionNode','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','lastSync','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','newDirectoryPath','&type=','bool','trim','mergedCli','datasetCode','785925FEvNBC','entry','newDirectory','\x22;\x20temporary\x20directory\x20\x22','defaultApp','\x22:\x20its\x20target\x20\x22','BFF_LOCAL_UNSYNCED','cancelled','scriptType','1664760jXRgsv','dev','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','hash','message','Pull\x20complete:\x20','If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.','toISOString','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','24IUpRwG','pull','write','stringify','code','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','\x22\x20may\x20remain.','Could\x20not\x20restore\x20local\x20script\x20\x22','projectedFunctions','¤tPage=1&pageSize=','parse','conflict','existed','1951432qEvBfO','mode','currentApp','read','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','case-rename','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','\x20Recovery\x20errors:\x20','\x22:\x20both\x20target\x20\x22','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','stdin','alias','newLockKey','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','GET','\x22\x20from\x20the\x20lock\x20file.','keyChanges','Remote\x20script\x20missing\x20content.','delete','scriptsRootDir','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','HOOK','87395Nxhinc','hookLocation','/api/management/library/scripts/list?appCode=','ino','filter','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x20conflict','HOOK/','\x20--name\x20','functionName','set','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x20pulled','type','migrations','get','Failed\x20to\x20write\x20local\x20script\x20\x22','unresolvable\x20target\x20path','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','1191967DkTUXV','length','\x20--format\x20compress','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','apiDir'];a43_0x4124=function(){return _0x5a4f97;};return a43_0x4124();}function createPullFileTransaction(){const _0x365fd9=new Map(),_0x74f87b=async(_0x251adf,_0x4d7662)=>{const _0x4922b6=a43_0x220a;try{if(_0x4d7662[_0x4922b6(0x137)])await ensureParentDirectory(_0x251adf),await writeFile(_0x251adf,_0x4d7662['content']);else try{await unlink(_0x251adf);}catch(_0x2a64d4){if(_0x2a64d4[_0x4922b6(0x12e)]!=='ENOENT')throw _0x2a64d4;}return undefined;}catch(_0x45c448){return _0x45c448 instanceof Error?_0x45c448:new Error(String(_0x45c448));}};return{async 'write'(_0x463ae1,_0x384d7d){const _0xaa5408=a43_0x220a;if(!_0x365fd9['has'](_0x463ae1))try{_0x365fd9[_0xaa5408(0x159)](_0x463ae1,{'existed':!![],'content':await readFile(_0x463ae1)});}catch(_0x4bd33c){if(_0x4bd33c[_0xaa5408(0x12e)]!=='ENOENT')throw _0x4bd33c;_0x365fd9[_0xaa5408(0x159)](_0x463ae1,{'existed':![]});}try{await ensureParentDirectory(_0x463ae1),await writeFile(_0x463ae1,_0x384d7d,_0xaa5408(0x19f));}catch(_0x2b74de){const _0x2d1b4c=await _0x74f87b(_0x463ae1,_0x365fd9[_0xaa5408(0x15e)](_0x463ae1));if(!_0x2d1b4c)_0x365fd9[_0xaa5408(0x14b)](_0x463ae1);throw withRollbackErrors(_0x2b74de,_0xaa5408(0x15f)+_0x463ae1+'\x22.',_0x2d1b4c?[_0x2d1b4c]:[]);}},async 'rollback'(){const _0x2e1946=a43_0x220a,_0xae06e2=[];for(const [_0x364408,_0x586c87]of[..._0x365fd9['entries']()][_0x2e1946(0x16d)]()){const _0x3938f2=await _0x74f87b(_0x364408,_0x586c87);_0x3938f2&&_0xae06e2[_0x2e1946(0x198)](new Error(_0x2e1946(0x132)+_0x364408+'\x22:\x20'+_0x3938f2[_0x2e1946(0x125)]));}return _0xae06e2;}};}function withRollbackErrors(_0x578021,_0x1a20ca,_0x4c8659){const _0x5ebf3a=a43_0x39c143,_0x57d91a=_0x578021 instanceof Error?_0x578021:new Error(String(_0x578021));if(_0x4c8659[_0x5ebf3a(0x163)]===0x0)return _0x57d91a;return new AggregateError([_0x57d91a,..._0x4c8659],_0x1a20ca+_0x5ebf3a(0x13f)+_0x4c8659[_0x5ebf3a(0x1a3)](_0x548077=>_0x548077[_0x5ebf3a(0x125)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x31e8b3,_0xb0c9fb,_0x62cf26){const _0x520ae8=a43_0x39c143,_0x1a3713=resolveApiModelSource(_0x31e8b3,_0xb0c9fb,_0x62cf26),_0xa399e3=loadAliasMap(_0x31e8b3,undefined,_0x1a3713['filePath'],_0x1a3713[_0x520ae8(0x1a2)]);return assertUnambiguousHookAliases(_0xa399e3),new Map(_0xa399e3[_0x520ae8(0x1a3)](_0x5e2b1d=>[_0x5e2b1d['datasetCode']['toLowerCase'](),_0x5e2b1d[_0x520ae8(0x143)]]));}async function planHookDirectoryMigration(_0x5a0503,_0x1a5360,_0x4f950d,_0x514f1c){const _0x5613c3=a43_0x39c143,_0x554b2b=new Map();for(const [_0x1849db,_0x19e1a5]of Object['entries'](_0x1a5360[_0x5613c3(0x17c)])){const [_0x6df3d5,_0x5df896,_0x30fa77,_0x3e35f6,_0x1c5013,..._0x15faf6]=_0x1849db[_0x5613c3(0x17f)]('/');if(_0x6df3d5!==_0x5613c3(0x14e)||!_0x5df896||!_0x30fa77||!_0x3e35f6||!_0x1c5013||_0x15faf6['length']>0x0||!_0x19e1a5[_0x5613c3(0x1ad)])continue;const _0x4ce180=_0x4f950d['get'](_0x19e1a5[_0x5613c3(0x1ad)]['toLowerCase']()),_0x2fea53=_0x4ce180??_0x19e1a5[_0x5613c3(0x1ad)];if(!isSafeHookDirectorySegment(_0x5df896))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x17e)+_0x5df896+_0x5613c3(0x148));if(!isSafeHookDirectorySegment(_0x2fea53))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x5df896+_0x5613c3(0x12f));if(_0x5df896===_0x2fea53)continue;const _0x10cf9b=_0x554b2b[_0x5613c3(0x15e)](_0x5df896)??{'datasetCode':_0x19e1a5[_0x5613c3(0x1ad)],'alias':_0x4ce180,'keyChanges':[]};if(_0x10cf9b['datasetCode']!==_0x19e1a5[_0x5613c3(0x1ad)])throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x5df896+_0x5613c3(0x16f));const _0x17b19c=_0x5613c3(0x156)+_0x2fea53+'/'+_0x30fa77+'/'+_0x3e35f6+'/'+_0x1c5013;try{resolveLocalFilePathFromLockKey(_0x5a0503,_0x1849db),resolveLocalFilePathFromLockKey(_0x5a0503,_0x17b19c);}catch(_0xbe3797){throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x1a5)+_0x1849db+'\x22:\x20'+(_0xbe3797 instanceof Error?_0xbe3797[_0x5613c3(0x125)]:String(_0xbe3797)));}_0x10cf9b['keyChanges'][_0x5613c3(0x198)]({'oldLockKey':_0x1849db,'newLockKey':_0x17b19c,'entry':_0x19e1a5}),_0x554b2b[_0x5613c3(0x159)](_0x5df896,_0x10cf9b);}const _0x46b74d=new Set([..._0x554b2b['values']()][_0x5613c3(0x168)](_0x24919c=>_0x24919c['keyChanges'][_0x5613c3(0x1a3)](_0x23cd6e=>_0x23cd6e['oldLockKey']))),_0x2a2322=new Map(),_0x28da3=new Map();for(const [_0x7ccf08,_0x183b26]of _0x554b2b){const _0x24882f=_0x183b26[_0x5613c3(0x143)]??_0x183b26['datasetCode'],_0x348ef4=hookDirectoryIdentity(_0x24882f),_0x92bb3f=_0x2a2322['get'](_0x348ef4);if(_0x92bb3f&&_0x92bb3f!==_0x7ccf08)throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x176)+_0x92bb3f+_0x5613c3(0x18e)+_0x7ccf08+_0x5613c3(0x140)+_0x24882f+_0x5613c3(0x17a));_0x2a2322['set'](_0x348ef4,_0x7ccf08);for(const _0x5b95c3 of _0x183b26['keyChanges']){const _0x9a8a89=_0x28da3[_0x5613c3(0x15e)](_0x5b95c3[_0x5613c3(0x144)]);if(_0x9a8a89&&_0x9a8a89!==_0x5b95c3[_0x5613c3(0x17d)])throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x130)+_0x9a8a89+_0x5613c3(0x18e)+_0x5b95c3[_0x5613c3(0x17d)]+'\x22:\x20both\x20target\x20\x22'+_0x5b95c3[_0x5613c3(0x144)]+_0x5613c3(0x141));if(_0x46b74d[_0x5613c3(0x184)](_0x5b95c3[_0x5613c3(0x144)]))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x14d)+_0x5b95c3[_0x5613c3(0x17d)]+_0x5613c3(0x11d)+_0x5b95c3[_0x5613c3(0x144)]+_0x5613c3(0x161));_0x28da3[_0x5613c3(0x159)](_0x5b95c3[_0x5613c3(0x144)],_0x5b95c3[_0x5613c3(0x17d)]);}}const _0x4f8ca8=new Map();for(const [_0x56e44b,_0x2a4926]of _0x4f950d){_0x4f8ca8[_0x5613c3(0x159)](hookDirectoryIdentity(_0x2a4926),_0x56e44b);}const _0x38b7dc=[];for(const [_0x4eff6b,_0x4f7a55]of _0x554b2b){const _0x1dc2d2=_0x4f7a55['alias']??_0x4f7a55['datasetCode'],_0x7bbe59=join(_0x5a0503['scriptsRootDir'],_0x5613c3(0x14e),_0x4eff6b),_0x56da17=join(_0x5a0503[_0x5613c3(0x14c)],_0x5613c3(0x14e),_0x1dc2d2),_0x4c61d=await directoryExists(_0x7bbe59),_0x4aff2a=await directoryExists(_0x56da17),_0x343097=_0x4c61d?_0x4aff2a?await sameDirectory(_0x7bbe59,_0x56da17)?_0x5613c3(0x13d):undefined:'move':_0x5613c3(0x16a);if(!_0x343097)throw CliErrors['validation'](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x192)+_0x1dc2d2+_0x5613c3(0x13e));const _0x5c6b22=_0x4f8ca8[_0x5613c3(0x15e)](hookDirectoryIdentity(_0x4eff6b));if(_0x5c6b22&&_0x5c6b22!==_0x4f7a55[_0x5613c3(0x1ad)][_0x5613c3(0x179)]()){const _0x313e27=new Set(_0x4f7a55[_0x5613c3(0x149)][_0x5613c3(0x1a3)](_0x2a7540=>_0x2a7540[_0x5613c3(0x17d)])),_0xcf4dc6=_0x514f1c[_0x5613c3(0x153)](_0x14c373=>_0x14c373['type']==='HOOK'&&_0x14c373[_0x5613c3(0x143)]!=null&&hookDirectoryIdentity(_0x14c373[_0x5613c3(0x143)])===hookDirectoryIdentity(_0x4eff6b)&&!_0x313e27[_0x5613c3(0x184)](_0x14c373[_0x5613c3(0x180)]));if(_0xcf4dc6[_0x5613c3(0x163)]>0x0)throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x183));}const _0x3fb02d=_0x4f8ca8['get'](hookDirectoryIdentity(_0x1dc2d2));if(_0x3fb02d&&_0x3fb02d!==_0x4f7a55[_0x5613c3(0x1ad)][_0x5613c3(0x179)]())throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x192)+_0x1dc2d2+_0x5613c3(0x129));for(const _0x50b89a of _0x4f7a55[_0x5613c3(0x149)]){const _0x4f40fb=_0x1a5360[_0x5613c3(0x17c)][_0x50b89a[_0x5613c3(0x144)]];if(_0x4f40fb&&!_0x46b74d['has'](_0x50b89a[_0x5613c3(0x144)])&&!sameHookIdentity(_0x50b89a[_0x5613c3(0x1af)],_0x4f40fb))throw CliErrors[_0x5613c3(0x186)](_0x5613c3(0x166)+_0x4eff6b+_0x5613c3(0x192)+_0x1dc2d2+_0x5613c3(0x154));}_0x38b7dc[_0x5613c3(0x198)]({'oldDirectory':_0x4eff6b,'newDirectory':_0x1dc2d2,'oldDirectoryPath':_0x7bbe59,'newDirectoryPath':_0x56da17,'mode':_0x343097,'alias':_0x4f7a55[_0x5613c3(0x143)],'keyChanges':_0x4f7a55[_0x5613c3(0x149)]});}const _0x3d2c8b={..._0x1a5360['functions']},_0x15a2e5=new Map(),_0xf5438c=new Map();for(const _0x100727 of _0x38b7dc){const _0x594280=_0x100727['mode']!=='rekey';_0x594280&&_0xf5438c[_0x5613c3(0x159)](hookDirectoryIdentity(_0x100727[_0x5613c3(0x11a)]),_0x100727[_0x5613c3(0x18a)]);for(const _0x551105 of _0x100727[_0x5613c3(0x149)]){const _0x1d5800=_0x3d2c8b[_0x551105[_0x5613c3(0x144)]],_0x3e7bf2=_0x594280?_0x551105[_0x5613c3(0x1af)]:_0x1d5800??_0x551105['entry'];_0x3d2c8b[_0x551105[_0x5613c3(0x144)]]=canonicalizeHookEntry(_0x3e7bf2,_0x100727[_0x5613c3(0x143)]),delete _0x3d2c8b[_0x551105[_0x5613c3(0x17d)]],_0x594280&&_0x15a2e5[_0x5613c3(0x159)](_0x551105[_0x5613c3(0x144)],resolveLocalFilePathFromLockKey(_0x5a0503,_0x551105['oldLockKey']));}}return{'migrations':_0x38b7dc,'projectedFunctions':_0x3d2c8b,'sourceFilePathByNewLockKey':_0x15a2e5,'sourceDirectoryPathByNewDirectory':_0xf5438c};}function resolveMigratedSourceFilePath(_0x47c175,_0x4a7f4f){const _0x283d23=a43_0x39c143;if(!_0x47c175||!_0x4a7f4f)return undefined;const _0x3e4f9a=_0x47c175[_0x283d23(0x19d)][_0x283d23(0x15e)](_0x4a7f4f[_0x283d23(0x180)]);if(_0x3e4f9a)return _0x3e4f9a;if(_0x4a7f4f['type']!==_0x283d23(0x14e))return undefined;const [,_0xef5c6c,..._0x40db01]=_0x4a7f4f[_0x283d23(0x180)]['split']('/');if(!_0xef5c6c||_0x40db01[_0x283d23(0x163)]===0x0)return undefined;const _0x1c8e54=_0x47c175['sourceDirectoryPathByNewDirectory'][_0x283d23(0x15e)](hookDirectoryIdentity(_0xef5c6c));return _0x1c8e54?join(_0x1c8e54,..._0x40db01)+_0x283d23(0x199):undefined;}function sameHookIdentity(_0xb81684,_0x4f0d3d){const _0xf2d236=a43_0x39c143;return _0xb81684[_0xf2d236(0x191)]===_0x4f0d3d[_0xf2d236(0x191)]&&_0xb81684['datasetCode']===_0x4f0d3d[_0xf2d236(0x1ad)]&&_0xb81684[_0xf2d236(0x16b)]===_0x4f0d3d[_0xf2d236(0x16b)]&&_0xb81684[_0xf2d236(0x1a4)]===_0x4f0d3d['functionNode'];}function canonicalizeHookEntry(_0x509fbf,_0x14c2c7){const {alias:_0x12d37f,..._0x4c77ff}=_0x509fbf;return _0x14c2c7?{..._0x4c77ff,'alias':_0x14c2c7}:_0x4c77ff;}function hookDirectoryIdentity(_0x458255){const _0x75b125=a43_0x39c143;return _0x458255['normalize']('NFC')[_0x75b125(0x179)]();}function isSafeHookDirectorySegment(_0x1b9dcf){return isSafeLockKeySegment(_0x1b9dcf);}async function sameDirectory(_0x4ba62a,_0x1f4d13){const _0x292111=a43_0x39c143,[_0x1f5d45,_0x988180]=await Promise[_0x292111(0x187)]([stat(_0x4ba62a),stat(_0x1f4d13)]);return _0x1f5d45[_0x292111(0x122)]===_0x988180[_0x292111(0x122)]&&_0x1f5d45[_0x292111(0x152)]===_0x988180[_0x292111(0x152)];}async function applyHookDirectoryMigration(_0x1b7a03,_0x5e02ce){const _0x4392ea=a43_0x39c143,_0x58e5a2=_0x5e02ce[_0x4392ea(0x17c)],_0x1bf617=_0x5e02ce[_0x4392ea(0x1a6)],_0x20d68a=[],_0x3c4d23=async()=>{const _0x5063d5=_0x4392ea,_0xf83419=[];_0x5e02ce['functions']=_0x58e5a2,_0x5e02ce[_0x5063d5(0x1a6)]=_0x1bf617;for(const {migration:_0x50e179,temporaryPath:_0x57153f}of[..._0x20d68a]['reverse']()){try{_0x57153f?(await rename(_0x50e179['newDirectoryPath'],_0x57153f),await rename(_0x57153f,_0x50e179['oldDirectoryPath'])):await rename(_0x50e179[_0x5063d5(0x1a8)],_0x50e179[_0x5063d5(0x18a)]);}catch(_0x55244f){_0xf83419[_0x5063d5(0x198)](new Error(_0x5063d5(0x1a7)+_0x50e179[_0x5063d5(0x174)]+_0x5063d5(0x193)+_0x50e179[_0x5063d5(0x11a)]+'\x22:\x20'+(_0x55244f instanceof Error?_0x55244f['message']:String(_0x55244f))));}}return _0xf83419;};try{for(const _0x5a439f of _0x1b7a03[_0x4392ea(0x15d)]){if(_0x5a439f[_0x4392ea(0x139)]===_0x4392ea(0x195))await ensureParentDirectory(_0x5a439f[_0x4392ea(0x1a8)]),await rename(_0x5a439f[_0x4392ea(0x18a)],_0x5a439f['newDirectoryPath']),_0x20d68a[_0x4392ea(0x198)]({'migration':_0x5a439f});else{if(_0x5a439f[_0x4392ea(0x139)]===_0x4392ea(0x13d)){const _0x2aca31=join(dirname(_0x5a439f['oldDirectoryPath']),'.hook-directory-migrate-'+randomUUID());await rename(_0x5a439f['oldDirectoryPath'],_0x2aca31);try{await rename(_0x2aca31,_0x5a439f['newDirectoryPath']);}catch(_0x64e464){try{await rename(_0x2aca31,_0x5a439f[_0x4392ea(0x18a)]);}catch(_0x49cee5){throw withRollbackErrors(_0x64e464,_0x4392ea(0x145)+_0x5a439f['oldDirectory']+_0x4392ea(0x192)+_0x5a439f['newDirectory']+_0x4392ea(0x11b)+_0x2aca31+_0x4392ea(0x131),[new Error(_0x4392ea(0x13c)+_0x2aca31+_0x4392ea(0x192)+_0x5a439f[_0x4392ea(0x174)]+'\x22:\x20'+(_0x49cee5 instanceof Error?_0x49cee5[_0x4392ea(0x125)]:String(_0x49cee5)))]);}throw _0x64e464;}_0x20d68a[_0x4392ea(0x198)]({'migration':_0x5a439f,'temporaryPath':_0x2aca31});}}}return _0x5e02ce[_0x4392ea(0x17c)]=_0x1b7a03[_0x4392ea(0x133)],{'rollback':_0x3c4d23};}catch(_0xd503af){const _0x37984b=await _0x3c4d23();throw withRollbackErrors(_0xd503af,_0x4392ea(0x165),_0x37984b);}}async function confirmForce(){const _0x2e80fa=a43_0x39c143,_0xd9044c=createInterface({'input':process[_0x2e80fa(0x142)],'output':process[_0x2e80fa(0x19c)]}),_0x271e08=await new Promise(_0x13fcf6=>{const _0x7e8c09=_0x2e80fa;_0xd9044c[_0x7e8c09(0x171)](_0x7e8c09(0x194),_0x13fcf6);});return _0xd9044c['close'](),['y','yes']['includes'](_0x271e08[_0x2e80fa(0x1ab)]()['toLowerCase']());}
|
|
1
|
+
const a43_0xf3a316=a43_0x290c;(function(_0x5f11de,_0x2c5714){const _0x43ea17=a43_0x290c,_0x15ec3f=_0x5f11de();while(!![]){try{const _0xdf6a2d=parseInt(_0x43ea17(0x238))/0x1+parseInt(_0x43ea17(0x1d2))/0x2+-parseInt(_0x43ea17(0x1fb))/0x3*(parseInt(_0x43ea17(0x1e3))/0x4)+parseInt(_0x43ea17(0x23f))/0x5*(-parseInt(_0x43ea17(0x1c2))/0x6)+-parseInt(_0x43ea17(0x21c))/0x7+-parseInt(_0x43ea17(0x228))/0x8*(parseInt(_0x43ea17(0x216))/0x9)+parseInt(_0x43ea17(0x21e))/0xa*(parseInt(_0x43ea17(0x246))/0xb);if(_0xdf6a2d===_0x2c5714)break;else _0x15ec3f['push'](_0x15ec3f['shift']());}catch(_0x1796d7){_0x15ec3f['push'](_0x15ec3f['shift']());}}}(a43_0x5aba,0xc2339));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0xf3a316(0x212),'command':a43_0xf3a316(0x1dc),'description':a43_0xf3a316(0x206),'risk':a43_0xf3a316(0x1e4),'structuredErrors':!![],'flags':[{'name':a43_0xf3a316(0x201),'type':a43_0xf3a316(0x220),'description':'Pull\x20only\x20this\x20script\x20type','enum':['COMMON',a43_0xf3a316(0x249),a43_0xf3a316(0x1d6)]},{'name':a43_0xf3a316(0x242),'type':'boolean','description':a43_0xf3a316(0x240)}],async 'dryRun'(_0xb95f95){const _0x31ad2a=a43_0xf3a316,_0x27521d=loadBffProjectConfig(_0xb95f95['appCode']),_0x217d34=await readBffLockFile(_0x27521d[_0x31ad2a(0x1f4)]),{appLock:_0x45cba8}=ensureLockScope(_0x217d34??createEmptyBffLock(),_0xb95f95[_0x31ad2a(0x1d7)],_0x27521d[_0x31ad2a(0x235)],_0x31ad2a(0x1dc)),_0x5e7bfd=normalizeBffType(_0xb95f95[_0x31ad2a(0x1d4)](_0x31ad2a(0x201)))??undefined,[_0x1fa293,_0x174d5c]=await Promise[_0x31ad2a(0x21f)]([listBffScripts(_0xb95f95[_0x31ad2a(0x1d7)],_0x5e7bfd),getBffScriptStatistics(_0xb95f95[_0x31ad2a(0x1d7)])]),_0x5de0ea=_0x1fa293['some'](_0xe85b32=>normalizeBffType(_0xe85b32[_0x31ad2a(0x1c8)])===_0x31ad2a(0x1d6)),_0x14c441=_0x5de0ea?buildDatasetCodeToAliasMap(_0xb95f95['apiDir'],_0xb95f95[_0x31ad2a(0x1d7)],_0xb95f95[_0x31ad2a(0x1c9)]||_0xb95f95[_0x31ad2a(0x231)]?.[_0x31ad2a(0x217)]||_0xb95f95['mergedCli']?.[_0x31ad2a(0x236)]):new Map(),_0x3bd77a=_0x5de0ea?await planHookDirectoryMigration(_0x27521d,_0x45cba8,_0x14c441,await scanLocalBffFunctions(_0x27521d,_0x31ad2a(0x1d6))):undefined,_0x397e42=createHookLocationMap(_0x174d5c),_0x4196ef=[];for(const _0x3da451 of _0x1fa293){const _0x5cd346=resolveRemoteScriptTarget(_0x27521d,_0x3da451,_0x397e42,_0x3bd77a?.[_0x31ad2a(0x221)]??_0x45cba8[_0x31ad2a(0x218)],_0x14c441);if(!_0x5cd346){_0x4196ef[_0x31ad2a(0x239)]({'scriptType':_0x3da451[_0x31ad2a(0x1c8)],'functionName':_0x3da451[_0x31ad2a(0x234)]??'','status':_0x31ad2a(0x211),'reason':_0x31ad2a(0x20a)});continue;}const _0x14e026=(_0x3bd77a?.['projectedFunctions']??_0x45cba8[_0x31ad2a(0x218)])[_0x5cd346['lockKey']],_0x3d9209=_0x3da451[_0x31ad2a(0x1ea)]!=null?computeContentHash(_0x3da451[_0x31ad2a(0x1ea)]):undefined,_0x2a8636=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x3bd77a,_0x5cd346)??_0x5cd346[_0x31ad2a(0x21a)],_0x14e026,_0x3d9209),_0x566413=_0x2a8636?localUnsyncedConflict(_0x5cd346,_0x3da451['id']):undefined;_0x4196ef['push']({'lockKey':_0x5cd346[_0x31ad2a(0x23b)],'filePath':_0x5cd346[_0x31ad2a(0x21a)],'remoteId':_0x3da451['id']??null,'status':_0x566413?'conflict':'would_pull',..._0x566413?{'conflict':_0x566413}:{},..._0x5cd346[_0x31ad2a(0x1e9)]?{'alias':_0x5cd346[_0x31ad2a(0x1e9)][_0x31ad2a(0x1ca)]??null,'datasetCode':_0x5cd346[_0x31ad2a(0x1e9)]['datasetCode'],'operationType':_0x5cd346[_0x31ad2a(0x1e9)][_0x31ad2a(0x233)],'functionNode':_0x5cd346[_0x31ad2a(0x1e9)][_0x31ad2a(0x1ec)]}:{}});}return{'method':_0x31ad2a(0x1f5),'url':_0x31ad2a(0x1de)+_0xb95f95[_0x31ad2a(0x1d7)]+(_0x5e7bfd?_0x31ad2a(0x219)+_0x5e7bfd:'')+_0x31ad2a(0x20e)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0xb95f95[_0x31ad2a(0x1d7)],'filterType':_0x5e7bfd??null,..._0x3bd77a&&_0x3bd77a[_0x31ad2a(0x247)][_0x31ad2a(0x1d3)]>0x0?{'hookDirectoryMigrations':_0x3bd77a[_0x31ad2a(0x247)]['map'](_0x24b35d=>({'from':_0x24b35d[_0x31ad2a(0x1e1)],'to':_0x24b35d[_0x31ad2a(0x1e8)]}))}:{},'files':_0x4196ef},'description':_0x31ad2a(0x1be)+_0x4196ef[_0x31ad2a(0x1d3)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x574eba){const _0x26d317=a43_0xf3a316,_0x4e69c5=loadBffProjectConfig(_0x574eba[_0x26d317(0x1d7)]),_0x23863b=await readBffLockFile(_0x4e69c5[_0x26d317(0x1f4)]),{lockData:_0x5f441,appLock:_0x2c6fc8}=ensureLockScope(_0x23863b??createEmptyBffLock(),_0x574eba[_0x26d317(0x1d7)],_0x4e69c5[_0x26d317(0x235)],_0x26d317(0x1dc)),_0x3e4576=normalizeBffType(_0x574eba['str']('type'))??undefined;if(_0x574eba[_0x26d317(0x1d4)](_0x26d317(0x201))&&!_0x3e4576)throw CliErrors[_0x26d317(0x243)](_0x26d317(0x23a));const [_0x3db448,_0x5d6bda]=await Promise['all']([listBffScripts(_0x574eba[_0x26d317(0x1d7)],_0x3e4576),getBffScriptStatistics(_0x574eba[_0x26d317(0x1d7)])]);if(_0x3db448[_0x26d317(0x1d3)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x26d317(0x23c)};const _0x2af958=_0x574eba[_0x26d317(0x1d8)](_0x26d317(0x242));if(_0x2af958&&!_0x574eba[_0x26d317(0x20d)]){const _0x4abf72=await confirmForce();if(!_0x4abf72)throw CliErrors['cancelled'](_0x26d317(0x1e5));}if(_0x2af958&&_0x574eba['nonInteractive']){}const _0x339839=_0x3db448[_0x26d317(0x1cf)](_0x5b56ad=>normalizeBffType(_0x5b56ad[_0x26d317(0x1c8)])===_0x26d317(0x1d6)),_0x3caf5e=_0x339839?buildDatasetCodeToAliasMap(_0x574eba['apiDir'],_0x574eba[_0x26d317(0x1d7)],_0x574eba[_0x26d317(0x1c9)]||_0x574eba['mergedCli']?.[_0x26d317(0x217)]||_0x574eba['mergedCli']?.[_0x26d317(0x236)]):new Map(),_0x532aef=createHookLocationMap(_0x5d6bda),_0x1c06dd=JSON['parse'](JSON[_0x26d317(0x1d5)](_0x5f441)),_0xd0c003=_0x574eba[_0x26d317(0x1d7)],_0x1a9951=_0x1c06dd[_0x26d317(0x1d1)][_0xd0c003];if(!_0x1a9951)throw new Error(_0x26d317(0x24f)+_0xd0c003+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x2c4302=_0x339839?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4e69c5,_0x1a9951,_0x3caf5e,await scanLocalBffFunctions(_0x4e69c5,'HOOK')),_0x1a9951):undefined,_0x308cc6=createPullFileTransaction(),_0x4215d6=[],_0x37ea00=[],_0x102cac=[],_0xb2d12c=[];for(const _0x51b70b of _0x3db448){const _0xbcfde2=resolveRemoteScriptTarget(_0x4e69c5,_0x51b70b,_0x532aef,_0x1a9951[_0x26d317(0x218)],_0x3caf5e);if(!_0xbcfde2){_0x37ea00[_0x26d317(0x239)]({'lockKey':_0x51b70b[_0x26d317(0x1c8)]+'/'+_0x51b70b[_0x26d317(0x234)],'reason':_0x26d317(0x20a)});continue;}const _0x25f646=_0x1a9951[_0x26d317(0x218)][_0xbcfde2[_0x26d317(0x23b)]];try{if(!_0x51b70b['id'])throw new Error(_0x26d317(0x22b));if(_0x51b70b['scriptContent']==null)throw new Error(_0x26d317(0x1cd));const _0x32c5f4=_0x51b70b[_0x26d317(0x1ea)],_0x1be0cd=computeContentHash(_0x32c5f4);if(!_0x2af958){const _0x4aa787=await hasUnsyncedLocalChanges(_0xbcfde2['filePath'],_0x25f646,_0x1be0cd);if(_0x4aa787){_0x102cac[_0x26d317(0x239)](localUnsyncedConflict(_0xbcfde2,_0x51b70b['id']));continue;}}await _0x308cc6['write'](_0xbcfde2[_0x26d317(0x21a)],_0x32c5f4);const _0x2cca4b={'hash':_0x1be0cd,'remoteId':_0x51b70b['id'],'version':_0x51b70b[_0x26d317(0x20b)]};_0xbcfde2[_0x26d317(0x201)]===_0x26d317(0x1d6)&&_0xbcfde2[_0x26d317(0x1e9)]&&(_0x2cca4b[_0x26d317(0x1ca)]=_0xbcfde2[_0x26d317(0x1e9)][_0x26d317(0x1ca)],_0x2cca4b['datasetCode']=_0xbcfde2[_0x26d317(0x1e9)]['datasetCode'],_0x2cca4b[_0x26d317(0x233)]=_0xbcfde2['hookLocation'][_0x26d317(0x233)],_0x2cca4b[_0x26d317(0x1ec)]=_0xbcfde2['hookLocation'][_0x26d317(0x1ec)]),_0x1a9951[_0x26d317(0x218)][_0xbcfde2['lockKey']]=_0x2cca4b,_0x4215d6[_0x26d317(0x239)]({'lockKey':_0xbcfde2[_0x26d317(0x23b)],'remoteId':_0x51b70b['id']});}catch(_0x227ef6){_0xb2d12c[_0x26d317(0x239)]({'lockKey':_0xbcfde2[_0x26d317(0x23b)],'error':_0x227ef6 instanceof Error?_0x227ef6['message']:String(_0x227ef6)});}}_0x1a9951[_0x26d317(0x245)]=new Date()['toISOString']();try{await writeBffLockFile(_0x4e69c5['lockFilePath'],_0x1c06dd);}catch(_0x18dd1b){const _0x368e40=[...await _0x308cc6[_0x26d317(0x1f2)](),...await _0x2c4302?.['rollback']()??[]];throw withRollbackErrors(_0x18dd1b,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x368e40);}return{'ok':_0xb2d12c['length']===0x0,'data':{'pulled':_0x4215d6,'skipped':_0x37ea00,'conflicts':_0x102cac,'failed':_0xb2d12c},'message':formatPullMessage(_0x4215d6[_0x26d317(0x1d3)],_0x37ea00['length'],_0x102cac['length'],_0xb2d12c[_0x26d317(0x1d3)])};}};function localUnsyncedConflict(_0x4ee441,_0x1d7ec3){const _0x5e676b=a43_0xf3a316,_0xb83abc=_0x4ee441[_0x5e676b(0x23b)][_0x5e676b(0x21d)]('/')['at'](-0x1);return{'code':_0x5e676b(0x1da),'lockKey':_0x4ee441['lockKey'],'filePath':_0x4ee441[_0x5e676b(0x21a)],..._0x1d7ec3!=null?{'remoteId':_0x1d7ec3}:{},'message':_0x5e676b(0x1f8),'nextAction':{'action':_0x5e676b(0x1c5),'command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x4ee441['type']+_0x5e676b(0x23d)+_0xb83abc+'\x20--format\x20compress','requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function a43_0x290c(_0x1c6675,_0x177499){_0x1c6675=_0x1c6675-0x1be;const _0x5aba20=a43_0x5aba();let _0x290cf6=_0x5aba20[_0x1c6675];return _0x290cf6;}function formatPullMessage(_0x2c5e9d,_0x3f3aa6,_0x2eef24,_0xd25c17){const _0x1fd906=a43_0xf3a316,_0x3b06e3=[_0x1fd906(0x204)+_0x2c5e9d+_0x1fd906(0x210),_0x3f3aa6+_0x1fd906(0x224)];_0x2eef24>0x0&&_0x3b06e3['push'](_0x2eef24+_0x1fd906(0x1e7)+(_0x2eef24===0x1?'':'s')+'\x20'+(_0x2eef24===0x1?_0x1fd906(0x23e):'require')+_0x1fd906(0x244));if(_0xd25c17>0x0)_0x3b06e3[_0x1fd906(0x239)](_0xd25c17+_0x1fd906(0x213));return _0x3b06e3['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x30ea61,_0x229292,_0x5771b8){if(!await fileExists(_0x30ea61))return![];const _0x1132b4=await computeFileHash(_0x30ea61);if(!_0x229292)return _0x5771b8?_0x1132b4!==_0x5771b8:!![];return _0x1132b4!==_0x229292['hash'];}function createPullFileTransaction(){const _0x64bb1d=new Map(),_0x14dec0=async(_0x374e29,_0x54a988)=>{const _0xb3d087=a43_0x290c;try{if(_0x54a988['existed'])await ensureParentDirectory(_0x374e29),await writeFile(_0x374e29,_0x54a988[_0xb3d087(0x20f)]);else try{await unlink(_0x374e29);}catch(_0x5488bb){if(_0x5488bb[_0xb3d087(0x227)]!=='ENOENT')throw _0x5488bb;}return undefined;}catch(_0x4509be){return _0x4509be instanceof Error?_0x4509be:new Error(String(_0x4509be));}};return{async 'write'(_0x2eeedf,_0x161fa5){const _0x4261e9=a43_0x290c;if(!_0x64bb1d[_0x4261e9(0x1f9)](_0x2eeedf))try{_0x64bb1d['set'](_0x2eeedf,{'existed':!![],'content':await readFile(_0x2eeedf)});}catch(_0x3413e7){if(_0x3413e7[_0x4261e9(0x227)]!=='ENOENT')throw _0x3413e7;_0x64bb1d[_0x4261e9(0x1ff)](_0x2eeedf,{'existed':![]});}try{await ensureParentDirectory(_0x2eeedf),await writeFile(_0x2eeedf,_0x161fa5,_0x4261e9(0x203));}catch(_0x851a08){const _0x26c860=await _0x14dec0(_0x2eeedf,_0x64bb1d[_0x4261e9(0x24c)](_0x2eeedf));if(!_0x26c860)_0x64bb1d['delete'](_0x2eeedf);throw withRollbackErrors(_0x851a08,_0x4261e9(0x202)+_0x2eeedf+'\x22.',_0x26c860?[_0x26c860]:[]);}},async 'rollback'(){const _0x117484=a43_0x290c,_0x29f0dd=[];for(const [_0x5331ad,_0x3720a5]of[..._0x64bb1d[_0x117484(0x232)]()][_0x117484(0x1c0)]()){const _0x39d95d=await _0x14dec0(_0x5331ad,_0x3720a5);_0x39d95d&&_0x29f0dd[_0x117484(0x239)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x5331ad+'\x22:\x20'+_0x39d95d['message']));}return _0x29f0dd;}};}function withRollbackErrors(_0x4a3855,_0x5d701e,_0x3171b4){const _0x3bdb2c=a43_0xf3a316,_0x450120=_0x4a3855 instanceof Error?_0x4a3855:new Error(String(_0x4a3855));if(_0x3171b4[_0x3bdb2c(0x1d3)]===0x0)return _0x450120;return new AggregateError([_0x450120,..._0x3171b4],_0x5d701e+_0x3bdb2c(0x1dd)+_0x3171b4[_0x3bdb2c(0x215)](_0x1fcd0c=>_0x1fcd0c[_0x3bdb2c(0x214)])[_0x3bdb2c(0x22c)](';\x20'));}function buildDatasetCodeToAliasMap(_0x18e6e6,_0x1ead77,_0x568ce5){const _0x513905=a43_0xf3a316,_0x2731bc=resolveApiModelSource(_0x18e6e6,_0x1ead77,_0x568ce5),_0x2fc529=loadAliasMap(_0x18e6e6,undefined,_0x2731bc[_0x513905(0x21a)],_0x2731bc[_0x513905(0x1c7)]);return assertUnambiguousHookAliases(_0x2fc529),new Map(_0x2fc529[_0x513905(0x215)](_0x5e8972=>[_0x5e8972[_0x513905(0x1bf)][_0x513905(0x1fd)](),_0x5e8972['alias']]));}async function planHookDirectoryMigration(_0x7f606c,_0x2ced5c,_0x1d1cb2,_0x5e60d9){const _0x10615d=a43_0xf3a316,_0x548fb2=new Map();for(const [_0xd45a2b,_0x19caa1]of Object[_0x10615d(0x232)](_0x2ced5c[_0x10615d(0x218)])){const [_0x440904,_0x37a6ca,_0x73f697,_0x414eff,_0x11ba9f,..._0x15701c]=_0xd45a2b[_0x10615d(0x21d)]('/');if(_0x440904!==_0x10615d(0x1d6)||!_0x37a6ca||!_0x73f697||!_0x414eff||!_0x11ba9f||_0x15701c[_0x10615d(0x1d3)]>0x0||!_0x19caa1[_0x10615d(0x1bf)])continue;const _0x58a84c=_0x1d1cb2[_0x10615d(0x24c)](_0x19caa1[_0x10615d(0x1bf)][_0x10615d(0x1fd)]()),_0x1d8271=_0x58a84c??_0x19caa1[_0x10615d(0x1bf)];if(!isSafeHookDirectorySegment(_0x37a6ca))throw CliErrors[_0x10615d(0x243)](_0x10615d(0x223)+_0x37a6ca+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x1d8271))throw CliErrors['validation'](_0x10615d(0x229)+_0x37a6ca+_0x10615d(0x237));if(_0x37a6ca===_0x1d8271)continue;const _0x34723e=_0x548fb2[_0x10615d(0x24c)](_0x37a6ca)??{'datasetCode':_0x19caa1[_0x10615d(0x1bf)],'alias':_0x58a84c,'keyChanges':[]};if(_0x34723e[_0x10615d(0x1bf)]!==_0x19caa1[_0x10615d(0x1bf)])throw CliErrors['validation'](_0x10615d(0x229)+_0x37a6ca+_0x10615d(0x248));const _0x1ee301=_0x10615d(0x1f6)+_0x1d8271+'/'+_0x73f697+'/'+_0x414eff+'/'+_0x11ba9f;try{resolveLocalFilePathFromLockKey(_0x7f606c,_0xd45a2b),resolveLocalFilePathFromLockKey(_0x7f606c,_0x1ee301);}catch(_0x42d211){throw CliErrors['validation'](_0x10615d(0x1c3)+_0xd45a2b+_0x10615d(0x1d0)+(_0x42d211 instanceof Error?_0x42d211[_0x10615d(0x214)]:String(_0x42d211)));}_0x34723e[_0x10615d(0x22a)][_0x10615d(0x239)]({'oldLockKey':_0xd45a2b,'newLockKey':_0x1ee301,'entry':_0x19caa1}),_0x548fb2[_0x10615d(0x1ff)](_0x37a6ca,_0x34723e);}const _0x884816=new Set([..._0x548fb2[_0x10615d(0x22d)]()]['flatMap'](_0x39b983=>_0x39b983[_0x10615d(0x22a)]['map'](_0xecaa29=>_0xecaa29[_0x10615d(0x20c)]))),_0xf90d9b=new Map(),_0x449ef9=new Map();for(const [_0x58b1a7,_0x483c58]of _0x548fb2){const _0x3db944=_0x483c58[_0x10615d(0x1ca)]??_0x483c58[_0x10615d(0x1bf)],_0x21f9ca=hookDirectoryIdentity(_0x3db944),_0x480d52=_0xf90d9b[_0x10615d(0x24c)](_0x21f9ca);if(_0x480d52&&_0x480d52!==_0x58b1a7)throw CliErrors[_0x10615d(0x243)]('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x480d52+_0x10615d(0x1fc)+_0x58b1a7+_0x10615d(0x1ee)+_0x3db944+_0x10615d(0x1f1));_0xf90d9b[_0x10615d(0x1ff)](_0x21f9ca,_0x58b1a7);for(const _0x46185d of _0x483c58['keyChanges']){const _0x10af0b=_0x449ef9[_0x10615d(0x24c)](_0x46185d['newLockKey']);if(_0x10af0b&&_0x10af0b!==_0x46185d[_0x10615d(0x20c)])throw CliErrors[_0x10615d(0x243)](_0x10615d(0x1f3)+_0x10af0b+_0x10615d(0x1fc)+_0x46185d[_0x10615d(0x20c)]+_0x10615d(0x1ee)+_0x46185d[_0x10615d(0x1f7)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x884816[_0x10615d(0x1f9)](_0x46185d['newLockKey']))throw CliErrors[_0x10615d(0x243)](_0x10615d(0x222)+_0x46185d[_0x10615d(0x20c)]+_0x10615d(0x1ed)+_0x46185d[_0x10615d(0x1f7)]+_0x10615d(0x1e6));_0x449ef9['set'](_0x46185d[_0x10615d(0x1f7)],_0x46185d[_0x10615d(0x20c)]);}}const _0x3b2f00=new Map();for(const [_0x236a0f,_0x143436]of _0x1d1cb2){_0x3b2f00[_0x10615d(0x1ff)](hookDirectoryIdentity(_0x143436),_0x236a0f);}const _0x3b2c4f=[];for(const [_0xb68a1e,_0x11b9fa]of _0x548fb2){const _0x1776f8=_0x11b9fa[_0x10615d(0x1ca)]??_0x11b9fa[_0x10615d(0x1bf)],_0x13ab8a=join(_0x7f606c[_0x10615d(0x225)],_0x10615d(0x1d6),_0xb68a1e),_0x3120f9=join(_0x7f606c['scriptsRootDir'],'HOOK',_0x1776f8),_0x29ee38=await directoryExists(_0x13ab8a),_0x1ab224=await directoryExists(_0x3120f9),_0x6348f0=_0x29ee38?_0x1ab224?await sameDirectory(_0x13ab8a,_0x3120f9)?_0x10615d(0x1c1):undefined:_0x10615d(0x208):_0x10615d(0x1c6);if(!_0x6348f0)throw CliErrors[_0x10615d(0x243)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0xb68a1e+_0x10615d(0x22f)+_0x1776f8+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x38dc5c=_0x3b2f00[_0x10615d(0x24c)](hookDirectoryIdentity(_0xb68a1e));if(_0x38dc5c&&_0x38dc5c!==_0x11b9fa[_0x10615d(0x1bf)][_0x10615d(0x1fd)]()){const _0x334bd6=new Set(_0x11b9fa[_0x10615d(0x22a)][_0x10615d(0x215)](_0x41891d=>_0x41891d['oldLockKey'])),_0x3476be=_0x5e60d9[_0x10615d(0x230)](_0x1737af=>_0x1737af[_0x10615d(0x201)]===_0x10615d(0x1d6)&&_0x1737af[_0x10615d(0x1ca)]!=null&&hookDirectoryIdentity(_0x1737af[_0x10615d(0x1ca)])===hookDirectoryIdentity(_0xb68a1e)&&!_0x334bd6[_0x10615d(0x1f9)](_0x1737af['lockKey']));if(_0x3476be[_0x10615d(0x1d3)]>0x0)throw CliErrors[_0x10615d(0x243)](_0x10615d(0x229)+_0xb68a1e+_0x10615d(0x1fe));}const _0x173aa6=_0x3b2f00[_0x10615d(0x24c)](hookDirectoryIdentity(_0x1776f8));if(_0x173aa6&&_0x173aa6!==_0x11b9fa[_0x10615d(0x1bf)][_0x10615d(0x1fd)]())throw CliErrors[_0x10615d(0x243)](_0x10615d(0x229)+_0xb68a1e+_0x10615d(0x22f)+_0x1776f8+_0x10615d(0x1ce));for(const _0x7b8f91 of _0x11b9fa[_0x10615d(0x22a)]){const _0x45fd5f=_0x2ced5c[_0x10615d(0x218)][_0x7b8f91[_0x10615d(0x1f7)]];if(_0x45fd5f&&!_0x884816[_0x10615d(0x1f9)](_0x7b8f91['newLockKey'])&&!sameHookIdentity(_0x7b8f91['entry'],_0x45fd5f))throw CliErrors[_0x10615d(0x243)](_0x10615d(0x229)+_0xb68a1e+_0x10615d(0x22f)+_0x1776f8+'\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.');}_0x3b2c4f[_0x10615d(0x239)]({'oldDirectory':_0xb68a1e,'newDirectory':_0x1776f8,'oldDirectoryPath':_0x13ab8a,'newDirectoryPath':_0x3120f9,'mode':_0x6348f0,'alias':_0x11b9fa[_0x10615d(0x1ca)],'keyChanges':_0x11b9fa[_0x10615d(0x22a)]});}const _0x515ecd={..._0x2ced5c[_0x10615d(0x218)]},_0x2e8561=new Map(),_0x36f292=new Map();for(const _0x3ab7e7 of _0x3b2c4f){const _0x158c69=_0x3ab7e7[_0x10615d(0x24d)]!==_0x10615d(0x1c6);_0x158c69&&_0x36f292[_0x10615d(0x1ff)](hookDirectoryIdentity(_0x3ab7e7[_0x10615d(0x1e8)]),_0x3ab7e7[_0x10615d(0x1df)]);for(const _0x5313c1 of _0x3ab7e7[_0x10615d(0x22a)]){const _0x542ff6=_0x515ecd[_0x5313c1[_0x10615d(0x1f7)]],_0x4a017e=_0x158c69?_0x5313c1[_0x10615d(0x24a)]:_0x542ff6??_0x5313c1[_0x10615d(0x24a)];_0x515ecd[_0x5313c1[_0x10615d(0x1f7)]]=canonicalizeHookEntry(_0x4a017e,_0x3ab7e7['alias']),delete _0x515ecd[_0x5313c1[_0x10615d(0x20c)]],_0x158c69&&_0x2e8561[_0x10615d(0x1ff)](_0x5313c1[_0x10615d(0x1f7)],resolveLocalFilePathFromLockKey(_0x7f606c,_0x5313c1['oldLockKey']));}}return{'migrations':_0x3b2c4f,'projectedFunctions':_0x515ecd,'sourceFilePathByNewLockKey':_0x2e8561,'sourceDirectoryPathByNewDirectory':_0x36f292};}function resolveMigratedSourceFilePath(_0x14b42e,_0x19980e){const _0x420fd1=a43_0xf3a316;if(!_0x14b42e||!_0x19980e)return undefined;const _0x2a7937=_0x14b42e[_0x420fd1(0x1eb)][_0x420fd1(0x24c)](_0x19980e[_0x420fd1(0x23b)]);if(_0x2a7937)return _0x2a7937;if(_0x19980e[_0x420fd1(0x201)]!==_0x420fd1(0x1d6))return undefined;const [,_0x25d0bc,..._0x45c690]=_0x19980e[_0x420fd1(0x23b)][_0x420fd1(0x21d)]('/');if(!_0x25d0bc||_0x45c690[_0x420fd1(0x1d3)]===0x0)return undefined;const _0x52cba7=_0x14b42e[_0x420fd1(0x24b)]['get'](hookDirectoryIdentity(_0x25d0bc));return _0x52cba7?join(_0x52cba7,..._0x45c690)+_0x420fd1(0x1fa):undefined;}function a43_0x5aba(){const _0x379b6f=['lockKey','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x20--name\x20','requires','10WTiCJK','Force\x20overwrite\x20local\x20unsynced\x20changes','\x22\x20may\x20remain.','force','validation','\x20resolution','lastSync','165xReOwP','migrations','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','ENDPOINT','entry','sourceDirectoryPathByNewDirectory','get','mode','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','Lock\x20scope\x20for\x20app\x20\x22','Would\x20inspect\x20','datasetCode','reverse','case-rename','375174cXOyXH','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','close','push_local','rekey','profileName','scriptType','selectedAppName','alias','\x22;\x20temporary\x20directory\x20\x22','remoteId','Remote\x20script\x20missing\x20content.','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','some','\x22:\x20','apps','2861426uqvzoj','length','str','stringify','HOOK','appCode','bool','question','BFF_LOCAL_UNSYNCED','newDirectoryPath','pull','\x20Recovery\x20errors:\x20','/api/management/library/scripts/list?appCode=','oldDirectoryPath','ino','oldDirectory','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','5042008VDrcgk','read','Force\x20pull\x20cancelled.','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','\x20conflict','newDirectory','hookLocation','scriptContent','sourceFilePathByNewLockKey','functionNode','\x22:\x20its\x20target\x20\x22','\x22:\x20both\x20target\x20\x22','yes','trim','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','rollback','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','lockFilePath','GET','HOOK/','newLockKey','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','has','.js','3stXZtC','\x22\x20and\x20\x22','toLowerCase','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','set','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','type','Failed\x20to\x20write\x20local\x20script\x20\x22','utf8','Pull\x20complete:\x20','dev','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','normalize','move','stdin','unresolvable\x20target\x20path','version','oldLockKey','nonInteractive','¤tPage=1&pageSize=','content','\x20pulled','skipped','bff','\x20failed','message','map','45uTnzfH','currentApp','functions','&type=','filePath','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','10493329nqtwnA','split','1143170TYViuy','all','string','projectedFunctions','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','\x20skipped','scriptsRootDir','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','code','755464ZilcWj','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','keyChanges','Remote\x20script\x20missing\x20id.','join','values','includes','\x22\x20to\x20\x22','filter','mergedCli','entries','operationType','functionName','scriptsRoot','defaultApp','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','1006753qyNWyJ','push','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.'];a43_0x5aba=function(){return _0x379b6f;};return a43_0x5aba();}function sameHookIdentity(_0x2642d4,_0x15b19a){const _0x2cd0ef=a43_0xf3a316;return _0x2642d4[_0x2cd0ef(0x1cc)]===_0x15b19a[_0x2cd0ef(0x1cc)]&&_0x2642d4['datasetCode']===_0x15b19a[_0x2cd0ef(0x1bf)]&&_0x2642d4['operationType']===_0x15b19a[_0x2cd0ef(0x233)]&&_0x2642d4[_0x2cd0ef(0x1ec)]===_0x15b19a[_0x2cd0ef(0x1ec)];}function canonicalizeHookEntry(_0x509834,_0x5c13d0){const {alias:_0x48365b,..._0x291a83}=_0x509834;return _0x5c13d0?{..._0x291a83,'alias':_0x5c13d0}:_0x291a83;}function hookDirectoryIdentity(_0x54e7c9){const _0x35eca6=a43_0xf3a316;return _0x54e7c9[_0x35eca6(0x207)]('NFC')[_0x35eca6(0x1fd)]();}function isSafeHookDirectorySegment(_0xcfb177){return isSafeLockKeySegment(_0xcfb177);}async function sameDirectory(_0x5f2515,_0x4dc013){const _0x206413=a43_0xf3a316,[_0x4d902f,_0x2d8ca0]=await Promise['all']([stat(_0x5f2515),stat(_0x4dc013)]);return _0x4d902f[_0x206413(0x205)]===_0x2d8ca0[_0x206413(0x205)]&&_0x4d902f[_0x206413(0x1e0)]===_0x2d8ca0[_0x206413(0x1e0)];}async function applyHookDirectoryMigration(_0x3778a8,_0xbd2fa9){const _0x40bc22=a43_0xf3a316,_0x182d84=_0xbd2fa9[_0x40bc22(0x218)],_0x190a28=_0xbd2fa9['lastSync'],_0x38db76=[],_0x5eefce=async()=>{const _0x439f4b=_0x40bc22,_0x246324=[];_0xbd2fa9[_0x439f4b(0x218)]=_0x182d84,_0xbd2fa9[_0x439f4b(0x245)]=_0x190a28;for(const {migration:_0x247a62,temporaryPath:_0x210a3d}of[..._0x38db76]['reverse']()){try{_0x210a3d?(await rename(_0x247a62[_0x439f4b(0x1db)],_0x210a3d),await rename(_0x210a3d,_0x247a62[_0x439f4b(0x1df)])):await rename(_0x247a62[_0x439f4b(0x1db)],_0x247a62['oldDirectoryPath']);}catch(_0x185ba6){_0x246324['push'](new Error(_0x439f4b(0x1e2)+_0x247a62[_0x439f4b(0x1e1)]+'\x22\x20from\x20\x22'+_0x247a62[_0x439f4b(0x1e8)]+_0x439f4b(0x1d0)+(_0x185ba6 instanceof Error?_0x185ba6['message']:String(_0x185ba6))));}}return _0x246324;};try{for(const _0x4d5647 of _0x3778a8['migrations']){if(_0x4d5647[_0x40bc22(0x24d)]===_0x40bc22(0x208))await ensureParentDirectory(_0x4d5647['newDirectoryPath']),await rename(_0x4d5647[_0x40bc22(0x1df)],_0x4d5647[_0x40bc22(0x1db)]),_0x38db76[_0x40bc22(0x239)]({'migration':_0x4d5647});else{if(_0x4d5647['mode']==='case-rename'){const _0x32239d=join(dirname(_0x4d5647[_0x40bc22(0x1df)]),'.hook-directory-migrate-'+randomUUID());await rename(_0x4d5647[_0x40bc22(0x1df)],_0x32239d);try{await rename(_0x32239d,_0x4d5647[_0x40bc22(0x1db)]);}catch(_0x3ac1b4){try{await rename(_0x32239d,_0x4d5647[_0x40bc22(0x1df)]);}catch(_0x5931eb){throw withRollbackErrors(_0x3ac1b4,_0x40bc22(0x200)+_0x4d5647[_0x40bc22(0x1e1)]+'\x22\x20to\x20\x22'+_0x4d5647['newDirectory']+_0x40bc22(0x1cb)+_0x32239d+_0x40bc22(0x241),[new Error(_0x40bc22(0x21b)+_0x32239d+_0x40bc22(0x22f)+_0x4d5647[_0x40bc22(0x1e1)]+_0x40bc22(0x1d0)+(_0x5931eb instanceof Error?_0x5931eb[_0x40bc22(0x214)]:String(_0x5931eb)))]);}throw _0x3ac1b4;}_0x38db76['push']({'migration':_0x4d5647,'temporaryPath':_0x32239d});}}}return _0xbd2fa9[_0x40bc22(0x218)]=_0x3778a8['projectedFunctions'],{'rollback':_0x5eefce};}catch(_0x52ea71){const _0x338f6d=await _0x5eefce();throw withRollbackErrors(_0x52ea71,_0x40bc22(0x226),_0x338f6d);}}async function confirmForce(){const _0x46feae=a43_0xf3a316,_0x10bcce=createInterface({'input':process[_0x46feae(0x209)],'output':process['stderr']}),_0x2779af=await new Promise(_0x5c46ec=>{const _0x36a653=_0x46feae;_0x10bcce[_0x36a653(0x1d9)](_0x36a653(0x24e),_0x5c46ec);});return _0x10bcce[_0x46feae(0x1c4)](),['y',_0x46feae(0x1ef)][_0x46feae(0x22e)](_0x2779af[_0x46feae(0x1f0)]()['toLowerCase']());}
|