@lovrabet/rabetbase-cli 2.5.4-beta.2 → 2.5.4-beta.4
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/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/service.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/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.d.ts +2 -0
- package/lib/commands/user-account/feishu-bind.js +1 -0
- 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.d.ts +2 -0
- 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 +1 -1
- package/skills/rabetbase/SKILL.md +3 -2
- package/skills/rabetbase/references/rabetbase-user-account.md +20 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x45fa66=a34_0x1fce;(function(_0x5dd12d,_0x248586){const _0x29037a=a34_0x1fce,_0x353aa3=_0x5dd12d();while(!![]){try{const _0x439c38=parseInt(_0x29037a(0xbb))/0x1*(-parseInt(_0x29037a(0xb7))/0x2)+-parseInt(_0x29037a(0xb4))/0x3*(-parseInt(_0x29037a(0xdd))/0x4)+parseInt(_0x29037a(0xdf))/0x5+-parseInt(_0x29037a(0xde))/0x6+parseInt(_0x29037a(0xae))/0x7*(-parseInt(_0x29037a(0xc7))/0x8)+-parseInt(_0x29037a(0xc6))/0x9*(parseInt(_0x29037a(0xe6))/0xa)+parseInt(_0x29037a(0xd0))/0xb;if(_0x439c38===_0x248586)break;else _0x353aa3['push'](_0x353aa3['shift']());}catch(_0x5b4a85){_0x353aa3['push'](_0x353aa3['shift']());}}}(a34_0x5906,0x83d92));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a34_0x45fa66(0xd6),'required':!![]};export const VALUE_ARG={'name':a34_0x45fa66(0xb9),'description':a34_0x45fa66(0xcd),'required':![]};export const TAGS_FLAG={'name':a34_0x45fa66(0xe5),'type':a34_0x45fa66(0xaa),'description':a34_0x45fa66(0xd3)};export const STDIN_FLAG={'name':'stdin','type':a34_0x45fa66(0xad),'description':a34_0x45fa66(0xd4),'default':![]};export const FROM_ENV_FLAG={'name':a34_0x45fa66(0xbf),'type':a34_0x45fa66(0xaa),'description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};function a34_0x5906(){const _0x5f154b=['Read\x20config\x20value\x20from\x20stdin','end','Runtime\x20app-config\x20key','Value\x20file\x20is\x20not\x20readable:\x20','gmtModified','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','appCode:\x20','appCode','stdin','31480IfbteX','1939032VvZcQm','1332830sltlrQ','utf8','valueRedacted','trim','data','operation','tags','3585850wREpvC','method','kind','key','string','hasValue','Missing\x20app-config\x20key.','boolean','1648150GzOlZc','Failed\x20to\x20','argument','validation','length','before','213ZCWMHB','env','Environment\x20variable\x20is\x20not\x20set:\x20','56liZVPc','slice','value','args','7283FRUzms','url','error','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','from-env','name','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','path','str','reveal','push','18hZwkJP','8hYTWCH','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','apiError','key:\x20','file','setEncoding','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','once','bool','13138730EQNUKe','join','dryRun','Config\x20tags\x20for\x20filtering/display\x20metadata'];a34_0x5906=function(){return _0x5f154b;};return a34_0x5906();}export const REVEAL_FLAG={'name':a34_0x45fa66(0xc4),'type':'boolean','description':a34_0x45fa66(0xc8),'default':![]};export function readKeyArg(_0x31623f){const _0x46af60=a34_0x45fa66,_0xa37951=_0x31623f[_0x46af60(0xba)][0x0]?.[_0x46af60(0xe2)]()??'';return validateKey(_0xa37951),_0xa37951;}export function readOptionalTags(_0x3e6ac5){const _0x2a69d5=a34_0x45fa66,_0x5727f5=_0x3e6ac5[_0x2a69d5(0xc3)](_0x2a69d5(0xe5))[_0x2a69d5(0xe2)]();if(!_0x5727f5)return undefined;if(_0x5727f5[_0x2a69d5(0xb2)]>0x20)throw CliErrors[_0x2a69d5(0xb1)](_0x2a69d5(0xd9));return _0x5727f5;}export function validateKey(_0x2382d7){const _0x1901db=a34_0x45fa66;if(!_0x2382d7)throw CliErrors[_0x1901db(0xb1)](_0x1901db(0xac));if(_0x2382d7[_0x1901db(0xb2)]>0x100)throw CliErrors[_0x1901db(0xb1)]('App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.');}export function projectAppConfig(_0x4bd81b,_0xfeb4e4){const _0xcee9c8=a34_0x45fa66,_0x4fb165=_0x4bd81b[_0xcee9c8(0xb9)]!==undefined&&_0x4bd81b[_0xcee9c8(0xb9)]!==null&&_0x4bd81b[_0xcee9c8(0xb9)]!=='',_0xb4fb11={'appCode':_0x4bd81b[_0xcee9c8(0xdb)],'key':_0x4bd81b[_0xcee9c8(0xa9)],'tags':_0x4bd81b['tags']??undefined,'hasValue':_0x4fb165,'valueRedacted':_0x4fb165&&!_0xfeb4e4?.[_0xcee9c8(0xc4)],'gmtCreate':_0x4bd81b['gmtCreate'],'gmtModified':_0x4bd81b[_0xcee9c8(0xd8)]};return _0xfeb4e4?.[_0xcee9c8(0xc4)]&&(_0xb4fb11[_0xcee9c8(0xb9)]=_0x4bd81b[_0xcee9c8(0xb9)]??'',_0xb4fb11[_0xcee9c8(0xe1)]=![]),_0xb4fb11;}export function plannedAppConfig(_0x58fb44){const _0x3fda9d=a34_0x45fa66,_0x1a69f0=_0x58fb44[_0x3fda9d(0xab)]??!![];return{'appCode':_0x58fb44[_0x3fda9d(0xdb)],'key':_0x58fb44[_0x3fda9d(0xa9)],'tags':_0x58fb44[_0x3fda9d(0xe5)]??undefined,'hasValue':_0x1a69f0,'valueRedacted':_0x1a69f0};}export function buildMutationData(_0x485063){const _0x1ebb50=a34_0x45fa66;return{'operation':_0x485063[_0x1ebb50(0xe4)],'selector':{'appCode':_0x485063[_0x1ebb50(0xdb)],'key':_0x485063[_0x1ebb50(0xa9)]},'before':_0x485063[_0x1ebb50(0xb3)],'after':_0x485063['after'],'dryRun':_0x485063[_0x1ebb50(0xd2)],'warnings':_0x485063['warnings']??[]};}export async function withAppConfigApiBoundary(_0x19d7b2,_0x38192b,_0x2feebe){const _0x5848b1=a34_0x45fa66;try{return await _0x2feebe();}catch{const _0x9c967e=[_0x5848b1(0xda)+_0x38192b[_0x5848b1(0xdb)]];if(_0x38192b[_0x5848b1(0xa9)])_0x9c967e[_0x5848b1(0xc5)](_0x5848b1(0xca)+_0x38192b[_0x5848b1(0xa9)]);_0x9c967e['push']('value\x20is\x20redacted');throw CliErrors[_0x5848b1(0xc9)](_0x5848b1(0xaf)+_0x19d7b2+'\x20app\x20config.',_0x9c967e['join'](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x7c0e55,_0x4a3aa2){const _0x4e75c5=a34_0x45fa66;return Object['defineProperties'](_0x7c0e55,{'method':{'value':_0x4a3aa2[_0x4e75c5(0xa7)],'enumerable':![]},'url':{'value':_0x4a3aa2[_0x4e75c5(0xbc)],'enumerable':![]}});}export function assertSingleValueSource(_0x38b82a){const _0x45d319=a34_0x45fa66,_0x16c758=[];_0x38b82a[_0x45d319(0xba)][_0x45d319(0xb2)]>0x1&&_0x16c758[_0x45d319(0xc5)]({'kind':_0x45d319(0xb0),'value':_0x38b82a['args'][_0x45d319(0xb8)](0x1)[_0x45d319(0xd1)]('\x20')});const _0x171af1=_0x38b82a['flag'](_0x45d319(0xb9));_0x171af1!==undefined&&_0x171af1!==null&&_0x16c758[_0x45d319(0xc5)]({'kind':'argument','value':String(_0x171af1)});_0x38b82a[_0x45d319(0xcf)](_0x45d319(0xdc))&&_0x16c758['push']({'kind':_0x45d319(0xdc)});const _0x514145=_0x38b82a['str'](_0x45d319(0xbf))['trim']();_0x514145&&_0x16c758[_0x45d319(0xc5)]({'kind':_0x45d319(0xb5),'name':_0x514145});const _0x2ba0a5=_0x38b82a[_0x45d319(0xc3)](_0x45d319(0xcb))[_0x45d319(0xe2)]();_0x2ba0a5&&_0x16c758[_0x45d319(0xc5)]({'kind':_0x45d319(0xcb),'path':_0x2ba0a5});if(_0x16c758[_0x45d319(0xb2)]===0x0)throw CliErrors['validation']('Missing\x20app-config\x20value\x20source.',_0x45d319(0xc1));if(_0x16c758['length']>0x1)throw CliErrors[_0x45d319(0xb1)]('App\x20config\x20value\x20source\x20is\x20ambiguous.',_0x45d319(0xbe));return _0x16c758[0x0];}export async function assertValueSourceReadable(_0x26f064){const _0x5b2cb1=a34_0x45fa66;if(_0x26f064[_0x5b2cb1(0xa8)]==='env'&&!(_0x26f064[_0x5b2cb1(0xc0)]in process.env))throw CliErrors[_0x5b2cb1(0xb1)](_0x5b2cb1(0xb6)+_0x26f064['name']);if(_0x26f064[_0x5b2cb1(0xa8)]===_0x5b2cb1(0xcb))try{await access(_0x26f064['path']);}catch{throw CliErrors[_0x5b2cb1(0xb1)](_0x5b2cb1(0xd7)+_0x26f064[_0x5b2cb1(0xc2)]);}}function a34_0x1fce(_0x322b5a,_0x48e5ad){_0x322b5a=_0x322b5a-0xa7;const _0x59068b=a34_0x5906();let _0x1fce8c=_0x59068b[_0x322b5a];return _0x1fce8c;}export async function readAppConfigValue(_0x534ab8){const _0x434780=a34_0x45fa66,_0x12965e=assertSingleValueSource(_0x534ab8),_0x5526f4=[];if(_0x12965e[_0x434780(0xa8)]==='argument')return _0x5526f4[_0x434780(0xc5)]('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0x12965e[_0x434780(0xb9)]??'','source':_0x12965e[_0x434780(0xa8)],'warnings':_0x5526f4};if(_0x12965e['kind']===_0x434780(0xdc))return{'value':await readStdin(),'source':_0x12965e['kind'],'warnings':_0x5526f4};if(_0x12965e['kind']===_0x434780(0xb5)){if(!(_0x12965e['name']in process.env))throw CliErrors['validation'](_0x434780(0xb6)+_0x12965e[_0x434780(0xc0)]);return{'value':process.env[_0x12965e.name]??'','source':_0x12965e['kind'],'warnings':_0x5526f4};}return{'value':await readFile(_0x12965e[_0x434780(0xc2)],_0x434780(0xe0)),'source':_0x12965e['kind'],'warnings':_0x5526f4};}function readStdin(){return new Promise((_0xfd6cf7,_0x51c543)=>{const _0x227cd4=a34_0x1fce;let _0x4dcdda='';process[_0x227cd4(0xdc)][_0x227cd4(0xcc)](_0x227cd4(0xe0)),process[_0x227cd4(0xdc)]['on'](_0x227cd4(0xe3),_0x3bd27c=>{_0x4dcdda+=_0x3bd27c;}),process['stdin'][_0x227cd4(0xce)](_0x227cd4(0xd5),()=>_0xfd6cf7(_0x4dcdda)),process['stdin'][_0x227cd4(0xce)](_0x227cd4(0xbd),_0x51c543);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a35_0x2f29(){const _0x54d199=['logout','Login\x20via\x20browser','148158HAnRAP','9KawdhB','8646KOHPDP','157629eEvNVg','1237910rxryRC','5887952bmhEJl','2295TvmRIa','nonInteractive','auth','12DwXVHv','880098Oevhhm','log','write','boolean','Clear\x20login\x20session','585095BTZAZa','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','../../auth/auth-server-ui.js','yes'];a35_0x2f29=function(){return _0x54d199;};return a35_0x2f29();}const a35_0x2e1ce0=a35_0x418b;function a35_0x418b(_0x191bee,_0x3470a5){_0x191bee=_0x191bee-0x11a;const _0x2f29ef=a35_0x2f29();let _0x418b8b=_0x2f29ef[_0x191bee];return _0x418b8b;}(function(_0x2219e6,_0x1e578b){const _0x356ec1=a35_0x418b,_0x5139da=_0x2219e6();while(!![]){try{const _0x135e3d=-parseInt(_0x356ec1(0x12d))/0x1+-parseInt(_0x356ec1(0x11f))/0x2+-parseInt(_0x356ec1(0x12a))/0x3*(parseInt(_0x356ec1(0x11e))/0x4)+parseInt(_0x356ec1(0x11b))/0x5*(parseInt(_0x356ec1(0x12c))/0x6)+parseInt(_0x356ec1(0x124))/0x7+-parseInt(_0x356ec1(0x11a))/0x8*(-parseInt(_0x356ec1(0x12b))/0x9)+-parseInt(_0x356ec1(0x12e))/0xa;if(_0x135e3d===_0x1e578b)break;else _0x5139da['push'](_0x5139da['shift']());}catch(_0x3be5d1){_0x5139da['push'](_0x5139da['shift']());}}}(a35_0x2f29,0x9542b));import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':'login','description':a35_0x2e1ce0(0x129),'risk':a35_0x2e1ce0(0x121),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a35_0x2e1ce0(0x127),'type':a35_0x2e1ce0(0x122),'description':a35_0x2e1ce0(0x125),'default':![]}],async 'execute'(_0xd0718a){const _0x40ea85=a35_0x2e1ce0,{runAuthServer:_0x587aea}=await import(_0x40ea85(0x126));return await _0x587aea({'autoYes':_0xd0718a['bool']('yes'),'nonInteractive':_0xd0718a[_0x40ea85(0x11c)]}),{'ok':!![]};}},{'service':a35_0x2e1ce0(0x11d),'command':a35_0x2e1ce0(0x128),'description':a35_0x2e1ce0(0x123),'risk':a35_0x2e1ce0(0x121),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x27c6bb){const _0x4b2d8a=a35_0x2e1ce0;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x4b2d8a(0x120)]('✓\x20Logged\x20out')):console[_0x4b2d8a(0x120)]('!\x20Not\x20logged\x20in'),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a36_0x3e2f(){const _0x54bbae=['trim','40036NaAQnY','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','utf8','functionNode',']\x20(','read','currentApp','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','name','2BOjtAN','Dataset\x20not\x20found\x20for\x20code\x20\x22','before','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\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','修改后的请求参数','.js','operationType','/COMMON/','Select\x20operation\x20type:','Function\x20name\x20(valid\x20JS\x20identifier)','282635VboGkV','code','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','stderr','Script\x20type','8356956qLMXYX','1339688EIgYRO','datasetId','9930agvnzl','length','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Created\x20','Select\x20trigger\x20node:','datasetcode','\x20api\x20pull`\x20to\x20refresh.','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','No\x20datasets\x20found\x20for\x20this\x20app.','includes','join','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','scriptsRootDir','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','11AWIxmb','nonInteractive','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','type','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','source','create','Invalid\x20dataset\x20selection.','354YHVHlF','.js\x0a','\x20function:\x20','tableName','bff','Available\x20aliases:\x20','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','UNKNOWN','validation','defaultApp','\x22,\x20params\x20})\x0a','stdin','HOOK\x20requires\x20alias/operation/node\x20options.','mergedCli','当前响应结果','COMMON','1837520MOFJHp','/ENDPOINT/','after','write','function-node','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','selectedAppName','6392okWufu','keys','\x22\x20not\x20found.\x20','str','isInteger','HOOK','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','string','\x0a\x20*\x20[平台配置]\x20','\x22\x20not\x20found\x20for\x20dataset\x20','appCode','Select\x20dataset:','33ULYIRR','apiDir','修改后的响应结果','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','profileName','operation-type','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','当前请求参数','alias','find','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','ENDPOINT','/**\x0a\x20*\x20','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','map','No\x20model\x20aliases\x20found.\x20Run\x20`','423JsrpWU','datasetCode','Operation\x20type\x20\x22'];a36_0x3e2f=function(){return _0x54bbae;};return a36_0x3e2f();}const a36_0x1c0946=a36_0x4377;(function(_0x113a28,_0x49b94b){const _0xa31ee2=a36_0x4377,_0xc1b0b8=_0x113a28();while(!![]){try{const _0xdcce54=-parseInt(_0xa31ee2(0x106))/0x1*(parseInt(_0xa31ee2(0xfb))/0x2)+parseInt(_0xa31ee2(0xdc))/0x3*(-parseInt(_0xa31ee2(0xf2))/0x4)+parseInt(_0xa31ee2(0x10e))/0x5*(-parseInt(_0xa31ee2(0x125))/0x6)+-parseInt(_0xa31ee2(0x10c))/0x7+parseInt(_0xa31ee2(0xd0))/0x8*(-parseInt(_0xa31ee2(0xee))/0x9)+parseInt(_0xa31ee2(0xc8))/0xa+parseInt(_0xa31ee2(0x11d))/0xb*(parseInt(_0xa31ee2(0x10b))/0xc);if(_0xdcce54===_0x49b94b)break;else _0xc1b0b8['push'](_0xc1b0b8['shift']());}catch(_0x3ef2c9){_0xc1b0b8['push'](_0xc1b0b8['shift']());}}}(a36_0x3e2f,0x22808));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';function a36_0x4377(_0x27a671,_0x596285){_0x27a671=_0x27a671-0xc7;const _0x3e2ff1=a36_0x3e2f();let _0x437727=_0x3e2ff1[_0x27a671];return _0x437727;}export const bffCreate={'service':a36_0x1c0946(0x129),'command':a36_0x1c0946(0x123),'description':a36_0x1c0946(0x11c),'risk':a36_0x1c0946(0xf7),'flags':[{'name':a36_0x1c0946(0x120),'type':a36_0x1c0946(0xd7),'required':!![],'enum':[a36_0x1c0946(0xc7),a36_0x1c0946(0xe9),a36_0x1c0946(0xd5)],'description':a36_0x1c0946(0x10a)},{'name':a36_0x1c0946(0xfa),'type':a36_0x1c0946(0xd7),'required':!![],'description':a36_0x1c0946(0x105)},{'name':'description','type':a36_0x1c0946(0xd7),'description':'Script\x20description'},{'name':a36_0x1c0946(0xe6),'type':a36_0x1c0946(0xd7),'description':a36_0x1c0946(0x12b)},{'name':a36_0x1c0946(0x113),'type':'string','description':a36_0x1c0946(0xe8)},{'name':a36_0x1c0946(0xe1),'type':a36_0x1c0946(0xd7),'description':'Operation\x20type\x20(HOOK\x20only)'},{'name':a36_0x1c0946(0xcc),'type':a36_0x1c0946(0xd7),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':[a36_0x1c0946(0xfd),a36_0x1c0946(0xca)]}],async 'validate'(_0x4a7273){const _0x5568b7=a36_0x1c0946,_0xbe1d71=_0x4a7273[_0x5568b7(0xd3)](_0x5568b7(0xfa));if(!isValidBffFunctionName(_0xbe1d71))throw CliErrors[_0x5568b7(0x12d)]('Invalid\x20function\x20name\x20\x22'+_0xbe1d71+_0x5568b7(0x108));},async 'execute'(_0x1d5d4f){const _0x227eae=a36_0x1c0946,_0x14b59a=loadBffProjectConfig(_0x1d5d4f[_0x227eae(0xda)]),_0x43efd2=_0x1d5d4f['str'](_0x227eae(0x120)),_0x367c10=_0x1d5d4f[_0x227eae(0xd3)](_0x227eae(0xfa)),_0x40c4fe=_0x1d5d4f[_0x227eae(0xd3)]('description')||undefined,_0x3669b9=_0x43efd2==='HOOK'?await resolveHookOptions(_0x14b59a,_0x1d5d4f):undefined,_0x110a4f=buildFilePath(_0x14b59a,_0x43efd2,_0x367c10,_0x3669b9);if(await fileExists(_0x110a4f))throw CliErrors[_0x227eae(0x12d)]('File\x20already\x20exists:\x20'+_0x110a4f);await mkdir(dirname(_0x110a4f),{'recursive':!![]});const _0x2a92bc=generateTemplate(_0x43efd2,_0x367c10,_0x1d5d4f['appCode'],_0x40c4fe,_0x3669b9);await writeFile(_0x110a4f,_0x2a92bc,_0x227eae(0xf4));const _0x22c1b9={'type':_0x43efd2,'name':_0x367c10,'path':_0x110a4f};if(_0x40c4fe)_0x22c1b9['description']=_0x40c4fe;if(_0x3669b9){if(_0x3669b9[_0x227eae(0xe6)])_0x22c1b9[_0x227eae(0xe6)]=_0x3669b9['alias'];_0x22c1b9['datasetCode']=_0x3669b9[_0x227eae(0xef)],_0x22c1b9[_0x227eae(0x102)]=_0x3669b9[_0x227eae(0x102)],_0x22c1b9[_0x227eae(0xf5)]=_0x3669b9[_0x227eae(0xf5)];}return{'ok':!![],'data':_0x22c1b9,'message':_0x227eae(0x111)+_0x43efd2+_0x227eae(0x127)+_0x367c10};}};async function resolveHookOptions(_0x26f422,_0x14eb71){const _0xbae30a=a36_0x1c0946,_0x56dd86=resolveApiModelSource(_0x14eb71[_0xbae30a(0xdd)],_0x14eb71['appCode'],_0x14eb71[_0xbae30a(0xcf)]||_0x14eb71[_0xbae30a(0x132)]?.[_0xbae30a(0xf8)]||_0x14eb71[_0xbae30a(0x132)]?.[_0xbae30a(0x12e)]),_0x3677be=loadAliasMap(_0x14eb71[_0xbae30a(0xdd)],undefined,_0x56dd86['filePath'],_0x56dd86[_0xbae30a(0xe0)]),_0x35a4a9=_0x3677be[_0xbae30a(0x10f)]>0x0;let _0x4f615e,_0x2de30f,_0x4c2c12;const _0x518cbd=_0x14eb71[_0xbae30a(0xd3)](_0xbae30a(0xe6)),_0xb41087=_0x14eb71['str'](_0xbae30a(0x113));if(_0x518cbd){const _0x3c3904=resolveAlias(_0x14eb71[_0xbae30a(0xdd)],_0x518cbd,undefined,_0x56dd86['filePath'],_0x56dd86[_0xbae30a(0xe0)]);if(!_0x3c3904){const _0x38db2e=_0x35a4a9?_0xbae30a(0x12a)+_0x3677be[_0xbae30a(0xec)](_0x30a49a=>_0x30a49a[_0xbae30a(0xe6)])['join'](',\x20'):_0xbae30a(0xed)+CLI_BIN_NAME+_0xbae30a(0xce);throw CliErrors[_0xbae30a(0x12d)]('Alias\x20\x22'+_0x518cbd+_0xbae30a(0xd2)+_0x38db2e);}_0x4f615e=_0x518cbd,_0x2de30f=_0x3c3904;}else{if(_0xb41087){_0x2de30f=_0xb41087;const _0x4a984f=_0x3677be[_0xbae30a(0xe7)](_0x5d0443=>_0x5d0443[_0xbae30a(0xef)]===_0xb41087);_0x4f615e=_0x4a984f?.[_0xbae30a(0xe6)];}else{if(_0x14eb71[_0xbae30a(0x11e)])throw CliErrors[_0xbae30a(0x12d)](_0xbae30a(0xd6));else{if(_0x35a4a9){const _0x101ece=_0x3677be['map'](_0x53028f=>_0x53028f[_0xbae30a(0xe6)]+'\x20('+_0x53028f[_0xbae30a(0x128)]+')'),_0x335eed=await promptSelect(_0xbae30a(0xdb),_0x101ece),_0x1919f6=_0x3677be[_0x335eed];if(!_0x1919f6)throw CliErrors['validation'](_0xbae30a(0x124));_0x4f615e=_0x1919f6[_0xbae30a(0xe6)],_0x2de30f=_0x1919f6['datasetCode'];}else{const _0x4bb164=await listDatasets(_0x14eb71[_0xbae30a(0xda)]);if(_0x4bb164[_0xbae30a(0x10f)]===0x0)throw CliErrors[_0xbae30a(0x12d)](_0xbae30a(0x116));const _0x41c20e=_0x4bb164['map'](_0x14d6cf=>_0x14d6cf['name']+'\x20['+(_0x14d6cf[_0xbae30a(0x122)]??_0xbae30a(0x12c))+_0xbae30a(0xf6)+_0x14d6cf[_0xbae30a(0x107)]+')'),_0x31317e=await promptSelect(_0xbae30a(0xdb),_0x41c20e),_0x153571=_0x4bb164[_0x31317e];if(!_0x153571)throw CliErrors['validation'](_0xbae30a(0x124));_0x2de30f=_0x153571[_0xbae30a(0x107)],_0x4f615e=undefined;}}}}const _0x2068c4=await listDatasets(_0x14eb71[_0xbae30a(0xda)]),_0x1764c3=_0x2068c4[_0xbae30a(0xe7)](_0x29a319=>_0x29a319['code']===_0x2de30f);if(!_0x1764c3)throw CliErrors[_0xbae30a(0x12d)](_0xbae30a(0xfc)+_0x2de30f+'\x22.\x20'+(_0x4f615e?'The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0xbae30a(0x114):''));_0x4c2c12=_0x1764c3['id'];const _0x17dc25=_0x4f615e??_0x2de30f,_0x3ff1e2=await listBffDatasetOperations(_0x14eb71[_0xbae30a(0xda)],_0x4c2c12),_0x3cf648=_0x3ff1e2?Object[_0xbae30a(0xd1)](_0x3ff1e2):[];if(_0x3cf648[_0xbae30a(0x10f)]===0x0)throw CliErrors['validation']('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x17dc25+'.');let _0x514538;const _0x3d9d8e=_0x14eb71[_0xbae30a(0xd3)](_0xbae30a(0xe1));if(_0x3d9d8e){if(!_0x3cf648[_0xbae30a(0x117)](_0x3d9d8e))throw CliErrors['validation'](_0xbae30a(0xf0)+_0x3d9d8e+_0xbae30a(0xd9)+_0x17dc25+'.\x20'+('Available:\x20'+_0x3cf648[_0xbae30a(0x118)](',\x20')));_0x514538=_0x3d9d8e;}else{if(_0x14eb71['nonInteractive'])throw CliErrors[_0xbae30a(0x12d)](_0xbae30a(0x11b));const _0x314ae0=await promptSelect(_0xbae30a(0x104),_0x3cf648);_0x514538=_0x3cf648[_0x314ae0]??_0x3cf648[0x0];}let _0xdd1864=normalizeHookFunctionNode(_0x14eb71['str'](_0xbae30a(0xcc)));if(!_0xdd1864){if(_0x14eb71[_0xbae30a(0xd3)](_0xbae30a(0xcc)))throw CliErrors['validation']('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x14eb71[_0xbae30a(0x11e)])throw CliErrors['validation'](_0xbae30a(0x119));const _0x29f8de=await promptSelect(_0xbae30a(0x112),['before','after']);_0xdd1864=[_0xbae30a(0xfd),_0xbae30a(0xca)][_0x29f8de]??_0xbae30a(0xfd);}return{'alias':_0x4f615e,'datasetCode':_0x2de30f,'datasetId':_0x4c2c12,'operationType':_0x514538,'functionNode':_0xdd1864};}async function promptSelect(_0x15a38c,_0x4ac5f5){const _0x428ad8=a36_0x1c0946;if(_0x4ac5f5['length']===0x1)return 0x0;for(const [_0x5fd435,_0x3ee12b]of _0x4ac5f5['entries']()){process['stderr'][_0x428ad8(0xcb)]('\x20\x20'+(_0x5fd435+0x1)+'.\x20'+_0x3ee12b+'\x0a');}const _0x2973ff=createInterface({'input':process[_0x428ad8(0x130)],'output':process[_0x428ad8(0x109)]});while(!![]){const _0x37c281=await new Promise(_0x20fcfb=>{_0x2973ff['question'](_0x15a38c+'\x20',_0x20fcfb);}),_0x13278d=Number['parseInt'](_0x37c281[_0x428ad8(0xf1)](),0xa);if(Number[_0x428ad8(0xd4)](_0x13278d)&&_0x13278d>=0x1&&_0x13278d<=_0x4ac5f5['length'])return _0x2973ff['close'](),_0x13278d-0x1;process[_0x428ad8(0x109)]['write'](_0x428ad8(0xfe)+_0x4ac5f5[_0x428ad8(0x10f)]+'.\x0a');}}function buildFilePath(_0x4211ed,_0x5e45d7,_0x1534c4,_0x41fc10){const _0xb8088e=a36_0x1c0946;if(_0x5e45d7===_0xb8088e(0xd5)){if(!_0x41fc10)throw CliErrors[_0xb8088e(0x12d)](_0xb8088e(0x131));const _0x31eb48=_0x41fc10[_0xb8088e(0xe6)]??_0x41fc10['datasetCode'];return join(_0x4211ed[_0xb8088e(0x11a)],_0xb8088e(0xd5),_0x31eb48,_0x41fc10[_0xb8088e(0x102)],_0x41fc10[_0xb8088e(0xf5)],_0x1534c4+_0xb8088e(0x101));}return join(_0x4211ed[_0xb8088e(0x11a)],_0x5e45d7,_0x1534c4+'.js');}export function generateTemplate(_0x4e1dd1,_0x586a07,_0x4e3f69,_0x30ea59,_0x4b683b){const _0x53d6ff=a36_0x1c0946,_0x4b4069=_0x30ea59?.[_0x53d6ff(0xf1)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x4ce654=getAppBaseUrl(_0x4e3f69),_0xae5630=_0x53d6ff(0xe3);if(_0x4e1dd1===_0x53d6ff(0xc7))return'/**\x0a\x20*\x20'+_0x4b4069+_0x53d6ff(0xe2)+_0x586a07+_0x53d6ff(0xd8)+_0x4ce654+_0x53d6ff(0xdf)+_0x4e3f69+_0x53d6ff(0x103)+_0x586a07+'.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22'+_0x586a07+_0x53d6ff(0x12f)+_0xae5630+'\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'+_0x586a07+_0x53d6ff(0xcd);if(_0x4e1dd1===_0x53d6ff(0xe9))return _0x53d6ff(0xea)+_0x4b4069+_0x53d6ff(0x110)+_0x586a07+_0x53d6ff(0x115)+_0x4e3f69+'/'+_0x586a07+_0x53d6ff(0xd8)+_0x4ce654+_0x53d6ff(0xdf)+_0x4e3f69+_0x53d6ff(0xc9)+_0x586a07+_0x53d6ff(0x126)+_0xae5630+_0x53d6ff(0xff)+_0x586a07+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x4b683b)throw CliErrors['validation'](_0x53d6ff(0xeb));const _0xaaaa0c=_0x4b683b[_0x53d6ff(0xe6)]??_0x4b683b[_0x53d6ff(0xef)],_0x26ad21=_0x4b683b[_0x53d6ff(0xf5)]===_0x53d6ff(0xfd)?_0x53d6ff(0xe5):_0x53d6ff(0x133),_0x5cdd0d=_0x4b683b[_0x53d6ff(0xf5)]===_0x53d6ff(0xfd)?_0x53d6ff(0x100):_0x53d6ff(0xde);return _0x53d6ff(0xea)+_0x4b4069+_0x53d6ff(0xf3)+_0x586a07+_0x53d6ff(0xf9)+_0x4e3f69+'/'+_0x4b683b[_0x53d6ff(0xef)]+'/'+_0x4b683b['operationType']+_0x53d6ff(0xd8)+_0x4ce654+'/data/dataset/'+_0x4b683b[_0x53d6ff(0x10d)]+'#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'+_0x4e3f69+'/HOOK/'+_0xaaaa0c+'/'+_0x4b683b[_0x53d6ff(0x102)]+'/'+_0x4b683b[_0x53d6ff(0xf5)]+'/'+_0x586a07+'.js\x0a\x20*\x20[触发节点]\x20'+_0x4b683b[_0x53d6ff(0xf5)]+'\x0a'+_0xae5630+_0x53d6ff(0x121)+_0x26ad21+_0x53d6ff(0xe4)+_0x5cdd0d+_0x53d6ff(0x11f)+_0x586a07+_0x53d6ff(0xcd);}
|
|
1
|
+
const a36_0x4719a2=a36_0x195b;(function(_0x4de90a,_0x11d061){const _0x2b4265=a36_0x195b,_0x2ef10f=_0x4de90a();while(!![]){try{const _0x552404=-parseInt(_0x2b4265(0x12a))/0x1+-parseInt(_0x2b4265(0x147))/0x2*(parseInt(_0x2b4265(0x180))/0x3)+parseInt(_0x2b4265(0x159))/0x4+-parseInt(_0x2b4265(0x148))/0x5+-parseInt(_0x2b4265(0x134))/0x6+-parseInt(_0x2b4265(0x16f))/0x7*(-parseInt(_0x2b4265(0x163))/0x8)+-parseInt(_0x2b4265(0x174))/0x9*(-parseInt(_0x2b4265(0x184))/0xa);if(_0x552404===_0x11d061)break;else _0x2ef10f['push'](_0x2ef10f['shift']());}catch(_0x51e92d){_0x2ef10f['push'](_0x2ef10f['shift']());}}}(a36_0x24df,0x49a9f));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a36_0x24df(){const _0x5e34d8=['8405289hveRzz','HOOK','map','.js\x0a','description','validation','filePath','Operation\x20type\x20(HOOK\x20only)','function-node','\x22\x20not\x20found.\x20','COMMON','operationType','3NbWrSb','Available:\x20','join','defaultApp','10KwVVFU','ENDPOINT','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','HOOK\x20requires\x20alias/operation/node\x20options.','No\x20datasets\x20found\x20for\x20this\x20app.','trim','Select\x20trigger\x20node:','/COMMON/','Function\x20name\x20(valid\x20JS\x20identifier)','/HOOK/','keys','scriptsRootDir','write','length','Select\x20dataset:','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','当前响应结果','operation-type','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','mergedCli','408743lhEAcn','/**\x0a\x20*\x20','includes','apiDir','nonInteractive','stderr','str','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','datasetcode','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','951138TjyotD','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','Trigger\x20node\x20(HOOK\x20only)','datasetCode','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','Select\x20operation\x20type:','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','utf8','修改后的请求参数','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','name','functionNode','Available\x20aliases:\x20','tableName','\x22.\x20','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','source','before','1116244eutpgj','733435jXxzFk','find','Dataset\x20not\x20found\x20for\x20code\x20\x22','Invalid\x20dataset\x20selection.','.js','after','/data/dataset/','bff','read','.js\x0a\x20*\x20[触发节点]\x20','\x0a\x20*\x20[平台配置]\x20','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Invalid\x20function\x20name\x20\x22','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','No\x20operation\x20types\x20found\x20for\x20dataset\x20','alias','question','412612gZxAiP','File\x20already\x20exists:\x20','No\x20model\x20aliases\x20found.\x20Run\x20`','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','parseInt','selectedAppName','create','isInteger','修改后的响应结果','\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','16EFPpZB',']\x20(','UNKNOWN','code','entries','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','type','当前请求参数','appCode','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','\x20function:\x20','\x22,\x20params\x20})\x0a','1878548WQHmwQ','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','string','profileName','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/'];a36_0x24df=function(){return _0x5e34d8;};return a36_0x24df();}function a36_0x195b(_0x39b426,_0x239b53){_0x39b426=_0x39b426-0x128;const _0x24df85=a36_0x24df();let _0x195b93=_0x24df85[_0x39b426];return _0x195b93;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':a36_0x4719a2(0x14f),'command':a36_0x4719a2(0x15f),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a36_0x4719a2(0x150),'flags':[{'name':a36_0x4719a2(0x169),'type':'string','required':!![],'enum':[a36_0x4719a2(0x17e),'ENDPOINT',a36_0x4719a2(0x175)],'description':'Script\x20type'},{'name':a36_0x4719a2(0x13f),'type':a36_0x4719a2(0x171),'required':!![],'description':a36_0x4719a2(0x18d)},{'name':'description','type':a36_0x4719a2(0x171),'description':'Script\x20description'},{'name':'alias','type':'string','description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a36_0x4719a2(0x132),'type':'string','description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a36_0x4719a2(0x196),'type':a36_0x4719a2(0x171),'description':a36_0x4719a2(0x17b)},{'name':a36_0x4719a2(0x17c),'type':a36_0x4719a2(0x171),'description':a36_0x4719a2(0x136),'enum':[a36_0x4719a2(0x146),a36_0x4719a2(0x14d)]}],async 'validate'(_0x133225){const _0x5027cc=a36_0x4719a2,_0x104599=_0x133225[_0x5027cc(0x130)]('name');if(!isValidBffFunctionName(_0x104599))throw CliErrors['validation'](_0x5027cc(0x154)+_0x104599+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x305fda){const _0x43f21c=a36_0x4719a2,_0x283e05=loadBffProjectConfig(_0x305fda[_0x43f21c(0x16b)]),_0x49731e=_0x305fda[_0x43f21c(0x130)](_0x43f21c(0x169)),_0x2a02cf=_0x305fda[_0x43f21c(0x130)]('name'),_0x11ea4d=_0x305fda['str']('description')||undefined,_0x48ee8f=_0x49731e===_0x43f21c(0x175)?await resolveHookOptions(_0x283e05,_0x305fda):undefined,_0x134504=buildFilePath(_0x283e05,_0x49731e,_0x2a02cf,_0x48ee8f);if(await fileExists(_0x134504))throw CliErrors[_0x43f21c(0x179)](_0x43f21c(0x15a)+_0x134504);await mkdir(dirname(_0x134504),{'recursive':!![]});const _0x274240=generateTemplate(_0x49731e,_0x2a02cf,_0x305fda[_0x43f21c(0x16b)],_0x11ea4d,_0x48ee8f);await writeFile(_0x134504,_0x274240,_0x43f21c(0x13c));const _0x3ef679={'type':_0x49731e,'name':_0x2a02cf,'path':_0x134504};if(_0x11ea4d)_0x3ef679[_0x43f21c(0x178)]=_0x11ea4d;if(_0x48ee8f){if(_0x48ee8f['alias'])_0x3ef679[_0x43f21c(0x157)]=_0x48ee8f[_0x43f21c(0x157)];_0x3ef679[_0x43f21c(0x137)]=_0x48ee8f[_0x43f21c(0x137)],_0x3ef679['operationType']=_0x48ee8f[_0x43f21c(0x17f)],_0x3ef679[_0x43f21c(0x140)]=_0x48ee8f[_0x43f21c(0x140)];}return{'ok':!![],'data':_0x3ef679,'message':'Created\x20'+_0x49731e+_0x43f21c(0x16d)+_0x2a02cf};}};async function resolveHookOptions(_0x1a951c,_0x568343){const _0xe81234=a36_0x4719a2,_0x168d7e=resolveApiModelSource(_0x568343['apiDir'],_0x568343[_0xe81234(0x16b)],_0x568343[_0xe81234(0x15e)]||_0x568343['mergedCli']?.['currentApp']||_0x568343[_0xe81234(0x129)]?.[_0xe81234(0x183)]),_0x22a54b=loadAliasMap(_0x568343['apiDir'],undefined,_0x168d7e[_0xe81234(0x17a)],_0x168d7e[_0xe81234(0x172)]),_0x5c4fff=_0x22a54b['length']>0x0;let _0x1191b6,_0x538e48,_0x407cd8;const _0x52fe52=_0x568343[_0xe81234(0x130)]('alias'),_0x1b9f77=_0x568343[_0xe81234(0x130)](_0xe81234(0x132));if(_0x52fe52){const _0x33e2f0=resolveAlias(_0x568343[_0xe81234(0x12d)],_0x52fe52,undefined,_0x168d7e[_0xe81234(0x17a)],_0x168d7e[_0xe81234(0x172)]);if(!_0x33e2f0){const _0x5e6783=_0x5c4fff?_0xe81234(0x141)+_0x22a54b[_0xe81234(0x176)](_0x4f2da2=>_0x4f2da2[_0xe81234(0x157)])['join'](',\x20'):_0xe81234(0x15b)+CLI_BIN_NAME+_0xe81234(0x131);throw CliErrors[_0xe81234(0x179)]('Alias\x20\x22'+_0x52fe52+_0xe81234(0x17d)+_0x5e6783);}_0x1191b6=_0x52fe52,_0x538e48=_0x33e2f0;}else{if(_0x1b9f77){_0x538e48=_0x1b9f77;const _0x31a300=_0x22a54b['find'](_0x28338a=>_0x28338a[_0xe81234(0x137)]===_0x1b9f77);_0x1191b6=_0x31a300?.[_0xe81234(0x157)];}else{if(_0x568343[_0xe81234(0x12e)])throw CliErrors[_0xe81234(0x179)](_0xe81234(0x153));else{if(_0x5c4fff){const _0x149083=_0x22a54b[_0xe81234(0x176)](_0x3cc6eb=>_0x3cc6eb['alias']+'\x20('+_0x3cc6eb[_0xe81234(0x142)]+')'),_0x3b9b99=await promptSelect(_0xe81234(0x193),_0x149083),_0x51669d=_0x22a54b[_0x3b9b99];if(!_0x51669d)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x14b));_0x1191b6=_0x51669d['alias'],_0x538e48=_0x51669d['datasetCode'];}else{const _0x713b8=await listDatasets(_0x568343[_0xe81234(0x16b)]);if(_0x713b8[_0xe81234(0x192)]===0x0)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x189));const _0x31b30b=_0x713b8['map'](_0x3a78d3=>_0x3a78d3['name']+'\x20['+(_0x3a78d3[_0xe81234(0x145)]??_0xe81234(0x165))+_0xe81234(0x164)+_0x3a78d3[_0xe81234(0x166)]+')'),_0x46b0a3=await promptSelect(_0xe81234(0x193),_0x31b30b),_0x2a2011=_0x713b8[_0x46b0a3];if(!_0x2a2011)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x14b));_0x538e48=_0x2a2011['code'],_0x1191b6=undefined;}}}}const _0x35fa51=await listDatasets(_0x568343[_0xe81234(0x16b)]),_0x2ad824=_0x35fa51[_0xe81234(0x149)](_0x463e6e=>_0x463e6e['code']===_0x538e48);if(!_0x2ad824)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x14a)+_0x538e48+_0xe81234(0x143)+(_0x1191b6?_0xe81234(0x16c)+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x407cd8=_0x2ad824['id'];const _0xe4f127=_0x1191b6??_0x538e48,_0xd00f03=await listBffDatasetOperations(_0x568343['appCode'],_0x407cd8),_0x52f16d=_0xd00f03?Object[_0xe81234(0x18f)](_0xd00f03):[];if(_0x52f16d[_0xe81234(0x192)]===0x0)throw CliErrors[_0xe81234(0x179)](_0xe81234(0x156)+_0xe4f127+'.');let _0x5e2a11;const _0x252219=_0x568343[_0xe81234(0x130)](_0xe81234(0x196));if(_0x252219){if(!_0x52f16d[_0xe81234(0x12c)](_0x252219))throw CliErrors['validation']('Operation\x20type\x20\x22'+_0x252219+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0xe4f127+'.\x20'+(_0xe81234(0x181)+_0x52f16d[_0xe81234(0x182)](',\x20')));_0x5e2a11=_0x252219;}else{if(_0x568343[_0xe81234(0x12e)])throw CliErrors['validation']('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x1aad25=await promptSelect(_0xe81234(0x13a),_0x52f16d);_0x5e2a11=_0x52f16d[_0x1aad25]??_0x52f16d[0x0];}let _0x44aef8=normalizeHookFunctionNode(_0x568343[_0xe81234(0x130)]('function-node'));if(!_0x44aef8){if(_0x568343[_0xe81234(0x130)](_0xe81234(0x17c)))throw CliErrors[_0xe81234(0x179)](_0xe81234(0x135));if(_0x568343[_0xe81234(0x12e)])throw CliErrors[_0xe81234(0x179)](_0xe81234(0x170));const _0x2dabd8=await promptSelect(_0xe81234(0x18b),[_0xe81234(0x146),_0xe81234(0x14d)]);_0x44aef8=[_0xe81234(0x146),_0xe81234(0x14d)][_0x2dabd8]??_0xe81234(0x146);}return{'alias':_0x1191b6,'datasetCode':_0x538e48,'datasetId':_0x407cd8,'operationType':_0x5e2a11,'functionNode':_0x44aef8};}async function promptSelect(_0x5ef2e3,_0x26d90f){const _0x5967c8=a36_0x4719a2;if(_0x26d90f[_0x5967c8(0x192)]===0x1)return 0x0;for(const [_0x3f3c68,_0x4e57f3]of _0x26d90f[_0x5967c8(0x167)]()){process[_0x5967c8(0x12f)][_0x5967c8(0x191)]('\x20\x20'+(_0x3f3c68+0x1)+'.\x20'+_0x4e57f3+'\x0a');}const _0x2ff64b=createInterface({'input':process['stdin'],'output':process[_0x5967c8(0x12f)]});while(!![]){const _0x7e9066=await new Promise(_0x3f089b=>{const _0x50aacb=_0x5967c8;_0x2ff64b[_0x50aacb(0x158)](_0x5ef2e3+'\x20',_0x3f089b);}),_0x20c122=Number[_0x5967c8(0x15d)](_0x7e9066[_0x5967c8(0x18a)](),0xa);if(Number[_0x5967c8(0x160)](_0x20c122)&&_0x20c122>=0x1&&_0x20c122<=_0x26d90f[_0x5967c8(0x192)])return _0x2ff64b['close'](),_0x20c122-0x1;process['stderr'][_0x5967c8(0x191)](_0x5967c8(0x128)+_0x26d90f['length']+'.\x0a');}}function buildFilePath(_0x358b31,_0xe97b74,_0x12bbca,_0x509d61){const _0x434761=a36_0x4719a2;if(_0xe97b74===_0x434761(0x175)){if(!_0x509d61)throw CliErrors[_0x434761(0x179)](_0x434761(0x188));const _0x16def3=_0x509d61['alias']??_0x509d61['datasetCode'];return join(_0x358b31['scriptsRootDir'],_0x434761(0x175),_0x16def3,_0x509d61[_0x434761(0x17f)],_0x509d61['functionNode'],_0x12bbca+_0x434761(0x14c));}return join(_0x358b31[_0x434761(0x190)],_0xe97b74,_0x12bbca+_0x434761(0x14c));}export function generateTemplate(_0x32c5b4,_0x2e684f,_0x31def5,_0xd2b75e,_0x3b0ac1){const _0x130979=a36_0x4719a2,_0x64058f=_0xd2b75e?.[_0x130979(0x18a)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x33ff83=getAppBaseUrl(_0x31def5),_0x42b0eb=_0x130979(0x155);if(_0x32c5b4===_0x130979(0x17e))return _0x130979(0x12b)+_0x64058f+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x2e684f+_0x130979(0x152)+_0x33ff83+_0x130979(0x173)+_0x31def5+_0x130979(0x18c)+_0x2e684f+_0x130979(0x138)+_0x2e684f+_0x130979(0x16e)+_0x42b0eb+'\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'+_0x2e684f+_0x130979(0x168);if(_0x32c5b4===_0x130979(0x185))return _0x130979(0x12b)+_0x64058f+_0x130979(0x13b)+_0x2e684f+_0x130979(0x144)+_0x31def5+'/'+_0x2e684f+_0x130979(0x152)+_0x33ff83+_0x130979(0x173)+_0x31def5+'/ENDPOINT/'+_0x2e684f+_0x130979(0x177)+_0x42b0eb+_0x130979(0x162)+_0x2e684f+_0x130979(0x168);if(!_0x3b0ac1)throw CliErrors[_0x130979(0x179)](_0x130979(0x194));const _0x443241=_0x3b0ac1['alias']??_0x3b0ac1['datasetCode'],_0x3e25b3=_0x3b0ac1[_0x130979(0x140)]===_0x130979(0x146)?_0x130979(0x16a):_0x130979(0x195),_0x58f4ef=_0x3b0ac1[_0x130979(0x140)]==='before'?_0x130979(0x13d):_0x130979(0x161);return _0x130979(0x12b)+_0x64058f+_0x130979(0x139)+_0x2e684f+_0x130979(0x15c)+_0x31def5+'/'+_0x3b0ac1[_0x130979(0x137)]+'/'+_0x3b0ac1['operationType']+_0x130979(0x152)+_0x33ff83+_0x130979(0x14e)+_0x3b0ac1['datasetId']+_0x130979(0x133)+_0x31def5+_0x130979(0x18e)+_0x443241+'/'+_0x3b0ac1[_0x130979(0x17f)]+'/'+_0x3b0ac1[_0x130979(0x140)]+'/'+_0x2e684f+_0x130979(0x151)+_0x3b0ac1[_0x130979(0x140)]+'\x0a'+_0x42b0eb+_0x130979(0x187)+_0x3e25b3+_0x130979(0x186)+_0x58f4ef+_0x130979(0x13e)+_0x2e684f+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a37_0x5d69(){const _0x2cbd28=['delete','No\x20lock\x20entry\x20found\x20for\x20\x22','length','104570fHlRSp','\x20(local\x20file\x20moved\x20to\x20trash)','Deleted\x20','target','Backend\x20Function\x20lock\x20file\x20not\x20found.','3410634hBbBXy','parse','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','bff','high-risk-write','2334495fCDpNZ','stringify','3122aFHhys','find','60224NHTsWG','Local\x20delete\x20not\x20settled\x20for\x20','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','Function\x20not\x20found:\x20','projectRoot','295XQoDfP','936vbILWK','str','includes','POST','lockFilePath','1067JxXjkr','630723yZCdZc','join','split','map','validation','string','14tuudjv','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','replace','\x22\x20not\x20found\x20after\x20ensureLockScope.','apps','<timestamp>','remoteId','appCode','functions','trashDir','trashedTo','31828056ElLIJc','toISOString','scriptsRoot','20IhqTEs'];a37_0x5d69=function(){return _0x2cbd28;};return a37_0x5d69();}const a37_0x54c4cc=a37_0x2b17;(function(_0x1ef014,_0x52512a){const _0x70f5bf=a37_0x2b17,_0x1e980f=_0x1ef014();while(!![]){try{const _0x40c811=parseInt(_0x70f5bf(0xb5))/0x1*(parseInt(_0x70f5bf(0xae))/0x2)+-parseInt(_0x70f5bf(0xbc))/0x3*(-parseInt(_0x70f5bf(0xd0))/0x4)+parseInt(_0x70f5bf(0xac))/0x5+parseInt(_0x70f5bf(0xa6))/0x6*(parseInt(_0x70f5bf(0xc2))/0x7)+parseInt(_0x70f5bf(0xb0))/0x8*(-parseInt(_0x70f5bf(0xb6))/0x9)+parseInt(_0x70f5bf(0xa1))/0xa*(parseInt(_0x70f5bf(0xbb))/0xb)+-parseInt(_0x70f5bf(0xcd))/0xc;if(_0x40c811===_0x52512a)break;else _0x1e980f['push'](_0x1e980f['shift']());}catch(_0x2381b0){_0x1e980f['push'](_0x1e980f['shift']());}}}(a37_0x5d69,0xa991c));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';export const bffDelete={'service':a37_0x54c4cc(0xaa),'command':'delete','description':a37_0x54c4cc(0xc3),'risk':a37_0x54c4cc(0xab),'flags':[{'name':'target','type':a37_0x54c4cc(0xc1),'required':!![],'description':'Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name'}],async 'validate'(_0x4eb22c){const _0x56d65c=a37_0x54c4cc,_0x5d3557=loadBffProjectConfig(_0x4eb22c[_0x56d65c(0xc9)]),_0x5a7f6f=await readBffLockFile(_0x5d3557[_0x56d65c(0xba)]);if(!_0x5a7f6f)throw CliErrors[_0x56d65c(0xc0)](_0x56d65c(0xb2));},async 'dryRun'(_0x23d70b){const _0x1149c8=a37_0x54c4cc,_0x29adbe=loadBffProjectConfig(_0x23d70b['appCode']),_0x16431c=await readBffLockFile(_0x29adbe[_0x1149c8(0xba)]);if(!_0x16431c)throw CliErrors['validation'](_0x1149c8(0xa5));const {appLock:_0x1efb2b}=ensureLockScope(_0x16431c,_0x23d70b[_0x1149c8(0xc9)],_0x29adbe[_0x1149c8(0xcf)],_0x1149c8(0xd1)),_0x394528=_0x23d70b['str'](_0x1149c8(0xa4)),_0x4fe0fd=Object['keys'](_0x1efb2b[_0x1149c8(0xca)]),_0x37ac18=resolveDeleteTarget(_0x394528,_0x4fe0fd),_0x3758a3=_0x1efb2b[_0x1149c8(0xca)][_0x37ac18];if(!_0x3758a3)throw CliErrors['validation'](_0x1149c8(0x9f)+_0x37ac18+'\x22.');const _0x3a331c=resolveLocalFilePathFromLockKey(_0x29adbe,_0x37ac18),_0x79c818=relative(_0x29adbe[_0x1149c8(0xb4)],_0x3a331c),_0x357650=join(_0x29adbe[_0x1149c8(0xcb)],_0x1149c8(0xc7),_0x79c818);return{'method':_0x1149c8(0xb9),'url':'/api/management/library/scripts/delete','body':{'appCode':_0x23d70b['appCode'],'target':_0x37ac18,'remoteId':_0x3758a3[_0x1149c8(0xc8)],'localFilePath':_0x3a331c,'trashedPath':_0x357650},'description':'Would\x20delete\x20'+_0x37ac18+_0x1149c8(0xa8)};},async 'execute'(_0x2d5ef6){const _0x17165d=a37_0x54c4cc,_0x3d0a8a=loadBffProjectConfig(_0x2d5ef6['appCode']),_0x76dac7=await readBffLockFile(_0x3d0a8a['lockFilePath']);if(!_0x76dac7)throw CliErrors[_0x17165d(0xc0)](_0x17165d(0xa5));const {lockData:_0x3f1763,appLock:_0x2a4554}=ensureLockScope(_0x76dac7,_0x2d5ef6[_0x17165d(0xc9)],_0x3d0a8a[_0x17165d(0xcf)],_0x17165d(0xd1)),_0x13cb63=JSON[_0x17165d(0xa7)](JSON[_0x17165d(0xad)](_0x3f1763)),_0x46cb12=_0x13cb63[_0x17165d(0xc6)][_0x2d5ef6[_0x17165d(0xc9)]];if(!_0x46cb12)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x2d5ef6[_0x17165d(0xc9)]+_0x17165d(0xc5));const _0x35a848=_0x2d5ef6[_0x17165d(0xb7)]('target'),_0x5f2143=Object['keys'](_0x46cb12[_0x17165d(0xca)]),_0x55c639=resolveDeleteTarget(_0x35a848,_0x5f2143),_0x5de02a=_0x46cb12[_0x17165d(0xca)][_0x55c639];if(!_0x5de02a)throw CliErrors['validation']('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x55c639+'\x22.');await deleteBffScript(_0x5de02a['remoteId']),delete _0x46cb12[_0x17165d(0xca)][_0x55c639],_0x46cb12['lastSync']=new Date()[_0x17165d(0xce)](),await writeBffLockFile(_0x3d0a8a[_0x17165d(0xba)],_0x13cb63);const _0x1706f3=resolveLocalFilePathFromLockKey(_0x3d0a8a,_0x55c639);let _0x4dbe4a;await fileExists(_0x1706f3)&&(_0x4dbe4a=await moveToTrash(_0x3d0a8a[_0x17165d(0xb4)],_0x3d0a8a[_0x17165d(0xcb)],_0x1706f3),await cleanupEmptyDirectories(dirname(_0x1706f3),_0x3d0a8a['scriptsRootDir']));await waitForDeleteSettlement(_0x3d0a8a['lockFilePath'],_0x2d5ef6['appCode'],_0x55c639,_0x1706f3),await sleep(0x96);const _0x4b0b41={'deleted':_0x55c639,'remoteId':_0x5de02a[_0x17165d(0xc8)]};if(_0x4dbe4a)_0x4b0b41[_0x17165d(0xcc)]=_0x4dbe4a;return{'ok':!![],'data':_0x4b0b41,'message':_0x17165d(0xa3)+_0x55c639+(_0x4dbe4a?_0x17165d(0xa2):'')};}};function resolveDeleteTarget(_0x4a316d,_0x44b28f){const _0x5377b8=a37_0x54c4cc;if(_0x4a316d[_0x5377b8(0xb8)]('/')){const _0x176610=_0x44b28f[_0x5377b8(0xaf)](_0x29b2b0=>_0x29b2b0===_0x4a316d);if(!_0x176610)throw CliErrors['validation'](_0x5377b8(0xb3)+_0x4a316d);return _0x176610;}const _0x25bad5=_0x44b28f['filter'](_0x27d831=>_0x27d831[_0x5377b8(0xbe)]('/')['at'](-0x1)===_0x4a316d);if(_0x25bad5['length']===0x0)throw CliErrors[_0x5377b8(0xc0)](_0x5377b8(0xb3)+_0x4a316d);if(_0x25bad5[_0x5377b8(0xa0)]>0x1)throw CliErrors['validation']('Multiple\x20functions\x20match\x20\x22'+_0x4a316d+_0x5377b8(0xa9)+_0x25bad5[_0x5377b8(0xbf)](_0x509fac=>'\x20\x20-\x20'+_0x509fac)[_0x5377b8(0xbd)]('\x0a'));return _0x25bad5[0x0];}function a37_0x2b17(_0x2663d2,_0x51ee24){_0x2663d2=_0x2663d2-0x9f;const _0x5d696a=a37_0x5d69();let _0x2b1713=_0x5d696a[_0x2663d2];return _0x2b1713;}async function moveToTrash(_0x4934a1,_0x14f018,_0x5614d2){const _0xfb9101=a37_0x54c4cc,_0x1daced=new Date()[_0xfb9101(0xce)]()[_0xfb9101(0xc4)](/[:.]/g,'-'),_0x1650c6=relative(_0x4934a1,_0x5614d2),_0x340623=join(_0x14f018,_0x1daced,_0x1650c6);return await mkdir(dirname(_0x340623),{'recursive':!![]}),await rename(_0x5614d2,_0x340623),_0x340623;}async function cleanupEmptyDirectories(_0x22efb8,_0x349ea7){const _0xe401ba=a37_0x54c4cc;let _0x47f3f8=resolve(_0x22efb8);const _0x4b1050=resolve(_0x349ea7);while(_0x47f3f8['startsWith'](''+_0x4b1050+sep)||_0x47f3f8===_0x4b1050){if(_0x47f3f8===_0x4b1050)return;try{const _0x32999f=await readdir(_0x47f3f8);if(_0x32999f[_0xe401ba(0xa0)]>0x0)return;await rmdir(_0x47f3f8);}catch{return;}_0x47f3f8=dirname(_0x47f3f8);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x4282d0,_0x5c3743,_0x82c189,_0x44bd29){const _0x1c0ce1=a37_0x54c4cc;for(let _0x2054c2=0x0;_0x2054c2<DELETE_SETTLE_RETRY_COUNT;_0x2054c2+=0x1){const _0x2b632f=await readBffLockFile(_0x4282d0),_0x30693e=!!_0x2b632f?.[_0x1c0ce1(0xc6)]?.[_0x5c3743]?.['functions']?.[_0x82c189],_0x576a8=await fileExists(_0x44bd29);if(!_0x30693e&&!_0x576a8)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x1c0ce1(0xb1)+_0x82c189+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x590cf7=a38_0x2cd4;function a38_0x2cd4(_0x215ee3,_0x4b2deb){_0x215ee3=_0x215ee3-0x116;const _0x27389e=a38_0x2738();let _0x2cd410=_0x27389e[_0x215ee3];return _0x2cd410;}(function(_0x60c81b,_0x111fd5){const _0x54b84e=a38_0x2cd4,_0x57a720=_0x60c81b();while(!![]){try{const _0x2e91d2=-parseInt(_0x54b84e(0x12d))/0x1+parseInt(_0x54b84e(0x124))/0x2+parseInt(_0x54b84e(0x127))/0x3+parseInt(_0x54b84e(0x12f))/0x4*(-parseInt(_0x54b84e(0x117))/0x5)+parseInt(_0x54b84e(0x130))/0x6*(-parseInt(_0x54b84e(0x120))/0x7)+parseInt(_0x54b84e(0x123))/0x8*(parseInt(_0x54b84e(0x11a))/0x9)+-parseInt(_0x54b84e(0x119))/0xa*(-parseInt(_0x54b84e(0x12b))/0xb);if(_0x2e91d2===_0x111fd5)break;else _0x57a720['push'](_0x57a720['shift']());}catch(_0x144ade){_0x57a720['push'](_0x57a720['shift']());}}}(a38_0x2738,0xb14bf));import{getBffScriptInfo}from'../../core/api-client.js';function a38_0x2738(){const _0x2f7e0f=['scriptContent','3052050zcxgXb','scriptType','detail','Return\x20full\x20raw\x20script\x20object','33MLHcGf','bool','419301yHkjLy','functionName','4aWGtld','587436RqDCEQ','num','appCode','read','3699830EGWWWw','verbose','193090YOMQFL','11088HmqsEC','number','(none)','Script\x20ID','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','updateUserName','7RczFNZ','description','version','5192WbYidS','217070ytzAue','boolean'];a38_0x2738=function(){return _0x2f7e0f;};return a38_0x2738();}export const bffDetail={'service':'bff','command':a38_0x590cf7(0x129),'description':a38_0x590cf7(0x11e),'risk':a38_0x590cf7(0x116),'flags':[{'name':'id','type':a38_0x590cf7(0x11b),'required':!![],'description':a38_0x590cf7(0x11d)},{'name':a38_0x590cf7(0x118),'type':a38_0x590cf7(0x125),'description':a38_0x590cf7(0x12a)}],async 'execute'(_0x1673ad){const _0x192213=a38_0x590cf7,_0x26fe17=await getBffScriptInfo(_0x1673ad[_0x192213(0x131)]('id')),_0x46c68f=_0x1673ad[_0x192213(0x12c)]('verbose');if(_0x46c68f)return{'ok':!![],'data':_0x26fe17};return{'ok':!![],'data':{'id':_0x26fe17['id'],'functionName':_0x26fe17[_0x192213(0x12e)]??'','version':_0x26fe17[_0x192213(0x122)]??'','updateUserName':_0x26fe17[_0x192213(0x11f)]??'','appCode':_0x26fe17[_0x192213(0x132)],'scriptType':_0x26fe17[_0x192213(0x128)],'description':_0x26fe17[_0x192213(0x121)]||_0x192213(0x11c),'createdTime':_0x26fe17['createdTime']??'','updatedTime':_0x26fe17['updatedTime']??'','scriptContent':_0x26fe17[_0x192213(0x126)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a39_0x1ea0(_0x3156b1,_0x4537f2){_0x3156b1=_0x3156b1-0xb0;const _0x2fee28=a39_0x2fee();let _0x1ea010=_0x2fee28[_0x3156b1];return _0x1ea010;}function a39_0x2fee(){const _0x470ae2=['3070571nqRlbB','38XqBxTm','9138942xuuMZj','53980fBAPwq','2997344IzcfIJ','111909PXAPcy','115ticHYn','27848ggaDNz','2359626JEUEnT'];a39_0x2fee=function(){return _0x470ae2;};return a39_0x2fee();}(function(_0x457876,_0x1ec8ae){const _0x2addde=a39_0x1ea0,_0x119040=_0x457876();while(!![]){try{const _0x6232c7=-parseInt(_0x2addde(0xb4))/0x1+parseInt(_0x2addde(0xb2))/0x2*(-parseInt(_0x2addde(0xb6))/0x3)+-parseInt(_0x2addde(0xb8))/0x4*(parseInt(_0x2addde(0xb7))/0x5)+parseInt(_0x2addde(0xb0))/0x6+-parseInt(_0x2addde(0xb1))/0x7+parseInt(_0x2addde(0xb5))/0x8+parseInt(_0x2addde(0xb3))/0x9;if(_0x6232c7===_0x1ec8ae)break;else _0x119040['push'](_0x119040['shift']());}catch(_0x52fe62){_0x119040['push'](_0x119040['shift']());}}}(a39_0x2fee,0x66fe5));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a40_0x8799(){const _0x3cc548=['2702120AkpmUh','69372irPjXB','Filter\x20by\x20script\x20name','str','List\x20Backend\x20Function\x20scripts','818178tckpTN','COMMON','(unnamed)','appCode','type','8iYcKJF','1012lOjBpg','Return\x20full\x20script\x20objects','Script\x20type\x20filter','235lOOkyK','scriptType','299cDllYb','bff','No\x20Backend\x20Function\x20scripts\x20found.','7qAzpwM','string','verbose','679RsBFEI','1963608dLTNNq','4129356xBWPuG','functionName','18vINRif','25302xUawcr','description','map','length','name','read'];a40_0x8799=function(){return _0x3cc548;};return a40_0x8799();}const a40_0x42fd07=a40_0x5c13;(function(_0x5acddc,_0x53c5a8){const _0x388ba4=a40_0x5c13,_0x2df186=_0x5acddc();while(!![]){try{const _0x3c9324=parseInt(_0x388ba4(0xb6))/0x1*(parseInt(_0x388ba4(0xab))/0x2)+parseInt(_0x388ba4(0xa5))/0x3*(-parseInt(_0x388ba4(0xaa))/0x4)+parseInt(_0x388ba4(0xae))/0x5*(parseInt(_0x388ba4(0xbb))/0x6)+parseInt(_0x388ba4(0xb3))/0x7*(parseInt(_0x388ba4(0xb7))/0x8)+parseInt(_0x388ba4(0xba))/0x9*(parseInt(_0x388ba4(0xa0))/0xa)+-parseInt(_0x388ba4(0xb8))/0xb+-parseInt(_0x388ba4(0xa1))/0xc*(parseInt(_0x388ba4(0xb0))/0xd);if(_0x3c9324===_0x53c5a8)break;else _0x2df186['push'](_0x2df186['shift']());}catch(_0xde0422){_0x2df186['push'](_0x2df186['shift']());}}}(a40_0x8799,0x42dad));import{listBffScripts}from'../../core/api-client.js';function a40_0x5c13(_0x5ee889,_0xc4a41d){_0x5ee889=_0x5ee889-0x9e;const _0x8799cf=a40_0x8799();let _0x5c137b=_0x8799cf[_0x5ee889];return _0x5c137b;}export const bffList={'service':a40_0x42fd07(0xb1),'command':'list','description':a40_0x42fd07(0xa4),'risk':a40_0x42fd07(0x9f),'flags':[{'name':a40_0x42fd07(0xa9),'type':'string','description':a40_0x42fd07(0xad),'default':'ENDPOINT','enum':['ENDPOINT',a40_0x42fd07(0xa6)]},{'name':'name','type':a40_0x42fd07(0xb4),'description':a40_0x42fd07(0xa2)},{'name':a40_0x42fd07(0xb5),'type':'boolean','description':a40_0x42fd07(0xac)}],async 'execute'(_0x386019){const _0x2e1ab4=a40_0x42fd07,_0x334ebb=await listBffScripts(_0x386019[_0x2e1ab4(0xa8)],_0x386019[_0x2e1ab4(0xa3)]('type'),{'scriptName':_0x386019['str'](_0x2e1ab4(0x9e))||undefined}),_0x3a6828=_0x386019['bool'](_0x2e1ab4(0xb5));return{'ok':!![],'data':_0x3a6828?_0x334ebb:_0x334ebb[_0x2e1ab4(0xbd)](_0x5cbe11=>({'id':_0x5cbe11['id'],'functionName':_0x5cbe11[_0x2e1ab4(0xb9)]??'','description':_0x5cbe11[_0x2e1ab4(0xbc)]||_0x2e1ab4(0xa7),'scriptType':_0x5cbe11[_0x2e1ab4(0xaf)]})),'message':_0x334ebb[_0x2e1ab4(0xbe)]===0x0?_0x2e1ab4(0xb2):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x282398=a41_0x1377;(function(_0x15aaa2,_0x4841e1){const _0xcdcbff=a41_0x1377,_0xb8f2f9=_0x15aaa2();while(!![]){try{const _0x1b6cc4=-parseInt(_0xcdcbff(0xf6))/0x1+-parseInt(_0xcdcbff(0x101))/0x2+-parseInt(_0xcdcbff(0x11a))/0x3+parseInt(_0xcdcbff(0xf5))/0x4+-parseInt(_0xcdcbff(0xf4))/0x5*(-parseInt(_0xcdcbff(0x10e))/0x6)+-parseInt(_0xcdcbff(0x104))/0x7*(parseInt(_0xcdcbff(0x110))/0x8)+parseInt(_0xcdcbff(0xfa))/0x9;if(_0x1b6cc4===_0x4841e1)break;else _0xb8f2f9['push'](_0xb8f2f9['shift']());}catch(_0x3cc071){_0xb8f2f9['push'](_0xb8f2f9['shift']());}}}(a41_0x5656,0x51d04));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a41_0x5656(){const _0x73431b=['ERROR','bff','Maximum\x20log\x20lines\x20to\x20return\x20(1-','78WMrJkx','--limit\x20must\x20be\x20between\x201\x20and\x20','62664UeGcHm','number','\x20must\x20be\x20a\x20positive\x20integer.','string','Found\x20','read','keyword','length','flag','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','471345hbcQKZ','num','end-time','DEBUG','INFO','toUpperCase','limit','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','69830SXNxrB','2125892wudBUG','286878wKRUGf','str','level','--start-time','3534786bmeUmP','validation','start-time','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','Filter\x20by\x20log\x20level','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','--end-time','73726JMapoQ','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','since','259MBvtrh','trim','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','isSafeInteger','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','\x20Backend\x20Function\x20log\x20line(s).','--limit'];a41_0x5656=function(){return _0x73431b;};return a41_0x5656();}const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a41_0x282398(0x11d),a41_0x282398(0x11e),'WARN',a41_0x282398(0x10b)];function a41_0x1377(_0x53bdda,_0x3b5879){_0x53bdda=_0x53bdda-0xf1;const _0x5656e3=a41_0x5656();let _0x13777f=_0x5656e3[_0x53bdda];return _0x13777f;}export function resolveBffLogQuery(_0x346588,_0x260817=Date['now']()){const _0x7c944f=a41_0x282398,_0x20ec34=_0x346588[_0x7c944f(0x118)](_0x7c944f(0x103)),_0x22f8c9=_0x346588[_0x7c944f(0x118)](_0x7c944f(0xfc)),_0x1a077b=_0x346588[_0x7c944f(0x118)](_0x7c944f(0x11c));if(_0x20ec34!==undefined&&_0x22f8c9!==undefined)throw CliErrors[_0x7c944f(0xfb)](_0x7c944f(0xfd));const _0x34091e=_0x1a077b===undefined?_0x260817:readPositiveInteger(_0x346588[_0x7c944f(0x11b)](_0x7c944f(0x11c)),_0x7c944f(0x100)),_0x1f7bfe=_0x22f8c9===undefined?_0x34091e-readSinceMinutes(_0x346588)*0xea60:readPositiveInteger(_0x346588[_0x7c944f(0x11b)]('start-time'),_0x7c944f(0xf9));if(_0x1f7bfe<=0x0)throw CliErrors[_0x7c944f(0xfb)](_0x7c944f(0x102));if(_0x1f7bfe>_0x34091e)throw CliErrors[_0x7c944f(0xfb)](_0x7c944f(0x119));const _0x55c774=readPositiveInteger(_0x346588[_0x7c944f(0x11b)](_0x7c944f(0xf2),DEFAULT_LIMIT),_0x7c944f(0x10a));if(_0x55c774>MAX_LIMIT)throw CliErrors[_0x7c944f(0xfb)](_0x7c944f(0x10f)+MAX_LIMIT+'.');const _0x377153=_0x346588['str'](_0x7c944f(0xf8))['trim']()[_0x7c944f(0xf1)]()||undefined,_0x24e466=_0x346588[_0x7c944f(0xf7)](_0x7c944f(0x116))[_0x7c944f(0x105)]()||undefined;return{'appCode':_0x346588['appCode'],'startTime':_0x1f7bfe,'endTime':_0x34091e,..._0x22f8c9===undefined?{'sinceMinutes':readSinceMinutes(_0x346588)}:{},..._0x377153?{'level':_0x377153}:{},..._0x24e466?{'keyword':_0x24e466}:{},'limit':_0x55c774};}function readSinceMinutes(_0x9c4347){const _0x74d79e=a41_0x282398;return readPositiveInteger(_0x9c4347[_0x74d79e(0x11b)](_0x74d79e(0x103),DEFAULT_SINCE_MINUTES),'--since');}function readPositiveInteger(_0x1cf443,_0x3eb33f){const _0x87c007=a41_0x282398;if(!Number[_0x87c007(0x107)](_0x1cf443)||_0x1cf443<=0x0)throw CliErrors[_0x87c007(0xfb)](_0x3eb33f+_0x87c007(0x112));return _0x1cf443;}export const bffLogs={'service':a41_0x282398(0x10c),'command':'logs','description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':a41_0x282398(0x115),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a41_0x282398(0x103),'type':a41_0x282398(0x111),'description':a41_0x282398(0x108)+DEFAULT_SINCE_MINUTES+')'},{'name':a41_0x282398(0xfc),'type':a41_0x282398(0x111),'description':a41_0x282398(0xff)},{'name':'end-time','type':a41_0x282398(0x111),'description':'Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)'},{'name':a41_0x282398(0xf8),'type':'string','description':a41_0x282398(0xfe),'enum':LOG_LEVELS},{'name':a41_0x282398(0x116),'type':a41_0x282398(0x113),'description':a41_0x282398(0xf3)},{'name':a41_0x282398(0xf2),'type':a41_0x282398(0x111),'description':a41_0x282398(0x10d)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x209bb4){resolveBffLogQuery(_0x209bb4);},async 'execute'(_0x2b69c1){const _0x3bde90=a41_0x282398,_0x55dc5b=resolveBffLogQuery(_0x2b69c1),{sinceMinutes:_0x46ba78,..._0x5c1054}=_0x55dc5b,_0x365873=await searchBffScriptLogs(_0x5c1054);return{'ok':!![],'data':{'query':_0x55dc5b,'count':_0x365873[_0x3bde90(0x117)],'logs':_0x365873},'message':_0x365873[_0x3bde90(0x117)]===0x0?_0x3bde90(0x106):_0x3bde90(0x114)+_0x365873[_0x3bde90(0x117)]+_0x3bde90(0x109)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a42_0x4ab5f9=a42_0x18ac;(function(_0x2a931f,_0x5dccf9){const _0x448f93=a42_0x18ac,_0x126622=_0x2a931f();while(!![]){try{const _0x2bfc8a=-parseInt(_0x448f93(0x18b))/0x1+-parseInt(_0x448f93(0x1c0))/0x2*(-parseInt(_0x448f93(0x182))/0x3)+parseInt(_0x448f93(0x17d))/0x4+parseInt(_0x448f93(0x1d0))/0x5*(parseInt(_0x448f93(0x1a6))/0x6)+parseInt(_0x448f93(0x1a1))/0x7*(parseInt(_0x448f93(0x1b4))/0x8)+parseInt(_0x448f93(0x1ea))/0x9+-parseInt(_0x448f93(0x1c8))/0xa;if(_0x2bfc8a===_0x5dccf9)break;else _0x126622['push'](_0x126622['shift']());}catch(_0x2ce378){_0x126622['push'](_0x126622['shift']());}}}(a42_0x2d5a,0x49ba2));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':a42_0x4ab5f9(0x1b0),'command':a42_0x4ab5f9(0x173),'description':a42_0x4ab5f9(0x15f),'risk':'read','structuredErrors':!![],'flags':[{'name':a42_0x4ab5f9(0x174),'type':a42_0x4ab5f9(0x198),'description':a42_0x4ab5f9(0x195),'enum':[a42_0x4ab5f9(0x158),'ENDPOINT',a42_0x4ab5f9(0x16a)]},{'name':a42_0x4ab5f9(0x175),'type':a42_0x4ab5f9(0x161),'description':a42_0x4ab5f9(0x16c)}],async 'dryRun'(_0x5d7df0){const _0x170e09=a42_0x4ab5f9,_0x423c24=loadBffProjectConfig(_0x5d7df0['appCode']),_0x361002=await readBffLockFile(_0x423c24[_0x170e09(0x1eb)]),{appLock:_0x1d4066}=ensureLockScope(_0x361002??createEmptyBffLock(),_0x5d7df0[_0x170e09(0x1b1)],_0x423c24[_0x170e09(0x194)],_0x170e09(0x173)),_0x11e957=normalizeBffType(_0x5d7df0['str']('type'))??undefined,[_0x5840e0,_0x159f23]=await Promise[_0x170e09(0x1e7)]([listBffScripts(_0x5d7df0[_0x170e09(0x1b1)],_0x11e957),getBffScriptStatistics(_0x5d7df0['appCode'])]),_0x10c60e=_0x5840e0[_0x170e09(0x1d4)](_0x558b92=>normalizeBffType(_0x558b92[_0x170e09(0x1dc)])===_0x170e09(0x16a)),_0x7e1f50=_0x10c60e?buildDatasetCodeToAliasMap(_0x5d7df0[_0x170e09(0x1dd)],_0x5d7df0[_0x170e09(0x1b1)],_0x5d7df0['selectedAppName']||_0x5d7df0[_0x170e09(0x1d6)]?.['currentApp']||_0x5d7df0[_0x170e09(0x1d6)]?.[_0x170e09(0x1e4)]):new Map(),_0x785e82=_0x10c60e?await planHookDirectoryMigration(_0x423c24,_0x1d4066,_0x7e1f50,await scanLocalBffFunctions(_0x423c24,_0x170e09(0x16a))):undefined,_0x420e16=createHookLocationMap(_0x159f23),_0x69736d=[];for(const _0x2e5fe2 of _0x5840e0){const _0x14ad1e=resolveRemoteScriptTarget(_0x423c24,_0x2e5fe2,_0x420e16,_0x785e82?.[_0x170e09(0x18d)]??_0x1d4066[_0x170e09(0x1d8)],_0x7e1f50);if(!_0x14ad1e){_0x69736d[_0x170e09(0x1c2)]({'scriptType':_0x2e5fe2[_0x170e09(0x1dc)],'functionName':_0x2e5fe2[_0x170e09(0x1d9)]??'','status':'skipped','reason':'unresolvable\x20target\x20path'});continue;}const _0x353407=(_0x785e82?.[_0x170e09(0x18d)]??_0x1d4066[_0x170e09(0x1d8)])[_0x14ad1e[_0x170e09(0x17f)]],_0x440b8d=_0x2e5fe2[_0x170e09(0x1b2)]!=null?computeContentHash(_0x2e5fe2[_0x170e09(0x1b2)]):undefined,_0x367adb=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x785e82,_0x14ad1e)??_0x14ad1e[_0x170e09(0x19a)],_0x353407,_0x440b8d),_0x524256=_0x367adb?localUnsyncedConflict(_0x14ad1e,_0x2e5fe2['id']):undefined;_0x69736d[_0x170e09(0x1c2)]({'lockKey':_0x14ad1e[_0x170e09(0x17f)],'filePath':_0x14ad1e[_0x170e09(0x19a)],'remoteId':_0x2e5fe2['id']??null,'status':_0x524256?_0x170e09(0x18c):_0x170e09(0x1d7),..._0x524256?{'conflict':_0x524256}:{},..._0x14ad1e[_0x170e09(0x18e)]?{'alias':_0x14ad1e[_0x170e09(0x18e)]['alias']??null,'datasetCode':_0x14ad1e[_0x170e09(0x18e)][_0x170e09(0x193)],'operationType':_0x14ad1e[_0x170e09(0x18e)][_0x170e09(0x19c)],'functionNode':_0x14ad1e[_0x170e09(0x18e)][_0x170e09(0x1a5)]}:{}});}return{'method':_0x170e09(0x1e5),'url':_0x170e09(0x1ca)+_0x5d7df0['appCode']+(_0x11e957?'&type='+_0x11e957:'')+_0x170e09(0x166)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x5d7df0[_0x170e09(0x1b1)],'filterType':_0x11e957??null,..._0x785e82&&_0x785e82[_0x170e09(0x1bb)][_0x170e09(0x187)]>0x0?{'hookDirectoryMigrations':_0x785e82['migrations'][_0x170e09(0x1a3)](_0x3e9f9f=>({'from':_0x3e9f9f[_0x170e09(0x1e1)],'to':_0x3e9f9f[_0x170e09(0x179)]}))}:{},'files':_0x69736d},'description':'Would\x20inspect\x20'+_0x69736d['length']+_0x170e09(0x171)};},async 'execute'(_0x439ec1){const _0x4e9b10=a42_0x4ab5f9,_0x60023f=loadBffProjectConfig(_0x439ec1[_0x4e9b10(0x1b1)]),_0x3754f3=await readBffLockFile(_0x60023f['lockFilePath']),{lockData:_0x1ac3ff,appLock:_0x24843b}=ensureLockScope(_0x3754f3??createEmptyBffLock(),_0x439ec1['appCode'],_0x60023f['scriptsRoot'],_0x4e9b10(0x173)),_0x464efd=normalizeBffType(_0x439ec1['str'](_0x4e9b10(0x174)))??undefined;if(_0x439ec1[_0x4e9b10(0x184)]('type')&&!_0x464efd)throw CliErrors[_0x4e9b10(0x170)]('--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.');const [_0x34f656,_0x9c04c8]=await Promise[_0x4e9b10(0x1e7)]([listBffScripts(_0x439ec1[_0x4e9b10(0x1b1)],_0x464efd),getBffScriptStatistics(_0x439ec1[_0x4e9b10(0x1b1)])]);if(_0x34f656[_0x4e9b10(0x187)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x4e9b10(0x1a2)};const _0x3b8525=_0x439ec1[_0x4e9b10(0x1ab)](_0x4e9b10(0x175));if(_0x3b8525&&!_0x439ec1[_0x4e9b10(0x1aa)]){const _0x2464ae=await confirmForce();if(!_0x2464ae)throw CliErrors[_0x4e9b10(0x172)](_0x4e9b10(0x1ec));}if(_0x3b8525&&_0x439ec1[_0x4e9b10(0x1aa)]){}const _0x289df3=_0x34f656['some'](_0x1a63f0=>normalizeBffType(_0x1a63f0['scriptType'])===_0x4e9b10(0x16a)),_0x346cbe=_0x289df3?buildDatasetCodeToAliasMap(_0x439ec1[_0x4e9b10(0x1dd)],_0x439ec1['appCode'],_0x439ec1[_0x4e9b10(0x18f)]||_0x439ec1[_0x4e9b10(0x1d6)]?.[_0x4e9b10(0x169)]||_0x439ec1['mergedCli']?.[_0x4e9b10(0x1e4)]):new Map(),_0x3d27a6=createHookLocationMap(_0x9c04c8),_0x7f9b4a=JSON[_0x4e9b10(0x15d)](JSON['stringify'](_0x1ac3ff)),_0x17c9e6=_0x439ec1['appCode'],_0xe4ae68=_0x7f9b4a[_0x4e9b10(0x1a9)][_0x17c9e6];if(!_0xe4ae68)throw new Error(_0x4e9b10(0x1a0)+_0x17c9e6+_0x4e9b10(0x1cb));const _0x399b68=_0x289df3?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x60023f,_0xe4ae68,_0x346cbe,await scanLocalBffFunctions(_0x60023f,'HOOK')),_0xe4ae68):undefined,_0x31b9d8=createPullFileTransaction(),_0x4b7ba2=[],_0x4af7cb=[],_0x3bec16=[],_0x1f90da=[];for(const _0x31ffee of _0x34f656){const _0x55dae7=resolveRemoteScriptTarget(_0x60023f,_0x31ffee,_0x3d27a6,_0xe4ae68[_0x4e9b10(0x1d8)],_0x346cbe);if(!_0x55dae7){_0x4af7cb[_0x4e9b10(0x1c2)]({'lockKey':_0x31ffee[_0x4e9b10(0x1dc)]+'/'+_0x31ffee[_0x4e9b10(0x1d9)],'reason':_0x4e9b10(0x15b)});continue;}const _0x329299=_0xe4ae68[_0x4e9b10(0x1d8)][_0x55dae7[_0x4e9b10(0x17f)]];try{if(!_0x31ffee['id'])throw new Error(_0x4e9b10(0x167));if(_0x31ffee[_0x4e9b10(0x1b2)]==null)throw new Error(_0x4e9b10(0x1a4));const _0x2d5e83=_0x31ffee['scriptContent'],_0x4715d0=computeContentHash(_0x2d5e83);if(!_0x3b8525){const _0x12cff0=await hasUnsyncedLocalChanges(_0x55dae7['filePath'],_0x329299,_0x4715d0);if(_0x12cff0){_0x3bec16[_0x4e9b10(0x1c2)](localUnsyncedConflict(_0x55dae7,_0x31ffee['id']));continue;}}await _0x31b9d8['write'](_0x55dae7[_0x4e9b10(0x19a)],_0x2d5e83);const _0x338dbf={'hash':_0x4715d0,'remoteId':_0x31ffee['id'],'version':_0x31ffee[_0x4e9b10(0x186)]};_0x55dae7[_0x4e9b10(0x174)]==='HOOK'&&_0x55dae7[_0x4e9b10(0x18e)]&&(_0x338dbf[_0x4e9b10(0x1ce)]=_0x55dae7['hookLocation'][_0x4e9b10(0x1ce)],_0x338dbf[_0x4e9b10(0x193)]=_0x55dae7[_0x4e9b10(0x18e)]['datasetCode'],_0x338dbf[_0x4e9b10(0x19c)]=_0x55dae7[_0x4e9b10(0x18e)][_0x4e9b10(0x19c)],_0x338dbf[_0x4e9b10(0x1a5)]=_0x55dae7[_0x4e9b10(0x18e)][_0x4e9b10(0x1a5)]),_0xe4ae68[_0x4e9b10(0x1d8)][_0x55dae7[_0x4e9b10(0x17f)]]=_0x338dbf,_0x4b7ba2[_0x4e9b10(0x1c2)]({'lockKey':_0x55dae7['lockKey'],'remoteId':_0x31ffee['id']});}catch(_0x178519){_0x1f90da[_0x4e9b10(0x1c2)]({'lockKey':_0x55dae7[_0x4e9b10(0x17f)],'error':_0x178519 instanceof Error?_0x178519['message']:String(_0x178519)});}}_0xe4ae68['lastSync']=new Date()[_0x4e9b10(0x1e8)]();try{await writeBffLockFile(_0x60023f[_0x4e9b10(0x1eb)],_0x7f9b4a);}catch(_0x1fbf17){const _0x498b85=[...await _0x31b9d8[_0x4e9b10(0x160)](),...await _0x399b68?.[_0x4e9b10(0x160)]()??[]];throw withRollbackErrors(_0x1fbf17,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x498b85);}return{'ok':_0x1f90da[_0x4e9b10(0x187)]===0x0,'data':{'pulled':_0x4b7ba2,'skipped':_0x4af7cb,'conflicts':_0x3bec16,'failed':_0x1f90da},'message':formatPullMessage(_0x4b7ba2['length'],_0x4af7cb[_0x4e9b10(0x187)],_0x3bec16['length'],_0x1f90da['length'])};}};function localUnsyncedConflict(_0x1c3158,_0x592abc){const _0x3a767b=a42_0x4ab5f9,_0x9a59fa=_0x1c3158[_0x3a767b(0x17f)][_0x3a767b(0x19e)]('/')['at'](-0x1);return{'code':_0x3a767b(0x196),'lockKey':_0x1c3158[_0x3a767b(0x17f)],'filePath':_0x1c3158[_0x3a767b(0x19a)],..._0x592abc!=null?{'remoteId':_0x592abc}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x3a767b(0x1da)+_0x1c3158[_0x3a767b(0x174)]+'\x20--name\x20'+_0x9a59fa+_0x3a767b(0x1c1),'requiresReview':!![],'message':_0x3a767b(0x192)}};}function formatPullMessage(_0xa98a,_0x2eee46,_0x485c82,_0x58101f){const _0x2671be=a42_0x4ab5f9,_0xaec6b7=[_0x2671be(0x190)+_0xa98a+_0x2671be(0x1e9),_0x2eee46+_0x2671be(0x1e0)];_0x485c82>0x0&&_0xaec6b7[_0x2671be(0x1c2)](_0x485c82+_0x2671be(0x1bd)+(_0x485c82===0x1?'':'s')+'\x20'+(_0x485c82===0x1?_0x2671be(0x1a7):'require')+_0x2671be(0x17b));if(_0x58101f>0x0)_0xaec6b7[_0x2671be(0x1c2)](_0x58101f+_0x2671be(0x183));return _0xaec6b7[_0x2671be(0x1db)](',\x20');}async function hasUnsyncedLocalChanges(_0x432377,_0xb209c6,_0x20352){const _0x32ac82=a42_0x4ab5f9;if(!await fileExists(_0x432377))return![];const _0x462ce6=await computeFileHash(_0x432377);if(!_0xb209c6)return _0x20352?_0x462ce6!==_0x20352:!![];return _0x462ce6!==_0xb209c6[_0x32ac82(0x1cd)];}function a42_0x18ac(_0x126667,_0x367d2b){_0x126667=_0x126667-0x156;const _0x2d5aa0=a42_0x2d5a();let _0x18ac31=_0x2d5aa0[_0x126667];return _0x18ac31;}function createPullFileTransaction(){const _0x2921eb=new Map(),_0x19dc6f=async(_0x3dfb22,_0x37bbaa)=>{const _0x5cd72d=a42_0x18ac;try{if(_0x37bbaa[_0x5cd72d(0x17e)])await ensureParentDirectory(_0x3dfb22),await writeFile(_0x3dfb22,_0x37bbaa[_0x5cd72d(0x1b6)]);else try{await unlink(_0x3dfb22);}catch(_0x59c8d0){if(_0x59c8d0[_0x5cd72d(0x189)]!==_0x5cd72d(0x1bc))throw _0x59c8d0;}return undefined;}catch(_0x327d3e){return _0x327d3e instanceof Error?_0x327d3e:new Error(String(_0x327d3e));}};return{async 'write'(_0x226037,_0x1cd6b9){const _0x5c5e3c=a42_0x18ac;if(!_0x2921eb['has'](_0x226037))try{_0x2921eb[_0x5c5e3c(0x1c4)](_0x226037,{'existed':!![],'content':await readFile(_0x226037)});}catch(_0x3500e6){if(_0x3500e6['code']!==_0x5c5e3c(0x1bc))throw _0x3500e6;_0x2921eb[_0x5c5e3c(0x1c4)](_0x226037,{'existed':![]});}try{await ensureParentDirectory(_0x226037),await writeFile(_0x226037,_0x1cd6b9,'utf8');}catch(_0x17656a){const _0x409029=await _0x19dc6f(_0x226037,_0x2921eb[_0x5c5e3c(0x15e)](_0x226037));if(!_0x409029)_0x2921eb['delete'](_0x226037);throw withRollbackErrors(_0x17656a,_0x5c5e3c(0x199)+_0x226037+'\x22.',_0x409029?[_0x409029]:[]);}},async 'rollback'(){const _0x47ad61=a42_0x18ac,_0x53a913=[];for(const [_0x261002,_0x13dbe9]of[..._0x2921eb['entries']()][_0x47ad61(0x19b)]()){const _0x4062a1=await _0x19dc6f(_0x261002,_0x13dbe9);_0x4062a1&&_0x53a913[_0x47ad61(0x1c2)](new Error(_0x47ad61(0x178)+_0x261002+'\x22:\x20'+_0x4062a1[_0x47ad61(0x1d1)]));}return _0x53a913;}};}function withRollbackErrors(_0x3baf92,_0x25545f,_0x92b16d){const _0x4a7651=a42_0x4ab5f9,_0x4dfb6e=_0x3baf92 instanceof Error?_0x3baf92:new Error(String(_0x3baf92));if(_0x92b16d[_0x4a7651(0x187)]===0x0)return _0x4dfb6e;return new AggregateError([_0x4dfb6e,..._0x92b16d],_0x25545f+_0x4a7651(0x180)+_0x92b16d['map'](_0x3aa61b=>_0x3aa61b[_0x4a7651(0x1d1)])[_0x4a7651(0x1db)](';\x20'));}function buildDatasetCodeToAliasMap(_0x58751c,_0x43141d,_0x19cddd){const _0x3cddd4=a42_0x4ab5f9,_0x221126=resolveApiModelSource(_0x58751c,_0x43141d,_0x19cddd),_0x40c2dd=loadAliasMap(_0x58751c,undefined,_0x221126[_0x3cddd4(0x19a)],_0x221126[_0x3cddd4(0x1b5)]);return assertUnambiguousHookAliases(_0x40c2dd),new Map(_0x40c2dd['map'](_0x54169b=>[_0x54169b[_0x3cddd4(0x193)][_0x3cddd4(0x1c9)](),_0x54169b[_0x3cddd4(0x1ce)]]));}async function planHookDirectoryMigration(_0x1ff0ed,_0x306fb6,_0x1b8129,_0x4cf5c2){const _0x1e13ae=a42_0x4ab5f9,_0x2c449d=new Map();for(const [_0x2eeb61,_0x37e6f8]of Object[_0x1e13ae(0x1bf)](_0x306fb6[_0x1e13ae(0x1d8)])){const [_0x1596ab,_0x71db35,_0x5dd872,_0x115a91,_0x2af047,..._0x5742e4]=_0x2eeb61['split']('/');if(_0x1596ab!=='HOOK'||!_0x71db35||!_0x5dd872||!_0x115a91||!_0x2af047||_0x5742e4['length']>0x0||!_0x37e6f8[_0x1e13ae(0x193)])continue;const _0x2ec244=_0x1b8129[_0x1e13ae(0x15e)](_0x37e6f8['datasetCode'][_0x1e13ae(0x1c9)]()),_0x3b55e8=_0x2ec244??_0x37e6f8[_0x1e13ae(0x193)];if(!isSafeHookDirectorySegment(_0x71db35))throw CliErrors[_0x1e13ae(0x170)](_0x1e13ae(0x197)+_0x71db35+_0x1e13ae(0x159));if(!isSafeHookDirectorySegment(_0x3b55e8))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x71db35+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x71db35===_0x3b55e8)continue;const _0x5da982=_0x2c449d[_0x1e13ae(0x15e)](_0x71db35)??{'datasetCode':_0x37e6f8['datasetCode'],'alias':_0x2ec244,'keyChanges':[]};if(_0x5da982[_0x1e13ae(0x193)]!==_0x37e6f8[_0x1e13ae(0x193)])throw CliErrors['validation'](_0x1e13ae(0x177)+_0x71db35+'\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.');const _0x2c648e=_0x1e13ae(0x1b8)+_0x3b55e8+'/'+_0x5dd872+'/'+_0x115a91+'/'+_0x2af047;try{resolveLocalFilePathFromLockKey(_0x1ff0ed,_0x2eeb61),resolveLocalFilePathFromLockKey(_0x1ff0ed,_0x2c648e);}catch(_0x4d13be){throw CliErrors[_0x1e13ae(0x170)](_0x1e13ae(0x1b3)+_0x2eeb61+_0x1e13ae(0x191)+(_0x4d13be instanceof Error?_0x4d13be[_0x1e13ae(0x1d1)]:String(_0x4d13be)));}_0x5da982[_0x1e13ae(0x1b9)][_0x1e13ae(0x1c2)]({'oldLockKey':_0x2eeb61,'newLockKey':_0x2c648e,'entry':_0x37e6f8}),_0x2c449d['set'](_0x71db35,_0x5da982);}const _0x410858=new Set([..._0x2c449d[_0x1e13ae(0x1d3)]()][_0x1e13ae(0x17a)](_0x227d0c=>_0x227d0c[_0x1e13ae(0x1b9)][_0x1e13ae(0x1a3)](_0x355547=>_0x355547['oldLockKey']))),_0x462c73=new Map(),_0xc58e47=new Map();for(const [_0x568fce,_0x246e65]of _0x2c449d){const _0x1d6182=_0x246e65[_0x1e13ae(0x1ce)]??_0x246e65[_0x1e13ae(0x193)],_0xf91b26=hookDirectoryIdentity(_0x1d6182),_0x582887=_0x462c73['get'](_0xf91b26);if(_0x582887&&_0x582887!==_0x568fce)throw CliErrors[_0x1e13ae(0x170)](_0x1e13ae(0x1c5)+_0x582887+_0x1e13ae(0x156)+_0x568fce+_0x1e13ae(0x163)+_0x1d6182+_0x1e13ae(0x1c6));_0x462c73['set'](_0xf91b26,_0x568fce);for(const _0x46f121 of _0x246e65[_0x1e13ae(0x1b9)]){const _0x167a81=_0xc58e47['get'](_0x46f121[_0x1e13ae(0x16e)]);if(_0x167a81&&_0x167a81!==_0x46f121[_0x1e13ae(0x19f)])throw CliErrors[_0x1e13ae(0x170)](_0x1e13ae(0x1be)+_0x167a81+_0x1e13ae(0x156)+_0x46f121[_0x1e13ae(0x19f)]+_0x1e13ae(0x163)+_0x46f121[_0x1e13ae(0x16e)]+_0x1e13ae(0x181));if(_0x410858[_0x1e13ae(0x1cc)](_0x46f121[_0x1e13ae(0x16e)]))throw CliErrors[_0x1e13ae(0x170)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x46f121[_0x1e13ae(0x19f)]+_0x1e13ae(0x17c)+_0x46f121[_0x1e13ae(0x16e)]+_0x1e13ae(0x176));_0xc58e47[_0x1e13ae(0x1c4)](_0x46f121['newLockKey'],_0x46f121[_0x1e13ae(0x19f)]);}}const _0x195882=new Map();for(const [_0xa4a4d3,_0x33e3ba]of _0x1b8129){_0x195882[_0x1e13ae(0x1c4)](hookDirectoryIdentity(_0x33e3ba),_0xa4a4d3);}const _0x372331=[];for(const [_0x1a9060,_0x1bad6e]of _0x2c449d){const _0x28461c=_0x1bad6e[_0x1e13ae(0x1ce)]??_0x1bad6e[_0x1e13ae(0x193)],_0x1a2c0a=join(_0x1ff0ed[_0x1e13ae(0x165)],'HOOK',_0x1a9060),_0x52e965=join(_0x1ff0ed[_0x1e13ae(0x165)],'HOOK',_0x28461c),_0x56d12e=await directoryExists(_0x1a2c0a),_0x1445d7=await directoryExists(_0x52e965),_0x41b32e=_0x56d12e?_0x1445d7?await sameDirectory(_0x1a2c0a,_0x52e965)?'case-rename':undefined:'move':_0x1e13ae(0x168);if(!_0x41b32e)throw CliErrors['validation'](_0x1e13ae(0x177)+_0x1a9060+'\x22\x20to\x20\x22'+_0x28461c+'\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.');const _0x33d102=_0x195882[_0x1e13ae(0x15e)](hookDirectoryIdentity(_0x1a9060));if(_0x33d102&&_0x33d102!==_0x1bad6e[_0x1e13ae(0x193)]['toLowerCase']()){const _0x4287c9=new Set(_0x1bad6e[_0x1e13ae(0x1b9)][_0x1e13ae(0x1a3)](_0x8c14ab=>_0x8c14ab['oldLockKey'])),_0x5b9228=_0x4cf5c2['filter'](_0x2afa37=>_0x2afa37[_0x1e13ae(0x174)]===_0x1e13ae(0x16a)&&_0x2afa37[_0x1e13ae(0x1ce)]!=null&&hookDirectoryIdentity(_0x2afa37[_0x1e13ae(0x1ce)])===hookDirectoryIdentity(_0x1a9060)&&!_0x4287c9[_0x1e13ae(0x1cc)](_0x2afa37['lockKey']));if(_0x5b9228[_0x1e13ae(0x187)]>0x0)throw CliErrors[_0x1e13ae(0x170)](_0x1e13ae(0x177)+_0x1a9060+_0x1e13ae(0x1de));}const _0x4627f7=_0x195882[_0x1e13ae(0x15e)](hookDirectoryIdentity(_0x28461c));if(_0x4627f7&&_0x4627f7!==_0x1bad6e[_0x1e13ae(0x193)][_0x1e13ae(0x1c9)]())throw CliErrors['validation'](_0x1e13ae(0x177)+_0x1a9060+_0x1e13ae(0x1af)+_0x28461c+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x3ac060 of _0x1bad6e['keyChanges']){const _0xf95933=_0x306fb6['functions'][_0x3ac060['newLockKey']];if(_0xf95933&&!_0x410858[_0x1e13ae(0x1cc)](_0x3ac060['newLockKey'])&&!sameHookIdentity(_0x3ac060[_0x1e13ae(0x18a)],_0xf95933))throw CliErrors[_0x1e13ae(0x170)](_0x1e13ae(0x177)+_0x1a9060+_0x1e13ae(0x1af)+_0x28461c+_0x1e13ae(0x15a));}_0x372331[_0x1e13ae(0x1c2)]({'oldDirectory':_0x1a9060,'newDirectory':_0x28461c,'oldDirectoryPath':_0x1a2c0a,'newDirectoryPath':_0x52e965,'mode':_0x41b32e,'alias':_0x1bad6e[_0x1e13ae(0x1ce)],'keyChanges':_0x1bad6e[_0x1e13ae(0x1b9)]});}const _0x2bab66={..._0x306fb6[_0x1e13ae(0x1d8)]},_0x36b84d=new Map(),_0x3a694c=new Map();for(const _0x51801c of _0x372331){const _0x4a07d4=_0x51801c[_0x1e13ae(0x162)]!==_0x1e13ae(0x168);_0x4a07d4&&_0x3a694c[_0x1e13ae(0x1c4)](hookDirectoryIdentity(_0x51801c[_0x1e13ae(0x179)]),_0x51801c[_0x1e13ae(0x19d)]);for(const _0x2fd12c of _0x51801c[_0x1e13ae(0x1b9)]){const _0x1105f7=_0x2bab66[_0x2fd12c[_0x1e13ae(0x16e)]],_0xae46f=_0x4a07d4?_0x2fd12c['entry']:_0x1105f7??_0x2fd12c[_0x1e13ae(0x18a)];_0x2bab66[_0x2fd12c[_0x1e13ae(0x16e)]]=canonicalizeHookEntry(_0xae46f,_0x51801c[_0x1e13ae(0x1ce)]),delete _0x2bab66[_0x2fd12c['oldLockKey']],_0x4a07d4&&_0x36b84d[_0x1e13ae(0x1c4)](_0x2fd12c[_0x1e13ae(0x16e)],resolveLocalFilePathFromLockKey(_0x1ff0ed,_0x2fd12c[_0x1e13ae(0x19f)]));}}return{'migrations':_0x372331,'projectedFunctions':_0x2bab66,'sourceFilePathByNewLockKey':_0x36b84d,'sourceDirectoryPathByNewDirectory':_0x3a694c};}function a42_0x2d5a(){const _0x31b4a2=['newDirectoryPath','all','toISOString','\x20pulled','4647942kqzHxY','lockFilePath','Force\x20pull\x20cancelled.','\x22\x20and\x20\x22','sourceDirectoryPathByNewDirectory','COMMON','\x22\x20from\x20the\x20lock\x20file.','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','unresolvable\x20target\x20path','NFC','parse','get','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','rollback','boolean','mode','\x22:\x20both\x20target\x20\x22','normalize','scriptsRootDir','¤tPage=1&pageSize=','Remote\x20script\x20missing\x20id.','rekey','currentApp','HOOK','\x22;\x20temporary\x20directory\x20\x22','Force\x20overwrite\x20local\x20unsynced\x20changes','move','newLockKey','stderr','validation','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','cancelled','pull','type','force','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','newDirectory','flatMap','\x20resolution','\x22:\x20its\x20target\x20\x22','1262528GFAJqU','existed','lockKey','\x20Recovery\x20errors:\x20','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','3MXDqXs','\x20failed','str','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','version','length','case-rename','code','entry','225941LNZzuy','conflict','projectedFunctions','hookLocation','selectedAppName','Pull\x20complete:\x20','\x22:\x20','If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.','datasetCode','scriptsRoot','Pull\x20only\x20this\x20script\x20type','BFF_LOCAL_UNSYNCED','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','string','Failed\x20to\x20write\x20local\x20script\x20\x22','filePath','reverse','operationType','oldDirectoryPath','split','oldLockKey','Lock\x20scope\x20for\x20app\x20\x22','3094854pNjCtU','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','map','Remote\x20script\x20missing\x20content.','functionNode','834jhvbmt','requires','\x22\x20may\x20remain.','apps','nonInteractive','bool','.hook-directory-migrate-','\x22\x20from\x20\x22','includes','\x22\x20to\x20\x22','bff','appCode','scriptContent','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','8tlmWYr','profileName','content','yes','HOOK/','keyChanges','ino','migrations','ENOENT','\x20conflict','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','entries','542802qXVoiX','\x20--format\x20compress','push','remoteId','set','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','stdin','14883200hiyOiP','toLowerCase','/api/management/library/scripts/list?appCode=','\x22\x20not\x20found\x20after\x20ensureLockScope.','has','hash','alias','lastSync','16930UmWFvT','message','sourceFilePathByNewLockKey','values','some','.js','mergedCli','would_pull','functions','functionName','\x20bff\x20push\x20--type\x20','join','scriptType','apiDir','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','trim','\x20skipped','oldDirectory','question','dev','defaultApp','GET'];a42_0x2d5a=function(){return _0x31b4a2;};return a42_0x2d5a();}function resolveMigratedSourceFilePath(_0x298c6e,_0x1cef02){const _0x4801f8=a42_0x4ab5f9;if(!_0x298c6e||!_0x1cef02)return undefined;const _0x4b9086=_0x298c6e[_0x4801f8(0x1d2)][_0x4801f8(0x15e)](_0x1cef02['lockKey']);if(_0x4b9086)return _0x4b9086;if(_0x1cef02[_0x4801f8(0x174)]!==_0x4801f8(0x16a))return undefined;const [,_0x5304cb,..._0x2c9dcb]=_0x1cef02['lockKey']['split']('/');if(!_0x5304cb||_0x2c9dcb['length']===0x0)return undefined;const _0xe2fee8=_0x298c6e[_0x4801f8(0x157)]['get'](hookDirectoryIdentity(_0x5304cb));return _0xe2fee8?join(_0xe2fee8,..._0x2c9dcb)+_0x4801f8(0x1d5):undefined;}function sameHookIdentity(_0x13ccb6,_0x8c085c){const _0x495943=a42_0x4ab5f9;return _0x13ccb6['remoteId']===_0x8c085c[_0x495943(0x1c3)]&&_0x13ccb6[_0x495943(0x193)]===_0x8c085c[_0x495943(0x193)]&&_0x13ccb6[_0x495943(0x19c)]===_0x8c085c[_0x495943(0x19c)]&&_0x13ccb6[_0x495943(0x1a5)]===_0x8c085c['functionNode'];}function canonicalizeHookEntry(_0x7c7d1b,_0x45a337){const {alias:_0x16c2ed,..._0x52cef4}=_0x7c7d1b;return _0x45a337?{..._0x52cef4,'alias':_0x45a337}:_0x52cef4;}function hookDirectoryIdentity(_0x389255){const _0x323d1c=a42_0x4ab5f9;return _0x389255[_0x323d1c(0x164)](_0x323d1c(0x15c))['toLowerCase']();}function isSafeHookDirectorySegment(_0x390680){return isSafeLockKeySegment(_0x390680);}async function sameDirectory(_0x4d45bb,_0x39066f){const _0x2f54a0=a42_0x4ab5f9,[_0x1e8691,_0xdc5a6d]=await Promise['all']([stat(_0x4d45bb),stat(_0x39066f)]);return _0x1e8691['dev']===_0xdc5a6d[_0x2f54a0(0x1e3)]&&_0x1e8691['ino']===_0xdc5a6d[_0x2f54a0(0x1ba)];}async function applyHookDirectoryMigration(_0x2f46e7,_0x6ec92){const _0x50ffea=a42_0x4ab5f9,_0x229cc4=_0x6ec92['functions'],_0x519db9=_0x6ec92['lastSync'],_0x5db29c=[],_0x5addbc=async()=>{const _0x5724f6=a42_0x18ac,_0x1e64bb=[];_0x6ec92[_0x5724f6(0x1d8)]=_0x229cc4,_0x6ec92[_0x5724f6(0x1cf)]=_0x519db9;for(const {migration:_0x1a3ae5,temporaryPath:_0x5092a7}of[..._0x5db29c][_0x5724f6(0x19b)]()){try{_0x5092a7?(await rename(_0x1a3ae5[_0x5724f6(0x1e6)],_0x5092a7),await rename(_0x5092a7,_0x1a3ae5['oldDirectoryPath'])):await rename(_0x1a3ae5['newDirectoryPath'],_0x1a3ae5[_0x5724f6(0x19d)]);}catch(_0x3103f2){_0x1e64bb[_0x5724f6(0x1c2)](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x1a3ae5['oldDirectory']+_0x5724f6(0x1ad)+_0x1a3ae5[_0x5724f6(0x179)]+_0x5724f6(0x191)+(_0x3103f2 instanceof Error?_0x3103f2['message']:String(_0x3103f2))));}}return _0x1e64bb;};try{for(const _0x47d974 of _0x2f46e7[_0x50ffea(0x1bb)]){if(_0x47d974['mode']===_0x50ffea(0x16d))await ensureParentDirectory(_0x47d974[_0x50ffea(0x1e6)]),await rename(_0x47d974[_0x50ffea(0x19d)],_0x47d974[_0x50ffea(0x1e6)]),_0x5db29c[_0x50ffea(0x1c2)]({'migration':_0x47d974});else{if(_0x47d974[_0x50ffea(0x162)]===_0x50ffea(0x188)){const _0x2b469e=join(dirname(_0x47d974[_0x50ffea(0x19d)]),_0x50ffea(0x1ac)+randomUUID());await rename(_0x47d974['oldDirectoryPath'],_0x2b469e);try{await rename(_0x2b469e,_0x47d974[_0x50ffea(0x1e6)]);}catch(_0x9d7187){try{await rename(_0x2b469e,_0x47d974[_0x50ffea(0x19d)]);}catch(_0x1a2b77){throw withRollbackErrors(_0x9d7187,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x47d974[_0x50ffea(0x1e1)]+'\x22\x20to\x20\x22'+_0x47d974[_0x50ffea(0x179)]+_0x50ffea(0x16b)+_0x2b469e+_0x50ffea(0x1a8),[new Error(_0x50ffea(0x185)+_0x2b469e+_0x50ffea(0x1af)+_0x47d974[_0x50ffea(0x1e1)]+_0x50ffea(0x191)+(_0x1a2b77 instanceof Error?_0x1a2b77[_0x50ffea(0x1d1)]:String(_0x1a2b77)))]);}throw _0x9d7187;}_0x5db29c[_0x50ffea(0x1c2)]({'migration':_0x47d974,'temporaryPath':_0x2b469e});}}}return _0x6ec92['functions']=_0x2f46e7[_0x50ffea(0x18d)],{'rollback':_0x5addbc};}catch(_0x58d785){const _0x21adb6=await _0x5addbc();throw withRollbackErrors(_0x58d785,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x21adb6);}}async function confirmForce(){const _0x2c8a20=a42_0x4ab5f9,_0x49e1f0=createInterface({'input':process[_0x2c8a20(0x1c7)],'output':process[_0x2c8a20(0x16f)]}),_0x14fca3=await new Promise(_0x1c8bcd=>{const _0x59461d=_0x2c8a20;_0x49e1f0[_0x59461d(0x1e2)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x1c8bcd);});return _0x49e1f0['close'](),['y',_0x2c8a20(0x1b7)][_0x2c8a20(0x1ae)](_0x14fca3[_0x2c8a20(0x1df)]()['toLowerCase']());}
|
|
1
|
+
const a42_0x59b6b6=a42_0x118c;(function(_0x1bdb8c,_0x1235d9){const _0x31598e=a42_0x118c,_0x30c464=_0x1bdb8c();while(!![]){try{const _0x5e73a5=parseInt(_0x31598e(0x1e9))/0x1+-parseInt(_0x31598e(0x215))/0x2*(parseInt(_0x31598e(0x1e0))/0x3)+parseInt(_0x31598e(0x1c1))/0x4+-parseInt(_0x31598e(0x1b3))/0x5*(-parseInt(_0x31598e(0x227))/0x6)+parseInt(_0x31598e(0x19f))/0x7*(-parseInt(_0x31598e(0x1d8))/0x8)+parseInt(_0x31598e(0x205))/0x9*(-parseInt(_0x31598e(0x1de))/0xa)+-parseInt(_0x31598e(0x1df))/0xb*(-parseInt(_0x31598e(0x1e8))/0xc);if(_0x5e73a5===_0x1235d9)break;else _0x30c464['push'](_0x30c464['shift']());}catch(_0x7650d){_0x30c464['push'](_0x30c464['shift']());}}}(a42_0x11bb,0x86a14));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';function a42_0x118c(_0x54407c,_0x4682a3){_0x54407c=_0x54407c-0x199;const _0x11bb88=a42_0x11bb();let _0x118c94=_0x11bb88[_0x54407c];return _0x118c94;}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':a42_0x59b6b6(0x1ee),'command':a42_0x59b6b6(0x1d0),'description':a42_0x59b6b6(0x1e6),'risk':a42_0x59b6b6(0x200),'structuredErrors':!![],'flags':[{'name':a42_0x59b6b6(0x20a),'type':a42_0x59b6b6(0x1bf),'description':a42_0x59b6b6(0x1fc),'enum':[a42_0x59b6b6(0x1e1),a42_0x59b6b6(0x1b1),a42_0x59b6b6(0x19c)]},{'name':a42_0x59b6b6(0x22e),'type':'boolean','description':a42_0x59b6b6(0x21d)}],async 'dryRun'(_0x11871b){const _0x478c30=a42_0x59b6b6,_0x2a54fd=loadBffProjectConfig(_0x11871b['appCode']),_0x261acf=await readBffLockFile(_0x2a54fd[_0x478c30(0x1ad)]),{appLock:_0x396076}=ensureLockScope(_0x261acf??createEmptyBffLock(),_0x11871b[_0x478c30(0x1b5)],_0x2a54fd[_0x478c30(0x1da)],_0x478c30(0x1d0)),_0x32e2b2=normalizeBffType(_0x11871b[_0x478c30(0x1d5)](_0x478c30(0x20a)))??undefined,[_0x4d0833,_0xf011d8]=await Promise[_0x478c30(0x1a2)]([listBffScripts(_0x11871b[_0x478c30(0x1b5)],_0x32e2b2),getBffScriptStatistics(_0x11871b[_0x478c30(0x1b5)])]),_0x1bb89d=_0x4d0833[_0x478c30(0x21e)](_0xb80b1b=>normalizeBffType(_0xb80b1b[_0x478c30(0x1c4)])==='HOOK'),_0x5d4dba=_0x1bb89d?buildDatasetCodeToAliasMap(_0x11871b[_0x478c30(0x1e4)],_0x11871b[_0x478c30(0x1b5)],_0x11871b[_0x478c30(0x1d7)]||_0x11871b[_0x478c30(0x1bc)]?.['currentApp']||_0x11871b[_0x478c30(0x1bc)]?.[_0x478c30(0x19d)]):new Map(),_0x523464=_0x1bb89d?await planHookDirectoryMigration(_0x2a54fd,_0x396076,_0x5d4dba,await scanLocalBffFunctions(_0x2a54fd,'HOOK')):undefined,_0x5842a4=createHookLocationMap(_0xf011d8),_0x4d7906=[];for(const _0x18e637 of _0x4d0833){const _0x442842=resolveRemoteScriptTarget(_0x2a54fd,_0x18e637,_0x5842a4,_0x523464?.[_0x478c30(0x1af)]??_0x396076['functions'],_0x5d4dba);if(!_0x442842){_0x4d7906[_0x478c30(0x1f1)]({'scriptType':_0x18e637[_0x478c30(0x1c4)],'functionName':_0x18e637[_0x478c30(0x226)]??'','status':_0x478c30(0x22b),'reason':_0x478c30(0x221)});continue;}const _0x2701fb=(_0x523464?.[_0x478c30(0x1af)]??_0x396076[_0x478c30(0x212)])[_0x442842[_0x478c30(0x1ef)]],_0x5c816e=_0x18e637[_0x478c30(0x228)]!=null?computeContentHash(_0x18e637['scriptContent']):undefined,_0x19a0c9=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x523464,_0x442842)??_0x442842[_0x478c30(0x20e)],_0x2701fb,_0x5c816e),_0x53c5ac=_0x19a0c9?localUnsyncedConflict(_0x442842,_0x18e637['id']):undefined;_0x4d7906[_0x478c30(0x1f1)]({'lockKey':_0x442842[_0x478c30(0x1ef)],'filePath':_0x442842[_0x478c30(0x20e)],'remoteId':_0x18e637['id']??null,'status':_0x53c5ac?_0x478c30(0x229):_0x478c30(0x1c8),..._0x53c5ac?{'conflict':_0x53c5ac}:{},..._0x442842[_0x478c30(0x1b7)]?{'alias':_0x442842[_0x478c30(0x1b7)][_0x478c30(0x1eb)]??null,'datasetCode':_0x442842['hookLocation']['datasetCode'],'operationType':_0x442842['hookLocation'][_0x478c30(0x208)],'functionNode':_0x442842[_0x478c30(0x1b7)]['functionNode']}:{}});}return{'method':_0x478c30(0x1d9),'url':_0x478c30(0x203)+_0x11871b[_0x478c30(0x1b5)]+(_0x32e2b2?_0x478c30(0x1dc)+_0x32e2b2:'')+_0x478c30(0x21b)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x11871b[_0x478c30(0x1b5)],'filterType':_0x32e2b2??null,..._0x523464&&_0x523464['migrations'][_0x478c30(0x224)]>0x0?{'hookDirectoryMigrations':_0x523464['migrations'][_0x478c30(0x1c0)](_0x5adf95=>({'from':_0x5adf95['oldDirectory'],'to':_0x5adf95[_0x478c30(0x1cf)]}))}:{},'files':_0x4d7906},'description':_0x478c30(0x199)+_0x4d7906['length']+_0x478c30(0x1a3)};},async 'execute'(_0x46e905){const _0x5ef651=a42_0x59b6b6,_0x4c86df=loadBffProjectConfig(_0x46e905[_0x5ef651(0x1b5)]),_0x448fcd=await readBffLockFile(_0x4c86df['lockFilePath']),{lockData:_0x1405fc,appLock:_0x52b296}=ensureLockScope(_0x448fcd??createEmptyBffLock(),_0x46e905[_0x5ef651(0x1b5)],_0x4c86df[_0x5ef651(0x1da)],_0x5ef651(0x1d0)),_0x2150ea=normalizeBffType(_0x46e905[_0x5ef651(0x1d5)](_0x5ef651(0x20a)))??undefined;if(_0x46e905['str'](_0x5ef651(0x20a))&&!_0x2150ea)throw CliErrors[_0x5ef651(0x232)](_0x5ef651(0x1fa));const [_0x28ccac,_0x530025]=await Promise[_0x5ef651(0x1a2)]([listBffScripts(_0x46e905[_0x5ef651(0x1b5)],_0x2150ea),getBffScriptStatistics(_0x46e905[_0x5ef651(0x1b5)])]);if(_0x28ccac[_0x5ef651(0x224)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x5ef651(0x1f6)};const _0x2853de=_0x46e905['bool'](_0x5ef651(0x22e));if(_0x2853de&&!_0x46e905[_0x5ef651(0x1d4)]){const _0xc8953=await confirmForce();if(!_0xc8953)throw CliErrors[_0x5ef651(0x20d)](_0x5ef651(0x1a9));}if(_0x2853de&&_0x46e905['nonInteractive']){}const _0x279bc7=_0x28ccac[_0x5ef651(0x21e)](_0x24f74e=>normalizeBffType(_0x24f74e[_0x5ef651(0x1c4)])===_0x5ef651(0x19c)),_0x380e34=_0x279bc7?buildDatasetCodeToAliasMap(_0x46e905[_0x5ef651(0x1e4)],_0x46e905[_0x5ef651(0x1b5)],_0x46e905[_0x5ef651(0x1d7)]||_0x46e905['mergedCli']?.['currentApp']||_0x46e905[_0x5ef651(0x1bc)]?.['defaultApp']):new Map(),_0x3ecf7c=createHookLocationMap(_0x530025),_0x5ae17b=JSON[_0x5ef651(0x222)](JSON[_0x5ef651(0x219)](_0x1405fc)),_0x617ce9=_0x46e905[_0x5ef651(0x1b5)],_0x140168=_0x5ae17b[_0x5ef651(0x1db)][_0x617ce9];if(!_0x140168)throw new Error(_0x5ef651(0x1a4)+_0x617ce9+_0x5ef651(0x21f));const _0x3b3d60=_0x279bc7?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x4c86df,_0x140168,_0x380e34,await scanLocalBffFunctions(_0x4c86df,_0x5ef651(0x19c))),_0x140168):undefined,_0x22315c=createPullFileTransaction(),_0x51176e=[],_0x3521f5=[],_0x439974=[],_0x421bf7=[];for(const _0x2a6ef3 of _0x28ccac){const _0x5c7faa=resolveRemoteScriptTarget(_0x4c86df,_0x2a6ef3,_0x3ecf7c,_0x140168[_0x5ef651(0x212)],_0x380e34);if(!_0x5c7faa){_0x3521f5[_0x5ef651(0x1f1)]({'lockKey':_0x2a6ef3[_0x5ef651(0x1c4)]+'/'+_0x2a6ef3[_0x5ef651(0x226)],'reason':_0x5ef651(0x221)});continue;}const _0xff6706=_0x140168[_0x5ef651(0x212)][_0x5c7faa[_0x5ef651(0x1ef)]];try{if(!_0x2a6ef3['id'])throw new Error(_0x5ef651(0x217));if(_0x2a6ef3[_0x5ef651(0x228)]==null)throw new Error(_0x5ef651(0x1f0));const _0x4a038e=_0x2a6ef3[_0x5ef651(0x228)],_0x4c4eb5=computeContentHash(_0x4a038e);if(!_0x2853de){const _0x579062=await hasUnsyncedLocalChanges(_0x5c7faa[_0x5ef651(0x20e)],_0xff6706,_0x4c4eb5);if(_0x579062){_0x439974['push'](localUnsyncedConflict(_0x5c7faa,_0x2a6ef3['id']));continue;}}await _0x22315c[_0x5ef651(0x1c5)](_0x5c7faa[_0x5ef651(0x20e)],_0x4a038e);const _0x3820b5={'hash':_0x4c4eb5,'remoteId':_0x2a6ef3['id'],'version':_0x2a6ef3[_0x5ef651(0x22c)]};_0x5c7faa[_0x5ef651(0x20a)]==='HOOK'&&_0x5c7faa[_0x5ef651(0x1b7)]&&(_0x3820b5['alias']=_0x5c7faa[_0x5ef651(0x1b7)][_0x5ef651(0x1eb)],_0x3820b5[_0x5ef651(0x1cd)]=_0x5c7faa['hookLocation'][_0x5ef651(0x1cd)],_0x3820b5[_0x5ef651(0x208)]=_0x5c7faa[_0x5ef651(0x1b7)]['operationType'],_0x3820b5['functionNode']=_0x5c7faa[_0x5ef651(0x1b7)][_0x5ef651(0x1e7)]),_0x140168[_0x5ef651(0x212)][_0x5c7faa[_0x5ef651(0x1ef)]]=_0x3820b5,_0x51176e['push']({'lockKey':_0x5c7faa[_0x5ef651(0x1ef)],'remoteId':_0x2a6ef3['id']});}catch(_0x1faf1f){_0x421bf7[_0x5ef651(0x1f1)]({'lockKey':_0x5c7faa[_0x5ef651(0x1ef)],'error':_0x1faf1f instanceof Error?_0x1faf1f[_0x5ef651(0x1d6)]:String(_0x1faf1f)});}}_0x140168['lastSync']=new Date()[_0x5ef651(0x1bd)]();try{await writeBffLockFile(_0x4c86df[_0x5ef651(0x1ad)],_0x5ae17b);}catch(_0x5837d0){const _0x10987d=[...await _0x22315c['rollback'](),...await _0x3b3d60?.[_0x5ef651(0x19a)]()??[]];throw withRollbackErrors(_0x5837d0,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x10987d);}return{'ok':_0x421bf7['length']===0x0,'data':{'pulled':_0x51176e,'skipped':_0x3521f5,'conflicts':_0x439974,'failed':_0x421bf7},'message':formatPullMessage(_0x51176e['length'],_0x3521f5['length'],_0x439974[_0x5ef651(0x224)],_0x421bf7[_0x5ef651(0x224)])};}};function localUnsyncedConflict(_0x1a3e09,_0x24ed8f){const _0x572a40=a42_0x59b6b6,_0x5162b1=_0x1a3e09[_0x572a40(0x1ef)]['split']('/')['at'](-0x1);return{'code':_0x572a40(0x225),'lockKey':_0x1a3e09[_0x572a40(0x1ef)],'filePath':_0x1a3e09[_0x572a40(0x20e)],..._0x24ed8f!=null?{'remoteId':_0x24ed8f}:{},'message':'Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x572a40(0x1e2)+_0x1a3e09['type']+_0x572a40(0x1ed)+_0x5162b1+'\x20--format\x20compress','requiresReview':!![],'message':_0x572a40(0x1e3)}};}function formatPullMessage(_0x3876ff,_0x2ed4e4,_0x308e31,_0x217b1b){const _0x2969df=a42_0x59b6b6,_0x4560d6=[_0x2969df(0x218)+_0x3876ff+_0x2969df(0x1ca),_0x2ed4e4+_0x2969df(0x1ce)];_0x308e31>0x0&&_0x4560d6[_0x2969df(0x1f1)](_0x308e31+_0x2969df(0x1f9)+(_0x308e31===0x1?'':'s')+'\x20'+(_0x308e31===0x1?_0x2969df(0x1ac):_0x2969df(0x1be))+_0x2969df(0x1ab));if(_0x217b1b>0x0)_0x4560d6[_0x2969df(0x1f1)](_0x217b1b+'\x20failed');return _0x4560d6[_0x2969df(0x19b)](',\x20');}async function hasUnsyncedLocalChanges(_0x4fdd64,_0x43e453,_0x53bb30){const _0x12fd53=a42_0x59b6b6;if(!await fileExists(_0x4fdd64))return![];const _0x275ee2=await computeFileHash(_0x4fdd64);if(!_0x43e453)return _0x53bb30?_0x275ee2!==_0x53bb30:!![];return _0x275ee2!==_0x43e453[_0x12fd53(0x206)];}function createPullFileTransaction(){const _0x303d01=new Map(),_0x376053=async(_0x5bf9c9,_0x199e54)=>{const _0x216863=a42_0x118c;try{if(_0x199e54[_0x216863(0x21a)])await ensureParentDirectory(_0x5bf9c9),await writeFile(_0x5bf9c9,_0x199e54[_0x216863(0x1b6)]);else try{await unlink(_0x5bf9c9);}catch(_0x5547de){if(_0x5547de[_0x216863(0x1b2)]!==_0x216863(0x1f5))throw _0x5547de;}return undefined;}catch(_0x1365d7){return _0x1365d7 instanceof Error?_0x1365d7:new Error(String(_0x1365d7));}};return{async 'write'(_0x1b4ab5,_0x1a917b){const _0xd546ee=a42_0x118c;if(!_0x303d01[_0xd546ee(0x1f8)](_0x1b4ab5))try{_0x303d01[_0xd546ee(0x20f)](_0x1b4ab5,{'existed':!![],'content':await readFile(_0x1b4ab5)});}catch(_0x1d1946){if(_0x1d1946[_0xd546ee(0x1b2)]!==_0xd546ee(0x1f5))throw _0x1d1946;_0x303d01['set'](_0x1b4ab5,{'existed':![]});}try{await ensureParentDirectory(_0x1b4ab5),await writeFile(_0x1b4ab5,_0x1a917b,_0xd546ee(0x210));}catch(_0x557fee){const _0x1479e3=await _0x376053(_0x1b4ab5,_0x303d01[_0xd546ee(0x22f)](_0x1b4ab5));if(!_0x1479e3)_0x303d01['delete'](_0x1b4ab5);throw withRollbackErrors(_0x557fee,_0xd546ee(0x1a7)+_0x1b4ab5+'\x22.',_0x1479e3?[_0x1479e3]:[]);}},async 'rollback'(){const _0x313f34=a42_0x118c,_0x2ef98b=[];for(const [_0x23a325,_0x37cc48]of[..._0x303d01['entries']()][_0x313f34(0x211)]()){const _0x951299=await _0x376053(_0x23a325,_0x37cc48);_0x951299&&_0x2ef98b[_0x313f34(0x1f1)](new Error(_0x313f34(0x220)+_0x23a325+_0x313f34(0x1fd)+_0x951299['message']));}return _0x2ef98b;}};}function withRollbackErrors(_0x5e844c,_0x29d2d1,_0x279929){const _0x30a6cf=a42_0x59b6b6,_0x84763e=_0x5e844c instanceof Error?_0x5e844c:new Error(String(_0x5e844c));if(_0x279929['length']===0x0)return _0x84763e;return new AggregateError([_0x84763e,..._0x279929],_0x29d2d1+_0x30a6cf(0x1a1)+_0x279929[_0x30a6cf(0x1c0)](_0x374acf=>_0x374acf[_0x30a6cf(0x1d6)])[_0x30a6cf(0x19b)](';\x20'));}function buildDatasetCodeToAliasMap(_0x4cd8a0,_0x330207,_0x2552b8){const _0x2bc417=a42_0x59b6b6,_0x296b3c=resolveApiModelSource(_0x4cd8a0,_0x330207,_0x2552b8),_0x3c8373=loadAliasMap(_0x4cd8a0,undefined,_0x296b3c[_0x2bc417(0x20e)],_0x296b3c['profileName']);return assertUnambiguousHookAliases(_0x3c8373),new Map(_0x3c8373[_0x2bc417(0x1c0)](_0x1d9100=>[_0x1d9100['datasetCode'][_0x2bc417(0x1ba)](),_0x1d9100[_0x2bc417(0x1eb)]]));}async function planHookDirectoryMigration(_0x2bcead,_0x2206f9,_0x553674,_0x2d3689){const _0x428e51=a42_0x59b6b6,_0x2bdafc=new Map();for(const [_0x412c8c,_0x3e0966]of Object[_0x428e51(0x1b4)](_0x2206f9['functions'])){const [_0x254986,_0x2477f5,_0x3c9293,_0x2eff5b,_0x37590e,..._0x512dd7]=_0x412c8c['split']('/');if(_0x254986!=='HOOK'||!_0x2477f5||!_0x3c9293||!_0x2eff5b||!_0x37590e||_0x512dd7[_0x428e51(0x224)]>0x0||!_0x3e0966['datasetCode'])continue;const _0x2e5908=_0x553674[_0x428e51(0x22f)](_0x3e0966[_0x428e51(0x1cd)][_0x428e51(0x1ba)]()),_0x1715b5=_0x2e5908??_0x3e0966[_0x428e51(0x1cd)];if(!isSafeHookDirectorySegment(_0x2477f5))throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1fb)+_0x2477f5+_0x428e51(0x209));if(!isSafeHookDirectorySegment(_0x1715b5))throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x2477f5+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x2477f5===_0x1715b5)continue;const _0xd7cb2c=_0x2bdafc[_0x428e51(0x22f)](_0x2477f5)??{'datasetCode':_0x3e0966[_0x428e51(0x1cd)],'alias':_0x2e5908,'keyChanges':[]};if(_0xd7cb2c[_0x428e51(0x1cd)]!==_0x3e0966[_0x428e51(0x1cd)])throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x2477f5+_0x428e51(0x1cb));const _0x4d2503=_0x428e51(0x1a8)+_0x1715b5+'/'+_0x3c9293+'/'+_0x2eff5b+'/'+_0x37590e;try{resolveLocalFilePathFromLockKey(_0x2bcead,_0x412c8c),resolveLocalFilePathFromLockKey(_0x2bcead,_0x4d2503);}catch(_0x2e354a){throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1d3)+_0x412c8c+_0x428e51(0x1fd)+(_0x2e354a instanceof Error?_0x2e354a[_0x428e51(0x1d6)]:String(_0x2e354a)));}_0xd7cb2c[_0x428e51(0x1f7)][_0x428e51(0x1f1)]({'oldLockKey':_0x412c8c,'newLockKey':_0x4d2503,'entry':_0x3e0966}),_0x2bdafc[_0x428e51(0x20f)](_0x2477f5,_0xd7cb2c);}const _0x1f45f8=new Set([..._0x2bdafc['values']()][_0x428e51(0x1ec)](_0x142813=>_0x142813[_0x428e51(0x1f7)][_0x428e51(0x1c0)](_0x2d9ea0=>_0x2d9ea0[_0x428e51(0x1f3)]))),_0x39121d=new Map(),_0x3ac236=new Map();for(const [_0x5dbf3e,_0x2f3fbf]of _0x2bdafc){const _0xe6cf45=_0x2f3fbf[_0x428e51(0x1eb)]??_0x2f3fbf[_0x428e51(0x1cd)],_0x45f6e9=hookDirectoryIdentity(_0xe6cf45),_0x5b3330=_0x39121d[_0x428e51(0x22f)](_0x45f6e9);if(_0x5b3330&&_0x5b3330!==_0x5dbf3e)throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1f4)+_0x5b3330+_0x428e51(0x1dd)+_0x5dbf3e+'\x22:\x20both\x20target\x20\x22'+_0xe6cf45+_0x428e51(0x22d));_0x39121d[_0x428e51(0x20f)](_0x45f6e9,_0x5dbf3e);for(const _0x18a96c of _0x2f3fbf['keyChanges']){const _0x4fec92=_0x3ac236['get'](_0x18a96c[_0x428e51(0x1aa)]);if(_0x4fec92&&_0x4fec92!==_0x18a96c['oldLockKey'])throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x4fec92+_0x428e51(0x1dd)+_0x18a96c[_0x428e51(0x1f3)]+'\x22:\x20both\x20target\x20\x22'+_0x18a96c[_0x428e51(0x1aa)]+_0x428e51(0x1ea));if(_0x1f45f8[_0x428e51(0x1f8)](_0x18a96c[_0x428e51(0x1aa)]))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x18a96c[_0x428e51(0x1f3)]+_0x428e51(0x201)+_0x18a96c[_0x428e51(0x1aa)]+_0x428e51(0x1a6));_0x3ac236[_0x428e51(0x20f)](_0x18a96c['newLockKey'],_0x18a96c['oldLockKey']);}}const _0x25f687=new Map();for(const [_0x36e8f2,_0xd57c30]of _0x553674){_0x25f687[_0x428e51(0x20f)](hookDirectoryIdentity(_0xd57c30),_0x36e8f2);}const _0x16adb3=[];for(const [_0x17000f,_0x3d567a]of _0x2bdafc){const _0x120558=_0x3d567a['alias']??_0x3d567a[_0x428e51(0x1cd)],_0x8f4479=join(_0x2bcead[_0x428e51(0x1d1)],_0x428e51(0x19c),_0x17000f),_0x5316e5=join(_0x2bcead['scriptsRootDir'],_0x428e51(0x19c),_0x120558),_0x5d6094=await directoryExists(_0x8f4479),_0x1b2d70=await directoryExists(_0x5316e5),_0x486938=_0x5d6094?_0x1b2d70?await sameDirectory(_0x8f4479,_0x5316e5)?'case-rename':undefined:_0x428e51(0x1ae):'rekey';if(!_0x486938)throw CliErrors[_0x428e51(0x232)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x17000f+_0x428e51(0x230)+_0x120558+_0x428e51(0x202));const _0x51f97c=_0x25f687['get'](hookDirectoryIdentity(_0x17000f));if(_0x51f97c&&_0x51f97c!==_0x3d567a['datasetCode']['toLowerCase']()){const _0x1d9e06=new Set(_0x3d567a[_0x428e51(0x1f7)][_0x428e51(0x1c0)](_0x27a712=>_0x27a712['oldLockKey'])),_0x16ec48=_0x2d3689[_0x428e51(0x204)](_0x2d6fae=>_0x2d6fae[_0x428e51(0x20a)]===_0x428e51(0x19c)&&_0x2d6fae['alias']!=null&&hookDirectoryIdentity(_0x2d6fae['alias'])===hookDirectoryIdentity(_0x17000f)&&!_0x1d9e06[_0x428e51(0x1f8)](_0x2d6fae[_0x428e51(0x1ef)]));if(_0x16ec48[_0x428e51(0x224)]>0x0)throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x17000f+_0x428e51(0x1c7));}const _0x4ea3a6=_0x25f687[_0x428e51(0x22f)](hookDirectoryIdentity(_0x120558));if(_0x4ea3a6&&_0x4ea3a6!==_0x3d567a[_0x428e51(0x1cd)]['toLowerCase']())throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x17000f+_0x428e51(0x230)+_0x120558+_0x428e51(0x1b0));for(const _0x272141 of _0x3d567a[_0x428e51(0x1f7)]){const _0x1cf35d=_0x2206f9[_0x428e51(0x212)][_0x272141[_0x428e51(0x1aa)]];if(_0x1cf35d&&!_0x1f45f8[_0x428e51(0x1f8)](_0x272141[_0x428e51(0x1aa)])&&!sameHookIdentity(_0x272141[_0x428e51(0x207)],_0x1cf35d))throw CliErrors[_0x428e51(0x232)](_0x428e51(0x1a0)+_0x17000f+'\x22\x20to\x20\x22'+_0x120558+_0x428e51(0x1d2));}_0x16adb3['push']({'oldDirectory':_0x17000f,'newDirectory':_0x120558,'oldDirectoryPath':_0x8f4479,'newDirectoryPath':_0x5316e5,'mode':_0x486938,'alias':_0x3d567a[_0x428e51(0x1eb)],'keyChanges':_0x3d567a['keyChanges']});}const _0x5137c2={..._0x2206f9[_0x428e51(0x212)]},_0x5a1063=new Map(),_0x465d97=new Map();for(const _0x2c3913 of _0x16adb3){const _0x3ee3ee=_0x2c3913[_0x428e51(0x1c2)]!=='rekey';_0x3ee3ee&&_0x465d97[_0x428e51(0x20f)](hookDirectoryIdentity(_0x2c3913[_0x428e51(0x1cf)]),_0x2c3913[_0x428e51(0x223)]);for(const _0x1155bc of _0x2c3913[_0x428e51(0x1f7)]){const _0x39ed53=_0x5137c2[_0x1155bc[_0x428e51(0x1aa)]],_0xc3a919=_0x3ee3ee?_0x1155bc['entry']:_0x39ed53??_0x1155bc[_0x428e51(0x207)];_0x5137c2[_0x1155bc[_0x428e51(0x1aa)]]=canonicalizeHookEntry(_0xc3a919,_0x2c3913[_0x428e51(0x1eb)]),delete _0x5137c2[_0x1155bc[_0x428e51(0x1f3)]],_0x3ee3ee&&_0x5a1063[_0x428e51(0x20f)](_0x1155bc[_0x428e51(0x1aa)],resolveLocalFilePathFromLockKey(_0x2bcead,_0x1155bc[_0x428e51(0x1f3)]));}}return{'migrations':_0x16adb3,'projectedFunctions':_0x5137c2,'sourceFilePathByNewLockKey':_0x5a1063,'sourceDirectoryPathByNewDirectory':_0x465d97};}function resolveMigratedSourceFilePath(_0x57f0f3,_0x16dd9a){const _0x4bc676=a42_0x59b6b6;if(!_0x57f0f3||!_0x16dd9a)return undefined;const _0x103448=_0x57f0f3[_0x4bc676(0x21c)]['get'](_0x16dd9a[_0x4bc676(0x1ef)]);if(_0x103448)return _0x103448;if(_0x16dd9a[_0x4bc676(0x20a)]!==_0x4bc676(0x19c))return undefined;const [,_0x3dc95a,..._0x52db92]=_0x16dd9a[_0x4bc676(0x1ef)][_0x4bc676(0x1c9)]('/');if(!_0x3dc95a||_0x52db92['length']===0x0)return undefined;const _0x485c4c=_0x57f0f3['sourceDirectoryPathByNewDirectory'][_0x4bc676(0x22f)](hookDirectoryIdentity(_0x3dc95a));return _0x485c4c?join(_0x485c4c,..._0x52db92)+'.js':undefined;}function sameHookIdentity(_0x2f962b,_0xa46b48){const _0x22b6ce=a42_0x59b6b6;return _0x2f962b['remoteId']===_0xa46b48[_0x22b6ce(0x1cc)]&&_0x2f962b[_0x22b6ce(0x1cd)]===_0xa46b48[_0x22b6ce(0x1cd)]&&_0x2f962b[_0x22b6ce(0x208)]===_0xa46b48[_0x22b6ce(0x208)]&&_0x2f962b[_0x22b6ce(0x1e7)]===_0xa46b48[_0x22b6ce(0x1e7)];}function canonicalizeHookEntry(_0x1148de,_0x59583f){const {alias:_0x2a1939,..._0xb44d4d}=_0x1148de;return _0x59583f?{..._0xb44d4d,'alias':_0x59583f}:_0xb44d4d;}function hookDirectoryIdentity(_0x3d41b7){const _0x31b5fc=a42_0x59b6b6;return _0x3d41b7['normalize'](_0x31b5fc(0x22a))[_0x31b5fc(0x1ba)]();}function isSafeHookDirectorySegment(_0x1da962){return isSafeLockKeySegment(_0x1da962);}function a42_0x11bb(){const _0x11e867=['projectedFunctions','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','ENDPOINT','code','5PJgeIu','entries','appCode','content','hookLocation','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','lastSync','toLowerCase','migrations','mergedCli','toISOString','require','string','map','1163864yvxCAP','mode','newDirectoryPath','scriptType','write','question','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','would_pull','split','\x20pulled','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','remoteId','datasetCode','\x20skipped','newDirectory','pull','scriptsRootDir','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','nonInteractive','str','message','selectedAppName','40wopYXa','GET','scriptsRoot','apps','&type=','\x22\x20and\x20\x22','611360wdJjrm','55yaJHty','12jYEGoZ','COMMON','\x20bff\x20push\x20--type\x20','If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.','apiDir','dev','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','functionNode','1811496tQCRin','965657SVmjXr','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','alias','flatMap','\x20--name\x20','bff','lockKey','Remote\x20script\x20missing\x20content.','push','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','oldLockKey','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','ENOENT','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','keyChanges','has','\x20conflict','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','Pull\x20only\x20this\x20script\x20type','\x22:\x20','close','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','read','\x22:\x20its\x20target\x20\x22','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','/api/management/library/scripts/list?appCode=','filter','81qHYjPU','hash','entry','operationType','\x22\x20from\x20the\x20lock\x20file.','type','stderr','\x22\x20from\x20\x22','cancelled','filePath','set','utf8','reverse','functions','stdin','ino','381772oJGfQZ','case-rename','Remote\x20script\x20missing\x20id.','Pull\x20complete:\x20','stringify','existed','¤tPage=1&pageSize=','sourceFilePathByNewLockKey','Force\x20overwrite\x20local\x20unsynced\x20changes','some','\x22\x20not\x20found\x20after\x20ensureLockScope.','Could\x20not\x20restore\x20local\x20script\x20\x22','unresolvable\x20target\x20path','parse','oldDirectoryPath','length','BFF_LOCAL_UNSYNCED','functionName','1754334ZkCgtZ','scriptContent','conflict','NFC','skipped','version','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','force','get','\x22\x20to\x20\x22','includes','validation','Would\x20inspect\x20','rollback','join','HOOK','defaultApp','oldDirectory','614026rOxNmM','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','\x20Recovery\x20errors:\x20','all','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','Lock\x20scope\x20for\x20app\x20\x22','trim','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Failed\x20to\x20write\x20local\x20script\x20\x22','HOOK/','Force\x20pull\x20cancelled.','newLockKey','\x20resolution','requires','lockFilePath','move'];a42_0x11bb=function(){return _0x11e867;};return a42_0x11bb();}async function sameDirectory(_0x1adbfc,_0xb3354f){const _0xfeb117=a42_0x59b6b6,[_0x15ad26,_0x15ea1e]=await Promise[_0xfeb117(0x1a2)]([stat(_0x1adbfc),stat(_0xb3354f)]);return _0x15ad26[_0xfeb117(0x1e5)]===_0x15ea1e['dev']&&_0x15ad26[_0xfeb117(0x214)]===_0x15ea1e[_0xfeb117(0x214)];}async function applyHookDirectoryMigration(_0x2da0b2,_0x510c75){const _0x199a4d=a42_0x59b6b6,_0x1b51ea=_0x510c75[_0x199a4d(0x212)],_0x432e9f=_0x510c75[_0x199a4d(0x1b9)],_0x3b268a=[],_0x3d2f99=async()=>{const _0x2d9f7b=_0x199a4d,_0x2fc1b3=[];_0x510c75[_0x2d9f7b(0x212)]=_0x1b51ea,_0x510c75[_0x2d9f7b(0x1b9)]=_0x432e9f;for(const {migration:_0x386ecc,temporaryPath:_0x58363c}of[..._0x3b268a][_0x2d9f7b(0x211)]()){try{_0x58363c?(await rename(_0x386ecc[_0x2d9f7b(0x1c3)],_0x58363c),await rename(_0x58363c,_0x386ecc[_0x2d9f7b(0x223)])):await rename(_0x386ecc['newDirectoryPath'],_0x386ecc[_0x2d9f7b(0x223)]);}catch(_0x74c7ab){_0x2fc1b3['push'](new Error(_0x2d9f7b(0x1b8)+_0x386ecc['oldDirectory']+_0x2d9f7b(0x20c)+_0x386ecc['newDirectory']+'\x22:\x20'+(_0x74c7ab instanceof Error?_0x74c7ab[_0x2d9f7b(0x1d6)]:String(_0x74c7ab))));}}return _0x2fc1b3;};try{for(const _0x3c34bb of _0x2da0b2[_0x199a4d(0x1bb)]){if(_0x3c34bb[_0x199a4d(0x1c2)]===_0x199a4d(0x1ae))await ensureParentDirectory(_0x3c34bb[_0x199a4d(0x1c3)]),await rename(_0x3c34bb[_0x199a4d(0x223)],_0x3c34bb[_0x199a4d(0x1c3)]),_0x3b268a['push']({'migration':_0x3c34bb});else{if(_0x3c34bb[_0x199a4d(0x1c2)]===_0x199a4d(0x216)){const _0x318195=join(dirname(_0x3c34bb['oldDirectoryPath']),'.hook-directory-migrate-'+randomUUID());await rename(_0x3c34bb[_0x199a4d(0x223)],_0x318195);try{await rename(_0x318195,_0x3c34bb[_0x199a4d(0x1c3)]);}catch(_0x3182a9){try{await rename(_0x318195,_0x3c34bb[_0x199a4d(0x223)]);}catch(_0x5b114e){throw withRollbackErrors(_0x3182a9,_0x199a4d(0x1f2)+_0x3c34bb[_0x199a4d(0x19e)]+_0x199a4d(0x230)+_0x3c34bb['newDirectory']+'\x22;\x20temporary\x20directory\x20\x22'+_0x318195+'\x22\x20may\x20remain.',[new Error(_0x199a4d(0x1ff)+_0x318195+_0x199a4d(0x230)+_0x3c34bb[_0x199a4d(0x19e)]+_0x199a4d(0x1fd)+(_0x5b114e instanceof Error?_0x5b114e[_0x199a4d(0x1d6)]:String(_0x5b114e)))]);}throw _0x3182a9;}_0x3b268a[_0x199a4d(0x1f1)]({'migration':_0x3c34bb,'temporaryPath':_0x318195});}}}return _0x510c75[_0x199a4d(0x212)]=_0x2da0b2[_0x199a4d(0x1af)],{'rollback':_0x3d2f99};}catch(_0x298e5f){const _0x4e8f82=await _0x3d2f99();throw withRollbackErrors(_0x298e5f,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x4e8f82);}}async function confirmForce(){const _0x419b2c=a42_0x59b6b6,_0xae6b74=createInterface({'input':process[_0x419b2c(0x213)],'output':process[_0x419b2c(0x20b)]}),_0x32833d=await new Promise(_0x32da89=>{const _0x4422cc=_0x419b2c;_0xae6b74[_0x4422cc(0x1c6)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x32da89);});return _0xae6b74[_0x419b2c(0x1fe)](),['y','yes'][_0x419b2c(0x231)](_0x32833d[_0x419b2c(0x1a5)]()['toLowerCase']());}
|