@lovrabet/rabetbase-cli 2.5.4 → 2.5.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-restore.js +1 -1
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/dataset/user-deleted-field-list.js +1 -1
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +1 -1
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/table-diff-shared.js +1 -1
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +1 -1
- package/lib/commands/deployment/sync-jobs.js +1 -1
- package/lib/commands/deployment/sync-status.js +1 -1
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/flow/create.js +1 -1
- package/lib/commands/flow/detail.js +1 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +1 -1
- package/lib/commands/flow/publish.js +1 -1
- package/lib/commands/flow/runtime-resources-shared.js +1 -1
- package/lib/commands/flow/runtime-role-list.js +1 -1
- package/lib/commands/flow/runtime-role-user-list.js +1 -1
- package/lib/commands/flow/runtime-user-search.js +1 -1
- package/lib/commands/flow/shared.js +1 -1
- package/lib/commands/flow/update.js +1 -1
- package/lib/commands/flow/validate.js +1 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +1 -1
- package/lib/commands/instant-api-policy/publish.js +1 -1
- package/lib/commands/instant-api-policy/pull.js +1 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +1 -1
- package/lib/commands/instant-api-policy/shared.js +1 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +1 -1
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/subapp-assets.js +1 -1
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +1 -1
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/menu/visibility-update.js +1 -1
- package/lib/commands/notification/config-create.js +1 -1
- package/lib/commands/notification/config-delete.js +1 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/config-update.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +1 -1
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/create.js +1 -1
- package/lib/commands/page/custom/detail.js +1 -1
- package/lib/commands/page/custom/list.js +1 -1
- package/lib/commands/page/custom/publish.js +1 -1
- package/lib/commands/page/custom/shared.js +1 -1
- package/lib/commands/page/custom/syntax.js +1 -1
- package/lib/commands/page/custom/update.js +1 -1
- package/lib/commands/page/data-list-status.js +1 -1
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/project/api-architecture-upgrade.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/materialize-project-template.js +1 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +1 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/feishu-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.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-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +2 -1
- package/skills/rabetbase/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/SKILL.md +39 -0
- package/skills/rabetbase-page-generation/references/component-baseline.md +18 -0
- package/skills/rabetbase-page-generation/references/generation.md +126 -0
- package/skills/rabetbase-page-generation/templates/onepage/build.mjs +48 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/create/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/index.jsx +194 -0
- package/skills/rabetbase-page-generation/templates/onepage/detail/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/README.md +20 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/index.jsx +721 -0
- package/skills/rabetbase-page-generation/templates/onepage/list/preview.png +0 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/editor.jsx +395 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/model.js +141 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/page.css +377 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/record-layout.jsx +90 -0
- package/skills/rabetbase-page-generation/templates/onepage/shared/responsive.jsx +70 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/README.md +21 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/index.jsx +4 -0
- package/skills/rabetbase-page-generation/templates/onepage/update/preview.png +0 -0
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x4266ad=a34_0x4ecb;(function(_0x119a5b,_0x36ce31){const _0x1131b2=a34_0x4ecb,_0x2e7e42=_0x119a5b();while(!![]){try{const _0x275938=parseInt(_0x1131b2(0x1dc))/0x1+parseInt(_0x1131b2(0x1e5))/0x2+parseInt(_0x1131b2(0x1ee))/0x3*(parseInt(_0x1131b2(0x1e1))/0x4)+parseInt(_0x1131b2(0x1e9))/0x5+-parseInt(_0x1131b2(0x1f2))/0x6*(parseInt(_0x1131b2(0x1db))/0x7)+-parseInt(_0x1131b2(0x1de))/0x8+parseInt(_0x1131b2(0x1ef))/0x9*(-parseInt(_0x1131b2(0x1f4))/0xa);if(_0x275938===_0x36ce31)break;else _0x2e7e42['push'](_0x2e7e42['shift']());}catch(_0x587296){_0x2e7e42['push'](_0x2e7e42['shift']());}}}(a34_0x5973,0xef6a2));function a34_0x5973(){const _0x4fcba6=['14NHiXpE','1264700BYlCmq','POST','6986504csewrs','tags','Read\x20config\x20value\x20from\x20file','4CdraGz','App\x20config\x20server\x20id\x20missing\x20for\x20key=','appCode','write','2161710bkpnlG','app-config','Updated','update','9546205iBXuJz','set','apiError','isFinite','get','536553oqBHQo','10459782wlhNnn','create','/smartapi/app-config/create','4252482rDAiVe','number','10qBNEBw','string','Created','file'];a34_0x5973=function(){return _0x4fcba6;};return a34_0x5973();}import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';function a34_0x4ecb(_0x1efbf8,_0xca695d){_0x1efbf8=_0x1efbf8-0x1da;const _0x597342=a34_0x5973();let _0x4ecbd0=_0x597342[_0x1efbf8];return _0x4ecbd0;}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_0x4266ad(0x1f1),UPDATE_PATH='/smartapi/app-config/update';export const appConfigSet={'service':a34_0x4266ad(0x1e6),'command':a34_0x4266ad(0x1ea),'description':'Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','risk':a34_0x4266ad(0x1e4),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x4266ad(0x1da),'type':a34_0x4266ad(0x1f5),'description':a34_0x4266ad(0x1e0)}],async 'validate'(_0x4545ad){readKeyArg(_0x4545ad),readOptionalTags(_0x4545ad),assertSingleValueSource(_0x4545ad);},async 'dryRun'(_0x2b6016){const _0x93b5c3=a34_0x4266ad,_0x6b1208=readKeyArg(_0x2b6016),_0x2f272b=readOptionalTags(_0x2b6016),_0x7de1d3=assertSingleValueSource(_0x2b6016);await assertValueSourceReadable(_0x7de1d3);const _0x4d23d1=await withAppConfigApiBoundary(_0x93b5c3(0x1ed),{'appCode':_0x2b6016[_0x93b5c3(0x1e3)],'key':_0x6b1208},()=>getAppConfigByKey(_0x2b6016[_0x93b5c3(0x1e3)],_0x6b1208)),_0x3ef7fa=_0x4d23d1?_0x93b5c3(0x1e8):_0x93b5c3(0x1f0),_0x429087=_0x4d23d1?projectAppConfig(_0x4d23d1):null,_0x1667b0=plannedAppConfig({'appCode':_0x2b6016[_0x93b5c3(0x1e3)],'key':_0x6b1208,'tags':_0x2f272b??_0x4d23d1?.['tags'],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x3ef7fa,'appCode':_0x2b6016[_0x93b5c3(0x1e3)],'key':_0x6b1208,'before':_0x429087,'after':_0x1667b0,'dryRun':!![]}),{'method':_0x93b5c3(0x1dd),'url':_0x3ef7fa===_0x93b5c3(0x1e8)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x23ae8a){const _0xdd0042=a34_0x4266ad,_0x47669c=readKeyArg(_0x23ae8a),_0x361491=readOptionalTags(_0x23ae8a),_0x234c44=await withAppConfigApiBoundary(_0xdd0042(0x1ed),{'appCode':_0x23ae8a[_0xdd0042(0x1e3)],'key':_0x47669c},()=>getAppConfigByKey(_0x23ae8a[_0xdd0042(0x1e3)],_0x47669c)),_0x3f4bcb=_0x234c44?projectAppConfig(_0x234c44):null,_0x1fc12f=_0x234c44?'update':_0xdd0042(0x1f0),{value:_0x525be2,warnings:_0x2d59ab}=await readAppConfigValue(_0x23ae8a),_0x35e6f7={'appCode':_0x23ae8a['appCode'],'key':_0x47669c,'value':_0x525be2,'tags':_0x361491??_0x234c44?.[_0xdd0042(0x1df)]??undefined};await withAppConfigApiBoundary(_0x1fc12f,{'appCode':_0x23ae8a[_0xdd0042(0x1e3)],'key':_0x47669c},async()=>{const _0x29c039=_0xdd0042;_0x234c44?await updateAppConfig({..._0x35e6f7,'id':requireAppConfigId(_0x234c44,_0x47669c,_0x23ae8a[_0x29c039(0x1e3)])}):await createAppConfig(_0x35e6f7);});const _0x5bb32b=await withAppConfigApiBoundary(_0xdd0042(0x1ed),{'appCode':_0x23ae8a['appCode'],'key':_0x47669c},()=>getAppConfigByKey(_0x23ae8a[_0xdd0042(0x1e3)],_0x47669c)),_0x3f4a19=_0x5bb32b?projectAppConfig(_0x5bb32b):plannedAppConfig({'appCode':_0x23ae8a[_0xdd0042(0x1e3)],'key':_0x47669c,'tags':_0x35e6f7[_0xdd0042(0x1df)],'hasValue':_0x525be2!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x1fc12f,'appCode':_0x23ae8a[_0xdd0042(0x1e3)],'key':_0x47669c,'before':_0x3f4bcb,'after':_0x3f4a19,'dryRun':![],'warnings':_0x2d59ab}),'message':(_0x1fc12f==='update'?_0xdd0042(0x1e7):_0xdd0042(0x1f6))+'\x20app\x20config\x20'+_0x47669c};}};function requireAppConfigId(_0x438412,_0x1f860f,_0xb72ea5){const _0x2d427a=a34_0x4266ad;if(typeof _0x438412['id']===_0x2d427a(0x1f3)&&Number[_0x2d427a(0x1ec)](_0x438412['id'])&&_0x438412['id']>0x0)return _0x438412['id'];throw CliErrors[_0x2d427a(0x1eb)](_0x2d427a(0x1e2)+_0x1f860f+',\x20appCode='+_0xb72ea5);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0xbe90e5=a35_0x2d47;(function(_0x3f4280,_0x53dfdb){const _0x5d6d04=a35_0x2d47,_0x12d11d=_0x3f4280();while(!![]){try{const _0x1360ea=-parseInt(_0x5d6d04(0xb8))/0x1*(-parseInt(_0x5d6d04(0xbf))/0x2)+-parseInt(_0x5d6d04(0x9d))/0x3*(parseInt(_0x5d6d04(0xbb))/0x4)+-parseInt(_0x5d6d04(0xb6))/0x5*(parseInt(_0x5d6d04(0xc0))/0x6)+-parseInt(_0x5d6d04(0x99))/0x7*(-parseInt(_0x5d6d04(0x83))/0x8)+parseInt(_0x5d6d04(0xb4))/0x9*(-parseInt(_0x5d6d04(0xc1))/0xa)+parseInt(_0x5d6d04(0xb0))/0xb*(-parseInt(_0x5d6d04(0xad))/0xc)+parseInt(_0x5d6d04(0x82))/0xd*(parseInt(_0x5d6d04(0xa8))/0xe);if(_0x1360ea===_0x53dfdb)break;else _0x12d11d['push'](_0x12d11d['shift']());}catch(_0x18d6f9){_0x12d11d['push'](_0x12d11d['shift']());}}}(a35_0x1565,0xe25fc));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0xbe90e5(0x89),'description':a35_0xbe90e5(0x85),'required':!![]};export const VALUE_ARG={'name':a35_0xbe90e5(0x98),'description':a35_0xbe90e5(0xa9),'required':![]};export const TAGS_FLAG={'name':a35_0xbe90e5(0x80),'type':a35_0xbe90e5(0x97),'description':a35_0xbe90e5(0xc3)};export const STDIN_FLAG={'name':'stdin','type':a35_0xbe90e5(0xa5),'description':a35_0xbe90e5(0xa2),'default':![]};export const FROM_ENV_FLAG={'name':a35_0xbe90e5(0x91),'type':'string','description':a35_0xbe90e5(0xa7)};export const REVEAL_FLAG={'name':'reveal','type':a35_0xbe90e5(0xa5),'description':a35_0xbe90e5(0x81),'default':![]};export function readKeyArg(_0x3f2f34){const _0x279112=a35_0xbe90e5,_0x4991a0=_0x3f2f34[_0x279112(0x8e)][0x0]?.['trim']()??'';return validateKey(_0x4991a0),_0x4991a0;}export function readOptionalTags(_0x30f753){const _0xa22158=a35_0xbe90e5,_0x250f7f=_0x30f753[_0xa22158(0x92)](_0xa22158(0x80))[_0xa22158(0xae)]();if(!_0x250f7f)return undefined;if(_0x250f7f[_0xa22158(0x9a)]>0x20)throw CliErrors[_0xa22158(0x88)](_0xa22158(0xbd));return _0x250f7f;}export function validateKey(_0x3fe024){const _0x317460=a35_0xbe90e5;if(!_0x3fe024)throw CliErrors[_0x317460(0x88)](_0x317460(0xa6));if(_0x3fe024[_0x317460(0x9a)]>0x100)throw CliErrors[_0x317460(0x88)](_0x317460(0xa4));}export function projectAppConfig(_0x1b9977,_0x34b975){const _0x20bf6f=a35_0xbe90e5,_0x546ecf=_0x1b9977['value']!==undefined&&_0x1b9977[_0x20bf6f(0x98)]!==null&&_0x1b9977[_0x20bf6f(0x98)]!=='',_0x1439c9={'appCode':_0x1b9977[_0x20bf6f(0x8b)],'key':_0x1b9977[_0x20bf6f(0x89)],'tags':_0x1b9977[_0x20bf6f(0x80)]??undefined,'hasValue':_0x546ecf,'valueRedacted':_0x546ecf&&!_0x34b975?.[_0x20bf6f(0xbe)],'gmtCreate':_0x1b9977[_0x20bf6f(0xc2)],'gmtModified':_0x1b9977['gmtModified']};return _0x34b975?.[_0x20bf6f(0xbe)]&&(_0x1439c9[_0x20bf6f(0x98)]=_0x1b9977[_0x20bf6f(0x98)]??'',_0x1439c9[_0x20bf6f(0xbc)]=![]),_0x1439c9;}export function plannedAppConfig(_0x13b041){const _0x381b3f=a35_0xbe90e5,_0x169c9a=_0x13b041[_0x381b3f(0xa3)]??!![];return{'appCode':_0x13b041[_0x381b3f(0x8b)],'key':_0x13b041['key'],'tags':_0x13b041['tags']??undefined,'hasValue':_0x169c9a,'valueRedacted':_0x169c9a};}export function buildMutationData(_0x17c26a){const _0x32bbe0=a35_0xbe90e5;return{'operation':_0x17c26a[_0x32bbe0(0x8c)],'selector':{'appCode':_0x17c26a['appCode'],'key':_0x17c26a[_0x32bbe0(0x89)]},'before':_0x17c26a[_0x32bbe0(0x7f)],'after':_0x17c26a['after'],'dryRun':_0x17c26a[_0x32bbe0(0xb3)],'warnings':_0x17c26a[_0x32bbe0(0xa1)]??[]};}function a35_0x2d47(_0x59fad0,_0x5bc6bb){_0x59fad0=_0x59fad0-0x7e;const _0x1565d8=a35_0x1565();let _0x2d4739=_0x1565d8[_0x59fad0];return _0x2d4739;}export async function withAppConfigApiBoundary(_0x3645ab,_0x3d0118,_0xbb865b){const _0x54718c=a35_0xbe90e5;try{return await _0xbb865b();}catch{const _0x58fe1c=[_0x54718c(0xab)+_0x3d0118['appCode']];if(_0x3d0118[_0x54718c(0x89)])_0x58fe1c['push']('key:\x20'+_0x3d0118[_0x54718c(0x89)]);_0x58fe1c[_0x54718c(0xb7)]('value\x20is\x20redacted');throw CliErrors['apiError'](_0x54718c(0xac)+_0x3645ab+_0x54718c(0xba),_0x58fe1c[_0x54718c(0x86)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x1024db,_0x139106){const _0x958bbf=a35_0xbe90e5;return Object[_0x958bbf(0x9c)](_0x1024db,{'method':{'value':_0x139106[_0x958bbf(0x8f)],'enumerable':![]},'url':{'value':_0x139106[_0x958bbf(0x8d)],'enumerable':![]}});}export function assertSingleValueSource(_0x1113ed){const _0x13ac7c=a35_0xbe90e5,_0xc416ad=[];_0x1113ed['args']['length']>0x1&&_0xc416ad['push']({'kind':_0x13ac7c(0x9e),'value':_0x1113ed[_0x13ac7c(0x8e)][_0x13ac7c(0x93)](0x1)[_0x13ac7c(0x86)]('\x20')});const _0x4a8abb=_0x1113ed['flag'](_0x13ac7c(0x98));_0x4a8abb!==undefined&&_0x4a8abb!==null&&_0xc416ad[_0x13ac7c(0xb7)]({'kind':'argument','value':String(_0x4a8abb)});_0x1113ed[_0x13ac7c(0xa0)](_0x13ac7c(0x9b))&&_0xc416ad[_0x13ac7c(0xb7)]({'kind':_0x13ac7c(0x9b)});const _0x3d0f0b=_0x1113ed['str'](_0x13ac7c(0x91))[_0x13ac7c(0xae)]();_0x3d0f0b&&_0xc416ad[_0x13ac7c(0xb7)]({'kind':_0x13ac7c(0x9f),'name':_0x3d0f0b});const _0x179b4b=_0x1113ed[_0x13ac7c(0x92)](_0x13ac7c(0xb1))[_0x13ac7c(0xae)]();_0x179b4b&&_0xc416ad[_0x13ac7c(0xb7)]({'kind':_0x13ac7c(0xb1),'path':_0x179b4b});if(_0xc416ad['length']===0x0)throw CliErrors[_0x13ac7c(0x88)](_0x13ac7c(0x94),'Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0xc416ad['length']>0x1)throw CliErrors['validation'](_0x13ac7c(0x96),_0x13ac7c(0xb9));return _0xc416ad[0x0];}export async function assertValueSourceReadable(_0x57ff07){const _0x5a0b1b=a35_0xbe90e5;if(_0x57ff07['kind']===_0x5a0b1b(0x9f)&&!(_0x57ff07[_0x5a0b1b(0x84)]in process.env))throw CliErrors[_0x5a0b1b(0x88)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x57ff07[_0x5a0b1b(0x84)]);if(_0x57ff07[_0x5a0b1b(0xc4)]==='file')try{await access(_0x57ff07[_0x5a0b1b(0x7e)]);}catch{throw CliErrors[_0x5a0b1b(0x88)](_0x5a0b1b(0x87)+_0x57ff07[_0x5a0b1b(0x7e)]);}}export async function readAppConfigValue(_0x451095){const _0x52784c=a35_0xbe90e5,_0x3cabcf=assertSingleValueSource(_0x451095),_0x33e9ed=[];if(_0x3cabcf[_0x52784c(0xc4)]===_0x52784c(0x9e))return _0x33e9ed[_0x52784c(0xb7)](_0x52784c(0x90)),{'value':_0x3cabcf[_0x52784c(0x98)]??'','source':_0x3cabcf[_0x52784c(0xc4)],'warnings':_0x33e9ed};if(_0x3cabcf[_0x52784c(0xc4)]===_0x52784c(0x9b))return{'value':await readStdin(),'source':_0x3cabcf[_0x52784c(0xc4)],'warnings':_0x33e9ed};if(_0x3cabcf[_0x52784c(0xc4)]==='env'){if(!(_0x3cabcf[_0x52784c(0x84)]in process.env))throw CliErrors[_0x52784c(0x88)](_0x52784c(0xaa)+_0x3cabcf[_0x52784c(0x84)]);return{'value':process.env[_0x3cabcf.name]??'','source':_0x3cabcf[_0x52784c(0xc4)],'warnings':_0x33e9ed};}return{'value':await readFile(_0x3cabcf[_0x52784c(0x7e)],_0x52784c(0xb5)),'source':_0x3cabcf[_0x52784c(0xc4)],'warnings':_0x33e9ed};}function readStdin(){return new Promise((_0x5aa623,_0x15ee56)=>{const _0x50e75f=a35_0x2d47;let _0x3b543f='';process[_0x50e75f(0x9b)][_0x50e75f(0xaf)](_0x50e75f(0xb5)),process['stdin']['on'](_0x50e75f(0xb2),_0x541958=>{_0x3b543f+=_0x541958;}),process[_0x50e75f(0x9b)][_0x50e75f(0x8a)](_0x50e75f(0x95),()=>_0x5aa623(_0x3b543f)),process[_0x50e75f(0x9b)][_0x50e75f(0x8a)]('error',_0x15ee56);});}function a35_0x1565(){const _0x7b7fcd=['setEncoding','1419NbbcqV','file','data','dryRun','27XNJNyC','utf8','3432015pHhOlc','push','11919XXWhOH','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','\x20app\x20config.','604pFCsFU','valueRedacted','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','reveal','148udbufV','6eAddov','1934120eZhLim','gmtCreate','Config\x20tags\x20for\x20filtering/display\x20metadata','kind','path','before','tags','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','10324639NGVpif','8vLYchu','name','Runtime\x20app-config\x20key','join','Value\x20file\x20is\x20not\x20readable:\x20','validation','key','once','appCode','operation','url','args','method','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','from-env','str','slice','Missing\x20app-config\x20value\x20source.','end','App\x20config\x20value\x20source\x20is\x20ambiguous.','string','value','8275946dkvMrP','length','stdin','defineProperties','12372QbCwTS','argument','env','bool','warnings','Read\x20config\x20value\x20from\x20stdin','hasValue','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','boolean','Missing\x20app-config\x20key.','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','42kIckEr','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','Environment\x20variable\x20is\x20not\x20set:\x20','appCode:\x20','Failed\x20to\x20','151656MCtSKW','trim'];a35_0x1565=function(){return _0x7b7fcd;};return a35_0x1565();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a36_0x233d8b=a36_0x37e0;(function(_0x598341,_0x258e61){const _0x4c4e21=a36_0x37e0,_0x53e62e=_0x598341();while(!![]){try{const _0x2c91ca=-parseInt(_0x4c4e21(0x117))/0x1*(parseInt(_0x4c4e21(0x11d))/0x2)+-parseInt(_0x4c4e21(0x124))/0x3+parseInt(_0x4c4e21(0x10f))/0x4+parseInt(_0x4c4e21(0x11a))/0x5*(-parseInt(_0x4c4e21(0x11e))/0x6)+-parseInt(_0x4c4e21(0x122))/0x7+parseInt(_0x4c4e21(0x119))/0x8*(parseInt(_0x4c4e21(0x116))/0x9)+-parseInt(_0x4c4e21(0x11b))/0xa*(-parseInt(_0x4c4e21(0x127))/0xb);if(_0x2c91ca===_0x258e61)break;else _0x53e62e['push'](_0x53e62e['shift']());}catch(_0x11dae9){_0x53e62e['push'](_0x53e62e['shift']());}}}(a36_0x2841,0x521ff));import{unlinkSync,existsSync}from'node:fs';function a36_0x2841(){const _0x7ff8ca=['!\x20Not\x20logged\x20in','4334176aNiraK','log','912903iDZfBQ','boolean','Login\x20via\x20browser','11AIMsGu','2149452FigcyK','write','yes','logout','nonInteractive','✓\x20Logged\x20out','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','531ZhVeHj','48449UpQmuz','auth','41728mhFjtk','142160YQdEwu','8191670XSNbIE','bool','12JpSqYq','24TNjEtF','login','Clear\x20login\x20session'];a36_0x2841=function(){return _0x7ff8ca;};return a36_0x2841();}function a36_0x37e0(_0x503772,_0x1c3abd){_0x503772=_0x503772-0x10f;const _0x2841e7=a36_0x2841();let _0x37e07a=_0x2841e7[_0x503772];return _0x37e07a;}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a36_0x233d8b(0x118),'command':a36_0x233d8b(0x11f),'description':a36_0x233d8b(0x126),'risk':a36_0x233d8b(0x110),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'yes','type':a36_0x233d8b(0x125),'description':a36_0x233d8b(0x115),'default':![]}],async 'execute'(_0x6e5c64){const _0x3461a6=a36_0x233d8b,{runAuthServer:_0x13558c}=await import('../../auth/auth-server-ui.js');return await _0x13558c({'autoYes':_0x6e5c64[_0x3461a6(0x11c)](_0x3461a6(0x111)),'nonInteractive':_0x6e5c64[_0x3461a6(0x113)]}),{'ok':!![]};}},{'service':a36_0x233d8b(0x118),'command':a36_0x233d8b(0x112),'description':a36_0x233d8b(0x120),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x5b4a00){const _0x140164=a36_0x233d8b;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x140164(0x123)](_0x140164(0x114))):console[_0x140164(0x123)](_0x140164(0x121)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x15ca3c=a37_0x3926;(function(_0x4cab90,_0x4904e8){const _0x1462c1=a37_0x3926,_0x45138f=_0x4cab90();while(!![]){try{const _0x3370cb=parseInt(_0x1462c1(0x140))/0x1+-parseInt(_0x1462c1(0x125))/0x2*(-parseInt(_0x1462c1(0x16b))/0x3)+parseInt(_0x1462c1(0x129))/0x4*(parseInt(_0x1462c1(0x16d))/0x5)+-parseInt(_0x1462c1(0x12e))/0x6*(parseInt(_0x1462c1(0x15f))/0x7)+parseInt(_0x1462c1(0x149))/0x8+-parseInt(_0x1462c1(0x13f))/0x9*(parseInt(_0x1462c1(0x14b))/0xa)+-parseInt(_0x1462c1(0x141))/0xb;if(_0x3370cb===_0x4904e8)break;else _0x45138f['push'](_0x45138f['shift']());}catch(_0x344ecc){_0x45138f['push'](_0x45138f['shift']());}}}(a37_0x3449,0x3eb3f));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';function a37_0x3926(_0x563e3c,_0x2085ec){_0x563e3c=_0x563e3c-0x124;const _0x34491d=a37_0x3449();let _0x3926c6=_0x34491d[_0x563e3c];return _0x3926c6;}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';function a37_0x3449(){const _0xc572b6=['The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','str','.js','function-node','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','length','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','operation-type','\x0a\x20*\x20[平台配置]\x20','datasetId','/**\x0a\x20*\x20','修改后的请求参数','name','appCode','mergedCli','UNKNOWN','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Operation\x20type\x20\x22','966fSxRCq','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Select\x20dataset:','No\x20model\x20aliases\x20found.\x20Run\x20`','Invalid\x20dataset\x20selection.','\x20api\x20pull`\x20to\x20refresh.','Available\x20aliases:\x20','alias','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','stderr','keys','1149QDrman','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','5WIvPHT','/ENDPOINT/','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','after','profileName','bff','Script\x20description','Created\x20','Available:\x20','selectedAppName','functionNode','\x22.\x20','stdin','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','apiDir','当前响应结果','datasetCode','\x20function:\x20','includes','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','write','Alias\x20\x22','map','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','defaultApp','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','/data/dataset/','currentApp','close','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','description','No\x20datasets\x20found\x20for\x20this\x20app.','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','operationType','find','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','Trigger\x20node\x20(HOOK\x20only)','Invalid\x20function\x20name\x20\x22','\x22\x20not\x20found\x20for\x20dataset\x20','1708NIejJQ','join','question','HOOK','1312788lIGQxK','filePath','utf8','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','/HOOK/','7746zKLFlN','type','parseInt','string','Operation\x20type\x20(HOOK\x20only)','nonInteractive','Select\x20operation\x20type:','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','File\x20already\x20exists:\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','.js\x0a\x20*\x20[触发节点]\x20','source','validation','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','1098yieEYT','459486sHTESN','8883226JHbqEJ','No\x20operation\x20types\x20found\x20for\x20dataset\x20','COMMON','before','HOOK\x20requires\x20alias/operation/node\x20options.','修改后的响应结果','code','tableName','3532592tpBqTQ','\x22,\x20params\x20})\x0a','25720YWkuHW','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'];a37_0x3449=function(){return _0xc572b6;};return a37_0x3449();}export const bffCreate={'service':a37_0x15ca3c(0x172),'command':'create','description':a37_0x15ca3c(0x13e),'risk':'read','flags':[{'name':a37_0x15ca3c(0x12f),'type':'string','required':!![],'enum':['COMMON','ENDPOINT','HOOK'],'description':'Script\x20type'},{'name':a37_0x15ca3c(0x159),'type':'string','required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a37_0x15ca3c(0x18b),'type':'string','description':a37_0x15ca3c(0x173)},{'name':'alias','type':'string','description':a37_0x15ca3c(0x137)},{'name':'datasetcode','type':a37_0x15ca3c(0x131),'description':a37_0x15ca3c(0x190)},{'name':a37_0x15ca3c(0x154),'type':'string','description':a37_0x15ca3c(0x132)},{'name':a37_0x15ca3c(0x150),'type':a37_0x15ca3c(0x131),'description':a37_0x15ca3c(0x192),'enum':[a37_0x15ca3c(0x144),a37_0x15ca3c(0x170)]}],async 'validate'(_0x13bb7e){const _0x40c8e3=a37_0x15ca3c,_0x130687=_0x13bb7e[_0x40c8e3(0x14e)](_0x40c8e3(0x159));if(!isValidBffFunctionName(_0x130687))throw CliErrors[_0x40c8e3(0x13d)](_0x40c8e3(0x193)+_0x130687+_0x40c8e3(0x186));},async 'execute'(_0x54f3b0){const _0x290424=a37_0x15ca3c,_0x4016c9=loadBffProjectConfig(_0x54f3b0[_0x290424(0x15a)]),_0x3fed4b=_0x54f3b0[_0x290424(0x14e)](_0x290424(0x12f)),_0x1f3470=_0x54f3b0[_0x290424(0x14e)](_0x290424(0x159)),_0x5384d9=_0x54f3b0['str']('description')||undefined,_0x1f63e7=_0x3fed4b===_0x290424(0x128)?await resolveHookOptions(_0x4016c9,_0x54f3b0):undefined,_0x53d5dc=buildFilePath(_0x4016c9,_0x3fed4b,_0x1f3470,_0x1f63e7);if(await fileExists(_0x53d5dc))throw CliErrors['validation'](_0x290424(0x136)+_0x53d5dc);await mkdir(dirname(_0x53d5dc),{'recursive':!![]});const _0x1a879e=generateTemplate(_0x3fed4b,_0x1f3470,_0x54f3b0[_0x290424(0x15a)],_0x5384d9,_0x1f63e7);await writeFile(_0x53d5dc,_0x1a879e,_0x290424(0x12b));const _0x3d996a={'type':_0x3fed4b,'name':_0x1f3470,'path':_0x53d5dc};if(_0x5384d9)_0x3d996a[_0x290424(0x18b)]=_0x5384d9;if(_0x1f63e7){if(_0x1f63e7[_0x290424(0x167)])_0x3d996a['alias']=_0x1f63e7[_0x290424(0x167)];_0x3d996a['datasetCode']=_0x1f63e7[_0x290424(0x17d)],_0x3d996a[_0x290424(0x18e)]=_0x1f63e7[_0x290424(0x18e)],_0x3d996a['functionNode']=_0x1f63e7['functionNode'];}return{'ok':!![],'data':_0x3d996a,'message':_0x290424(0x174)+_0x3fed4b+_0x290424(0x17e)+_0x1f3470};}};async function resolveHookOptions(_0x336ca8,_0x2c1631){const _0x58320c=a37_0x15ca3c,_0x42ee99=resolveApiModelSource(_0x2c1631[_0x58320c(0x17b)],_0x2c1631[_0x58320c(0x15a)],_0x2c1631[_0x58320c(0x176)]||_0x2c1631[_0x58320c(0x15b)]?.[_0x58320c(0x188)]||_0x2c1631['mergedCli']?.[_0x58320c(0x185)]),_0x2f306a=loadAliasMap(_0x2c1631[_0x58320c(0x17b)],undefined,_0x42ee99[_0x58320c(0x12a)],_0x42ee99[_0x58320c(0x171)]),_0x33d8e7=_0x2f306a[_0x58320c(0x152)]>0x0;let _0x166e0d,_0x197d0f,_0x7b1093;const _0x1cc175=_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x167)),_0x19c5c9=_0x2c1631[_0x58320c(0x14e)]('datasetcode');if(_0x1cc175){const _0x25fe51=resolveAlias(_0x2c1631[_0x58320c(0x17b)],_0x1cc175,undefined,_0x42ee99[_0x58320c(0x12a)],_0x42ee99[_0x58320c(0x171)]);if(!_0x25fe51){const _0x7049b6=_0x33d8e7?_0x58320c(0x166)+_0x2f306a[_0x58320c(0x183)](_0x307ee5=>_0x307ee5[_0x58320c(0x167)])[_0x58320c(0x126)](',\x20'):_0x58320c(0x163)+CLI_BIN_NAME+_0x58320c(0x12c);throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x182)+_0x1cc175+'\x22\x20not\x20found.\x20'+_0x7049b6);}_0x166e0d=_0x1cc175,_0x197d0f=_0x25fe51;}else{if(_0x19c5c9){_0x197d0f=_0x19c5c9;const _0x5bb408=_0x2f306a[_0x58320c(0x18f)](_0x9227bc=>_0x9227bc['datasetCode']===_0x19c5c9);_0x166e0d=_0x5bb408?.[_0x58320c(0x167)];}else{if(_0x2c1631[_0x58320c(0x133)])throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x15d));else{if(_0x33d8e7){const _0x2f4f46=_0x2f306a['map'](_0xcfcec9=>_0xcfcec9[_0x58320c(0x167)]+'\x20('+_0xcfcec9[_0x58320c(0x148)]+')'),_0x20c49f=await promptSelect(_0x58320c(0x162),_0x2f4f46),_0x116e23=_0x2f306a[_0x20c49f];if(!_0x116e23)throw CliErrors['validation'](_0x58320c(0x164));_0x166e0d=_0x116e23['alias'],_0x197d0f=_0x116e23[_0x58320c(0x17d)];}else{const _0x22baf9=await listDatasets(_0x2c1631[_0x58320c(0x15a)]);if(_0x22baf9[_0x58320c(0x152)]===0x0)throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x18c));const _0x417e0f=_0x22baf9[_0x58320c(0x183)](_0x14049c=>_0x14049c[_0x58320c(0x159)]+'\x20['+(_0x14049c[_0x58320c(0x13c)]??_0x58320c(0x15c))+']\x20('+_0x14049c['code']+')'),_0x26eff=await promptSelect(_0x58320c(0x162),_0x417e0f),_0x2ca2b2=_0x22baf9[_0x26eff];if(!_0x2ca2b2)throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x164));_0x197d0f=_0x2ca2b2[_0x58320c(0x147)],_0x166e0d=undefined;}}}}const _0x59cb01=await listDatasets(_0x2c1631[_0x58320c(0x15a)]),_0x4bbaef=_0x59cb01[_0x58320c(0x18f)](_0x41a037=>_0x41a037[_0x58320c(0x147)]===_0x197d0f);if(!_0x4bbaef)throw CliErrors[_0x58320c(0x13d)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0x197d0f+_0x58320c(0x178)+(_0x166e0d?_0x58320c(0x14d)+CLI_BIN_NAME+_0x58320c(0x165):''));_0x7b1093=_0x4bbaef['id'];const _0x4b4f06=_0x166e0d??_0x197d0f,_0x240f34=await listBffDatasetOperations(_0x2c1631['appCode'],_0x7b1093),_0x194dbc=_0x240f34?Object[_0x58320c(0x16a)](_0x240f34):[];if(_0x194dbc[_0x58320c(0x152)]===0x0)throw CliErrors['validation'](_0x58320c(0x142)+_0x4b4f06+'.');let _0x56a4f5;const _0x2dda50=_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x154));if(_0x2dda50){if(!_0x194dbc[_0x58320c(0x17f)](_0x2dda50))throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x15e)+_0x2dda50+_0x58320c(0x124)+_0x4b4f06+'.\x20'+(_0x58320c(0x175)+_0x194dbc[_0x58320c(0x126)](',\x20')));_0x56a4f5=_0x2dda50;}else{if(_0x2c1631[_0x58320c(0x133)])throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x161));const _0x17d752=await promptSelect(_0x58320c(0x134),_0x194dbc);_0x56a4f5=_0x194dbc[_0x17d752]??_0x194dbc[0x0];}let _0x482a91=normalizeHookFunctionNode(_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x150)));if(!_0x482a91){if(_0x2c1631[_0x58320c(0x14e)](_0x58320c(0x150)))throw CliErrors[_0x58320c(0x13d)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x2c1631[_0x58320c(0x133)])throw CliErrors[_0x58320c(0x13d)](_0x58320c(0x160));const _0x1fc618=await promptSelect('Select\x20trigger\x20node:',[_0x58320c(0x144),_0x58320c(0x170)]);_0x482a91=[_0x58320c(0x144),_0x58320c(0x170)][_0x1fc618]??_0x58320c(0x144);}return{'alias':_0x166e0d,'datasetCode':_0x197d0f,'datasetId':_0x7b1093,'operationType':_0x56a4f5,'functionNode':_0x482a91};}async function promptSelect(_0x5b43d7,_0x25f293){const _0x122bab=a37_0x15ca3c;if(_0x25f293[_0x122bab(0x152)]===0x1)return 0x0;for(const [_0x5bf726,_0xdff51f]of _0x25f293['entries']()){process[_0x122bab(0x169)][_0x122bab(0x181)]('\x20\x20'+(_0x5bf726+0x1)+'.\x20'+_0xdff51f+'\x0a');}const _0x537669=createInterface({'input':process[_0x122bab(0x179)],'output':process[_0x122bab(0x169)]});while(!![]){const _0x2397d6=await new Promise(_0x10e5b7=>{const _0x3de219=_0x122bab;_0x537669[_0x3de219(0x127)](_0x5b43d7+'\x20',_0x10e5b7);}),_0x41d090=Number[_0x122bab(0x130)](_0x2397d6['trim'](),0xa);if(Number['isInteger'](_0x41d090)&&_0x41d090>=0x1&&_0x41d090<=_0x25f293[_0x122bab(0x152)])return _0x537669[_0x122bab(0x189)](),_0x41d090-0x1;process[_0x122bab(0x169)][_0x122bab(0x181)](_0x122bab(0x16c)+_0x25f293[_0x122bab(0x152)]+'.\x0a');}}function buildFilePath(_0x323740,_0x3b7e98,_0x12d7e8,_0xe3d581){const _0x19fa5f=a37_0x15ca3c;if(_0x3b7e98===_0x19fa5f(0x128)){if(!_0xe3d581)throw CliErrors[_0x19fa5f(0x13d)](_0x19fa5f(0x145));const _0x22662d=_0xe3d581[_0x19fa5f(0x167)]??_0xe3d581[_0x19fa5f(0x17d)];return join(_0x323740['scriptsRootDir'],'HOOK',_0x22662d,_0xe3d581[_0x19fa5f(0x18e)],_0xe3d581['functionNode'],_0x12d7e8+'.js');}return join(_0x323740['scriptsRootDir'],_0x3b7e98,_0x12d7e8+_0x19fa5f(0x14f));}export function generateTemplate(_0x596781,_0x198233,_0x5d8ad7,_0x55d2ed,_0x1bf064){const _0x79960b=a37_0x15ca3c,_0x369aea=_0x55d2ed?.['trim']()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x178bf8=getAppBaseUrl(_0x5d8ad7),_0x2f1565=_0x79960b(0x17a);if(_0x596781===_0x79960b(0x143))return _0x79960b(0x157)+_0x369aea+_0x79960b(0x138)+_0x198233+_0x79960b(0x155)+_0x178bf8+_0x79960b(0x14c)+_0x5d8ad7+'/COMMON/'+_0x198233+_0x79960b(0x18d)+_0x198233+_0x79960b(0x14a)+_0x2f1565+_0x79960b(0x139)+_0x198233+_0x79960b(0x151);if(_0x596781==='ENDPOINT')return _0x79960b(0x157)+_0x369aea+_0x79960b(0x13a)+_0x198233+_0x79960b(0x191)+_0x5d8ad7+'/'+_0x198233+'\x0a\x20*\x20[平台配置]\x20'+_0x178bf8+_0x79960b(0x14c)+_0x5d8ad7+_0x79960b(0x16e)+_0x198233+'.js\x0a'+_0x2f1565+'\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'+_0x198233+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x1bf064)throw CliErrors[_0x79960b(0x13d)](_0x79960b(0x180));const _0x22801b=_0x1bf064[_0x79960b(0x167)]??_0x1bf064[_0x79960b(0x17d)],_0x1a77c9=_0x1bf064[_0x79960b(0x177)]===_0x79960b(0x144)?'当前请求参数':_0x79960b(0x17c),_0x935d6d=_0x1bf064['functionNode']===_0x79960b(0x144)?_0x79960b(0x158):_0x79960b(0x146);return _0x79960b(0x157)+_0x369aea+_0x79960b(0x135)+_0x198233+_0x79960b(0x18a)+_0x5d8ad7+'/'+_0x1bf064[_0x79960b(0x17d)]+'/'+_0x1bf064['operationType']+_0x79960b(0x155)+_0x178bf8+_0x79960b(0x187)+_0x1bf064[_0x79960b(0x156)]+_0x79960b(0x168)+_0x5d8ad7+_0x79960b(0x12d)+_0x22801b+'/'+_0x1bf064[_0x79960b(0x18e)]+'/'+_0x1bf064[_0x79960b(0x177)]+'/'+_0x198233+_0x79960b(0x13b)+_0x1bf064[_0x79960b(0x177)]+'\x0a'+_0x2f1565+_0x79960b(0x184)+_0x1a77c9+_0x79960b(0x153)+_0x935d6d+_0x79960b(0x16f)+_0x198233+_0x79960b(0x151);}
|
|
1
|
+
const a37_0x64b9f2=a37_0x506d;(function(_0x1868e1,_0x3ee78a){const _0x24e302=a37_0x506d,_0x2ad185=_0x1868e1();while(!![]){try{const _0x27c26e=-parseInt(_0x24e302(0xc8))/0x1*(parseInt(_0x24e302(0xa0))/0x2)+parseInt(_0x24e302(0x73))/0x3+parseInt(_0x24e302(0x97))/0x4*(parseInt(_0x24e302(0x85))/0x5)+-parseInt(_0x24e302(0xaa))/0x6+-parseInt(_0x24e302(0xab))/0x7*(parseInt(_0x24e302(0x92))/0x8)+parseInt(_0x24e302(0xad))/0x9+parseInt(_0x24e302(0xcc))/0xa;if(_0x27c26e===_0x3ee78a)break;else _0x2ad185['push'](_0x2ad185['shift']());}catch(_0x1d11f7){_0x2ad185['push'](_0x2ad185['shift']());}}}(a37_0x5768,0x8c896));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a37_0x506d(_0x4fd697,_0x571178){_0x4fd697=_0x4fd697-0x6b;const _0x576847=a37_0x5768();let _0x506d02=_0x576847[_0x4fd697];return _0x506d02;}import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a37_0x5768(){const _0x1a5a29=['description','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Operation\x20type\x20(HOOK\x20only)','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','close','function-node','bff','No\x20datasets\x20found\x20for\x20this\x20app.','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','scriptsRootDir','HOOK\x20requires\x20alias/operation/node\x20options.','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','join','profileName','parseInt','string','524637AdubeM','read','stderr','ENDPOINT','\x22\x20not\x20found\x20for\x20dataset\x20','.js\x0a\x20*\x20[触发节点]\x20','当前请求参数','nonInteractive','.js\x0a','alias','UNKNOWN','length','datasetId','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Trigger\x20node\x20(HOOK\x20only)','Select\x20dataset:','entries','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','35HiWTVv','operationType','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','operation-type','/**\x0a\x20*\x20','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Created\x20','keys','HOOK','Dataset\x20not\x20found\x20for\x20code\x20\x22','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','Operation\x20type\x20\x22','selectedAppName','2213528oXckTq','create','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','currentApp','Select\x20trigger\x20node:','465204zTHQiW','map','\x22\x20not\x20found.\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','mergedCli','.js','datasetCode','Invalid\x20function\x20name\x20\x22','validation','2XCsuoS','Select\x20operation\x20type:','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','Function\x20name\x20(valid\x20JS\x20identifier)','isInteger','当前响应结果','question','before','COMMON','str','2831526YqeGFP','28iUlvTv','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','3850839qBhZmB','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','name','修改后的响应结果','filePath','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','\x20function:\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','File\x20already\x20exists:\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x0a\x20*\x20[平台配置]\x20','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','defaultApp','code','tableName','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','apiDir','type','\x22.\x20','functionNode','Available\x20aliases:\x20','appCode','write','after','/ENDPOINT/','1131848QBEZJD','find','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','No\x20operation\x20types\x20found\x20for\x20dataset\x20','18693140yPamPV','Invalid\x20dataset\x20selection.','datasetcode','trim'];a37_0x5768=function(){return _0x1a5a29;};return a37_0x5768();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a37_0x64b9f2(0xd7),'command':a37_0x64b9f2(0x93),'description':a37_0x64b9f2(0xbe),'risk':a37_0x64b9f2(0x74),'flags':[{'name':a37_0x64b9f2(0xc0),'type':a37_0x64b9f2(0x72),'required':!![],'enum':[a37_0x64b9f2(0xa8),a37_0x64b9f2(0x76),a37_0x64b9f2(0x8d)],'description':'Script\x20type'},{'name':a37_0x64b9f2(0xb0),'type':a37_0x64b9f2(0x72),'required':!![],'description':a37_0x64b9f2(0xa3)},{'name':a37_0x64b9f2(0xd0),'type':'string','description':'Script\x20description'},{'name':'alias','type':a37_0x64b9f2(0x72),'description':a37_0x64b9f2(0x9a)},{'name':a37_0x64b9f2(0xce),'type':'string','description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a37_0x64b9f2(0x88),'type':a37_0x64b9f2(0x72),'description':a37_0x64b9f2(0xd3)},{'name':a37_0x64b9f2(0xd6),'type':a37_0x64b9f2(0x72),'description':a37_0x64b9f2(0x81),'enum':[a37_0x64b9f2(0xa7),a37_0x64b9f2(0xc6)]}],async 'validate'(_0x163cc){const _0x2d297f=a37_0x64b9f2,_0x5c8d5c=_0x163cc['str'](_0x2d297f(0xb0));if(!isValidBffFunctionName(_0x5c8d5c))throw CliErrors[_0x2d297f(0x9f)](_0x2d297f(0x9e)+_0x5c8d5c+_0x2d297f(0xb5));},async 'execute'(_0x5984f5){const _0x3251c4=a37_0x64b9f2,_0x432eb5=loadBffProjectConfig(_0x5984f5[_0x3251c4(0xc4)]),_0x557c66=_0x5984f5[_0x3251c4(0xa9)](_0x3251c4(0xc0)),_0x296a40=_0x5984f5[_0x3251c4(0xa9)](_0x3251c4(0xb0)),_0xa318ea=_0x5984f5[_0x3251c4(0xa9)](_0x3251c4(0xd0))||undefined,_0x2807ed=_0x557c66==='HOOK'?await resolveHookOptions(_0x432eb5,_0x5984f5):undefined,_0x33cc1d=buildFilePath(_0x432eb5,_0x557c66,_0x296a40,_0x2807ed);if(await fileExists(_0x33cc1d))throw CliErrors[_0x3251c4(0x9f)](_0x3251c4(0xb6)+_0x33cc1d);await mkdir(dirname(_0x33cc1d),{'recursive':!![]});const _0x2afacd=generateTemplate(_0x557c66,_0x296a40,_0x5984f5[_0x3251c4(0xc4)],_0xa318ea,_0x2807ed);await writeFile(_0x33cc1d,_0x2afacd,'utf8');const _0x4161e7={'type':_0x557c66,'name':_0x296a40,'path':_0x33cc1d};if(_0xa318ea)_0x4161e7['description']=_0xa318ea;if(_0x2807ed){if(_0x2807ed[_0x3251c4(0x7c)])_0x4161e7[_0x3251c4(0x7c)]=_0x2807ed[_0x3251c4(0x7c)];_0x4161e7[_0x3251c4(0x9d)]=_0x2807ed[_0x3251c4(0x9d)],_0x4161e7['operationType']=_0x2807ed[_0x3251c4(0x86)],_0x4161e7[_0x3251c4(0xc2)]=_0x2807ed['functionNode'];}return{'ok':!![],'data':_0x4161e7,'message':_0x3251c4(0x8b)+_0x557c66+_0x3251c4(0xb4)+_0x296a40};}};async function resolveHookOptions(_0x563572,_0x3a2b55){const _0x193492=a37_0x64b9f2,_0xf6e2ff=resolveApiModelSource(_0x3a2b55['apiDir'],_0x3a2b55['appCode'],_0x3a2b55[_0x193492(0x91)]||_0x3a2b55['mergedCli']?.[_0x193492(0x95)]||_0x3a2b55[_0x193492(0x9b)]?.[_0x193492(0xbb)]),_0x5c5130=loadAliasMap(_0x3a2b55[_0x193492(0xbf)],undefined,_0xf6e2ff[_0x193492(0xb2)],_0xf6e2ff[_0x193492(0x70)]),_0x319730=_0x5c5130[_0x193492(0x7e)]>0x0;let _0x3a0b9f,_0x24346b,_0x1f7310;const _0x52ff15=_0x3a2b55['str'](_0x193492(0x7c)),_0x3023ce=_0x3a2b55['str'](_0x193492(0xce));if(_0x52ff15){const _0x17fa53=resolveAlias(_0x3a2b55['apiDir'],_0x52ff15,undefined,_0xf6e2ff['filePath'],_0xf6e2ff[_0x193492(0x70)]);if(!_0x17fa53){const _0x36402a=_0x319730?_0x193492(0xc3)+_0x5c5130[_0x193492(0x98)](_0x444091=>_0x444091[_0x193492(0x7c)])['join'](',\x20'):'No\x20model\x20aliases\x20found.\x20Run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x193492(0x9f)]('Alias\x20\x22'+_0x52ff15+_0x193492(0x99)+_0x36402a);}_0x3a0b9f=_0x52ff15,_0x24346b=_0x17fa53;}else{if(_0x3023ce){_0x24346b=_0x3023ce;const _0x4e5204=_0x5c5130[_0x193492(0xc9)](_0x5742a4=>_0x5742a4[_0x193492(0x9d)]===_0x3023ce);_0x3a0b9f=_0x4e5204?.[_0x193492(0x7c)];}else{if(_0x3a2b55[_0x193492(0x7a)])throw CliErrors[_0x193492(0x9f)](_0x193492(0x80));else{if(_0x319730){const _0x34ec80=_0x5c5130[_0x193492(0x98)](_0x1efce9=>_0x1efce9[_0x193492(0x7c)]+'\x20('+_0x1efce9[_0x193492(0xbd)]+')'),_0xd6547f=await promptSelect(_0x193492(0x82),_0x34ec80),_0xe8e0fa=_0x5c5130[_0xd6547f];if(!_0xe8e0fa)throw CliErrors[_0x193492(0x9f)]('Invalid\x20dataset\x20selection.');_0x3a0b9f=_0xe8e0fa['alias'],_0x24346b=_0xe8e0fa[_0x193492(0x9d)];}else{const _0x4e2d4c=await listDatasets(_0x3a2b55['appCode']);if(_0x4e2d4c[_0x193492(0x7e)]===0x0)throw CliErrors[_0x193492(0x9f)](_0x193492(0xd8));const _0x265438=_0x4e2d4c[_0x193492(0x98)](_0x4171a7=>_0x4171a7[_0x193492(0xb0)]+'\x20['+(_0x4171a7['source']??_0x193492(0x7d))+']\x20('+_0x4171a7[_0x193492(0xbc)]+')'),_0x2fec4e=await promptSelect(_0x193492(0x82),_0x265438),_0x599493=_0x4e2d4c[_0x2fec4e];if(!_0x599493)throw CliErrors[_0x193492(0x9f)](_0x193492(0xcd));_0x24346b=_0x599493[_0x193492(0xbc)],_0x3a0b9f=undefined;}}}}const _0x741f46=await listDatasets(_0x3a2b55[_0x193492(0xc4)]),_0x391f81=_0x741f46[_0x193492(0xc9)](_0x7f7d59=>_0x7f7d59[_0x193492(0xbc)]===_0x24346b);if(!_0x391f81)throw CliErrors['validation'](_0x193492(0x8e)+_0x24346b+_0x193492(0xc1)+(_0x3a0b9f?_0x193492(0x94)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x1f7310=_0x391f81['id'];const _0x36c9a6=_0x3a0b9f??_0x24346b,_0x3acaeb=await listBffDatasetOperations(_0x3a2b55['appCode'],_0x1f7310),_0x3fa512=_0x3acaeb?Object[_0x193492(0x8c)](_0x3acaeb):[];if(_0x3fa512[_0x193492(0x7e)]===0x0)throw CliErrors[_0x193492(0x9f)](_0x193492(0xcb)+_0x36c9a6+'.');let _0x2212d9;const _0x2fe76b=_0x3a2b55[_0x193492(0xa9)](_0x193492(0x88));if(_0x2fe76b){if(!_0x3fa512['includes'](_0x2fe76b))throw CliErrors['validation'](_0x193492(0x90)+_0x2fe76b+_0x193492(0x77)+_0x36c9a6+'.\x20'+('Available:\x20'+_0x3fa512[_0x193492(0x6f)](',\x20')));_0x2212d9=_0x2fe76b;}else{if(_0x3a2b55[_0x193492(0x7a)])throw CliErrors[_0x193492(0x9f)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0xb51575=await promptSelect(_0x193492(0xa1),_0x3fa512);_0x2212d9=_0x3fa512[_0xb51575]??_0x3fa512[0x0];}let _0x32b648=normalizeHookFunctionNode(_0x3a2b55[_0x193492(0xa9)]('function-node'));if(!_0x32b648){if(_0x3a2b55[_0x193492(0xa9)]('function-node'))throw CliErrors['validation'](_0x193492(0xaf));if(_0x3a2b55[_0x193492(0x7a)])throw CliErrors['validation'](_0x193492(0xd1));const _0x439e90=await promptSelect(_0x193492(0x96),[_0x193492(0xa7),'after']);_0x32b648=['before','after'][_0x439e90]??_0x193492(0xa7);}return{'alias':_0x3a0b9f,'datasetCode':_0x24346b,'datasetId':_0x1f7310,'operationType':_0x2212d9,'functionNode':_0x32b648};}async function promptSelect(_0x19c5a8,_0x5c5b9b){const _0x441469=a37_0x64b9f2;if(_0x5c5b9b[_0x441469(0x7e)]===0x1)return 0x0;for(const [_0x35ffaf,_0x48cc91]of _0x5c5b9b[_0x441469(0x83)]()){process[_0x441469(0x75)][_0x441469(0xc5)]('\x20\x20'+(_0x35ffaf+0x1)+'.\x20'+_0x48cc91+'\x0a');}const _0x371d48=createInterface({'input':process['stdin'],'output':process['stderr']});while(!![]){const _0x4f2c8c=await new Promise(_0x462a3a=>{const _0x82f042=_0x441469;_0x371d48[_0x82f042(0xa6)](_0x19c5a8+'\x20',_0x462a3a);}),_0x4b3503=Number[_0x441469(0x71)](_0x4f2c8c['trim'](),0xa);if(Number[_0x441469(0xa4)](_0x4b3503)&&_0x4b3503>=0x1&&_0x4b3503<=_0x5c5b9b['length'])return _0x371d48[_0x441469(0xd5)](),_0x4b3503-0x1;process[_0x441469(0x75)][_0x441469(0xc5)](_0x441469(0x84)+_0x5c5b9b[_0x441469(0x7e)]+'.\x0a');}}function buildFilePath(_0x83f117,_0x59b490,_0xaf577c,_0x21d43e){const _0x3d1020=a37_0x64b9f2;if(_0x59b490===_0x3d1020(0x8d)){if(!_0x21d43e)throw CliErrors['validation'](_0x3d1020(0x6d));const _0xbe3a2f=_0x21d43e['alias']??_0x21d43e[_0x3d1020(0x9d)];return join(_0x83f117[_0x3d1020(0x6c)],'HOOK',_0xbe3a2f,_0x21d43e[_0x3d1020(0x86)],_0x21d43e[_0x3d1020(0xc2)],_0xaf577c+'.js');}return join(_0x83f117[_0x3d1020(0x6c)],_0x59b490,_0xaf577c+_0x3d1020(0x9c));}export function generateTemplate(_0x14677f,_0x4c07e4,_0x1b3495,_0x3f7662,_0x360541){const _0x4fb349=a37_0x64b9f2,_0x4c90c8=_0x3f7662?.[_0x4fb349(0xcf)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x5e3dd4=getAppBaseUrl(_0x1b3495),_0x841654=_0x4fb349(0xba);if(_0x14677f==='COMMON')return'/**\x0a\x20*\x20'+_0x4c90c8+_0x4fb349(0x6e)+_0x4c07e4+'\x0a\x20*\x20[平台配置]\x20'+_0x5e3dd4+_0x4fb349(0x6b)+_0x1b3495+'/COMMON/'+_0x4c07e4+_0x4fb349(0xa2)+_0x4c07e4+'\x22,\x20params\x20})\x0a'+_0x841654+_0x4fb349(0xb7)+_0x4c07e4+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(_0x14677f===_0x4fb349(0x76))return _0x4fb349(0x89)+_0x4c90c8+_0x4fb349(0xae)+_0x4c07e4+_0x4fb349(0xca)+_0x1b3495+'/'+_0x4c07e4+_0x4fb349(0xb9)+_0x5e3dd4+_0x4fb349(0x6b)+_0x1b3495+_0x4fb349(0xc7)+_0x4c07e4+_0x4fb349(0x7b)+_0x841654+_0x4fb349(0x8a)+_0x4c07e4+_0x4fb349(0xac);if(!_0x360541)throw CliErrors['validation'](_0x4fb349(0x8f));const _0x4b15c2=_0x360541['alias']??_0x360541[_0x4fb349(0x9d)],_0x45434b=_0x360541['functionNode']==='before'?_0x4fb349(0x79):_0x4fb349(0xa5),_0x299857=_0x360541[_0x4fb349(0xc2)]===_0x4fb349(0xa7)?'修改后的请求参数':_0x4fb349(0xb1);return'/**\x0a\x20*\x20'+_0x4c90c8+_0x4fb349(0xb3)+_0x4c07e4+_0x4fb349(0x87)+_0x1b3495+'/'+_0x360541['datasetCode']+'/'+_0x360541['operationType']+_0x4fb349(0xb9)+_0x5e3dd4+'/data/dataset/'+_0x360541[_0x4fb349(0x7f)]+_0x4fb349(0xb8)+_0x1b3495+'/HOOK/'+_0x4b15c2+'/'+_0x360541['operationType']+'/'+_0x360541[_0x4fb349(0xc2)]+'/'+_0x4c07e4+_0x4fb349(0x78)+_0x360541[_0x4fb349(0xc2)]+'\x0a'+_0x841654+_0x4fb349(0xd4)+_0x45434b+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x299857+_0x4fb349(0xd2)+_0x4c07e4+_0x4fb349(0xac);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x5db84a=a38_0x34c1;(function(_0x43dd5d,_0x364b12){const _0x126eb=a38_0x34c1,_0x1f9c0b=_0x43dd5d();while(!![]){try{const _0x273a35=-parseInt(_0x126eb(0x1e0))/0x1*(parseInt(_0x126eb(0x1e4))/0x2)+-parseInt(_0x126eb(0x1bd))/0x3*(parseInt(_0x126eb(0x1ce))/0x4)+-parseInt(_0x126eb(0x1cc))/0x5+-parseInt(_0x126eb(0x1d2))/0x6+-parseInt(_0x126eb(0x1e1))/0x7*(parseInt(_0x126eb(0x1de))/0x8)+parseInt(_0x126eb(0x1e2))/0x9*(-parseInt(_0x126eb(0x1d8))/0xa)+parseInt(_0x126eb(0x1c7))/0xb;if(_0x273a35===_0x364b12)break;else _0x1f9c0b['push'](_0x1f9c0b['shift']());}catch(_0x9ef03a){_0x1f9c0b['push'](_0x1f9c0b['shift']());}}}(a38_0x3e9a,0x4ed62));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';function a38_0x34c1(_0xd36207,_0x16fed8){_0xd36207=_0xd36207-0x1b3;const _0x3e9aa7=a38_0x3e9a();let _0x34c1c7=_0x3e9aa7[_0xd36207];return _0x34c1c7;}import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':'bff','command':'delete','description':a38_0x5db84a(0x1c5),'risk':a38_0x5db84a(0x1bb),'flags':[{'name':a38_0x5db84a(0x1e9),'type':a38_0x5db84a(0x1df),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x466279){const _0x344157=a38_0x5db84a,_0x406203=loadBffProjectConfig(_0x466279['appCode']),_0x3bfff0=await readBffLockFile(_0x406203[_0x344157(0x1d9)]);if(!_0x3bfff0)throw CliErrors['validation'](_0x344157(0x1e5));},async 'dryRun'(_0x366914){const _0x464cdd=a38_0x5db84a,_0x5f50c1=loadBffProjectConfig(_0x366914[_0x464cdd(0x1be)]),_0x3f72ec=await readBffLockFile(_0x5f50c1[_0x464cdd(0x1d9)]);if(!_0x3f72ec)throw CliErrors[_0x464cdd(0x1e6)](_0x464cdd(0x1d5));const {appLock:_0x1fc909}=ensureLockScope(_0x3f72ec,_0x366914[_0x464cdd(0x1be)],_0x5f50c1[_0x464cdd(0x1cf)],_0x464cdd(0x1c2)),_0x5b2929=_0x366914[_0x464cdd(0x1e3)]('target'),_0x3f4cbb=Object['keys'](_0x1fc909[_0x464cdd(0x1d0)]),_0x2be0cf=resolveDeleteTarget(_0x5b2929,_0x3f4cbb),_0x54d8d2=_0x1fc909[_0x464cdd(0x1d0)][_0x2be0cf];if(!_0x54d8d2)throw CliErrors['validation'](_0x464cdd(0x1cb)+_0x2be0cf+'\x22.');const _0x76c398=resolveLocalFilePathFromLockKey(_0x5f50c1,_0x2be0cf),_0x59015e=relative(_0x5f50c1[_0x464cdd(0x1d1)],_0x76c398),_0x3d3407=join(_0x5f50c1[_0x464cdd(0x1dd)],_0x464cdd(0x1c9),_0x59015e);return{'method':_0x464cdd(0x1e8),'url':_0x464cdd(0x1b9),'body':{'appCode':_0x366914[_0x464cdd(0x1be)],'target':_0x2be0cf,'remoteId':_0x54d8d2[_0x464cdd(0x1ba)],'localFilePath':_0x76c398,'trashedPath':_0x3d3407},'description':_0x464cdd(0x1c3)+_0x2be0cf+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash'};},async 'execute'(_0x271cd8){const _0x263692=a38_0x5db84a,_0x25b471=loadBffProjectConfig(_0x271cd8['appCode']),_0xfdd7db=await readBffLockFile(_0x25b471[_0x263692(0x1d9)]);if(!_0xfdd7db)throw CliErrors[_0x263692(0x1e6)](_0x263692(0x1d5));const {lockData:_0x55a887,appLock:_0x4ee57c}=ensureLockScope(_0xfdd7db,_0x271cd8['appCode'],_0x25b471['scriptsRoot'],_0x263692(0x1c2)),_0x1a0536=JSON[_0x263692(0x1b5)](JSON[_0x263692(0x1d6)](_0x55a887)),_0x576f60=_0x1a0536[_0x263692(0x1b6)][_0x271cd8['appCode']];if(!_0x576f60)throw new Error(_0x263692(0x1cd)+_0x271cd8[_0x263692(0x1be)]+_0x263692(0x1c6));const _0x445b0f=_0x271cd8['str'](_0x263692(0x1e9)),_0x2dfccd=Object['keys'](_0x576f60[_0x263692(0x1d0)]),_0x5eb815=resolveDeleteTarget(_0x445b0f,_0x2dfccd),_0x51c9ae=_0x576f60[_0x263692(0x1d0)][_0x5eb815];if(!_0x51c9ae)throw CliErrors['validation'](_0x263692(0x1cb)+_0x5eb815+'\x22.');await deleteBffScript(_0x51c9ae[_0x263692(0x1ba)]),delete _0x576f60[_0x263692(0x1d0)][_0x5eb815],_0x576f60[_0x263692(0x1ea)]=new Date()[_0x263692(0x1db)](),await writeBffLockFile(_0x25b471[_0x263692(0x1d9)],_0x1a0536);const _0x339061=resolveLocalFilePathFromLockKey(_0x25b471,_0x5eb815);let _0x1e4770;await fileExists(_0x339061)&&(_0x1e4770=await moveToTrash(_0x25b471[_0x263692(0x1d1)],_0x25b471[_0x263692(0x1dd)],_0x339061),await cleanupEmptyDirectories(dirname(_0x339061),_0x25b471[_0x263692(0x1c1)]));await waitForDeleteSettlement(_0x25b471['lockFilePath'],_0x271cd8['appCode'],_0x5eb815,_0x339061),await sleep(0x96);const _0x3b83b2={'deleted':_0x5eb815,'remoteId':_0x51c9ae[_0x263692(0x1ba)]};if(_0x1e4770)_0x3b83b2[_0x263692(0x1b7)]=_0x1e4770;return{'ok':!![],'data':_0x3b83b2,'message':_0x263692(0x1ca)+_0x5eb815+(_0x1e4770?_0x263692(0x1b3):'')};}};function resolveDeleteTarget(_0x4cbff1,_0x2c6a68){const _0x3bb1a9=a38_0x5db84a;if(_0x4cbff1[_0x3bb1a9(0x1b4)]('/')){const _0x187829=_0x2c6a68[_0x3bb1a9(0x1c0)](_0x12eff7=>_0x12eff7===_0x4cbff1);if(!_0x187829)throw CliErrors[_0x3bb1a9(0x1e6)]('Function\x20not\x20found:\x20'+_0x4cbff1);return _0x187829;}const _0x3dab90=_0x2c6a68[_0x3bb1a9(0x1bc)](_0x3c4f55=>_0x3c4f55[_0x3bb1a9(0x1d4)]('/')['at'](-0x1)===_0x4cbff1);if(_0x3dab90['length']===0x0)throw CliErrors['validation'](_0x3bb1a9(0x1da)+_0x4cbff1);if(_0x3dab90[_0x3bb1a9(0x1bf)]>0x1)throw CliErrors[_0x3bb1a9(0x1e6)](_0x3bb1a9(0x1d3)+_0x4cbff1+_0x3bb1a9(0x1c8)+_0x3dab90[_0x3bb1a9(0x1dc)](_0x882420=>_0x3bb1a9(0x1e7)+_0x882420)[_0x3bb1a9(0x1d7)]('\x0a'));return _0x3dab90[0x0];}async function moveToTrash(_0x36f113,_0x3f12a2,_0x34a02d){const _0x556dcc=a38_0x5db84a,_0x392c5e=new Date()[_0x556dcc(0x1db)]()[_0x556dcc(0x1b8)](/[:.]/g,'-'),_0x384061=relative(_0x36f113,_0x34a02d),_0x5b34a0=join(_0x3f12a2,_0x392c5e,_0x384061);return await mkdir(dirname(_0x5b34a0),{'recursive':!![]}),await rename(_0x34a02d,_0x5b34a0),_0x5b34a0;}async function cleanupEmptyDirectories(_0x5bed0c,_0x2958c1){const _0x3f05a4=a38_0x5db84a;let _0x43a280=resolve(_0x5bed0c);const _0x1ad04c=resolve(_0x2958c1);while(_0x43a280[_0x3f05a4(0x1c4)](''+_0x1ad04c+sep)||_0x43a280===_0x1ad04c){if(_0x43a280===_0x1ad04c)return;try{const _0x1d751c=await readdir(_0x43a280);if(_0x1d751c[_0x3f05a4(0x1bf)]>0x0)return;await rmdir(_0x43a280);}catch{return;}_0x43a280=dirname(_0x43a280);}}function a38_0x3e9a(){const _0x1b5453=['4hoQcmZ','scriptsRoot','functions','projectRoot','424884TjFsAc','Multiple\x20functions\x20match\x20\x22','split','Backend\x20Function\x20lock\x20file\x20not\x20found.','stringify','join','50ICoVKg','lockFilePath','Function\x20not\x20found:\x20','toISOString','map','trashDir','32Xmzmza','string','18043JzFcxg','1018129dTydWu','184581RPMqmf','str','12jwEsSs','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','validation','\x20\x20-\x20','POST','target','lastSync','\x20(local\x20file\x20moved\x20to\x20trash)','includes','parse','apps','trashedTo','replace','/api/management/library/scripts/delete','remoteId','high-risk-write','filter','1512543bgeGDp','appCode','length','find','scriptsRootDir','delete','Would\x20delete\x20','startsWith','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','\x22\x20not\x20found\x20after\x20ensureLockScope.','22069201FMwkNS','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','<timestamp>','Deleted\x20','No\x20lock\x20entry\x20found\x20for\x20\x22','1578955ZIthWh','Lock\x20scope\x20for\x20app\x20\x22'];a38_0x3e9a=function(){return _0x1b5453;};return a38_0x3e9a();}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x4d39d5,_0x1ad03b,_0x2f9803,_0x454f52){const _0x48af3b=a38_0x5db84a;for(let _0x289bae=0x0;_0x289bae<DELETE_SETTLE_RETRY_COUNT;_0x289bae+=0x1){const _0x20c66a=await readBffLockFile(_0x4d39d5),_0x51f9dd=!!_0x20c66a?.[_0x48af3b(0x1b6)]?.[_0x1ad03b]?.['functions']?.[_0x2f9803],_0x2de0c2=await fileExists(_0x454f52);if(!_0x51f9dd&&!_0x2de0c2)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x2f9803+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a39_0x14f5(_0x31d1d1,_0x4d910f){_0x31d1d1=_0x31d1d1-0x1af;const _0x28176e=a39_0x2817();let _0x14f52b=_0x28176e[_0x31d1d1];return _0x14f52b;}const a39_0x5ce98f=a39_0x14f5;function a39_0x2817(){const _0x214ce2=['createdTime','Script\x20ID','29862585wyYIxp','appCode','2174014bJOjlc','Return\x20full\x20raw\x20script\x20object','version','2412AoyCZc','1172089uIOJAK','verbose','318ZrrDMj','updateUserName','updatedTime','4459455bYRpbh','22636bAdeou','70rIzhLk','9940032VfyMBI','functionName','10PZbTHq','num','description'];a39_0x2817=function(){return _0x214ce2;};return a39_0x2817();}(function(_0x5b9d7b,_0x116f19){const _0x4afeef=a39_0x14f5,_0x17b0e7=_0x5b9d7b();while(!![]){try{const _0x349c4=parseInt(_0x4afeef(0x1b5))/0x1+-parseInt(_0x4afeef(0x1b1))/0x2+-parseInt(_0x4afeef(0x1b7))/0x3*(parseInt(_0x4afeef(0x1bb))/0x4)+parseInt(_0x4afeef(0x1bc))/0x5*(-parseInt(_0x4afeef(0x1b4))/0x6)+-parseInt(_0x4afeef(0x1ba))/0x7+-parseInt(_0x4afeef(0x1bd))/0x8+-parseInt(_0x4afeef(0x1af))/0x9*(-parseInt(_0x4afeef(0x1bf))/0xa);if(_0x349c4===_0x116f19)break;else _0x17b0e7['push'](_0x17b0e7['shift']());}catch(_0x200ae8){_0x17b0e7['push'](_0x17b0e7['shift']());}}}(a39_0x2817,0xe0250));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':'detail','description':'Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','risk':'read','flags':[{'name':'id','type':'number','required':!![],'description':a39_0x5ce98f(0x1c3)},{'name':a39_0x5ce98f(0x1b6),'type':'boolean','description':a39_0x5ce98f(0x1b2)}],async 'execute'(_0x1749d9){const _0x3ab84d=a39_0x5ce98f,_0x57ffbb=await getBffScriptInfo(_0x1749d9[_0x3ab84d(0x1c0)]('id')),_0x49d9c2=_0x1749d9['bool'](_0x3ab84d(0x1b6));if(_0x49d9c2)return{'ok':!![],'data':_0x57ffbb};return{'ok':!![],'data':{'id':_0x57ffbb['id'],'functionName':_0x57ffbb[_0x3ab84d(0x1be)]??'','version':_0x57ffbb[_0x3ab84d(0x1b3)]??'','updateUserName':_0x57ffbb[_0x3ab84d(0x1b8)]??'','appCode':_0x57ffbb[_0x3ab84d(0x1b0)],'scriptType':_0x57ffbb['scriptType'],'description':_0x57ffbb[_0x3ab84d(0x1c1)]||'(none)','createdTime':_0x57ffbb[_0x3ab84d(0x1c2)]??'','updatedTime':_0x57ffbb[_0x3ab84d(0x1b9)]??'','scriptContent':_0x57ffbb['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a40_0x1bb4(_0x2384cb,_0x42e387){_0x2384cb=_0x2384cb-0xac;const _0x46f423=a40_0x46f4();let _0x1bb457=_0x46f423[_0x2384cb];return _0x1bb457;}function a40_0x46f4(){const _0x397ce8=['7508424rFlUXe','1210115YuHCbY','990TvOhmZ','2101635nZtgxy','2474860WuKfTC','4cnzrSZ','5464445VEZwUa','407590MbLsAG','6THtvaq','4391992NPLsTj'];a40_0x46f4=function(){return _0x397ce8;};return a40_0x46f4();}(function(_0x10ea54,_0x2406c2){const _0x556064=a40_0x1bb4,_0x34f75b=_0x10ea54();while(!![]){try{const _0x5aa5cc=-parseInt(_0x556064(0xad))/0x1+-parseInt(_0x556064(0xb0))/0x2+parseInt(_0x556064(0xaf))/0x3*(-parseInt(_0x556064(0xb1))/0x4)+parseInt(_0x556064(0xb2))/0x5*(-parseInt(_0x556064(0xb4))/0x6)+parseInt(_0x556064(0xac))/0x7+-parseInt(_0x556064(0xb5))/0x8+-parseInt(_0x556064(0xae))/0x9*(-parseInt(_0x556064(0xb3))/0xa);if(_0x5aa5cc===_0x2406c2)break;else _0x34f75b['push'](_0x34f75b['shift']());}catch(_0xf540c2){_0x34f75b['push'](_0x34f75b['shift']());}}}(a40_0x46f4,0xbb0c0));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_0x3de316=a41_0x7640;function a41_0x4e3b(){const _0x5a4de8=['description','bool','Filter\x20by\x20script\x20name','type','bff','16445835hsFVdA','verbose','6214716VKxvLQ','8nKpeVW','list','160dnCJjd','string','2sMoOdp','2407292nknUOJ','ENDPOINT','4917325mRrBcw','826122IaFjkR','5848927vInVMw','name','Script\x20type\x20filter','str','(unnamed)','map','boolean','Return\x20full\x20script\x20objects','6GwHokk','447192MjAxCs','No\x20Backend\x20Function\x20scripts\x20found.'];a41_0x4e3b=function(){return _0x5a4de8;};return a41_0x4e3b();}(function(_0x24b215,_0x1a7e06){const _0x4d0b9b=a41_0x7640,_0xcee795=_0x24b215();while(!![]){try{const _0x5243e9=-parseInt(_0x4d0b9b(0x8b))/0x1*(parseInt(_0x4d0b9b(0x99))/0x2)+parseInt(_0x4d0b9b(0x8a))/0x3*(parseInt(_0x4d0b9b(0x9a))/0x4)+parseInt(_0x4d0b9b(0x9c))/0x5+-parseInt(_0x4d0b9b(0x94))/0x6+parseInt(_0x4d0b9b(0x9e))/0x7*(parseInt(_0x4d0b9b(0x95))/0x8)+-parseInt(_0x4d0b9b(0x92))/0x9+-parseInt(_0x4d0b9b(0x97))/0xa*(-parseInt(_0x4d0b9b(0x9d))/0xb);if(_0x5243e9===_0x1a7e06)break;else _0xcee795['push'](_0xcee795['shift']());}catch(_0x5d65f5){_0xcee795['push'](_0xcee795['shift']());}}}(a41_0x4e3b,0xdf25b));import{listBffScripts}from'../../core/api-client.js';function a41_0x7640(_0x3186f3,_0x1729cf){_0x3186f3=_0x3186f3-0x88;const _0x4e3bef=a41_0x4e3b();let _0x76404e=_0x4e3bef[_0x3186f3];return _0x76404e;}export const bffList={'service':a41_0x3de316(0x91),'command':a41_0x3de316(0x96),'description':'List\x20Backend\x20Function\x20scripts','risk':'read','flags':[{'name':'type','type':a41_0x3de316(0x98),'description':a41_0x3de316(0xa0),'default':a41_0x3de316(0x9b),'enum':[a41_0x3de316(0x9b),'COMMON']},{'name':a41_0x3de316(0x9f),'type':a41_0x3de316(0x98),'description':a41_0x3de316(0x8f)},{'name':a41_0x3de316(0x93),'type':a41_0x3de316(0x88),'description':a41_0x3de316(0x89)}],async 'execute'(_0x43fcd7){const _0x1f2681=a41_0x3de316,_0x3431af=await listBffScripts(_0x43fcd7['appCode'],_0x43fcd7[_0x1f2681(0xa1)](_0x1f2681(0x90)),{'scriptName':_0x43fcd7['str'](_0x1f2681(0x9f))||undefined}),_0x43cfd4=_0x43fcd7[_0x1f2681(0x8e)]('verbose');return{'ok':!![],'data':_0x43cfd4?_0x3431af:_0x3431af[_0x1f2681(0xa3)](_0x29641f=>({'id':_0x29641f['id'],'functionName':_0x29641f['functionName']??'','description':_0x29641f[_0x1f2681(0x8d)]||_0x1f2681(0xa2),'scriptType':_0x29641f['scriptType']})),'message':_0x3431af['length']===0x0?_0x1f2681(0x8c):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a42_0xe72b88=a42_0x3fc5;(function(_0x2c0da1,_0x34ab2b){const _0xa2cec9=a42_0x3fc5,_0x522be1=_0x2c0da1();while(!![]){try{const _0x49595d=parseInt(_0xa2cec9(0xda))/0x1+-parseInt(_0xa2cec9(0xc7))/0x2*(parseInt(_0xa2cec9(0xba))/0x3)+parseInt(_0xa2cec9(0xe3))/0x4*(-parseInt(_0xa2cec9(0xc8))/0x5)+-parseInt(_0xa2cec9(0xd9))/0x6+-parseInt(_0xa2cec9(0xb8))/0x7+-parseInt(_0xa2cec9(0xb5))/0x8*(parseInt(_0xa2cec9(0xd3))/0x9)+parseInt(_0xa2cec9(0xd4))/0xa;if(_0x49595d===_0x34ab2b)break;else _0x522be1['push'](_0x522be1['shift']());}catch(_0xe2b59f){_0x522be1['push'](_0x522be1['shift']());}}}(a42_0x344c,0x37345));function a42_0x344c(){const _0x2046b2=['appCode','number','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','514800HrMTMe','343778ddeEOm','ERROR','Found\x20','level','logs','length','bff','validation','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','278716UQQSMH','str','8dCOOUd','keyword','INFO','1692551QvAlyp','start-time','1156497gtjCuM','--since','toUpperCase','read','end-time','\x20Backend\x20Function\x20log\x20line(s).','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','trim','limit','flag','Maximum\x20log\x20lines\x20to\x20return\x20(1-','string','2Iuyqra','10xlZVto','now','since','WARN','DEBUG','num','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','--limit','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','63324VVvxXx','7418250CALZSI','--end-time'];a42_0x344c=function(){return _0x2046b2;};return a42_0x344c();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a42_0xe72b88(0xcc),a42_0xe72b88(0xb7),a42_0xe72b88(0xcb),a42_0xe72b88(0xdb)];export function resolveBffLogQuery(_0x2f9795,_0x521716=Date[a42_0xe72b88(0xc9)]()){const _0x4fe2d6=a42_0xe72b88,_0x442023=_0x2f9795['flag'](_0x4fe2d6(0xca)),_0x3d5741=_0x2f9795[_0x4fe2d6(0xc4)](_0x4fe2d6(0xb9)),_0x4b7885=_0x2f9795['flag'](_0x4fe2d6(0xbe));if(_0x442023!==undefined&&_0x3d5741!==undefined)throw CliErrors[_0x4fe2d6(0xe1)](_0x4fe2d6(0xd8));const _0x4ed61a=_0x4b7885===undefined?_0x521716:readPositiveInteger(_0x2f9795[_0x4fe2d6(0xcd)](_0x4fe2d6(0xbe)),_0x4fe2d6(0xd5)),_0x1a444b=_0x3d5741===undefined?_0x4ed61a-readSinceMinutes(_0x2f9795)*0xea60:readPositiveInteger(_0x2f9795['num'](_0x4fe2d6(0xb9)),'--start-time');if(_0x1a444b<=0x0)throw CliErrors[_0x4fe2d6(0xe1)](_0x4fe2d6(0xe2));if(_0x1a444b>_0x4ed61a)throw CliErrors['validation']('--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.');const _0x57446a=readPositiveInteger(_0x2f9795[_0x4fe2d6(0xcd)](_0x4fe2d6(0xc3),DEFAULT_LIMIT),_0x4fe2d6(0xcf));if(_0x57446a>MAX_LIMIT)throw CliErrors[_0x4fe2d6(0xe1)]('--limit\x20must\x20be\x20between\x201\x20and\x20'+MAX_LIMIT+'.');const _0xfde654=_0x2f9795[_0x4fe2d6(0xb4)](_0x4fe2d6(0xdd))[_0x4fe2d6(0xc2)]()[_0x4fe2d6(0xbc)]()||undefined,_0x313dbc=_0x2f9795[_0x4fe2d6(0xb4)](_0x4fe2d6(0xb6))[_0x4fe2d6(0xc2)]()||undefined;return{'appCode':_0x2f9795[_0x4fe2d6(0xd6)],'startTime':_0x1a444b,'endTime':_0x4ed61a,..._0x3d5741===undefined?{'sinceMinutes':readSinceMinutes(_0x2f9795)}:{},..._0xfde654?{'level':_0xfde654}:{},..._0x313dbc?{'keyword':_0x313dbc}:{},'limit':_0x57446a};}function readSinceMinutes(_0x202534){const _0x597890=a42_0xe72b88;return readPositiveInteger(_0x202534[_0x597890(0xcd)](_0x597890(0xca),DEFAULT_SINCE_MINUTES),_0x597890(0xbb));}function a42_0x3fc5(_0x4bcca9,_0x25046f){_0x4bcca9=_0x4bcca9-0xb4;const _0x344c4c=a42_0x344c();let _0x3fc5cf=_0x344c4c[_0x4bcca9];return _0x3fc5cf;}function readPositiveInteger(_0x468b69,_0xa29339){if(!Number['isSafeInteger'](_0x468b69)||_0x468b69<=0x0)throw CliErrors['validation'](_0xa29339+'\x20must\x20be\x20a\x20positive\x20integer.');return _0x468b69;}export const bffLogs={'service':a42_0xe72b88(0xe0),'command':a42_0xe72b88(0xde),'description':a42_0xe72b88(0xce),'risk':a42_0xe72b88(0xbd),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':'since','type':a42_0xe72b88(0xd7),'description':a42_0xe72b88(0xc0)+DEFAULT_SINCE_MINUTES+')'},{'name':'start-time','type':a42_0xe72b88(0xd7),'description':a42_0xe72b88(0xd2)},{'name':a42_0xe72b88(0xbe),'type':'number','description':a42_0xe72b88(0xd1)},{'name':'level','type':'string','description':'Filter\x20by\x20log\x20level','enum':LOG_LEVELS},{'name':'keyword','type':a42_0xe72b88(0xc6),'description':a42_0xe72b88(0xd0)},{'name':a42_0xe72b88(0xc3),'type':'number','description':a42_0xe72b88(0xc5)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x2b8fc7){resolveBffLogQuery(_0x2b8fc7);},async 'execute'(_0x224f2){const _0x248b66=a42_0xe72b88,_0x249b09=resolveBffLogQuery(_0x224f2),{sinceMinutes:_0x24b691,..._0x355575}=_0x249b09,_0x27acf0=await searchBffScriptLogs(_0x355575);return{'ok':!![],'data':{'query':_0x249b09,'count':_0x27acf0[_0x248b66(0xdf)],'logs':_0x27acf0},'message':_0x27acf0['length']===0x0?_0x248b66(0xc1):_0x248b66(0xdc)+_0x27acf0[_0x248b66(0xdf)]+_0x248b66(0xbf)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x27f8d1=a43_0x7e08;function a43_0x7e08(_0xde8849,_0x118e87){_0xde8849=_0xde8849-0x146;const _0x395ad8=a43_0x395a();let _0x7e082d=_0x395ad8[_0xde8849];return _0x7e082d;}(function(_0x5d869c,_0x173f86){const _0xda683a=a43_0x7e08,_0x740891=_0x5d869c();while(!![]){try{const _0x380614=parseInt(_0xda683a(0x17b))/0x1*(-parseInt(_0xda683a(0x19a))/0x2)+parseInt(_0xda683a(0x1ba))/0x3*(parseInt(_0xda683a(0x16f))/0x4)+parseInt(_0xda683a(0x16b))/0x5*(-parseInt(_0xda683a(0x1ce))/0x6)+parseInt(_0xda683a(0x195))/0x7+-parseInt(_0xda683a(0x168))/0x8*(parseInt(_0xda683a(0x1d5))/0x9)+parseInt(_0xda683a(0x148))/0xa*(parseInt(_0xda683a(0x18d))/0xb)+parseInt(_0xda683a(0x1db))/0xc*(parseInt(_0xda683a(0x14e))/0xd);if(_0x380614===_0x173f86)break;else _0x740891['push'](_0x740891['shift']());}catch(_0x490941){_0x740891['push'](_0x740891['shift']());}}}(a43_0x395a,0x48cf7));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a43_0x27f8d1(0x147),'command':a43_0x27f8d1(0x170),'description':a43_0x27f8d1(0x1a2),'risk':a43_0x27f8d1(0x1c9),'structuredErrors':!![],'flags':[{'name':a43_0x27f8d1(0x193),'type':'string','description':'Pull\x20only\x20this\x20script\x20type','enum':[a43_0x27f8d1(0x14d),'ENDPOINT',a43_0x27f8d1(0x191)]},{'name':a43_0x27f8d1(0x17a),'type':a43_0x27f8d1(0x15d),'description':a43_0x27f8d1(0x1cb)}],async 'dryRun'(_0x180422){const _0x54d961=a43_0x27f8d1,_0x1010e9=loadBffProjectConfig(_0x180422[_0x54d961(0x1d6)]),_0x1e3272=await readBffLockFile(_0x1010e9['lockFilePath']),{appLock:_0x1bafce}=ensureLockScope(_0x1e3272??createEmptyBffLock(),_0x180422[_0x54d961(0x1d6)],_0x1010e9[_0x54d961(0x183)],'pull'),_0x8e4b8b=normalizeBffType(_0x180422[_0x54d961(0x1ac)](_0x54d961(0x193)))??undefined,[_0x1c72bf,_0x4070af]=await Promise['all']([listBffScripts(_0x180422[_0x54d961(0x1d6)],_0x8e4b8b),getBffScriptStatistics(_0x180422['appCode'])]),_0x641275=_0x1c72bf[_0x54d961(0x1c3)](_0x394bdb=>normalizeBffType(_0x394bdb['scriptType'])==='HOOK'),_0x21b84a=_0x641275?buildDatasetCodeToAliasMap(_0x180422[_0x54d961(0x19b)],_0x180422[_0x54d961(0x1d6)],_0x180422[_0x54d961(0x184)]||_0x180422[_0x54d961(0x175)]?.[_0x54d961(0x176)]||_0x180422[_0x54d961(0x175)]?.[_0x54d961(0x1a1)]):new Map(),_0xc97c2e=_0x641275?await planHookDirectoryMigration(_0x1010e9,_0x1bafce,_0x21b84a,await scanLocalBffFunctions(_0x1010e9,_0x54d961(0x191))):undefined,_0x1c7efa=createHookLocationMap(_0x4070af),_0x212623=[];for(const _0x315785 of _0x1c72bf){const _0x3b917f=resolveRemoteScriptTarget(_0x1010e9,_0x315785,_0x1c7efa,_0xc97c2e?.[_0x54d961(0x1d8)]??_0x1bafce[_0x54d961(0x17c)],_0x21b84a);if(!_0x3b917f){_0x212623[_0x54d961(0x18e)]({'scriptType':_0x315785[_0x54d961(0x1dd)],'functionName':_0x315785[_0x54d961(0x1c7)]??'','status':_0x54d961(0x1bd),'reason':_0x54d961(0x1c6)});continue;}const _0x141098=(_0xc97c2e?.[_0x54d961(0x1d8)]??_0x1bafce['functions'])[_0x3b917f[_0x54d961(0x1ad)]],_0x4662b4=_0x315785[_0x54d961(0x166)]!=null?computeContentHash(_0x315785[_0x54d961(0x166)]):undefined,_0x593b17=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0xc97c2e,_0x3b917f)??_0x3b917f[_0x54d961(0x186)],_0x141098,_0x4662b4),_0x2c8c31=_0x593b17?localUnsyncedConflict(_0x3b917f,_0x315785['id']):undefined;_0x212623['push']({'lockKey':_0x3b917f['lockKey'],'filePath':_0x3b917f['filePath'],'remoteId':_0x315785['id']??null,'status':_0x2c8c31?'conflict':_0x54d961(0x1d7),..._0x2c8c31?{'conflict':_0x2c8c31}:{},..._0x3b917f[_0x54d961(0x1d3)]?{'alias':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x194)]??null,'datasetCode':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x1c0)],'operationType':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x1bc)],'functionNode':_0x3b917f[_0x54d961(0x1d3)][_0x54d961(0x1b1)]}:{}});}return{'method':_0x54d961(0x14a),'url':_0x54d961(0x150)+_0x180422[_0x54d961(0x1d6)]+(_0x8e4b8b?_0x54d961(0x15e)+_0x8e4b8b:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x180422[_0x54d961(0x1d6)],'filterType':_0x8e4b8b??null,..._0xc97c2e&&_0xc97c2e[_0x54d961(0x161)][_0x54d961(0x16a)]>0x0?{'hookDirectoryMigrations':_0xc97c2e['migrations']['map'](_0xa2b2f2=>({'from':_0xa2b2f2[_0x54d961(0x158)],'to':_0xa2b2f2[_0x54d961(0x1c4)]}))}:{},'files':_0x212623},'description':_0x54d961(0x1dc)+_0x212623[_0x54d961(0x16a)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x3912dc){const _0x23b472=a43_0x27f8d1,_0x4f1506=loadBffProjectConfig(_0x3912dc[_0x23b472(0x1d6)]),_0x337b67=await readBffLockFile(_0x4f1506[_0x23b472(0x17e)]),{lockData:_0x19d3ca,appLock:_0x2ea86e}=ensureLockScope(_0x337b67??createEmptyBffLock(),_0x3912dc[_0x23b472(0x1d6)],_0x4f1506['scriptsRoot'],_0x23b472(0x170)),_0x3bf888=normalizeBffType(_0x3912dc['str']('type'))??undefined;if(_0x3912dc['str'](_0x23b472(0x193))&&!_0x3bf888)throw CliErrors[_0x23b472(0x162)](_0x23b472(0x1b5));const [_0x1a8124,_0x2e1930]=await Promise[_0x23b472(0x1ab)]([listBffScripts(_0x3912dc['appCode'],_0x3bf888),getBffScriptStatistics(_0x3912dc[_0x23b472(0x1d6)])]);if(_0x1a8124[_0x23b472(0x16a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x23b472(0x173)};const _0x2f023f=_0x3912dc['bool'](_0x23b472(0x17a));if(_0x2f023f&&!_0x3912dc[_0x23b472(0x180)]){const _0x120e36=await confirmForce();if(!_0x120e36)throw CliErrors[_0x23b472(0x15c)](_0x23b472(0x19e));}if(_0x2f023f&&_0x3912dc['nonInteractive']){}const _0xb1887b=_0x1a8124['some'](_0x544265=>normalizeBffType(_0x544265[_0x23b472(0x1dd)])==='HOOK'),_0xd42c0a=_0xb1887b?buildDatasetCodeToAliasMap(_0x3912dc[_0x23b472(0x19b)],_0x3912dc[_0x23b472(0x1d6)],_0x3912dc[_0x23b472(0x184)]||_0x3912dc[_0x23b472(0x175)]?.['currentApp']||_0x3912dc[_0x23b472(0x175)]?.['defaultApp']):new Map(),_0x51cb60=createHookLocationMap(_0x2e1930),_0x4ef5c5=JSON[_0x23b472(0x18f)](JSON[_0x23b472(0x1cf)](_0x19d3ca)),_0x301500=_0x3912dc[_0x23b472(0x1d6)],_0x1e79f9=_0x4ef5c5['apps'][_0x301500];if(!_0x1e79f9)throw new Error(_0x23b472(0x1a3)+_0x301500+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x1e3c13=_0xb1887b?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4f1506,_0x1e79f9,_0xd42c0a,await scanLocalBffFunctions(_0x4f1506,'HOOK')),_0x1e79f9):undefined,_0x2f86ca=createPullFileTransaction(),_0x1d7096=[],_0x88ef88=[],_0x281587=[],_0x24a3f3=[];for(const _0x19b318 of _0x1a8124){const _0x1d4bfb=resolveRemoteScriptTarget(_0x4f1506,_0x19b318,_0x51cb60,_0x1e79f9[_0x23b472(0x17c)],_0xd42c0a);if(!_0x1d4bfb){_0x88ef88['push']({'lockKey':_0x19b318[_0x23b472(0x1dd)]+'/'+_0x19b318[_0x23b472(0x1c7)],'reason':_0x23b472(0x1c6)});continue;}const _0x4a19cf=_0x1e79f9[_0x23b472(0x17c)][_0x1d4bfb[_0x23b472(0x1ad)]];try{if(!_0x19b318['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x19b318[_0x23b472(0x166)]==null)throw new Error(_0x23b472(0x157));const _0x1ff23f=_0x19b318['scriptContent'],_0x5f5cc7=computeContentHash(_0x1ff23f);if(!_0x2f023f){const _0x13320a=await hasUnsyncedLocalChanges(_0x1d4bfb['filePath'],_0x4a19cf,_0x5f5cc7);if(_0x13320a){_0x281587[_0x23b472(0x18e)](localUnsyncedConflict(_0x1d4bfb,_0x19b318['id']));continue;}}await _0x2f86ca[_0x23b472(0x1d9)](_0x1d4bfb[_0x23b472(0x186)],_0x1ff23f);const _0x510089={'hash':_0x5f5cc7,'remoteId':_0x19b318['id'],'version':_0x19b318['version']};_0x1d4bfb[_0x23b472(0x193)]===_0x23b472(0x191)&&_0x1d4bfb[_0x23b472(0x1d3)]&&(_0x510089[_0x23b472(0x194)]=_0x1d4bfb[_0x23b472(0x1d3)][_0x23b472(0x194)],_0x510089['datasetCode']=_0x1d4bfb['hookLocation'][_0x23b472(0x1c0)],_0x510089['operationType']=_0x1d4bfb[_0x23b472(0x1d3)][_0x23b472(0x1bc)],_0x510089[_0x23b472(0x1b1)]=_0x1d4bfb[_0x23b472(0x1d3)][_0x23b472(0x1b1)]),_0x1e79f9[_0x23b472(0x17c)][_0x1d4bfb[_0x23b472(0x1ad)]]=_0x510089,_0x1d7096[_0x23b472(0x18e)]({'lockKey':_0x1d4bfb[_0x23b472(0x1ad)],'remoteId':_0x19b318['id']});}catch(_0x542d78){_0x24a3f3[_0x23b472(0x18e)]({'lockKey':_0x1d4bfb[_0x23b472(0x1ad)],'error':_0x542d78 instanceof Error?_0x542d78[_0x23b472(0x14c)]:String(_0x542d78)});}}_0x1e79f9[_0x23b472(0x16e)]=new Date()[_0x23b472(0x1b8)]();try{await writeBffLockFile(_0x4f1506[_0x23b472(0x17e)],_0x4ef5c5);}catch(_0x2af6bb){const _0x2b0cb8=[...await _0x2f86ca[_0x23b472(0x1da)](),...await _0x1e3c13?.[_0x23b472(0x1da)]()??[]];throw withRollbackErrors(_0x2af6bb,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x2b0cb8);}return{'ok':_0x24a3f3['length']===0x0,'data':{'pulled':_0x1d7096,'skipped':_0x88ef88,'conflicts':_0x281587,'failed':_0x24a3f3},'message':formatPullMessage(_0x1d7096[_0x23b472(0x16a)],_0x88ef88['length'],_0x281587['length'],_0x24a3f3[_0x23b472(0x16a)])};}};function localUnsyncedConflict(_0x5c725d,_0xab7697){const _0x47bb57=a43_0x27f8d1,_0x9b1552=_0x5c725d[_0x47bb57(0x1ad)][_0x47bb57(0x171)]('/')['at'](-0x1);return{'code':'BFF_LOCAL_UNSYNCED','lockKey':_0x5c725d[_0x47bb57(0x1ad)],'filePath':_0x5c725d['filePath'],..._0xab7697!=null?{'remoteId':_0xab7697}:{},'message':_0x47bb57(0x15a),'nextAction':{'action':_0x47bb57(0x177),'command':CLI_BIN_NAME+_0x47bb57(0x1ae)+_0x5c725d['type']+_0x47bb57(0x1bf)+_0x9b1552+_0x47bb57(0x188),'requiresReview':!![],'message':_0x47bb57(0x1c2)}};}function formatPullMessage(_0x3246a8,_0x1bb502,_0x5f4c67,_0xf6cfcf){const _0x519cb6=a43_0x27f8d1,_0x4a447f=['Pull\x20complete:\x20'+_0x3246a8+_0x519cb6(0x155),_0x1bb502+_0x519cb6(0x1a5)];_0x5f4c67>0x0&&_0x4a447f[_0x519cb6(0x18e)](_0x5f4c67+'\x20conflict'+(_0x5f4c67===0x1?'':'s')+'\x20'+(_0x5f4c67===0x1?_0x519cb6(0x1d4):'require')+'\x20resolution');if(_0xf6cfcf>0x0)_0x4a447f[_0x519cb6(0x18e)](_0xf6cfcf+_0x519cb6(0x152));return _0x4a447f[_0x519cb6(0x174)](',\x20');}async function hasUnsyncedLocalChanges(_0x5930,_0x273b49,_0x755c48){const _0x2683dc=a43_0x27f8d1;if(!await fileExists(_0x5930))return![];const _0x4aab34=await computeFileHash(_0x5930);if(!_0x273b49)return _0x755c48?_0x4aab34!==_0x755c48:!![];return _0x4aab34!==_0x273b49[_0x2683dc(0x1a4)];}function createPullFileTransaction(){const _0x5954bc=new Map(),_0x58d838=async(_0x2f491f,_0x5c5241)=>{const _0x1896da=a43_0x7e08;try{if(_0x5c5241[_0x1896da(0x149)])await ensureParentDirectory(_0x2f491f),await writeFile(_0x2f491f,_0x5c5241[_0x1896da(0x156)]);else try{await unlink(_0x2f491f);}catch(_0x357be4){if(_0x357be4[_0x1896da(0x1aa)]!==_0x1896da(0x160))throw _0x357be4;}return undefined;}catch(_0x9669b1){return _0x9669b1 instanceof Error?_0x9669b1:new Error(String(_0x9669b1));}};return{async 'write'(_0x157320,_0x2a344e){const _0x369880=a43_0x7e08;if(!_0x5954bc['has'](_0x157320))try{_0x5954bc[_0x369880(0x1a8)](_0x157320,{'existed':!![],'content':await readFile(_0x157320)});}catch(_0x755c0d){if(_0x755c0d['code']!==_0x369880(0x160))throw _0x755c0d;_0x5954bc[_0x369880(0x1a8)](_0x157320,{'existed':![]});}try{await ensureParentDirectory(_0x157320),await writeFile(_0x157320,_0x2a344e,_0x369880(0x1b0));}catch(_0x3421bc){const _0x59afc7=await _0x58d838(_0x157320,_0x5954bc[_0x369880(0x15f)](_0x157320));if(!_0x59afc7)_0x5954bc[_0x369880(0x1b9)](_0x157320);throw withRollbackErrors(_0x3421bc,_0x369880(0x1a7)+_0x157320+'\x22.',_0x59afc7?[_0x59afc7]:[]);}},async 'rollback'(){const _0x2d6f17=a43_0x7e08,_0x2b2053=[];for(const [_0x1a8bb7,_0x4ae69e]of[..._0x5954bc[_0x2d6f17(0x18b)]()][_0x2d6f17(0x19c)]()){const _0x3d161e=await _0x58d838(_0x1a8bb7,_0x4ae69e);_0x3d161e&&_0x2b2053[_0x2d6f17(0x18e)](new Error(_0x2d6f17(0x1cd)+_0x1a8bb7+_0x2d6f17(0x1be)+_0x3d161e[_0x2d6f17(0x14c)]));}return _0x2b2053;}};}function withRollbackErrors(_0x3f0b7f,_0x5ae34c,_0xdd61ad){const _0x1f6d1c=a43_0x27f8d1,_0x4a9eab=_0x3f0b7f instanceof Error?_0x3f0b7f:new Error(String(_0x3f0b7f));if(_0xdd61ad[_0x1f6d1c(0x16a)]===0x0)return _0x4a9eab;return new AggregateError([_0x4a9eab,..._0xdd61ad],_0x5ae34c+_0x1f6d1c(0x167)+_0xdd61ad[_0x1f6d1c(0x1b3)](_0x382469=>_0x382469[_0x1f6d1c(0x14c)])[_0x1f6d1c(0x174)](';\x20'));}function buildDatasetCodeToAliasMap(_0x4baf42,_0xc82e4a,_0x36d93f){const _0xfdd774=a43_0x27f8d1,_0x3dae37=resolveApiModelSource(_0x4baf42,_0xc82e4a,_0x36d93f),_0x3da54b=loadAliasMap(_0x4baf42,undefined,_0x3dae37[_0xfdd774(0x186)],_0x3dae37[_0xfdd774(0x14b)]);return assertUnambiguousHookAliases(_0x3da54b),new Map(_0x3da54b[_0xfdd774(0x1b3)](_0x27e2bc=>[_0x27e2bc[_0xfdd774(0x1c0)]['toLowerCase'](),_0x27e2bc['alias']]));}async function planHookDirectoryMigration(_0x13bc75,_0x3cf4ce,_0x27c476,_0x44824d){const _0x393464=a43_0x27f8d1,_0x4654bf=new Map();for(const [_0x43b45b,_0x55bc21]of Object['entries'](_0x3cf4ce[_0x393464(0x17c)])){const [_0x14834b,_0x25b6eb,_0xbd58e2,_0x2c072e,_0x275135,..._0x308ecb]=_0x43b45b[_0x393464(0x171)]('/');if(_0x14834b!=='HOOK'||!_0x25b6eb||!_0xbd58e2||!_0x2c072e||!_0x275135||_0x308ecb[_0x393464(0x16a)]>0x0||!_0x55bc21['datasetCode'])continue;const _0x465d0a=_0x27c476[_0x393464(0x15f)](_0x55bc21[_0x393464(0x1c0)][_0x393464(0x169)]()),_0x452c06=_0x465d0a??_0x55bc21[_0x393464(0x1c0)];if(!isSafeHookDirectorySegment(_0x25b6eb))throw CliErrors[_0x393464(0x162)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x25b6eb+_0x393464(0x192));if(!isSafeHookDirectorySegment(_0x452c06))throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x25b6eb+_0x393464(0x1af));if(_0x25b6eb===_0x452c06)continue;const _0x294ec1=_0x4654bf[_0x393464(0x15f)](_0x25b6eb)??{'datasetCode':_0x55bc21[_0x393464(0x1c0)],'alias':_0x465d0a,'keyChanges':[]};if(_0x294ec1[_0x393464(0x1c0)]!==_0x55bc21[_0x393464(0x1c0)])throw CliErrors[_0x393464(0x162)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x25b6eb+'\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.');const _0x35c01a=_0x393464(0x18c)+_0x452c06+'/'+_0xbd58e2+'/'+_0x2c072e+'/'+_0x275135;try{resolveLocalFilePathFromLockKey(_0x13bc75,_0x43b45b),resolveLocalFilePathFromLockKey(_0x13bc75,_0x35c01a);}catch(_0x2a29aa){throw CliErrors[_0x393464(0x162)](_0x393464(0x198)+_0x43b45b+'\x22:\x20'+(_0x2a29aa instanceof Error?_0x2a29aa['message']:String(_0x2a29aa)));}_0x294ec1[_0x393464(0x190)][_0x393464(0x18e)]({'oldLockKey':_0x43b45b,'newLockKey':_0x35c01a,'entry':_0x55bc21}),_0x4654bf[_0x393464(0x1a8)](_0x25b6eb,_0x294ec1);}const _0x3b53c5=new Set([..._0x4654bf['values']()][_0x393464(0x181)](_0x29abd6=>_0x29abd6['keyChanges'][_0x393464(0x1b3)](_0x12ec3e=>_0x12ec3e[_0x393464(0x1b6)]))),_0x242e80=new Map(),_0x3a0164=new Map();for(const [_0x43974c,_0x152bf4]of _0x4654bf){const _0x215067=_0x152bf4[_0x393464(0x194)]??_0x152bf4[_0x393464(0x1c0)],_0xeadcfb=hookDirectoryIdentity(_0x215067),_0x136a46=_0x242e80[_0x393464(0x15f)](_0xeadcfb);if(_0x136a46&&_0x136a46!==_0x43974c)throw CliErrors[_0x393464(0x162)](_0x393464(0x199)+_0x136a46+_0x393464(0x165)+_0x43974c+_0x393464(0x151)+_0x215067+_0x393464(0x172));_0x242e80['set'](_0xeadcfb,_0x43974c);for(const _0x518712 of _0x152bf4['keyChanges']){const _0xf7d6d7=_0x3a0164[_0x393464(0x15f)](_0x518712[_0x393464(0x146)]);if(_0xf7d6d7&&_0xf7d6d7!==_0x518712['oldLockKey'])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0xf7d6d7+_0x393464(0x165)+_0x518712[_0x393464(0x1b6)]+_0x393464(0x151)+_0x518712['newLockKey']+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x3b53c5[_0x393464(0x189)](_0x518712[_0x393464(0x146)]))throw CliErrors['validation'](_0x393464(0x182)+_0x518712[_0x393464(0x1b6)]+_0x393464(0x197)+_0x518712[_0x393464(0x146)]+_0x393464(0x1a6));_0x3a0164[_0x393464(0x1a8)](_0x518712[_0x393464(0x146)],_0x518712[_0x393464(0x1b6)]);}}const _0x40d254=new Map();for(const [_0x7af792,_0xbd402d]of _0x27c476){_0x40d254['set'](hookDirectoryIdentity(_0xbd402d),_0x7af792);}const _0x371e30=[];for(const [_0x443f4f,_0x4f50dc]of _0x4654bf){const _0x15203d=_0x4f50dc[_0x393464(0x194)]??_0x4f50dc[_0x393464(0x1c0)],_0xc25484=join(_0x13bc75['scriptsRootDir'],'HOOK',_0x443f4f),_0x1b8034=join(_0x13bc75['scriptsRootDir'],_0x393464(0x191),_0x15203d),_0x33b6a2=await directoryExists(_0xc25484),_0x1cfc51=await directoryExists(_0x1b8034),_0x20c344=_0x33b6a2?_0x1cfc51?await sameDirectory(_0xc25484,_0x1b8034)?_0x393464(0x17f):undefined:_0x393464(0x153):_0x393464(0x1d2);if(!_0x20c344)throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x443f4f+'\x22\x20to\x20\x22'+_0x15203d+_0x393464(0x163));const _0x362742=_0x40d254[_0x393464(0x15f)](hookDirectoryIdentity(_0x443f4f));if(_0x362742&&_0x362742!==_0x4f50dc[_0x393464(0x1c0)][_0x393464(0x169)]()){const _0x201940=new Set(_0x4f50dc['keyChanges']['map'](_0x1f79dc=>_0x1f79dc[_0x393464(0x1b6)])),_0x49e405=_0x44824d[_0x393464(0x185)](_0x65eaeb=>_0x65eaeb[_0x393464(0x193)]===_0x393464(0x191)&&_0x65eaeb['alias']!=null&&hookDirectoryIdentity(_0x65eaeb[_0x393464(0x194)])===hookDirectoryIdentity(_0x443f4f)&&!_0x201940['has'](_0x65eaeb['lockKey']));if(_0x49e405[_0x393464(0x16a)]>0x0)throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x443f4f+_0x393464(0x19d));}const _0x15760b=_0x40d254[_0x393464(0x15f)](hookDirectoryIdentity(_0x15203d));if(_0x15760b&&_0x15760b!==_0x4f50dc[_0x393464(0x1c0)]['toLowerCase']())throw CliErrors['validation'](_0x393464(0x16c)+_0x443f4f+_0x393464(0x159)+_0x15203d+_0x393464(0x1c5));for(const _0x4ab9c7 of _0x4f50dc[_0x393464(0x190)]){const _0x57a42f=_0x3cf4ce[_0x393464(0x17c)][_0x4ab9c7[_0x393464(0x146)]];if(_0x57a42f&&!_0x3b53c5['has'](_0x4ab9c7['newLockKey'])&&!sameHookIdentity(_0x4ab9c7[_0x393464(0x1ca)],_0x57a42f))throw CliErrors[_0x393464(0x162)](_0x393464(0x16c)+_0x443f4f+_0x393464(0x159)+_0x15203d+_0x393464(0x154));}_0x371e30[_0x393464(0x18e)]({'oldDirectory':_0x443f4f,'newDirectory':_0x15203d,'oldDirectoryPath':_0xc25484,'newDirectoryPath':_0x1b8034,'mode':_0x20c344,'alias':_0x4f50dc[_0x393464(0x194)],'keyChanges':_0x4f50dc[_0x393464(0x190)]});}const _0x4cf6f1={..._0x3cf4ce['functions']},_0x5cbf4b=new Map(),_0x1d508b=new Map();for(const _0x597274 of _0x371e30){const _0x559060=_0x597274[_0x393464(0x1b2)]!=='rekey';_0x559060&&_0x1d508b[_0x393464(0x1a8)](hookDirectoryIdentity(_0x597274['newDirectory']),_0x597274[_0x393464(0x16d)]);for(const _0x5392ed of _0x597274[_0x393464(0x190)]){const _0x1650c4=_0x4cf6f1[_0x5392ed[_0x393464(0x146)]],_0x4fd37c=_0x559060?_0x5392ed['entry']:_0x1650c4??_0x5392ed[_0x393464(0x1ca)];_0x4cf6f1[_0x5392ed[_0x393464(0x146)]]=canonicalizeHookEntry(_0x4fd37c,_0x597274['alias']),delete _0x4cf6f1[_0x5392ed['oldLockKey']],_0x559060&&_0x5cbf4b[_0x393464(0x1a8)](_0x5392ed[_0x393464(0x146)],resolveLocalFilePathFromLockKey(_0x13bc75,_0x5392ed['oldLockKey']));}}return{'migrations':_0x371e30,'projectedFunctions':_0x4cf6f1,'sourceFilePathByNewLockKey':_0x5cbf4b,'sourceDirectoryPathByNewDirectory':_0x1d508b};}function resolveMigratedSourceFilePath(_0x56d53a,_0x5f7d76){const _0x5cb5e4=a43_0x27f8d1;if(!_0x56d53a||!_0x5f7d76)return undefined;const _0x269691=_0x56d53a[_0x5cb5e4(0x1de)][_0x5cb5e4(0x15f)](_0x5f7d76[_0x5cb5e4(0x1ad)]);if(_0x269691)return _0x269691;if(_0x5f7d76[_0x5cb5e4(0x193)]!=='HOOK')return undefined;const [,_0x52f787,..._0x4ccfc7]=_0x5f7d76[_0x5cb5e4(0x1ad)]['split']('/');if(!_0x52f787||_0x4ccfc7[_0x5cb5e4(0x16a)]===0x0)return undefined;const _0x51ec8b=_0x56d53a[_0x5cb5e4(0x18a)]['get'](hookDirectoryIdentity(_0x52f787));return _0x51ec8b?join(_0x51ec8b,..._0x4ccfc7)+_0x5cb5e4(0x1b4):undefined;}function sameHookIdentity(_0x5d9e5e,_0x474b29){const _0x2b9013=a43_0x27f8d1;return _0x5d9e5e[_0x2b9013(0x1c1)]===_0x474b29[_0x2b9013(0x1c1)]&&_0x5d9e5e[_0x2b9013(0x1c0)]===_0x474b29['datasetCode']&&_0x5d9e5e[_0x2b9013(0x1bc)]===_0x474b29[_0x2b9013(0x1bc)]&&_0x5d9e5e[_0x2b9013(0x1b1)]===_0x474b29[_0x2b9013(0x1b1)];}function canonicalizeHookEntry(_0x4fdd10,_0x599d02){const {alias:_0x42df26,..._0x2984ab}=_0x4fdd10;return _0x599d02?{..._0x2984ab,'alias':_0x599d02}:_0x2984ab;}function hookDirectoryIdentity(_0x2dd194){const _0x245cc9=a43_0x27f8d1;return _0x2dd194['normalize'](_0x245cc9(0x1bb))[_0x245cc9(0x169)]();}function isSafeHookDirectorySegment(_0x5131b7){return isSafeLockKeySegment(_0x5131b7);}async function sameDirectory(_0x566b38,_0x31a9bb){const _0x35cbe6=a43_0x27f8d1,[_0x5c3ad4,_0x7f32d]=await Promise[_0x35cbe6(0x1ab)]([stat(_0x566b38),stat(_0x31a9bb)]);return _0x5c3ad4[_0x35cbe6(0x187)]===_0x7f32d['dev']&&_0x5c3ad4[_0x35cbe6(0x15b)]===_0x7f32d['ino'];}function a43_0x395a(){const _0x5333c6=['pull','split','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','join','mergedCli','currentApp','push_local','.hook-directory-migrate-','stderr','force','356527kMGqiU','functions','trim','lockFilePath','case-rename','nonInteractive','flatMap','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','scriptsRoot','selectedAppName','filter','filePath','dev','\x20--format\x20compress','has','sourceDirectoryPathByNewDirectory','entries','HOOK/','198RbqEhA','push','parse','keyChanges','HOOK','\x22\x20from\x20the\x20lock\x20file.','type','alias','3230283gyZsmW','\x22\x20from\x20\x22','\x22:\x20its\x20target\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','2FmErmS','apiDir','reverse','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Force\x20pull\x20cancelled.','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','\x22;\x20temporary\x20directory\x20\x22','defaultApp','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','Lock\x20scope\x20for\x20app\x20\x22','hash','\x20skipped','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Failed\x20to\x20write\x20local\x20script\x20\x22','set','\x22\x20may\x20remain.','code','all','str','lockKey','\x20bff\x20push\x20--type\x20','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','utf8','functionNode','mode','map','.js','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','oldLockKey','question','toISOString','delete','266664tlfuuQ','NFC','operationType','skipped','\x22:\x20','\x20--name\x20','datasetCode','remoteId','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.','some','newDirectory','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','unresolvable\x20target\x20path','functionName','includes','read','entry','Force\x20overwrite\x20local\x20unsynced\x20changes','newDirectoryPath','Could\x20not\x20restore\x20local\x20script\x20\x22','3390tujokZ','stringify','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','rekey','hookLocation','requires','9geKftS','appCode','would_pull','projectedFunctions','write','rollback','3468qcVMGx','Would\x20inspect\x20','scriptType','sourceFilePathByNewLockKey','newLockKey','bff','84050YOwAjb','existed','GET','profileName','message','COMMON','4069RCEnvK','yes','/api/management/library/scripts/list?appCode=','\x22:\x20both\x20target\x20\x22','\x20failed','move','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x20pulled','content','Remote\x20script\x20missing\x20content.','oldDirectory','\x22\x20to\x20\x22','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','ino','cancelled','boolean','&type=','get','ENOENT','migrations','validation','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','stdin','\x22\x20and\x20\x22','scriptContent','\x20Recovery\x20errors:\x20','1000792RGxDIE','toLowerCase','length','895Aqhaft','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','oldDirectoryPath','lastSync','8rvVuVf'];a43_0x395a=function(){return _0x5333c6;};return a43_0x395a();}async function applyHookDirectoryMigration(_0x2fcf23,_0xf060e0){const _0x32767e=a43_0x27f8d1,_0x1dd855=_0xf060e0[_0x32767e(0x17c)],_0x5aa4fe=_0xf060e0[_0x32767e(0x16e)],_0x3a05d6=[],_0x1b50f3=async()=>{const _0x15fe69=_0x32767e,_0x498e6f=[];_0xf060e0[_0x15fe69(0x17c)]=_0x1dd855,_0xf060e0[_0x15fe69(0x16e)]=_0x5aa4fe;for(const {migration:_0x2e1f4a,temporaryPath:_0x3a7d78}of[..._0x3a05d6][_0x15fe69(0x19c)]()){try{_0x3a7d78?(await rename(_0x2e1f4a[_0x15fe69(0x1cc)],_0x3a7d78),await rename(_0x3a7d78,_0x2e1f4a['oldDirectoryPath'])):await rename(_0x2e1f4a[_0x15fe69(0x1cc)],_0x2e1f4a[_0x15fe69(0x16d)]);}catch(_0x4c0119){_0x498e6f[_0x15fe69(0x18e)](new Error(_0x15fe69(0x1d0)+_0x2e1f4a[_0x15fe69(0x158)]+_0x15fe69(0x196)+_0x2e1f4a[_0x15fe69(0x1c4)]+_0x15fe69(0x1be)+(_0x4c0119 instanceof Error?_0x4c0119[_0x15fe69(0x14c)]:String(_0x4c0119))));}}return _0x498e6f;};try{for(const _0x286b6c of _0x2fcf23[_0x32767e(0x161)]){if(_0x286b6c[_0x32767e(0x1b2)]==='move')await ensureParentDirectory(_0x286b6c['newDirectoryPath']),await rename(_0x286b6c[_0x32767e(0x16d)],_0x286b6c[_0x32767e(0x1cc)]),_0x3a05d6[_0x32767e(0x18e)]({'migration':_0x286b6c});else{if(_0x286b6c[_0x32767e(0x1b2)]===_0x32767e(0x17f)){const _0x8efd21=join(dirname(_0x286b6c['oldDirectoryPath']),_0x32767e(0x178)+randomUUID());await rename(_0x286b6c['oldDirectoryPath'],_0x8efd21);try{await rename(_0x8efd21,_0x286b6c[_0x32767e(0x1cc)]);}catch(_0x25830d){try{await rename(_0x8efd21,_0x286b6c['oldDirectoryPath']);}catch(_0x2395eb){throw withRollbackErrors(_0x25830d,_0x32767e(0x19f)+_0x286b6c['oldDirectory']+_0x32767e(0x159)+_0x286b6c[_0x32767e(0x1c4)]+_0x32767e(0x1a0)+_0x8efd21+_0x32767e(0x1a9),[new Error(_0x32767e(0x1d1)+_0x8efd21+_0x32767e(0x159)+_0x286b6c['oldDirectory']+_0x32767e(0x1be)+(_0x2395eb instanceof Error?_0x2395eb[_0x32767e(0x14c)]:String(_0x2395eb)))]);}throw _0x25830d;}_0x3a05d6['push']({'migration':_0x286b6c,'temporaryPath':_0x8efd21});}}}return _0xf060e0['functions']=_0x2fcf23[_0x32767e(0x1d8)],{'rollback':_0x1b50f3};}catch(_0x3243e0){const _0x50afdd=await _0x1b50f3();throw withRollbackErrors(_0x3243e0,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x50afdd);}}async function confirmForce(){const _0x28e91a=a43_0x27f8d1,_0x18ebea=createInterface({'input':process[_0x28e91a(0x164)],'output':process[_0x28e91a(0x179)]}),_0x56f697=await new Promise(_0x3fa172=>{const _0x8227cc=_0x28e91a;_0x18ebea[_0x8227cc(0x1b7)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x3fa172);});return _0x18ebea['close'](),['y',_0x28e91a(0x14f)][_0x28e91a(0x1c8)](_0x56f697[_0x28e91a(0x17d)]()[_0x28e91a(0x169)]());}
|
|
1
|
+
const a43_0x1c3654=a43_0x1da4;(function(_0xa6b30d,_0x34f9b2){const _0xb79229=a43_0x1da4,_0x599d83=_0xa6b30d();while(!![]){try{const _0x261c94=-parseInt(_0xb79229(0x1c2))/0x1+-parseInt(_0xb79229(0x20d))/0x2*(parseInt(_0xb79229(0x1f6))/0x3)+-parseInt(_0xb79229(0x1dd))/0x4+parseInt(_0xb79229(0x1dc))/0x5*(parseInt(_0xb79229(0x1f3))/0x6)+-parseInt(_0xb79229(0x22d))/0x7+-parseInt(_0xb79229(0x22f))/0x8*(-parseInt(_0xb79229(0x1ef))/0x9)+parseInt(_0xb79229(0x256))/0xa;if(_0x261c94===_0x34f9b2)break;else _0x599d83['push'](_0x599d83['shift']());}catch(_0x264225){_0x599d83['push'](_0x599d83['shift']());}}}(a43_0x1f25,0xc23c5));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a43_0x1f25(){const _0x1d1a38=['oldDirectory','apiDir','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','would_pull','normalize','Remote\x20script\x20missing\x20content.','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','\x22:\x20both\x20target\x20\x22','¤tPage=1&pageSize=','move','\x20Recovery\x20errors:\x20','push_local','functionName','trim','toLowerCase','toISOString','keyChanges','3348415DQBgSq','6099636qdhJgr','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','values','bool','entry','\x22\x20and\x20\x22','\x22\x20may\x20remain.','dev','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','read','conflict','hookLocation','unresolvable\x20target\x20path','split','all','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','ENOENT','\x22\x20from\x20the\x20lock\x20file.','135981aZkkKP','migrations','delete','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','6gwRHuq','NFC','\x20resolution','36888NirMCJ','\x22;\x20temporary\x20directory\x20\x22','mode','selectedAppName','type','\x20failed','ENDPOINT','lockKey','Force\x20overwrite\x20local\x20unsynced\x20changes','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','some','\x20bff\x20push\x20--type\x20','defaultApp','get','.js','case-rename','BFF_LOCAL_UNSYNCED','code','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','HOOK','stderr','filter','requires','220TBHEWe','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','bff','newDirectoryPath','ino','includes','version','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','scriptsRootDir','write','pull','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','join','oldLockKey','\x20conflict','message','\x22:\x20its\x20target\x20\x22','rollback','currentApp','scriptContent','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','lastSync','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','.hook-directory-migrate-','profileName','newLockKey','stdin','COMMON','functionNode','\x22\x20not\x20found\x20after\x20ensureLockScope.','Remote\x20script\x20missing\x20id.','map','2992171MpgknX','string','664IMHxsC','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','oldDirectoryPath','reverse','scriptType','flatMap','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','Pull\x20only\x20this\x20script\x20type','has','datasetCode','Could\x20not\x20restore\x20local\x20script\x20\x22','Would\x20inspect\x20','newDirectory','alias','operationType','functions','filePath','sourceFilePathByNewLockKey','set','/api/management/library/scripts/list?appCode=','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x22\x20to\x20\x22','question','projectedFunctions','cancelled','length','\x22\x20from\x20\x22','hash','lockFilePath','push','GET','content','mergedCli','validation','boolean','parse','str','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','26033800XYQMAo','force','remoteId','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22:\x20','426599NQOILQ','nonInteractive','rekey','Lock\x20scope\x20for\x20app\x20\x22','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x20pulled','&type=','appCode'];a43_0x1f25=function(){return _0x1d1a38;};return a43_0x1f25();}export const bffPull={'service':a43_0x1c3654(0x20f),'command':a43_0x1c3654(0x217),'description':a43_0x1c3654(0x1ec),'risk':a43_0x1c3654(0x1e6),'structuredErrors':!![],'flags':[{'name':a43_0x1c3654(0x1fa),'type':a43_0x1c3654(0x22e),'description':a43_0x1c3654(0x236),'enum':[a43_0x1c3654(0x228),a43_0x1c3654(0x1fc),a43_0x1c3654(0x209)]},{'name':a43_0x1c3654(0x257),'type':a43_0x1c3654(0x251),'description':a43_0x1c3654(0x1fe)}],async 'dryRun'(_0x3d1365){const _0xee76e5=a43_0x1c3654,_0x4b3dad=loadBffProjectConfig(_0x3d1365[_0xee76e5(0x1c9)]),_0x223ad6=await readBffLockFile(_0x4b3dad[_0xee76e5(0x24b)]),{appLock:_0x35d109}=ensureLockScope(_0x223ad6??createEmptyBffLock(),_0x3d1365[_0xee76e5(0x1c9)],_0x4b3dad['scriptsRoot'],'pull'),_0x432768=normalizeBffType(_0x3d1365['str']('type'))??undefined,[_0x2333dd,_0x360a2a]=await Promise['all']([listBffScripts(_0x3d1365['appCode'],_0x432768),getBffScriptStatistics(_0x3d1365[_0xee76e5(0x1c9)])]),_0x2566f7=_0x2333dd['some'](_0x2d88d1=>normalizeBffType(_0x2d88d1[_0xee76e5(0x233)])===_0xee76e5(0x209)),_0x26de0b=_0x2566f7?buildDatasetCodeToAliasMap(_0x3d1365[_0xee76e5(0x1cb)],_0x3d1365['appCode'],_0x3d1365[_0xee76e5(0x1f9)]||_0x3d1365['mergedCli']?.[_0xee76e5(0x21f)]||_0x3d1365[_0xee76e5(0x24f)]?.['defaultApp']):new Map(),_0x40b653=_0x2566f7?await planHookDirectoryMigration(_0x4b3dad,_0x35d109,_0x26de0b,await scanLocalBffFunctions(_0x4b3dad,_0xee76e5(0x209))):undefined,_0x10e7cc=createHookLocationMap(_0x360a2a),_0x3f9aca=[];for(const _0x1e4c0a of _0x2333dd){const _0x380ea6=resolveRemoteScriptTarget(_0x4b3dad,_0x1e4c0a,_0x10e7cc,_0x40b653?.[_0xee76e5(0x246)]??_0x35d109[_0xee76e5(0x23e)],_0x26de0b);if(!_0x380ea6){_0x3f9aca[_0xee76e5(0x24c)]({'scriptType':_0x1e4c0a[_0xee76e5(0x233)],'functionName':_0x1e4c0a[_0xee76e5(0x1d7)]??'','status':'skipped','reason':_0xee76e5(0x1e9)});continue;}const _0x4dbd24=(_0x40b653?.[_0xee76e5(0x246)]??_0x35d109[_0xee76e5(0x23e)])[_0x380ea6[_0xee76e5(0x1fd)]],_0x388f35=_0x1e4c0a[_0xee76e5(0x220)]!=null?computeContentHash(_0x1e4c0a[_0xee76e5(0x220)]):undefined,_0x20c2ff=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x40b653,_0x380ea6)??_0x380ea6['filePath'],_0x4dbd24,_0x388f35),_0x6a53e6=_0x20c2ff?localUnsyncedConflict(_0x380ea6,_0x1e4c0a['id']):undefined;_0x3f9aca[_0xee76e5(0x24c)]({'lockKey':_0x380ea6[_0xee76e5(0x1fd)],'filePath':_0x380ea6[_0xee76e5(0x23f)],'remoteId':_0x1e4c0a['id']??null,'status':_0x6a53e6?_0xee76e5(0x1e7):_0xee76e5(0x1ce),..._0x6a53e6?{'conflict':_0x6a53e6}:{},..._0x380ea6[_0xee76e5(0x1e8)]?{'alias':_0x380ea6[_0xee76e5(0x1e8)]['alias']??null,'datasetCode':_0x380ea6['hookLocation'][_0xee76e5(0x238)],'operationType':_0x380ea6['hookLocation'][_0xee76e5(0x23d)],'functionNode':_0x380ea6[_0xee76e5(0x1e8)][_0xee76e5(0x229)]}:{}});}return{'method':_0xee76e5(0x24d),'url':_0xee76e5(0x242)+_0x3d1365[_0xee76e5(0x1c9)]+(_0x432768?_0xee76e5(0x1c8)+_0x432768:'')+_0xee76e5(0x1d3)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x3d1365[_0xee76e5(0x1c9)],'filterType':_0x432768??null,..._0x40b653&&_0x40b653[_0xee76e5(0x1f0)][_0xee76e5(0x248)]>0x0?{'hookDirectoryMigrations':_0x40b653[_0xee76e5(0x1f0)][_0xee76e5(0x22c)](_0x2ef9ac=>({'from':_0x2ef9ac['oldDirectory'],'to':_0x2ef9ac['newDirectory']}))}:{},'files':_0x3f9aca},'description':_0xee76e5(0x23a)+_0x3f9aca[_0xee76e5(0x248)]+'\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull'};},async 'execute'(_0x4eb194){const _0x1cc277=a43_0x1c3654,_0x32033f=loadBffProjectConfig(_0x4eb194[_0x1cc277(0x1c9)]),_0x40217b=await readBffLockFile(_0x32033f[_0x1cc277(0x24b)]),{lockData:_0x153b87,appLock:_0x15e587}=ensureLockScope(_0x40217b??createEmptyBffLock(),_0x4eb194[_0x1cc277(0x1c9)],_0x32033f['scriptsRoot'],'pull'),_0x5b82bb=normalizeBffType(_0x4eb194['str'](_0x1cc277(0x1fa)))??undefined;if(_0x4eb194[_0x1cc277(0x253)](_0x1cc277(0x1fa))&&!_0x5b82bb)throw CliErrors['validation'](_0x1cc277(0x1de));const [_0x131f44,_0x2f31ac]=await Promise['all']([listBffScripts(_0x4eb194[_0x1cc277(0x1c9)],_0x5b82bb),getBffScriptStatistics(_0x4eb194[_0x1cc277(0x1c9)])]);if(_0x131f44[_0x1cc277(0x248)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x1cc277(0x1d1)};const _0x241196=_0x4eb194[_0x1cc277(0x1e0)]('force');if(_0x241196&&!_0x4eb194[_0x1cc277(0x1c3)]){const _0x3b1a18=await confirmForce();if(!_0x3b1a18)throw CliErrors[_0x1cc277(0x247)]('Force\x20pull\x20cancelled.');}if(_0x241196&&_0x4eb194[_0x1cc277(0x1c3)]){}const _0x2dd2f3=_0x131f44[_0x1cc277(0x200)](_0x343101=>normalizeBffType(_0x343101[_0x1cc277(0x233)])==='HOOK'),_0x12330a=_0x2dd2f3?buildDatasetCodeToAliasMap(_0x4eb194['apiDir'],_0x4eb194['appCode'],_0x4eb194['selectedAppName']||_0x4eb194['mergedCli']?.[_0x1cc277(0x21f)]||_0x4eb194[_0x1cc277(0x24f)]?.[_0x1cc277(0x202)]):new Map(),_0x2f77b5=createHookLocationMap(_0x2f31ac),_0x195a92=JSON[_0x1cc277(0x252)](JSON['stringify'](_0x153b87)),_0xed4686=_0x4eb194[_0x1cc277(0x1c9)],_0x41179b=_0x195a92['apps'][_0xed4686];if(!_0x41179b)throw new Error(_0x1cc277(0x1c5)+_0xed4686+_0x1cc277(0x22a));const _0x305ec5=_0x2dd2f3?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x32033f,_0x41179b,_0x12330a,await scanLocalBffFunctions(_0x32033f,_0x1cc277(0x209))),_0x41179b):undefined,_0x1777a4=createPullFileTransaction(),_0x202215=[],_0x7a9803=[],_0x49804c=[],_0x5ea391=[];for(const _0x4491cc of _0x131f44){const _0x29746c=resolveRemoteScriptTarget(_0x32033f,_0x4491cc,_0x2f77b5,_0x41179b['functions'],_0x12330a);if(!_0x29746c){_0x7a9803[_0x1cc277(0x24c)]({'lockKey':_0x4491cc[_0x1cc277(0x233)]+'/'+_0x4491cc[_0x1cc277(0x1d7)],'reason':'unresolvable\x20target\x20path'});continue;}const _0x231d23=_0x41179b[_0x1cc277(0x23e)][_0x29746c[_0x1cc277(0x1fd)]];try{if(!_0x4491cc['id'])throw new Error(_0x1cc277(0x22b));if(_0x4491cc[_0x1cc277(0x220)]==null)throw new Error(_0x1cc277(0x1d0));const _0x5be011=_0x4491cc[_0x1cc277(0x220)],_0x726622=computeContentHash(_0x5be011);if(!_0x241196){const _0x208fcd=await hasUnsyncedLocalChanges(_0x29746c[_0x1cc277(0x23f)],_0x231d23,_0x726622);if(_0x208fcd){_0x49804c['push'](localUnsyncedConflict(_0x29746c,_0x4491cc['id']));continue;}}await _0x1777a4[_0x1cc277(0x216)](_0x29746c[_0x1cc277(0x23f)],_0x5be011);const _0x35b62e={'hash':_0x726622,'remoteId':_0x4491cc['id'],'version':_0x4491cc[_0x1cc277(0x213)]};_0x29746c[_0x1cc277(0x1fa)]===_0x1cc277(0x209)&&_0x29746c['hookLocation']&&(_0x35b62e[_0x1cc277(0x23c)]=_0x29746c[_0x1cc277(0x1e8)][_0x1cc277(0x23c)],_0x35b62e[_0x1cc277(0x238)]=_0x29746c[_0x1cc277(0x1e8)]['datasetCode'],_0x35b62e['operationType']=_0x29746c[_0x1cc277(0x1e8)][_0x1cc277(0x23d)],_0x35b62e[_0x1cc277(0x229)]=_0x29746c[_0x1cc277(0x1e8)][_0x1cc277(0x229)]),_0x41179b[_0x1cc277(0x23e)][_0x29746c[_0x1cc277(0x1fd)]]=_0x35b62e,_0x202215[_0x1cc277(0x24c)]({'lockKey':_0x29746c[_0x1cc277(0x1fd)],'remoteId':_0x4491cc['id']});}catch(_0x1b8448){_0x5ea391[_0x1cc277(0x24c)]({'lockKey':_0x29746c['lockKey'],'error':_0x1b8448 instanceof Error?_0x1b8448[_0x1cc277(0x21c)]:String(_0x1b8448)});}}_0x41179b['lastSync']=new Date()[_0x1cc277(0x1da)]();try{await writeBffLockFile(_0x32033f[_0x1cc277(0x24b)],_0x195a92);}catch(_0x5533be){const _0x564fb9=[...await _0x1777a4[_0x1cc277(0x21e)](),...await _0x305ec5?.[_0x1cc277(0x21e)]()??[]];throw withRollbackErrors(_0x5533be,_0x1cc277(0x208),_0x564fb9);}return{'ok':_0x5ea391[_0x1cc277(0x248)]===0x0,'data':{'pulled':_0x202215,'skipped':_0x7a9803,'conflicts':_0x49804c,'failed':_0x5ea391},'message':formatPullMessage(_0x202215[_0x1cc277(0x248)],_0x7a9803[_0x1cc277(0x248)],_0x49804c['length'],_0x5ea391[_0x1cc277(0x248)])};}};function localUnsyncedConflict(_0x13f490,_0x40841c){const _0x539297=a43_0x1c3654,_0x138aac=_0x13f490[_0x539297(0x1fd)]['split']('/')['at'](-0x1);return{'code':_0x539297(0x206),'lockKey':_0x13f490[_0x539297(0x1fd)],'filePath':_0x13f490[_0x539297(0x23f)],..._0x40841c!=null?{'remoteId':_0x40841c}:{},'message':_0x539297(0x218),'nextAction':{'action':_0x539297(0x1d6),'command':CLI_BIN_NAME+_0x539297(0x201)+_0x13f490[_0x539297(0x1fa)]+'\x20--name\x20'+_0x138aac+'\x20--format\x20compress','requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function a43_0x1da4(_0x334c1c,_0x133499){_0x334c1c=_0x334c1c-0x1c2;const _0x1f253b=a43_0x1f25();let _0x1da4f3=_0x1f253b[_0x334c1c];return _0x1da4f3;}function formatPullMessage(_0x46dd15,_0x2500d1,_0x531d6a,_0x3a18d4){const _0x4ce93d=a43_0x1c3654,_0x1202ec=['Pull\x20complete:\x20'+_0x46dd15+_0x4ce93d(0x1c7),_0x2500d1+'\x20skipped'];_0x531d6a>0x0&&_0x1202ec['push'](_0x531d6a+_0x4ce93d(0x21b)+(_0x531d6a===0x1?'':'s')+'\x20'+(_0x531d6a===0x1?_0x4ce93d(0x20c):'require')+_0x4ce93d(0x1f5));if(_0x3a18d4>0x0)_0x1202ec[_0x4ce93d(0x24c)](_0x3a18d4+_0x4ce93d(0x1fb));return _0x1202ec[_0x4ce93d(0x219)](',\x20');}async function hasUnsyncedLocalChanges(_0x497ec8,_0x96ac7c,_0x1f7693){const _0x544482=a43_0x1c3654;if(!await fileExists(_0x497ec8))return![];const _0x3892eb=await computeFileHash(_0x497ec8);if(!_0x96ac7c)return _0x1f7693?_0x3892eb!==_0x1f7693:!![];return _0x3892eb!==_0x96ac7c[_0x544482(0x24a)];}function createPullFileTransaction(){const _0x5b58fd=new Map(),_0x94881e=async(_0x42b64e,_0x3b5e2c)=>{const _0x4dbb05=a43_0x1da4;try{if(_0x3b5e2c['existed'])await ensureParentDirectory(_0x42b64e),await writeFile(_0x42b64e,_0x3b5e2c[_0x4dbb05(0x24e)]);else try{await unlink(_0x42b64e);}catch(_0x17beeb){if(_0x17beeb['code']!=='ENOENT')throw _0x17beeb;}return undefined;}catch(_0x596a7d){return _0x596a7d instanceof Error?_0x596a7d:new Error(String(_0x596a7d));}};return{async 'write'(_0x3382a2,_0x1f8241){const _0x1410f3=a43_0x1da4;if(!_0x5b58fd['has'](_0x3382a2))try{_0x5b58fd[_0x1410f3(0x241)](_0x3382a2,{'existed':!![],'content':await readFile(_0x3382a2)});}catch(_0x4b54db){if(_0x4b54db[_0x1410f3(0x207)]!==_0x1410f3(0x1ed))throw _0x4b54db;_0x5b58fd['set'](_0x3382a2,{'existed':![]});}try{await ensureParentDirectory(_0x3382a2),await writeFile(_0x3382a2,_0x1f8241,'utf8');}catch(_0x318824){const _0x13fede=await _0x94881e(_0x3382a2,_0x5b58fd[_0x1410f3(0x203)](_0x3382a2));if(!_0x13fede)_0x5b58fd[_0x1410f3(0x1f1)](_0x3382a2);throw withRollbackErrors(_0x318824,'Failed\x20to\x20write\x20local\x20script\x20\x22'+_0x3382a2+'\x22.',_0x13fede?[_0x13fede]:[]);}},async 'rollback'(){const _0x1167e8=a43_0x1da4,_0x25727b=[];for(const [_0x443352,_0x2a1fcd]of[..._0x5b58fd['entries']()][_0x1167e8(0x232)]()){const _0x2b83ac=await _0x94881e(_0x443352,_0x2a1fcd);_0x2b83ac&&_0x25727b['push'](new Error(_0x1167e8(0x239)+_0x443352+_0x1167e8(0x25b)+_0x2b83ac[_0x1167e8(0x21c)]));}return _0x25727b;}};}function withRollbackErrors(_0x3481fb,_0x4a268f,_0x502801){const _0x4c9716=a43_0x1c3654,_0x200090=_0x3481fb instanceof Error?_0x3481fb:new Error(String(_0x3481fb));if(_0x502801[_0x4c9716(0x248)]===0x0)return _0x200090;return new AggregateError([_0x200090,..._0x502801],_0x4a268f+_0x4c9716(0x1d5)+_0x502801[_0x4c9716(0x22c)](_0x5a0e90=>_0x5a0e90[_0x4c9716(0x21c)])[_0x4c9716(0x219)](';\x20'));}function buildDatasetCodeToAliasMap(_0x13a4d1,_0xb4003,_0x10aed5){const _0x3043f9=a43_0x1c3654,_0x465c62=resolveApiModelSource(_0x13a4d1,_0xb4003,_0x10aed5),_0x323a62=loadAliasMap(_0x13a4d1,undefined,_0x465c62[_0x3043f9(0x23f)],_0x465c62[_0x3043f9(0x225)]);return assertUnambiguousHookAliases(_0x323a62),new Map(_0x323a62[_0x3043f9(0x22c)](_0xe07cb=>[_0xe07cb[_0x3043f9(0x238)][_0x3043f9(0x1d9)](),_0xe07cb['alias']]));}async function planHookDirectoryMigration(_0x1c5cc3,_0x129f6c,_0xdf2ad3,_0xac8e8a){const _0x693d1f=a43_0x1c3654,_0x57dc20=new Map();for(const [_0x14e4e0,_0x26c282]of Object['entries'](_0x129f6c['functions'])){const [_0x55bd18,_0x19a866,_0x10b64e,_0x13554a,_0x1843fe,..._0x1a19ad]=_0x14e4e0[_0x693d1f(0x1ea)]('/');if(_0x55bd18!==_0x693d1f(0x209)||!_0x19a866||!_0x10b64e||!_0x13554a||!_0x1843fe||_0x1a19ad[_0x693d1f(0x248)]>0x0||!_0x26c282[_0x693d1f(0x238)])continue;const _0x55c374=_0xdf2ad3[_0x693d1f(0x203)](_0x26c282[_0x693d1f(0x238)][_0x693d1f(0x1d9)]()),_0x1294db=_0x55c374??_0x26c282[_0x693d1f(0x238)];if(!isSafeHookDirectorySegment(_0x19a866))throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x254)+_0x19a866+_0x693d1f(0x1ee));if(!isSafeHookDirectorySegment(_0x1294db))throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x1c6)+_0x19a866+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x19a866===_0x1294db)continue;const _0x497d47=_0x57dc20[_0x693d1f(0x203)](_0x19a866)??{'datasetCode':_0x26c282[_0x693d1f(0x238)],'alias':_0x55c374,'keyChanges':[]};if(_0x497d47[_0x693d1f(0x238)]!==_0x26c282['datasetCode'])throw CliErrors[_0x693d1f(0x250)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x19a866+_0x693d1f(0x214));const _0xda0eb9='HOOK/'+_0x1294db+'/'+_0x10b64e+'/'+_0x13554a+'/'+_0x1843fe;try{resolveLocalFilePathFromLockKey(_0x1c5cc3,_0x14e4e0),resolveLocalFilePathFromLockKey(_0x1c5cc3,_0xda0eb9);}catch(_0x34e0cb){throw CliErrors['validation'](_0x693d1f(0x1cc)+_0x14e4e0+'\x22:\x20'+(_0x34e0cb instanceof Error?_0x34e0cb[_0x693d1f(0x21c)]:String(_0x34e0cb)));}_0x497d47[_0x693d1f(0x1db)][_0x693d1f(0x24c)]({'oldLockKey':_0x14e4e0,'newLockKey':_0xda0eb9,'entry':_0x26c282}),_0x57dc20[_0x693d1f(0x241)](_0x19a866,_0x497d47);}const _0x4efd39=new Set([..._0x57dc20[_0x693d1f(0x1df)]()][_0x693d1f(0x234)](_0x588f8f=>_0x588f8f[_0x693d1f(0x1db)][_0x693d1f(0x22c)](_0x2c2cde=>_0x2c2cde[_0x693d1f(0x21a)]))),_0x4973fc=new Map(),_0x2cd365=new Map();for(const [_0x55dc5d,_0x50cb5]of _0x57dc20){const _0x2ccd1e=_0x50cb5[_0x693d1f(0x23c)]??_0x50cb5['datasetCode'],_0x4320b1=hookDirectoryIdentity(_0x2ccd1e),_0x4162b8=_0x4973fc[_0x693d1f(0x203)](_0x4320b1);if(_0x4162b8&&_0x4162b8!==_0x55dc5d)throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x235)+_0x4162b8+_0x693d1f(0x1e2)+_0x55dc5d+_0x693d1f(0x1d2)+_0x2ccd1e+_0x693d1f(0x1ff));_0x4973fc['set'](_0x4320b1,_0x55dc5d);for(const _0x326ba2 of _0x50cb5[_0x693d1f(0x1db)]){const _0x52fcbb=_0x2cd365[_0x693d1f(0x203)](_0x326ba2[_0x693d1f(0x226)]);if(_0x52fcbb&&_0x52fcbb!==_0x326ba2[_0x693d1f(0x21a)])throw CliErrors['validation'](_0x693d1f(0x223)+_0x52fcbb+_0x693d1f(0x1e2)+_0x326ba2[_0x693d1f(0x21a)]+_0x693d1f(0x1d2)+_0x326ba2[_0x693d1f(0x226)]+_0x693d1f(0x1e5));if(_0x4efd39['has'](_0x326ba2[_0x693d1f(0x226)]))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x326ba2['oldLockKey']+_0x693d1f(0x21d)+_0x326ba2[_0x693d1f(0x226)]+_0x693d1f(0x1cd));_0x2cd365['set'](_0x326ba2[_0x693d1f(0x226)],_0x326ba2[_0x693d1f(0x21a)]);}}const _0x276c57=new Map();for(const [_0x414a7b,_0x355289]of _0xdf2ad3){_0x276c57['set'](hookDirectoryIdentity(_0x355289),_0x414a7b);}const _0x240b44=[];for(const [_0x401da0,_0x3b71b4]of _0x57dc20){const _0x1f8dd2=_0x3b71b4['alias']??_0x3b71b4['datasetCode'],_0x2487e9=join(_0x1c5cc3[_0x693d1f(0x215)],'HOOK',_0x401da0),_0x15cf01=join(_0x1c5cc3[_0x693d1f(0x215)],_0x693d1f(0x209),_0x1f8dd2),_0xec51cc=await directoryExists(_0x2487e9),_0x3618a5=await directoryExists(_0x15cf01),_0x2bf801=_0xec51cc?_0x3618a5?await sameDirectory(_0x2487e9,_0x15cf01)?_0x693d1f(0x205):undefined:_0x693d1f(0x1d4):_0x693d1f(0x1c4);if(!_0x2bf801)throw CliErrors['validation'](_0x693d1f(0x1c6)+_0x401da0+_0x693d1f(0x244)+_0x1f8dd2+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x1a031b=_0x276c57[_0x693d1f(0x203)](hookDirectoryIdentity(_0x401da0));if(_0x1a031b&&_0x1a031b!==_0x3b71b4[_0x693d1f(0x238)][_0x693d1f(0x1d9)]()){const _0xeb6e78=new Set(_0x3b71b4[_0x693d1f(0x1db)][_0x693d1f(0x22c)](_0x191bcd=>_0x191bcd[_0x693d1f(0x21a)])),_0x2beabe=_0xac8e8a[_0x693d1f(0x20b)](_0x2d38ad=>_0x2d38ad['type']==='HOOK'&&_0x2d38ad[_0x693d1f(0x23c)]!=null&&hookDirectoryIdentity(_0x2d38ad[_0x693d1f(0x23c)])===hookDirectoryIdentity(_0x401da0)&&!_0xeb6e78[_0x693d1f(0x237)](_0x2d38ad['lockKey']));if(_0x2beabe['length']>0x0)throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x1c6)+_0x401da0+_0x693d1f(0x230));}const _0x453822=_0x276c57[_0x693d1f(0x203)](hookDirectoryIdentity(_0x1f8dd2));if(_0x453822&&_0x453822!==_0x3b71b4[_0x693d1f(0x238)][_0x693d1f(0x1d9)]())throw CliErrors[_0x693d1f(0x250)](_0x693d1f(0x1c6)+_0x401da0+_0x693d1f(0x244)+_0x1f8dd2+_0x693d1f(0x259));for(const _0x4016e1 of _0x3b71b4['keyChanges']){const _0x13aeec=_0x129f6c[_0x693d1f(0x23e)][_0x4016e1[_0x693d1f(0x226)]];if(_0x13aeec&&!_0x4efd39[_0x693d1f(0x237)](_0x4016e1[_0x693d1f(0x226)])&&!sameHookIdentity(_0x4016e1['entry'],_0x13aeec))throw CliErrors[_0x693d1f(0x250)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x401da0+_0x693d1f(0x244)+_0x1f8dd2+_0x693d1f(0x221));}_0x240b44[_0x693d1f(0x24c)]({'oldDirectory':_0x401da0,'newDirectory':_0x1f8dd2,'oldDirectoryPath':_0x2487e9,'newDirectoryPath':_0x15cf01,'mode':_0x2bf801,'alias':_0x3b71b4[_0x693d1f(0x23c)],'keyChanges':_0x3b71b4[_0x693d1f(0x1db)]});}const _0x191e04={..._0x129f6c['functions']},_0x3f6b21=new Map(),_0x83a8ce=new Map();for(const _0x51e971 of _0x240b44){const _0x38e0c7=_0x51e971[_0x693d1f(0x1f8)]!==_0x693d1f(0x1c4);_0x38e0c7&&_0x83a8ce[_0x693d1f(0x241)](hookDirectoryIdentity(_0x51e971[_0x693d1f(0x23b)]),_0x51e971[_0x693d1f(0x231)]);for(const _0x4a433f of _0x51e971[_0x693d1f(0x1db)]){const _0x189ffb=_0x191e04[_0x4a433f[_0x693d1f(0x226)]],_0x31e357=_0x38e0c7?_0x4a433f[_0x693d1f(0x1e1)]:_0x189ffb??_0x4a433f['entry'];_0x191e04[_0x4a433f[_0x693d1f(0x226)]]=canonicalizeHookEntry(_0x31e357,_0x51e971['alias']),delete _0x191e04[_0x4a433f[_0x693d1f(0x21a)]],_0x38e0c7&&_0x3f6b21[_0x693d1f(0x241)](_0x4a433f[_0x693d1f(0x226)],resolveLocalFilePathFromLockKey(_0x1c5cc3,_0x4a433f[_0x693d1f(0x21a)]));}}return{'migrations':_0x240b44,'projectedFunctions':_0x191e04,'sourceFilePathByNewLockKey':_0x3f6b21,'sourceDirectoryPathByNewDirectory':_0x83a8ce};}function resolveMigratedSourceFilePath(_0x1d48d1,_0x39aa7a){const _0x646ca7=a43_0x1c3654;if(!_0x1d48d1||!_0x39aa7a)return undefined;const _0x131232=_0x1d48d1[_0x646ca7(0x240)][_0x646ca7(0x203)](_0x39aa7a['lockKey']);if(_0x131232)return _0x131232;if(_0x39aa7a[_0x646ca7(0x1fa)]!==_0x646ca7(0x209))return undefined;const [,_0x592dd0,..._0x4b22ec]=_0x39aa7a[_0x646ca7(0x1fd)][_0x646ca7(0x1ea)]('/');if(!_0x592dd0||_0x4b22ec[_0x646ca7(0x248)]===0x0)return undefined;const _0x408565=_0x1d48d1['sourceDirectoryPathByNewDirectory'][_0x646ca7(0x203)](hookDirectoryIdentity(_0x592dd0));return _0x408565?join(_0x408565,..._0x4b22ec)+_0x646ca7(0x204):undefined;}function sameHookIdentity(_0x47f1b0,_0x519dda){const _0x1e42fb=a43_0x1c3654;return _0x47f1b0[_0x1e42fb(0x258)]===_0x519dda[_0x1e42fb(0x258)]&&_0x47f1b0[_0x1e42fb(0x238)]===_0x519dda[_0x1e42fb(0x238)]&&_0x47f1b0[_0x1e42fb(0x23d)]===_0x519dda[_0x1e42fb(0x23d)]&&_0x47f1b0[_0x1e42fb(0x229)]===_0x519dda['functionNode'];}function canonicalizeHookEntry(_0x1a61cd,_0x2b800b){const {alias:_0x43a919,..._0x120375}=_0x1a61cd;return _0x2b800b?{..._0x120375,'alias':_0x2b800b}:_0x120375;}function hookDirectoryIdentity(_0x338dff){const _0x1ce4c8=a43_0x1c3654;return _0x338dff[_0x1ce4c8(0x1cf)](_0x1ce4c8(0x1f4))['toLowerCase']();}function isSafeHookDirectorySegment(_0x324c96){return isSafeLockKeySegment(_0x324c96);}async function sameDirectory(_0x1f6fbf,_0x4891a4){const _0x22f76b=a43_0x1c3654,[_0x1625d9,_0x35960f]=await Promise[_0x22f76b(0x1eb)]([stat(_0x1f6fbf),stat(_0x4891a4)]);return _0x1625d9[_0x22f76b(0x1e4)]===_0x35960f[_0x22f76b(0x1e4)]&&_0x1625d9['ino']===_0x35960f[_0x22f76b(0x211)];}async function applyHookDirectoryMigration(_0x1cba2e,_0x88163b){const _0x488e6a=a43_0x1c3654,_0x42ce40=_0x88163b['functions'],_0x5b6780=_0x88163b[_0x488e6a(0x222)],_0x291646=[],_0xc4ab7c=async()=>{const _0x15f89d=_0x488e6a,_0x3fca0c=[];_0x88163b[_0x15f89d(0x23e)]=_0x42ce40,_0x88163b[_0x15f89d(0x222)]=_0x5b6780;for(const {migration:_0x1a658d,temporaryPath:_0x2dae7b}of[..._0x291646][_0x15f89d(0x232)]()){try{_0x2dae7b?(await rename(_0x1a658d['newDirectoryPath'],_0x2dae7b),await rename(_0x2dae7b,_0x1a658d['oldDirectoryPath'])):await rename(_0x1a658d['newDirectoryPath'],_0x1a658d[_0x15f89d(0x231)]);}catch(_0x45e6be){_0x3fca0c[_0x15f89d(0x24c)](new Error(_0x15f89d(0x20e)+_0x1a658d[_0x15f89d(0x1ca)]+_0x15f89d(0x249)+_0x1a658d['newDirectory']+'\x22:\x20'+(_0x45e6be instanceof Error?_0x45e6be[_0x15f89d(0x21c)]:String(_0x45e6be))));}}return _0x3fca0c;};try{for(const _0x2dc727 of _0x1cba2e['migrations']){if(_0x2dc727[_0x488e6a(0x1f8)]===_0x488e6a(0x1d4))await ensureParentDirectory(_0x2dc727['newDirectoryPath']),await rename(_0x2dc727[_0x488e6a(0x231)],_0x2dc727[_0x488e6a(0x210)]),_0x291646[_0x488e6a(0x24c)]({'migration':_0x2dc727});else{if(_0x2dc727[_0x488e6a(0x1f8)]===_0x488e6a(0x205)){const _0x484d07=join(dirname(_0x2dc727[_0x488e6a(0x231)]),_0x488e6a(0x224)+randomUUID());await rename(_0x2dc727[_0x488e6a(0x231)],_0x484d07);try{await rename(_0x484d07,_0x2dc727[_0x488e6a(0x210)]);}catch(_0x191ed4){try{await rename(_0x484d07,_0x2dc727[_0x488e6a(0x231)]);}catch(_0x5c4c79){throw withRollbackErrors(_0x191ed4,_0x488e6a(0x255)+_0x2dc727[_0x488e6a(0x1ca)]+_0x488e6a(0x244)+_0x2dc727[_0x488e6a(0x23b)]+_0x488e6a(0x1f7)+_0x484d07+_0x488e6a(0x1e3),[new Error(_0x488e6a(0x25a)+_0x484d07+'\x22\x20to\x20\x22'+_0x2dc727['oldDirectory']+_0x488e6a(0x25b)+(_0x5c4c79 instanceof Error?_0x5c4c79[_0x488e6a(0x21c)]:String(_0x5c4c79)))]);}throw _0x191ed4;}_0x291646[_0x488e6a(0x24c)]({'migration':_0x2dc727,'temporaryPath':_0x484d07});}}}return _0x88163b[_0x488e6a(0x23e)]=_0x1cba2e[_0x488e6a(0x246)],{'rollback':_0xc4ab7c};}catch(_0x425b69){const _0x2fc7a7=await _0xc4ab7c();throw withRollbackErrors(_0x425b69,_0x488e6a(0x243),_0x2fc7a7);}}async function confirmForce(){const _0x458b1f=a43_0x1c3654,_0x42b064=createInterface({'input':process[_0x458b1f(0x227)],'output':process[_0x458b1f(0x20a)]}),_0x57188b=await new Promise(_0x53a7ad=>{const _0x4d2f79=_0x458b1f;_0x42b064[_0x4d2f79(0x245)](_0x4d2f79(0x1f2),_0x53a7ad);});return _0x42b064['close'](),['y','yes'][_0x458b1f(0x212)](_0x57188b[_0x458b1f(0x1d8)]()['toLowerCase']());}
|