@lovrabet/rabetbase-cli 2.5.4 → 2.5.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +1 -1
- package/lib/api/model-registry-file.js +1 -1
- package/lib/api/model-registry-scaffold.js +1 -1
- package/lib/api/model-source.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +1 -1
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.js +1 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +1 -1
- package/lib/commands/dataset/cross-relation-shared.js +1 -1
- package/lib/commands/dataset/cross-relation-update.js +1 -1
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/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 +35 -0
- package/skills/rabetbase-page-generation/references/component-baseline.md +18 -0
- package/skills/rabetbase-page-generation/references/generation.md +77 -0
- package/skills/rabetbase-page-generation/templates/onepage/build.mjs +63 -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 +717 -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
|
+
function a34_0x1f5a(){const _0x5e2d58=['/smartapi/app-config/create','number','34144533eHQMQU','set','app-config','appCode','802540QjYWuW','Updated','create',',\x20appCode=','5677945qFJqhV','12cbmtoc','1203265lyDWnG','3Aimaso','Read\x20config\x20value\x20from\x20file','1338736oTEOjn','file','8064400nRAWXL','\x20app\x20config\x20','Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','get','apiError','tags','/smartapi/app-config/update','3627604hvswUA','update','write','isFinite'];a34_0x1f5a=function(){return _0x5e2d58;};return a34_0x1f5a();}const a34_0x2f1d2a=a34_0x4078;(function(_0x23d937,_0x2dcb9f){const _0x3dac9c=a34_0x4078,_0x5cef7c=_0x23d937();while(!![]){try{const _0x2a7198=parseInt(_0x3dac9c(0x14a))/0x1+-parseInt(_0x3dac9c(0x153))/0x2+parseInt(_0x3dac9c(0x151))/0x3*(-parseInt(_0x3dac9c(0x15c))/0x4)+parseInt(_0x3dac9c(0x150))/0x5*(-parseInt(_0x3dac9c(0x14f))/0x6)+-parseInt(_0x3dac9c(0x14e))/0x7+-parseInt(_0x3dac9c(0x155))/0x8+parseInt(_0x3dac9c(0x146))/0x9;if(_0x2a7198===_0x2dcb9f)break;else _0x5cef7c['push'](_0x5cef7c['shift']());}catch(_0x250598){_0x5cef7c['push'](_0x5cef7c['shift']());}}}(a34_0x1f5a,0xafb01));import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a34_0x4078(_0x18fc6e,_0x10207d){_0x18fc6e=_0x18fc6e-0x144;const _0x1f5a7b=a34_0x1f5a();let _0x407844=_0x1f5a7b[_0x18fc6e];return _0x407844;}const CREATE_PATH=a34_0x2f1d2a(0x144),UPDATE_PATH=a34_0x2f1d2a(0x15b);export const appConfigSet={'service':a34_0x2f1d2a(0x148),'command':a34_0x2f1d2a(0x147),'description':a34_0x2f1d2a(0x157),'risk':a34_0x2f1d2a(0x15e),'args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':a34_0x2f1d2a(0x154),'type':'string','description':a34_0x2f1d2a(0x152)}],async 'validate'(_0x34e536){readKeyArg(_0x34e536),readOptionalTags(_0x34e536),assertSingleValueSource(_0x34e536);},async 'dryRun'(_0x1648a1){const _0x4a1b8f=a34_0x2f1d2a,_0x5c3117=readKeyArg(_0x1648a1),_0x332532=readOptionalTags(_0x1648a1),_0x449b98=assertSingleValueSource(_0x1648a1);await assertValueSourceReadable(_0x449b98);const _0x10b363=await withAppConfigApiBoundary('get',{'appCode':_0x1648a1[_0x4a1b8f(0x149)],'key':_0x5c3117},()=>getAppConfigByKey(_0x1648a1[_0x4a1b8f(0x149)],_0x5c3117)),_0x3afdbd=_0x10b363?'update':'create',_0x2e1725=_0x10b363?projectAppConfig(_0x10b363):null,_0x240de5=plannedAppConfig({'appCode':_0x1648a1[_0x4a1b8f(0x149)],'key':_0x5c3117,'tags':_0x332532??_0x10b363?.[_0x4a1b8f(0x15a)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x3afdbd,'appCode':_0x1648a1[_0x4a1b8f(0x149)],'key':_0x5c3117,'before':_0x2e1725,'after':_0x240de5,'dryRun':!![]}),{'method':'POST','url':_0x3afdbd===_0x4a1b8f(0x15d)?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x4de83c){const _0x52366e=a34_0x2f1d2a,_0x430992=readKeyArg(_0x4de83c),_0x4e2635=readOptionalTags(_0x4de83c),_0x303b0d=await withAppConfigApiBoundary(_0x52366e(0x158),{'appCode':_0x4de83c['appCode'],'key':_0x430992},()=>getAppConfigByKey(_0x4de83c[_0x52366e(0x149)],_0x430992)),_0x3eb33d=_0x303b0d?projectAppConfig(_0x303b0d):null,_0x137ab0=_0x303b0d?_0x52366e(0x15d):_0x52366e(0x14c),{value:_0x3d5aea,warnings:_0x41c67e}=await readAppConfigValue(_0x4de83c),_0xa5858={'appCode':_0x4de83c['appCode'],'key':_0x430992,'value':_0x3d5aea,'tags':_0x4e2635??_0x303b0d?.[_0x52366e(0x15a)]??undefined};await withAppConfigApiBoundary(_0x137ab0,{'appCode':_0x4de83c['appCode'],'key':_0x430992},async()=>{const _0x319fbf=_0x52366e;_0x303b0d?await updateAppConfig({..._0xa5858,'id':requireAppConfigId(_0x303b0d,_0x430992,_0x4de83c[_0x319fbf(0x149)])}):await createAppConfig(_0xa5858);});const _0x4f1ddf=await withAppConfigApiBoundary(_0x52366e(0x158),{'appCode':_0x4de83c[_0x52366e(0x149)],'key':_0x430992},()=>getAppConfigByKey(_0x4de83c[_0x52366e(0x149)],_0x430992)),_0x47ac4b=_0x4f1ddf?projectAppConfig(_0x4f1ddf):plannedAppConfig({'appCode':_0x4de83c[_0x52366e(0x149)],'key':_0x430992,'tags':_0xa5858[_0x52366e(0x15a)],'hasValue':_0x3d5aea!==''});return{'ok':!![],'data':buildMutationData({'operation':_0x137ab0,'appCode':_0x4de83c[_0x52366e(0x149)],'key':_0x430992,'before':_0x3eb33d,'after':_0x47ac4b,'dryRun':![],'warnings':_0x41c67e}),'message':(_0x137ab0===_0x52366e(0x15d)?_0x52366e(0x14b):'Created')+_0x52366e(0x156)+_0x430992};}};function requireAppConfigId(_0x541d61,_0x3f7e46,_0x324a2e){const _0x4f30cb=a34_0x2f1d2a;if(typeof _0x541d61['id']===_0x4f30cb(0x145)&&Number[_0x4f30cb(0x15f)](_0x541d61['id'])&&_0x541d61['id']>0x0)return _0x541d61['id'];throw CliErrors[_0x4f30cb(0x159)]('App\x20config\x20server\x20id\x20missing\x20for\x20key='+_0x3f7e46+_0x4f30cb(0x14d)+_0x324a2e);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x44ac6d=a35_0x7e86;(function(_0x31056a,_0x3c8970){const _0x19e3ec=a35_0x7e86,_0x128e29=_0x31056a();while(!![]){try{const _0x4ab6fa=-parseInt(_0x19e3ec(0x172))/0x1*(parseInt(_0x19e3ec(0x159))/0x2)+-parseInt(_0x19e3ec(0x155))/0x3+-parseInt(_0x19e3ec(0x166))/0x4+parseInt(_0x19e3ec(0x161))/0x5*(-parseInt(_0x19e3ec(0x14a))/0x6)+parseInt(_0x19e3ec(0x141))/0x7+-parseInt(_0x19e3ec(0x16f))/0x8+parseInt(_0x19e3ec(0x144))/0x9;if(_0x4ab6fa===_0x3c8970)break;else _0x128e29['push'](_0x128e29['shift']());}catch(_0x104554){_0x128e29['push'](_0x128e29['shift']());}}}(a35_0x1548,0xdcb86));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a35_0x44ac6d(0x165),'description':'Runtime\x20app-config\x20key','required':!![]};function a35_0x7e86(_0x8eff6d,_0x332ee4){_0x8eff6d=_0x8eff6d-0x138;const _0x1548d1=a35_0x1548();let _0x7e868f=_0x1548d1[_0x8eff6d];return _0x7e868f;}export const VALUE_ARG={'name':a35_0x44ac6d(0x145),'description':a35_0x44ac6d(0x149),'required':![]};export const TAGS_FLAG={'name':'tags','type':a35_0x44ac6d(0x16a),'description':a35_0x44ac6d(0x139)};export const STDIN_FLAG={'name':a35_0x44ac6d(0x156),'type':'boolean','description':a35_0x44ac6d(0x174),'default':![]};export const FROM_ENV_FLAG={'name':a35_0x44ac6d(0x13f),'type':a35_0x44ac6d(0x16a),'description':a35_0x44ac6d(0x14f)};export const REVEAL_FLAG={'name':a35_0x44ac6d(0x15b),'type':a35_0x44ac6d(0x14e),'description':a35_0x44ac6d(0x148),'default':![]};export function readKeyArg(_0x5aa4db){const _0x1a0416=a35_0x44ac6d,_0x300fc5=_0x5aa4db[_0x1a0416(0x154)][0x0]?.[_0x1a0416(0x147)]()??'';return validateKey(_0x300fc5),_0x300fc5;}export function readOptionalTags(_0xc8151){const _0x4d58ab=a35_0x44ac6d,_0x5ab304=_0xc8151[_0x4d58ab(0x175)](_0x4d58ab(0x13a))[_0x4d58ab(0x147)]();if(!_0x5ab304)return undefined;if(_0x5ab304['length']>0x20)throw CliErrors[_0x4d58ab(0x15e)](_0x4d58ab(0x15d));return _0x5ab304;}function a35_0x1548(){const _0x581058=['from-env','url','6093857oRdUaM','file','Failed\x20to\x20','47542824aCSBTJ','value','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','trim','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','54hsUPKT','\x20app\x20config.','Value\x20file\x20is\x20not\x20readable:\x20','dryRun','boolean','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','Environment\x20variable\x20is\x20not\x20set:\x20','Missing\x20app-config\x20key.','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','warnings','args','2871156HbXLJb','stdin','gmtModified','defineProperties','258TSZhKI','join','reveal','Missing\x20app-config\x20value\x20source.','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','validation','path','utf8','846970hhYzzi','hasValue','once','operation','key','745236jHmDuj','length','push','kind','string','env','data','setEncoding','appCode','11024448ncVuum','key:\x20','end','9326oDPFoo','after','Read\x20config\x20value\x20from\x20stdin','str','name','Config\x20tags\x20for\x20filtering/display\x20metadata','tags','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','flag','argument','apiError'];a35_0x1548=function(){return _0x581058;};return a35_0x1548();}export function validateKey(_0x3b069c){const _0x5553f3=a35_0x44ac6d;if(!_0x3b069c)throw CliErrors['validation'](_0x5553f3(0x151));if(_0x3b069c['length']>0x100)throw CliErrors[_0x5553f3(0x15e)](_0x5553f3(0x152));}export function projectAppConfig(_0x45342a,_0x2b919b){const _0x38f10f=a35_0x44ac6d,_0x212da6=_0x45342a[_0x38f10f(0x145)]!==undefined&&_0x45342a[_0x38f10f(0x145)]!==null&&_0x45342a[_0x38f10f(0x145)]!=='',_0x54a5d3={'appCode':_0x45342a[_0x38f10f(0x16e)],'key':_0x45342a[_0x38f10f(0x165)],'tags':_0x45342a['tags']??undefined,'hasValue':_0x212da6,'valueRedacted':_0x212da6&&!_0x2b919b?.[_0x38f10f(0x15b)],'gmtCreate':_0x45342a['gmtCreate'],'gmtModified':_0x45342a[_0x38f10f(0x157)]};return _0x2b919b?.[_0x38f10f(0x15b)]&&(_0x54a5d3[_0x38f10f(0x145)]=_0x45342a[_0x38f10f(0x145)]??'',_0x54a5d3['valueRedacted']=![]),_0x54a5d3;}export function plannedAppConfig(_0x471fce){const _0x307bfd=a35_0x44ac6d,_0x29b625=_0x471fce[_0x307bfd(0x162)]??!![];return{'appCode':_0x471fce[_0x307bfd(0x16e)],'key':_0x471fce[_0x307bfd(0x165)],'tags':_0x471fce[_0x307bfd(0x13a)]??undefined,'hasValue':_0x29b625,'valueRedacted':_0x29b625};}export function buildMutationData(_0x26382b){const _0x4db621=a35_0x44ac6d;return{'operation':_0x26382b[_0x4db621(0x164)],'selector':{'appCode':_0x26382b[_0x4db621(0x16e)],'key':_0x26382b[_0x4db621(0x165)]},'before':_0x26382b['before'],'after':_0x26382b[_0x4db621(0x173)],'dryRun':_0x26382b[_0x4db621(0x14d)],'warnings':_0x26382b[_0x4db621(0x153)]??[]};}export async function withAppConfigApiBoundary(_0x272408,_0x3d9e89,_0x4404d5){const _0x50fd85=a35_0x44ac6d;try{return await _0x4404d5();}catch{const _0x2f9eeb=['appCode:\x20'+_0x3d9e89[_0x50fd85(0x16e)]];if(_0x3d9e89[_0x50fd85(0x165)])_0x2f9eeb['push'](_0x50fd85(0x170)+_0x3d9e89['key']);_0x2f9eeb[_0x50fd85(0x168)]('value\x20is\x20redacted');throw CliErrors[_0x50fd85(0x13e)](_0x50fd85(0x143)+_0x272408+_0x50fd85(0x14b),_0x2f9eeb[_0x50fd85(0x15a)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x5b36c6,_0x429442){const _0x2c35a9=a35_0x44ac6d;return Object[_0x2c35a9(0x158)](_0x5b36c6,{'method':{'value':_0x429442['method'],'enumerable':![]},'url':{'value':_0x429442[_0x2c35a9(0x140)],'enumerable':![]}});}export function assertSingleValueSource(_0x5d572f){const _0x45539f=a35_0x44ac6d,_0x3847c3=[];_0x5d572f['args'][_0x45539f(0x167)]>0x1&&_0x3847c3[_0x45539f(0x168)]({'kind':_0x45539f(0x13d),'value':_0x5d572f['args']['slice'](0x1)[_0x45539f(0x15a)]('\x20')});const _0x4e877a=_0x5d572f[_0x45539f(0x13c)](_0x45539f(0x145));_0x4e877a!==undefined&&_0x4e877a!==null&&_0x3847c3[_0x45539f(0x168)]({'kind':_0x45539f(0x13d),'value':String(_0x4e877a)});_0x5d572f['bool']('stdin')&&_0x3847c3[_0x45539f(0x168)]({'kind':_0x45539f(0x156)});const _0x35cd88=_0x5d572f['str'](_0x45539f(0x13f))['trim']();_0x35cd88&&_0x3847c3[_0x45539f(0x168)]({'kind':'env','name':_0x35cd88});const _0x2d2898=_0x5d572f['str'](_0x45539f(0x142))['trim']();_0x2d2898&&_0x3847c3[_0x45539f(0x168)]({'kind':_0x45539f(0x142),'path':_0x2d2898});if(_0x3847c3['length']===0x0)throw CliErrors[_0x45539f(0x15e)](_0x45539f(0x15c),_0x45539f(0x13b));if(_0x3847c3[_0x45539f(0x167)]>0x1)throw CliErrors['validation']('App\x20config\x20value\x20source\x20is\x20ambiguous.','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');return _0x3847c3[0x0];}export async function assertValueSourceReadable(_0x1a9340){const _0x617691=a35_0x44ac6d;if(_0x1a9340[_0x617691(0x169)]===_0x617691(0x16b)&&!(_0x1a9340[_0x617691(0x138)]in process.env))throw CliErrors[_0x617691(0x15e)](_0x617691(0x150)+_0x1a9340[_0x617691(0x138)]);if(_0x1a9340[_0x617691(0x169)]==='file')try{await access(_0x1a9340['path']);}catch{throw CliErrors[_0x617691(0x15e)](_0x617691(0x14c)+_0x1a9340[_0x617691(0x15f)]);}}export async function readAppConfigValue(_0x2cce38){const _0x36397a=a35_0x44ac6d,_0xf8347f=assertSingleValueSource(_0x2cce38),_0x18aed6=[];if(_0xf8347f[_0x36397a(0x169)]==='argument')return _0x18aed6[_0x36397a(0x168)](_0x36397a(0x146)),{'value':_0xf8347f[_0x36397a(0x145)]??'','source':_0xf8347f['kind'],'warnings':_0x18aed6};if(_0xf8347f[_0x36397a(0x169)]===_0x36397a(0x156))return{'value':await readStdin(),'source':_0xf8347f[_0x36397a(0x169)],'warnings':_0x18aed6};if(_0xf8347f[_0x36397a(0x169)]===_0x36397a(0x16b)){if(!(_0xf8347f[_0x36397a(0x138)]in process.env))throw CliErrors[_0x36397a(0x15e)](_0x36397a(0x150)+_0xf8347f['name']);return{'value':process.env[_0xf8347f.name]??'','source':_0xf8347f[_0x36397a(0x169)],'warnings':_0x18aed6};}return{'value':await readFile(_0xf8347f[_0x36397a(0x15f)],_0x36397a(0x160)),'source':_0xf8347f['kind'],'warnings':_0x18aed6};}function readStdin(){return new Promise((_0x1ff831,_0x47cde2)=>{const _0x3c61f1=a35_0x7e86;let _0x397d62='';process[_0x3c61f1(0x156)][_0x3c61f1(0x16d)](_0x3c61f1(0x160)),process['stdin']['on'](_0x3c61f1(0x16c),_0x398036=>{_0x397d62+=_0x398036;}),process[_0x3c61f1(0x156)][_0x3c61f1(0x163)](_0x3c61f1(0x171),()=>_0x1ff831(_0x397d62)),process[_0x3c61f1(0x156)][_0x3c61f1(0x163)]('error',_0x47cde2);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a36_0x11d1(_0x39676e,_0x485dc1){_0x39676e=_0x39676e-0x65;const _0x38cd05=a36_0x38cd();let _0x11d137=_0x38cd05[_0x39676e];return _0x11d137;}function a36_0x38cd(){const _0xdc5e63=['logout','write','1847634NWAhmw','92662tWXmJl','13QONykB','240177rQEgBu','!\x20Not\x20logged\x20in','✓\x20Logged\x20out','1871984DGPZZh','9590376fYtqhi','24aQysFE','18nwPGvb','Login\x20via\x20browser','nonInteractive','850000DPTaLU','4913337WgheEv','63DMyKpW','log','yes','14dMDHJi','auth','boolean','5LoIXJC','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately'];a36_0x38cd=function(){return _0xdc5e63;};return a36_0x38cd();}const a36_0x5660a5=a36_0x11d1;(function(_0x46ad1e,_0x3c5a8e){const _0xb5395f=a36_0x11d1,_0x3bff3f=_0x46ad1e();while(!![]){try{const _0x5daa8d=-parseInt(_0xb5395f(0x79))/0x1*(-parseInt(_0xb5395f(0x71))/0x2)+parseInt(_0xb5395f(0x73))/0x3*(-parseInt(_0xb5395f(0x78))/0x4)+parseInt(_0xb5395f(0x6c))/0x5*(parseInt(_0xb5395f(0x70))/0x6)+-parseInt(_0xb5395f(0x69))/0x7*(-parseInt(_0xb5395f(0x76))/0x8)+-parseInt(_0xb5395f(0x66))/0x9*(-parseInt(_0xb5395f(0x7c))/0xa)+-parseInt(_0xb5395f(0x65))/0xb+parseInt(_0xb5395f(0x77))/0xc*(-parseInt(_0xb5395f(0x72))/0xd);if(_0x5daa8d===_0x3c5a8e)break;else _0x3bff3f['push'](_0x3bff3f['shift']());}catch(_0x1c8654){_0x3bff3f['push'](_0x3bff3f['shift']());}}}(a36_0x38cd,0x74dd2));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':'login','description':a36_0x5660a5(0x7a),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a36_0x5660a5(0x68),'type':a36_0x5660a5(0x6b),'description':a36_0x5660a5(0x6d),'default':![]}],async 'execute'(_0x1436c5){const _0x3b169f=a36_0x5660a5,{runAuthServer:_0x30d43e}=await import('../../auth/auth-server-ui.js');return await _0x30d43e({'autoYes':_0x1436c5['bool'](_0x3b169f(0x68)),'nonInteractive':_0x1436c5[_0x3b169f(0x7b)]}),{'ok':!![]};}},{'service':a36_0x5660a5(0x6a),'command':a36_0x5660a5(0x6e),'description':'Clear\x20login\x20session','risk':a36_0x5660a5(0x6f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x24612e){const _0x1fc2c2=a36_0x5660a5;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x1fc2c2(0x67)](_0x1fc2c2(0x75))):console[_0x1fc2c2(0x67)](_0x1fc2c2(0x74)),{'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_0x5efbeb=a37_0x5810;(function(_0x34d66c,_0x32d3e6){const _0x528b24=a37_0x5810,_0x5993ac=_0x34d66c();while(!![]){try{const _0x4d9db0=-parseInt(_0x528b24(0x16b))/0x1+-parseInt(_0x528b24(0x1b2))/0x2*(parseInt(_0x528b24(0x1b7))/0x3)+-parseInt(_0x528b24(0x1cb))/0x4*(-parseInt(_0x528b24(0x1d6))/0x5)+-parseInt(_0x528b24(0x1bc))/0x6*(-parseInt(_0x528b24(0x180))/0x7)+-parseInt(_0x528b24(0x185))/0x8+-parseInt(_0x528b24(0x1bd))/0x9*(-parseInt(_0x528b24(0x1d2))/0xa)+-parseInt(_0x528b24(0x198))/0xb;if(_0x4d9db0===_0x32d3e6)break;else _0x5993ac['push'](_0x5993ac['shift']());}catch(_0x3dfaf6){_0x5993ac['push'](_0x5993ac['shift']());}}}(a37_0x17a0,0x822c9));import{createInterface}from'node:readline';function a37_0x5810(_0xcf48b3,_0x5dd98d){_0xcf48b3=_0xcf48b3-0x162;const _0x17a052=a37_0x17a0();let _0x58102d=_0x17a052[_0xcf48b3];return _0x58102d;}import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a37_0x17a0(){const _0x95e3ff=['function-node','/**\x0a\x20*\x20','create','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','filePath','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','nonInteractive','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','read','datasetId','isInteger','profileName','map','/HOOK/','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','functionNode','7JsopKm','No\x20operation\x20types\x20found\x20for\x20dataset\x20','scriptsRootDir','code','HOOK\x20requires\x20alias/operation/node\x20options.','4698608qmyVUX','\x22\x20not\x20found\x20for\x20dataset\x20','Trigger\x20node\x20(HOOK\x20only)','stdin','name','ENDPOINT','description','Script\x20type','File\x20already\x20exists:\x20','Alias\x20\x22','Available\x20aliases:\x20','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','operationType','Function\x20name\x20(valid\x20JS\x20identifier)','currentApp','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','find','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','3227829OqsQOV','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','Select\x20trigger\x20node:','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','HOOK','operation-type','\x0a\x20*\x20[平台配置]\x20','修改后的请求参数','entries','Select\x20dataset:','length','mergedCli','Created\x20','question','Available:\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无(如有通知或外部调用,说明影响与失败策略)','修改后的响应结果','validation','\x20api\x20pull`\x20to\x20refresh.','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','Invalid\x20function\x20name\x20\x22','type','stderr','write','8mCfYxO','alias','tableName','No\x20datasets\x20found\x20for\x20this\x20app.','keys','407703qWIjtj','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','.js','utf8','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','5941098QbBmpN','7074pBcViq','includes','apiDir','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','source','/ENDPOINT/','defaultApp','Operation\x20type\x20\x22','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','/COMMON/','join','2076qAKUWX','selectedAppName','before','str','Invalid\x20dataset\x20selection.','当前响应结果','datasetCode','11180ybeDlK','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\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','appCode','7115MSCNPm','Select\x20operation\x20type:','.js\x0a','parseInt','string','after','.js\x0a\x20*\x20[触发节点]\x20','trim','当前请求参数','No\x20model\x20aliases\x20found.\x20Run\x20`',']\x20(','649906ONuZnb','\x20function:\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'];a37_0x17a0=function(){return _0x95e3ff;};return a37_0x17a0();}import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a37_0x5efbeb(0x170),'description':a37_0x5efbeb(0x17d),'risk':a37_0x5efbeb(0x176),'flags':[{'name':a37_0x5efbeb(0x1af),'type':a37_0x5efbeb(0x164),'required':!![],'enum':['COMMON',a37_0x5efbeb(0x18a),a37_0x5efbeb(0x19c)],'description':a37_0x5efbeb(0x18c)},{'name':a37_0x5efbeb(0x189),'type':'string','required':!![],'description':a37_0x5efbeb(0x193)},{'name':a37_0x5efbeb(0x18b),'type':a37_0x5efbeb(0x164),'description':'Script\x20description'},{'name':a37_0x5efbeb(0x1b3),'type':a37_0x5efbeb(0x164),'description':a37_0x5efbeb(0x1c8)},{'name':'datasetcode','type':'string','description':a37_0x5efbeb(0x1bb)},{'name':a37_0x5efbeb(0x19d),'type':a37_0x5efbeb(0x164),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a37_0x5efbeb(0x16e),'type':a37_0x5efbeb(0x164),'description':a37_0x5efbeb(0x187),'enum':['before',a37_0x5efbeb(0x165)]}],async 'validate'(_0x315753){const _0x4c4c42=a37_0x5efbeb,_0x5d5144=_0x315753['str'](_0x4c4c42(0x189));if(!isValidBffFunctionName(_0x5d5144))throw CliErrors[_0x4c4c42(0x1a9)](_0x4c4c42(0x1ae)+_0x5d5144+_0x4c4c42(0x1ad));},async 'execute'(_0x3560fd){const _0x254679=a37_0x5efbeb,_0x10b8cf=loadBffProjectConfig(_0x3560fd['appCode']),_0x26bf23=_0x3560fd[_0x254679(0x1ce)](_0x254679(0x1af)),_0x1ebe9e=_0x3560fd[_0x254679(0x1ce)](_0x254679(0x189)),_0xeecc2f=_0x3560fd[_0x254679(0x1ce)]('description')||undefined,_0x481f0f=_0x26bf23==='HOOK'?await resolveHookOptions(_0x10b8cf,_0x3560fd):undefined,_0x140937=buildFilePath(_0x10b8cf,_0x26bf23,_0x1ebe9e,_0x481f0f);if(await fileExists(_0x140937))throw CliErrors[_0x254679(0x1a9)](_0x254679(0x18d)+_0x140937);await mkdir(dirname(_0x140937),{'recursive':!![]});const _0x45d79f=generateTemplate(_0x26bf23,_0x1ebe9e,_0x3560fd[_0x254679(0x1d5)],_0xeecc2f,_0x481f0f);await writeFile(_0x140937,_0x45d79f,_0x254679(0x1ba));const _0x479236={'type':_0x26bf23,'name':_0x1ebe9e,'path':_0x140937};if(_0xeecc2f)_0x479236[_0x254679(0x18b)]=_0xeecc2f;if(_0x481f0f){if(_0x481f0f[_0x254679(0x1b3)])_0x479236[_0x254679(0x1b3)]=_0x481f0f[_0x254679(0x1b3)];_0x479236[_0x254679(0x1d1)]=_0x481f0f['datasetCode'],_0x479236['operationType']=_0x481f0f['operationType'],_0x479236['functionNode']=_0x481f0f[_0x254679(0x17f)];}return{'ok':!![],'data':_0x479236,'message':_0x254679(0x1a4)+_0x26bf23+_0x254679(0x16c)+_0x1ebe9e};}};async function resolveHookOptions(_0xa10995,_0x4e6ed0){const _0x5a1ea2=a37_0x5efbeb,_0x2770b5=resolveApiModelSource(_0x4e6ed0[_0x5a1ea2(0x1bf)],_0x4e6ed0[_0x5a1ea2(0x1d5)],_0x4e6ed0[_0x5a1ea2(0x1cc)]||_0x4e6ed0[_0x5a1ea2(0x1a3)]?.[_0x5a1ea2(0x194)]||_0x4e6ed0[_0x5a1ea2(0x1a3)]?.[_0x5a1ea2(0x1c3)]),_0x57127e=loadAliasMap(_0x4e6ed0[_0x5a1ea2(0x1bf)],undefined,_0x2770b5['filePath'],_0x2770b5[_0x5a1ea2(0x179)]),_0x475293=_0x57127e['length']>0x0;let _0x1077ce,_0x390b55,_0x4dfe01;const _0x58b125=_0x4e6ed0[_0x5a1ea2(0x1ce)](_0x5a1ea2(0x1b3)),_0x29c0d5=_0x4e6ed0['str']('datasetcode');if(_0x58b125){const _0x29424d=resolveAlias(_0x4e6ed0[_0x5a1ea2(0x1bf)],_0x58b125,undefined,_0x2770b5[_0x5a1ea2(0x172)],_0x2770b5[_0x5a1ea2(0x179)]);if(!_0x29424d){const _0x16ffc9=_0x475293?_0x5a1ea2(0x18f)+_0x57127e[_0x5a1ea2(0x17a)](_0xb0f9d9=>_0xb0f9d9['alias'])[_0x5a1ea2(0x1ca)](',\x20'):_0x5a1ea2(0x169)+CLI_BIN_NAME+_0x5a1ea2(0x19b);throw CliErrors['validation'](_0x5a1ea2(0x18e)+_0x58b125+'\x22\x20not\x20found.\x20'+_0x16ffc9);}_0x1077ce=_0x58b125,_0x390b55=_0x29424d;}else{if(_0x29c0d5){_0x390b55=_0x29c0d5;const _0x44e54e=_0x57127e['find'](_0x424db9=>_0x424db9[_0x5a1ea2(0x1d1)]===_0x29c0d5);_0x1077ce=_0x44e54e?.[_0x5a1ea2(0x1b3)];}else{if(_0x4e6ed0[_0x5a1ea2(0x174)])throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x1c0));else{if(_0x475293){const _0x3f0b31=_0x57127e['map'](_0x1622b6=>_0x1622b6[_0x5a1ea2(0x1b3)]+'\x20('+_0x1622b6[_0x5a1ea2(0x1b4)]+')'),_0x1c16eb=await promptSelect(_0x5a1ea2(0x1a1),_0x3f0b31),_0x56d793=_0x57127e[_0x1c16eb];if(!_0x56d793)throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x1cf));_0x1077ce=_0x56d793[_0x5a1ea2(0x1b3)],_0x390b55=_0x56d793[_0x5a1ea2(0x1d1)];}else{const _0x14b29c=await listDatasets(_0x4e6ed0[_0x5a1ea2(0x1d5)]);if(_0x14b29c[_0x5a1ea2(0x1a2)]===0x0)throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x1b5));const _0x18b29d=_0x14b29c['map'](_0x529754=>_0x529754[_0x5a1ea2(0x189)]+'\x20['+(_0x529754[_0x5a1ea2(0x1c1)]??'UNKNOWN')+_0x5a1ea2(0x16a)+_0x529754[_0x5a1ea2(0x183)]+')'),_0x22ea0c=await promptSelect(_0x5a1ea2(0x1a1),_0x18b29d),_0x14c611=_0x14b29c[_0x22ea0c];if(!_0x14c611)throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x1cf));_0x390b55=_0x14c611['code'],_0x1077ce=undefined;}}}}const _0x1da3e4=await listDatasets(_0x4e6ed0[_0x5a1ea2(0x1d5)]),_0x2de748=_0x1da3e4[_0x5a1ea2(0x196)](_0xa1fe93=>_0xa1fe93[_0x5a1ea2(0x183)]===_0x390b55);if(!_0x2de748)throw CliErrors['validation'](_0x5a1ea2(0x1c5)+_0x390b55+'\x22.\x20'+(_0x1077ce?_0x5a1ea2(0x1d3)+CLI_BIN_NAME+_0x5a1ea2(0x1aa):''));_0x4dfe01=_0x2de748['id'];const _0x3a7e1d=_0x1077ce??_0x390b55,_0x2171c5=await listBffDatasetOperations(_0x4e6ed0[_0x5a1ea2(0x1d5)],_0x4dfe01),_0x4f2061=_0x2171c5?Object[_0x5a1ea2(0x1b6)](_0x2171c5):[];if(_0x4f2061[_0x5a1ea2(0x1a2)]===0x0)throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x181)+_0x3a7e1d+'.');let _0x3f6627;const _0x3a11a1=_0x4e6ed0[_0x5a1ea2(0x1ce)]('operation-type');if(_0x3a11a1){if(!_0x4f2061[_0x5a1ea2(0x1be)](_0x3a11a1))throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x1c4)+_0x3a11a1+_0x5a1ea2(0x186)+_0x3a7e1d+'.\x20'+(_0x5a1ea2(0x1a6)+_0x4f2061[_0x5a1ea2(0x1ca)](',\x20')));_0x3f6627=_0x3a11a1;}else{if(_0x4e6ed0['nonInteractive'])throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x197));const _0x37219e=await promptSelect(_0x5a1ea2(0x1d7),_0x4f2061);_0x3f6627=_0x4f2061[_0x37219e]??_0x4f2061[0x0];}let _0x40f2db=normalizeHookFunctionNode(_0x4e6ed0[_0x5a1ea2(0x1ce)]('function-node'));if(!_0x40f2db){if(_0x4e6ed0[_0x5a1ea2(0x1ce)](_0x5a1ea2(0x16e)))throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x171));if(_0x4e6ed0[_0x5a1ea2(0x174)])throw CliErrors[_0x5a1ea2(0x1a9)](_0x5a1ea2(0x1ab));const _0x17a085=await promptSelect(_0x5a1ea2(0x19a),['before',_0x5a1ea2(0x165)]);_0x40f2db=[_0x5a1ea2(0x1cd),'after'][_0x17a085]??_0x5a1ea2(0x1cd);}return{'alias':_0x1077ce,'datasetCode':_0x390b55,'datasetId':_0x4dfe01,'operationType':_0x3f6627,'functionNode':_0x40f2db};}async function promptSelect(_0x4bdd98,_0x39128e){const _0x2ef432=a37_0x5efbeb;if(_0x39128e[_0x2ef432(0x1a2)]===0x1)return 0x0;for(const [_0x45c6f1,_0x5cac1e]of _0x39128e[_0x2ef432(0x1a0)]()){process[_0x2ef432(0x1b0)][_0x2ef432(0x1b1)]('\x20\x20'+(_0x45c6f1+0x1)+'.\x20'+_0x5cac1e+'\x0a');}const _0x542234=createInterface({'input':process[_0x2ef432(0x188)],'output':process['stderr']});while(!![]){const _0x2f1a9a=await new Promise(_0x3b53c9=>{const _0x544a67=_0x2ef432;_0x542234[_0x544a67(0x1a5)](_0x4bdd98+'\x20',_0x3b53c9);}),_0x17d874=Number[_0x2ef432(0x163)](_0x2f1a9a['trim'](),0xa);if(Number[_0x2ef432(0x178)](_0x17d874)&&_0x17d874>=0x1&&_0x17d874<=_0x39128e['length'])return _0x542234['close'](),_0x17d874-0x1;process['stderr'][_0x2ef432(0x1b1)](_0x2ef432(0x195)+_0x39128e[_0x2ef432(0x1a2)]+'.\x0a');}}function buildFilePath(_0x3783e2,_0x3d6c30,_0x9566d9,_0x1a7766){const _0xc77b84=a37_0x5efbeb;if(_0x3d6c30==='HOOK'){if(!_0x1a7766)throw CliErrors[_0xc77b84(0x1a9)](_0xc77b84(0x184));const _0x37597b=_0x1a7766[_0xc77b84(0x1b3)]??_0x1a7766[_0xc77b84(0x1d1)];return join(_0x3783e2[_0xc77b84(0x182)],_0xc77b84(0x19c),_0x37597b,_0x1a7766[_0xc77b84(0x192)],_0x1a7766['functionNode'],_0x9566d9+_0xc77b84(0x1b9));}return join(_0x3783e2[_0xc77b84(0x182)],_0x3d6c30,_0x9566d9+_0xc77b84(0x1b9));}export function generateTemplate(_0x5205c0,_0xb71846,_0x156d62,_0x3baf1d,_0x2012db){const _0x518e7e=a37_0x5efbeb,_0x1c3bd7=_0x3baf1d?.[_0x518e7e(0x167)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0xd30fbd=getAppBaseUrl(_0x156d62),_0x3e7e62=_0x518e7e(0x1a7);if(_0x5205c0==='COMMON')return'/**\x0a\x20*\x20'+_0x1c3bd7+_0x518e7e(0x1c7)+_0xb71846+_0x518e7e(0x19e)+_0xd30fbd+_0x518e7e(0x190)+_0x156d62+_0x518e7e(0x1c9)+_0xb71846+_0x518e7e(0x173)+_0xb71846+'\x22,\x20params\x20})\x0a'+_0x3e7e62+_0x518e7e(0x1c6)+_0xb71846+_0x518e7e(0x17c);if(_0x5205c0==='ENDPOINT')return'/**\x0a\x20*\x20'+_0x1c3bd7+_0x518e7e(0x16d)+_0xb71846+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x156d62+'/'+_0xb71846+'\x0a\x20*\x20[平台配置]\x20'+_0xd30fbd+_0x518e7e(0x190)+_0x156d62+_0x518e7e(0x1c2)+_0xb71846+_0x518e7e(0x162)+_0x3e7e62+_0x518e7e(0x1d4)+_0xb71846+_0x518e7e(0x17c);if(!_0x2012db)throw CliErrors[_0x518e7e(0x1a9)](_0x518e7e(0x175));const _0x3ba1de=_0x2012db['alias']??_0x2012db[_0x518e7e(0x1d1)],_0x5e9385=_0x2012db['functionNode']==='before'?_0x518e7e(0x168):_0x518e7e(0x1d0),_0x5f030f=_0x2012db[_0x518e7e(0x17f)]===_0x518e7e(0x1cd)?_0x518e7e(0x19f):_0x518e7e(0x1a8);return _0x518e7e(0x16f)+_0x1c3bd7+_0x518e7e(0x1b8)+_0xb71846+_0x518e7e(0x1ac)+_0x156d62+'/'+_0x2012db[_0x518e7e(0x1d1)]+'/'+_0x2012db[_0x518e7e(0x192)]+_0x518e7e(0x19e)+_0xd30fbd+'/data/dataset/'+_0x2012db[_0x518e7e(0x177)]+_0x518e7e(0x17e)+_0x156d62+_0x518e7e(0x17b)+_0x3ba1de+'/'+_0x2012db['operationType']+'/'+_0x2012db['functionNode']+'/'+_0xb71846+_0x518e7e(0x166)+_0x2012db[_0x518e7e(0x17f)]+'\x0a'+_0x3e7e62+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x5e9385+_0x518e7e(0x199)+_0x5f030f+_0x518e7e(0x191)+_0xb71846+_0x518e7e(0x17c);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a38_0xd1dc(){const _0x4999dc=['10ctxQIZ','1746157hgNDJB','string','\x20\x20-\x20','1085058uGcHyI','str','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','trashDir','Backend\x20Function\x20lock\x20file\x20not\x20found.','trashedTo','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','Function\x20not\x20found:\x20','2045460iYeMwH','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','8YpvExw','10980603KbixjC','parse','remoteId','join','delete','\x20(local\x20file\x20moved\x20to\x20trash)','appCode','bff','toISOString','POST','startsWith','172182fhtHrW','scriptsRoot','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','1994416pOZoYF','lockFilePath','functions','target','Multiple\x20functions\x20match\x20\x22','Would\x20delete\x20','scriptsRootDir','projectRoot','Lock\x20scope\x20for\x20app\x20\x22','length','keys','includes','apps','lastSync','No\x20lock\x20entry\x20found\x20for\x20\x22','1098717KrRNhY','Local\x20delete\x20not\x20settled\x20for\x20','find','<timestamp>','\x22\x20not\x20found\x20after\x20ensureLockScope.','validation'];a38_0xd1dc=function(){return _0x4999dc;};return a38_0xd1dc();}const a38_0x479abf=a38_0x2e87;(function(_0x19207f,_0xfc42bb){const _0x2c29f3=a38_0x2e87,_0x10026e=_0x19207f();while(!![]){try{const _0x25365d=parseInt(_0x2c29f3(0xcf))/0x1*(-parseInt(_0x2c29f3(0xc3))/0x2)+-parseInt(_0x2c29f3(0xe1))/0x3+-parseInt(_0x2c29f3(0xc1))/0x4+parseInt(_0x2c29f3(0xb4))/0x5*(parseInt(_0x2c29f3(0xb8))/0x6)+parseInt(_0x2c29f3(0xb5))/0x7+parseInt(_0x2c29f3(0xd2))/0x8+parseInt(_0x2c29f3(0xc4))/0x9;if(_0x25365d===_0xfc42bb)break;else _0x10026e['push'](_0x10026e['shift']());}catch(_0x193ca6){_0x10026e['push'](_0x10026e['shift']());}}}(a38_0xd1dc,0x7d87e));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';function a38_0x2e87(_0x4289ae,_0x4be2e3){_0x4289ae=_0x4289ae-0xb4;const _0xd1dc36=a38_0xd1dc();let _0x2e87b2=_0xd1dc36[_0x4289ae];return _0x2e87b2;}export const bffDelete={'service':a38_0x479abf(0xcb),'command':a38_0x479abf(0xc8),'description':a38_0x479abf(0xc2),'risk':'high-risk-write','flags':[{'name':'target','type':a38_0x479abf(0xb6),'required':!![],'description':a38_0x479abf(0xd1)}],async 'validate'(_0x16cabe){const _0x2209f2=a38_0x479abf,_0x29c4c0=loadBffProjectConfig(_0x16cabe[_0x2209f2(0xca)]),_0x4b6298=await readBffLockFile(_0x29c4c0['lockFilePath']);if(!_0x4b6298)throw CliErrors[_0x2209f2(0xe6)](_0x2209f2(0xbf));},async 'dryRun'(_0x4d61df){const _0x48b725=a38_0x479abf,_0x2c3c65=loadBffProjectConfig(_0x4d61df[_0x48b725(0xca)]),_0x365047=await readBffLockFile(_0x2c3c65[_0x48b725(0xd3)]);if(!_0x365047)throw CliErrors['validation']('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {appLock:_0x24988b}=ensureLockScope(_0x365047,_0x4d61df[_0x48b725(0xca)],_0x2c3c65[_0x48b725(0xd0)],'delete'),_0x1d8c2e=_0x4d61df[_0x48b725(0xb9)](_0x48b725(0xd5)),_0x3d5706=Object[_0x48b725(0xdc)](_0x24988b[_0x48b725(0xd4)]),_0x28aaa9=resolveDeleteTarget(_0x1d8c2e,_0x3d5706),_0x105049=_0x24988b['functions'][_0x28aaa9];if(!_0x105049)throw CliErrors[_0x48b725(0xe6)](_0x48b725(0xe0)+_0x28aaa9+'\x22.');const _0x1f5345=resolveLocalFilePathFromLockKey(_0x2c3c65,_0x28aaa9),_0x4618f1=relative(_0x2c3c65['projectRoot'],_0x1f5345),_0x27eb99=join(_0x2c3c65['trashDir'],_0x48b725(0xe4),_0x4618f1);return{'method':_0x48b725(0xcd),'url':'/api/management/library/scripts/delete','body':{'appCode':_0x4d61df[_0x48b725(0xca)],'target':_0x28aaa9,'remoteId':_0x105049[_0x48b725(0xc6)],'localFilePath':_0x1f5345,'trashedPath':_0x27eb99},'description':_0x48b725(0xd7)+_0x28aaa9+_0x48b725(0xba)};},async 'execute'(_0x17d5ba){const _0x44e470=a38_0x479abf,_0x436be8=loadBffProjectConfig(_0x17d5ba[_0x44e470(0xca)]),_0x21f61e=await readBffLockFile(_0x436be8[_0x44e470(0xd3)]);if(!_0x21f61e)throw CliErrors[_0x44e470(0xe6)](_0x44e470(0xbd));const {lockData:_0x3085d6,appLock:_0x460343}=ensureLockScope(_0x21f61e,_0x17d5ba[_0x44e470(0xca)],_0x436be8['scriptsRoot'],'delete'),_0x41b319=JSON[_0x44e470(0xc5)](JSON['stringify'](_0x3085d6)),_0x578837=_0x41b319[_0x44e470(0xde)][_0x17d5ba[_0x44e470(0xca)]];if(!_0x578837)throw new Error(_0x44e470(0xda)+_0x17d5ba[_0x44e470(0xca)]+_0x44e470(0xe5));const _0x12f15c=_0x17d5ba[_0x44e470(0xb9)](_0x44e470(0xd5)),_0x21e027=Object[_0x44e470(0xdc)](_0x578837['functions']),_0x1f33e8=resolveDeleteTarget(_0x12f15c,_0x21e027),_0x4082a9=_0x578837[_0x44e470(0xd4)][_0x1f33e8];if(!_0x4082a9)throw CliErrors['validation'](_0x44e470(0xe0)+_0x1f33e8+'\x22.');await deleteBffScript(_0x4082a9[_0x44e470(0xc6)]),delete _0x578837['functions'][_0x1f33e8],_0x578837[_0x44e470(0xdf)]=new Date()[_0x44e470(0xcc)](),await writeBffLockFile(_0x436be8['lockFilePath'],_0x41b319);const _0x4f61ff=resolveLocalFilePathFromLockKey(_0x436be8,_0x1f33e8);let _0xf5919e;await fileExists(_0x4f61ff)&&(_0xf5919e=await moveToTrash(_0x436be8[_0x44e470(0xd9)],_0x436be8[_0x44e470(0xbc)],_0x4f61ff),await cleanupEmptyDirectories(dirname(_0x4f61ff),_0x436be8[_0x44e470(0xd8)]));await waitForDeleteSettlement(_0x436be8['lockFilePath'],_0x17d5ba[_0x44e470(0xca)],_0x1f33e8,_0x4f61ff),await sleep(0x96);const _0x4c4724={'deleted':_0x1f33e8,'remoteId':_0x4082a9['remoteId']};if(_0xf5919e)_0x4c4724[_0x44e470(0xbe)]=_0xf5919e;return{'ok':!![],'data':_0x4c4724,'message':'Deleted\x20'+_0x1f33e8+(_0xf5919e?_0x44e470(0xc9):'')};}};function resolveDeleteTarget(_0x74e499,_0x19cda8){const _0x22020c=a38_0x479abf;if(_0x74e499[_0x22020c(0xdd)]('/')){const _0x4c9a07=_0x19cda8[_0x22020c(0xe3)](_0xf47353=>_0xf47353===_0x74e499);if(!_0x4c9a07)throw CliErrors[_0x22020c(0xe6)]('Function\x20not\x20found:\x20'+_0x74e499);return _0x4c9a07;}const _0x786012=_0x19cda8['filter'](_0x523801=>_0x523801['split']('/')['at'](-0x1)===_0x74e499);if(_0x786012[_0x22020c(0xdb)]===0x0)throw CliErrors['validation'](_0x22020c(0xc0)+_0x74e499);if(_0x786012[_0x22020c(0xdb)]>0x1)throw CliErrors[_0x22020c(0xe6)](_0x22020c(0xd6)+_0x74e499+_0x22020c(0xbb)+_0x786012['map'](_0x22a084=>_0x22020c(0xb7)+_0x22a084)[_0x22020c(0xc7)]('\x0a'));return _0x786012[0x0];}async function moveToTrash(_0xab3b84,_0x5ffb57,_0x39b079){const _0x2b2423=a38_0x479abf,_0x274e2e=new Date()[_0x2b2423(0xcc)]()['replace'](/[:.]/g,'-'),_0x1fc875=relative(_0xab3b84,_0x39b079),_0x148150=join(_0x5ffb57,_0x274e2e,_0x1fc875);return await mkdir(dirname(_0x148150),{'recursive':!![]}),await rename(_0x39b079,_0x148150),_0x148150;}async function cleanupEmptyDirectories(_0x43db08,_0x1b3c43){const _0x3ffb55=a38_0x479abf;let _0xb2ebe9=resolve(_0x43db08);const _0x112e09=resolve(_0x1b3c43);while(_0xb2ebe9[_0x3ffb55(0xce)](''+_0x112e09+sep)||_0xb2ebe9===_0x112e09){if(_0xb2ebe9===_0x112e09)return;try{const _0x1f6244=await readdir(_0xb2ebe9);if(_0x1f6244['length']>0x0)return;await rmdir(_0xb2ebe9);}catch{return;}_0xb2ebe9=dirname(_0xb2ebe9);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x3572ad,_0x15d6c1,_0x5c0c68,_0x366b1d){const _0xe9fe0d=a38_0x479abf;for(let _0x5ea1ca=0x0;_0x5ea1ca<DELETE_SETTLE_RETRY_COUNT;_0x5ea1ca+=0x1){const _0x505cb8=await readBffLockFile(_0x3572ad),_0x34d49d=!!_0x505cb8?.[_0xe9fe0d(0xde)]?.[_0x15d6c1]?.[_0xe9fe0d(0xd4)]?.[_0x5c0c68],_0x185a18=await fileExists(_0x366b1d);if(!_0x34d49d&&!_0x185a18)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0xe9fe0d(0xe2)+_0x5c0c68+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a39_0x1b35(){const _0x1c05c7=['detail','Script\x20ID','description','7QXMHGy','(none)','12124090eBfIQU','36788EHHkSB','5769110YwXUJb','233475WRrFpf','15vDTvXX','Return\x20full\x20raw\x20script\x20object','4XfUTpJ','num','1317786BdilhI','bff','3510872LIFgyS','1885563fHZUAX','number','159rvqZRv','verbose','appCode','createdTime','bool','updatedTime','functionName','scriptType','read'];a39_0x1b35=function(){return _0x1c05c7;};return a39_0x1b35();}const a39_0x20a314=a39_0x4eea;(function(_0x5dd836,_0x28f6b5){const _0x50d8a8=a39_0x4eea,_0x32c5a0=_0x5dd836();while(!![]){try{const _0x1f5168=-parseInt(_0x50d8a8(0x15e))/0x1*(-parseInt(_0x50d8a8(0x161))/0x2)+parseInt(_0x50d8a8(0x168))/0x3*(-parseInt(_0x50d8a8(0x15c))/0x4)+parseInt(_0x50d8a8(0x15f))/0x5*(parseInt(_0x50d8a8(0x163))/0x6)+parseInt(_0x50d8a8(0x159))/0x7*(parseInt(_0x50d8a8(0x165))/0x8)+-parseInt(_0x50d8a8(0x166))/0x9+parseInt(_0x50d8a8(0x15d))/0xa+-parseInt(_0x50d8a8(0x15b))/0xb;if(_0x1f5168===_0x28f6b5)break;else _0x32c5a0['push'](_0x32c5a0['shift']());}catch(_0x2cedad){_0x32c5a0['push'](_0x32c5a0['shift']());}}}(a39_0x1b35,0x539cb));import{getBffScriptInfo}from'../../core/api-client.js';function a39_0x4eea(_0x358e0f,_0x43b805){_0x358e0f=_0x358e0f-0x153;const _0x1b3585=a39_0x1b35();let _0x4eea94=_0x1b3585[_0x358e0f];return _0x4eea94;}export const bffDetail={'service':a39_0x20a314(0x164),'command':a39_0x20a314(0x156),'description':'Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','risk':a39_0x20a314(0x155),'flags':[{'name':'id','type':a39_0x20a314(0x167),'required':!![],'description':a39_0x20a314(0x157)},{'name':a39_0x20a314(0x169),'type':'boolean','description':a39_0x20a314(0x160)}],async 'execute'(_0x4d1521){const _0x52c7cd=a39_0x20a314,_0x289417=await getBffScriptInfo(_0x4d1521[_0x52c7cd(0x162)]('id')),_0x2b9b6e=_0x4d1521[_0x52c7cd(0x16c)](_0x52c7cd(0x169));if(_0x2b9b6e)return{'ok':!![],'data':_0x289417};return{'ok':!![],'data':{'id':_0x289417['id'],'functionName':_0x289417[_0x52c7cd(0x153)]??'','version':_0x289417['version']??'','updateUserName':_0x289417['updateUserName']??'','appCode':_0x289417[_0x52c7cd(0x16a)],'scriptType':_0x289417[_0x52c7cd(0x154)],'description':_0x289417[_0x52c7cd(0x158)]||_0x52c7cd(0x15a),'createdTime':_0x289417[_0x52c7cd(0x16b)]??'','updatedTime':_0x289417[_0x52c7cd(0x16d)]??'','scriptContent':_0x289417['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x256477,_0x2b14d7){const _0x54093c=a40_0x1d0c,_0x5dec06=_0x256477();while(!![]){try{const _0x4cf997=-parseInt(_0x54093c(0x88))/0x1*(-parseInt(_0x54093c(0x86))/0x2)+-parseInt(_0x54093c(0x89))/0x3*(-parseInt(_0x54093c(0x8b))/0x4)+parseInt(_0x54093c(0x85))/0x5+-parseInt(_0x54093c(0x8d))/0x6+-parseInt(_0x54093c(0x8a))/0x7*(parseInt(_0x54093c(0x8c))/0x8)+parseInt(_0x54093c(0x87))/0x9+-parseInt(_0x54093c(0x8f))/0xa*(-parseInt(_0x54093c(0x8e))/0xb);if(_0x4cf997===_0x2b14d7)break;else _0x5dec06['push'](_0x5dec06['shift']());}catch(_0x41775f){_0x5dec06['push'](_0x5dec06['shift']());}}}(a40_0x345c,0x6bdf4));function a40_0x1d0c(_0x391b35,_0x1b4906){_0x391b35=_0x391b35-0x85;const _0x345c3b=a40_0x345c();let _0x1d0c41=_0x345c3b[_0x391b35];return _0x1d0c41;}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';function a40_0x345c(){const _0x2313e8=['120526uADiRB','254516ngAcff','72FOKLur','3710982dgPiLf','99RBAtOX','45780tSNOuo','30545HYXMuw','550196RgJTLY','4987503mcUdcb','2iAPDTv','3cXMtOC'];a40_0x345c=function(){return _0x2313e8;};return a40_0x345c();}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_0x5334dc=a41_0x552e;function a41_0x552e(_0x30aa75,_0x1f6b4b){_0x30aa75=_0x30aa75-0x126;const _0x4c94c9=a41_0x4c94();let _0x552e7e=_0x4c94c9[_0x30aa75];return _0x552e7e;}function a41_0x4c94(){const _0xcbf4dd=['string','119iNrtaV','list','1480644oNPuNF','160DrBLZg','440638EKpkAK','452968jYmNgU','ENDPOINT','description','read','bff','List\x20Backend\x20Function\x20scripts','576MClQVZ','2596980YsOdPp','verbose','308jyJCCK','scriptType','13437CedAiC','50157JDVXoq','appCode','No\x20Backend\x20Function\x20scripts\x20found.','functionName','1970QhJAic','length','bool','Filter\x20by\x20script\x20name','(unnamed)','type','COMMON','5335WdDKle','Script\x20type\x20filter'];a41_0x4c94=function(){return _0xcbf4dd;};return a41_0x4c94();}(function(_0x2d751a,_0x284697){const _0x24eb86=a41_0x552e,_0x3d101d=_0x2d751a();while(!![]){try{const _0x3cf371=-parseInt(_0x24eb86(0x137))/0x1*(parseInt(_0x24eb86(0x12a))/0x2)+parseInt(_0x24eb86(0x129))/0x3+parseInt(_0x24eb86(0x135))/0x4*(-parseInt(_0x24eb86(0x143))/0x5)+-parseInt(_0x24eb86(0x133))/0x6+parseInt(_0x24eb86(0x127))/0x7*(parseInt(_0x24eb86(0x12c))/0x8)+parseInt(_0x24eb86(0x138))/0x9*(-parseInt(_0x24eb86(0x13c))/0xa)+-parseInt(_0x24eb86(0x12b))/0xb*(-parseInt(_0x24eb86(0x132))/0xc);if(_0x3cf371===_0x284697)break;else _0x3d101d['push'](_0x3d101d['shift']());}catch(_0x1ec505){_0x3d101d['push'](_0x3d101d['shift']());}}}(a41_0x4c94,0xa8b73));import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a41_0x5334dc(0x130),'command':a41_0x5334dc(0x128),'description':a41_0x5334dc(0x131),'risk':a41_0x5334dc(0x12f),'flags':[{'name':a41_0x5334dc(0x141),'type':a41_0x5334dc(0x126),'description':a41_0x5334dc(0x144),'default':a41_0x5334dc(0x12d),'enum':[a41_0x5334dc(0x12d),a41_0x5334dc(0x142)]},{'name':'name','type':a41_0x5334dc(0x126),'description':a41_0x5334dc(0x13f)},{'name':a41_0x5334dc(0x134),'type':'boolean','description':'Return\x20full\x20script\x20objects'}],async 'execute'(_0x485d3e){const _0x324e74=a41_0x5334dc,_0x452468=await listBffScripts(_0x485d3e[_0x324e74(0x139)],_0x485d3e['str']('type'),{'scriptName':_0x485d3e['str']('name')||undefined}),_0x4262fc=_0x485d3e[_0x324e74(0x13e)]('verbose');return{'ok':!![],'data':_0x4262fc?_0x452468:_0x452468['map'](_0x23baea=>({'id':_0x23baea['id'],'functionName':_0x23baea[_0x324e74(0x13b)]??'','description':_0x23baea[_0x324e74(0x12e)]||_0x324e74(0x140),'scriptType':_0x23baea[_0x324e74(0x136)]})),'message':_0x452468[_0x324e74(0x13d)]===0x0?_0x324e74(0x13a):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a42_0x4a33f6=a42_0x9808;function a42_0x1c9d(){const _0x1687e1=['117586mvGbab','11PFqUme','\x20Backend\x20Function\x20log\x20line(s).','DEBUG','423380yyGgrE','keyword','string','isSafeInteger','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','bff','since','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','read','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','end-time','num','1699176peTCCI','number','ERROR','str','toUpperCase','flag','132mEFDPB','length','4797018VqcVLY','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','1901652sQZPym','--since','7LPGiYT','6537640SxePYi','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','level','--start-time','limit','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','validation','65595YoTRxX','now','1KRvcVF','Filter\x20by\x20log\x20level','trim'];a42_0x1c9d=function(){return _0x1687e1;};return a42_0x1c9d();}(function(_0x355e78,_0x1362bf){const _0x3fca12=a42_0x9808,_0x1557aa=_0x355e78();while(!![]){try{const _0x16d724=-parseInt(_0x3fca12(0x1a1))/0x1*(parseInt(_0x3fca12(0x1a4))/0x2)+-parseInt(_0x3fca12(0x195))/0x3+parseInt(_0x3fca12(0x190))/0x4*(-parseInt(_0x3fca12(0x19f))/0x5)+parseInt(_0x3fca12(0x18a))/0x6+parseInt(_0x3fca12(0x197))/0x7*(parseInt(_0x3fca12(0x198))/0x8)+parseInt(_0x3fca12(0x192))/0x9+parseInt(_0x3fca12(0x1a8))/0xa*(parseInt(_0x3fca12(0x1a5))/0xb);if(_0x16d724===_0x1362bf)break;else _0x1557aa['push'](_0x1557aa['shift']());}catch(_0xa7c3c4){_0x1557aa['push'](_0x1557aa['shift']());}}}(a42_0x1c9d,0x864f9));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a42_0x9808(_0x2ca341,_0x5846d0){_0x2ca341=_0x2ca341-0x183;const _0x1c9d55=a42_0x1c9d();let _0x980857=_0x1c9d55[_0x2ca341];return _0x980857;}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_0x4a33f6(0x1a7),'INFO','WARN',a42_0x4a33f6(0x18c)];export function resolveBffLogQuery(_0x36502a,_0x52bafd=Date[a42_0x4a33f6(0x1a0)]()){const _0x53c91d=a42_0x4a33f6,_0x2ded0a=_0x36502a[_0x53c91d(0x18f)](_0x53c91d(0x183)),_0x4f1d7f=_0x36502a[_0x53c91d(0x18f)]('start-time'),_0x47b221=_0x36502a['flag'](_0x53c91d(0x188));if(_0x2ded0a!==undefined&&_0x4f1d7f!==undefined)throw CliErrors[_0x53c91d(0x19e)](_0x53c91d(0x199));const _0x1e5df0=_0x47b221===undefined?_0x52bafd:readPositiveInteger(_0x36502a[_0x53c91d(0x189)](_0x53c91d(0x188)),'--end-time'),_0x54a802=_0x4f1d7f===undefined?_0x1e5df0-readSinceMinutes(_0x36502a)*0xea60:readPositiveInteger(_0x36502a[_0x53c91d(0x189)]('start-time'),_0x53c91d(0x19b));if(_0x54a802<=0x0)throw CliErrors['validation'](_0x53c91d(0x194));if(_0x54a802>_0x1e5df0)throw CliErrors[_0x53c91d(0x19e)](_0x53c91d(0x184));const _0x546f84=readPositiveInteger(_0x36502a[_0x53c91d(0x189)](_0x53c91d(0x19c),DEFAULT_LIMIT),'--limit');if(_0x546f84>MAX_LIMIT)throw CliErrors['validation']('--limit\x20must\x20be\x20between\x201\x20and\x20'+MAX_LIMIT+'.');const _0xd301cd=_0x36502a['str'](_0x53c91d(0x19a))[_0x53c91d(0x1a3)]()[_0x53c91d(0x18e)]()||undefined,_0x2e93d3=_0x36502a[_0x53c91d(0x18d)](_0x53c91d(0x1a9))[_0x53c91d(0x1a3)]()||undefined;return{'appCode':_0x36502a['appCode'],'startTime':_0x54a802,'endTime':_0x1e5df0,..._0x4f1d7f===undefined?{'sinceMinutes':readSinceMinutes(_0x36502a)}:{},..._0xd301cd?{'level':_0xd301cd}:{},..._0x2e93d3?{'keyword':_0x2e93d3}:{},'limit':_0x546f84};}function readSinceMinutes(_0x4cc15e){const _0x294021=a42_0x4a33f6;return readPositiveInteger(_0x4cc15e['num'](_0x294021(0x183),DEFAULT_SINCE_MINUTES),_0x294021(0x196));}function readPositiveInteger(_0x57f711,_0x5cc425){const _0xe54c28=a42_0x4a33f6;if(!Number[_0xe54c28(0x1ab)](_0x57f711)||_0x57f711<=0x0)throw CliErrors[_0xe54c28(0x19e)](_0x5cc425+'\x20must\x20be\x20a\x20positive\x20integer.');return _0x57f711;}export const bffLogs={'service':a42_0x4a33f6(0x1ad),'command':'logs','description':a42_0x4a33f6(0x187),'risk':a42_0x4a33f6(0x186),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a42_0x4a33f6(0x183),'type':a42_0x4a33f6(0x18b),'description':'Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20'+DEFAULT_SINCE_MINUTES+')'},{'name':'start-time','type':a42_0x4a33f6(0x18b),'description':a42_0x4a33f6(0x19d)},{'name':a42_0x4a33f6(0x188),'type':'number','description':a42_0x4a33f6(0x185)},{'name':a42_0x4a33f6(0x19a),'type':a42_0x4a33f6(0x1aa),'description':a42_0x4a33f6(0x1a2),'enum':LOG_LEVELS},{'name':'keyword','type':'string','description':a42_0x4a33f6(0x1ac)},{'name':a42_0x4a33f6(0x19c),'type':a42_0x4a33f6(0x18b),'description':'Maximum\x20log\x20lines\x20to\x20return\x20(1-'+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x48a73e){resolveBffLogQuery(_0x48a73e);},async 'execute'(_0x7318de){const _0x5c5b2b=a42_0x4a33f6,_0x389b2c=resolveBffLogQuery(_0x7318de),{sinceMinutes:_0x1640b0,..._0x4c0051}=_0x389b2c,_0x141551=await searchBffScriptLogs(_0x4c0051);return{'ok':!![],'data':{'query':_0x389b2c,'count':_0x141551['length'],'logs':_0x141551},'message':_0x141551[_0x5c5b2b(0x191)]===0x0?_0x5c5b2b(0x193):'Found\x20'+_0x141551[_0x5c5b2b(0x191)]+_0x5c5b2b(0x1a6)};}};
|
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
|
+
function a43_0x3979(){const _0x4584c9=['Cannot\x20migrate\x20HOOK\x20directories\x20\x22','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','operationType','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','remoteId','would_pull','split','\x22\x20and\x20\x22','stderr','projectedFunctions','HOOK','scriptsRoot','close','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','entry','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Would\x20inspect\x20','\x22:\x20','appCode','message','has','includes','get','/api/management/library/scripts/list?appCode=','functionNode','str','8NSBxbn','existed','1040440bHTwuI','.js','all','code','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.','flatMap','Pull\x20complete:\x20','migrations','filePath','toLowerCase','oldLockKey','apps','stringify','scriptsRootDir','reverse','utf8','ino','pull','length','\x20pulled','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','scriptType','normalize','sourceFilePathByNewLockKey','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','mode','1657020igmhBI','Remote\x20script\x20missing\x20id.','2yBQfHE','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','validation','hookLocation','50BpCqLa','mergedCli','12648361nOBdSA','require','functions','move','stdin','GET','newDirectory','lockFilePath','push','BFF_LOCAL_UNSYNCED','some','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','newLockKey','sourceDirectoryPathByNewDirectory','\x20resolution','22536JxSStC','alias','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','set','nonInteractive','12sZfSra','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','lockKey','functionName','newDirectoryPath','values','\x20--format\x20compress','NFC','110919WJkeJt','oldDirectory','currentApp','ENDPOINT','\x22\x20from\x20the\x20lock\x20file.','&type=','rollback','\x20skipped','defaultApp','dev','ENOENT','21nnlOey','\x22\x20not\x20found\x20after\x20ensureLockScope.','push_local','map','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','scriptContent','force','\x22\x20to\x20\x22','\x20--name\x20','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','Lock\x20scope\x20for\x20app\x20\x22','requires','type','trim','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','datasetCode','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','entries','hash','Force\x20overwrite\x20local\x20unsynced\x20changes','cancelled','lastSync','rekey','\x20bff\x20push\x20--type\x20','conflict','947984jdeJls','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','filter','bff','join','yes','Failed\x20to\x20write\x20local\x20script\x20\x22','keyChanges','bool','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','oldDirectoryPath','unresolvable\x20target\x20path','selectedAppName','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','\x20conflict','case-rename','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','282274bEunZQ','delete','read','string','skipped','version','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','content'];a43_0x3979=function(){return _0x4584c9;};return a43_0x3979();}const a43_0x133205=a43_0x1b2f;(function(_0x50e4e1,_0x4acf41){const _0xdb9587=a43_0x1b2f,_0x12ef98=_0x50e4e1();while(!![]){try{const _0x3b6c1b=parseInt(_0xdb9587(0x17b))/0x1*(parseInt(_0xdb9587(0x138))/0x2)+-parseInt(_0xdb9587(0x19d))/0x3*(parseInt(_0xdb9587(0x15d))/0x4)+-parseInt(_0xdb9587(0x15f))/0x5+parseInt(_0xdb9587(0x179))/0x6*(-parseInt(_0xdb9587(0x1a8))/0x7)+parseInt(_0xdb9587(0x127))/0x8+-parseInt(_0xdb9587(0x190))/0x9*(parseInt(_0xdb9587(0x17f))/0xa)+-parseInt(_0xdb9587(0x181))/0xb*(-parseInt(_0xdb9587(0x195))/0xc);if(_0x3b6c1b===_0x4acf41)break;else _0x12ef98['push'](_0x12ef98['shift']());}catch(_0x497feb){_0x12ef98['push'](_0x12ef98['shift']());}}}(a43_0x3979,0x68627));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_0x133205(0x12a),'command':a43_0x133205(0x170),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':a43_0x133205(0x13a),'structuredErrors':!![],'flags':[{'name':a43_0x133205(0x1b4),'type':a43_0x133205(0x13b),'description':'Pull\x20only\x20this\x20script\x20type','enum':['COMMON',a43_0x133205(0x1a0),'HOOK']},{'name':a43_0x133205(0x1ae),'type':'boolean','description':a43_0x133205(0x121)}],async 'dryRun'(_0x33474c){const _0x5215bd=a43_0x133205,_0xfd69d2=loadBffProjectConfig(_0x33474c['appCode']),_0x474641=await readBffLockFile(_0xfd69d2[_0x5215bd(0x188)]),{appLock:_0x383709}=ensureLockScope(_0x474641??createEmptyBffLock(),_0x33474c[_0x5215bd(0x155)],_0xfd69d2[_0x5215bd(0x14d)],_0x5215bd(0x170)),_0x1d99ea=normalizeBffType(_0x33474c[_0x5215bd(0x15c)](_0x5215bd(0x1b4)))??undefined,[_0x15d9cc,_0x55e712]=await Promise[_0x5215bd(0x161)]([listBffScripts(_0x33474c[_0x5215bd(0x155)],_0x1d99ea),getBffScriptStatistics(_0x33474c[_0x5215bd(0x155)])]),_0x3e06b5=_0x15d9cc[_0x5215bd(0x18b)](_0x220ed6=>normalizeBffType(_0x220ed6[_0x5215bd(0x174)])===_0x5215bd(0x14c)),_0x1cd19b=_0x3e06b5?buildDatasetCodeToAliasMap(_0x33474c['apiDir'],_0x33474c[_0x5215bd(0x155)],_0x33474c[_0x5215bd(0x133)]||_0x33474c[_0x5215bd(0x180)]?.[_0x5215bd(0x19f)]||_0x33474c[_0x5215bd(0x180)]?.['defaultApp']):new Map(),_0x3e4243=_0x3e06b5?await planHookDirectoryMigration(_0xfd69d2,_0x383709,_0x1cd19b,await scanLocalBffFunctions(_0xfd69d2,_0x5215bd(0x14c))):undefined,_0x17b14f=createHookLocationMap(_0x55e712),_0xd277ee=[];for(const _0x144159 of _0x15d9cc){const _0x53fdad=resolveRemoteScriptTarget(_0xfd69d2,_0x144159,_0x17b14f,_0x3e4243?.[_0x5215bd(0x14b)]??_0x383709[_0x5215bd(0x183)],_0x1cd19b);if(!_0x53fdad){_0xd277ee[_0x5215bd(0x189)]({'scriptType':_0x144159['scriptType'],'functionName':_0x144159['functionName']??'','status':_0x5215bd(0x13c),'reason':_0x5215bd(0x132)});continue;}const _0x2e2cbf=(_0x3e4243?.['projectedFunctions']??_0x383709['functions'])[_0x53fdad['lockKey']],_0x3a31e6=_0x144159[_0x5215bd(0x1ad)]!=null?computeContentHash(_0x144159[_0x5215bd(0x1ad)]):undefined,_0x1c75ba=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x3e4243,_0x53fdad)??_0x53fdad[_0x5215bd(0x167)],_0x2e2cbf,_0x3a31e6),_0xb9451c=_0x1c75ba?localUnsyncedConflict(_0x53fdad,_0x144159['id']):undefined;_0xd277ee['push']({'lockKey':_0x53fdad[_0x5215bd(0x197)],'filePath':_0x53fdad[_0x5215bd(0x167)],'remoteId':_0x144159['id']??null,'status':_0xb9451c?_0x5215bd(0x126):_0x5215bd(0x147),..._0xb9451c?{'conflict':_0xb9451c}:{},..._0x53fdad[_0x5215bd(0x17e)]?{'alias':_0x53fdad[_0x5215bd(0x17e)]['alias']??null,'datasetCode':_0x53fdad[_0x5215bd(0x17e)][_0x5215bd(0x1b7)],'operationType':_0x53fdad['hookLocation'][_0x5215bd(0x144)],'functionNode':_0x53fdad['hookLocation'][_0x5215bd(0x15b)]}:{}});}return{'method':_0x5215bd(0x186),'url':_0x5215bd(0x15a)+_0x33474c[_0x5215bd(0x155)]+(_0x1d99ea?_0x5215bd(0x1a2)+_0x1d99ea:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x33474c[_0x5215bd(0x155)],'filterType':_0x1d99ea??null,..._0x3e4243&&_0x3e4243['migrations'][_0x5215bd(0x171)]>0x0?{'hookDirectoryMigrations':_0x3e4243[_0x5215bd(0x166)][_0x5215bd(0x1ab)](_0x1cff12=>({'from':_0x1cff12[_0x5215bd(0x19e)],'to':_0x1cff12[_0x5215bd(0x187)]}))}:{},'files':_0xd277ee},'description':_0x5215bd(0x153)+_0xd277ee['length']+_0x5215bd(0x18c)};},async 'execute'(_0x5476c8){const _0x5bd581=a43_0x133205,_0x37c362=loadBffProjectConfig(_0x5476c8[_0x5bd581(0x155)]),_0x5aaaa5=await readBffLockFile(_0x37c362[_0x5bd581(0x188)]),{lockData:_0x4d19d2,appLock:_0x4497e1}=ensureLockScope(_0x5aaaa5??createEmptyBffLock(),_0x5476c8['appCode'],_0x37c362[_0x5bd581(0x14d)],_0x5bd581(0x170)),_0x20316b=normalizeBffType(_0x5476c8['str'](_0x5bd581(0x1b4)))??undefined;if(_0x5476c8[_0x5bd581(0x15c)]('type')&&!_0x20316b)throw CliErrors['validation'](_0x5bd581(0x196));const [_0x507515,_0x523b12]=await Promise[_0x5bd581(0x161)]([listBffScripts(_0x5476c8[_0x5bd581(0x155)],_0x20316b),getBffScriptStatistics(_0x5476c8[_0x5bd581(0x155)])]);if(_0x507515[_0x5bd581(0x171)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x5bd581(0x128)};const _0x52219c=_0x5476c8[_0x5bd581(0x12f)](_0x5bd581(0x1ae));if(_0x52219c&&!_0x5476c8[_0x5bd581(0x194)]){const _0x10a7ee=await confirmForce();if(!_0x10a7ee)throw CliErrors[_0x5bd581(0x122)]('Force\x20pull\x20cancelled.');}if(_0x52219c&&_0x5476c8[_0x5bd581(0x194)]){}const _0x35cd2d=_0x507515['some'](_0x56dd88=>normalizeBffType(_0x56dd88[_0x5bd581(0x174)])==='HOOK'),_0x59d1c5=_0x35cd2d?buildDatasetCodeToAliasMap(_0x5476c8['apiDir'],_0x5476c8[_0x5bd581(0x155)],_0x5476c8['selectedAppName']||_0x5476c8[_0x5bd581(0x180)]?.[_0x5bd581(0x19f)]||_0x5476c8[_0x5bd581(0x180)]?.[_0x5bd581(0x1a5)]):new Map(),_0x6b025b=createHookLocationMap(_0x523b12),_0x16a1d1=JSON['parse'](JSON[_0x5bd581(0x16b)](_0x4d19d2)),_0x568fd1=_0x5476c8[_0x5bd581(0x155)],_0xd70e62=_0x16a1d1[_0x5bd581(0x16a)][_0x568fd1];if(!_0xd70e62)throw new Error(_0x5bd581(0x1b2)+_0x568fd1+_0x5bd581(0x1a9));const _0x4cf65b=_0x35cd2d?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x37c362,_0xd70e62,_0x59d1c5,await scanLocalBffFunctions(_0x37c362,_0x5bd581(0x14c))),_0xd70e62):undefined,_0x565373=createPullFileTransaction(),_0x3b4049=[],_0x16ee71=[],_0x2e1399=[],_0x2e5f1e=[];for(const _0x2b9475 of _0x507515){const _0x162cca=resolveRemoteScriptTarget(_0x37c362,_0x2b9475,_0x6b025b,_0xd70e62[_0x5bd581(0x183)],_0x59d1c5);if(!_0x162cca){_0x16ee71[_0x5bd581(0x189)]({'lockKey':_0x2b9475['scriptType']+'/'+_0x2b9475[_0x5bd581(0x198)],'reason':_0x5bd581(0x132)});continue;}const _0x3cbc04=_0xd70e62[_0x5bd581(0x183)][_0x162cca[_0x5bd581(0x197)]];try{if(!_0x2b9475['id'])throw new Error(_0x5bd581(0x17a));if(_0x2b9475[_0x5bd581(0x1ad)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x349efd=_0x2b9475[_0x5bd581(0x1ad)],_0x49bf7c=computeContentHash(_0x349efd);if(!_0x52219c){const _0x4a3fc8=await hasUnsyncedLocalChanges(_0x162cca[_0x5bd581(0x167)],_0x3cbc04,_0x49bf7c);if(_0x4a3fc8){_0x2e1399['push'](localUnsyncedConflict(_0x162cca,_0x2b9475['id']));continue;}}await _0x565373['write'](_0x162cca[_0x5bd581(0x167)],_0x349efd);const _0x5d8a85={'hash':_0x49bf7c,'remoteId':_0x2b9475['id'],'version':_0x2b9475[_0x5bd581(0x13d)]};_0x162cca['type']==='HOOK'&&_0x162cca[_0x5bd581(0x17e)]&&(_0x5d8a85[_0x5bd581(0x191)]=_0x162cca[_0x5bd581(0x17e)]['alias'],_0x5d8a85[_0x5bd581(0x1b7)]=_0x162cca[_0x5bd581(0x17e)][_0x5bd581(0x1b7)],_0x5d8a85[_0x5bd581(0x144)]=_0x162cca[_0x5bd581(0x17e)][_0x5bd581(0x144)],_0x5d8a85[_0x5bd581(0x15b)]=_0x162cca[_0x5bd581(0x17e)][_0x5bd581(0x15b)]),_0xd70e62[_0x5bd581(0x183)][_0x162cca['lockKey']]=_0x5d8a85,_0x3b4049[_0x5bd581(0x189)]({'lockKey':_0x162cca[_0x5bd581(0x197)],'remoteId':_0x2b9475['id']});}catch(_0x37e0b3){_0x2e5f1e['push']({'lockKey':_0x162cca[_0x5bd581(0x197)],'error':_0x37e0b3 instanceof Error?_0x37e0b3[_0x5bd581(0x156)]:String(_0x37e0b3)});}}_0xd70e62[_0x5bd581(0x123)]=new Date()['toISOString']();try{await writeBffLockFile(_0x37c362[_0x5bd581(0x188)],_0x16a1d1);}catch(_0x28f551){const _0x34551b=[...await _0x565373[_0x5bd581(0x1a3)](),...await _0x4cf65b?.[_0x5bd581(0x1a3)]()??[]];throw withRollbackErrors(_0x28f551,_0x5bd581(0x151),_0x34551b);}return{'ok':_0x2e5f1e['length']===0x0,'data':{'pulled':_0x3b4049,'skipped':_0x16ee71,'conflicts':_0x2e1399,'failed':_0x2e5f1e},'message':formatPullMessage(_0x3b4049[_0x5bd581(0x171)],_0x16ee71[_0x5bd581(0x171)],_0x2e1399[_0x5bd581(0x171)],_0x2e5f1e[_0x5bd581(0x171)])};}};function localUnsyncedConflict(_0x414840,_0x38bb72){const _0x566f91=a43_0x133205,_0x260f3e=_0x414840['lockKey'][_0x566f91(0x148)]('/')['at'](-0x1);return{'code':_0x566f91(0x18a),'lockKey':_0x414840['lockKey'],'filePath':_0x414840['filePath'],..._0x38bb72!=null?{'remoteId':_0x38bb72}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':_0x566f91(0x1aa),'command':CLI_BIN_NAME+_0x566f91(0x125)+_0x414840[_0x566f91(0x1b4)]+_0x566f91(0x1b0)+_0x260f3e+_0x566f91(0x19b),'requiresReview':!![],'message':_0x566f91(0x163)}};}function formatPullMessage(_0x5670c7,_0x21386e,_0x54d69c,_0x47d797){const _0x10de2a=a43_0x133205,_0x20db23=[_0x10de2a(0x165)+_0x5670c7+_0x10de2a(0x172),_0x21386e+_0x10de2a(0x1a4)];_0x54d69c>0x0&&_0x20db23['push'](_0x54d69c+_0x10de2a(0x135)+(_0x54d69c===0x1?'':'s')+'\x20'+(_0x54d69c===0x1?_0x10de2a(0x1b3):_0x10de2a(0x182))+_0x10de2a(0x18f));if(_0x47d797>0x0)_0x20db23['push'](_0x47d797+'\x20failed');return _0x20db23[_0x10de2a(0x12b)](',\x20');}async function hasUnsyncedLocalChanges(_0x3da2cb,_0x463e5a,_0x57dec0){const _0x19ab08=a43_0x133205;if(!await fileExists(_0x3da2cb))return![];const _0x513729=await computeFileHash(_0x3da2cb);if(!_0x463e5a)return _0x57dec0?_0x513729!==_0x57dec0:!![];return _0x513729!==_0x463e5a[_0x19ab08(0x120)];}function createPullFileTransaction(){const _0x5493a3=new Map(),_0x42594f=async(_0x1c1ac3,_0x52be38)=>{const _0x2155d1=a43_0x1b2f;try{if(_0x52be38[_0x2155d1(0x15e)])await ensureParentDirectory(_0x1c1ac3),await writeFile(_0x1c1ac3,_0x52be38[_0x2155d1(0x13f)]);else try{await unlink(_0x1c1ac3);}catch(_0x22d5fa){if(_0x22d5fa['code']!==_0x2155d1(0x1a7))throw _0x22d5fa;}return undefined;}catch(_0x3695f3){return _0x3695f3 instanceof Error?_0x3695f3:new Error(String(_0x3695f3));}};return{async 'write'(_0x35a73f,_0x28e16a){const _0x7127df=a43_0x1b2f;if(!_0x5493a3['has'](_0x35a73f))try{_0x5493a3[_0x7127df(0x193)](_0x35a73f,{'existed':!![],'content':await readFile(_0x35a73f)});}catch(_0x412ad3){if(_0x412ad3[_0x7127df(0x162)]!==_0x7127df(0x1a7))throw _0x412ad3;_0x5493a3[_0x7127df(0x193)](_0x35a73f,{'existed':![]});}try{await ensureParentDirectory(_0x35a73f),await writeFile(_0x35a73f,_0x28e16a,_0x7127df(0x16e));}catch(_0x4d9df2){const _0x4364a5=await _0x42594f(_0x35a73f,_0x5493a3[_0x7127df(0x159)](_0x35a73f));if(!_0x4364a5)_0x5493a3[_0x7127df(0x139)](_0x35a73f);throw withRollbackErrors(_0x4d9df2,_0x7127df(0x12d)+_0x35a73f+'\x22.',_0x4364a5?[_0x4364a5]:[]);}},async 'rollback'(){const _0x2549b1=a43_0x1b2f,_0x494974=[];for(const [_0x4e7ac6,_0x4f84e6]of[..._0x5493a3[_0x2549b1(0x11f)]()][_0x2549b1(0x16d)]()){const _0x25a250=await _0x42594f(_0x4e7ac6,_0x4f84e6);_0x25a250&&_0x494974[_0x2549b1(0x189)](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x4e7ac6+_0x2549b1(0x154)+_0x25a250[_0x2549b1(0x156)]));}return _0x494974;}};}function withRollbackErrors(_0x154155,_0x587d0f,_0x53e840){const _0x5f54c8=a43_0x133205,_0x78603b=_0x154155 instanceof Error?_0x154155:new Error(String(_0x154155));if(_0x53e840['length']===0x0)return _0x78603b;return new AggregateError([_0x78603b,..._0x53e840],_0x587d0f+'\x20Recovery\x20errors:\x20'+_0x53e840[_0x5f54c8(0x1ab)](_0x10db2a=>_0x10db2a[_0x5f54c8(0x156)])[_0x5f54c8(0x12b)](';\x20'));}function buildDatasetCodeToAliasMap(_0x465fc0,_0x3a6e81,_0x39bfae){const _0x272a75=a43_0x133205,_0x4c6c52=resolveApiModelSource(_0x465fc0,_0x3a6e81,_0x39bfae),_0x213f19=loadAliasMap(_0x465fc0,undefined,_0x4c6c52['filePath'],_0x4c6c52['profileName']);return assertUnambiguousHookAliases(_0x213f19),new Map(_0x213f19[_0x272a75(0x1ab)](_0x1a1a90=>[_0x1a1a90[_0x272a75(0x1b7)][_0x272a75(0x168)](),_0x1a1a90[_0x272a75(0x191)]]));}async function planHookDirectoryMigration(_0x48cf57,_0x3c0d93,_0x458b0e,_0x1d78bc){const _0x3f5110=a43_0x133205,_0x3db706=new Map();for(const [_0x551b96,_0x52551e]of Object[_0x3f5110(0x11f)](_0x3c0d93[_0x3f5110(0x183)])){const [_0x34ca0c,_0x3d9106,_0xbc7330,_0x3385f0,_0x3d7c1c,..._0x598ac1]=_0x551b96['split']('/');if(_0x34ca0c!==_0x3f5110(0x14c)||!_0x3d9106||!_0xbc7330||!_0x3385f0||!_0x3d7c1c||_0x598ac1[_0x3f5110(0x171)]>0x0||!_0x52551e[_0x3f5110(0x1b7)])continue;const _0x37ef14=_0x458b0e['get'](_0x52551e[_0x3f5110(0x1b7)][_0x3f5110(0x168)]()),_0x52b051=_0x37ef14??_0x52551e[_0x3f5110(0x1b7)];if(!isSafeHookDirectorySegment(_0x3d9106))throw CliErrors[_0x3f5110(0x17d)](_0x3f5110(0x177)+_0x3d9106+_0x3f5110(0x1a1));if(!isSafeHookDirectorySegment(_0x52b051))throw CliErrors['validation'](_0x3f5110(0x137)+_0x3d9106+_0x3f5110(0x17c));if(_0x3d9106===_0x52b051)continue;const _0xb51589=_0x3db706['get'](_0x3d9106)??{'datasetCode':_0x52551e[_0x3f5110(0x1b7)],'alias':_0x37ef14,'keyChanges':[]};if(_0xb51589[_0x3f5110(0x1b7)]!==_0x52551e['datasetCode'])throw CliErrors[_0x3f5110(0x17d)](_0x3f5110(0x137)+_0x3d9106+_0x3f5110(0x145));const _0x3feb18='HOOK/'+_0x52b051+'/'+_0xbc7330+'/'+_0x3385f0+'/'+_0x3d7c1c;try{resolveLocalFilePathFromLockKey(_0x48cf57,_0x551b96),resolveLocalFilePathFromLockKey(_0x48cf57,_0x3feb18);}catch(_0x339d1f){throw CliErrors['validation'](_0x3f5110(0x141)+_0x551b96+_0x3f5110(0x154)+(_0x339d1f instanceof Error?_0x339d1f[_0x3f5110(0x156)]:String(_0x339d1f)));}_0xb51589[_0x3f5110(0x12e)]['push']({'oldLockKey':_0x551b96,'newLockKey':_0x3feb18,'entry':_0x52551e}),_0x3db706['set'](_0x3d9106,_0xb51589);}const _0x5049ce=new Set([..._0x3db706[_0x3f5110(0x19a)]()][_0x3f5110(0x164)](_0x1da7db=>_0x1da7db[_0x3f5110(0x12e)][_0x3f5110(0x1ab)](_0x30bcdc=>_0x30bcdc[_0x3f5110(0x169)]))),_0x127f41=new Map(),_0x557a79=new Map();for(const [_0x1aa2b0,_0x4d3f3f]of _0x3db706){const _0xd374c2=_0x4d3f3f[_0x3f5110(0x191)]??_0x4d3f3f[_0x3f5110(0x1b7)],_0x390075=hookDirectoryIdentity(_0xd374c2),_0x374992=_0x127f41['get'](_0x390075);if(_0x374992&&_0x374992!==_0x1aa2b0)throw CliErrors[_0x3f5110(0x17d)](_0x3f5110(0x140)+_0x374992+_0x3f5110(0x149)+_0x1aa2b0+'\x22:\x20both\x20target\x20\x22'+_0xd374c2+_0x3f5110(0x142));_0x127f41[_0x3f5110(0x193)](_0x390075,_0x1aa2b0);for(const _0x55e67e of _0x4d3f3f[_0x3f5110(0x12e)]){const _0x21c73b=_0x557a79[_0x3f5110(0x159)](_0x55e67e[_0x3f5110(0x18d)]);if(_0x21c73b&&_0x21c73b!==_0x55e67e[_0x3f5110(0x169)])throw CliErrors['validation'](_0x3f5110(0x134)+_0x21c73b+_0x3f5110(0x149)+_0x55e67e[_0x3f5110(0x169)]+'\x22:\x20both\x20target\x20\x22'+_0x55e67e[_0x3f5110(0x18d)]+_0x3f5110(0x1b8));if(_0x5049ce[_0x3f5110(0x157)](_0x55e67e[_0x3f5110(0x18d)]))throw CliErrors[_0x3f5110(0x17d)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x55e67e[_0x3f5110(0x169)]+'\x22:\x20its\x20target\x20\x22'+_0x55e67e['newLockKey']+_0x3f5110(0x152));_0x557a79['set'](_0x55e67e[_0x3f5110(0x18d)],_0x55e67e['oldLockKey']);}}const _0x3c8989=new Map();for(const [_0x3da50e,_0xe306f1]of _0x458b0e){_0x3c8989[_0x3f5110(0x193)](hookDirectoryIdentity(_0xe306f1),_0x3da50e);}const _0x2a2ec1=[];for(const [_0x420a48,_0x2377ee]of _0x3db706){const _0x531c87=_0x2377ee[_0x3f5110(0x191)]??_0x2377ee[_0x3f5110(0x1b7)],_0x4d6e9e=join(_0x48cf57['scriptsRootDir'],_0x3f5110(0x14c),_0x420a48),_0x478572=join(_0x48cf57[_0x3f5110(0x16c)],_0x3f5110(0x14c),_0x531c87),_0x451f2a=await directoryExists(_0x4d6e9e),_0x742e0=await directoryExists(_0x478572),_0x13bb2b=_0x451f2a?_0x742e0?await sameDirectory(_0x4d6e9e,_0x478572)?_0x3f5110(0x136):undefined:_0x3f5110(0x184):_0x3f5110(0x124);if(!_0x13bb2b)throw CliErrors[_0x3f5110(0x17d)](_0x3f5110(0x137)+_0x420a48+'\x22\x20to\x20\x22'+_0x531c87+_0x3f5110(0x14f));const _0x39e782=_0x3c8989[_0x3f5110(0x159)](hookDirectoryIdentity(_0x420a48));if(_0x39e782&&_0x39e782!==_0x2377ee[_0x3f5110(0x1b7)][_0x3f5110(0x168)]()){const _0x17e304=new Set(_0x2377ee[_0x3f5110(0x12e)][_0x3f5110(0x1ab)](_0x52c03c=>_0x52c03c[_0x3f5110(0x169)])),_0x3f2b76=_0x1d78bc[_0x3f5110(0x129)](_0x159b61=>_0x159b61[_0x3f5110(0x1b4)]===_0x3f5110(0x14c)&&_0x159b61[_0x3f5110(0x191)]!=null&&hookDirectoryIdentity(_0x159b61['alias'])===hookDirectoryIdentity(_0x420a48)&&!_0x17e304[_0x3f5110(0x157)](_0x159b61['lockKey']));if(_0x3f2b76['length']>0x0)throw CliErrors[_0x3f5110(0x17d)](_0x3f5110(0x137)+_0x420a48+_0x3f5110(0x1b1));}const _0x40d138=_0x3c8989[_0x3f5110(0x159)](hookDirectoryIdentity(_0x531c87));if(_0x40d138&&_0x40d138!==_0x2377ee['datasetCode'][_0x3f5110(0x168)]())throw CliErrors[_0x3f5110(0x17d)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x420a48+'\x22\x20to\x20\x22'+_0x531c87+_0x3f5110(0x1ac));for(const _0x27676c of _0x2377ee[_0x3f5110(0x12e)]){const _0x5e334c=_0x3c0d93[_0x3f5110(0x183)][_0x27676c['newLockKey']];if(_0x5e334c&&!_0x5049ce[_0x3f5110(0x157)](_0x27676c[_0x3f5110(0x18d)])&&!sameHookIdentity(_0x27676c['entry'],_0x5e334c))throw CliErrors[_0x3f5110(0x17d)](_0x3f5110(0x137)+_0x420a48+_0x3f5110(0x1af)+_0x531c87+_0x3f5110(0x1b6));}_0x2a2ec1['push']({'oldDirectory':_0x420a48,'newDirectory':_0x531c87,'oldDirectoryPath':_0x4d6e9e,'newDirectoryPath':_0x478572,'mode':_0x13bb2b,'alias':_0x2377ee[_0x3f5110(0x191)],'keyChanges':_0x2377ee[_0x3f5110(0x12e)]});}const _0x152873={..._0x3c0d93['functions']},_0x202eba=new Map(),_0x908c83=new Map();for(const _0x2555de of _0x2a2ec1){const _0x56d5d0=_0x2555de[_0x3f5110(0x178)]!=='rekey';_0x56d5d0&&_0x908c83[_0x3f5110(0x193)](hookDirectoryIdentity(_0x2555de[_0x3f5110(0x187)]),_0x2555de[_0x3f5110(0x131)]);for(const _0x334f68 of _0x2555de['keyChanges']){const _0xfaa69d=_0x152873[_0x334f68[_0x3f5110(0x18d)]],_0x4e9c1b=_0x56d5d0?_0x334f68[_0x3f5110(0x150)]:_0xfaa69d??_0x334f68[_0x3f5110(0x150)];_0x152873[_0x334f68['newLockKey']]=canonicalizeHookEntry(_0x4e9c1b,_0x2555de[_0x3f5110(0x191)]),delete _0x152873[_0x334f68['oldLockKey']],_0x56d5d0&&_0x202eba['set'](_0x334f68['newLockKey'],resolveLocalFilePathFromLockKey(_0x48cf57,_0x334f68[_0x3f5110(0x169)]));}}return{'migrations':_0x2a2ec1,'projectedFunctions':_0x152873,'sourceFilePathByNewLockKey':_0x202eba,'sourceDirectoryPathByNewDirectory':_0x908c83};}function resolveMigratedSourceFilePath(_0x1fe453,_0x55ed0a){const _0xc6a6f4=a43_0x133205;if(!_0x1fe453||!_0x55ed0a)return undefined;const _0x2ed872=_0x1fe453[_0xc6a6f4(0x176)][_0xc6a6f4(0x159)](_0x55ed0a[_0xc6a6f4(0x197)]);if(_0x2ed872)return _0x2ed872;if(_0x55ed0a['type']!==_0xc6a6f4(0x14c))return undefined;const [,_0x9a71d1,..._0x1b6d62]=_0x55ed0a[_0xc6a6f4(0x197)][_0xc6a6f4(0x148)]('/');if(!_0x9a71d1||_0x1b6d62[_0xc6a6f4(0x171)]===0x0)return undefined;const _0x14c696=_0x1fe453[_0xc6a6f4(0x18e)][_0xc6a6f4(0x159)](hookDirectoryIdentity(_0x9a71d1));return _0x14c696?join(_0x14c696,..._0x1b6d62)+_0xc6a6f4(0x160):undefined;}function a43_0x1b2f(_0x2e7df9,_0x31e32a){_0x2e7df9=_0x2e7df9-0x11f;const _0x3979cf=a43_0x3979();let _0x1b2fd3=_0x3979cf[_0x2e7df9];return _0x1b2fd3;}function sameHookIdentity(_0x1d6384,_0x364f8e){const _0x35bcb9=a43_0x133205;return _0x1d6384[_0x35bcb9(0x146)]===_0x364f8e[_0x35bcb9(0x146)]&&_0x1d6384[_0x35bcb9(0x1b7)]===_0x364f8e['datasetCode']&&_0x1d6384[_0x35bcb9(0x144)]===_0x364f8e[_0x35bcb9(0x144)]&&_0x1d6384[_0x35bcb9(0x15b)]===_0x364f8e[_0x35bcb9(0x15b)];}function canonicalizeHookEntry(_0x59b5ac,_0x79451b){const {alias:_0x2cc300,..._0x1a5ded}=_0x59b5ac;return _0x79451b?{..._0x1a5ded,'alias':_0x79451b}:_0x1a5ded;}function hookDirectoryIdentity(_0x2c9f9b){const _0x35d5b2=a43_0x133205;return _0x2c9f9b[_0x35d5b2(0x175)](_0x35d5b2(0x19c))[_0x35d5b2(0x168)]();}function isSafeHookDirectorySegment(_0xcb11a7){return isSafeLockKeySegment(_0xcb11a7);}async function sameDirectory(_0x58b8ad,_0x2877ac){const _0x26c2cc=a43_0x133205,[_0x24fd8a,_0x3adfaf]=await Promise[_0x26c2cc(0x161)]([stat(_0x58b8ad),stat(_0x2877ac)]);return _0x24fd8a[_0x26c2cc(0x1a6)]===_0x3adfaf[_0x26c2cc(0x1a6)]&&_0x24fd8a[_0x26c2cc(0x16f)]===_0x3adfaf[_0x26c2cc(0x16f)];}async function applyHookDirectoryMigration(_0x5045e8,_0x4ca2ec){const _0x5db543=a43_0x133205,_0x23f704=_0x4ca2ec['functions'],_0x4abb0e=_0x4ca2ec[_0x5db543(0x123)],_0x48c76e=[],_0x44126b=async()=>{const _0x306dd7=_0x5db543,_0x45d7e2=[];_0x4ca2ec[_0x306dd7(0x183)]=_0x23f704,_0x4ca2ec[_0x306dd7(0x123)]=_0x4abb0e;for(const {migration:_0x21f006,temporaryPath:_0x321f7d}of[..._0x48c76e][_0x306dd7(0x16d)]()){try{_0x321f7d?(await rename(_0x21f006[_0x306dd7(0x199)],_0x321f7d),await rename(_0x321f7d,_0x21f006[_0x306dd7(0x131)])):await rename(_0x21f006[_0x306dd7(0x199)],_0x21f006[_0x306dd7(0x131)]);}catch(_0x1540f5){_0x45d7e2['push'](new Error(_0x306dd7(0x13e)+_0x21f006[_0x306dd7(0x19e)]+'\x22\x20from\x20\x22'+_0x21f006['newDirectory']+_0x306dd7(0x154)+(_0x1540f5 instanceof Error?_0x1540f5[_0x306dd7(0x156)]:String(_0x1540f5))));}}return _0x45d7e2;};try{for(const _0x1cf2e1 of _0x5045e8['migrations']){if(_0x1cf2e1[_0x5db543(0x178)]===_0x5db543(0x184))await ensureParentDirectory(_0x1cf2e1[_0x5db543(0x199)]),await rename(_0x1cf2e1[_0x5db543(0x131)],_0x1cf2e1['newDirectoryPath']),_0x48c76e[_0x5db543(0x189)]({'migration':_0x1cf2e1});else{if(_0x1cf2e1[_0x5db543(0x178)]===_0x5db543(0x136)){const _0x3aa909=join(dirname(_0x1cf2e1[_0x5db543(0x131)]),'.hook-directory-migrate-'+randomUUID());await rename(_0x1cf2e1['oldDirectoryPath'],_0x3aa909);try{await rename(_0x3aa909,_0x1cf2e1[_0x5db543(0x199)]);}catch(_0x13cd70){try{await rename(_0x3aa909,_0x1cf2e1[_0x5db543(0x131)]);}catch(_0x5af0a1){throw withRollbackErrors(_0x13cd70,_0x5db543(0x143)+_0x1cf2e1['oldDirectory']+_0x5db543(0x1af)+_0x1cf2e1[_0x5db543(0x187)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x3aa909+'\x22\x20may\x20remain.',[new Error(_0x5db543(0x192)+_0x3aa909+_0x5db543(0x1af)+_0x1cf2e1[_0x5db543(0x19e)]+_0x5db543(0x154)+(_0x5af0a1 instanceof Error?_0x5af0a1['message']:String(_0x5af0a1)))]);}throw _0x13cd70;}_0x48c76e[_0x5db543(0x189)]({'migration':_0x1cf2e1,'temporaryPath':_0x3aa909});}}}return _0x4ca2ec['functions']=_0x5045e8['projectedFunctions'],{'rollback':_0x44126b};}catch(_0x579ffc){const _0x16f750=await _0x44126b();throw withRollbackErrors(_0x579ffc,_0x5db543(0x130),_0x16f750);}}async function confirmForce(){const _0x8944e2=a43_0x133205,_0x1c6674=createInterface({'input':process[_0x8944e2(0x185)],'output':process[_0x8944e2(0x14a)]}),_0x38c8f5=await new Promise(_0x1b6d49=>{const _0x502ead=_0x8944e2;_0x1c6674['question'](_0x502ead(0x173),_0x1b6d49);});return _0x1c6674[_0x8944e2(0x14e)](),['y',_0x8944e2(0x12c)][_0x8944e2(0x158)](_0x38c8f5[_0x8944e2(0x1b5)]()[_0x8944e2(0x168)]());}
|