@lovrabet/rabetbase-cli 2.5.4-beta.1 → 2.5.4-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- 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.d.ts +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/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.d.ts +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.d.ts +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.d.ts +4 -0
- 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.d.ts +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.d.ts +14 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.d.ts +1 -0
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +1 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.d.ts +15 -3
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.d.ts +2 -2
- 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.d.ts +5 -0
- 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 +2 -2
- package/skills/rabetbase/guides/sql-creation-workflow.md +1 -1
- package/skills/rabetbase/guides/sql-mybatis.md +12 -8
- package/skills/rabetbase/references/rabetbase-config.md +6 -4
- package/skills/rabetbase/references/rabetbase-init.md +7 -5
- package/skills/rabetbase/references/rabetbase-kb.md +8 -6
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a33_0x4af6cb=a33_0x4cff;(function(_0x32aec9,_0x3b17f9){const _0xf0f88e=a33_0x4cff,_0x38aa8e=_0x32aec9();while(!![]){try{const _0x53f27a=parseInt(_0xf0f88e(0x1ab))/0x1+-parseInt(_0xf0f88e(0x1b4))/0x2+parseInt(_0xf0f88e(0x1b2))/0x3+-parseInt(_0xf0f88e(0x1aa))/0x4*(parseInt(_0xf0f88e(0x1bc))/0x5)+parseInt(_0xf0f88e(0x1b7))/0x6*(parseInt(_0xf0f88e(0x1a4))/0x7)+-parseInt(_0xf0f88e(0x1b8))/0x8*(-parseInt(_0xf0f88e(0x1a3))/0x9)+-parseInt(_0xf0f88e(0x1ad))/0xa;if(_0x53f27a===_0x3b17f9)break;else _0x38aa8e['push'](_0x38aa8e['shift']());}catch(_0x37a61d){_0x38aa8e['push'](_0x38aa8e['shift']());}}}(a33_0x5c12,0x80571));function a33_0x5c12(){const _0x1379e3=['Create\x20or\x20update\x20one\x20runtime\x20app-config\x20key','isFinite',',\x20appCode=','/smartapi/app-config/create','apiError','461356VGYFQt','963785JsDxRr','number','18532360sMQoJS','tags','set','update','Read\x20config\x20value\x20from\x20file','553128roqEFN','app-config','125272XowIgG','get','create','392478qhYsyj','3943592zkkmWj','appCode','string','\x20app\x20config\x20','5bzpWHh','Updated','/smartapi/app-config/update','9ZWTmkN','98oSTuaB'];a33_0x5c12=function(){return _0x1379e3;};return a33_0x5c12();}import{createAppConfig,getAppConfigByKey,updateAppConfig}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{assertSingleValueSource,assertValueSourceReadable,asAppConfigDryRunResult,buildMutationData,FROM_ENV_FLAG,KEY_ARG,plannedAppConfig,projectAppConfig,readAppConfigValue,readKeyArg,readOptionalTags,STDIN_FLAG,TAGS_FLAG,VALUE_ARG,withAppConfigApiBoundary}from'../../commands/app-config/shared.js';function a33_0x4cff(_0x284b14,_0x3748a9){_0x284b14=_0x284b14-0x1a3;const _0x5c1278=a33_0x5c12();let _0x4cff2d=_0x5c1278[_0x284b14];return _0x4cff2d;}const CREATE_PATH=a33_0x4af6cb(0x1a8),UPDATE_PATH=a33_0x4af6cb(0x1be);export const appConfigSet={'service':a33_0x4af6cb(0x1b3),'command':a33_0x4af6cb(0x1af),'description':a33_0x4af6cb(0x1a5),'risk':'write','args':[KEY_ARG,VALUE_ARG],'flags':[APPCODE_FLAG_OPTIONAL,TAGS_FLAG,STDIN_FLAG,FROM_ENV_FLAG,{'name':'file','type':a33_0x4af6cb(0x1ba),'description':a33_0x4af6cb(0x1b1)}],async 'validate'(_0x44c8de){readKeyArg(_0x44c8de),readOptionalTags(_0x44c8de),assertSingleValueSource(_0x44c8de);},async 'dryRun'(_0x407db4){const _0x58210a=a33_0x4af6cb,_0x8cee95=readKeyArg(_0x407db4),_0x4f828f=readOptionalTags(_0x407db4),_0x22a7fe=assertSingleValueSource(_0x407db4);await assertValueSourceReadable(_0x22a7fe);const _0x3978b5=await withAppConfigApiBoundary(_0x58210a(0x1b5),{'appCode':_0x407db4[_0x58210a(0x1b9)],'key':_0x8cee95},()=>getAppConfigByKey(_0x407db4['appCode'],_0x8cee95)),_0x3b3ae4=_0x3978b5?_0x58210a(0x1b0):_0x58210a(0x1b6),_0x200bcc=_0x3978b5?projectAppConfig(_0x3978b5):null,_0xa532e=plannedAppConfig({'appCode':_0x407db4['appCode'],'key':_0x8cee95,'tags':_0x4f828f??_0x3978b5?.[_0x58210a(0x1ae)],'hasValue':!![]});return asAppConfigDryRunResult(buildMutationData({'operation':_0x3b3ae4,'appCode':_0x407db4['appCode'],'key':_0x8cee95,'before':_0x200bcc,'after':_0xa532e,'dryRun':!![]}),{'method':'POST','url':_0x3b3ae4==='update'?UPDATE_PATH:CREATE_PATH});},async 'execute'(_0x40e93e){const _0x5e5b11=a33_0x4af6cb,_0x4a73bc=readKeyArg(_0x40e93e),_0x44ec52=readOptionalTags(_0x40e93e),_0x196b16=await withAppConfigApiBoundary(_0x5e5b11(0x1b5),{'appCode':_0x40e93e[_0x5e5b11(0x1b9)],'key':_0x4a73bc},()=>getAppConfigByKey(_0x40e93e[_0x5e5b11(0x1b9)],_0x4a73bc)),_0x236d89=_0x196b16?projectAppConfig(_0x196b16):null,_0xe71890=_0x196b16?_0x5e5b11(0x1b0):_0x5e5b11(0x1b6),{value:_0x54754c,warnings:_0x200023}=await readAppConfigValue(_0x40e93e),_0x265675={'appCode':_0x40e93e[_0x5e5b11(0x1b9)],'key':_0x4a73bc,'value':_0x54754c,'tags':_0x44ec52??_0x196b16?.[_0x5e5b11(0x1ae)]??undefined};await withAppConfigApiBoundary(_0xe71890,{'appCode':_0x40e93e[_0x5e5b11(0x1b9)],'key':_0x4a73bc},async()=>{const _0x5bedd7=_0x5e5b11;_0x196b16?await updateAppConfig({..._0x265675,'id':requireAppConfigId(_0x196b16,_0x4a73bc,_0x40e93e[_0x5bedd7(0x1b9)])}):await createAppConfig(_0x265675);});const _0x5d18ed=await withAppConfigApiBoundary('get',{'appCode':_0x40e93e[_0x5e5b11(0x1b9)],'key':_0x4a73bc},()=>getAppConfigByKey(_0x40e93e[_0x5e5b11(0x1b9)],_0x4a73bc)),_0x3b2511=_0x5d18ed?projectAppConfig(_0x5d18ed):plannedAppConfig({'appCode':_0x40e93e[_0x5e5b11(0x1b9)],'key':_0x4a73bc,'tags':_0x265675['tags'],'hasValue':_0x54754c!==''});return{'ok':!![],'data':buildMutationData({'operation':_0xe71890,'appCode':_0x40e93e[_0x5e5b11(0x1b9)],'key':_0x4a73bc,'before':_0x236d89,'after':_0x3b2511,'dryRun':![],'warnings':_0x200023}),'message':(_0xe71890==='update'?_0x5e5b11(0x1bd):'Created')+_0x5e5b11(0x1bb)+_0x4a73bc};}};function requireAppConfigId(_0x25061b,_0x980fdd,_0x2c42bb){const _0x265ecf=a33_0x4af6cb;if(typeof _0x25061b['id']===_0x265ecf(0x1ac)&&Number[_0x265ecf(0x1a6)](_0x25061b['id'])&&_0x25061b['id']>0x0)return _0x25061b['id'];throw CliErrors[_0x265ecf(0x1a9)]('App\x20config\x20server\x20id\x20missing\x20for\x20key='+_0x980fdd+_0x265ecf(0x1a7)+_0x2c42bb);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x416c6c=a34_0x5cb2;(function(_0x16945b,_0x205d9a){const _0x57ffaf=a34_0x5cb2,_0x577d7c=_0x16945b();while(!![]){try{const _0x2830f2=-parseInt(_0x57ffaf(0xa4))/0x1+-parseInt(_0x57ffaf(0x6d))/0x2+parseInt(_0x57ffaf(0xa2))/0x3*(parseInt(_0x57ffaf(0x7c))/0x4)+-parseInt(_0x57ffaf(0x6e))/0x5+-parseInt(_0x57ffaf(0x9e))/0x6*(parseInt(_0x57ffaf(0x79))/0x7)+parseInt(_0x57ffaf(0x8f))/0x8+-parseInt(_0x57ffaf(0x98))/0x9*(-parseInt(_0x57ffaf(0x6a))/0xa);if(_0x2830f2===_0x205d9a)break;else _0x577d7c['push'](_0x577d7c['shift']());}catch(_0x467f70){_0x577d7c['push'](_0x577d7c['shift']());}}}(a34_0x3943,0x7ecff));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a34_0x416c6c(0xa9),'required':!![]};function a34_0x3943(){const _0x420660=['gmtModified','Runtime\x20app-config\x20key','utf8','Value\x20file\x20is\x20not\x20readable:\x20','apiError','appCode:\x20','Missing\x20app-config\x20value\x20source.','4609370JzcYGW','warnings','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','1215068xdepON','2496325bqgDeM','reveal','path','Config\x20tags\x20for\x20filtering/display\x20metadata','file','bool','length','url','flag','args','key:\x20','1429078NCTwVY','key','Failed\x20to\x20','63988DTHLja','\x20app\x20config.','string','value','stdin','before','valueRedacted','Read\x20config\x20value\x20from\x20stdin','from-env','appCode','push','tags','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','setEncoding','slice','Missing\x20app-config\x20key.','data','env','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','5785664xOXJgs','name','argument','once','boolean','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','value\x20is\x20redacted','dryRun','trim','27kBchLu','Environment\x20variable\x20is\x20not\x20set:\x20','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','gmtCreate','validation','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','6prCDpW','method','operation','kind','93eMFBWq','str','771550gvEcxD','after','defineProperties','join'];a34_0x3943=function(){return _0x420660;};return a34_0x3943();}export const VALUE_ARG={'name':a34_0x416c6c(0x7f),'description':'Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','required':![]};export const TAGS_FLAG={'name':a34_0x416c6c(0x87),'type':a34_0x416c6c(0x7e),'description':a34_0x416c6c(0x71)};export const STDIN_FLAG={'name':a34_0x416c6c(0x80),'type':a34_0x416c6c(0x93),'description':a34_0x416c6c(0x83),'default':![]};export const FROM_ENV_FLAG={'name':a34_0x416c6c(0x84),'type':a34_0x416c6c(0x7e),'description':a34_0x416c6c(0x6c)};export const REVEAL_FLAG={'name':a34_0x416c6c(0x6f),'type':'boolean','description':a34_0x416c6c(0x9a),'default':![]};export function readKeyArg(_0x26f01c){const _0x48f836=a34_0x416c6c,_0x22b332=_0x26f01c[_0x48f836(0x77)][0x0]?.[_0x48f836(0x97)]()??'';return validateKey(_0x22b332),_0x22b332;}function a34_0x5cb2(_0x15927f,_0xf15b8d){_0x15927f=_0x15927f-0x65;const _0x3943bc=a34_0x3943();let _0x5cb264=_0x3943bc[_0x15927f];return _0x5cb264;}export function readOptionalTags(_0x1739d9){const _0x235699=a34_0x416c6c,_0x440622=_0x1739d9['str'](_0x235699(0x87))['trim']();if(!_0x440622)return undefined;if(_0x440622[_0x235699(0x74)]>0x20)throw CliErrors[_0x235699(0x9c)](_0x235699(0x9d));return _0x440622;}export function validateKey(_0x32590b){const _0x54952d=a34_0x416c6c;if(!_0x32590b)throw CliErrors[_0x54952d(0x9c)](_0x54952d(0x8b));if(_0x32590b[_0x54952d(0x74)]>0x100)throw CliErrors[_0x54952d(0x9c)](_0x54952d(0x88));}export function projectAppConfig(_0x260439,_0x4bc732){const _0x55d822=a34_0x416c6c,_0x4ae4c3=_0x260439['value']!==undefined&&_0x260439[_0x55d822(0x7f)]!==null&&_0x260439[_0x55d822(0x7f)]!=='',_0x4ea85f={'appCode':_0x260439[_0x55d822(0x85)],'key':_0x260439['key'],'tags':_0x260439[_0x55d822(0x87)]??undefined,'hasValue':_0x4ae4c3,'valueRedacted':_0x4ae4c3&&!_0x4bc732?.[_0x55d822(0x6f)],'gmtCreate':_0x260439[_0x55d822(0x9b)],'gmtModified':_0x260439[_0x55d822(0xa8)]};return _0x4bc732?.['reveal']&&(_0x4ea85f[_0x55d822(0x7f)]=_0x260439[_0x55d822(0x7f)]??'',_0x4ea85f[_0x55d822(0x82)]=![]),_0x4ea85f;}export function plannedAppConfig(_0x1c611c){const _0x4ee540=a34_0x416c6c,_0x109c80=_0x1c611c['hasValue']??!![];return{'appCode':_0x1c611c[_0x4ee540(0x85)],'key':_0x1c611c['key'],'tags':_0x1c611c['tags']??undefined,'hasValue':_0x109c80,'valueRedacted':_0x109c80};}export function buildMutationData(_0x2209cd){const _0x3cd757=a34_0x416c6c;return{'operation':_0x2209cd[_0x3cd757(0xa0)],'selector':{'appCode':_0x2209cd[_0x3cd757(0x85)],'key':_0x2209cd[_0x3cd757(0x7a)]},'before':_0x2209cd[_0x3cd757(0x81)],'after':_0x2209cd[_0x3cd757(0xa5)],'dryRun':_0x2209cd[_0x3cd757(0x96)],'warnings':_0x2209cd[_0x3cd757(0x6b)]??[]};}export async function withAppConfigApiBoundary(_0x5c44ea,_0x1078ba,_0x3ca897){const _0x23c215=a34_0x416c6c;try{return await _0x3ca897();}catch{const _0x6b8ed9=[_0x23c215(0x68)+_0x1078ba[_0x23c215(0x85)]];if(_0x1078ba[_0x23c215(0x7a)])_0x6b8ed9['push'](_0x23c215(0x78)+_0x1078ba[_0x23c215(0x7a)]);_0x6b8ed9[_0x23c215(0x86)](_0x23c215(0x95));throw CliErrors[_0x23c215(0x67)](_0x23c215(0x7b)+_0x5c44ea+_0x23c215(0x7d),_0x6b8ed9['join'](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x29a4b1,_0x3829b6){const _0x5a9569=a34_0x416c6c;return Object[_0x5a9569(0xa6)](_0x29a4b1,{'method':{'value':_0x3829b6[_0x5a9569(0x9f)],'enumerable':![]},'url':{'value':_0x3829b6[_0x5a9569(0x75)],'enumerable':![]}});}export function assertSingleValueSource(_0x4d7b45){const _0x568bd0=a34_0x416c6c,_0x323334=[];_0x4d7b45[_0x568bd0(0x77)][_0x568bd0(0x74)]>0x1&&_0x323334[_0x568bd0(0x86)]({'kind':_0x568bd0(0x91),'value':_0x4d7b45[_0x568bd0(0x77)][_0x568bd0(0x8a)](0x1)[_0x568bd0(0xa7)]('\x20')});const _0x5f5a3f=_0x4d7b45[_0x568bd0(0x76)](_0x568bd0(0x7f));_0x5f5a3f!==undefined&&_0x5f5a3f!==null&&_0x323334[_0x568bd0(0x86)]({'kind':_0x568bd0(0x91),'value':String(_0x5f5a3f)});_0x4d7b45[_0x568bd0(0x73)](_0x568bd0(0x80))&&_0x323334[_0x568bd0(0x86)]({'kind':_0x568bd0(0x80)});const _0x59a9cb=_0x4d7b45['str'](_0x568bd0(0x84))[_0x568bd0(0x97)]();_0x59a9cb&&_0x323334[_0x568bd0(0x86)]({'kind':_0x568bd0(0x8d),'name':_0x59a9cb});const _0xe19835=_0x4d7b45[_0x568bd0(0xa3)](_0x568bd0(0x72))['trim']();_0xe19835&&_0x323334['push']({'kind':_0x568bd0(0x72),'path':_0xe19835});if(_0x323334[_0x568bd0(0x74)]===0x0)throw CliErrors['validation'](_0x568bd0(0x69),'Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');if(_0x323334[_0x568bd0(0x74)]>0x1)throw CliErrors[_0x568bd0(0x9c)]('App\x20config\x20value\x20source\x20is\x20ambiguous.',_0x568bd0(0x94));return _0x323334[0x0];}export async function assertValueSourceReadable(_0x1da7d4){const _0x526de7=a34_0x416c6c;if(_0x1da7d4[_0x526de7(0xa1)]===_0x526de7(0x8d)&&!(_0x1da7d4[_0x526de7(0x90)]in process.env))throw CliErrors[_0x526de7(0x9c)](_0x526de7(0x99)+_0x1da7d4[_0x526de7(0x90)]);if(_0x1da7d4[_0x526de7(0xa1)]===_0x526de7(0x72))try{await access(_0x1da7d4['path']);}catch{throw CliErrors[_0x526de7(0x9c)](_0x526de7(0x66)+_0x1da7d4['path']);}}export async function readAppConfigValue(_0x40048b){const _0x5953c2=a34_0x416c6c,_0x12100b=assertSingleValueSource(_0x40048b),_0xc7fc06=[];if(_0x12100b[_0x5953c2(0xa1)]===_0x5953c2(0x91))return _0xc7fc06[_0x5953c2(0x86)](_0x5953c2(0x8e)),{'value':_0x12100b[_0x5953c2(0x7f)]??'','source':_0x12100b['kind'],'warnings':_0xc7fc06};if(_0x12100b[_0x5953c2(0xa1)]===_0x5953c2(0x80))return{'value':await readStdin(),'source':_0x12100b[_0x5953c2(0xa1)],'warnings':_0xc7fc06};if(_0x12100b[_0x5953c2(0xa1)]===_0x5953c2(0x8d)){if(!(_0x12100b[_0x5953c2(0x90)]in process.env))throw CliErrors[_0x5953c2(0x9c)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x12100b[_0x5953c2(0x90)]);return{'value':process.env[_0x12100b.name]??'','source':_0x12100b[_0x5953c2(0xa1)],'warnings':_0xc7fc06};}return{'value':await readFile(_0x12100b[_0x5953c2(0x70)],_0x5953c2(0x65)),'source':_0x12100b[_0x5953c2(0xa1)],'warnings':_0xc7fc06};}function readStdin(){return new Promise((_0x1fa69f,_0x3800e2)=>{const _0x433632=a34_0x5cb2;let _0xd50447='';process[_0x433632(0x80)][_0x433632(0x89)](_0x433632(0x65)),process['stdin']['on'](_0x433632(0x8c),_0x5cbaa4=>{_0xd50447+=_0x5cbaa4;}),process[_0x433632(0x80)]['once']('end',()=>_0x1fa69f(_0xd50447)),process[_0x433632(0x80)][_0x433632(0x92)]('error',_0x3800e2);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a35_0x4900(){const _0x4cb0b3=['nonInteractive','yes','1dMBsUe','../../auth/auth-server-ui.js','boolean','1328000EOGxfS','16uuFXxL','155604FGlbZX','!\x20Not\x20logged\x20in','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','logout','20DxzSsC','Clear\x20login\x20session','7438878UdCMos','161606SeHKSs','8792ZHrHRY','Login\x20via\x20browser','login','726xKVqQu','write','2400534wjpObd','bool','233658wJlAAs','3367wLjvZY','log'];a35_0x4900=function(){return _0x4cb0b3;};return a35_0x4900();}const a35_0x2b92b7=a35_0x7551;(function(_0x544701,_0xf78adf){const _0xe4a041=a35_0x7551,_0x2be85d=_0x544701();while(!![]){try{const _0x3ac556=parseInt(_0xe4a041(0x1b3))/0x1*(-parseInt(_0xe4a041(0x1a6))/0x2)+parseInt(_0xe4a041(0x1ae))/0x3*(-parseInt(_0xe4a041(0x1b7))/0x4)+parseInt(_0xe4a041(0x1b6))/0x5+parseInt(_0xe4a041(0x1a5))/0x6+-parseInt(_0xe4a041(0x1af))/0x7*(parseInt(_0xe4a041(0x1a7))/0x8)+parseInt(_0xe4a041(0x1ac))/0x9*(-parseInt(_0xe4a041(0x1a3))/0xa)+-parseInt(_0xe4a041(0x1aa))/0xb*(-parseInt(_0xe4a041(0x1b8))/0xc);if(_0x3ac556===_0xf78adf)break;else _0x2be85d['push'](_0x2be85d['shift']());}catch(_0x291a36){_0x2be85d['push'](_0x2be85d['shift']());}}}(a35_0x4900,0xdd641));function a35_0x7551(_0x506be4,_0x4f08cc){_0x506be4=_0x506be4-0x1a0;const _0x490057=a35_0x4900();let _0x75519a=_0x490057[_0x506be4];return _0x75519a;}import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':'auth','command':a35_0x2b92b7(0x1a9),'description':a35_0x2b92b7(0x1a8),'risk':a35_0x2b92b7(0x1ab),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'yes','type':a35_0x2b92b7(0x1b5),'description':a35_0x2b92b7(0x1a1),'default':![]}],async 'execute'(_0x446ff1){const _0x22e290=a35_0x2b92b7,{runAuthServer:_0x35c827}=await import(_0x22e290(0x1b4));return await _0x35c827({'autoYes':_0x446ff1[_0x22e290(0x1ad)](_0x22e290(0x1b2)),'nonInteractive':_0x446ff1[_0x22e290(0x1b1)]}),{'ok':!![]};}},{'service':'auth','command':a35_0x2b92b7(0x1a2),'description':a35_0x2b92b7(0x1a4),'risk':a35_0x2b92b7(0x1ab),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x43abcd){const _0x21f827=a35_0x2b92b7;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x21f827(0x1b0)]('✓\x20Logged\x20out')):console[_0x21f827(0x1b0)](_0x21f827(0x1a0)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a36_0xbc87(){const _0x36e971=['\x22\x20not\x20found.\x20','\x0a\x20*\x20[平台配置]\x20','Operation\x20type\x20(HOOK\x20only)','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','read','Select\x20trigger\x20node:','/**\x0a\x20*\x20','function-node','write','length','Invalid\x20function\x20name\x20\x22','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','str','Available\x20aliases:\x20','isInteger','/HOOK/','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','5lWEZIA','close','/COMMON/','File\x20already\x20exists:\x20','Select\x20dataset:','\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','find','No\x20model\x20aliases\x20found.\x20Run\x20`','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','No\x20datasets\x20found\x20for\x20this\x20app.','207075knHzQy','83564qNTzpZ','appCode','name','description','831450iPxzBt','keys','Function\x20name\x20(valid\x20JS\x20identifier)','UNKNOWN','COMMON','after','join','.js','.js\x0a','\x22\x20not\x20found\x20for\x20dataset\x20','operationType','trim','profileName','\x22.\x20','question','Select\x20operation\x20type:','Script\x20description','\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','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','mergedCli','Operation\x20type\x20\x22','82922ZmjyLe','ENDPOINT','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','1430586YZzYXp','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','71768JbMWiZ','currentApp','HOOK','apiDir','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','map','create','validation','修改后的响应结果','修改后的请求参数','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','No\x20operation\x20types\x20found\x20for\x20dataset\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无(如有通知或外部调用,说明影响与失败策略)','before','utf8','Alias\x20\x22','当前请求参数','datasetId','filePath','stderr','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','stdin','entries','alias','code','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','defaultApp','datasetCode','.js\x0a\x20*\x20[触发节点]\x20','functionNode','string','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','42iZOICN','includes','tableName','Dataset\x20not\x20found\x20for\x20code\x20\x22','\x22,\x20params\x20})\x0a','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','scriptsRootDir','Script\x20type','/ENDPOINT/','/data/dataset/','selectedAppName','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','当前响应结果','\x20api\x20pull`\x20to\x20refresh.','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.',']\x20(','Created\x20','6wfolxJ','source','Trigger\x20node\x20(HOOK\x20only)','nonInteractive','Invalid\x20dataset\x20selection.','665658uCNHqT','operation-type'];a36_0xbc87=function(){return _0x36e971;};return a36_0xbc87();}const a36_0x592d32=a36_0xe485;(function(_0x34f9cd,_0x557c40){const _0x37cc98=a36_0xe485,_0x56013a=_0x34f9cd();while(!![]){try{const _0x6d0eb4=parseInt(_0x37cc98(0x1b0))/0x1*(parseInt(_0x37cc98(0x1d4))/0x2)+parseInt(_0x37cc98(0x198))/0x3*(-parseInt(_0x37cc98(0x1bb))/0x4)+-parseInt(_0x37cc98(0x1ba))/0x5+parseInt(_0x37cc98(0x19d))/0x6+parseInt(_0x37cc98(0x186))/0x7*(-parseInt(_0x37cc98(0x1d9))/0x8)+-parseInt(_0x37cc98(0x1d7))/0x9+parseInt(_0x37cc98(0x1bf))/0xa;if(_0x6d0eb4===_0x557c40)break;else _0x56013a['push'](_0x56013a['shift']());}catch(_0x4e0134){_0x56013a['push'](_0x56013a['shift']());}}}(a36_0xbc87,0x19bc8));import{createInterface}from'node:readline';function a36_0xe485(_0x3722f1,_0x4804ff){_0x3722f1=_0x3722f1-0x172;const _0xbc8792=a36_0xbc87();let _0xe485b8=_0xbc8792[_0x3722f1];return _0xe485b8;}import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{DEFAULT_BFF_SCRIPT_DESCRIPTION,isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a36_0x592d32(0x1df),'description':a36_0x592d32(0x179),'risk':a36_0x592d32(0x1a3),'flags':[{'name':'type','type':'string','required':!![],'enum':[a36_0x592d32(0x1c3),a36_0x592d32(0x1d5),a36_0x592d32(0x1db)],'description':a36_0x592d32(0x18e)},{'name':a36_0x592d32(0x1bd),'type':a36_0x592d32(0x184),'required':!![],'description':a36_0x592d32(0x1c1)},{'name':a36_0x592d32(0x1be),'type':a36_0x592d32(0x184),'description':a36_0x592d32(0x1cf)},{'name':a36_0x592d32(0x17d),'type':a36_0x592d32(0x184),'description':a36_0x592d32(0x1af)},{'name':'datasetcode','type':a36_0x592d32(0x184),'description':a36_0x592d32(0x1d1)},{'name':a36_0x592d32(0x19e),'type':a36_0x592d32(0x184),'description':a36_0x592d32(0x1a1)},{'name':a36_0x592d32(0x1a6),'type':a36_0x592d32(0x184),'description':a36_0x592d32(0x19a),'enum':['before',a36_0x592d32(0x1c4)]}],async 'validate'(_0x5e40ac){const _0x1b1ce2=a36_0x592d32,_0x3ccd23=_0x5e40ac['str'](_0x1b1ce2(0x1bd));if(!isValidBffFunctionName(_0x3ccd23))throw CliErrors[_0x1b1ce2(0x1e0)](_0x1b1ce2(0x1a9)+_0x3ccd23+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x3d2c4b){const _0x4a1e5e=a36_0x592d32,_0x445405=loadBffProjectConfig(_0x3d2c4b[_0x4a1e5e(0x1bc)]),_0x56af27=_0x3d2c4b[_0x4a1e5e(0x1ab)]('type'),_0x578fe7=_0x3d2c4b[_0x4a1e5e(0x1ab)](_0x4a1e5e(0x1bd)),_0x262af4=_0x3d2c4b[_0x4a1e5e(0x1ab)]('description')||undefined,_0x103418=_0x56af27===_0x4a1e5e(0x1db)?await resolveHookOptions(_0x445405,_0x3d2c4b):undefined,_0x191be1=buildFilePath(_0x445405,_0x56af27,_0x578fe7,_0x103418);if(await fileExists(_0x191be1))throw CliErrors[_0x4a1e5e(0x1e0)](_0x4a1e5e(0x1b3)+_0x191be1);await mkdir(dirname(_0x191be1),{'recursive':!![]});const _0x1b111e=generateTemplate(_0x56af27,_0x578fe7,_0x3d2c4b[_0x4a1e5e(0x1bc)],_0x262af4,_0x103418);await writeFile(_0x191be1,_0x1b111e,_0x4a1e5e(0x173));const _0x5632b3={'type':_0x56af27,'name':_0x578fe7,'path':_0x191be1};if(_0x262af4)_0x5632b3[_0x4a1e5e(0x1be)]=_0x262af4;if(_0x103418){if(_0x103418['alias'])_0x5632b3[_0x4a1e5e(0x17d)]=_0x103418[_0x4a1e5e(0x17d)];_0x5632b3[_0x4a1e5e(0x181)]=_0x103418['datasetCode'],_0x5632b3[_0x4a1e5e(0x1c9)]=_0x103418[_0x4a1e5e(0x1c9)],_0x5632b3[_0x4a1e5e(0x183)]=_0x103418[_0x4a1e5e(0x183)];}return{'ok':!![],'data':_0x5632b3,'message':_0x4a1e5e(0x197)+_0x56af27+'\x20function:\x20'+_0x578fe7};}};async function resolveHookOptions(_0x5b61ef,_0x3febaa){const _0x25e7c8=a36_0x592d32,_0x6789cc=resolveApiModelSource(_0x3febaa[_0x25e7c8(0x1dc)],_0x3febaa['appCode'],_0x3febaa[_0x25e7c8(0x191)]||_0x3febaa[_0x25e7c8(0x1d2)]?.[_0x25e7c8(0x1da)]||_0x3febaa[_0x25e7c8(0x1d2)]?.[_0x25e7c8(0x180)]),_0x1e2282=loadAliasMap(_0x3febaa[_0x25e7c8(0x1dc)],undefined,_0x6789cc[_0x25e7c8(0x177)],_0x6789cc[_0x25e7c8(0x1cb)]),_0x149de0=_0x1e2282[_0x25e7c8(0x1a8)]>0x0;let _0x465390,_0x46fe5a,_0x46f5ba;const _0x3f99dd=_0x3febaa['str'](_0x25e7c8(0x17d)),_0x41752f=_0x3febaa[_0x25e7c8(0x1ab)]('datasetcode');if(_0x3f99dd){const _0x5092d2=resolveAlias(_0x3febaa['apiDir'],_0x3f99dd,undefined,_0x6789cc['filePath'],_0x6789cc['profileName']);if(!_0x5092d2){const _0xaf4f2b=_0x149de0?_0x25e7c8(0x1ac)+_0x1e2282[_0x25e7c8(0x1de)](_0x286508=>_0x286508[_0x25e7c8(0x17d)])[_0x25e7c8(0x1c5)](',\x20'):_0x25e7c8(0x1b7)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors['validation'](_0x25e7c8(0x174)+_0x3f99dd+_0x25e7c8(0x19f)+_0xaf4f2b);}_0x465390=_0x3f99dd,_0x46fe5a=_0x5092d2;}else{if(_0x41752f){_0x46fe5a=_0x41752f;const _0x3af8f5=_0x1e2282[_0x25e7c8(0x1b6)](_0x3a896b=>_0x3a896b[_0x25e7c8(0x181)]===_0x41752f);_0x465390=_0x3af8f5?.[_0x25e7c8(0x17d)];}else{if(_0x3febaa[_0x25e7c8(0x19b)])throw CliErrors[_0x25e7c8(0x1e0)]('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x149de0){const _0x38f7c7=_0x1e2282[_0x25e7c8(0x1de)](_0x2360be=>_0x2360be['alias']+'\x20('+_0x2360be[_0x25e7c8(0x188)]+')'),_0x1800db=await promptSelect('Select\x20dataset:',_0x38f7c7),_0x57205b=_0x1e2282[_0x1800db];if(!_0x57205b)throw CliErrors[_0x25e7c8(0x1e0)](_0x25e7c8(0x19c));_0x465390=_0x57205b['alias'],_0x46fe5a=_0x57205b[_0x25e7c8(0x181)];}else{const _0x1951f5=await listDatasets(_0x3febaa[_0x25e7c8(0x1bc)]);if(_0x1951f5[_0x25e7c8(0x1a8)]===0x0)throw CliErrors[_0x25e7c8(0x1e0)](_0x25e7c8(0x1b9));const _0x23aafd=_0x1951f5[_0x25e7c8(0x1de)](_0x10b120=>_0x10b120[_0x25e7c8(0x1bd)]+'\x20['+(_0x10b120[_0x25e7c8(0x199)]??_0x25e7c8(0x1c2))+_0x25e7c8(0x196)+_0x10b120[_0x25e7c8(0x17e)]+')'),_0x891711=await promptSelect(_0x25e7c8(0x1b4),_0x23aafd),_0x4bf026=_0x1951f5[_0x891711];if(!_0x4bf026)throw CliErrors[_0x25e7c8(0x1e0)](_0x25e7c8(0x19c));_0x46fe5a=_0x4bf026[_0x25e7c8(0x17e)],_0x465390=undefined;}}}}const _0x3cdc8b=await listDatasets(_0x3febaa['appCode']),_0x507a89=_0x3cdc8b[_0x25e7c8(0x1b6)](_0x38f304=>_0x38f304['code']===_0x46fe5a);if(!_0x507a89)throw CliErrors['validation'](_0x25e7c8(0x189)+_0x46fe5a+_0x25e7c8(0x1cc)+(_0x465390?_0x25e7c8(0x192)+CLI_BIN_NAME+_0x25e7c8(0x194):''));_0x46f5ba=_0x507a89['id'];const _0x302d73=_0x465390??_0x46fe5a,_0x54d10d=await listBffDatasetOperations(_0x3febaa[_0x25e7c8(0x1bc)],_0x46f5ba),_0x202a34=_0x54d10d?Object[_0x25e7c8(0x1c0)](_0x54d10d):[];if(_0x202a34[_0x25e7c8(0x1a8)]===0x0)throw CliErrors['validation'](_0x25e7c8(0x1e4)+_0x302d73+'.');let _0x39669a;const _0x2174ed=_0x3febaa[_0x25e7c8(0x1ab)]('operation-type');if(_0x2174ed){if(!_0x202a34[_0x25e7c8(0x187)](_0x2174ed))throw CliErrors[_0x25e7c8(0x1e0)](_0x25e7c8(0x1d3)+_0x2174ed+_0x25e7c8(0x1c8)+_0x302d73+'.\x20'+('Available:\x20'+_0x202a34[_0x25e7c8(0x1c5)](',\x20')));_0x39669a=_0x2174ed;}else{if(_0x3febaa[_0x25e7c8(0x19b)])throw CliErrors[_0x25e7c8(0x1e0)](_0x25e7c8(0x1a2));const _0x5b7415=await promptSelect(_0x25e7c8(0x1ce),_0x202a34);_0x39669a=_0x202a34[_0x5b7415]??_0x202a34[0x0];}let _0x1fc9d9=normalizeHookFunctionNode(_0x3febaa[_0x25e7c8(0x1ab)](_0x25e7c8(0x1a6)));if(!_0x1fc9d9){if(_0x3febaa[_0x25e7c8(0x1ab)](_0x25e7c8(0x1a6)))throw CliErrors[_0x25e7c8(0x1e0)](_0x25e7c8(0x1dd));if(_0x3febaa[_0x25e7c8(0x19b)])throw CliErrors['validation'](_0x25e7c8(0x195));const _0x2f6287=await promptSelect(_0x25e7c8(0x1a4),[_0x25e7c8(0x172),_0x25e7c8(0x1c4)]);_0x1fc9d9=[_0x25e7c8(0x172),_0x25e7c8(0x1c4)][_0x2f6287]??_0x25e7c8(0x172);}return{'alias':_0x465390,'datasetCode':_0x46fe5a,'datasetId':_0x46f5ba,'operationType':_0x39669a,'functionNode':_0x1fc9d9};}async function promptSelect(_0x4bfa7a,_0x27b315){const _0x32482c=a36_0x592d32;if(_0x27b315[_0x32482c(0x1a8)]===0x1)return 0x0;for(const [_0x35023c,_0x463b12]of _0x27b315[_0x32482c(0x17c)]()){process[_0x32482c(0x178)][_0x32482c(0x1a7)]('\x20\x20'+(_0x35023c+0x1)+'.\x20'+_0x463b12+'\x0a');}const _0x2b90e2=createInterface({'input':process[_0x32482c(0x17b)],'output':process[_0x32482c(0x178)]});while(!![]){const _0x1fc7de=await new Promise(_0x4e284a=>{const _0x170e3c=_0x32482c;_0x2b90e2[_0x170e3c(0x1cd)](_0x4bfa7a+'\x20',_0x4e284a);}),_0x3138bf=Number['parseInt'](_0x1fc7de[_0x32482c(0x1ca)](),0xa);if(Number[_0x32482c(0x1ad)](_0x3138bf)&&_0x3138bf>=0x1&&_0x3138bf<=_0x27b315[_0x32482c(0x1a8)])return _0x2b90e2[_0x32482c(0x1b1)](),_0x3138bf-0x1;process[_0x32482c(0x178)][_0x32482c(0x1a7)](_0x32482c(0x1d8)+_0x27b315[_0x32482c(0x1a8)]+'.\x0a');}}function buildFilePath(_0x330809,_0x556853,_0xb83076,_0x2651bc){const _0x15601f=a36_0x592d32;if(_0x556853===_0x15601f(0x1db)){if(!_0x2651bc)throw CliErrors[_0x15601f(0x1e0)]('HOOK\x20requires\x20alias/operation/node\x20options.');const _0x8ab404=_0x2651bc[_0x15601f(0x17d)]??_0x2651bc[_0x15601f(0x181)];return join(_0x330809[_0x15601f(0x18d)],_0x15601f(0x1db),_0x8ab404,_0x2651bc[_0x15601f(0x1c9)],_0x2651bc[_0x15601f(0x183)],_0xb83076+_0x15601f(0x1c6));}return join(_0x330809[_0x15601f(0x18d)],_0x556853,_0xb83076+_0x15601f(0x1c6));}export function generateTemplate(_0x365608,_0x1681f6,_0x10db54,_0x5e1ab3,_0x22966e){const _0x16a74b=a36_0x592d32,_0x121f0f=_0x5e1ab3?.['trim']()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x42428b=getAppBaseUrl(_0x10db54),_0x222949=_0x16a74b(0x1e5);if(_0x365608===_0x16a74b(0x1c3))return _0x16a74b(0x1a5)+_0x121f0f+_0x16a74b(0x185)+_0x1681f6+_0x16a74b(0x1a0)+_0x42428b+_0x16a74b(0x17f)+_0x10db54+_0x16a74b(0x1b2)+_0x1681f6+_0x16a74b(0x17a)+_0x1681f6+_0x16a74b(0x18a)+_0x222949+_0x16a74b(0x1d0)+_0x1681f6+_0x16a74b(0x18c);if(_0x365608===_0x16a74b(0x1d5))return'/**\x0a\x20*\x20'+_0x121f0f+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x1681f6+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x10db54+'/'+_0x1681f6+'\x0a\x20*\x20[平台配置]\x20'+_0x42428b+_0x16a74b(0x17f)+_0x10db54+_0x16a74b(0x18f)+_0x1681f6+_0x16a74b(0x1c7)+_0x222949+_0x16a74b(0x1b5)+_0x1681f6+_0x16a74b(0x18c);if(!_0x22966e)throw CliErrors[_0x16a74b(0x1e0)]('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');const _0x3c958b=_0x22966e[_0x16a74b(0x17d)]??_0x22966e['datasetCode'],_0x36b73e=_0x22966e['functionNode']===_0x16a74b(0x172)?_0x16a74b(0x175):_0x16a74b(0x193),_0x5918d0=_0x22966e[_0x16a74b(0x183)]==='before'?_0x16a74b(0x1e2):_0x16a74b(0x1e1);return _0x16a74b(0x1a5)+_0x121f0f+_0x16a74b(0x1d6)+_0x1681f6+_0x16a74b(0x1e3)+_0x10db54+'/'+_0x22966e[_0x16a74b(0x181)]+'/'+_0x22966e[_0x16a74b(0x1c9)]+_0x16a74b(0x1a0)+_0x42428b+_0x16a74b(0x190)+_0x22966e[_0x16a74b(0x176)]+_0x16a74b(0x1b8)+_0x10db54+_0x16a74b(0x1ae)+_0x3c958b+'/'+_0x22966e['operationType']+'/'+_0x22966e[_0x16a74b(0x183)]+'/'+_0x1681f6+_0x16a74b(0x182)+_0x22966e[_0x16a74b(0x183)]+'\x0a'+_0x222949+_0x16a74b(0x1aa)+_0x36b73e+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x5918d0+_0x16a74b(0x18b)+_0x1681f6+_0x16a74b(0x18c);}
|
|
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 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a37_0x2ce4af=a37_0x59a5;(function(_0x1c4b73,_0x2fcb7b){const _0x256a2c=a37_0x59a5,_0x246a06=_0x1c4b73();while(!![]){try{const _0x78c9b0=parseInt(_0x256a2c(0x11b))/0x1+-parseInt(_0x256a2c(0x140))/0x2*(parseInt(_0x256a2c(0x13c))/0x3)+-parseInt(_0x256a2c(0x11f))/0x4*(parseInt(_0x256a2c(0x12d))/0x5)+-parseInt(_0x256a2c(0x124))/0x6+parseInt(_0x256a2c(0x129))/0x7+-parseInt(_0x256a2c(0x12f))/0x8*(-parseInt(_0x256a2c(0x11c))/0x9)+parseInt(_0x256a2c(0x127))/0xa;if(_0x78c9b0===_0x2fcb7b)break;else _0x246a06['push'](_0x246a06['shift']());}catch(_0x3b5c24){_0x246a06['push'](_0x246a06['shift']());}}}(a37_0x1d56,0xe2265));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';function a37_0x1d56(){const _0xcd41b=['stringify','map','delete','validation','appCode','521979KOqeCJ','join','string','scriptsRoot','16wDTzRf','target','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','\x22\x20not\x20found\x20after\x20ensureLockScope.','keys','trashDir','<timestamp>','lockFilePath','functions','apps','toISOString','projectRoot','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','remoteId','find','parse','1200848rfhPBa','459HmLGVm','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','startsWith','1272woqpBJ','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','Backend\x20Function\x20lock\x20file\x20not\x20found.','\x20\x20-\x20','POST','9261954tnmtpO','Would\x20delete\x20','Function\x20not\x20found:\x20','10052040aQNTyZ','Multiple\x20functions\x20match\x20\x22','12914062uabrkj','length','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','Local\x20delete\x20not\x20settled\x20for\x20','10795LuWidR','No\x20lock\x20entry\x20found\x20for\x20\x22','78048OCGsKv','includes','lastSync','filter','scriptsRootDir','str','Lock\x20scope\x20for\x20app\x20\x22','Deleted\x20'];a37_0x1d56=function(){return _0xcd41b;};return a37_0x1d56();}export const bffDelete={'service':'bff','command':'delete','description':a37_0x2ce4af(0x120),'risk':'high-risk-write','flags':[{'name':a37_0x2ce4af(0x141),'type':a37_0x2ce4af(0x13e),'required':!![],'description':a37_0x2ce4af(0x142)}],async 'validate'(_0x57cc23){const _0xb899c0=a37_0x2ce4af,_0x3bd064=loadBffProjectConfig(_0x57cc23['appCode']),_0x5465d6=await readBffLockFile(_0x3bd064['lockFilePath']);if(!_0x5465d6)throw CliErrors[_0xb899c0(0x13a)](_0xb899c0(0x12b));},async 'dryRun'(_0x486c18){const _0x6f3885=a37_0x2ce4af,_0x3eb3f0=loadBffProjectConfig(_0x486c18['appCode']),_0x125c82=await readBffLockFile(_0x3eb3f0[_0x6f3885(0x112)]);if(!_0x125c82)throw CliErrors[_0x6f3885(0x13a)](_0x6f3885(0x121));const {appLock:_0x1fafeb}=ensureLockScope(_0x125c82,_0x486c18['appCode'],_0x3eb3f0['scriptsRoot'],_0x6f3885(0x139)),_0x55d0a7=_0x486c18[_0x6f3885(0x134)](_0x6f3885(0x141)),_0x5d00c9=Object[_0x6f3885(0x10f)](_0x1fafeb[_0x6f3885(0x113)]),_0x3376c0=resolveDeleteTarget(_0x55d0a7,_0x5d00c9),_0x27f779=_0x1fafeb[_0x6f3885(0x113)][_0x3376c0];if(!_0x27f779)throw CliErrors[_0x6f3885(0x13a)](_0x6f3885(0x12e)+_0x3376c0+'\x22.');const _0x4c5ec3=resolveLocalFilePathFromLockKey(_0x3eb3f0,_0x3376c0),_0x48eeaf=relative(_0x3eb3f0[_0x6f3885(0x116)],_0x4c5ec3),_0x2a6ebd=join(_0x3eb3f0[_0x6f3885(0x110)],_0x6f3885(0x111),_0x48eeaf);return{'method':_0x6f3885(0x123),'url':'/api/management/library/scripts/delete','body':{'appCode':_0x486c18[_0x6f3885(0x13b)],'target':_0x3376c0,'remoteId':_0x27f779[_0x6f3885(0x118)],'localFilePath':_0x4c5ec3,'trashedPath':_0x2a6ebd},'description':_0x6f3885(0x125)+_0x3376c0+_0x6f3885(0x117)};},async 'execute'(_0x35c90b){const _0x5f3e75=a37_0x2ce4af,_0x240b8a=loadBffProjectConfig(_0x35c90b[_0x5f3e75(0x13b)]),_0x39dc41=await readBffLockFile(_0x240b8a['lockFilePath']);if(!_0x39dc41)throw CliErrors[_0x5f3e75(0x13a)](_0x5f3e75(0x121));const {lockData:_0x1a83fe,appLock:_0x79a66e}=ensureLockScope(_0x39dc41,_0x35c90b[_0x5f3e75(0x13b)],_0x240b8a[_0x5f3e75(0x13f)],_0x5f3e75(0x139)),_0x6ffabd=JSON[_0x5f3e75(0x11a)](JSON[_0x5f3e75(0x137)](_0x1a83fe)),_0x1ad679=_0x6ffabd[_0x5f3e75(0x114)][_0x35c90b[_0x5f3e75(0x13b)]];if(!_0x1ad679)throw new Error(_0x5f3e75(0x135)+_0x35c90b[_0x5f3e75(0x13b)]+_0x5f3e75(0x10e));const _0x3a3528=_0x35c90b[_0x5f3e75(0x134)](_0x5f3e75(0x141)),_0x272320=Object[_0x5f3e75(0x10f)](_0x1ad679[_0x5f3e75(0x113)]),_0x340c58=resolveDeleteTarget(_0x3a3528,_0x272320),_0x41daa7=_0x1ad679[_0x5f3e75(0x113)][_0x340c58];if(!_0x41daa7)throw CliErrors[_0x5f3e75(0x13a)]('No\x20lock\x20entry\x20found\x20for\x20\x22'+_0x340c58+'\x22.');await deleteBffScript(_0x41daa7['remoteId']),delete _0x1ad679[_0x5f3e75(0x113)][_0x340c58],_0x1ad679[_0x5f3e75(0x131)]=new Date()[_0x5f3e75(0x115)](),await writeBffLockFile(_0x240b8a[_0x5f3e75(0x112)],_0x6ffabd);const _0x14c5bc=resolveLocalFilePathFromLockKey(_0x240b8a,_0x340c58);let _0x2f297c;await fileExists(_0x14c5bc)&&(_0x2f297c=await moveToTrash(_0x240b8a['projectRoot'],_0x240b8a[_0x5f3e75(0x110)],_0x14c5bc),await cleanupEmptyDirectories(dirname(_0x14c5bc),_0x240b8a[_0x5f3e75(0x133)]));await waitForDeleteSettlement(_0x240b8a['lockFilePath'],_0x35c90b[_0x5f3e75(0x13b)],_0x340c58,_0x14c5bc),await sleep(0x96);const _0x15f810={'deleted':_0x340c58,'remoteId':_0x41daa7[_0x5f3e75(0x118)]};if(_0x2f297c)_0x15f810['trashedTo']=_0x2f297c;return{'ok':!![],'data':_0x15f810,'message':_0x5f3e75(0x136)+_0x340c58+(_0x2f297c?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x33602b,_0x2139e9){const _0x371fee=a37_0x2ce4af;if(_0x33602b[_0x371fee(0x130)]('/')){const _0x5e957e=_0x2139e9[_0x371fee(0x119)](_0x21d3aa=>_0x21d3aa===_0x33602b);if(!_0x5e957e)throw CliErrors[_0x371fee(0x13a)]('Function\x20not\x20found:\x20'+_0x33602b);return _0x5e957e;}const _0x383a1f=_0x2139e9[_0x371fee(0x132)](_0x32f863=>_0x32f863['split']('/')['at'](-0x1)===_0x33602b);if(_0x383a1f[_0x371fee(0x12a)]===0x0)throw CliErrors['validation'](_0x371fee(0x126)+_0x33602b);if(_0x383a1f[_0x371fee(0x12a)]>0x1)throw CliErrors['validation'](_0x371fee(0x128)+_0x33602b+_0x371fee(0x11d)+_0x383a1f[_0x371fee(0x138)](_0x3ab081=>_0x371fee(0x122)+_0x3ab081)[_0x371fee(0x13d)]('\x0a'));return _0x383a1f[0x0];}async function moveToTrash(_0x3000d6,_0xc7c087,_0x457867){const _0x57b6b3=a37_0x2ce4af,_0xbcaa21=new Date()[_0x57b6b3(0x115)]()['replace'](/[:.]/g,'-'),_0x812ade=relative(_0x3000d6,_0x457867),_0x1520dc=join(_0xc7c087,_0xbcaa21,_0x812ade);return await mkdir(dirname(_0x1520dc),{'recursive':!![]}),await rename(_0x457867,_0x1520dc),_0x1520dc;}function a37_0x59a5(_0x1abef5,_0x401b02){_0x1abef5=_0x1abef5-0x10e;const _0x1d565b=a37_0x1d56();let _0x59a57c=_0x1d565b[_0x1abef5];return _0x59a57c;}async function cleanupEmptyDirectories(_0x17b75a,_0x5113ba){const _0x3e5b9c=a37_0x2ce4af;let _0x3723fc=resolve(_0x17b75a);const _0x17665c=resolve(_0x5113ba);while(_0x3723fc[_0x3e5b9c(0x11e)](''+_0x17665c+sep)||_0x3723fc===_0x17665c){if(_0x3723fc===_0x17665c)return;try{const _0x4821ad=await readdir(_0x3723fc);if(_0x4821ad['length']>0x0)return;await rmdir(_0x3723fc);}catch{return;}_0x3723fc=dirname(_0x3723fc);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0xaf7376,_0x501a9a,_0x516033,_0x24090c){const _0xf68fcd=a37_0x2ce4af;for(let _0x3d3a09=0x0;_0x3d3a09<DELETE_SETTLE_RETRY_COUNT;_0x3d3a09+=0x1){const _0x1c350e=await readBffLockFile(_0xaf7376),_0x45187e=!!_0x1c350e?.[_0xf68fcd(0x114)]?.[_0x501a9a]?.['functions']?.[_0x516033],_0x30275f=await fileExists(_0x24090c);if(!_0x45187e&&!_0x30275f)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0xf68fcd(0x12c)+_0x516033+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x277482=a38_0x23c2;(function(_0x10b560,_0x4f15dd){const _0xf633c5=a38_0x23c2,_0x5d6f78=_0x10b560();while(!![]){try{const _0x1baf7e=-parseInt(_0xf633c5(0x1e9))/0x1*(-parseInt(_0xf633c5(0x1f5))/0x2)+parseInt(_0xf633c5(0x1e2))/0x3+parseInt(_0xf633c5(0x1dd))/0x4*(-parseInt(_0xf633c5(0x1e3))/0x5)+parseInt(_0xf633c5(0x1e1))/0x6*(-parseInt(_0xf633c5(0x1e4))/0x7)+parseInt(_0xf633c5(0x1f2))/0x8+-parseInt(_0xf633c5(0x1f6))/0x9+parseInt(_0xf633c5(0x1f0))/0xa;if(_0x1baf7e===_0x4f15dd)break;else _0x5d6f78['push'](_0x5d6f78['shift']());}catch(_0x61724a){_0x5d6f78['push'](_0x5d6f78['shift']());}}}(a38_0x229d,0xca606));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':a38_0x277482(0x1f1),'command':a38_0x277482(0x1df),'description':a38_0x277482(0x1ee),'risk':a38_0x277482(0x1ec),'flags':[{'name':'id','type':a38_0x277482(0x1e6),'required':!![],'description':a38_0x277482(0x1db)},{'name':a38_0x277482(0x1e8),'type':a38_0x277482(0x1e5),'description':a38_0x277482(0x1eb)}],async 'execute'(_0x19906e){const _0x37ee60=a38_0x277482,_0xe9c6a7=await getBffScriptInfo(_0x19906e[_0x37ee60(0x1e7)]('id')),_0x11377e=_0x19906e[_0x37ee60(0x1ed)](_0x37ee60(0x1e8));if(_0x11377e)return{'ok':!![],'data':_0xe9c6a7};return{'ok':!![],'data':{'id':_0xe9c6a7['id'],'functionName':_0xe9c6a7[_0x37ee60(0x1f3)]??'','version':_0xe9c6a7[_0x37ee60(0x1ef)]??'','updateUserName':_0xe9c6a7[_0x37ee60(0x1dc)]??'','appCode':_0xe9c6a7['appCode'],'scriptType':_0xe9c6a7['scriptType'],'description':_0xe9c6a7['description']||_0x37ee60(0x1e0),'createdTime':_0xe9c6a7[_0x37ee60(0x1ea)]??'','updatedTime':_0xe9c6a7[_0x37ee60(0x1f4)]??'','scriptContent':_0xe9c6a7[_0x37ee60(0x1de)]??''}};}};function a38_0x23c2(_0x4daaa8,_0x4b2247){_0x4daaa8=_0x4daaa8-0x1db;const _0x229d5c=a38_0x229d();let _0x23c217=_0x229d5c[_0x4daaa8];return _0x23c217;}function a38_0x229d(){const _0x11b61a=['number','num','verbose','66043HTkpSR','createdTime','Return\x20full\x20raw\x20script\x20object','read','bool','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','version','5937930gBHYfJ','bff','7497360QYRqdK','functionName','updatedTime','14aWKeBn','9206703LdfVsk','Script\x20ID','updateUserName','3748QCvxnw','scriptContent','detail','(none)','6Xsqusq','3146013pfjboL','5645DCuicN','925127DcCNzZ','boolean'];a38_0x229d=function(){return _0x11b61a;};return a38_0x229d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1f09fb,_0x32d96a){const _0x454565=a39_0x2fe9,_0x5c977c=_0x1f09fb();while(!![]){try{const _0x587588=parseInt(_0x454565(0x9b))/0x1+parseInt(_0x454565(0x9f))/0x2*(parseInt(_0x454565(0x99))/0x3)+-parseInt(_0x454565(0x9d))/0x4*(parseInt(_0x454565(0x9c))/0x5)+-parseInt(_0x454565(0x98))/0x6*(-parseInt(_0x454565(0x9a))/0x7)+-parseInt(_0x454565(0x96))/0x8*(-parseInt(_0x454565(0x97))/0x9)+-parseInt(_0x454565(0x95))/0xa*(parseInt(_0x454565(0x9e))/0xb)+-parseInt(_0x454565(0xa0))/0xc;if(_0x587588===_0x32d96a)break;else _0x5c977c['push'](_0x5c977c['shift']());}catch(_0x116624){_0x5c977c['push'](_0x5c977c['shift']());}}}(a39_0x5373,0x272cd));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';function a39_0x2fe9(_0x668265,_0x4539c7){_0x668265=_0x668265-0x95;const _0x53730=a39_0x5373();let _0x2fe9e9=_0x53730[_0x668265];return _0x2fe9e9;}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];function a39_0x5373(){const _0x5ff752=['2395NXonzx','284QHRSqt','9944XXESMv','12964uVRyqC','3470064sVfGyw','1400wzIdNI','1886808VjFvNk','9mpzSUa','198GKIaHJ','66orIXHU','32466eVvVrt','78693bjkEfL'];a39_0x5373=function(){return _0x5ff752;};return a39_0x5373();}
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a40_0x43e1c6=a40_0x1b86;function a40_0x1b86(_0x5458af,_0x16a386){_0x5458af=_0x5458af-0xee;const _0x10fc10=a40_0x10fc();let _0x1b8665=_0x10fc10[_0x5458af];return _0x1b8665;}(function(_0x1fa052,_0x2af1c3){const _0xdf9e98=a40_0x1b86,_0x47c6ac=_0x1fa052();while(!![]){try{const _0x4f976e=parseInt(_0xdf9e98(0xf8))/0x1+parseInt(_0xdf9e98(0x107))/0x2+parseInt(_0xdf9e98(0xf0))/0x3+-parseInt(_0xdf9e98(0x10a))/0x4+parseInt(_0xdf9e98(0xfd))/0x5*(parseInt(_0xdf9e98(0x108))/0x6)+-parseInt(_0xdf9e98(0xf2))/0x7+parseInt(_0xdf9e98(0xf7))/0x8;if(_0x4f976e===_0x2af1c3)break;else _0x47c6ac['push'](_0x47c6ac['shift']());}catch(_0x5a9e34){_0x47c6ac['push'](_0x47c6ac['shift']());}}}(a40_0x10fc,0xdeb7e));import{listBffScripts}from'../../core/api-client.js';function a40_0x10fc(){const _0x44b365=['map','703810ArzQoR','12396zVFKpE','List\x20Backend\x20Function\x20scripts','1183808tjmeif','appCode','boolean','Script\x20type\x20filter','str','184704VUMFNP','bool','10676442XdntQB','type','functionName','string','Filter\x20by\x20script\x20name','6939072BcJJFg','712927ZwDwbE','list','description','bff','scriptType','1790ckuEEQ','ENDPOINT','verbose','name','COMMON','No\x20Backend\x20Function\x20scripts\x20found.','read','(unnamed)','Return\x20full\x20script\x20objects'];a40_0x10fc=function(){return _0x44b365;};return a40_0x10fc();}export const bffList={'service':a40_0x43e1c6(0xfb),'command':a40_0x43e1c6(0xf9),'description':a40_0x43e1c6(0x109),'risk':a40_0x43e1c6(0x103),'flags':[{'name':a40_0x43e1c6(0xf3),'type':a40_0x43e1c6(0xf5),'description':a40_0x43e1c6(0xee),'default':a40_0x43e1c6(0xfe),'enum':[a40_0x43e1c6(0xfe),a40_0x43e1c6(0x101)]},{'name':a40_0x43e1c6(0x100),'type':a40_0x43e1c6(0xf5),'description':a40_0x43e1c6(0xf6)},{'name':a40_0x43e1c6(0xff),'type':a40_0x43e1c6(0x10c),'description':a40_0x43e1c6(0x105)}],async 'execute'(_0x3f524a){const _0x5c4718=a40_0x43e1c6,_0x444db8=await listBffScripts(_0x3f524a[_0x5c4718(0x10b)],_0x3f524a['str'](_0x5c4718(0xf3)),{'scriptName':_0x3f524a[_0x5c4718(0xef)](_0x5c4718(0x100))||undefined}),_0x3cf68c=_0x3f524a[_0x5c4718(0xf1)](_0x5c4718(0xff));return{'ok':!![],'data':_0x3cf68c?_0x444db8:_0x444db8[_0x5c4718(0x106)](_0x568760=>({'id':_0x568760['id'],'functionName':_0x568760[_0x5c4718(0xf4)]??'','description':_0x568760[_0x5c4718(0xfa)]||_0x5c4718(0x104),'scriptType':_0x568760[_0x5c4718(0xfc)]})),'message':_0x444db8['length']===0x0?_0x5c4718(0x102):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x51380e=a41_0x1629;(function(_0x436b7e,_0x8274fe){const _0x9cfc16=a41_0x1629,_0x3f68b1=_0x436b7e();while(!![]){try{const _0x57a21d=parseInt(_0x9cfc16(0x147))/0x1*(-parseInt(_0x9cfc16(0x148))/0x2)+parseInt(_0x9cfc16(0x157))/0x3*(-parseInt(_0x9cfc16(0x156))/0x4)+parseInt(_0x9cfc16(0x13a))/0x5+-parseInt(_0x9cfc16(0x151))/0x6*(parseInt(_0x9cfc16(0x13c))/0x7)+-parseInt(_0x9cfc16(0x14f))/0x8+-parseInt(_0x9cfc16(0x153))/0x9+parseInt(_0x9cfc16(0x134))/0xa*(parseInt(_0x9cfc16(0x13b))/0xb);if(_0x57a21d===_0x8274fe)break;else _0x3f68b1['push'](_0x3f68b1['shift']());}catch(_0x4525d5){_0x3f68b1['push'](_0x3f68b1['shift']());}}}(a41_0x1371,0x4344f));function a41_0x1629(_0x408cfa,_0x5d6ee6){_0x408cfa=_0x408cfa-0x128;const _0x13718a=a41_0x1371();let _0x162993=_0x13718a[_0x408cfa];return _0x162993;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a41_0x51380e(0x14d),a41_0x51380e(0x13e),a41_0x51380e(0x145),a41_0x51380e(0x152)];export function resolveBffLogQuery(_0x19e2b0,_0x4a9ab7=Date[a41_0x51380e(0x12f)]()){const _0x1855b1=a41_0x51380e,_0x2fcae8=_0x19e2b0[_0x1855b1(0x12c)](_0x1855b1(0x144)),_0xfe0eba=_0x19e2b0[_0x1855b1(0x12c)](_0x1855b1(0x12a)),_0x502cc7=_0x19e2b0['flag']('end-time');if(_0x2fcae8!==undefined&&_0xfe0eba!==undefined)throw CliErrors['validation'](_0x1855b1(0x132));const _0x58ad1e=_0x502cc7===undefined?_0x4a9ab7:readPositiveInteger(_0x19e2b0[_0x1855b1(0x131)](_0x1855b1(0x133)),_0x1855b1(0x140)),_0x433b2a=_0xfe0eba===undefined?_0x58ad1e-readSinceMinutes(_0x19e2b0)*0xea60:readPositiveInteger(_0x19e2b0['num'](_0x1855b1(0x12a)),_0x1855b1(0x129));if(_0x433b2a<=0x0)throw CliErrors[_0x1855b1(0x155)](_0x1855b1(0x15b));if(_0x433b2a>_0x58ad1e)throw CliErrors['validation'](_0x1855b1(0x12e));const _0x56eeb2=readPositiveInteger(_0x19e2b0[_0x1855b1(0x131)]('limit',DEFAULT_LIMIT),_0x1855b1(0x13d));if(_0x56eeb2>MAX_LIMIT)throw CliErrors[_0x1855b1(0x155)](_0x1855b1(0x15c)+MAX_LIMIT+'.');const _0x1b85e6=_0x19e2b0['str'](_0x1855b1(0x158))[_0x1855b1(0x141)]()[_0x1855b1(0x142)]()||undefined,_0x3c095a=_0x19e2b0[_0x1855b1(0x14b)](_0x1855b1(0x143))['trim']()||undefined;return{'appCode':_0x19e2b0[_0x1855b1(0x150)],'startTime':_0x433b2a,'endTime':_0x58ad1e,..._0xfe0eba===undefined?{'sinceMinutes':readSinceMinutes(_0x19e2b0)}:{},..._0x1b85e6?{'level':_0x1b85e6}:{},..._0x3c095a?{'keyword':_0x3c095a}:{},'limit':_0x56eeb2};}function readSinceMinutes(_0x5d5846){const _0xbe0733=a41_0x51380e;return readPositiveInteger(_0x5d5846[_0xbe0733(0x131)]('since',DEFAULT_SINCE_MINUTES),_0xbe0733(0x138));}function readPositiveInteger(_0x3175f9,_0x22297d){const _0x3547be=a41_0x51380e;if(!Number[_0x3547be(0x12d)](_0x3175f9)||_0x3175f9<=0x0)throw CliErrors[_0x3547be(0x155)](_0x22297d+_0x3547be(0x159));return _0x3175f9;}function a41_0x1371(){const _0x316433=['6830BciRIE','length','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','--since','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','550590kEnqOY','23573iCDnpZ','91sSvtSw','--limit','INFO','string','--end-time','trim','toUpperCase','keyword','since','WARN','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','1PwLard','741154Hvvcvg','Filter\x20by\x20log\x20level','\x20Backend\x20Function\x20log\x20line(s).','str','read','DEBUG','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','3371008EHXERK','appCode','144426lXtPkC','ERROR','1299951jJEShA','logs','validation','28hBrgqy','20973siTlti','level','\x20must\x20be\x20a\x20positive\x20integer.','limit','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','--limit\x20must\x20be\x20between\x201\x20and\x20','Found\x20','--start-time','start-time','Maximum\x20log\x20lines\x20to\x20return\x20(1-','flag','isSafeInteger','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','now','number','num','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','end-time'];a41_0x1371=function(){return _0x316433;};return a41_0x1371();}export const bffLogs={'service':'bff','command':a41_0x51380e(0x154),'description':a41_0x51380e(0x139),'risk':a41_0x51380e(0x14c),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a41_0x51380e(0x144),'type':a41_0x51380e(0x130),'description':a41_0x51380e(0x146)+DEFAULT_SINCE_MINUTES+')'},{'name':a41_0x51380e(0x12a),'type':'number','description':a41_0x51380e(0x14e)},{'name':a41_0x51380e(0x133),'type':a41_0x51380e(0x130),'description':a41_0x51380e(0x136)},{'name':a41_0x51380e(0x158),'type':'string','description':a41_0x51380e(0x149),'enum':LOG_LEVELS},{'name':a41_0x51380e(0x143),'type':a41_0x51380e(0x13f),'description':a41_0x51380e(0x137)},{'name':a41_0x51380e(0x15a),'type':a41_0x51380e(0x130),'description':a41_0x51380e(0x12b)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x29427b){resolveBffLogQuery(_0x29427b);},async 'execute'(_0x2b57ba){const _0x1de943=a41_0x51380e,_0xd09bda=resolveBffLogQuery(_0x2b57ba),{sinceMinutes:_0xfe2062,..._0x5a62e5}=_0xd09bda,_0x5499eb=await searchBffScriptLogs(_0x5a62e5);return{'ok':!![],'data':{'query':_0xd09bda,'count':_0x5499eb[_0x1de943(0x135)],'logs':_0x5499eb},'message':_0x5499eb[_0x1de943(0x135)]===0x0?'No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.':_0x1de943(0x128)+_0x5499eb[_0x1de943(0x135)]+_0x1de943(0x14a)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a42_0x2f20d2=a42_0x356a;(function(_0x174718,_0x4cef5b){const _0x1f6287=a42_0x356a,_0xf4078c=_0x174718();while(!![]){try{const _0x3fef3f=-parseInt(_0x1f6287(0x11f))/0x1+-parseInt(_0x1f6287(0xe0))/0x2*(-parseInt(_0x1f6287(0x115))/0x3)+-parseInt(_0x1f6287(0x116))/0x4+-parseInt(_0x1f6287(0x149))/0x5+parseInt(_0x1f6287(0x142))/0x6*(-parseInt(_0x1f6287(0xd9))/0x7)+parseInt(_0x1f6287(0xe9))/0x8+parseInt(_0x1f6287(0x159))/0x9*(parseInt(_0x1f6287(0x118))/0xa);if(_0x3fef3f===_0x4cef5b)break;else _0xf4078c['push'](_0xf4078c['shift']());}catch(_0x3b92a5){_0xf4078c['push'](_0xf4078c['shift']());}}}(a42_0x2728,0x97ee3));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';function a42_0x2728(){const _0x474adc=['Remote\x20script\x20missing\x20content.','case-rename','scriptType','.hook-directory-migrate-','Pull\x20only\x20this\x20script\x20type','Force\x20overwrite\x20local\x20unsynced\x20changes','COMMON','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','alias','\x20failed','unresolvable\x20target\x20path','flatMap','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','currentApp','1089393pBfREe','3125040epfpvt','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','15394630yavvva','\x22;\x20temporary\x20directory\x20\x22','apiDir','mode','close','\x22\x20and\x20\x22','Would\x20inspect\x20','553422gnmZlD','str','cancelled','get','force','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','newLockKey','Remote\x20script\x20missing\x20id.','nonInteractive','skipped','entry','oldLockKey','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','pull','reverse','type','hookLocation','GET','.js','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','rekey','\x20--format\x20compress','content','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','datasetCode','defaultApp','toISOString','set','¤tPage=1&pageSize=','Force\x20pull\x20cancelled.','\x22\x20from\x20\x22','trim','operationType','would_pull','scriptsRoot','77730rppWmd','delete','selectedAppName','newDirectoryPath','sourceFilePathByNewLockKey','move','apps','5863250fiOvqR','\x20resolution','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','projectedFunctions','keyChanges','oldDirectory','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','&type=','oldDirectoryPath','Failed\x20to\x20write\x20local\x20script\x20\x22','ENOENT','remoteId','profileName','HOOK','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','18fLsMhP','existed','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','code','require','\x20--name\x20','length','dev','Could\x20not\x20restore\x20local\x20script\x20\x22','\x22:\x20its\x20target\x20\x22','entries','\x22:\x20both\x20target\x20\x22','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','BFF_LOCAL_UNSYNCED','push','413nuGNHS','hash','scriptContent','message','toLowerCase','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','yes','2FAFmcP','\x22:\x20','\x20bff\x20push\x20--type\x20','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','newDirectory','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','string','values','functions','3615416ufuvbJ','has','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','push_local','map','requires','\x22\x20to\x20\x22','sourceDirectoryPathByNewDirectory','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','join','\x22\x20not\x20found\x20after\x20ensureLockScope.','appCode','migrations','normalize','mergedCli','validation','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','filePath','lockFilePath','ino','functionNode','some','lockKey','all','Pull\x20complete:\x20','lastSync','bool','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.','split','scriptsRootDir'];a42_0x2728=function(){return _0x474adc;};return a42_0x2728();}import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';function a42_0x356a(_0x2981be,_0xea274f){_0x2981be=_0x2981be-0xcc;const _0x2728e7=a42_0x2728();let _0x356a57=_0x2728e7[_0x2981be];return _0x356a57;}export const bffPull={'service':'bff','command':a42_0x2f20d2(0x12c),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':'read','structuredErrors':!![],'flags':[{'name':a42_0x2f20d2(0x12e),'type':a42_0x2f20d2(0xe6),'description':a42_0x2f20d2(0x10b),'enum':[a42_0x2f20d2(0x10d),'ENDPOINT','HOOK']},{'name':a42_0x2f20d2(0x123),'type':'boolean','description':a42_0x2f20d2(0x10c)}],async 'dryRun'(_0x21c859){const _0x4ead41=a42_0x2f20d2,_0x458bb7=loadBffProjectConfig(_0x21c859[_0x4ead41(0xf4)]),_0x509ae6=await readBffLockFile(_0x458bb7[_0x4ead41(0xfb)]),{appLock:_0xd29b05}=ensureLockScope(_0x509ae6??createEmptyBffLock(),_0x21c859[_0x4ead41(0xf4)],_0x458bb7[_0x4ead41(0x141)],_0x4ead41(0x12c)),_0x22c252=normalizeBffType(_0x21c859[_0x4ead41(0x120)](_0x4ead41(0x12e)))??undefined,[_0x47e069,_0x422491]=await Promise[_0x4ead41(0x100)]([listBffScripts(_0x21c859[_0x4ead41(0xf4)],_0x22c252),getBffScriptStatistics(_0x21c859[_0x4ead41(0xf4)])]),_0x2ebca0=_0x47e069[_0x4ead41(0xfe)](_0x5407f7=>normalizeBffType(_0x5407f7['scriptType'])===_0x4ead41(0x157)),_0x20e485=_0x2ebca0?buildDatasetCodeToAliasMap(_0x21c859[_0x4ead41(0x11a)],_0x21c859['appCode'],_0x21c859[_0x4ead41(0x144)]||_0x21c859[_0x4ead41(0xf7)]?.[_0x4ead41(0x114)]||_0x21c859[_0x4ead41(0xf7)]?.[_0x4ead41(0x138)]):new Map(),_0x34a04b=_0x2ebca0?await planHookDirectoryMigration(_0x458bb7,_0xd29b05,_0x20e485,await scanLocalBffFunctions(_0x458bb7,_0x4ead41(0x157))):undefined,_0x5ecfe6=createHookLocationMap(_0x422491),_0x4f3135=[];for(const _0xc1e2f5 of _0x47e069){const _0x4e3f56=resolveRemoteScriptTarget(_0x458bb7,_0xc1e2f5,_0x5ecfe6,_0x34a04b?.[_0x4ead41(0x14c)]??_0xd29b05[_0x4ead41(0xe8)],_0x20e485);if(!_0x4e3f56){_0x4f3135[_0x4ead41(0xd8)]({'scriptType':_0xc1e2f5['scriptType'],'functionName':_0xc1e2f5['functionName']??'','status':_0x4ead41(0x128),'reason':'unresolvable\x20target\x20path'});continue;}const _0x3116f8=(_0x34a04b?.['projectedFunctions']??_0xd29b05[_0x4ead41(0xe8)])[_0x4e3f56[_0x4ead41(0xff)]],_0x45188b=_0xc1e2f5['scriptContent']!=null?computeContentHash(_0xc1e2f5[_0x4ead41(0xdb)]):undefined,_0x1a95a7=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x34a04b,_0x4e3f56)??_0x4e3f56[_0x4ead41(0xfa)],_0x3116f8,_0x45188b),_0x462f2=_0x1a95a7?localUnsyncedConflict(_0x4e3f56,_0xc1e2f5['id']):undefined;_0x4f3135['push']({'lockKey':_0x4e3f56['lockKey'],'filePath':_0x4e3f56[_0x4ead41(0xfa)],'remoteId':_0xc1e2f5['id']??null,'status':_0x462f2?'conflict':_0x4ead41(0x140),..._0x462f2?{'conflict':_0x462f2}:{},..._0x4e3f56[_0x4ead41(0x12f)]?{'alias':_0x4e3f56[_0x4ead41(0x12f)][_0x4ead41(0x10f)]??null,'datasetCode':_0x4e3f56[_0x4ead41(0x12f)][_0x4ead41(0x137)],'operationType':_0x4e3f56['hookLocation'][_0x4ead41(0x13f)],'functionNode':_0x4e3f56[_0x4ead41(0x12f)]['functionNode']}:{}});}return{'method':_0x4ead41(0x130),'url':'/api/management/library/scripts/list?appCode='+_0x21c859[_0x4ead41(0xf4)]+(_0x22c252?_0x4ead41(0x151)+_0x22c252:'')+_0x4ead41(0x13b)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x21c859[_0x4ead41(0xf4)],'filterType':_0x22c252??null,..._0x34a04b&&_0x34a04b[_0x4ead41(0xf5)][_0x4ead41(0xd0)]>0x0?{'hookDirectoryMigrations':_0x34a04b[_0x4ead41(0xf5)][_0x4ead41(0xed)](_0x4a4fe5=>({'from':_0x4a4fe5[_0x4ead41(0x14e)],'to':_0x4a4fe5[_0x4ead41(0xe4)]}))}:{},'files':_0x4f3135},'description':_0x4ead41(0x11e)+_0x4f3135[_0x4ead41(0xd0)]+_0x4ead41(0x10e)};},async 'execute'(_0xc16c43){const _0x5a8c8e=a42_0x2f20d2,_0x32f5b3=loadBffProjectConfig(_0xc16c43[_0x5a8c8e(0xf4)]),_0xcbac99=await readBffLockFile(_0x32f5b3[_0x5a8c8e(0xfb)]),{lockData:_0x360437,appLock:_0xfa5c47}=ensureLockScope(_0xcbac99??createEmptyBffLock(),_0xc16c43[_0x5a8c8e(0xf4)],_0x32f5b3[_0x5a8c8e(0x141)],_0x5a8c8e(0x12c)),_0x3ab19a=normalizeBffType(_0xc16c43[_0x5a8c8e(0x120)](_0x5a8c8e(0x12e)))??undefined;if(_0xc16c43['str'](_0x5a8c8e(0x12e))&&!_0x3ab19a)throw CliErrors[_0x5a8c8e(0xf8)](_0x5a8c8e(0xeb));const [_0x11668f,_0x5442f0]=await Promise[_0x5a8c8e(0x100)]([listBffScripts(_0xc16c43['appCode'],_0x3ab19a),getBffScriptStatistics(_0xc16c43[_0x5a8c8e(0xf4)])]);if(_0x11668f['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x12a9b6=_0xc16c43[_0x5a8c8e(0x103)](_0x5a8c8e(0x123));if(_0x12a9b6&&!_0xc16c43[_0x5a8c8e(0x127)]){const _0x2c0e64=await confirmForce();if(!_0x2c0e64)throw CliErrors[_0x5a8c8e(0x121)](_0x5a8c8e(0x13c));}if(_0x12a9b6&&_0xc16c43['nonInteractive']){}const _0x4c8a36=_0x11668f[_0x5a8c8e(0xfe)](_0x57f2aa=>normalizeBffType(_0x57f2aa[_0x5a8c8e(0x109)])===_0x5a8c8e(0x157)),_0xa92009=_0x4c8a36?buildDatasetCodeToAliasMap(_0xc16c43[_0x5a8c8e(0x11a)],_0xc16c43[_0x5a8c8e(0xf4)],_0xc16c43['selectedAppName']||_0xc16c43[_0x5a8c8e(0xf7)]?.[_0x5a8c8e(0x114)]||_0xc16c43[_0x5a8c8e(0xf7)]?.[_0x5a8c8e(0x138)]):new Map(),_0x140a72=createHookLocationMap(_0x5442f0),_0x4b60ce=JSON['parse'](JSON['stringify'](_0x360437)),_0x1619ce=_0xc16c43[_0x5a8c8e(0xf4)],_0x3430eb=_0x4b60ce[_0x5a8c8e(0x148)][_0x1619ce];if(!_0x3430eb)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x1619ce+_0x5a8c8e(0xf3));const _0x182ad3=_0x4c8a36?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x32f5b3,_0x3430eb,_0xa92009,await scanLocalBffFunctions(_0x32f5b3,_0x5a8c8e(0x157))),_0x3430eb):undefined,_0x15ce49=createPullFileTransaction(),_0x3f88d8=[],_0x563878=[],_0x8f0e51=[],_0x5e89cf=[];for(const _0x3ddc32 of _0x11668f){const _0x24cd54=resolveRemoteScriptTarget(_0x32f5b3,_0x3ddc32,_0x140a72,_0x3430eb['functions'],_0xa92009);if(!_0x24cd54){_0x563878[_0x5a8c8e(0xd8)]({'lockKey':_0x3ddc32[_0x5a8c8e(0x109)]+'/'+_0x3ddc32['functionName'],'reason':_0x5a8c8e(0x111)});continue;}const _0x389a84=_0x3430eb[_0x5a8c8e(0xe8)][_0x24cd54['lockKey']];try{if(!_0x3ddc32['id'])throw new Error(_0x5a8c8e(0x126));if(_0x3ddc32[_0x5a8c8e(0xdb)]==null)throw new Error(_0x5a8c8e(0x107));const _0x37bf56=_0x3ddc32[_0x5a8c8e(0xdb)],_0x3ce222=computeContentHash(_0x37bf56);if(!_0x12a9b6){const _0x978fad=await hasUnsyncedLocalChanges(_0x24cd54['filePath'],_0x389a84,_0x3ce222);if(_0x978fad){_0x8f0e51[_0x5a8c8e(0xd8)](localUnsyncedConflict(_0x24cd54,_0x3ddc32['id']));continue;}}await _0x15ce49['write'](_0x24cd54[_0x5a8c8e(0xfa)],_0x37bf56);const _0x8f7bb0={'hash':_0x3ce222,'remoteId':_0x3ddc32['id'],'version':_0x3ddc32['version']};_0x24cd54[_0x5a8c8e(0x12e)]===_0x5a8c8e(0x157)&&_0x24cd54[_0x5a8c8e(0x12f)]&&(_0x8f7bb0[_0x5a8c8e(0x10f)]=_0x24cd54['hookLocation']['alias'],_0x8f7bb0['datasetCode']=_0x24cd54[_0x5a8c8e(0x12f)]['datasetCode'],_0x8f7bb0[_0x5a8c8e(0x13f)]=_0x24cd54[_0x5a8c8e(0x12f)]['operationType'],_0x8f7bb0[_0x5a8c8e(0xfd)]=_0x24cd54[_0x5a8c8e(0x12f)][_0x5a8c8e(0xfd)]),_0x3430eb[_0x5a8c8e(0xe8)][_0x24cd54[_0x5a8c8e(0xff)]]=_0x8f7bb0,_0x3f88d8[_0x5a8c8e(0xd8)]({'lockKey':_0x24cd54[_0x5a8c8e(0xff)],'remoteId':_0x3ddc32['id']});}catch(_0x22dffe){_0x5e89cf[_0x5a8c8e(0xd8)]({'lockKey':_0x24cd54[_0x5a8c8e(0xff)],'error':_0x22dffe instanceof Error?_0x22dffe['message']:String(_0x22dffe)});}}_0x3430eb['lastSync']=new Date()[_0x5a8c8e(0x139)]();try{await writeBffLockFile(_0x32f5b3[_0x5a8c8e(0xfb)],_0x4b60ce);}catch(_0xcbce2c){const _0x5aba36=[...await _0x15ce49['rollback'](),...await _0x182ad3?.['rollback']()??[]];throw withRollbackErrors(_0xcbce2c,_0x5a8c8e(0xf1),_0x5aba36);}return{'ok':_0x5e89cf[_0x5a8c8e(0xd0)]===0x0,'data':{'pulled':_0x3f88d8,'skipped':_0x563878,'conflicts':_0x8f0e51,'failed':_0x5e89cf},'message':formatPullMessage(_0x3f88d8[_0x5a8c8e(0xd0)],_0x563878[_0x5a8c8e(0xd0)],_0x8f0e51['length'],_0x5e89cf[_0x5a8c8e(0xd0)])};}};function localUnsyncedConflict(_0x2c2b8b,_0x2e3987){const _0x434444=a42_0x2f20d2,_0x3d9d71=_0x2c2b8b[_0x434444(0xff)][_0x434444(0x105)]('/')['at'](-0x1);return{'code':_0x434444(0xd7),'lockKey':_0x2c2b8b[_0x434444(0xff)],'filePath':_0x2c2b8b[_0x434444(0xfa)],..._0x2e3987!=null?{'remoteId':_0x2e3987}:{},'message':_0x434444(0x14f),'nextAction':{'action':_0x434444(0xec),'command':CLI_BIN_NAME+_0x434444(0xe2)+_0x2c2b8b[_0x434444(0x12e)]+_0x434444(0xcf)+_0x3d9d71+_0x434444(0x134),'requiresReview':!![],'message':_0x434444(0x104)}};}function formatPullMessage(_0x54dbab,_0x542b96,_0x34a659,_0x562721){const _0x558946=a42_0x2f20d2,_0x30989d=[_0x558946(0x101)+_0x54dbab+'\x20pulled',_0x542b96+'\x20skipped'];_0x34a659>0x0&&_0x30989d[_0x558946(0xd8)](_0x34a659+'\x20conflict'+(_0x34a659===0x1?'':'s')+'\x20'+(_0x34a659===0x1?_0x558946(0xee):_0x558946(0xce))+_0x558946(0x14a));if(_0x562721>0x0)_0x30989d[_0x558946(0xd8)](_0x562721+_0x558946(0x110));return _0x30989d['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x43717c,_0x58c693,_0x52d25f){const _0x31cb73=a42_0x2f20d2;if(!await fileExists(_0x43717c))return![];const _0x27d96e=await computeFileHash(_0x43717c);if(!_0x58c693)return _0x52d25f?_0x27d96e!==_0x52d25f:!![];return _0x27d96e!==_0x58c693[_0x31cb73(0xda)];}function createPullFileTransaction(){const _0x388bf8=new Map(),_0x469dd7=async(_0x1e1d6f,_0x293ba9)=>{const _0x532176=a42_0x356a;try{if(_0x293ba9[_0x532176(0x15a)])await ensureParentDirectory(_0x1e1d6f),await writeFile(_0x1e1d6f,_0x293ba9[_0x532176(0x135)]);else try{await unlink(_0x1e1d6f);}catch(_0xc63a00){if(_0xc63a00[_0x532176(0xcd)]!=='ENOENT')throw _0xc63a00;}return undefined;}catch(_0x19e2ed){return _0x19e2ed instanceof Error?_0x19e2ed:new Error(String(_0x19e2ed));}};return{async 'write'(_0x329845,_0x5f1d4e){const _0x21b550=a42_0x356a;if(!_0x388bf8[_0x21b550(0xea)](_0x329845))try{_0x388bf8[_0x21b550(0x13a)](_0x329845,{'existed':!![],'content':await readFile(_0x329845)});}catch(_0x2b2e8e){if(_0x2b2e8e[_0x21b550(0xcd)]!==_0x21b550(0x154))throw _0x2b2e8e;_0x388bf8[_0x21b550(0x13a)](_0x329845,{'existed':![]});}try{await ensureParentDirectory(_0x329845),await writeFile(_0x329845,_0x5f1d4e,'utf8');}catch(_0x4e7dbe){const _0x354f0f=await _0x469dd7(_0x329845,_0x388bf8[_0x21b550(0x122)](_0x329845));if(!_0x354f0f)_0x388bf8[_0x21b550(0x143)](_0x329845);throw withRollbackErrors(_0x4e7dbe,_0x21b550(0x153)+_0x329845+'\x22.',_0x354f0f?[_0x354f0f]:[]);}},async 'rollback'(){const _0x46d2ad=a42_0x356a,_0x38e3d7=[];for(const [_0x58c412,_0x411f7a]of[..._0x388bf8[_0x46d2ad(0xd4)]()]['reverse']()){const _0x55d6a2=await _0x469dd7(_0x58c412,_0x411f7a);_0x55d6a2&&_0x38e3d7['push'](new Error(_0x46d2ad(0xd2)+_0x58c412+_0x46d2ad(0xe1)+_0x55d6a2[_0x46d2ad(0xdc)]));}return _0x38e3d7;}};}function withRollbackErrors(_0x380a9d,_0xc36103,_0x3b3b75){const _0x279d1d=a42_0x2f20d2,_0x49750b=_0x380a9d instanceof Error?_0x380a9d:new Error(String(_0x380a9d));if(_0x3b3b75['length']===0x0)return _0x49750b;return new AggregateError([_0x49750b,..._0x3b3b75],_0xc36103+'\x20Recovery\x20errors:\x20'+_0x3b3b75[_0x279d1d(0xed)](_0x4653e6=>_0x4653e6[_0x279d1d(0xdc)])[_0x279d1d(0xf2)](';\x20'));}function buildDatasetCodeToAliasMap(_0x1e5d67,_0x17eb4e,_0x40bfe1){const _0x37fcca=a42_0x2f20d2,_0x59eb60=resolveApiModelSource(_0x1e5d67,_0x17eb4e,_0x40bfe1),_0x34fffc=loadAliasMap(_0x1e5d67,undefined,_0x59eb60[_0x37fcca(0xfa)],_0x59eb60[_0x37fcca(0x156)]);return assertUnambiguousHookAliases(_0x34fffc),new Map(_0x34fffc['map'](_0xffd6c0=>[_0xffd6c0[_0x37fcca(0x137)][_0x37fcca(0xdd)](),_0xffd6c0[_0x37fcca(0x10f)]]));}async function planHookDirectoryMigration(_0x3a9ffa,_0x286180,_0xac20a0,_0x695414){const _0x34100f=a42_0x2f20d2,_0x15e3f3=new Map();for(const [_0x16ab94,_0x548829]of Object['entries'](_0x286180['functions'])){const [_0x43b5ef,_0x3c65b7,_0x4bdd37,_0x27f8dc,_0x1c1411,..._0x61cc17]=_0x16ab94[_0x34100f(0x105)]('/');if(_0x43b5ef!==_0x34100f(0x157)||!_0x3c65b7||!_0x4bdd37||!_0x27f8dc||!_0x1c1411||_0x61cc17[_0x34100f(0xd0)]>0x0||!_0x548829[_0x34100f(0x137)])continue;const _0x567bd8=_0xac20a0['get'](_0x548829['datasetCode'][_0x34100f(0xdd)]()),_0x571c7c=_0x567bd8??_0x548829[_0x34100f(0x137)];if(!isSafeHookDirectorySegment(_0x3c65b7))throw CliErrors[_0x34100f(0xf8)](_0x34100f(0x113)+_0x3c65b7+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x571c7c))throw CliErrors['validation'](_0x34100f(0x150)+_0x3c65b7+_0x34100f(0xe3));if(_0x3c65b7===_0x571c7c)continue;const _0x26c8e8=_0x15e3f3['get'](_0x3c65b7)??{'datasetCode':_0x548829['datasetCode'],'alias':_0x567bd8,'keyChanges':[]};if(_0x26c8e8[_0x34100f(0x137)]!==_0x548829['datasetCode'])throw CliErrors['validation'](_0x34100f(0x150)+_0x3c65b7+'\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.');const _0x4889d2='HOOK/'+_0x571c7c+'/'+_0x4bdd37+'/'+_0x27f8dc+'/'+_0x1c1411;try{resolveLocalFilePathFromLockKey(_0x3a9ffa,_0x16ab94),resolveLocalFilePathFromLockKey(_0x3a9ffa,_0x4889d2);}catch(_0x37c99e){throw CliErrors[_0x34100f(0xf8)](_0x34100f(0x12b)+_0x16ab94+_0x34100f(0xe1)+(_0x37c99e instanceof Error?_0x37c99e[_0x34100f(0xdc)]:String(_0x37c99e)));}_0x26c8e8[_0x34100f(0x14d)][_0x34100f(0xd8)]({'oldLockKey':_0x16ab94,'newLockKey':_0x4889d2,'entry':_0x548829}),_0x15e3f3['set'](_0x3c65b7,_0x26c8e8);}const _0x472796=new Set([..._0x15e3f3[_0x34100f(0xe7)]()][_0x34100f(0x112)](_0x5567a2=>_0x5567a2[_0x34100f(0x14d)][_0x34100f(0xed)](_0x38aaef=>_0x38aaef[_0x34100f(0x12a)]))),_0x2ce2e8=new Map(),_0x42cbc2=new Map();for(const [_0x1b78b5,_0x3085d9]of _0x15e3f3){const _0xc9e536=_0x3085d9[_0x34100f(0x10f)]??_0x3085d9[_0x34100f(0x137)],_0xcdcf7d=hookDirectoryIdentity(_0xc9e536),_0xc20b72=_0x2ce2e8[_0x34100f(0x122)](_0xcdcf7d);if(_0xc20b72&&_0xc20b72!==_0x1b78b5)throw CliErrors['validation'](_0x34100f(0xde)+_0xc20b72+_0x34100f(0x11d)+_0x1b78b5+_0x34100f(0xd5)+_0xc9e536+_0x34100f(0xcc));_0x2ce2e8[_0x34100f(0x13a)](_0xcdcf7d,_0x1b78b5);for(const _0x73a7e4 of _0x3085d9[_0x34100f(0x14d)]){const _0x58c9d7=_0x42cbc2['get'](_0x73a7e4[_0x34100f(0x125)]);if(_0x58c9d7&&_0x58c9d7!==_0x73a7e4[_0x34100f(0x12a)])throw CliErrors[_0x34100f(0xf8)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x58c9d7+_0x34100f(0x11d)+_0x73a7e4[_0x34100f(0x12a)]+_0x34100f(0xd5)+_0x73a7e4['newLockKey']+_0x34100f(0x136));if(_0x472796['has'](_0x73a7e4[_0x34100f(0x125)]))throw CliErrors[_0x34100f(0xf8)](_0x34100f(0x117)+_0x73a7e4[_0x34100f(0x12a)]+_0x34100f(0xd3)+_0x73a7e4[_0x34100f(0x125)]+_0x34100f(0x14b));_0x42cbc2[_0x34100f(0x13a)](_0x73a7e4[_0x34100f(0x125)],_0x73a7e4[_0x34100f(0x12a)]);}}const _0x7cf3ff=new Map();for(const [_0x43fe2c,_0x2ba0cf]of _0xac20a0){_0x7cf3ff[_0x34100f(0x13a)](hookDirectoryIdentity(_0x2ba0cf),_0x43fe2c);}const _0xc2653e=[];for(const [_0x1370ff,_0x1a0390]of _0x15e3f3){const _0x4587c6=_0x1a0390['alias']??_0x1a0390[_0x34100f(0x137)],_0x1bdb11=join(_0x3a9ffa[_0x34100f(0x106)],_0x34100f(0x157),_0x1370ff),_0x34029a=join(_0x3a9ffa['scriptsRootDir'],_0x34100f(0x157),_0x4587c6),_0x52b023=await directoryExists(_0x1bdb11),_0x18c055=await directoryExists(_0x34029a),_0x4d8406=_0x52b023?_0x18c055?await sameDirectory(_0x1bdb11,_0x34029a)?'case-rename':undefined:_0x34100f(0x147):_0x34100f(0x133);if(!_0x4d8406)throw CliErrors[_0x34100f(0xf8)](_0x34100f(0x150)+_0x1370ff+_0x34100f(0xef)+_0x4587c6+_0x34100f(0xf9));const _0x2d7f1b=_0x7cf3ff['get'](hookDirectoryIdentity(_0x1370ff));if(_0x2d7f1b&&_0x2d7f1b!==_0x1a0390[_0x34100f(0x137)][_0x34100f(0xdd)]()){const _0x233282=new Set(_0x1a0390[_0x34100f(0x14d)][_0x34100f(0xed)](_0x223889=>_0x223889['oldLockKey'])),_0x58f6c1=_0x695414['filter'](_0x5b733f=>_0x5b733f[_0x34100f(0x12e)]==='HOOK'&&_0x5b733f[_0x34100f(0x10f)]!=null&&hookDirectoryIdentity(_0x5b733f['alias'])===hookDirectoryIdentity(_0x1370ff)&&!_0x233282[_0x34100f(0xea)](_0x5b733f[_0x34100f(0xff)]));if(_0x58f6c1['length']>0x0)throw CliErrors[_0x34100f(0xf8)](_0x34100f(0x150)+_0x1370ff+_0x34100f(0x124));}const _0x5c97e7=_0x7cf3ff['get'](hookDirectoryIdentity(_0x4587c6));if(_0x5c97e7&&_0x5c97e7!==_0x1a0390[_0x34100f(0x137)]['toLowerCase']())throw CliErrors['validation'](_0x34100f(0x150)+_0x1370ff+'\x22\x20to\x20\x22'+_0x4587c6+_0x34100f(0xd6));for(const _0x17c0d5 of _0x1a0390[_0x34100f(0x14d)]){const _0x3457ec=_0x286180[_0x34100f(0xe8)][_0x17c0d5['newLockKey']];if(_0x3457ec&&!_0x472796['has'](_0x17c0d5[_0x34100f(0x125)])&&!sameHookIdentity(_0x17c0d5[_0x34100f(0x129)],_0x3457ec))throw CliErrors[_0x34100f(0xf8)](_0x34100f(0x150)+_0x1370ff+_0x34100f(0xef)+_0x4587c6+_0x34100f(0x132));}_0xc2653e[_0x34100f(0xd8)]({'oldDirectory':_0x1370ff,'newDirectory':_0x4587c6,'oldDirectoryPath':_0x1bdb11,'newDirectoryPath':_0x34029a,'mode':_0x4d8406,'alias':_0x1a0390[_0x34100f(0x10f)],'keyChanges':_0x1a0390[_0x34100f(0x14d)]});}const _0x1b1d87={..._0x286180[_0x34100f(0xe8)]},_0xf54d18=new Map(),_0x52999d=new Map();for(const _0x570904 of _0xc2653e){const _0x550565=_0x570904[_0x34100f(0x11b)]!==_0x34100f(0x133);_0x550565&&_0x52999d[_0x34100f(0x13a)](hookDirectoryIdentity(_0x570904[_0x34100f(0xe4)]),_0x570904[_0x34100f(0x152)]);for(const _0x508e76 of _0x570904[_0x34100f(0x14d)]){const _0x3c4871=_0x1b1d87[_0x508e76[_0x34100f(0x125)]],_0x5b8976=_0x550565?_0x508e76[_0x34100f(0x129)]:_0x3c4871??_0x508e76[_0x34100f(0x129)];_0x1b1d87[_0x508e76['newLockKey']]=canonicalizeHookEntry(_0x5b8976,_0x570904[_0x34100f(0x10f)]),delete _0x1b1d87[_0x508e76[_0x34100f(0x12a)]],_0x550565&&_0xf54d18[_0x34100f(0x13a)](_0x508e76[_0x34100f(0x125)],resolveLocalFilePathFromLockKey(_0x3a9ffa,_0x508e76[_0x34100f(0x12a)]));}}return{'migrations':_0xc2653e,'projectedFunctions':_0x1b1d87,'sourceFilePathByNewLockKey':_0xf54d18,'sourceDirectoryPathByNewDirectory':_0x52999d};}function resolveMigratedSourceFilePath(_0x3eaee7,_0x1bbc1d){const _0x5bbbd8=a42_0x2f20d2;if(!_0x3eaee7||!_0x1bbc1d)return undefined;const _0x540115=_0x3eaee7[_0x5bbbd8(0x146)][_0x5bbbd8(0x122)](_0x1bbc1d[_0x5bbbd8(0xff)]);if(_0x540115)return _0x540115;if(_0x1bbc1d[_0x5bbbd8(0x12e)]!==_0x5bbbd8(0x157))return undefined;const [,_0x23cfc0,..._0x5c9437]=_0x1bbc1d[_0x5bbbd8(0xff)][_0x5bbbd8(0x105)]('/');if(!_0x23cfc0||_0x5c9437[_0x5bbbd8(0xd0)]===0x0)return undefined;const _0x5879cc=_0x3eaee7[_0x5bbbd8(0xf0)]['get'](hookDirectoryIdentity(_0x23cfc0));return _0x5879cc?join(_0x5879cc,..._0x5c9437)+_0x5bbbd8(0x131):undefined;}function sameHookIdentity(_0x1b6809,_0x565363){const _0x344bfd=a42_0x2f20d2;return _0x1b6809['remoteId']===_0x565363[_0x344bfd(0x155)]&&_0x1b6809[_0x344bfd(0x137)]===_0x565363[_0x344bfd(0x137)]&&_0x1b6809[_0x344bfd(0x13f)]===_0x565363[_0x344bfd(0x13f)]&&_0x1b6809[_0x344bfd(0xfd)]===_0x565363[_0x344bfd(0xfd)];}function canonicalizeHookEntry(_0x43ff66,_0x5b675d){const {alias:_0x327fce,..._0x71fa8f}=_0x43ff66;return _0x5b675d?{..._0x71fa8f,'alias':_0x5b675d}:_0x71fa8f;}function hookDirectoryIdentity(_0x373b52){const _0x236c03=a42_0x2f20d2;return _0x373b52[_0x236c03(0xf6)]('NFC')[_0x236c03(0xdd)]();}function isSafeHookDirectorySegment(_0x5c2830){return isSafeLockKeySegment(_0x5c2830);}async function sameDirectory(_0x54d03b,_0x1a9f10){const _0x556708=a42_0x2f20d2,[_0x245f4c,_0x3ec850]=await Promise[_0x556708(0x100)]([stat(_0x54d03b),stat(_0x1a9f10)]);return _0x245f4c[_0x556708(0xd1)]===_0x3ec850[_0x556708(0xd1)]&&_0x245f4c['ino']===_0x3ec850[_0x556708(0xfc)];}async function applyHookDirectoryMigration(_0x1aff81,_0xa26654){const _0xf3b516=a42_0x2f20d2,_0x41fda2=_0xa26654['functions'],_0xfcf66c=_0xa26654['lastSync'],_0x5b9da2=[],_0x1ffcf1=async()=>{const _0xd80331=a42_0x356a,_0x4b762d=[];_0xa26654[_0xd80331(0xe8)]=_0x41fda2,_0xa26654[_0xd80331(0x102)]=_0xfcf66c;for(const {migration:_0x4f66ea,temporaryPath:_0x467152}of[..._0x5b9da2][_0xd80331(0x12d)]()){try{_0x467152?(await rename(_0x4f66ea[_0xd80331(0x145)],_0x467152),await rename(_0x467152,_0x4f66ea[_0xd80331(0x152)])):await rename(_0x4f66ea[_0xd80331(0x145)],_0x4f66ea[_0xd80331(0x152)]);}catch(_0x1c8a2e){_0x4b762d[_0xd80331(0xd8)](new Error('Could\x20not\x20restore\x20HOOK\x20directory\x20\x22'+_0x4f66ea[_0xd80331(0x14e)]+_0xd80331(0x13d)+_0x4f66ea['newDirectory']+_0xd80331(0xe1)+(_0x1c8a2e instanceof Error?_0x1c8a2e[_0xd80331(0xdc)]:String(_0x1c8a2e))));}}return _0x4b762d;};try{for(const _0x4793f1 of _0x1aff81[_0xf3b516(0xf5)]){if(_0x4793f1['mode']===_0xf3b516(0x147))await ensureParentDirectory(_0x4793f1[_0xf3b516(0x145)]),await rename(_0x4793f1['oldDirectoryPath'],_0x4793f1[_0xf3b516(0x145)]),_0x5b9da2[_0xf3b516(0xd8)]({'migration':_0x4793f1});else{if(_0x4793f1[_0xf3b516(0x11b)]===_0xf3b516(0x108)){const _0x3acf21=join(dirname(_0x4793f1[_0xf3b516(0x152)]),_0xf3b516(0x10a)+randomUUID());await rename(_0x4793f1[_0xf3b516(0x152)],_0x3acf21);try{await rename(_0x3acf21,_0x4793f1[_0xf3b516(0x145)]);}catch(_0x4170ee){try{await rename(_0x3acf21,_0x4793f1[_0xf3b516(0x152)]);}catch(_0x5eca13){throw withRollbackErrors(_0x4170ee,'Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22'+_0x4793f1[_0xf3b516(0x14e)]+_0xf3b516(0xef)+_0x4793f1[_0xf3b516(0xe4)]+_0xf3b516(0x119)+_0x3acf21+'\x22\x20may\x20remain.',[new Error(_0xf3b516(0xe5)+_0x3acf21+_0xf3b516(0xef)+_0x4793f1[_0xf3b516(0x14e)]+_0xf3b516(0xe1)+(_0x5eca13 instanceof Error?_0x5eca13[_0xf3b516(0xdc)]:String(_0x5eca13)))]);}throw _0x4170ee;}_0x5b9da2['push']({'migration':_0x4793f1,'temporaryPath':_0x3acf21});}}}return _0xa26654[_0xf3b516(0xe8)]=_0x1aff81[_0xf3b516(0x14c)],{'rollback':_0x1ffcf1};}catch(_0x44c7ba){const _0x45fc7f=await _0x1ffcf1();throw withRollbackErrors(_0x44c7ba,_0xf3b516(0x158),_0x45fc7f);}}async function confirmForce(){const _0x116965=a42_0x2f20d2,_0x36ca18=createInterface({'input':process['stdin'],'output':process['stderr']}),_0xc3ede2=await new Promise(_0xd3dfe5=>{_0x36ca18['question']('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0xd3dfe5);});return _0x36ca18[_0x116965(0x11c)](),['y',_0x116965(0xdf)]['includes'](_0xc3ede2[_0x116965(0x13e)]()[_0x116965(0xdd)]());}
|
|
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']());}
|