@lovrabet/rabetbase-cli 2.5.7 → 2.5.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/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-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
|
+
const a34_0x2c188d=a34_0x4082;function a34_0x4082(_0x35af37,_0x16989f){_0x35af37=_0x35af37-0x108;const _0x522a82=a34_0x522a();let _0x4082c2=_0x522a82[_0x35af37];return _0x4082c2;}(function(_0x4cba03,_0x402e49){const _0x3fa0a2=a34_0x4082,_0x1b8525=_0x4cba03();while(!![]){try{const _0x3265c5=-parseInt(_0x3fa0a2(0x113))/0x1*(parseInt(_0x3fa0a2(0x128))/0x2)+-parseInt(_0x3fa0a2(0x117))/0x3*(parseInt(_0x3fa0a2(0x10f))/0x4)+-parseInt(_0x3fa0a2(0x11e))/0x5*(parseInt(_0x3fa0a2(0x124))/0x6)+-parseInt(_0x3fa0a2(0x109))/0x7*(parseInt(_0x3fa0a2(0x127))/0x8)+-parseInt(_0x3fa0a2(0x108))/0x9+parseInt(_0x3fa0a2(0x125))/0xa*(parseInt(_0x3fa0a2(0x11a))/0xb)+parseInt(_0x3fa0a2(0x10b))/0xc;if(_0x3265c5===_0x402e49)break;else _0x1b8525['push'](_0x1b8525['shift']());}catch(_0x1d1096){_0x1b8525['push'](_0x1b8525['shift']());}}}(a34_0x522a,0x5cc67));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';function a34_0x522a(){const _0x405ea6=['1400110VXtnPb','4021515nJFgYk','4068281pxsdLD','update','29722308yIcLdw','get','Read\x20config\x20value\x20from\x20file','POST','168iivuPJ','set','App\x20config\x20server\x20id\x20missing\x20for\x20key=','tags','1BmaWoF','number','\x20app\x20config\x20','write','49116Xlpbyt','appCode','apiError','1293974tPEARM','/smartapi/app-config/create','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','isFinite','170285DmJMpo','string','/smartapi/app-config/update','Updated',',\x20appCode=','file','6tlOPPN','30SNJbzV','create','8IedjFU'];a34_0x522a=function(){return _0x405ea6;};return a34_0x522a();}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_0x2c188d(0x11b),UPDATE_PATH=a34_0x2c188d(0x120);export const appConfigSet={'service':'app-config','command':a34_0x2c188d(0x110),'description':a34_0x2c188d(0x11c),'risk':a34_0x2c188d(0x116),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x2c188d(0x123),'type':a34_0x2c188d(0x11f),'description':a34_0x2c188d(0x10d)}],async 'validate'(_0x45982d){readKeyArg(_0x45982d),readOptionalTags(_0x45982d),assertSingleValueSource(_0x45982d);},async 'dryRun'(_0x57558b){const _0x4740fb=a34_0x2c188d,_0x23b95c=readKeyArg(_0x57558b),_0xc6b568=readOptionalTags(_0x57558b),_0x19c440=assertSingleValueSource(_0x57558b);await assertValueSourceReadable(_0x19c440);const _0x2d3a9b=await withAppConfigApiBoundary(_0x4740fb(0x10c),{'appCode':_0x57558b[_0x4740fb(0x118)],'key':_0x23b95c},()=>getAppConfigByKey(_0x57558b[_0x4740fb(0x118)],_0x23b95c)),_0xc77556=_0x2d3a9b?'update':_0x4740fb(0x126),_0x2e9db2=_0x2d3a9b?projectAppConfig(_0x2d3a9b):null,_0x14eb1d=plannedAppConfig({'appCode':_0x57558b[_0x4740fb(0x118)],'key':_0x23b95c,'tags':_0xc6b568??_0x2d3a9b?.['tags'],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0xc77556,'appCode':_0x57558b[_0x4740fb(0x118)],'key':_0x23b95c,'before':_0x2e9db2,'after':_0x14eb1d,'dryRun':!![]}),{'method':_0x4740fb(0x10e),'url':_0xc77556===_0x4740fb(0x10a)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x58d86d){const _0x27240f=a34_0x2c188d,_0x1bdeef=readKeyArg(_0x58d86d),_0x38b80c=readOptionalTags(_0x58d86d),_0x1c212b=await withAppConfigApiBoundary(_0x27240f(0x10c),{'appCode':_0x58d86d[_0x27240f(0x118)],'key':_0x1bdeef},()=>getAppConfigByKey(_0x58d86d[_0x27240f(0x118)],_0x1bdeef)),_0xd4d102=_0x1c212b?projectAppConfig(_0x1c212b):null,_0x22fcb5=_0x1c212b?'update':'create',{value:_0x1dfe21,warnings:_0x13d80c}=await readAppConfigValue(_0x58d86d),_0xdb0082={'appCode':_0x58d86d[_0x27240f(0x118)],'key':_0x1bdeef,'value':_0x1dfe21,'tags':_0x38b80c??_0x1c212b?.['tags']??undefined};await withAppConfigApiBoundary(_0x22fcb5,{'appCode':_0x58d86d[_0x27240f(0x118)],'key':_0x1bdeef},async()=>{const _0x23c996=_0x27240f;_0x1c212b?await updateAppConfig({..._0xdb0082,'id':requireAppConfigId(_0x1c212b,_0x1bdeef,_0x58d86d[_0x23c996(0x118)])}):await createAppConfig(_0xdb0082);});const _0x4fc294=await withAppConfigApiBoundary(_0x27240f(0x10c),{'appCode':_0x58d86d[_0x27240f(0x118)],'key':_0x1bdeef},()=>getAppConfigByKey(_0x58d86d[_0x27240f(0x118)],_0x1bdeef)),_0x470ca9=_0x4fc294?projectAppConfig(_0x4fc294):plannedAppConfig({'appCode':_0x58d86d[_0x27240f(0x118)],'key':_0x1bdeef,'tags':_0xdb0082[_0x27240f(0x112)],'hasValue':_0x1dfe21!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x22fcb5,'appCode':_0x58d86d['appCode'],'key':_0x1bdeef,'before':_0xd4d102,'after':_0x470ca9,'dryRun':![],'warnings':_0x13d80c}),'message':(_0x22fcb5===_0x27240f(0x10a)?_0x27240f(0x121):'Created')+_0x27240f(0x115)+_0x1bdeef};}};function requireAppConfigId(_0x3ef2b4,_0x2bc7ad,_0x34cd88){const _0x52c984=a34_0x2c188d;if(typeof _0x3ef2b4['id']===_0x52c984(0x114)&&Number[_0x52c984(0x11d)](_0x3ef2b4['id'])&&_0x3ef2b4['id']>0x0)return _0x3ef2b4['id'];throw CliErrors[_0x52c984(0x119)](_0x52c984(0x111)+_0x2bc7ad+_0x52c984(0x122)+_0x34cd88);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x194e8b=a35_0x157e;(function(_0x24e95f,_0x43ba95){const _0x40710d=a35_0x157e,_0x13417b=_0x24e95f();while(!![]){try{const _0xc493c5=parseInt(_0x40710d(0xbf))/0x1+-parseInt(_0x40710d(0x9a))/0x2+-parseInt(_0x40710d(0x94))/0x3*(-parseInt(_0x40710d(0xbb))/0x4)+-parseInt(_0x40710d(0x87))/0x5*(-parseInt(_0x40710d(0x93))/0x6)+-parseInt(_0x40710d(0x8b))/0x7*(-parseInt(_0x40710d(0xc2))/0x8)+parseInt(_0x40710d(0xb4))/0x9+-parseInt(_0x40710d(0xc5))/0xa*(parseInt(_0x40710d(0x86))/0xb);if(_0xc493c5===_0x43ba95)break;else _0x13417b['push'](_0x13417b['shift']());}catch(_0x135076){_0x13417b['push'](_0x13417b['shift']());}}}(a35_0x58dd,0x1e3d2));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x194e8b(0xa7),'description':a35_0x194e8b(0xb3),'required':!![]};export const VALUE_ARG={'name':a35_0x194e8b(0xba),'description':a35_0x194e8b(0xaa),'required':![]};export const TAGS_FLAG={'name':a35_0x194e8b(0xc1),'type':a35_0x194e8b(0xb7),'description':a35_0x194e8b(0xb8)};export const STDIN_FLAG={'name':'stdin','type':'boolean','description':a35_0x194e8b(0xa9),'default':![]};export const FROM_ENV_FLAG={'name':'from-env','type':a35_0x194e8b(0xb7),'description':a35_0x194e8b(0xa6)};export const REVEAL_FLAG={'name':a35_0x194e8b(0xc3),'type':'boolean','description':a35_0x194e8b(0xb6),'default':![]};export function readKeyArg(_0x420b92){const _0x41afb8=a35_0x194e8b,_0x5ae676=_0x420b92[_0x41afb8(0x9d)][0x0]?.[_0x41afb8(0xb0)]()??'';return validateKey(_0x5ae676),_0x5ae676;}export function readOptionalTags(_0x1d976e){const _0x4f0b9b=a35_0x194e8b,_0x2d50be=_0x1d976e[_0x4f0b9b(0xab)](_0x4f0b9b(0xc1))[_0x4f0b9b(0xb0)]();if(!_0x2d50be)return undefined;if(_0x2d50be[_0x4f0b9b(0x99)]>0x20)throw CliErrors[_0x4f0b9b(0xa8)](_0x4f0b9b(0x92));return _0x2d50be;}export function validateKey(_0x2833ea){const _0x48fe16=a35_0x194e8b;if(!_0x2833ea)throw CliErrors[_0x48fe16(0xa8)]('Missing\x20app-config\x20key.');if(_0x2833ea[_0x48fe16(0x99)]>0x100)throw CliErrors[_0x48fe16(0xa8)](_0x48fe16(0xb9));}export function projectAppConfig(_0xef0a24,_0xa26767){const _0x2d2845=a35_0x194e8b,_0x3899fd=_0xef0a24[_0x2d2845(0xba)]!==undefined&&_0xef0a24['value']!==null&&_0xef0a24['value']!=='',_0x22454c={'appCode':_0xef0a24[_0x2d2845(0xa1)],'key':_0xef0a24[_0x2d2845(0xa7)],'tags':_0xef0a24[_0x2d2845(0xc1)]??undefined,'hasValue':_0x3899fd,'valueRedacted':_0x3899fd&&!_0xa26767?.['reveal'],'gmtCreate':_0xef0a24[_0x2d2845(0xc0)],'gmtModified':_0xef0a24[_0x2d2845(0x9e)]};return _0xa26767?.[_0x2d2845(0xc3)]&&(_0x22454c[_0x2d2845(0xba)]=_0xef0a24[_0x2d2845(0xba)]??'',_0x22454c[_0x2d2845(0x90)]=![]),_0x22454c;}export function plannedAppConfig(_0x1abde4){const _0x2338c9=a35_0x194e8b,_0x4e3b50=_0x1abde4[_0x2338c9(0xbe)]??!![];return{'appCode':_0x1abde4[_0x2338c9(0xa1)],'key':_0x1abde4[_0x2338c9(0xa7)],'tags':_0x1abde4[_0x2338c9(0xc1)]??undefined,'hasValue':_0x4e3b50,'valueRedacted':_0x4e3b50};}function a35_0x157e(_0x1fa74e,_0x3ce81d){_0x1fa74e=_0x1fa74e-0x82;const _0x58dd64=a35_0x58dd();let _0x157eb4=_0x58dd64[_0x1fa74e];return _0x157eb4;}export function buildMutationData(_0x400ca2){const _0x4e5f47=a35_0x194e8b;return{'operation':_0x400ca2['operation'],'selector':{'appCode':_0x400ca2[_0x4e5f47(0xa1)],'key':_0x400ca2[_0x4e5f47(0xa7)]},'before':_0x400ca2[_0x4e5f47(0xc6)],'after':_0x400ca2[_0x4e5f47(0xb2)],'dryRun':_0x400ca2[_0x4e5f47(0x9b)],'warnings':_0x400ca2[_0x4e5f47(0xa2)]??[]};}export async function withAppConfigApiBoundary(_0x22e511,_0x3c163e,_0x4f39bd){const _0x20ef0c=a35_0x194e8b;try{return await _0x4f39bd();}catch{const _0x2632f2=[_0x20ef0c(0xae)+_0x3c163e[_0x20ef0c(0xa1)]];if(_0x3c163e[_0x20ef0c(0xa7)])_0x2632f2[_0x20ef0c(0x96)](_0x20ef0c(0x9c)+_0x3c163e['key']);_0x2632f2[_0x20ef0c(0x96)](_0x20ef0c(0x8f));throw CliErrors[_0x20ef0c(0x91)](_0x20ef0c(0x85)+_0x22e511+_0x20ef0c(0x88),_0x2632f2[_0x20ef0c(0xad)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x185572,_0x1ca533){const _0x27bb6d=a35_0x194e8b;return Object['defineProperties'](_0x185572,{'method':{'value':_0x1ca533[_0x27bb6d(0xaf)],'enumerable':![]},'url':{'value':_0x1ca533[_0x27bb6d(0x8c)],'enumerable':![]}});}export function assertSingleValueSource(_0x1d9740){const _0x33697f=a35_0x194e8b,_0x4b4982=[];_0x1d9740[_0x33697f(0x9d)]['length']>0x1&&_0x4b4982['push']({'kind':_0x33697f(0xa3),'value':_0x1d9740[_0x33697f(0x9d)]['slice'](0x1)['join']('\x20')});const _0x131d7c=_0x1d9740[_0x33697f(0x9f)](_0x33697f(0xba));_0x131d7c!==undefined&&_0x131d7c!==null&&_0x4b4982[_0x33697f(0x96)]({'kind':_0x33697f(0xa3),'value':String(_0x131d7c)});_0x1d9740[_0x33697f(0xb1)](_0x33697f(0x82))&&_0x4b4982[_0x33697f(0x96)]({'kind':_0x33697f(0x82)});const _0x203b1e=_0x1d9740[_0x33697f(0xab)]('from-env')[_0x33697f(0xb0)]();_0x203b1e&&_0x4b4982[_0x33697f(0x96)]({'kind':'env','name':_0x203b1e});const _0x153961=_0x1d9740[_0x33697f(0xab)](_0x33697f(0xc4))[_0x33697f(0xb0)]();_0x153961&&_0x4b4982['push']({'kind':'file','path':_0x153961});if(_0x4b4982[_0x33697f(0x99)]===0x0)throw CliErrors[_0x33697f(0xa8)](_0x33697f(0xa0),_0x33697f(0xac));if(_0x4b4982[_0x33697f(0x99)]>0x1)throw CliErrors['validation']('App\x20config\x20value\x20source\x20is\x20ambiguous.',_0x33697f(0xbc));return _0x4b4982[0x0];}function a35_0x58dd(){const _0x236ef3=['Read\x20config\x20value\x20from\x20stdin','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','str','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','join','appCode:\x20','method','trim','bool','after','Runtime\x20app-config\x20key','2097999hRviNT','kind','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','string','Config\x20tags\x20for\x20filtering/display\x20metadata','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','value','4176BLnxuX','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','error','hasValue','35646PXmuzg','gmtCreate','tags','113448HrUETo','reveal','file','3490fBgRTu','before','stdin','path','data','Failed\x20to\x20','17006DgwCsl','956795DJgVTU','\x20app\x20config.','end','Value\x20file\x20is\x20not\x20readable:\x20','77BsrVLO','url','setEncoding','Environment\x20variable\x20is\x20not\x20set:\x20','value\x20is\x20redacted','valueRedacted','apiError','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','6hiPlSh','498zyBXGR','utf8','push','env','once','length','251998BbnnRY','dryRun','key:\x20','args','gmtModified','flag','Missing\x20app-config\x20value\x20source.','appCode','warnings','argument','name','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','key','validation'];a35_0x58dd=function(){return _0x236ef3;};return a35_0x58dd();}export async function assertValueSourceReadable(_0x28cc8b){const _0x15d1b4=a35_0x194e8b;if(_0x28cc8b['kind']===_0x15d1b4(0x97)&&!(_0x28cc8b[_0x15d1b4(0xa4)]in process.env))throw CliErrors['validation'](_0x15d1b4(0x8e)+_0x28cc8b[_0x15d1b4(0xa4)]);if(_0x28cc8b[_0x15d1b4(0xb5)]===_0x15d1b4(0xc4))try{await access(_0x28cc8b[_0x15d1b4(0x83)]);}catch{throw CliErrors[_0x15d1b4(0xa8)](_0x15d1b4(0x8a)+_0x28cc8b[_0x15d1b4(0x83)]);}}export async function readAppConfigValue(_0x4a9d2d){const _0x202df4=a35_0x194e8b,_0x4b57c9=assertSingleValueSource(_0x4a9d2d),_0x5ded6d=[];if(_0x4b57c9[_0x202df4(0xb5)]===_0x202df4(0xa3))return _0x5ded6d[_0x202df4(0x96)](_0x202df4(0xa5)),{'value':_0x4b57c9[_0x202df4(0xba)]??'','source':_0x4b57c9[_0x202df4(0xb5)],'warnings':_0x5ded6d};if(_0x4b57c9[_0x202df4(0xb5)]===_0x202df4(0x82))return{'value':await readStdin(),'source':_0x4b57c9[_0x202df4(0xb5)],'warnings':_0x5ded6d};if(_0x4b57c9[_0x202df4(0xb5)]===_0x202df4(0x97)){if(!(_0x4b57c9[_0x202df4(0xa4)]in process.env))throw CliErrors['validation'](_0x202df4(0x8e)+_0x4b57c9[_0x202df4(0xa4)]);return{'value':process.env[_0x4b57c9.name]??'','source':_0x4b57c9['kind'],'warnings':_0x5ded6d};}return{'value':await readFile(_0x4b57c9[_0x202df4(0x83)],_0x202df4(0x95)),'source':_0x4b57c9['kind'],'warnings':_0x5ded6d};}function readStdin(){return new Promise((_0x19e134,_0x1ba4f1)=>{const _0x38594c=a35_0x157e;let _0x5e42c6='';process['stdin'][_0x38594c(0x8d)](_0x38594c(0x95)),process[_0x38594c(0x82)]['on'](_0x38594c(0x84),_0x2b9d04=>{_0x5e42c6+=_0x2b9d04;}),process['stdin'][_0x38594c(0x98)](_0x38594c(0x89),()=>_0x19e134(_0x5e42c6)),process['stdin'][_0x38594c(0x98)](_0x38594c(0xbd),_0x1ba4f1);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x55c6e9=a36_0xa775;function a36_0xa775(_0x15455e,_0xa044d){_0x15455e=_0x15455e-0x74;const _0x4641a0=a36_0x4641();let _0xa77503=_0x4641a0[_0x15455e];return _0xa77503;}function a36_0x4641(){const _0x47e44c=['!\x20Not\x20logged\x20in','login','logout','177mrnrst','274671lHxBMX','bool','565TlpWXk','714zTjUOp','yes','1964760RFtmGb','auth','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','820064kGKDri','Clear\x20login\x20session','boolean','../../auth/auth-server-ui.js','log','✓\x20Logged\x20out','5744veEilK','175443mxCKtt','1680903KaFSYd'];a36_0x4641=function(){return _0x47e44c;};return a36_0x4641();}(function(_0x2814fd,_0x36a34e){const _0x5927f6=a36_0xa775,_0x317eaf=_0x2814fd();while(!![]){try{const _0x200ca4=parseInt(_0x5927f6(0x7d))/0x1+parseInt(_0x5927f6(0x76))/0x2+parseInt(_0x5927f6(0x82))/0x3*(parseInt(_0x5927f6(0x7c))/0x4)+parseInt(_0x5927f6(0x85))/0x5*(parseInt(_0x5927f6(0x86))/0x6)+-parseInt(_0x5927f6(0x7e))/0x7+-parseInt(_0x5927f6(0x88))/0x8+parseInt(_0x5927f6(0x83))/0x9;if(_0x200ca4===_0x36a34e)break;else _0x317eaf['push'](_0x317eaf['shift']());}catch(_0x4dd510){_0x317eaf['push'](_0x317eaf['shift']());}}}(a36_0x4641,0x37c59));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':a36_0x55c6e9(0x80),'description':'Login\x20via\x20browser','risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x55c6e9(0x87),'type':a36_0x55c6e9(0x78),'description':a36_0x55c6e9(0x75),'default':![]}],async 'execute'(_0x3556f3){const _0x197bf7=a36_0x55c6e9,{runAuthServer:_0x480f16}=await import(_0x197bf7(0x79));return await _0x480f16({'autoYes':_0x3556f3[_0x197bf7(0x84)](_0x197bf7(0x87)),'nonInteractive':_0x3556f3['nonInteractive']}),{'ok':!![]};}},{'service':a36_0x55c6e9(0x74),'command':a36_0x55c6e9(0x81),'description':a36_0x55c6e9(0x77),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x4ad22d){const _0x37ad3b=a36_0x55c6e9;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x37ad3b(0x7a)](_0x37ad3b(0x7b))):console[_0x37ad3b(0x7a)](_0x37ad3b(0x7f)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x552261=a37_0x48a4;(function(_0x7c6f29,_0x1c5e08){const _0x2d4b66=a37_0x48a4,_0x2b7667=_0x7c6f29();while(!![]){try{const _0x2916f5=parseInt(_0x2d4b66(0xd9))/0x1*(-parseInt(_0x2d4b66(0xaa))/0x2)+-parseInt(_0x2d4b66(0xfd))/0x3*(-parseInt(_0x2d4b66(0xe0))/0x4)+parseInt(_0x2d4b66(0xde))/0x5*(parseInt(_0x2d4b66(0xf8))/0x6)+-parseInt(_0x2d4b66(0xfa))/0x7*(-parseInt(_0x2d4b66(0xc1))/0x8)+parseInt(_0x2d4b66(0xaf))/0x9*(-parseInt(_0x2d4b66(0xb3))/0xa)+-parseInt(_0x2d4b66(0xe3))/0xb+parseInt(_0x2d4b66(0xc7))/0xc;if(_0x2916f5===_0x1c5e08)break;else _0x2b7667['push'](_0x2b7667['shift']());}catch(_0x60cf11){_0x2b7667['push'](_0x2b7667['shift']());}}}(a37_0xc7a3,0x6a7a6));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';function a37_0x48a4(_0x186388,_0x2f20d4){_0x186388=_0x186388-0xa8;const _0xc7a3c6=a37_0xc7a3();let _0x48a4f9=_0xc7a3c6[_0x186388];return _0x48a4f9;}import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';function a37_0xc7a3(){const _0xc49e8f=['ENDPOINT','\x22\x20not\x20found\x20for\x20dataset\x20','code','nonInteractive','functionNode','filePath','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','/ENDPOINT/','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','appCode','description','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','修改后的响应结果','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','/data/dataset/','validation','22Xghvww','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','tableName','Select\x20operation\x20type:','File\x20already\x20exists:\x20','873CymPlZ','\x22\x20not\x20found.\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','.js','47910LziZFE','join','defaultApp','Script\x20description','datasetCode','datasetcode','after','\x22,\x20params\x20})\x0a','before','string','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Created\x20','stderr','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','424VVtZKJ','operationType','Available\x20aliases:\x20','map','find','operation-type','8586408kJFxPb','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','keys','write','name','UNKNOWN','Alias\x20\x22','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','No\x20datasets\x20found\x20for\x20this\x20app.','parseInt','bff','close','/**\x0a\x20*\x20','apiDir','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','59231tEhNoN','selectedAppName','trim','HOOK\x20requires\x20alias/operation/node\x20options.','type','5nufvjf','alias','12128XuCyVL','当前请求参数','\x0a\x20*\x20[平台配置]\x20','5221810ctCEnl','source','\x20function:\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','includes','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','profileName','当前响应结果','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','isInteger','Invalid\x20dataset\x20selection.','str','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','function-node','create','.js\x0a','scriptsRootDir','read','Operation\x20type\x20\x22','修改后的请求参数','Trigger\x20node\x20(HOOK\x20only)','2225082gWdzPB','HOOK','47761pFqIiP','\x22.\x20','length','573zYZAtq','Select\x20trigger\x20node:','No\x20model\x20aliases\x20found.\x20Run\x20`','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','mergedCli','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','Available:\x20','utf8'];a37_0xc7a3=function(){return _0xc49e8f;};return a37_0xc7a3();}import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x552261(0xd3),'command':a37_0x552261(0xf1),'description':a37_0x552261(0x103),'risk':a37_0x552261(0xf4),'flags':[{'name':a37_0x552261(0xdd),'type':a37_0x552261(0xbc),'required':!![],'enum':['COMMON','ENDPOINT',a37_0x552261(0xf9)],'description':'Script\x20type'},{'name':'name','type':'string','required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x552261(0x112),'type':a37_0x552261(0xbc),'description':a37_0x552261(0xb6)},{'name':'alias','type':a37_0x552261(0xbc),'description':a37_0x552261(0xe6)},{'name':a37_0x552261(0xb8),'type':a37_0x552261(0xbc),'description':a37_0x552261(0x10d)},{'name':a37_0x552261(0xc6),'type':a37_0x552261(0xbc),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':'function-node','type':a37_0x552261(0xbc),'description':a37_0x552261(0xf7),'enum':[a37_0x552261(0xbb),a37_0x552261(0xb9)]}],async 'validate'(_0x3ecfd3){const _0x1d4532=a37_0x552261,_0x382caf=_0x3ecfd3[_0x1d4532(0xee)]('name');if(!isValidBffFunctionName(_0x382caf))throw CliErrors['validation']('Invalid\x20function\x20name\x20\x22'+_0x382caf+_0x1d4532(0xb1));},async 'execute'(_0x792531){const _0x156880=a37_0x552261,_0x52a354=loadBffProjectConfig(_0x792531[_0x156880(0x111)]),_0x41cbb7=_0x792531[_0x156880(0xee)](_0x156880(0xdd)),_0x152850=_0x792531[_0x156880(0xee)](_0x156880(0xcb)),_0x59c37d=_0x792531[_0x156880(0xee)](_0x156880(0x112))||undefined,_0x469563=_0x41cbb7===_0x156880(0xf9)?await resolveHookOptions(_0x52a354,_0x792531):undefined,_0x2339c0=buildFilePath(_0x52a354,_0x41cbb7,_0x152850,_0x469563);if(await fileExists(_0x2339c0))throw CliErrors['validation'](_0x156880(0xae)+_0x2339c0);await mkdir(dirname(_0x2339c0),{'recursive':!![]});const _0x1cd0d8=generateTemplate(_0x41cbb7,_0x152850,_0x792531[_0x156880(0x111)],_0x59c37d,_0x469563);await writeFile(_0x2339c0,_0x1cd0d8,_0x156880(0x105));const _0x574977={'type':_0x41cbb7,'name':_0x152850,'path':_0x2339c0};if(_0x59c37d)_0x574977[_0x156880(0x112)]=_0x59c37d;if(_0x469563){if(_0x469563['alias'])_0x574977[_0x156880(0xdf)]=_0x469563[_0x156880(0xdf)];_0x574977[_0x156880(0xb7)]=_0x469563[_0x156880(0xb7)],_0x574977[_0x156880(0xc2)]=_0x469563[_0x156880(0xc2)],_0x574977['functionNode']=_0x469563[_0x156880(0x10a)];}return{'ok':!![],'data':_0x574977,'message':_0x156880(0xbe)+_0x41cbb7+_0x156880(0xe5)+_0x152850};}};async function resolveHookOptions(_0x4201a4,_0x104876){const _0x293907=a37_0x552261,_0x657863=resolveApiModelSource(_0x104876[_0x293907(0xd6)],_0x104876[_0x293907(0x111)],_0x104876[_0x293907(0xda)]||_0x104876[_0x293907(0x102)]?.['currentApp']||_0x104876[_0x293907(0x102)]?.[_0x293907(0xb5)]),_0x320dde=loadAliasMap(_0x104876['apiDir'],undefined,_0x657863[_0x293907(0x10b)],_0x657863[_0x293907(0xe9)]),_0x317b45=_0x320dde[_0x293907(0xfc)]>0x0;let _0x557dc2,_0x2aea78,_0x83f0eb;const _0x28f8e0=_0x104876[_0x293907(0xee)](_0x293907(0xdf)),_0x2df469=_0x104876[_0x293907(0xee)](_0x293907(0xb8));if(_0x28f8e0){const _0x2742ee=resolveAlias(_0x104876[_0x293907(0xd6)],_0x28f8e0,undefined,_0x657863['filePath'],_0x657863['profileName']);if(!_0x2742ee){const _0x511ba2=_0x317b45?_0x293907(0xc3)+_0x320dde[_0x293907(0xc4)](_0x372a57=>_0x372a57[_0x293907(0xdf)])[_0x293907(0xb4)](',\x20'):_0x293907(0xff)+CLI_BIN_NAME+_0x293907(0x10c);throw CliErrors[_0x293907(0xa9)](_0x293907(0xcd)+_0x28f8e0+_0x293907(0xb0)+_0x511ba2);}_0x557dc2=_0x28f8e0,_0x2aea78=_0x2742ee;}else{if(_0x2df469){_0x2aea78=_0x2df469;const _0x397eb6=_0x320dde[_0x293907(0xc5)](_0x160d70=>_0x160d70[_0x293907(0xb7)]===_0x2df469);_0x557dc2=_0x397eb6?.[_0x293907(0xdf)];}else{if(_0x104876['nonInteractive'])throw CliErrors[_0x293907(0xa9)](_0x293907(0x113));else{if(_0x317b45){const _0x4bdf1d=_0x320dde['map'](_0x40dafa=>_0x40dafa[_0x293907(0xdf)]+'\x20('+_0x40dafa[_0x293907(0xac)]+')'),_0x59e3a1=await promptSelect('Select\x20dataset:',_0x4bdf1d),_0x1cc5c3=_0x320dde[_0x59e3a1];if(!_0x1cc5c3)throw CliErrors['validation'](_0x293907(0xed));_0x557dc2=_0x1cc5c3[_0x293907(0xdf)],_0x2aea78=_0x1cc5c3[_0x293907(0xb7)];}else{const _0x42fbeb=await listDatasets(_0x104876[_0x293907(0x111)]);if(_0x42fbeb[_0x293907(0xfc)]===0x0)throw CliErrors[_0x293907(0xa9)](_0x293907(0xd1));const _0x4c4c2d=_0x42fbeb['map'](_0x1cd8f3=>_0x1cd8f3[_0x293907(0xcb)]+'\x20['+(_0x1cd8f3[_0x293907(0xe4)]??_0x293907(0xcc))+']\x20('+_0x1cd8f3['code']+')'),_0x3d9d48=await promptSelect('Select\x20dataset:',_0x4c4c2d),_0x57b26e=_0x42fbeb[_0x3d9d48];if(!_0x57b26e)throw CliErrors['validation']('Invalid\x20dataset\x20selection.');_0x2aea78=_0x57b26e[_0x293907(0x108)],_0x557dc2=undefined;}}}}const _0x4b9202=await listDatasets(_0x104876['appCode']),_0x1aa6bb=_0x4b9202['find'](_0x9e6c5c=>_0x9e6c5c[_0x293907(0x108)]===_0x2aea78);if(!_0x1aa6bb)throw CliErrors['validation'](_0x293907(0xd7)+_0x2aea78+_0x293907(0xfb)+(_0x557dc2?_0x293907(0x101)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x83f0eb=_0x1aa6bb['id'];const _0x348f89=_0x557dc2??_0x2aea78,_0xe80394=await listBffDatasetOperations(_0x104876[_0x293907(0x111)],_0x83f0eb),_0x1df325=_0xe80394?Object[_0x293907(0xc9)](_0xe80394):[];if(_0x1df325[_0x293907(0xfc)]===0x0)throw CliErrors[_0x293907(0xa9)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x348f89+'.');let _0x4167bd;const _0xa5fdc7=_0x104876['str'](_0x293907(0xc6));if(_0xa5fdc7){if(!_0x1df325[_0x293907(0xe7)](_0xa5fdc7))throw CliErrors[_0x293907(0xa9)](_0x293907(0xf5)+_0xa5fdc7+_0x293907(0x107)+_0x348f89+'.\x20'+(_0x293907(0x104)+_0x1df325[_0x293907(0xb4)](',\x20')));_0x4167bd=_0xa5fdc7;}else{if(_0x104876[_0x293907(0x109)])throw CliErrors[_0x293907(0xa9)](_0x293907(0xe8));const _0x590b27=await promptSelect(_0x293907(0xad),_0x1df325);_0x4167bd=_0x1df325[_0x590b27]??_0x1df325[0x0];}let _0x2f10c8=normalizeHookFunctionNode(_0x104876[_0x293907(0xee)](_0x293907(0xf0)));if(!_0x2f10c8){if(_0x104876['str']('function-node'))throw CliErrors[_0x293907(0xa9)](_0x293907(0xce));if(_0x104876['nonInteractive'])throw CliErrors[_0x293907(0xa9)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x20c009=await promptSelect(_0x293907(0xfe),[_0x293907(0xbb),_0x293907(0xb9)]);_0x2f10c8=[_0x293907(0xbb),_0x293907(0xb9)][_0x20c009]??_0x293907(0xbb);}return{'alias':_0x557dc2,'datasetCode':_0x2aea78,'datasetId':_0x83f0eb,'operationType':_0x4167bd,'functionNode':_0x2f10c8};}async function promptSelect(_0x12959b,_0x29bf6a){const _0x307ce2=a37_0x552261;if(_0x29bf6a['length']===0x1)return 0x0;for(const [_0x121982,_0x29a623]of _0x29bf6a['entries']()){process['stderr'][_0x307ce2(0xca)]('\x20\x20'+(_0x121982+0x1)+'.\x20'+_0x29a623+'\x0a');}const _0x4daa7d=createInterface({'input':process['stdin'],'output':process[_0x307ce2(0xbf)]});while(!![]){const _0x2dc43e=await new Promise(_0x11ed47=>{_0x4daa7d['question'](_0x12959b+'\x20',_0x11ed47);}),_0x51768e=Number[_0x307ce2(0xd2)](_0x2dc43e['trim'](),0xa);if(Number[_0x307ce2(0xec)](_0x51768e)&&_0x51768e>=0x1&&_0x51768e<=_0x29bf6a[_0x307ce2(0xfc)])return _0x4daa7d[_0x307ce2(0xd4)](),_0x51768e-0x1;process['stderr'][_0x307ce2(0xca)](_0x307ce2(0x115)+_0x29bf6a[_0x307ce2(0xfc)]+'.\x0a');}}function buildFilePath(_0x313efd,_0x295564,_0x3cf281,_0x16cb79){const _0x1f354a=a37_0x552261;if(_0x295564==='HOOK'){if(!_0x16cb79)throw CliErrors[_0x1f354a(0xa9)](_0x1f354a(0xdc));const _0x456bed=_0x16cb79[_0x1f354a(0xdf)]??_0x16cb79[_0x1f354a(0xb7)];return join(_0x313efd[_0x1f354a(0xf3)],_0x1f354a(0xf9),_0x456bed,_0x16cb79[_0x1f354a(0xc2)],_0x16cb79['functionNode'],_0x3cf281+_0x1f354a(0xb2));}return join(_0x313efd[_0x1f354a(0xf3)],_0x295564,_0x3cf281+_0x1f354a(0xb2));}export function generateTemplate(_0x414bd0,_0x32e863,_0x483eb1,_0x1c58bd,_0x35fbd4){const _0x3269b0=a37_0x552261,_0x2d8283=_0x1c58bd?.[_0x3269b0(0xdb)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x47695f=getAppBaseUrl(_0x483eb1),_0xd6c767=_0x3269b0(0xeb);if(_0x414bd0==='COMMON')return _0x3269b0(0xd5)+_0x2d8283+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x32e863+_0x3269b0(0xe2)+_0x47695f+_0x3269b0(0x100)+_0x483eb1+'/COMMON/'+_0x32e863+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x32e863+_0x3269b0(0xba)+_0xd6c767+_0x3269b0(0xef)+_0x32e863+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x414bd0===_0x3269b0(0x106))return _0x3269b0(0xd5)+_0x2d8283+_0x3269b0(0xcf)+_0x32e863+_0x3269b0(0x110)+_0x483eb1+'/'+_0x32e863+_0x3269b0(0xe2)+_0x47695f+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x483eb1+_0x3269b0(0x10e)+_0x32e863+_0x3269b0(0xf2)+_0xd6c767+_0x3269b0(0xc0)+_0x32e863+_0x3269b0(0xbd);if(!_0x35fbd4)throw CliErrors[_0x3269b0(0xa9)](_0x3269b0(0xab));const _0xdc5b97=_0x35fbd4[_0x3269b0(0xdf)]??_0x35fbd4[_0x3269b0(0xb7)],_0x5d9d1a=_0x35fbd4[_0x3269b0(0x10a)]===_0x3269b0(0xbb)?_0x3269b0(0xe1):_0x3269b0(0xea),_0xeba16=_0x35fbd4[_0x3269b0(0x10a)]===_0x3269b0(0xbb)?_0x3269b0(0xf6):_0x3269b0(0x114);return _0x3269b0(0xd5)+_0x2d8283+_0x3269b0(0xd8)+_0x32e863+_0x3269b0(0x10f)+_0x483eb1+'/'+_0x35fbd4[_0x3269b0(0xb7)]+'/'+_0x35fbd4[_0x3269b0(0xc2)]+_0x3269b0(0xe2)+_0x47695f+_0x3269b0(0xa8)+_0x35fbd4['datasetId']+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x483eb1+'/HOOK/'+_0xdc5b97+'/'+_0x35fbd4['operationType']+'/'+_0x35fbd4[_0x3269b0(0x10a)]+'/'+_0x32e863+'.js\x0a\x20*\x20[触发节点]\x20'+_0x35fbd4['functionNode']+'\x0a'+_0xd6c767+_0x3269b0(0xd0)+_0x5d9d1a+_0x3269b0(0xc8)+_0xeba16+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x32e863+_0x3269b0(0xbd);}
|
|
1
|
+
function a37_0xe783(){const _0x23ef07=['No\x20operation\x20types\x20found\x20for\x20dataset\x20','datasetcode','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x22.\x20','profileName','operationType','\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','question','\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','Invalid\x20dataset\x20selection.','currentApp','function-node','filePath','4wIlyzI','Available:\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','includes','1146pxiocV','before','mergedCli','Operation\x20type\x20(HOOK\x20only)','Invalid\x20function\x20name\x20\x22','selectedAppName','str','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','description','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','parseInt','HOOK\x20requires\x20alias/operation/node\x20options.','alias','nonInteractive','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','/ENDPOINT/','utf8','No\x20datasets\x20found\x20for\x20this\x20app.','39659rkaimC','name','\x0a\x20*\x20[平台配置]\x20','2465UkpkAc','/HOOK/','Operation\x20type\x20\x22','修改后的响应结果','\x22\x20not\x20found.\x20','Script\x20type','File\x20already\x20exists:\x20','10lQorvP','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','find','627603bfVeQB','type','1887743QhblbB','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','datasetCode','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','defaultApp','220806nofsVx','Select\x20operation\x20type:','bff','stderr','trim','8BzaQdD',']\x20(','functionNode','Alias\x20\x22','source','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','string','\x22,\x20params\x20})\x0a','UNKNOWN','apiDir','Select\x20dataset:','No\x20model\x20aliases\x20found.\x20Run\x20`','ENDPOINT','Select\x20trigger\x20node:','length','\x20api\x20pull`\x20to\x20refresh.','COMMON','.js\x0a','write','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','.js\x0a\x20*\x20[触发节点]\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','after','HOOK','/**\x0a\x20*\x20','operation-type','stdin','isInteger','1700930aOCSKI','Trigger\x20node\x20(HOOK\x20only)','join','code','scriptsRootDir','当前请求参数','validation','datasetId','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','/data/dataset/','appCode','map','418800DsnYJg','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a'];a37_0xe783=function(){return _0x23ef07;};return a37_0xe783();}const a37_0x5761c5=a37_0x57a4;(function(_0x558a0e,_0x515c60){const _0x2a7d71=a37_0x57a4,_0x47aade=_0x558a0e();while(!![]){try{const _0x14be57=-parseInt(_0x2a7d71(0x174))/0x1*(parseInt(_0x2a7d71(0x18f))/0x2)+parseInt(_0x2a7d71(0x181))/0x3*(-parseInt(_0x2a7d71(0x15e))/0x4)+parseInt(_0x2a7d71(0x177))/0x5*(parseInt(_0x2a7d71(0x162))/0x6)+parseInt(_0x2a7d71(0x142))/0x7+parseInt(_0x2a7d71(0x14f))/0x8+-parseInt(_0x2a7d71(0x18a))/0x9+-parseInt(_0x2a7d71(0x17e))/0xa*(-parseInt(_0x2a7d71(0x183))/0xb);if(_0x14be57===_0x515c60)break;else _0x47aade['push'](_0x47aade['shift']());}catch(_0x238516){_0x47aade['push'](_0x47aade['shift']());}}}(a37_0xe783,0x29329));function a37_0x57a4(_0x5e805d,_0x3a946a){_0x5e805d=_0x5e805d-0x138;const _0xe7831a=a37_0xe783();let _0x57a43d=_0xe7831a[_0x5e805d];return _0x57a43d;}import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x5761c5(0x18c),'command':'create','description':a37_0x5761c5(0x14b),'risk':'read','flags':[{'name':'type','type':a37_0x5761c5(0x195),'required':!![],'enum':[a37_0x5761c5(0x19f),a37_0x5761c5(0x19b),a37_0x5761c5(0x13d)],'description':a37_0x5761c5(0x17c)},{'name':a37_0x5761c5(0x175),'type':a37_0x5761c5(0x195),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x5761c5(0x16a),'type':a37_0x5761c5(0x195),'description':'Script\x20description'},{'name':a37_0x5761c5(0x16e),'type':a37_0x5761c5(0x195),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':'datasetcode','type':a37_0x5761c5(0x195),'description':a37_0x5761c5(0x16b)},{'name':a37_0x5761c5(0x13f),'type':a37_0x5761c5(0x195),'description':a37_0x5761c5(0x165)},{'name':'function-node','type':a37_0x5761c5(0x195),'description':a37_0x5761c5(0x143),'enum':[a37_0x5761c5(0x163),a37_0x5761c5(0x13c)]}],async 'validate'(_0x425807){const _0x31b17a=a37_0x5761c5,_0x1a070f=_0x425807[_0x31b17a(0x168)](_0x31b17a(0x175));if(!isValidBffFunctionName(_0x1a070f))throw CliErrors['validation'](_0x31b17a(0x166)+_0x1a070f+_0x31b17a(0x160));},async 'execute'(_0x48d37a){const _0x38386e=a37_0x5761c5,_0x251312=loadBffProjectConfig(_0x48d37a[_0x38386e(0x14d)]),_0x306a3e=_0x48d37a[_0x38386e(0x168)](_0x38386e(0x182)),_0x379d63=_0x48d37a[_0x38386e(0x168)]('name'),_0x2832b3=_0x48d37a[_0x38386e(0x168)](_0x38386e(0x16a))||undefined,_0x3686cd=_0x306a3e==='HOOK'?await resolveHookOptions(_0x251312,_0x48d37a):undefined,_0x168870=buildFilePath(_0x251312,_0x306a3e,_0x379d63,_0x3686cd);if(await fileExists(_0x168870))throw CliErrors[_0x38386e(0x148)](_0x38386e(0x17d)+_0x168870);await mkdir(dirname(_0x168870),{'recursive':!![]});const _0x40844b=generateTemplate(_0x306a3e,_0x379d63,_0x48d37a[_0x38386e(0x14d)],_0x2832b3,_0x3686cd);await writeFile(_0x168870,_0x40844b,_0x38386e(0x172));const _0x367fdd={'type':_0x306a3e,'name':_0x379d63,'path':_0x168870};if(_0x2832b3)_0x367fdd[_0x38386e(0x16a)]=_0x2832b3;if(_0x3686cd){if(_0x3686cd[_0x38386e(0x16e)])_0x367fdd[_0x38386e(0x16e)]=_0x3686cd[_0x38386e(0x16e)];_0x367fdd[_0x38386e(0x186)]=_0x3686cd[_0x38386e(0x186)],_0x367fdd['operationType']=_0x3686cd['operationType'],_0x367fdd[_0x38386e(0x191)]=_0x3686cd[_0x38386e(0x191)];}return{'ok':!![],'data':_0x367fdd,'message':'Created\x20'+_0x306a3e+'\x20function:\x20'+_0x379d63};}};async function resolveHookOptions(_0xcbe232,_0x24538b){const _0xd4bbcc=a37_0x5761c5,_0x59b50f=resolveApiModelSource(_0x24538b[_0xd4bbcc(0x198)],_0x24538b['appCode'],_0x24538b[_0xd4bbcc(0x167)]||_0x24538b[_0xd4bbcc(0x164)]?.[_0xd4bbcc(0x15b)]||_0x24538b[_0xd4bbcc(0x164)]?.[_0xd4bbcc(0x189)]),_0x17da86=loadAliasMap(_0x24538b[_0xd4bbcc(0x198)],undefined,_0x59b50f[_0xd4bbcc(0x15d)],_0x59b50f[_0xd4bbcc(0x155)]),_0x30e3c9=_0x17da86[_0xd4bbcc(0x19d)]>0x0;let _0x475e6f,_0x1616bd,_0x56510e;const _0x1c2f6b=_0x24538b[_0xd4bbcc(0x168)](_0xd4bbcc(0x16e)),_0x52f049=_0x24538b['str'](_0xd4bbcc(0x152));if(_0x1c2f6b){const _0x59d9d4=resolveAlias(_0x24538b['apiDir'],_0x1c2f6b,undefined,_0x59b50f[_0xd4bbcc(0x15d)],_0x59b50f['profileName']);if(!_0x59d9d4){const _0x496b06=_0x30e3c9?'Available\x20aliases:\x20'+_0x17da86[_0xd4bbcc(0x14e)](_0x8b0558=>_0x8b0558['alias'])[_0xd4bbcc(0x144)](',\x20'):_0xd4bbcc(0x19a)+CLI_BIN_NAME+_0xd4bbcc(0x138);throw CliErrors['validation'](_0xd4bbcc(0x192)+_0x1c2f6b+_0xd4bbcc(0x17b)+_0x496b06);}_0x475e6f=_0x1c2f6b,_0x1616bd=_0x59d9d4;}else{if(_0x52f049){_0x1616bd=_0x52f049;const _0x43551b=_0x17da86[_0xd4bbcc(0x180)](_0x25ef1b=>_0x25ef1b['datasetCode']===_0x52f049);_0x475e6f=_0x43551b?.['alias'];}else{if(_0x24538b['nonInteractive'])throw CliErrors[_0xd4bbcc(0x148)](_0xd4bbcc(0x194));else{if(_0x30e3c9){const _0x4fae2a=_0x17da86['map'](_0x453429=>_0x453429[_0xd4bbcc(0x16e)]+'\x20('+_0x453429['tableName']+')'),_0x113064=await promptSelect(_0xd4bbcc(0x199),_0x4fae2a),_0x1bf2ab=_0x17da86[_0x113064];if(!_0x1bf2ab)throw CliErrors[_0xd4bbcc(0x148)](_0xd4bbcc(0x15a));_0x475e6f=_0x1bf2ab['alias'],_0x1616bd=_0x1bf2ab[_0xd4bbcc(0x186)];}else{const _0x3e4ed3=await listDatasets(_0x24538b[_0xd4bbcc(0x14d)]);if(_0x3e4ed3[_0xd4bbcc(0x19d)]===0x0)throw CliErrors[_0xd4bbcc(0x148)](_0xd4bbcc(0x173));const _0x4a90e6=_0x3e4ed3[_0xd4bbcc(0x14e)](_0x38b43e=>_0x38b43e[_0xd4bbcc(0x175)]+'\x20['+(_0x38b43e[_0xd4bbcc(0x193)]??_0xd4bbcc(0x197))+_0xd4bbcc(0x190)+_0x38b43e['code']+')'),_0x25cc83=await promptSelect(_0xd4bbcc(0x199),_0x4a90e6),_0x59b202=_0x3e4ed3[_0x25cc83];if(!_0x59b202)throw CliErrors[_0xd4bbcc(0x148)](_0xd4bbcc(0x15a));_0x1616bd=_0x59b202[_0xd4bbcc(0x145)],_0x475e6f=undefined;}}}}const _0x28b735=await listDatasets(_0x24538b[_0xd4bbcc(0x14d)]),_0x3d315f=_0x28b735['find'](_0x22b01c=>_0x22b01c[_0xd4bbcc(0x145)]===_0x1616bd);if(!_0x3d315f)throw CliErrors[_0xd4bbcc(0x148)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x1616bd+_0xd4bbcc(0x154)+(_0x475e6f?_0xd4bbcc(0x188)+CLI_BIN_NAME+_0xd4bbcc(0x19e):''));_0x56510e=_0x3d315f['id'];const _0xb1755=_0x475e6f??_0x1616bd,_0x59dc90=await listBffDatasetOperations(_0x24538b[_0xd4bbcc(0x14d)],_0x56510e),_0x1adeec=_0x59dc90?Object['keys'](_0x59dc90):[];if(_0x1adeec['length']===0x0)throw CliErrors[_0xd4bbcc(0x148)](_0xd4bbcc(0x151)+_0xb1755+'.');let _0xd4da77;const _0x34eefc=_0x24538b[_0xd4bbcc(0x168)](_0xd4bbcc(0x13f));if(_0x34eefc){if(!_0x1adeec[_0xd4bbcc(0x161)](_0x34eefc))throw CliErrors['validation'](_0xd4bbcc(0x179)+_0x34eefc+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0xb1755+'.\x20'+(_0xd4bbcc(0x15f)+_0x1adeec['join'](',\x20')));_0xd4da77=_0x34eefc;}else{if(_0x24538b[_0xd4bbcc(0x16f)])throw CliErrors[_0xd4bbcc(0x148)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x441082=await promptSelect(_0xd4bbcc(0x18b),_0x1adeec);_0xd4da77=_0x1adeec[_0x441082]??_0x1adeec[0x0];}let _0x21f08d=normalizeHookFunctionNode(_0x24538b[_0xd4bbcc(0x168)]('function-node'));if(!_0x21f08d){if(_0x24538b[_0xd4bbcc(0x168)](_0xd4bbcc(0x15c)))throw CliErrors['validation']('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x24538b['nonInteractive'])throw CliErrors[_0xd4bbcc(0x148)](_0xd4bbcc(0x184));const _0xb723e8=await promptSelect(_0xd4bbcc(0x19c),[_0xd4bbcc(0x163),_0xd4bbcc(0x13c)]);_0x21f08d=[_0xd4bbcc(0x163),_0xd4bbcc(0x13c)][_0xb723e8]??_0xd4bbcc(0x163);}return{'alias':_0x475e6f,'datasetCode':_0x1616bd,'datasetId':_0x56510e,'operationType':_0xd4da77,'functionNode':_0x21f08d};}async function promptSelect(_0xb3a7ae,_0x1af447){const _0x220ae9=a37_0x5761c5;if(_0x1af447[_0x220ae9(0x19d)]===0x1)return 0x0;for(const [_0x3a2db3,_0x28838a]of _0x1af447['entries']()){process[_0x220ae9(0x18d)][_0x220ae9(0x1a1)]('\x20\x20'+(_0x3a2db3+0x1)+'.\x20'+_0x28838a+'\x0a');}const _0x3ae477=createInterface({'input':process[_0x220ae9(0x140)],'output':process[_0x220ae9(0x18d)]});while(!![]){const _0x37b8ee=await new Promise(_0x26a2a6=>{const _0x5eea6a=_0x220ae9;_0x3ae477[_0x5eea6a(0x158)](_0xb3a7ae+'\x20',_0x26a2a6);}),_0x238136=Number[_0x220ae9(0x16c)](_0x37b8ee['trim'](),0xa);if(Number[_0x220ae9(0x141)](_0x238136)&&_0x238136>=0x1&&_0x238136<=_0x1af447[_0x220ae9(0x19d)])return _0x3ae477['close'](),_0x238136-0x1;process[_0x220ae9(0x18d)][_0x220ae9(0x1a1)]('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x1af447[_0x220ae9(0x19d)]+'.\x0a');}}function buildFilePath(_0xd7824e,_0xd36f64,_0x39ec36,_0x413527){const _0x11594a=a37_0x5761c5;if(_0xd36f64===_0x11594a(0x13d)){if(!_0x413527)throw CliErrors[_0x11594a(0x148)](_0x11594a(0x16d));const _0x430672=_0x413527[_0x11594a(0x16e)]??_0x413527[_0x11594a(0x186)];return join(_0xd7824e['scriptsRootDir'],_0x11594a(0x13d),_0x430672,_0x413527['operationType'],_0x413527[_0x11594a(0x191)],_0x39ec36+'.js');}return join(_0xd7824e[_0x11594a(0x146)],_0xd36f64,_0x39ec36+'.js');}export function generateTemplate(_0xd09403,_0x4a6c12,_0x1ad523,_0x428bba,_0x138290){const _0x514767=a37_0x5761c5,_0x54e04d=_0x428bba?.[_0x514767(0x18e)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3260c2=getAppBaseUrl(_0x1ad523),_0x5bf9dc=_0x514767(0x170);if(_0xd09403===_0x514767(0x19f))return'/**\x0a\x20*\x20'+_0x54e04d+_0x514767(0x17f)+_0x4a6c12+_0x514767(0x176)+_0x3260c2+'/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x1ad523+'/COMMON/'+_0x4a6c12+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x4a6c12+_0x514767(0x196)+_0x5bf9dc+_0x514767(0x157)+_0x4a6c12+_0x514767(0x150);if(_0xd09403==='ENDPOINT')return _0x514767(0x13e)+_0x54e04d+_0x514767(0x13b)+_0x4a6c12+_0x514767(0x14a)+_0x1ad523+'/'+_0x4a6c12+_0x514767(0x176)+_0x3260c2+_0x514767(0x169)+_0x1ad523+_0x514767(0x171)+_0x4a6c12+_0x514767(0x1a0)+_0x5bf9dc+_0x514767(0x159)+_0x4a6c12+_0x514767(0x150);if(!_0x138290)throw CliErrors[_0x514767(0x148)](_0x514767(0x185));const _0x350b6b=_0x138290[_0x514767(0x16e)]??_0x138290[_0x514767(0x186)],_0x514742=_0x138290[_0x514767(0x191)]===_0x514767(0x163)?_0x514767(0x147):'当前响应结果',_0x2f5f0e=_0x138290[_0x514767(0x191)]==='before'?'修改后的请求参数':_0x514767(0x17a);return _0x514767(0x13e)+_0x54e04d+_0x514767(0x153)+_0x4a6c12+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x1ad523+'/'+_0x138290[_0x514767(0x186)]+'/'+_0x138290['operationType']+_0x514767(0x176)+_0x3260c2+_0x514767(0x14c)+_0x138290[_0x514767(0x149)]+_0x514767(0x139)+_0x1ad523+_0x514767(0x178)+_0x350b6b+'/'+_0x138290[_0x514767(0x156)]+'/'+_0x138290['functionNode']+'/'+_0x4a6c12+_0x514767(0x13a)+_0x138290['functionNode']+'\x0a'+_0x5bf9dc+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x514742+_0x514767(0x187)+_0x2f5f0e+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0x4a6c12+_0x514767(0x150);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x10416a=a38_0x388c;(function(_0x3f3b29,_0x39e7f7){const _0x4fdd08=a38_0x388c,_0x47511e=_0x3f3b29();while(!![]){try{const _0x46194b=-parseInt(_0x4fdd08(0x1c5))/0x1*(parseInt(_0x4fdd08(0x1e4))/0x2)+parseInt(_0x4fdd08(0x1c7))/0x3+parseInt(_0x4fdd08(0x1af))/0x4*(parseInt(_0x4fdd08(0x1cd))/0x5)+-parseInt(_0x4fdd08(0x1bc))/0x6*(parseInt(_0x4fdd08(0x1db))/0x7)+parseInt(_0x4fdd08(0x1d0))/0x8+parseInt(_0x4fdd08(0x1e1))/0x9*(parseInt(_0x4fdd08(0x1ca))/0xa)+parseInt(_0x4fdd08(0x1d1))/0xb;if(_0x46194b===_0x39e7f7)break;else _0x47511e['push'](_0x47511e['shift']());}catch(_0x220220){_0x47511e['push'](_0x47511e['shift']());}}}(a38_0x2647,0xc4583));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';function a38_0x388c(_0x4c9cb4,_0x3024cd){_0x4c9cb4=_0x4c9cb4-0x1ac;const _0x2647b8=a38_0x2647();let _0x388c1c=_0x2647b8[_0x4c9cb4];return _0x388c1c;}function a38_0x2647(){const _0x10b75a=['includes','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','<timestamp>','find','replace','1ZwyJfL','POST','4521168OOFHCx','Multiple\x20functions\x20match\x20\x22','No\x20lock\x20entry\x20found\x20for\x20\x22','3690fhkLIE','functions','toISOString','2180DJrpWR','scriptsRoot','str','6170936bzbOyQ','4673339RPuuAV','validation','scriptsRootDir','target','stringify','length','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','/api/management/library/scripts/delete','projectRoot','startsWith','157367jnLhPd','delete','appCode','\x20\x20-\x20','lastSync','map','9063QkOaaQ','remoteId','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','2717870vuLtbQ','lockFilePath','apps','Backend\x20Function\x20lock\x20file\x20not\x20found.','92kwLjju','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','high-risk-write','\x20(local\x20file\x20moved\x20to\x20trash)','filter','\x22\x20not\x20found\x20after\x20ensureLockScope.','join','Would\x20delete\x20','trashDir','Function\x20not\x20found:\x20','Lock\x20scope\x20for\x20app\x20\x22','keys','string','246TxaeMW','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','Deleted\x20','bff'];a38_0x2647=function(){return _0x10b75a;};return a38_0x2647();}export const bffDelete={'service':a38_0x10416a(0x1bf),'command':a38_0x10416a(0x1dc),'description':a38_0x10416a(0x1e3),'risk':a38_0x10416a(0x1b1),'flags':[{'name':a38_0x10416a(0x1d4),'type':a38_0x10416a(0x1bb),'required':!![],'description':a38_0x10416a(0x1d7)}],async 'validate'(_0x45455b){const _0x2e1e4d=a38_0x10416a,_0x6a7b6f=loadBffProjectConfig(_0x45455b[_0x2e1e4d(0x1dd)]),_0x47c89d=await readBffLockFile(_0x6a7b6f[_0x2e1e4d(0x1ac)]);if(!_0x47c89d)throw CliErrors[_0x2e1e4d(0x1d2)](_0x2e1e4d(0x1c1));},async 'dryRun'(_0x1c72b1){const _0x3057db=a38_0x10416a,_0x41da75=loadBffProjectConfig(_0x1c72b1[_0x3057db(0x1dd)]),_0x1a7a34=await readBffLockFile(_0x41da75[_0x3057db(0x1ac)]);if(!_0x1a7a34)throw CliErrors['validation'](_0x3057db(0x1ae));const {appLock:_0x171290}=ensureLockScope(_0x1a7a34,_0x1c72b1[_0x3057db(0x1dd)],_0x41da75['scriptsRoot'],_0x3057db(0x1dc)),_0x4f0968=_0x1c72b1[_0x3057db(0x1cf)](_0x3057db(0x1d4)),_0x413713=Object[_0x3057db(0x1ba)](_0x171290['functions']),_0x30aad1=resolveDeleteTarget(_0x4f0968,_0x413713),_0x19ed48=_0x171290[_0x3057db(0x1cb)][_0x30aad1];if(!_0x19ed48)throw CliErrors['validation'](_0x3057db(0x1c9)+_0x30aad1+'\x22.');const _0x3efe92=resolveLocalFilePathFromLockKey(_0x41da75,_0x30aad1),_0x5230ce=relative(_0x41da75[_0x3057db(0x1d9)],_0x3efe92),_0x54d02e=join(_0x41da75['trashDir'],_0x3057db(0x1c2),_0x5230ce);return{'method':_0x3057db(0x1c6),'url':_0x3057db(0x1d8),'body':{'appCode':_0x1c72b1[_0x3057db(0x1dd)],'target':_0x30aad1,'remoteId':_0x19ed48['remoteId'],'localFilePath':_0x3efe92,'trashedPath':_0x54d02e},'description':_0x3057db(0x1b6)+_0x30aad1+_0x3057db(0x1b0)};},async 'execute'(_0x1c0853){const _0x4dcf56=a38_0x10416a,_0x516e7f=loadBffProjectConfig(_0x1c0853[_0x4dcf56(0x1dd)]),_0x9b812a=await readBffLockFile(_0x516e7f['lockFilePath']);if(!_0x9b812a)throw CliErrors[_0x4dcf56(0x1d2)](_0x4dcf56(0x1ae));const {lockData:_0x924f69,appLock:_0x2d56dc}=ensureLockScope(_0x9b812a,_0x1c0853[_0x4dcf56(0x1dd)],_0x516e7f[_0x4dcf56(0x1ce)],'delete'),_0x5a6d4c=JSON['parse'](JSON[_0x4dcf56(0x1d5)](_0x924f69)),_0x4579a1=_0x5a6d4c[_0x4dcf56(0x1ad)][_0x1c0853[_0x4dcf56(0x1dd)]];if(!_0x4579a1)throw new Error(_0x4dcf56(0x1b9)+_0x1c0853[_0x4dcf56(0x1dd)]+_0x4dcf56(0x1b4));const _0x14e39d=_0x1c0853[_0x4dcf56(0x1cf)](_0x4dcf56(0x1d4)),_0x144336=Object['keys'](_0x4579a1[_0x4dcf56(0x1cb)]),_0x4c4db6=resolveDeleteTarget(_0x14e39d,_0x144336),_0x5ef44e=_0x4579a1[_0x4dcf56(0x1cb)][_0x4c4db6];if(!_0x5ef44e)throw CliErrors[_0x4dcf56(0x1d2)](_0x4dcf56(0x1c9)+_0x4c4db6+'\x22.');await deleteBffScript(_0x5ef44e[_0x4dcf56(0x1e2)]),delete _0x4579a1[_0x4dcf56(0x1cb)][_0x4c4db6],_0x4579a1[_0x4dcf56(0x1df)]=new Date()[_0x4dcf56(0x1cc)](),await writeBffLockFile(_0x516e7f[_0x4dcf56(0x1ac)],_0x5a6d4c);const _0x116048=resolveLocalFilePathFromLockKey(_0x516e7f,_0x4c4db6);let _0x4aeeed;await fileExists(_0x116048)&&(_0x4aeeed=await moveToTrash(_0x516e7f[_0x4dcf56(0x1d9)],_0x516e7f[_0x4dcf56(0x1b7)],_0x116048),await cleanupEmptyDirectories(dirname(_0x116048),_0x516e7f[_0x4dcf56(0x1d3)]));await waitForDeleteSettlement(_0x516e7f[_0x4dcf56(0x1ac)],_0x1c0853[_0x4dcf56(0x1dd)],_0x4c4db6,_0x116048),await sleep(0x96);const _0x2d91b7={'deleted':_0x4c4db6,'remoteId':_0x5ef44e[_0x4dcf56(0x1e2)]};if(_0x4aeeed)_0x2d91b7['trashedTo']=_0x4aeeed;return{'ok':!![],'data':_0x2d91b7,'message':_0x4dcf56(0x1be)+_0x4c4db6+(_0x4aeeed?_0x4dcf56(0x1b2):'')};}};function resolveDeleteTarget(_0x129f1d,_0x4a68c5){const _0xeb44ee=a38_0x10416a;if(_0x129f1d[_0xeb44ee(0x1c0)]('/')){const _0x5bd4cf=_0x4a68c5[_0xeb44ee(0x1c3)](_0x3c6a3d=>_0x3c6a3d===_0x129f1d);if(!_0x5bd4cf)throw CliErrors[_0xeb44ee(0x1d2)](_0xeb44ee(0x1b8)+_0x129f1d);return _0x5bd4cf;}const _0x49694e=_0x4a68c5[_0xeb44ee(0x1b3)](_0x320e31=>_0x320e31['split']('/')['at'](-0x1)===_0x129f1d);if(_0x49694e[_0xeb44ee(0x1d6)]===0x0)throw CliErrors[_0xeb44ee(0x1d2)](_0xeb44ee(0x1b8)+_0x129f1d);if(_0x49694e[_0xeb44ee(0x1d6)]>0x1)throw CliErrors['validation'](_0xeb44ee(0x1c8)+_0x129f1d+_0xeb44ee(0x1bd)+_0x49694e[_0xeb44ee(0x1e0)](_0x40efd2=>_0xeb44ee(0x1de)+_0x40efd2)[_0xeb44ee(0x1b5)]('\x0a'));return _0x49694e[0x0];}async function moveToTrash(_0x1a2a03,_0x18ce88,_0x44be61){const _0x571050=a38_0x10416a,_0x31910e=new Date()[_0x571050(0x1cc)]()[_0x571050(0x1c4)](/[:.]/g,'-'),_0x486335=relative(_0x1a2a03,_0x44be61),_0x28d609=join(_0x18ce88,_0x31910e,_0x486335);return await mkdir(dirname(_0x28d609),{'recursive':!![]}),await rename(_0x44be61,_0x28d609),_0x28d609;}async function cleanupEmptyDirectories(_0x43cc2e,_0x5b2af9){const _0xc08403=a38_0x10416a;let _0x49363d=resolve(_0x43cc2e);const _0x5c65bf=resolve(_0x5b2af9);while(_0x49363d[_0xc08403(0x1da)](''+_0x5c65bf+sep)||_0x49363d===_0x5c65bf){if(_0x49363d===_0x5c65bf)return;try{const _0x2efaa2=await readdir(_0x49363d);if(_0x2efaa2['length']>0x0)return;await rmdir(_0x49363d);}catch{return;}_0x49363d=dirname(_0x49363d);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0xede9fd,_0x4befed,_0xbf4c91,_0x5e5959){const _0x1f417e=a38_0x10416a;for(let _0x25df4e=0x0;_0x25df4e<DELETE_SETTLE_RETRY_COUNT;_0x25df4e+=0x1){const _0xbbabf6=await readBffLockFile(_0xede9fd),_0x19dde7=!!_0xbbabf6?.[_0x1f417e(0x1ad)]?.[_0x4befed]?.[_0x1f417e(0x1cb)]?.[_0xbf4c91],_0x4a933f=await fileExists(_0x5e5959);if(!_0x19dde7&&!_0x4a933f)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0xbf4c91+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x309626=a39_0x1e62;function a39_0x1b78(){const _0x15f5e8=['8708985ezlqmJ','appCode','detail','bff','277854vLGrcX','createdTime','scriptType','20mlKtug','12197383nIGkLf','1514229SJEIhU','description','num','68iOvYqb','(none)','boolean','36srGYnk','read','verbose','version','11578qYeGrp','Script\x20ID','8728320sGDEmT','8bUxHsu','updatedTime','203bxSqXg','54305qQwZGk','functionName'];a39_0x1b78=function(){return _0x15f5e8;};return a39_0x1b78();}(function(_0xcb69f9,_0x2ccea5){const _0x3e849b=a39_0x1e62,_0x2f5049=_0xcb69f9();while(!![]){try{const _0x545e44=-parseInt(_0x3e849b(0x1fb))/0x1*(parseInt(_0x3e849b(0x202))/0x2)+-parseInt(_0x3e849b(0x1f8))/0x3+-parseInt(_0x3e849b(0x1f6))/0x4*(parseInt(_0x3e849b(0x208))/0x5)+-parseInt(_0x3e849b(0x1f3))/0x6*(parseInt(_0x3e849b(0x207))/0x7)+parseInt(_0x3e849b(0x205))/0x8*(-parseInt(_0x3e849b(0x20a))/0x9)+parseInt(_0x3e849b(0x204))/0xa+-parseInt(_0x3e849b(0x1f7))/0xb*(-parseInt(_0x3e849b(0x1fe))/0xc);if(_0x545e44===_0x2ccea5)break;else _0x2f5049['push'](_0x2f5049['shift']());}catch(_0x5ce4d9){_0x2f5049['push'](_0x2f5049['shift']());}}}(a39_0x1b78,0xe4881));import{getBffScriptInfo}from'../../core/api-client.js';function a39_0x1e62(_0x12b9a2,_0x22b0e4){_0x12b9a2=_0x12b9a2-0x1f0;const _0x1b784a=a39_0x1b78();let _0x1e62d9=_0x1b784a[_0x12b9a2];return _0x1e62d9;}export const bffDetail={'service':a39_0x309626(0x1f2),'command':a39_0x309626(0x1f1),'description':'Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','risk':a39_0x309626(0x1ff),'flags':[{'name':'id','type':'number','required':!![],'description':a39_0x309626(0x203)},{'name':a39_0x309626(0x200),'type':a39_0x309626(0x1fd),'description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x2ddd28){const _0xf53d99=a39_0x309626,_0xd87b80=await getBffScriptInfo(_0x2ddd28[_0xf53d99(0x1fa)]('id')),_0x116dbe=_0x2ddd28['bool'](_0xf53d99(0x200));if(_0x116dbe)return{'ok':!![],'data':_0xd87b80};return{'ok':!![],'data':{'id':_0xd87b80['id'],'functionName':_0xd87b80[_0xf53d99(0x209)]??'','version':_0xd87b80[_0xf53d99(0x201)]??'','updateUserName':_0xd87b80['updateUserName']??'','appCode':_0xd87b80[_0xf53d99(0x1f0)],'scriptType':_0xd87b80[_0xf53d99(0x1f5)],'description':_0xd87b80[_0xf53d99(0x1f9)]||_0xf53d99(0x1fc),'createdTime':_0xd87b80[_0xf53d99(0x1f4)]??'','updatedTime':_0xd87b80[_0xf53d99(0x206)]??'','scriptContent':_0xd87b80['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x59816a,_0x454e63){const _0x552e72=a40_0x275c,_0x2bc0ef=_0x59816a();while(!![]){try{const _0x1f09e3=-parseInt(_0x552e72(0x1d4))/0x1+-parseInt(_0x552e72(0x1d8))/0x2+-parseInt(_0x552e72(0x1d5))/0x3*(parseInt(_0x552e72(0x1d3))/0x4)+parseInt(_0x552e72(0x1d9))/0x5+parseInt(_0x552e72(0x1d2))/0x6+parseInt(_0x552e72(0x1d6))/0x7+-parseInt(_0x552e72(0x1da))/0x8*(-parseInt(_0x552e72(0x1d7))/0x9);if(_0x1f09e3===_0x454e63)break;else _0x2bc0ef['push'](_0x2bc0ef['shift']());}catch(_0x21279b){_0x2bc0ef['push'](_0x2bc0ef['shift']());}}}(a40_0x2fc3,0x9b96b));function a40_0x275c(_0xbe7a7c,_0x597c75){_0xbe7a7c=_0xbe7a7c-0x1d2;const _0x2fc3f6=a40_0x2fc3();let _0x275c60=_0x2fc3f6[_0xbe7a7c];return _0x275c60;}function a40_0x2fc3(){const _0x4d2fa4=['54552jQFJqQ','4081296cvHryU','2552792PfWtJm','885265cwVhNy','3oswbBU','1182426DXaFVf','2682UvVLfw','1556960HSLfuZ','290190rUeBKw'];a40_0x2fc3=function(){return _0x4d2fa4;};return a40_0x2fc3();}import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';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
|
-
function
|
|
1
|
+
const a41_0x3e38af=a41_0x5d81;function a41_0x5d81(_0x4ec5af,_0x31e03f){_0x4ec5af=_0x4ec5af-0x13c;const _0x157dd5=a41_0x157d();let _0x5d8191=_0x157dd5[_0x4ec5af];return _0x5d8191;}(function(_0x287487,_0x131555){const _0x4b7d72=a41_0x5d81,_0x3ed365=_0x287487();while(!![]){try{const _0x453219=parseInt(_0x4b7d72(0x157))/0x1*(-parseInt(_0x4b7d72(0x144))/0x2)+parseInt(_0x4b7d72(0x13f))/0x3+-parseInt(_0x4b7d72(0x155))/0x4*(parseInt(_0x4b7d72(0x152))/0x5)+-parseInt(_0x4b7d72(0x147))/0x6+-parseInt(_0x4b7d72(0x13d))/0x7+-parseInt(_0x4b7d72(0x13e))/0x8+-parseInt(_0x4b7d72(0x14d))/0x9*(-parseInt(_0x4b7d72(0x154))/0xa);if(_0x453219===_0x131555)break;else _0x3ed365['push'](_0x3ed365['shift']());}catch(_0x5edf47){_0x3ed365['push'](_0x3ed365['shift']());}}}(a41_0x157d,0xab2f8));function a41_0x157d(){const _0x487bab=['9649496lJIEUm','4027509ZpaYLy','List\x20Backend\x20Function\x20scripts','read','appCode','verbose','680698LNuFKY','bff','COMMON','908178jLIXmT','boolean','Filter\x20by\x20script\x20name','string','bool','(unnamed)','34022799oxeJIM','str','description','length','ENDPOINT','6324940AAwTJO','list','10KRUCrq','4AmBPFy','type','2delrwU','Return\x20full\x20script\x20objects','name','functionName','map','Script\x20type\x20filter','7828814ItfZcW'];a41_0x157d=function(){return _0x487bab;};return a41_0x157d();}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x3e38af(0x145),'command':a41_0x3e38af(0x153),'description':a41_0x3e38af(0x140),'risk':a41_0x3e38af(0x141),'flags':[{'name':a41_0x3e38af(0x156),'type':a41_0x3e38af(0x14a),'description':a41_0x3e38af(0x13c),'default':'ENDPOINT','enum':[a41_0x3e38af(0x151),a41_0x3e38af(0x146)]},{'name':a41_0x3e38af(0x159),'type':a41_0x3e38af(0x14a),'description':a41_0x3e38af(0x149)},{'name':a41_0x3e38af(0x143),'type':a41_0x3e38af(0x148),'description':a41_0x3e38af(0x158)}],async 'execute'(_0x2ca714){const _0x4f630b=a41_0x3e38af,_0x1233f9=await listBffScripts(_0x2ca714[_0x4f630b(0x142)],_0x2ca714[_0x4f630b(0x14e)](_0x4f630b(0x156)),{'scriptName':_0x2ca714[_0x4f630b(0x14e)](_0x4f630b(0x159))||undefined}),_0x21fc97=_0x2ca714[_0x4f630b(0x14b)](_0x4f630b(0x143));return{'ok':!![],'data':_0x21fc97?_0x1233f9:_0x1233f9[_0x4f630b(0x15b)](_0x2d2428=>({'id':_0x2d2428['id'],'functionName':_0x2d2428[_0x4f630b(0x15a)]??'','description':_0x2d2428[_0x4f630b(0x14f)]||_0x4f630b(0x14c),'scriptType':_0x2d2428['scriptType']})),'message':_0x1233f9[_0x4f630b(0x150)]===0x0?'No\x20Backend\x20Function\x20scripts\x20found.':undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x476b2a=a42_0x7baf;function a42_0xe791(){const _0x2a14ef=['length','5439712fldoCn','toUpperCase','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','INFO','--end-time','\x20Backend\x20Function\x20log\x20line(s).','validation','7wLOGeq','Maximum\x20log\x20lines\x20to\x20return\x20(1-','6641239AhmPsy','104226zhJwOB','since','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','--limit\x20must\x20be\x20between\x201\x20and\x20','--since','10NrtZDb','ERROR','WARN','number','flag','3446536Dwbihj','trim','end-time','3950352lWPPCP','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','33XlJSaz','\x20must\x20be\x20a\x20positive\x20integer.','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','str','start-time','713166DAjtRO','Found\x20','keyword','limit','num','logs','10eAFPcu','2022102nBLfCe','now','read','bff','string','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','level','Filter\x20by\x20log\x20level'];a42_0xe791=function(){return _0x2a14ef;};return a42_0xe791();}(function(_0x4e0a41,_0x3adeb4){const _0x1fddab=a42_0x7baf,_0x546b27=_0x4e0a41();while(!![]){try{const _0x4453a4=parseInt(_0x1fddab(0x8f))/0x1+-parseInt(_0x1fddab(0xab))/0x2*(-parseInt(_0x1fddab(0x8a))/0x3)+-parseInt(_0x1fddab(0xb5))/0x4+parseInt(_0x1fddab(0xb0))/0x5*(parseInt(_0x1fddab(0x96))/0x6)+-parseInt(_0x1fddab(0xa8))/0x7*(parseInt(_0x1fddab(0x9f))/0x8)+-parseInt(_0x1fddab(0xb8))/0x9+-parseInt(_0x1fddab(0x95))/0xa*(-parseInt(_0x1fddab(0xaa))/0xb);if(_0x4453a4===_0x3adeb4)break;else _0x546b27['push'](_0x546b27['shift']());}catch(_0x26457f){_0x546b27['push'](_0x546b27['shift']());}}}(a42_0xe791,0x8e7f2));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=['DEBUG',a42_0x476b2a(0xa4),a42_0x476b2a(0xb2),a42_0x476b2a(0xb1)];export function resolveBffLogQuery(_0x2bdb15,_0x5b0a34=Date[a42_0x476b2a(0x97)]()){const _0x1de6ff=a42_0x476b2a,_0x1ae85f=_0x2bdb15[_0x1de6ff(0xb4)]('since'),_0x2122e6=_0x2bdb15[_0x1de6ff(0xb4)]('start-time'),_0x5cfacf=_0x2bdb15[_0x1de6ff(0xb4)](_0x1de6ff(0xb7));if(_0x1ae85f!==undefined&&_0x2122e6!==undefined)throw CliErrors[_0x1de6ff(0xa7)](_0x1de6ff(0x89));const _0x2ad5bd=_0x5cfacf===undefined?_0x5b0a34:readPositiveInteger(_0x2bdb15[_0x1de6ff(0x93)]('end-time'),_0x1de6ff(0xa5)),_0x1ef527=_0x2122e6===undefined?_0x2ad5bd-readSinceMinutes(_0x2bdb15)*0xea60:readPositiveInteger(_0x2bdb15['num'](_0x1de6ff(0x8e)),'--start-time');if(_0x1ef527<=0x0)throw CliErrors[_0x1de6ff(0xa7)](_0x1de6ff(0x9b));if(_0x1ef527>_0x2ad5bd)throw CliErrors[_0x1de6ff(0xa7)](_0x1de6ff(0x8c));const _0x3cb119=readPositiveInteger(_0x2bdb15[_0x1de6ff(0x93)](_0x1de6ff(0x92),DEFAULT_LIMIT),'--limit');if(_0x3cb119>MAX_LIMIT)throw CliErrors[_0x1de6ff(0xa7)](_0x1de6ff(0xae)+MAX_LIMIT+'.');const _0x49a070=_0x2bdb15[_0x1de6ff(0x8d)](_0x1de6ff(0x9c))['trim']()[_0x1de6ff(0xa0)]()||undefined,_0x4b3924=_0x2bdb15[_0x1de6ff(0x8d)]('keyword')[_0x1de6ff(0xb6)]()||undefined;return{'appCode':_0x2bdb15['appCode'],'startTime':_0x1ef527,'endTime':_0x2ad5bd,..._0x2122e6===undefined?{'sinceMinutes':readSinceMinutes(_0x2bdb15)}:{},..._0x49a070?{'level':_0x49a070}:{},..._0x4b3924?{'keyword':_0x4b3924}:{},'limit':_0x3cb119};}function a42_0x7baf(_0x4b5b48,_0x5848e6){_0x4b5b48=_0x4b5b48-0x89;const _0xe791a0=a42_0xe791();let _0x7baf72=_0xe791a0[_0x4b5b48];return _0x7baf72;}function readSinceMinutes(_0x16da3c){const _0x256b14=a42_0x476b2a;return readPositiveInteger(_0x16da3c['num'](_0x256b14(0xac),DEFAULT_SINCE_MINUTES),_0x256b14(0xaf));}function readPositiveInteger(_0x1a1687,_0x29ba72){const _0x347433=a42_0x476b2a;if(!Number['isSafeInteger'](_0x1a1687)||_0x1a1687<=0x0)throw CliErrors[_0x347433(0xa7)](_0x29ba72+_0x347433(0x8b));return _0x1a1687;}export const bffLogs={'service':a42_0x476b2a(0x99),'command':a42_0x476b2a(0x94),'description':a42_0x476b2a(0xa3),'risk':a42_0x476b2a(0x98),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x476b2a(0xac),'type':a42_0x476b2a(0xb3),'description':'Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20'+DEFAULT_SINCE_MINUTES+')'},{'name':a42_0x476b2a(0x8e),'type':a42_0x476b2a(0xb3),'description':'Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds'},{'name':a42_0x476b2a(0xb7),'type':a42_0x476b2a(0xb3),'description':a42_0x476b2a(0xa2)},{'name':a42_0x476b2a(0x9c),'type':a42_0x476b2a(0x9a),'description':a42_0x476b2a(0x9d),'enum':LOG_LEVELS},{'name':a42_0x476b2a(0x91),'type':a42_0x476b2a(0x9a),'description':a42_0x476b2a(0xa1)},{'name':a42_0x476b2a(0x92),'type':a42_0x476b2a(0xb3),'description':a42_0x476b2a(0xa9)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x226767){resolveBffLogQuery(_0x226767);},async 'execute'(_0x3aac03){const _0x33d2d9=a42_0x476b2a,_0x2b4a4a=resolveBffLogQuery(_0x3aac03),{sinceMinutes:_0x2afa39,..._0x2327ab}=_0x2b4a4a,_0x2dda68=await searchBffScriptLogs(_0x2327ab);return{'ok':!![],'data':{'query':_0x2b4a4a,'count':_0x2dda68[_0x33d2d9(0x9e)],'logs':_0x2dda68},'message':_0x2dda68[_0x33d2d9(0x9e)]===0x0?_0x33d2d9(0xad):_0x33d2d9(0x90)+_0x2dda68[_0x33d2d9(0x9e)]+_0x33d2d9(0xa6)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x530a46=a43_0x31e3;(function(_0x28bc96,_0x409fc0){const _0x4bee76=a43_0x31e3,_0x3fe388=_0x28bc96();while(!![]){try{const _0x24a748=parseInt(_0x4bee76(0x1d5))/0x1+parseInt(_0x4bee76(0x190))/0x2*(-parseInt(_0x4bee76(0x210))/0x3)+parseInt(_0x4bee76(0x1fe))/0x4*(parseInt(_0x4bee76(0x1c8))/0x5)+-parseInt(_0x4bee76(0x202))/0x6+-parseInt(_0x4bee76(0x219))/0x7*(parseInt(_0x4bee76(0x1f3))/0x8)+-parseInt(_0x4bee76(0x1ac))/0x9+-parseInt(_0x4bee76(0x1f4))/0xa*(-parseInt(_0x4bee76(0x1b2))/0xb);if(_0x24a748===_0x409fc0)break;else _0x3fe388['push'](_0x3fe388['shift']());}catch(_0x1c6288){_0x3fe388['push'](_0x3fe388['shift']());}}}(a43_0x370c,0x2aa8b));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';function a43_0x370c(){const _0x3a788c=['all','nonInteractive','scriptContent','str','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','parse','split','read','datasetCode','close','string','pull','\x20conflict','bool','Failed\x20to\x20write\x20local\x20script\x20\x22','\x20--format\x20compress','map','newDirectory','/api/management/library/scripts/list?appCode=','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','&type=','GET','BFF_LOCAL_UNSYNCED','includes','scriptType','1794708oDzxzu','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','stderr','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','.hook-directory-migrate-','trim','132QEvJvc','length','cancelled','conflict','requires','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Lock\x20scope\x20for\x20app\x20\x22','COMMON','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','sourceDirectoryPathByNewDirectory','projectedFunctions','rekey','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','newLockKey','alias','keyChanges','\x22:\x20its\x20target\x20\x22','scriptsRootDir','\x20pulled','oldDirectory','lockFilePath','1669555uKdbiU','get','toLowerCase','apps','oldDirectoryPath','\x20failed','filePath','bff','mergedCli','ino','lastSync','entry','\x20bff\x20push\x20--type\x20','206525fDdQvG','type','HOOK','question','.js','scriptsRoot','\x20resolution','entries','set','reverse','delete','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','skipped','yes','existed','apiDir','require','case-rename','code','would_pull','ENOENT','some','hookLocation','\x20skipped','mode','lockKey','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','newDirectoryPath','stdin','868304uaOWSl','364020CJNXwu','\x22:\x20','\x22\x20and\x20\x22','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','Remote\x20script\x20missing\x20id.','\x22:\x20both\x20target\x20\x22','Pull\x20only\x20this\x20script\x20type','\x22;\x20temporary\x20directory\x20\x22','dev','4eLNOxo','\x22\x20to\x20\x22','move','unresolvable\x20target\x20path','1542870XVNFmM','selectedAppName','rollback','force','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','defaultApp','push','hash','Force\x20pull\x20cancelled.','profileName','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','currentApp','sourceFilePathByNewLockKey','join','3tNsfBv','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','Could\x20not\x20restore\x20local\x20script\x20\x22','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','functions','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','utf8','push_local','\x22\x20from\x20the\x20lock\x20file.','7HGZCaW','\x22\x20may\x20remain.','write','toISOString','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','functionNode','message','oldLockKey','remoteId','validation','appCode','operationType','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','474868TeQETT','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','has'];a43_0x370c=function(){return _0x3a788c;};return a43_0x370c();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x530a46(0x1cf),'command':'pull','description':a43_0x530a46(0x1f7),'risk':a43_0x530a46(0x19a),'structuredErrors':!![],'flags':[{'name':a43_0x530a46(0x1d6),'type':a43_0x530a46(0x19d),'description':a43_0x530a46(0x1fb),'enum':[a43_0x530a46(0x1ba),'ENDPOINT','HOOK']},{'name':a43_0x530a46(0x205),'type':'boolean','description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x136f83){const _0x10fe09=a43_0x530a46,_0x42be3f=loadBffProjectConfig(_0x136f83['appCode']),_0x234183=await readBffLockFile(_0x42be3f['lockFilePath']),{appLock:_0x2bb415}=ensureLockScope(_0x234183??createEmptyBffLock(),_0x136f83[_0x10fe09(0x18d)],_0x42be3f[_0x10fe09(0x1da)],_0x10fe09(0x19e)),_0x2ef955=normalizeBffType(_0x136f83[_0x10fe09(0x196)](_0x10fe09(0x1d6)))??undefined,[_0x3e71e2,_0x1a591a]=await Promise[_0x10fe09(0x193)]([listBffScripts(_0x136f83[_0x10fe09(0x18d)],_0x2ef955),getBffScriptStatistics(_0x136f83['appCode'])]),_0x5761cb=_0x3e71e2[_0x10fe09(0x1eb)](_0x23e470=>normalizeBffType(_0x23e470[_0x10fe09(0x1ab)])===_0x10fe09(0x1d7)),_0x14ee40=_0x5761cb?buildDatasetCodeToAliasMap(_0x136f83[_0x10fe09(0x1e5)],_0x136f83['appCode'],_0x136f83[_0x10fe09(0x203)]||_0x136f83[_0x10fe09(0x1d0)]?.[_0x10fe09(0x20d)]||_0x136f83[_0x10fe09(0x1d0)]?.[_0x10fe09(0x207)]):new Map(),_0x4f7d4e=_0x5761cb?await planHookDirectoryMigration(_0x42be3f,_0x2bb415,_0x14ee40,await scanLocalBffFunctions(_0x42be3f,'HOOK')):undefined,_0x245751=createHookLocationMap(_0x1a591a),_0x35bc0e=[];for(const _0x2ef483 of _0x3e71e2){const _0x23ad7c=resolveRemoteScriptTarget(_0x42be3f,_0x2ef483,_0x245751,_0x4f7d4e?.[_0x10fe09(0x1bd)]??_0x2bb415[_0x10fe09(0x214)],_0x14ee40);if(!_0x23ad7c){_0x35bc0e[_0x10fe09(0x208)]({'scriptType':_0x2ef483['scriptType'],'functionName':_0x2ef483['functionName']??'','status':_0x10fe09(0x1e2),'reason':_0x10fe09(0x201)});continue;}const _0x7e1c4b=(_0x4f7d4e?.['projectedFunctions']??_0x2bb415[_0x10fe09(0x214)])[_0x23ad7c[_0x10fe09(0x1ef)]],_0x33368a=_0x2ef483['scriptContent']!=null?computeContentHash(_0x2ef483['scriptContent']):undefined,_0x8d7c08=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x4f7d4e,_0x23ad7c)??_0x23ad7c[_0x10fe09(0x1ce)],_0x7e1c4b,_0x33368a),_0x570cc2=_0x8d7c08?localUnsyncedConflict(_0x23ad7c,_0x2ef483['id']):undefined;_0x35bc0e[_0x10fe09(0x208)]({'lockKey':_0x23ad7c[_0x10fe09(0x1ef)],'filePath':_0x23ad7c[_0x10fe09(0x1ce)],'remoteId':_0x2ef483['id']??null,'status':_0x570cc2?_0x10fe09(0x1b5):_0x10fe09(0x1e9),..._0x570cc2?{'conflict':_0x570cc2}:{},..._0x23ad7c['hookLocation']?{'alias':_0x23ad7c['hookLocation'][_0x10fe09(0x1c1)]??null,'datasetCode':_0x23ad7c[_0x10fe09(0x1ec)][_0x10fe09(0x19b)],'operationType':_0x23ad7c[_0x10fe09(0x1ec)][_0x10fe09(0x18e)],'functionNode':_0x23ad7c[_0x10fe09(0x1ec)]['functionNode']}:{}});}return{'method':_0x10fe09(0x1a8),'url':_0x10fe09(0x1a5)+_0x136f83['appCode']+(_0x2ef955?_0x10fe09(0x1a7)+_0x2ef955:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x136f83[_0x10fe09(0x18d)],'filterType':_0x2ef955??null,..._0x4f7d4e&&_0x4f7d4e['migrations'][_0x10fe09(0x1b3)]>0x0?{'hookDirectoryMigrations':_0x4f7d4e['migrations'][_0x10fe09(0x1a3)](_0x4fa8e4=>({'from':_0x4fa8e4['oldDirectory'],'to':_0x4fa8e4[_0x10fe09(0x1a4)]}))}:{},'files':_0x35bc0e},'description':'Would\x20inspect\x20'+_0x35bc0e['length']+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x138b30){const _0x1f6d2d=a43_0x530a46,_0x2e9552=loadBffProjectConfig(_0x138b30[_0x1f6d2d(0x18d)]),_0x43d88d=await readBffLockFile(_0x2e9552[_0x1f6d2d(0x1c7)]),{lockData:_0x325b29,appLock:_0x6d4966}=ensureLockScope(_0x43d88d??createEmptyBffLock(),_0x138b30[_0x1f6d2d(0x18d)],_0x2e9552[_0x1f6d2d(0x1da)],_0x1f6d2d(0x19e)),_0x439951=normalizeBffType(_0x138b30[_0x1f6d2d(0x196)](_0x1f6d2d(0x1d6)))??undefined;if(_0x138b30[_0x1f6d2d(0x196)](_0x1f6d2d(0x1d6))&&!_0x439951)throw CliErrors[_0x1f6d2d(0x18c)](_0x1f6d2d(0x1bf));const [_0x50c1f8,_0x580d02]=await Promise['all']([listBffScripts(_0x138b30[_0x1f6d2d(0x18d)],_0x439951),getBffScriptStatistics(_0x138b30[_0x1f6d2d(0x18d)])]);if(_0x50c1f8[_0x1f6d2d(0x1b3)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x2217e3=_0x138b30[_0x1f6d2d(0x1a0)](_0x1f6d2d(0x205));if(_0x2217e3&&!_0x138b30[_0x1f6d2d(0x194)]){const _0x28c82d=await confirmForce();if(!_0x28c82d)throw CliErrors[_0x1f6d2d(0x1b4)](_0x1f6d2d(0x20a));}if(_0x2217e3&&_0x138b30['nonInteractive']){}const _0x48720f=_0x50c1f8[_0x1f6d2d(0x1eb)](_0x53def1=>normalizeBffType(_0x53def1[_0x1f6d2d(0x1ab)])==='HOOK'),_0x115d1d=_0x48720f?buildDatasetCodeToAliasMap(_0x138b30['apiDir'],_0x138b30['appCode'],_0x138b30[_0x1f6d2d(0x203)]||_0x138b30['mergedCli']?.[_0x1f6d2d(0x20d)]||_0x138b30[_0x1f6d2d(0x1d0)]?.[_0x1f6d2d(0x207)]):new Map(),_0x18afd6=createHookLocationMap(_0x580d02),_0x1fe634=JSON[_0x1f6d2d(0x198)](JSON['stringify'](_0x325b29)),_0x22ad9a=_0x138b30[_0x1f6d2d(0x18d)],_0x2c3802=_0x1fe634[_0x1f6d2d(0x1cb)][_0x22ad9a];if(!_0x2c3802)throw new Error(_0x1f6d2d(0x1b9)+_0x22ad9a+_0x1f6d2d(0x1e1));const _0x27c88b=_0x48720f?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x2e9552,_0x2c3802,_0x115d1d,await scanLocalBffFunctions(_0x2e9552,_0x1f6d2d(0x1d7))),_0x2c3802):undefined,_0xb915f2=createPullFileTransaction(),_0x12f0f3=[],_0x49d2f4=[],_0x5e6746=[],_0x2f264f=[];for(const _0x1d4cb6 of _0x50c1f8){const _0x4d08e2=resolveRemoteScriptTarget(_0x2e9552,_0x1d4cb6,_0x18afd6,_0x2c3802[_0x1f6d2d(0x214)],_0x115d1d);if(!_0x4d08e2){_0x49d2f4[_0x1f6d2d(0x208)]({'lockKey':_0x1d4cb6[_0x1f6d2d(0x1ab)]+'/'+_0x1d4cb6['functionName'],'reason':_0x1f6d2d(0x201)});continue;}const _0x2e7eca=_0x2c3802[_0x1f6d2d(0x214)][_0x4d08e2[_0x1f6d2d(0x1ef)]];try{if(!_0x1d4cb6['id'])throw new Error(_0x1f6d2d(0x1f9));if(_0x1d4cb6[_0x1f6d2d(0x195)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x3a6ba9=_0x1d4cb6[_0x1f6d2d(0x195)],_0x432c64=computeContentHash(_0x3a6ba9);if(!_0x2217e3){const _0x194b56=await hasUnsyncedLocalChanges(_0x4d08e2[_0x1f6d2d(0x1ce)],_0x2e7eca,_0x432c64);if(_0x194b56){_0x5e6746['push'](localUnsyncedConflict(_0x4d08e2,_0x1d4cb6['id']));continue;}}await _0xb915f2[_0x1f6d2d(0x185)](_0x4d08e2[_0x1f6d2d(0x1ce)],_0x3a6ba9);const _0x340377={'hash':_0x432c64,'remoteId':_0x1d4cb6['id'],'version':_0x1d4cb6['version']};_0x4d08e2[_0x1f6d2d(0x1d6)]===_0x1f6d2d(0x1d7)&&_0x4d08e2[_0x1f6d2d(0x1ec)]&&(_0x340377[_0x1f6d2d(0x1c1)]=_0x4d08e2[_0x1f6d2d(0x1ec)][_0x1f6d2d(0x1c1)],_0x340377[_0x1f6d2d(0x19b)]=_0x4d08e2['hookLocation']['datasetCode'],_0x340377[_0x1f6d2d(0x18e)]=_0x4d08e2[_0x1f6d2d(0x1ec)]['operationType'],_0x340377[_0x1f6d2d(0x188)]=_0x4d08e2[_0x1f6d2d(0x1ec)][_0x1f6d2d(0x188)]),_0x2c3802[_0x1f6d2d(0x214)][_0x4d08e2['lockKey']]=_0x340377,_0x12f0f3[_0x1f6d2d(0x208)]({'lockKey':_0x4d08e2[_0x1f6d2d(0x1ef)],'remoteId':_0x1d4cb6['id']});}catch(_0x270618){_0x2f264f[_0x1f6d2d(0x208)]({'lockKey':_0x4d08e2[_0x1f6d2d(0x1ef)],'error':_0x270618 instanceof Error?_0x270618[_0x1f6d2d(0x189)]:String(_0x270618)});}}_0x2c3802[_0x1f6d2d(0x1d2)]=new Date()[_0x1f6d2d(0x186)]();try{await writeBffLockFile(_0x2e9552[_0x1f6d2d(0x1c7)],_0x1fe634);}catch(_0x2b0c9a){const _0x41b349=[...await _0xb915f2['rollback'](),...await _0x27c88b?.[_0x1f6d2d(0x204)]()??[]];throw withRollbackErrors(_0x2b0c9a,_0x1f6d2d(0x211),_0x41b349);}return{'ok':_0x2f264f[_0x1f6d2d(0x1b3)]===0x0,'data':{'pulled':_0x12f0f3,'skipped':_0x49d2f4,'conflicts':_0x5e6746,'failed':_0x2f264f},'message':formatPullMessage(_0x12f0f3[_0x1f6d2d(0x1b3)],_0x49d2f4[_0x1f6d2d(0x1b3)],_0x5e6746['length'],_0x2f264f[_0x1f6d2d(0x1b3)])};}};function localUnsyncedConflict(_0x537654,_0x57e838){const _0x2e276e=a43_0x530a46,_0x224ccb=_0x537654[_0x2e276e(0x1ef)][_0x2e276e(0x199)]('/')['at'](-0x1);return{'code':_0x2e276e(0x1a9),'lockKey':_0x537654[_0x2e276e(0x1ef)],'filePath':_0x537654[_0x2e276e(0x1ce)],..._0x57e838!=null?{'remoteId':_0x57e838}:{},'message':_0x2e276e(0x1ad),'nextAction':{'action':_0x2e276e(0x217),'command':CLI_BIN_NAME+_0x2e276e(0x1d4)+_0x537654[_0x2e276e(0x1d6)]+'\x20--name\x20'+_0x224ccb+_0x2e276e(0x1a2),'requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function formatPullMessage(_0x16b670,_0x38a327,_0x396b28,_0x188782){const _0x1e5c3d=a43_0x530a46,_0x43db9a=['Pull\x20complete:\x20'+_0x16b670+_0x1e5c3d(0x1c5),_0x38a327+_0x1e5c3d(0x1ed)];_0x396b28>0x0&&_0x43db9a[_0x1e5c3d(0x208)](_0x396b28+_0x1e5c3d(0x19f)+(_0x396b28===0x1?'':'s')+'\x20'+(_0x396b28===0x1?_0x1e5c3d(0x1b6):_0x1e5c3d(0x1e6))+_0x1e5c3d(0x1db));if(_0x188782>0x0)_0x43db9a[_0x1e5c3d(0x208)](_0x188782+_0x1e5c3d(0x1cd));return _0x43db9a[_0x1e5c3d(0x20f)](',\x20');}async function hasUnsyncedLocalChanges(_0x23f2a6,_0x24624e,_0x4b3c68){const _0x2b4b73=a43_0x530a46;if(!await fileExists(_0x23f2a6))return![];const _0x4eb319=await computeFileHash(_0x23f2a6);if(!_0x24624e)return _0x4b3c68?_0x4eb319!==_0x4b3c68:!![];return _0x4eb319!==_0x24624e[_0x2b4b73(0x209)];}function createPullFileTransaction(){const _0x57c37a=new Map(),_0x30faec=async(_0x557c82,_0xf740bd)=>{const _0x406d09=a43_0x31e3;try{if(_0xf740bd[_0x406d09(0x1e4)])await ensureParentDirectory(_0x557c82),await writeFile(_0x557c82,_0xf740bd['content']);else try{await unlink(_0x557c82);}catch(_0x4ad46f){if(_0x4ad46f[_0x406d09(0x1e8)]!==_0x406d09(0x1ea))throw _0x4ad46f;}return undefined;}catch(_0x719591){return _0x719591 instanceof Error?_0x719591:new Error(String(_0x719591));}};return{async 'write'(_0x504066,_0x361170){const _0x5708e5=a43_0x31e3;if(!_0x57c37a[_0x5708e5(0x192)](_0x504066))try{_0x57c37a[_0x5708e5(0x1dd)](_0x504066,{'existed':!![],'content':await readFile(_0x504066)});}catch(_0x276fb8){if(_0x276fb8[_0x5708e5(0x1e8)]!==_0x5708e5(0x1ea))throw _0x276fb8;_0x57c37a[_0x5708e5(0x1dd)](_0x504066,{'existed':![]});}try{await ensureParentDirectory(_0x504066),await writeFile(_0x504066,_0x361170,_0x5708e5(0x216));}catch(_0x193da2){const _0x2e327b=await _0x30faec(_0x504066,_0x57c37a[_0x5708e5(0x1c9)](_0x504066));if(!_0x2e327b)_0x57c37a[_0x5708e5(0x1df)](_0x504066);throw withRollbackErrors(_0x193da2,_0x5708e5(0x1a1)+_0x504066+'\x22.',_0x2e327b?[_0x2e327b]:[]);}},async 'rollback'(){const _0x549d1e=a43_0x31e3,_0x531d0d=[];for(const [_0x2f447c,_0x32059c]of[..._0x57c37a[_0x549d1e(0x1dc)]()][_0x549d1e(0x1de)]()){const _0x226f65=await _0x30faec(_0x2f447c,_0x32059c);_0x226f65&&_0x531d0d[_0x549d1e(0x208)](new Error(_0x549d1e(0x212)+_0x2f447c+_0x549d1e(0x1f5)+_0x226f65['message']));}return _0x531d0d;}};}function withRollbackErrors(_0x315f17,_0x4e693f,_0x41f450){const _0x5a66dd=a43_0x530a46,_0x3d7038=_0x315f17 instanceof Error?_0x315f17:new Error(String(_0x315f17));if(_0x41f450[_0x5a66dd(0x1b3)]===0x0)return _0x3d7038;return new AggregateError([_0x3d7038,..._0x41f450],_0x4e693f+'\x20Recovery\x20errors:\x20'+_0x41f450[_0x5a66dd(0x1a3)](_0x351376=>_0x351376[_0x5a66dd(0x189)])[_0x5a66dd(0x20f)](';\x20'));}function buildDatasetCodeToAliasMap(_0x719b65,_0x4747de,_0x2a4f0f){const _0x2ba562=a43_0x530a46,_0x44b87e=resolveApiModelSource(_0x719b65,_0x4747de,_0x2a4f0f),_0x136c59=loadAliasMap(_0x719b65,undefined,_0x44b87e['filePath'],_0x44b87e[_0x2ba562(0x20b)]);return assertUnambiguousHookAliases(_0x136c59),new Map(_0x136c59[_0x2ba562(0x1a3)](_0x4e17b2=>[_0x4e17b2['datasetCode'][_0x2ba562(0x1ca)](),_0x4e17b2[_0x2ba562(0x1c1)]]));}async function planHookDirectoryMigration(_0xa0935,_0x5b2993,_0x1caf52,_0x59ba1c){const _0x1b8c19=a43_0x530a46,_0x4ef383=new Map();for(const [_0x69e6a3,_0x1be4e2]of Object[_0x1b8c19(0x1dc)](_0x5b2993[_0x1b8c19(0x214)])){const [_0x1be07e,_0x593bce,_0x193d34,_0x15f67e,_0x93f413,..._0x4e5b14]=_0x69e6a3[_0x1b8c19(0x199)]('/');if(_0x1be07e!==_0x1b8c19(0x1d7)||!_0x593bce||!_0x193d34||!_0x15f67e||!_0x93f413||_0x4e5b14[_0x1b8c19(0x1b3)]>0x0||!_0x1be4e2['datasetCode'])continue;const _0x1d9047=_0x1caf52['get'](_0x1be4e2[_0x1b8c19(0x19b)][_0x1b8c19(0x1ca)]()),_0xc8f91a=_0x1d9047??_0x1be4e2[_0x1b8c19(0x19b)];if(!isSafeHookDirectorySegment(_0x593bce))throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1f0)+_0x593bce+_0x1b8c19(0x218));if(!isSafeHookDirectorySegment(_0xc8f91a))throw CliErrors['validation'](_0x1b8c19(0x1e0)+_0x593bce+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x593bce===_0xc8f91a)continue;const _0x3212f8=_0x4ef383[_0x1b8c19(0x1c9)](_0x593bce)??{'datasetCode':_0x1be4e2['datasetCode'],'alias':_0x1d9047,'keyChanges':[]};if(_0x3212f8[_0x1b8c19(0x19b)]!==_0x1be4e2[_0x1b8c19(0x19b)])throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1e0)+_0x593bce+_0x1b8c19(0x213));const _0x2ea045='HOOK/'+_0xc8f91a+'/'+_0x193d34+'/'+_0x15f67e+'/'+_0x93f413;try{resolveLocalFilePathFromLockKey(_0xa0935,_0x69e6a3),resolveLocalFilePathFromLockKey(_0xa0935,_0x2ea045);}catch(_0x1a70aa){throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1a6)+_0x69e6a3+_0x1b8c19(0x1f5)+(_0x1a70aa instanceof Error?_0x1a70aa[_0x1b8c19(0x189)]:String(_0x1a70aa)));}_0x3212f8[_0x1b8c19(0x1c2)][_0x1b8c19(0x208)]({'oldLockKey':_0x69e6a3,'newLockKey':_0x2ea045,'entry':_0x1be4e2}),_0x4ef383[_0x1b8c19(0x1dd)](_0x593bce,_0x3212f8);}const _0x329ffc=new Set([..._0x4ef383['values']()]['flatMap'](_0x4556f6=>_0x4556f6[_0x1b8c19(0x1c2)]['map'](_0x3fd922=>_0x3fd922['oldLockKey']))),_0x1f8d0a=new Map(),_0x12f974=new Map();for(const [_0x107b9c,_0x504d72]of _0x4ef383){const _0x4cce68=_0x504d72[_0x1b8c19(0x1c1)]??_0x504d72['datasetCode'],_0x48c9a2=hookDirectoryIdentity(_0x4cce68),_0x211c0f=_0x1f8d0a['get'](_0x48c9a2);if(_0x211c0f&&_0x211c0f!==_0x107b9c)throw CliErrors[_0x1b8c19(0x18c)]('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x211c0f+_0x1b8c19(0x1f6)+_0x107b9c+_0x1b8c19(0x1fa)+_0x4cce68+_0x1b8c19(0x1bb));_0x1f8d0a[_0x1b8c19(0x1dd)](_0x48c9a2,_0x107b9c);for(const _0x5da1cb of _0x504d72[_0x1b8c19(0x1c2)]){const _0xcafaa5=_0x12f974[_0x1b8c19(0x1c9)](_0x5da1cb[_0x1b8c19(0x1c0)]);if(_0xcafaa5&&_0xcafaa5!==_0x5da1cb['oldLockKey'])throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x197)+_0xcafaa5+_0x1b8c19(0x1f6)+_0x5da1cb[_0x1b8c19(0x18a)]+_0x1b8c19(0x1fa)+_0x5da1cb[_0x1b8c19(0x1c0)]+_0x1b8c19(0x1b8));if(_0x329ffc[_0x1b8c19(0x192)](_0x5da1cb[_0x1b8c19(0x1c0)]))throw CliErrors[_0x1b8c19(0x18c)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x5da1cb[_0x1b8c19(0x18a)]+_0x1b8c19(0x1c3)+_0x5da1cb['newLockKey']+_0x1b8c19(0x1af));_0x12f974[_0x1b8c19(0x1dd)](_0x5da1cb[_0x1b8c19(0x1c0)],_0x5da1cb[_0x1b8c19(0x18a)]);}}const _0xcbf2e6=new Map();for(const [_0x29297f,_0x45e9f5]of _0x1caf52){_0xcbf2e6['set'](hookDirectoryIdentity(_0x45e9f5),_0x29297f);}const _0x561c12=[];for(const [_0x4f2cdc,_0x55f268]of _0x4ef383){const _0x55da22=_0x55f268[_0x1b8c19(0x1c1)]??_0x55f268['datasetCode'],_0x533d6a=join(_0xa0935[_0x1b8c19(0x1c4)],_0x1b8c19(0x1d7),_0x4f2cdc),_0x1fa809=join(_0xa0935[_0x1b8c19(0x1c4)],_0x1b8c19(0x1d7),_0x55da22),_0x586486=await directoryExists(_0x533d6a),_0x17c111=await directoryExists(_0x1fa809),_0x32864b=_0x586486?_0x17c111?await sameDirectory(_0x533d6a,_0x1fa809)?_0x1b8c19(0x1e7):undefined:'move':_0x1b8c19(0x1be);if(!_0x32864b)throw CliErrors[_0x1b8c19(0x18c)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x4f2cdc+_0x1b8c19(0x1ff)+_0x55da22+_0x1b8c19(0x187));const _0x4bc0ad=_0xcbf2e6['get'](hookDirectoryIdentity(_0x4f2cdc));if(_0x4bc0ad&&_0x4bc0ad!==_0x55f268[_0x1b8c19(0x19b)][_0x1b8c19(0x1ca)]()){const _0x400d60=new Set(_0x55f268['keyChanges'][_0x1b8c19(0x1a3)](_0x2055fc=>_0x2055fc[_0x1b8c19(0x18a)])),_0x1d0e9c=_0x59ba1c['filter'](_0x394e97=>_0x394e97[_0x1b8c19(0x1d6)]===_0x1b8c19(0x1d7)&&_0x394e97['alias']!=null&&hookDirectoryIdentity(_0x394e97[_0x1b8c19(0x1c1)])===hookDirectoryIdentity(_0x4f2cdc)&&!_0x400d60[_0x1b8c19(0x192)](_0x394e97[_0x1b8c19(0x1ef)]));if(_0x1d0e9c[_0x1b8c19(0x1b3)]>0x0)throw CliErrors['validation'](_0x1b8c19(0x1e0)+_0x4f2cdc+_0x1b8c19(0x206));}const _0x591956=_0xcbf2e6[_0x1b8c19(0x1c9)](hookDirectoryIdentity(_0x55da22));if(_0x591956&&_0x591956!==_0x55f268[_0x1b8c19(0x19b)][_0x1b8c19(0x1ca)]())throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1e0)+_0x4f2cdc+_0x1b8c19(0x1ff)+_0x55da22+_0x1b8c19(0x191));for(const _0x164d9c of _0x55f268['keyChanges']){const _0x18d5cf=_0x5b2993[_0x1b8c19(0x214)][_0x164d9c['newLockKey']];if(_0x18d5cf&&!_0x329ffc[_0x1b8c19(0x192)](_0x164d9c[_0x1b8c19(0x1c0)])&&!sameHookIdentity(_0x164d9c['entry'],_0x18d5cf))throw CliErrors[_0x1b8c19(0x18c)](_0x1b8c19(0x1e0)+_0x4f2cdc+_0x1b8c19(0x1ff)+_0x55da22+_0x1b8c19(0x20c));}_0x561c12['push']({'oldDirectory':_0x4f2cdc,'newDirectory':_0x55da22,'oldDirectoryPath':_0x533d6a,'newDirectoryPath':_0x1fa809,'mode':_0x32864b,'alias':_0x55f268[_0x1b8c19(0x1c1)],'keyChanges':_0x55f268[_0x1b8c19(0x1c2)]});}const _0x57c0e3={..._0x5b2993['functions']},_0xc6058e=new Map(),_0x253fd5=new Map();for(const _0x427402 of _0x561c12){const _0x35bd14=_0x427402['mode']!=='rekey';_0x35bd14&&_0x253fd5[_0x1b8c19(0x1dd)](hookDirectoryIdentity(_0x427402[_0x1b8c19(0x1a4)]),_0x427402[_0x1b8c19(0x1cc)]);for(const _0xd0c760 of _0x427402['keyChanges']){const _0x25cf5b=_0x57c0e3[_0xd0c760['newLockKey']],_0x2aeafb=_0x35bd14?_0xd0c760[_0x1b8c19(0x1d3)]:_0x25cf5b??_0xd0c760[_0x1b8c19(0x1d3)];_0x57c0e3[_0xd0c760[_0x1b8c19(0x1c0)]]=canonicalizeHookEntry(_0x2aeafb,_0x427402['alias']),delete _0x57c0e3[_0xd0c760['oldLockKey']],_0x35bd14&&_0xc6058e[_0x1b8c19(0x1dd)](_0xd0c760[_0x1b8c19(0x1c0)],resolveLocalFilePathFromLockKey(_0xa0935,_0xd0c760['oldLockKey']));}}return{'migrations':_0x561c12,'projectedFunctions':_0x57c0e3,'sourceFilePathByNewLockKey':_0xc6058e,'sourceDirectoryPathByNewDirectory':_0x253fd5};}function resolveMigratedSourceFilePath(_0x184894,_0x5b43bd){const _0x5d72ce=a43_0x530a46;if(!_0x184894||!_0x5b43bd)return undefined;const _0x58ca4e=_0x184894[_0x5d72ce(0x20e)]['get'](_0x5b43bd[_0x5d72ce(0x1ef)]);if(_0x58ca4e)return _0x58ca4e;if(_0x5b43bd[_0x5d72ce(0x1d6)]!==_0x5d72ce(0x1d7))return undefined;const [,_0x5d1279,..._0x246ae4]=_0x5b43bd[_0x5d72ce(0x1ef)]['split']('/');if(!_0x5d1279||_0x246ae4[_0x5d72ce(0x1b3)]===0x0)return undefined;const _0x595fcf=_0x184894[_0x5d72ce(0x1bc)][_0x5d72ce(0x1c9)](hookDirectoryIdentity(_0x5d1279));return _0x595fcf?join(_0x595fcf,..._0x246ae4)+_0x5d72ce(0x1d9):undefined;}function sameHookIdentity(_0x15ef0a,_0x406ef6){const _0x5fbb45=a43_0x530a46;return _0x15ef0a[_0x5fbb45(0x18b)]===_0x406ef6[_0x5fbb45(0x18b)]&&_0x15ef0a[_0x5fbb45(0x19b)]===_0x406ef6[_0x5fbb45(0x19b)]&&_0x15ef0a[_0x5fbb45(0x18e)]===_0x406ef6[_0x5fbb45(0x18e)]&&_0x15ef0a['functionNode']===_0x406ef6[_0x5fbb45(0x188)];}function canonicalizeHookEntry(_0x5e1f00,_0xc0624e){const {alias:_0xcde7bf,..._0x3f0dbc}=_0x5e1f00;return _0xc0624e?{..._0x3f0dbc,'alias':_0xc0624e}:_0x3f0dbc;}function hookDirectoryIdentity(_0xe5b00a){const _0x29d959=a43_0x530a46;return _0xe5b00a['normalize']('NFC')[_0x29d959(0x1ca)]();}function isSafeHookDirectorySegment(_0x579591){return isSafeLockKeySegment(_0x579591);}function a43_0x31e3(_0x4b8c21,_0x20bb78){_0x4b8c21=_0x4b8c21-0x185;const _0x370c5f=a43_0x370c();let _0x31e3dd=_0x370c5f[_0x4b8c21];return _0x31e3dd;}async function sameDirectory(_0x3632a3,_0x3c5371){const _0x52f585=a43_0x530a46,[_0x515a7c,_0x2d9533]=await Promise[_0x52f585(0x193)]([stat(_0x3632a3),stat(_0x3c5371)]);return _0x515a7c[_0x52f585(0x1fd)]===_0x2d9533[_0x52f585(0x1fd)]&&_0x515a7c['ino']===_0x2d9533[_0x52f585(0x1d1)];}async function applyHookDirectoryMigration(_0x39060f,_0x3337f9){const _0x300c42=a43_0x530a46,_0x44011d=_0x3337f9[_0x300c42(0x214)],_0x3ab158=_0x3337f9['lastSync'],_0x39fa9f=[],_0x35cbf0=async()=>{const _0x3aaf6e=_0x300c42,_0x168851=[];_0x3337f9['functions']=_0x44011d,_0x3337f9[_0x3aaf6e(0x1d2)]=_0x3ab158;for(const {migration:_0x192f5e,temporaryPath:_0x32ba72}of[..._0x39fa9f]['reverse']()){try{_0x32ba72?(await rename(_0x192f5e[_0x3aaf6e(0x1f1)],_0x32ba72),await rename(_0x32ba72,_0x192f5e[_0x3aaf6e(0x1cc)])):await rename(_0x192f5e['newDirectoryPath'],_0x192f5e[_0x3aaf6e(0x1cc)]);}catch(_0x13faaf){_0x168851[_0x3aaf6e(0x208)](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x192f5e[_0x3aaf6e(0x1c6)]+'\x22\x20from\x20\x22'+_0x192f5e[_0x3aaf6e(0x1a4)]+_0x3aaf6e(0x1f5)+(_0x13faaf instanceof Error?_0x13faaf['message']:String(_0x13faaf))));}}return _0x168851;};try{for(const _0x242207 of _0x39060f['migrations']){if(_0x242207[_0x300c42(0x1ee)]===_0x300c42(0x200))await ensureParentDirectory(_0x242207[_0x300c42(0x1f1)]),await rename(_0x242207['oldDirectoryPath'],_0x242207['newDirectoryPath']),_0x39fa9f[_0x300c42(0x208)]({'migration':_0x242207});else{if(_0x242207['mode']===_0x300c42(0x1e7)){const _0x51818d=join(dirname(_0x242207['oldDirectoryPath']),_0x300c42(0x1b0)+randomUUID());await rename(_0x242207[_0x300c42(0x1cc)],_0x51818d);try{await rename(_0x51818d,_0x242207['newDirectoryPath']);}catch(_0x270da){try{await rename(_0x51818d,_0x242207[_0x300c42(0x1cc)]);}catch(_0x3f7ddd){throw withRollbackErrors(_0x270da,_0x300c42(0x1f8)+_0x242207[_0x300c42(0x1c6)]+_0x300c42(0x1ff)+_0x242207[_0x300c42(0x1a4)]+_0x300c42(0x1fc)+_0x51818d+_0x300c42(0x21a),[new Error(_0x300c42(0x1b7)+_0x51818d+_0x300c42(0x1ff)+_0x242207[_0x300c42(0x1c6)]+_0x300c42(0x1f5)+(_0x3f7ddd instanceof Error?_0x3f7ddd[_0x300c42(0x189)]:String(_0x3f7ddd)))]);}throw _0x270da;}_0x39fa9f[_0x300c42(0x208)]({'migration':_0x242207,'temporaryPath':_0x51818d});}}}return _0x3337f9[_0x300c42(0x214)]=_0x39060f[_0x300c42(0x1bd)],{'rollback':_0x35cbf0};}catch(_0xa1bfd6){const _0x345a67=await _0x35cbf0();throw withRollbackErrors(_0xa1bfd6,_0x300c42(0x18f),_0x345a67);}}async function confirmForce(){const _0x42a0d3=a43_0x530a46,_0xcbda96=createInterface({'input':process[_0x42a0d3(0x1f2)],'output':process[_0x42a0d3(0x1ae)]}),_0x1254cf=await new Promise(_0x3d6f6b=>{const _0x2ef422=_0x42a0d3;_0xcbda96[_0x2ef422(0x1d8)](_0x2ef422(0x215),_0x3d6f6b);});return _0xcbda96[_0x42a0d3(0x19c)](),['y',_0x42a0d3(0x1e3)][_0x42a0d3(0x1aa)](_0x1254cf[_0x42a0d3(0x1b1)]()['toLowerCase']());}
|
|
1
|
+
const a43_0x266076=a43_0xf235;function a43_0xf235(_0x1179ab,_0x56705d){_0x1179ab=_0x1179ab-0x135;const _0x16a575=a43_0x16a5();let _0xf23596=_0x16a575[_0x1179ab];return _0xf23596;}(function(_0x17a63e,_0x541776){const _0x3edbfc=a43_0xf235,_0x5c22c9=_0x17a63e();while(!![]){try{const _0x9ccb54=-parseInt(_0x3edbfc(0x1c1))/0x1+-parseInt(_0x3edbfc(0x17a))/0x2*(parseInt(_0x3edbfc(0x16a))/0x3)+parseInt(_0x3edbfc(0x15f))/0x4+parseInt(_0x3edbfc(0x13a))/0x5+-parseInt(_0x3edbfc(0x1be))/0x6*(parseInt(_0x3edbfc(0x19e))/0x7)+parseInt(_0x3edbfc(0x14f))/0x8+parseInt(_0x3edbfc(0x192))/0x9*(parseInt(_0x3edbfc(0x1c2))/0xa);if(_0x9ccb54===_0x541776)break;else _0x5c22c9['push'](_0x5c22c9['shift']());}catch(_0x44cf78){_0x5c22c9['push'](_0x5c22c9['shift']());}}}(a43_0x16a5,0xa4943));import{createInterface}from'node:readline';function a43_0x16a5(){const _0x33b164=['newDirectory','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','existed','hookLocation','1718135QFhyqO','Pull\x20only\x20this\x20script\x20type','filter','normalize','\x22:\x20','functions','length','\x20bff\x20push\x20--type\x20','scriptsRootDir','join','\x20conflict','selectedAppName','ino','COMMON','scriptContent','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','force','oldDirectoryPath','reverse','all','values','10309320tWUOUU','defaultApp','rekey','dev','question','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','lastSync','\x20resolution','get','set','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','\x22\x20and\x20\x22','unresolvable\x20target\x20path','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','\x22:\x20both\x20target\x20\x22','keyChanges','1684068SsgdLX','\x20pulled','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','push_local','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','validation','ENOENT','scriptsRoot','\x20Recovery\x20errors:\x20','message','10341ptCZJJ','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','skipped','Failed\x20to\x20write\x20local\x20script\x20\x22','yes','boolean','mode','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','.js','stderr','currentApp','alias','\x20failed','newLockKey','require','map','552suLCmW','includes','case-rename','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','functionNode','sourceFilePathByNewLockKey','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.','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','datasetCode','\x22\x20from\x20the\x20lock\x20file.','would_pull','apps','HOOK','migrations','some','entries','requires','functionName','\x22\x20may\x20remain.','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','type','\x22:\x20its\x20target\x20\x22','\x22\x20not\x20found\x20after\x20ensureLockScope.','63387DIiJlq','Force\x20overwrite\x20local\x20unsynced\x20changes','Remote\x20script\x20missing\x20id.','scriptType','read','utf8','remoteId','\x20--name\x20','toISOString','¤tPage=1&pageSize=','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','write','87549TevGCT','parse','move','Force\x20pull\x20cancelled.','Remote\x20script\x20missing\x20content.','has','bool','mergedCli','lockKey','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','split','entry','version','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','delete','oldDirectory','\x22;\x20temporary\x20directory\x20\x22','toLowerCase','newDirectoryPath','Pull\x20complete:\x20','operationType','flatMap','push','BFF_LOCAL_UNSYNCED','appCode','pull','lockFilePath','string','\x22\x20to\x20\x22','\x22\x20from\x20\x22','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','conflict','6sCAPvR','projectedFunctions','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','992841ZaJtsc','820LSTyWF','str','.hook-directory-migrate-','oldLockKey','stringify','filePath'];a43_0x16a5=function(){return _0x33b164;};return a43_0x16a5();}import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':a43_0x266076(0x1b7),'description':a43_0x266076(0x154),'risk':a43_0x266076(0x196),'structuredErrors':!![],'flags':[{'name':a43_0x266076(0x18f),'type':a43_0x266076(0x1b9),'description':a43_0x266076(0x13b),'enum':[a43_0x266076(0x147),'ENDPOINT',a43_0x266076(0x186)]},{'name':'force','type':a43_0x266076(0x16f),'description':a43_0x266076(0x193)}],async 'dryRun'(_0x139678){const _0x439cbb=a43_0x266076,_0x41c0c5=loadBffProjectConfig(_0x139678[_0x439cbb(0x1b6)]),_0x362f3b=await readBffLockFile(_0x41c0c5[_0x439cbb(0x1b8)]),{appLock:_0x11b348}=ensureLockScope(_0x362f3b??createEmptyBffLock(),_0x139678[_0x439cbb(0x1b6)],_0x41c0c5['scriptsRoot'],'pull'),_0x32c2ba=normalizeBffType(_0x139678[_0x439cbb(0x1c3)](_0x439cbb(0x18f)))??undefined,[_0x5f463b,_0x53530c]=await Promise[_0x439cbb(0x14d)]([listBffScripts(_0x139678['appCode'],_0x32c2ba),getBffScriptStatistics(_0x139678['appCode'])]),_0x53ff6e=_0x5f463b[_0x439cbb(0x188)](_0x28d8c9=>normalizeBffType(_0x28d8c9[_0x439cbb(0x195)])===_0x439cbb(0x186)),_0xe88eea=_0x53ff6e?buildDatasetCodeToAliasMap(_0x139678['apiDir'],_0x139678[_0x439cbb(0x1b6)],_0x139678['selectedAppName']||_0x139678[_0x439cbb(0x1a5)]?.[_0x439cbb(0x174)]||_0x139678[_0x439cbb(0x1a5)]?.['defaultApp']):new Map(),_0x2081ab=_0x53ff6e?await planHookDirectoryMigration(_0x41c0c5,_0x11b348,_0xe88eea,await scanLocalBffFunctions(_0x41c0c5,_0x439cbb(0x186))):undefined,_0x2dd1c1=createHookLocationMap(_0x53530c),_0x44d650=[];for(const _0x395268 of _0x5f463b){const _0x472372=resolveRemoteScriptTarget(_0x41c0c5,_0x395268,_0x2dd1c1,_0x2081ab?.['projectedFunctions']??_0x11b348['functions'],_0xe88eea);if(!_0x472372){_0x44d650[_0x439cbb(0x1b4)]({'scriptType':_0x395268[_0x439cbb(0x195)],'functionName':_0x395268[_0x439cbb(0x18b)]??'','status':_0x439cbb(0x16c),'reason':_0x439cbb(0x15b)});continue;}const _0x498960=(_0x2081ab?.[_0x439cbb(0x1bf)]??_0x11b348[_0x439cbb(0x13f)])[_0x472372[_0x439cbb(0x1a6)]],_0x10d20c=_0x395268['scriptContent']!=null?computeContentHash(_0x395268[_0x439cbb(0x148)]):undefined,_0x484633=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x2081ab,_0x472372)??_0x472372['filePath'],_0x498960,_0x10d20c),_0x58c755=_0x484633?localUnsyncedConflict(_0x472372,_0x395268['id']):undefined;_0x44d650[_0x439cbb(0x1b4)]({'lockKey':_0x472372['lockKey'],'filePath':_0x472372[_0x439cbb(0x135)],'remoteId':_0x395268['id']??null,'status':_0x58c755?_0x439cbb(0x1bd):_0x439cbb(0x184),..._0x58c755?{'conflict':_0x58c755}:{},..._0x472372['hookLocation']?{'alias':_0x472372[_0x439cbb(0x139)][_0x439cbb(0x175)]??null,'datasetCode':_0x472372[_0x439cbb(0x139)][_0x439cbb(0x182)],'operationType':_0x472372[_0x439cbb(0x139)][_0x439cbb(0x1b2)],'functionNode':_0x472372[_0x439cbb(0x139)][_0x439cbb(0x17e)]}:{}});}return{'method':'GET','url':'/api/management/library/scripts/list?appCode='+_0x139678[_0x439cbb(0x1b6)]+(_0x32c2ba?'&type='+_0x32c2ba:'')+_0x439cbb(0x19b)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x139678[_0x439cbb(0x1b6)],'filterType':_0x32c2ba??null,..._0x2081ab&&_0x2081ab[_0x439cbb(0x187)][_0x439cbb(0x140)]>0x0?{'hookDirectoryMigrations':_0x2081ab[_0x439cbb(0x187)][_0x439cbb(0x179)](_0x54bdca=>({'from':_0x54bdca['oldDirectory'],'to':_0x54bdca[_0x439cbb(0x136)]}))}:{},'files':_0x44d650},'description':'Would\x20inspect\x20'+_0x44d650['length']+_0x439cbb(0x18e)};},async 'execute'(_0xfa87eb){const _0x144be7=a43_0x266076,_0x4c486d=loadBffProjectConfig(_0xfa87eb['appCode']),_0x521e00=await readBffLockFile(_0x4c486d[_0x144be7(0x1b8)]),{lockData:_0x146dc5,appLock:_0x4a1457}=ensureLockScope(_0x521e00??createEmptyBffLock(),_0xfa87eb[_0x144be7(0x1b6)],_0x4c486d[_0x144be7(0x167)],_0x144be7(0x1b7)),_0x4cce0b=normalizeBffType(_0xfa87eb[_0x144be7(0x1c3)](_0x144be7(0x18f)))??undefined;if(_0xfa87eb[_0x144be7(0x1c3)](_0x144be7(0x18f))&&!_0x4cce0b)throw CliErrors[_0x144be7(0x165)](_0x144be7(0x18d));const [_0x57eac1,_0x495ab5]=await Promise[_0x144be7(0x14d)]([listBffScripts(_0xfa87eb[_0x144be7(0x1b6)],_0x4cce0b),getBffScriptStatistics(_0xfa87eb[_0x144be7(0x1b6)])]);if(_0x57eac1[_0x144be7(0x140)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x199e24=_0xfa87eb[_0x144be7(0x1a4)](_0x144be7(0x14a));if(_0x199e24&&!_0xfa87eb['nonInteractive']){const _0x386f3e=await confirmForce();if(!_0x386f3e)throw CliErrors['cancelled'](_0x144be7(0x1a1));}if(_0x199e24&&_0xfa87eb['nonInteractive']){}const _0x3d05cd=_0x57eac1['some'](_0x161f45=>normalizeBffType(_0x161f45[_0x144be7(0x195)])===_0x144be7(0x186)),_0x58ed42=_0x3d05cd?buildDatasetCodeToAliasMap(_0xfa87eb['apiDir'],_0xfa87eb[_0x144be7(0x1b6)],_0xfa87eb[_0x144be7(0x145)]||_0xfa87eb[_0x144be7(0x1a5)]?.['currentApp']||_0xfa87eb['mergedCli']?.[_0x144be7(0x150)]):new Map(),_0x404146=createHookLocationMap(_0x495ab5),_0x29ec7a=JSON[_0x144be7(0x19f)](JSON[_0x144be7(0x1c6)](_0x146dc5)),_0x20f8ef=_0xfa87eb[_0x144be7(0x1b6)],_0x58792b=_0x29ec7a[_0x144be7(0x185)][_0x20f8ef];if(!_0x58792b)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x20f8ef+_0x144be7(0x191));const _0xde2b0d=_0x3d05cd?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4c486d,_0x58792b,_0x58ed42,await scanLocalBffFunctions(_0x4c486d,_0x144be7(0x186))),_0x58792b):undefined,_0x54454c=createPullFileTransaction(),_0x558be4=[],_0x29a935=[],_0x8b29c=[],_0x2548fe=[];for(const _0xe2b42d of _0x57eac1){const _0x562d42=resolveRemoteScriptTarget(_0x4c486d,_0xe2b42d,_0x404146,_0x58792b['functions'],_0x58ed42);if(!_0x562d42){_0x29a935[_0x144be7(0x1b4)]({'lockKey':_0xe2b42d[_0x144be7(0x195)]+'/'+_0xe2b42d['functionName'],'reason':_0x144be7(0x15b)});continue;}const _0x63b960=_0x58792b[_0x144be7(0x13f)][_0x562d42['lockKey']];try{if(!_0xe2b42d['id'])throw new Error(_0x144be7(0x194));if(_0xe2b42d[_0x144be7(0x148)]==null)throw new Error(_0x144be7(0x1a2));const _0x415040=_0xe2b42d[_0x144be7(0x148)],_0x1abaa1=computeContentHash(_0x415040);if(!_0x199e24){const _0xcda110=await hasUnsyncedLocalChanges(_0x562d42[_0x144be7(0x135)],_0x63b960,_0x1abaa1);if(_0xcda110){_0x8b29c['push'](localUnsyncedConflict(_0x562d42,_0xe2b42d['id']));continue;}}await _0x54454c[_0x144be7(0x19d)](_0x562d42[_0x144be7(0x135)],_0x415040);const _0x3dff44={'hash':_0x1abaa1,'remoteId':_0xe2b42d['id'],'version':_0xe2b42d[_0x144be7(0x1aa)]};_0x562d42['type']===_0x144be7(0x186)&&_0x562d42[_0x144be7(0x139)]&&(_0x3dff44['alias']=_0x562d42[_0x144be7(0x139)][_0x144be7(0x175)],_0x3dff44['datasetCode']=_0x562d42[_0x144be7(0x139)][_0x144be7(0x182)],_0x3dff44[_0x144be7(0x1b2)]=_0x562d42['hookLocation'][_0x144be7(0x1b2)],_0x3dff44[_0x144be7(0x17e)]=_0x562d42['hookLocation']['functionNode']),_0x58792b['functions'][_0x562d42[_0x144be7(0x1a6)]]=_0x3dff44,_0x558be4['push']({'lockKey':_0x562d42[_0x144be7(0x1a6)],'remoteId':_0xe2b42d['id']});}catch(_0x1933aa){_0x2548fe[_0x144be7(0x1b4)]({'lockKey':_0x562d42[_0x144be7(0x1a6)],'error':_0x1933aa instanceof Error?_0x1933aa[_0x144be7(0x169)]:String(_0x1933aa)});}}_0x58792b['lastSync']=new Date()[_0x144be7(0x19a)]();try{await writeBffLockFile(_0x4c486d[_0x144be7(0x1b8)],_0x29ec7a);}catch(_0x247ac1){const _0x127ae4=[...await _0x54454c['rollback'](),...await _0xde2b0d?.['rollback']()??[]];throw withRollbackErrors(_0x247ac1,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x127ae4);}return{'ok':_0x2548fe['length']===0x0,'data':{'pulled':_0x558be4,'skipped':_0x29a935,'conflicts':_0x8b29c,'failed':_0x2548fe},'message':formatPullMessage(_0x558be4['length'],_0x29a935[_0x144be7(0x140)],_0x8b29c[_0x144be7(0x140)],_0x2548fe['length'])};}};function localUnsyncedConflict(_0x411f16,_0x1d73d3){const _0x1df9dd=a43_0x266076,_0x340188=_0x411f16[_0x1df9dd(0x1a6)][_0x1df9dd(0x1a8)]('/')['at'](-0x1);return{'code':_0x1df9dd(0x1b5),'lockKey':_0x411f16[_0x1df9dd(0x1a6)],'filePath':_0x411f16['filePath'],..._0x1d73d3!=null?{'remoteId':_0x1d73d3}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':_0x1df9dd(0x162),'command':CLI_BIN_NAME+_0x1df9dd(0x141)+_0x411f16[_0x1df9dd(0x18f)]+_0x1df9dd(0x199)+_0x340188+'\x20--format\x20compress','requiresReview':!![],'message':_0x1df9dd(0x180)}};}function formatPullMessage(_0x333e84,_0x28b445,_0x1ccc7f,_0x2a65a8){const _0x32bfeb=a43_0x266076,_0x2ba3e3=[_0x32bfeb(0x1b1)+_0x333e84+_0x32bfeb(0x160),_0x28b445+'\x20skipped'];_0x1ccc7f>0x0&&_0x2ba3e3[_0x32bfeb(0x1b4)](_0x1ccc7f+_0x32bfeb(0x144)+(_0x1ccc7f===0x1?'':'s')+'\x20'+(_0x1ccc7f===0x1?_0x32bfeb(0x18a):_0x32bfeb(0x178))+_0x32bfeb(0x156));if(_0x2a65a8>0x0)_0x2ba3e3['push'](_0x2a65a8+_0x32bfeb(0x176));return _0x2ba3e3[_0x32bfeb(0x143)](',\x20');}async function hasUnsyncedLocalChanges(_0x321842,_0x4826b4,_0x522b4d){if(!await fileExists(_0x321842))return![];const _0x53873a=await computeFileHash(_0x321842);if(!_0x4826b4)return _0x522b4d?_0x53873a!==_0x522b4d:!![];return _0x53873a!==_0x4826b4['hash'];}function createPullFileTransaction(){const _0x2ab9e8=new Map(),_0x4dfa6a=async(_0x385927,_0x2c3836)=>{const _0x2c4f22=a43_0xf235;try{if(_0x2c3836[_0x2c4f22(0x138)])await ensureParentDirectory(_0x385927),await writeFile(_0x385927,_0x2c3836['content']);else try{await unlink(_0x385927);}catch(_0x5be6fd){if(_0x5be6fd['code']!=='ENOENT')throw _0x5be6fd;}return undefined;}catch(_0x3ce978){return _0x3ce978 instanceof Error?_0x3ce978:new Error(String(_0x3ce978));}};return{async 'write'(_0x1ca019,_0xe6e19e){const _0x45dfc4=a43_0xf235;if(!_0x2ab9e8[_0x45dfc4(0x1a3)](_0x1ca019))try{_0x2ab9e8['set'](_0x1ca019,{'existed':!![],'content':await readFile(_0x1ca019)});}catch(_0x37b525){if(_0x37b525['code']!==_0x45dfc4(0x166))throw _0x37b525;_0x2ab9e8[_0x45dfc4(0x158)](_0x1ca019,{'existed':![]});}try{await ensureParentDirectory(_0x1ca019),await writeFile(_0x1ca019,_0xe6e19e,_0x45dfc4(0x197));}catch(_0x4628c4){const _0x39bacb=await _0x4dfa6a(_0x1ca019,_0x2ab9e8[_0x45dfc4(0x157)](_0x1ca019));if(!_0x39bacb)_0x2ab9e8[_0x45dfc4(0x1ac)](_0x1ca019);throw withRollbackErrors(_0x4628c4,_0x45dfc4(0x16d)+_0x1ca019+'\x22.',_0x39bacb?[_0x39bacb]:[]);}},async 'rollback'(){const _0x353af4=a43_0xf235,_0x45e30c=[];for(const [_0x328855,_0x355bd5]of[..._0x2ab9e8[_0x353af4(0x189)]()][_0x353af4(0x14c)]()){const _0x326327=await _0x4dfa6a(_0x328855,_0x355bd5);_0x326327&&_0x45e30c['push'](new Error(_0x353af4(0x164)+_0x328855+_0x353af4(0x13e)+_0x326327['message']));}return _0x45e30c;}};}function withRollbackErrors(_0x5ee3dc,_0x917cca,_0x553cb4){const _0x77edfc=a43_0x266076,_0x276969=_0x5ee3dc instanceof Error?_0x5ee3dc:new Error(String(_0x5ee3dc));if(_0x553cb4[_0x77edfc(0x140)]===0x0)return _0x276969;return new AggregateError([_0x276969,..._0x553cb4],_0x917cca+_0x77edfc(0x168)+_0x553cb4[_0x77edfc(0x179)](_0x363dd3=>_0x363dd3[_0x77edfc(0x169)])[_0x77edfc(0x143)](';\x20'));}function buildDatasetCodeToAliasMap(_0x1598c7,_0x32cc92,_0x4bcd65){const _0x2aaa4f=a43_0x266076,_0x366607=resolveApiModelSource(_0x1598c7,_0x32cc92,_0x4bcd65),_0x32e06c=loadAliasMap(_0x1598c7,undefined,_0x366607[_0x2aaa4f(0x135)],_0x366607['profileName']);return assertUnambiguousHookAliases(_0x32e06c),new Map(_0x32e06c[_0x2aaa4f(0x179)](_0x34d3a5=>[_0x34d3a5['datasetCode'][_0x2aaa4f(0x1af)](),_0x34d3a5['alias']]));}async function planHookDirectoryMigration(_0xa0c703,_0x1a70e9,_0x524dec,_0x541a91){const _0x83bf84=a43_0x266076,_0x467496=new Map();for(const [_0x8fb239,_0x4bdeaf]of Object[_0x83bf84(0x189)](_0x1a70e9['functions'])){const [_0x356000,_0x388d93,_0x50aa32,_0x5eb673,_0x71bb1e,..._0x2477dc]=_0x8fb239['split']('/');if(_0x356000!=='HOOK'||!_0x388d93||!_0x50aa32||!_0x5eb673||!_0x71bb1e||_0x2477dc[_0x83bf84(0x140)]>0x0||!_0x4bdeaf[_0x83bf84(0x182)])continue;const _0x159882=_0x524dec['get'](_0x4bdeaf['datasetCode'][_0x83bf84(0x1af)]()),_0x2493cb=_0x159882??_0x4bdeaf[_0x83bf84(0x182)];if(!isSafeHookDirectorySegment(_0x388d93))throw CliErrors[_0x83bf84(0x165)](_0x83bf84(0x161)+_0x388d93+_0x83bf84(0x183));if(!isSafeHookDirectorySegment(_0x2493cb))throw CliErrors[_0x83bf84(0x165)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x388d93+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x388d93===_0x2493cb)continue;const _0x7e4ea2=_0x467496[_0x83bf84(0x157)](_0x388d93)??{'datasetCode':_0x4bdeaf[_0x83bf84(0x182)],'alias':_0x159882,'keyChanges':[]};if(_0x7e4ea2[_0x83bf84(0x182)]!==_0x4bdeaf[_0x83bf84(0x182)])throw CliErrors[_0x83bf84(0x165)](_0x83bf84(0x163)+_0x388d93+_0x83bf84(0x171));const _0x32aeb9='HOOK/'+_0x2493cb+'/'+_0x50aa32+'/'+_0x5eb673+'/'+_0x71bb1e;try{resolveLocalFilePathFromLockKey(_0xa0c703,_0x8fb239),resolveLocalFilePathFromLockKey(_0xa0c703,_0x32aeb9);}catch(_0x5a1d67){throw CliErrors[_0x83bf84(0x165)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x8fb239+_0x83bf84(0x13e)+(_0x5a1d67 instanceof Error?_0x5a1d67[_0x83bf84(0x169)]:String(_0x5a1d67)));}_0x7e4ea2[_0x83bf84(0x15e)][_0x83bf84(0x1b4)]({'oldLockKey':_0x8fb239,'newLockKey':_0x32aeb9,'entry':_0x4bdeaf}),_0x467496[_0x83bf84(0x158)](_0x388d93,_0x7e4ea2);}const _0x2b2e9c=new Set([..._0x467496[_0x83bf84(0x14e)]()][_0x83bf84(0x1b3)](_0x2b0520=>_0x2b0520[_0x83bf84(0x15e)][_0x83bf84(0x179)](_0x48432e=>_0x48432e[_0x83bf84(0x1c5)]))),_0xa6f16d=new Map(),_0x1eeb89=new Map();for(const [_0x441f7c,_0x377664]of _0x467496){const _0x5410b3=_0x377664['alias']??_0x377664[_0x83bf84(0x182)],_0x56d786=hookDirectoryIdentity(_0x5410b3),_0x31de39=_0xa6f16d['get'](_0x56d786);if(_0x31de39&&_0x31de39!==_0x441f7c)throw CliErrors['validation'](_0x83bf84(0x159)+_0x31de39+_0x83bf84(0x15a)+_0x441f7c+_0x83bf84(0x15d)+_0x5410b3+_0x83bf84(0x181));_0xa6f16d[_0x83bf84(0x158)](_0x56d786,_0x441f7c);for(const _0x3e352a of _0x377664[_0x83bf84(0x15e)]){const _0x352849=_0x1eeb89['get'](_0x3e352a[_0x83bf84(0x177)]);if(_0x352849&&_0x352849!==_0x3e352a[_0x83bf84(0x1c5)])throw CliErrors[_0x83bf84(0x165)](_0x83bf84(0x1ab)+_0x352849+_0x83bf84(0x15a)+_0x3e352a[_0x83bf84(0x1c5)]+_0x83bf84(0x15d)+_0x3e352a[_0x83bf84(0x177)]+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x2b2e9c[_0x83bf84(0x1a3)](_0x3e352a[_0x83bf84(0x177)]))throw CliErrors[_0x83bf84(0x165)](_0x83bf84(0x1bc)+_0x3e352a[_0x83bf84(0x1c5)]+_0x83bf84(0x190)+_0x3e352a[_0x83bf84(0x177)]+_0x83bf84(0x17d));_0x1eeb89['set'](_0x3e352a[_0x83bf84(0x177)],_0x3e352a[_0x83bf84(0x1c5)]);}}const _0x22a774=new Map();for(const [_0x5386a2,_0x2b4ab4]of _0x524dec){_0x22a774['set'](hookDirectoryIdentity(_0x2b4ab4),_0x5386a2);}const _0x31534e=[];for(const [_0x5f0c0c,_0x1e5ee0]of _0x467496){const _0x4c1e2a=_0x1e5ee0[_0x83bf84(0x175)]??_0x1e5ee0['datasetCode'],_0x5be30f=join(_0xa0c703[_0x83bf84(0x142)],_0x83bf84(0x186),_0x5f0c0c),_0x5ac8b8=join(_0xa0c703[_0x83bf84(0x142)],_0x83bf84(0x186),_0x4c1e2a),_0x492f63=await directoryExists(_0x5be30f),_0x283b84=await directoryExists(_0x5ac8b8),_0x1053d8=_0x492f63?_0x283b84?await sameDirectory(_0x5be30f,_0x5ac8b8)?_0x83bf84(0x17c):undefined:_0x83bf84(0x1a0):_0x83bf84(0x151);if(!_0x1053d8)throw CliErrors[_0x83bf84(0x165)](_0x83bf84(0x163)+_0x5f0c0c+_0x83bf84(0x1ba)+_0x4c1e2a+_0x83bf84(0x137));const _0xa26411=_0x22a774[_0x83bf84(0x157)](hookDirectoryIdentity(_0x5f0c0c));if(_0xa26411&&_0xa26411!==_0x1e5ee0[_0x83bf84(0x182)][_0x83bf84(0x1af)]()){const _0x68c942=new Set(_0x1e5ee0[_0x83bf84(0x15e)][_0x83bf84(0x179)](_0x372ea2=>_0x372ea2['oldLockKey'])),_0x12ed01=_0x541a91[_0x83bf84(0x13c)](_0x4e2e6f=>_0x4e2e6f[_0x83bf84(0x18f)]===_0x83bf84(0x186)&&_0x4e2e6f[_0x83bf84(0x175)]!=null&&hookDirectoryIdentity(_0x4e2e6f[_0x83bf84(0x175)])===hookDirectoryIdentity(_0x5f0c0c)&&!_0x68c942[_0x83bf84(0x1a3)](_0x4e2e6f['lockKey']));if(_0x12ed01[_0x83bf84(0x140)]>0x0)throw CliErrors[_0x83bf84(0x165)](_0x83bf84(0x163)+_0x5f0c0c+_0x83bf84(0x1a7));}const _0x1401cc=_0x22a774[_0x83bf84(0x157)](hookDirectoryIdentity(_0x4c1e2a));if(_0x1401cc&&_0x1401cc!==_0x1e5ee0['datasetCode'][_0x83bf84(0x1af)]())throw CliErrors[_0x83bf84(0x165)](_0x83bf84(0x163)+_0x5f0c0c+_0x83bf84(0x1ba)+_0x4c1e2a+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x14503e of _0x1e5ee0['keyChanges']){const _0x370aaa=_0x1a70e9[_0x83bf84(0x13f)][_0x14503e['newLockKey']];if(_0x370aaa&&!_0x2b2e9c['has'](_0x14503e[_0x83bf84(0x177)])&&!sameHookIdentity(_0x14503e[_0x83bf84(0x1a9)],_0x370aaa))throw CliErrors['validation'](_0x83bf84(0x163)+_0x5f0c0c+_0x83bf84(0x1ba)+_0x4c1e2a+_0x83bf84(0x16b));}_0x31534e['push']({'oldDirectory':_0x5f0c0c,'newDirectory':_0x4c1e2a,'oldDirectoryPath':_0x5be30f,'newDirectoryPath':_0x5ac8b8,'mode':_0x1053d8,'alias':_0x1e5ee0[_0x83bf84(0x175)],'keyChanges':_0x1e5ee0[_0x83bf84(0x15e)]});}const _0x3f3b03={..._0x1a70e9[_0x83bf84(0x13f)]},_0x24d851=new Map(),_0x1e48dc=new Map();for(const _0x2081b5 of _0x31534e){const _0x54dfaa=_0x2081b5[_0x83bf84(0x170)]!==_0x83bf84(0x151);_0x54dfaa&&_0x1e48dc[_0x83bf84(0x158)](hookDirectoryIdentity(_0x2081b5['newDirectory']),_0x2081b5[_0x83bf84(0x14b)]);for(const _0x5eb360 of _0x2081b5[_0x83bf84(0x15e)]){const _0xe1cc6b=_0x3f3b03[_0x5eb360[_0x83bf84(0x177)]],_0x16a7ef=_0x54dfaa?_0x5eb360[_0x83bf84(0x1a9)]:_0xe1cc6b??_0x5eb360[_0x83bf84(0x1a9)];_0x3f3b03[_0x5eb360[_0x83bf84(0x177)]]=canonicalizeHookEntry(_0x16a7ef,_0x2081b5[_0x83bf84(0x175)]),delete _0x3f3b03[_0x5eb360['oldLockKey']],_0x54dfaa&&_0x24d851[_0x83bf84(0x158)](_0x5eb360[_0x83bf84(0x177)],resolveLocalFilePathFromLockKey(_0xa0c703,_0x5eb360[_0x83bf84(0x1c5)]));}}return{'migrations':_0x31534e,'projectedFunctions':_0x3f3b03,'sourceFilePathByNewLockKey':_0x24d851,'sourceDirectoryPathByNewDirectory':_0x1e48dc};}function resolveMigratedSourceFilePath(_0x1facfb,_0x37ebdd){const _0x2b6af1=a43_0x266076;if(!_0x1facfb||!_0x37ebdd)return undefined;const _0x3b9b37=_0x1facfb[_0x2b6af1(0x17f)][_0x2b6af1(0x157)](_0x37ebdd[_0x2b6af1(0x1a6)]);if(_0x3b9b37)return _0x3b9b37;if(_0x37ebdd[_0x2b6af1(0x18f)]!==_0x2b6af1(0x186))return undefined;const [,_0x306ce6,..._0x29c891]=_0x37ebdd['lockKey'][_0x2b6af1(0x1a8)]('/');if(!_0x306ce6||_0x29c891['length']===0x0)return undefined;const _0x55259e=_0x1facfb['sourceDirectoryPathByNewDirectory'][_0x2b6af1(0x157)](hookDirectoryIdentity(_0x306ce6));return _0x55259e?join(_0x55259e,..._0x29c891)+_0x2b6af1(0x172):undefined;}function sameHookIdentity(_0x23b7ee,_0x330604){const _0x3fd20e=a43_0x266076;return _0x23b7ee[_0x3fd20e(0x198)]===_0x330604[_0x3fd20e(0x198)]&&_0x23b7ee['datasetCode']===_0x330604[_0x3fd20e(0x182)]&&_0x23b7ee[_0x3fd20e(0x1b2)]===_0x330604[_0x3fd20e(0x1b2)]&&_0x23b7ee[_0x3fd20e(0x17e)]===_0x330604['functionNode'];}function canonicalizeHookEntry(_0x540b61,_0x38f81f){const {alias:_0x4dd760,..._0x5f4af6}=_0x540b61;return _0x38f81f?{..._0x5f4af6,'alias':_0x38f81f}:_0x5f4af6;}function hookDirectoryIdentity(_0x63eab3){const _0x175013=a43_0x266076;return _0x63eab3[_0x175013(0x13d)]('NFC')['toLowerCase']();}function isSafeHookDirectorySegment(_0x3561e4){return isSafeLockKeySegment(_0x3561e4);}async function sameDirectory(_0x463db2,_0x544dfe){const _0x41041b=a43_0x266076,[_0x1a8732,_0x45f9f4]=await Promise[_0x41041b(0x14d)]([stat(_0x463db2),stat(_0x544dfe)]);return _0x1a8732['dev']===_0x45f9f4[_0x41041b(0x152)]&&_0x1a8732[_0x41041b(0x146)]===_0x45f9f4[_0x41041b(0x146)];}async function applyHookDirectoryMigration(_0x37720e,_0x33a997){const _0x52ae3e=a43_0x266076,_0x53bcb7=_0x33a997['functions'],_0x3c8bb4=_0x33a997[_0x52ae3e(0x155)],_0x2820ec=[],_0x5765fe=async()=>{const _0x5ed4fe=_0x52ae3e,_0x56e1b5=[];_0x33a997[_0x5ed4fe(0x13f)]=_0x53bcb7,_0x33a997['lastSync']=_0x3c8bb4;for(const {migration:_0x3144e9,temporaryPath:_0x388610}of[..._0x2820ec][_0x5ed4fe(0x14c)]()){try{_0x388610?(await rename(_0x3144e9[_0x5ed4fe(0x1b0)],_0x388610),await rename(_0x388610,_0x3144e9[_0x5ed4fe(0x14b)])):await rename(_0x3144e9[_0x5ed4fe(0x1b0)],_0x3144e9['oldDirectoryPath']);}catch(_0x9da5e9){_0x56e1b5['push'](new Error(_0x5ed4fe(0x15c)+_0x3144e9[_0x5ed4fe(0x1ad)]+_0x5ed4fe(0x1bb)+_0x3144e9[_0x5ed4fe(0x136)]+_0x5ed4fe(0x13e)+(_0x9da5e9 instanceof Error?_0x9da5e9[_0x5ed4fe(0x169)]:String(_0x9da5e9))));}}return _0x56e1b5;};try{for(const _0x5664ae of _0x37720e[_0x52ae3e(0x187)]){if(_0x5664ae[_0x52ae3e(0x170)]===_0x52ae3e(0x1a0))await ensureParentDirectory(_0x5664ae[_0x52ae3e(0x1b0)]),await rename(_0x5664ae['oldDirectoryPath'],_0x5664ae[_0x52ae3e(0x1b0)]),_0x2820ec['push']({'migration':_0x5664ae});else{if(_0x5664ae['mode']===_0x52ae3e(0x17c)){const _0x6c0b31=join(dirname(_0x5664ae[_0x52ae3e(0x14b)]),_0x52ae3e(0x1c4)+randomUUID());await rename(_0x5664ae[_0x52ae3e(0x14b)],_0x6c0b31);try{await rename(_0x6c0b31,_0x5664ae[_0x52ae3e(0x1b0)]);}catch(_0x59e6b2){try{await rename(_0x6c0b31,_0x5664ae['oldDirectoryPath']);}catch(_0x1bb182){throw withRollbackErrors(_0x59e6b2,_0x52ae3e(0x149)+_0x5664ae[_0x52ae3e(0x1ad)]+_0x52ae3e(0x1ba)+_0x5664ae['newDirectory']+_0x52ae3e(0x1ae)+_0x6c0b31+_0x52ae3e(0x18c),[new Error(_0x52ae3e(0x1c0)+_0x6c0b31+_0x52ae3e(0x1ba)+_0x5664ae['oldDirectory']+_0x52ae3e(0x13e)+(_0x1bb182 instanceof Error?_0x1bb182['message']:String(_0x1bb182)))]);}throw _0x59e6b2;}_0x2820ec[_0x52ae3e(0x1b4)]({'migration':_0x5664ae,'temporaryPath':_0x6c0b31});}}}return _0x33a997['functions']=_0x37720e[_0x52ae3e(0x1bf)],{'rollback':_0x5765fe};}catch(_0x5c6808){const _0x343ec8=await _0x5765fe();throw withRollbackErrors(_0x5c6808,_0x52ae3e(0x19c),_0x343ec8);}}async function confirmForce(){const _0x31f6c8=a43_0x266076,_0x4a7cb0=createInterface({'input':process['stdin'],'output':process[_0x31f6c8(0x173)]}),_0x1d7cf5=await new Promise(_0x2d909f=>{const _0x4e9a63=_0x31f6c8;_0x4a7cb0[_0x4e9a63(0x153)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x2d909f);});return _0x4a7cb0['close'](),['y',_0x31f6c8(0x16e)][_0x31f6c8(0x17b)](_0x1d7cf5['trim']()[_0x31f6c8(0x1af)]());}
|