@lovrabet/rabetbase-cli 2.5.4-beta.1 → 2.5.4-beta.3
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/feishu-bind.d.ts +2 -0
- package/lib/commands/user-account/feishu-bind.js +1 -0
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.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.d.ts +2 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +1 -1
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/flow-config.js +1 -1
- package/lib/core/instant-api-policy/config.js +1 -1
- package/lib/core/kb-search-client.js +1 -1
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/lr-smart-jsx.js +1 -1
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.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 +4 -3
- 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/references/rabetbase-user-account.md +20 -2
- package/skills/rabetbase.manifest.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0x1fe8cb=a34_0x7531;(function(_0x645683,_0xf9d178){const _0x311a13=a34_0x7531,_0x193ad5=_0x645683();while(!![]){try{const _0x33af38=-parseInt(_0x311a13(0x1eb))/0x1+-parseInt(_0x311a13(0x1d8))/0x2+parseInt(_0x311a13(0x213))/0x3+-parseInt(_0x311a13(0x1fc))/0x4+parseInt(_0x311a13(0x205))/0x5*(parseInt(_0x311a13(0x202))/0x6)+-parseInt(_0x311a13(0x204))/0x7*(-parseInt(_0x311a13(0x1ea))/0x8)+-parseInt(_0x311a13(0x215))/0x9;if(_0x33af38===_0xf9d178)break;else _0x193ad5['push'](_0x193ad5['shift']());}catch(_0x445c2a){_0x193ad5['push'](_0x193ad5['shift']());}}}(a34_0x452b,0xde29f));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a34_0x1fe8cb(0x1d7),'description':a34_0x1fe8cb(0x1fa),'required':!![]};export const VALUE_ARG={'name':a34_0x1fe8cb(0x1db),'description':a34_0x1fe8cb(0x1f7),'required':![]};export const TAGS_FLAG={'name':a34_0x1fe8cb(0x20b),'type':'string','description':a34_0x1fe8cb(0x1fd)};export const STDIN_FLAG={'name':a34_0x1fe8cb(0x208),'type':a34_0x1fe8cb(0x1d6),'description':a34_0x1fe8cb(0x1ed),'default':![]};export const FROM_ENV_FLAG={'name':a34_0x1fe8cb(0x1e4),'type':a34_0x1fe8cb(0x216),'description':a34_0x1fe8cb(0x1dc)};export const REVEAL_FLAG={'name':a34_0x1fe8cb(0x1e8),'type':a34_0x1fe8cb(0x1d6),'description':a34_0x1fe8cb(0x201),'default':![]};export function readKeyArg(_0x1740e8){const _0x53fb62=a34_0x1fe8cb,_0x3ac97e=_0x1740e8['args'][0x0]?.[_0x53fb62(0x1e6)]()??'';return validateKey(_0x3ac97e),_0x3ac97e;}export function readOptionalTags(_0x5cfa4c){const _0x927c1=a34_0x1fe8cb,_0x1833db=_0x5cfa4c['str'](_0x927c1(0x20b))[_0x927c1(0x1e6)]();if(!_0x1833db)return undefined;if(_0x1833db['length']>0x20)throw CliErrors[_0x927c1(0x1d9)](_0x927c1(0x1e9));return _0x1833db;}export function validateKey(_0x336107){const _0x38f616=a34_0x1fe8cb;if(!_0x336107)throw CliErrors['validation'](_0x38f616(0x214));if(_0x336107[_0x38f616(0x211)]>0x100)throw CliErrors['validation'](_0x38f616(0x1df));}export function projectAppConfig(_0x42a7e5,_0x182c3d){const _0x660500=a34_0x1fe8cb,_0x4f7309=_0x42a7e5[_0x660500(0x1db)]!==undefined&&_0x42a7e5[_0x660500(0x1db)]!==null&&_0x42a7e5[_0x660500(0x1db)]!=='',_0x2d3fa1={'appCode':_0x42a7e5[_0x660500(0x1f6)],'key':_0x42a7e5[_0x660500(0x1d7)],'tags':_0x42a7e5[_0x660500(0x20b)]??undefined,'hasValue':_0x4f7309,'valueRedacted':_0x4f7309&&!_0x182c3d?.[_0x660500(0x1e8)],'gmtCreate':_0x42a7e5['gmtCreate'],'gmtModified':_0x42a7e5[_0x660500(0x1f0)]};return _0x182c3d?.[_0x660500(0x1e8)]&&(_0x2d3fa1[_0x660500(0x1db)]=_0x42a7e5[_0x660500(0x1db)]??'',_0x2d3fa1[_0x660500(0x209)]=![]),_0x2d3fa1;}function a34_0x452b(){const _0x43bd7c=['string','after','slice','boolean','key','1791464JIpMXr','validation','key:\x20','value','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','argument','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','hasValue','operation','utf8','App\x20config\x20value\x20source\x20is\x20ambiguous.','from-env','data','trim','str','reveal','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','5032zGINSx','26658uKzUus','setEncoding','Read\x20config\x20value\x20from\x20stdin','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','Value\x20file\x20is\x20not\x20readable:\x20','gmtModified','\x20app\x20config.','end','before','push','error','appCode','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','value\x20is\x20redacted','Failed\x20to\x20','Runtime\x20app-config\x20key','Environment\x20variable\x20is\x20not\x20set:\x20','715648gsmriR','Config\x20tags\x20for\x20filtering/display\x20metadata','args','kind','warnings','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','42702LRyBFo','path','7287ljYAvo','830bWaVES','once','appCode:\x20','stdin','valueRedacted','dryRun','tags','file','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','defineProperties','apiError','env','length','name','824529iiXvLs','Missing\x20app-config\x20key.','897921sVYiag'];a34_0x452b=function(){return _0x43bd7c;};return a34_0x452b();}export function plannedAppConfig(_0xd32ff1){const _0x326cc1=a34_0x1fe8cb,_0x1ac731=_0xd32ff1[_0x326cc1(0x1e0)]??!![];return{'appCode':_0xd32ff1['appCode'],'key':_0xd32ff1[_0x326cc1(0x1d7)],'tags':_0xd32ff1['tags']??undefined,'hasValue':_0x1ac731,'valueRedacted':_0x1ac731};}export function buildMutationData(_0x11a864){const _0x201b77=a34_0x1fe8cb;return{'operation':_0x11a864[_0x201b77(0x1e1)],'selector':{'appCode':_0x11a864[_0x201b77(0x1f6)],'key':_0x11a864[_0x201b77(0x1d7)]},'before':_0x11a864[_0x201b77(0x1f3)],'after':_0x11a864[_0x201b77(0x217)],'dryRun':_0x11a864[_0x201b77(0x20a)],'warnings':_0x11a864[_0x201b77(0x200)]??[]};}export async function withAppConfigApiBoundary(_0x168268,_0x39c360,_0x304de1){const _0x46a4f9=a34_0x1fe8cb;try{return await _0x304de1();}catch{const _0x911690=[_0x46a4f9(0x207)+_0x39c360[_0x46a4f9(0x1f6)]];if(_0x39c360['key'])_0x911690[_0x46a4f9(0x1f4)](_0x46a4f9(0x1da)+_0x39c360[_0x46a4f9(0x1d7)]);_0x911690['push'](_0x46a4f9(0x1f8));throw CliErrors[_0x46a4f9(0x20f)](_0x46a4f9(0x1f9)+_0x168268+_0x46a4f9(0x1f1),_0x911690['join'](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x2c7ef5,_0x158ed3){const _0xe4e3ff=a34_0x1fe8cb;return Object[_0xe4e3ff(0x20e)](_0x2c7ef5,{'method':{'value':_0x158ed3['method'],'enumerable':![]},'url':{'value':_0x158ed3['url'],'enumerable':![]}});}export function assertSingleValueSource(_0x577a43){const _0x382b58=a34_0x1fe8cb,_0x47b0d1=[];_0x577a43['args'][_0x382b58(0x211)]>0x1&&_0x47b0d1['push']({'kind':_0x382b58(0x1de),'value':_0x577a43[_0x382b58(0x1fe)][_0x382b58(0x1d5)](0x1)['join']('\x20')});const _0x5eba1c=_0x577a43['flag'](_0x382b58(0x1db));_0x5eba1c!==undefined&&_0x5eba1c!==null&&_0x47b0d1[_0x382b58(0x1f4)]({'kind':_0x382b58(0x1de),'value':String(_0x5eba1c)});_0x577a43['bool'](_0x382b58(0x208))&&_0x47b0d1[_0x382b58(0x1f4)]({'kind':'stdin'});const _0x15be7c=_0x577a43[_0x382b58(0x1e7)](_0x382b58(0x1e4))['trim']();_0x15be7c&&_0x47b0d1['push']({'kind':_0x382b58(0x210),'name':_0x15be7c});const _0xcf31c=_0x577a43[_0x382b58(0x1e7)](_0x382b58(0x20c))[_0x382b58(0x1e6)]();_0xcf31c&&_0x47b0d1[_0x382b58(0x1f4)]({'kind':_0x382b58(0x20c),'path':_0xcf31c});if(_0x47b0d1[_0x382b58(0x211)]===0x0)throw CliErrors[_0x382b58(0x1d9)]('Missing\x20app-config\x20value\x20source.',_0x382b58(0x1dd));if(_0x47b0d1[_0x382b58(0x211)]>0x1)throw CliErrors[_0x382b58(0x1d9)](_0x382b58(0x1e3),_0x382b58(0x20d));return _0x47b0d1[0x0];}function a34_0x7531(_0x347406,_0x34701e){_0x347406=_0x347406-0x1d5;const _0x452baa=a34_0x452b();let _0x753198=_0x452baa[_0x347406];return _0x753198;}export async function assertValueSourceReadable(_0xe65291){const _0x499fd4=a34_0x1fe8cb;if(_0xe65291[_0x499fd4(0x1ff)]===_0x499fd4(0x210)&&!(_0xe65291[_0x499fd4(0x212)]in process.env))throw CliErrors['validation'](_0x499fd4(0x1fb)+_0xe65291[_0x499fd4(0x212)]);if(_0xe65291[_0x499fd4(0x1ff)]===_0x499fd4(0x20c))try{await access(_0xe65291[_0x499fd4(0x203)]);}catch{throw CliErrors['validation'](_0x499fd4(0x1ef)+_0xe65291[_0x499fd4(0x203)]);}}export async function readAppConfigValue(_0x11f065){const _0xb50a78=a34_0x1fe8cb,_0x2df842=assertSingleValueSource(_0x11f065),_0x2a605f=[];if(_0x2df842['kind']==='argument')return _0x2a605f[_0xb50a78(0x1f4)](_0xb50a78(0x1ee)),{'value':_0x2df842[_0xb50a78(0x1db)]??'','source':_0x2df842[_0xb50a78(0x1ff)],'warnings':_0x2a605f};if(_0x2df842[_0xb50a78(0x1ff)]===_0xb50a78(0x208))return{'value':await readStdin(),'source':_0x2df842[_0xb50a78(0x1ff)],'warnings':_0x2a605f};if(_0x2df842[_0xb50a78(0x1ff)]==='env'){if(!(_0x2df842[_0xb50a78(0x212)]in process.env))throw CliErrors['validation'](_0xb50a78(0x1fb)+_0x2df842[_0xb50a78(0x212)]);return{'value':process.env[_0x2df842.name]??'','source':_0x2df842[_0xb50a78(0x1ff)],'warnings':_0x2a605f};}return{'value':await readFile(_0x2df842[_0xb50a78(0x203)],_0xb50a78(0x1e2)),'source':_0x2df842[_0xb50a78(0x1ff)],'warnings':_0x2a605f};}function readStdin(){return new Promise((_0x31acd4,_0x486f12)=>{const _0x37bc86=a34_0x7531;let _0x323850='';process[_0x37bc86(0x208)][_0x37bc86(0x1ec)](_0x37bc86(0x1e2)),process[_0x37bc86(0x208)]['on'](_0x37bc86(0x1e5),_0x59a142=>{_0x323850+=_0x59a142;}),process[_0x37bc86(0x208)][_0x37bc86(0x206)](_0x37bc86(0x1f2),()=>_0x31acd4(_0x323850)),process['stdin']['once'](_0x37bc86(0x1f5),_0x486f12);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x408b7d=a35_0x4ef5;(function(_0x3a75c3,_0x2ec71d){const _0x49045f=a35_0x4ef5,_0xb2fc7a=_0x3a75c3();while(!![]){try{const _0x47e6ca=parseInt(_0x49045f(0x148))/0x1*(parseInt(_0x49045f(0x155))/0x2)+parseInt(_0x49045f(0x14e))/0x3+parseInt(_0x49045f(0x149))/0x4*(-parseInt(_0x49045f(0x152))/0x5)+-parseInt(_0x49045f(0x14b))/0x6*(-parseInt(_0x49045f(0x156))/0x7)+parseInt(_0x49045f(0x157))/0x8*(parseInt(_0x49045f(0x146))/0x9)+-parseInt(_0x49045f(0x159))/0xa+-parseInt(_0x49045f(0x147))/0xb;if(_0x47e6ca===_0x2ec71d)break;else _0xb2fc7a['push'](_0xb2fc7a['shift']());}catch(_0x170535){_0xb2fc7a['push'](_0xb2fc7a['shift']());}}}(a35_0x28be,0x55dec));import{unlinkSync,existsSync}from'node:fs';function a35_0x4ef5(_0x77ab99,_0x12cd37){_0x77ab99=_0x77ab99-0x146;const _0x28bea5=a35_0x28be();let _0x4ef575=_0x28bea5[_0x77ab99];return _0x4ef575;}function a35_0x28be(){const _0x40bb26=['Login\x20via\x20browser','17298JvBTZr','144914SDYcOa','613429qEHlcj','4SykZaZ','nonInteractive','1752DiUQBA','log','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','1187523waHSHd','✓\x20Logged\x20out','Clear\x20login\x20session','write','3485115WITiTt','auth','../../auth/auth-server-ui.js','2YKmzLC','2786NcjZYw','424GUVUDu','!\x20Not\x20logged\x20in','1654310EqCwdZ'];a35_0x28be=function(){return _0x40bb26;};return a35_0x28be();}import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a35_0x408b7d(0x153),'command':'login','description':a35_0x408b7d(0x15a),'risk':a35_0x408b7d(0x151),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'yes','type':'boolean','description':a35_0x408b7d(0x14d),'default':![]}],async 'execute'(_0x4e4e8b){const _0x29ee9d=a35_0x408b7d,{runAuthServer:_0x2b586d}=await import(_0x29ee9d(0x154));return await _0x2b586d({'autoYes':_0x4e4e8b['bool']('yes'),'nonInteractive':_0x4e4e8b[_0x29ee9d(0x14a)]}),{'ok':!![]};}},{'service':'auth','command':'logout','description':a35_0x408b7d(0x150),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x7bb35f){const _0x10217f=a35_0x408b7d;return existsSync(cookieFile)?(unlinkSync(cookieFile),console['log'](_0x10217f(0x14f))):console[_0x10217f(0x14c)](_0x10217f(0x158)),{'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
|
+
const a36_0x4c2442=a36_0x3f81;(function(_0x114673,_0x2111df){const _0x3d677e=a36_0x3f81,_0x1efd03=_0x114673();while(!![]){try{const _0x5a99a0=-parseInt(_0x3d677e(0x145))/0x1+parseInt(_0x3d677e(0x126))/0x2+parseInt(_0x3d677e(0x159))/0x3*(-parseInt(_0x3d677e(0x16a))/0x4)+parseInt(_0x3d677e(0x151))/0x5*(parseInt(_0x3d677e(0x11d))/0x6)+parseInt(_0x3d677e(0x17c))/0x7+-parseInt(_0x3d677e(0x142))/0x8+parseInt(_0x3d677e(0x12b))/0x9*(parseInt(_0x3d677e(0x132))/0xa);if(_0x5a99a0===_0x2111df)break;else _0x1efd03['push'](_0x1efd03['shift']());}catch(_0x37bd23){_0x1efd03['push'](_0x1efd03['shift']());}}}(a36_0x127b,0x37f47));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';function a36_0x127b(){const _0x20f279=['close','Operation\x20type\x20(HOOK\x20only)','625294VRxvmu','Trigger\x20node\x20(HOOK\x20only)','Select\x20dataset:','currentApp','COMMON','69075dOaCNL','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Operation\x20type\x20\x22','length','parseInt','isInteger','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','200fwnyEv','\x22.\x20','Available\x20aliases:\x20','create','trim','.js\x0a\x20*\x20[触发节点]\x20','description','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','join','\x22,\x20params\x20})\x0a','profileName','defaultApp','functionNode','.js','Created\x20',']\x20(','3082272hyaxpr','HOOK\x20requires\x20alias/operation/node\x20options.','No\x20operation\x20types\x20found\x20for\x20dataset\x20','191353SOXJXm','/ENDPOINT/','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','appCode','write','Alias\x20\x22','question','filePath','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','map','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','utf8','1055upMBVu','stdin','mergedCli','name','/HOOK/','\x22\x20not\x20found.\x20','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','\x20api\x20pull`\x20to\x20refresh.','278763UwfPoW','keys','includes','scriptsRootDir','\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','alias','validation','修改后的响应结果','before','string','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','nonInteractive','stderr','Invalid\x20dataset\x20selection.','operationType','\x22\x20not\x20found\x20for\x20dataset\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','4TVWVGP','after','find','/data/dataset/','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','Select\x20operation\x20type:','type','datasetCode','Script\x20description','read','HOOK','/**\x0a\x20*\x20','The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','\x0a\x20*\x20[平台配置]\x20','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','Select\x20trigger\x20node:','.js\x0a','755111JkgvAn','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','entries','datasetcode','No\x20datasets\x20found\x20for\x20this\x20app.','apiDir','str','Dataset\x20not\x20found\x20for\x20code\x20\x22','selectedAppName','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','datasetId','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','No\x20model\x20aliases\x20found.\x20Run\x20`','9234QhCfHq','function-node','/COMMON/','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','code','\x20function:\x20','operation-type'];a36_0x127b=function(){return _0x20f279;};return a36_0x127b();}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';function a36_0x3f81(_0x10fed0,_0x7c020b){_0x10fed0=_0x10fed0-0x11a;const _0x127bc2=a36_0x127b();let _0x3f81f3=_0x127bc2[_0x10fed0];return _0x3f81f3;}import{CLI_BIN_NAME}from'../../constant/cli.js';import{getAppBaseUrl}from'../../constant/domain.js';export const bffCreate={'service':'bff','command':a36_0x4c2442(0x135),'description':'Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','risk':a36_0x4c2442(0x173),'flags':[{'name':a36_0x4c2442(0x170),'type':a36_0x4c2442(0x162),'required':!![],'enum':['COMMON','ENDPOINT','HOOK'],'description':'Script\x20type'},{'name':a36_0x4c2442(0x154),'type':a36_0x4c2442(0x162),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a36_0x4c2442(0x138),'type':a36_0x4c2442(0x162),'description':a36_0x4c2442(0x172)},{'name':a36_0x4c2442(0x15e),'type':a36_0x4c2442(0x162),'description':a36_0x4c2442(0x139)},{'name':a36_0x4c2442(0x180),'type':'string','description':a36_0x4c2442(0x120)},{'name':a36_0x4c2442(0x123),'type':a36_0x4c2442(0x162),'description':a36_0x4c2442(0x125)},{'name':a36_0x4c2442(0x11e),'type':a36_0x4c2442(0x162),'description':a36_0x4c2442(0x127),'enum':[a36_0x4c2442(0x161),a36_0x4c2442(0x16b)]}],async 'validate'(_0x51cd9a){const _0xcb82b2=a36_0x4c2442,_0x1b2f42=_0x51cd9a['str'](_0xcb82b2(0x154));if(!isValidBffFunctionName(_0x1b2f42))throw CliErrors[_0xcb82b2(0x15f)]('Invalid\x20function\x20name\x20\x22'+_0x1b2f42+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x5420e3){const _0x377faf=a36_0x4c2442,_0x682968=loadBffProjectConfig(_0x5420e3[_0x377faf(0x148)]),_0x424af0=_0x5420e3[_0x377faf(0x183)](_0x377faf(0x170)),_0x319b41=_0x5420e3[_0x377faf(0x183)](_0x377faf(0x154)),_0x21fec0=_0x5420e3['str'](_0x377faf(0x138))||undefined,_0x52f0c7=_0x424af0==='HOOK'?await resolveHookOptions(_0x682968,_0x5420e3):undefined,_0x43a7b7=buildFilePath(_0x682968,_0x424af0,_0x319b41,_0x52f0c7);if(await fileExists(_0x43a7b7))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x43a7b7);await mkdir(dirname(_0x43a7b7),{'recursive':!![]});const _0x2fe1fd=generateTemplate(_0x424af0,_0x319b41,_0x5420e3[_0x377faf(0x148)],_0x21fec0,_0x52f0c7);await writeFile(_0x43a7b7,_0x2fe1fd,_0x377faf(0x150));const _0x5685c5={'type':_0x424af0,'name':_0x319b41,'path':_0x43a7b7};if(_0x21fec0)_0x5685c5[_0x377faf(0x138)]=_0x21fec0;if(_0x52f0c7){if(_0x52f0c7[_0x377faf(0x15e)])_0x5685c5['alias']=_0x52f0c7[_0x377faf(0x15e)];_0x5685c5['datasetCode']=_0x52f0c7[_0x377faf(0x171)],_0x5685c5[_0x377faf(0x167)]=_0x52f0c7[_0x377faf(0x167)],_0x5685c5[_0x377faf(0x13e)]=_0x52f0c7['functionNode'];}return{'ok':!![],'data':_0x5685c5,'message':_0x377faf(0x140)+_0x424af0+_0x377faf(0x122)+_0x319b41};}};async function resolveHookOptions(_0x361635,_0x17cb80){const _0x52b981=a36_0x4c2442,_0x3a5fac=resolveApiModelSource(_0x17cb80[_0x52b981(0x182)],_0x17cb80[_0x52b981(0x148)],_0x17cb80[_0x52b981(0x185)]||_0x17cb80[_0x52b981(0x153)]?.[_0x52b981(0x129)]||_0x17cb80['mergedCli']?.[_0x52b981(0x13d)]),_0x36a211=loadAliasMap(_0x17cb80[_0x52b981(0x182)],undefined,_0x3a5fac[_0x52b981(0x14c)],_0x3a5fac['profileName']),_0x5ec73a=_0x36a211['length']>0x0;let _0x10368b,_0xbb8a27,_0x18f3c0;const _0x56cb76=_0x17cb80[_0x52b981(0x183)]('alias'),_0x2c6ffa=_0x17cb80[_0x52b981(0x183)]('datasetcode');if(_0x56cb76){const _0x50b071=resolveAlias(_0x17cb80[_0x52b981(0x182)],_0x56cb76,undefined,_0x3a5fac[_0x52b981(0x14c)],_0x3a5fac[_0x52b981(0x13c)]);if(!_0x50b071){const _0x33222c=_0x5ec73a?_0x52b981(0x134)+_0x36a211[_0x52b981(0x14e)](_0x1e9825=>_0x1e9825['alias'])[_0x52b981(0x13a)](',\x20'):_0x52b981(0x11c)+CLI_BIN_NAME+_0x52b981(0x14f);throw CliErrors[_0x52b981(0x15f)](_0x52b981(0x14a)+_0x56cb76+_0x52b981(0x156)+_0x33222c);}_0x10368b=_0x56cb76,_0xbb8a27=_0x50b071;}else{if(_0x2c6ffa){_0xbb8a27=_0x2c6ffa;const _0x2dc04c=_0x36a211[_0x52b981(0x16c)](_0x21bfb5=>_0x21bfb5['datasetCode']===_0x2c6ffa);_0x10368b=_0x2dc04c?.['alias'];}else{if(_0x17cb80[_0x52b981(0x164)])throw CliErrors[_0x52b981(0x15f)](_0x52b981(0x14d));else{if(_0x5ec73a){const _0x4511e2=_0x36a211['map'](_0x14a28e=>_0x14a28e['alias']+'\x20('+_0x14a28e['tableName']+')'),_0x57d5fd=await promptSelect(_0x52b981(0x128),_0x4511e2),_0x2ec5c7=_0x36a211[_0x57d5fd];if(!_0x2ec5c7)throw CliErrors['validation'](_0x52b981(0x166));_0x10368b=_0x2ec5c7['alias'],_0xbb8a27=_0x2ec5c7[_0x52b981(0x171)];}else{const _0xe4b091=await listDatasets(_0x17cb80[_0x52b981(0x148)]);if(_0xe4b091[_0x52b981(0x12e)]===0x0)throw CliErrors['validation'](_0x52b981(0x181));const _0x25c903=_0xe4b091[_0x52b981(0x14e)](_0x5592b8=>_0x5592b8[_0x52b981(0x154)]+'\x20['+(_0x5592b8['source']??'UNKNOWN')+_0x52b981(0x141)+_0x5592b8[_0x52b981(0x121)]+')'),_0x10a8e7=await promptSelect(_0x52b981(0x128),_0x25c903),_0x8f4d5d=_0xe4b091[_0x10a8e7];if(!_0x8f4d5d)throw CliErrors[_0x52b981(0x15f)]('Invalid\x20dataset\x20selection.');_0xbb8a27=_0x8f4d5d['code'],_0x10368b=undefined;}}}}const _0x10cd66=await listDatasets(_0x17cb80[_0x52b981(0x148)]),_0x3f5414=_0x10cd66[_0x52b981(0x16c)](_0x269f41=>_0x269f41['code']===_0xbb8a27);if(!_0x3f5414)throw CliErrors['validation'](_0x52b981(0x184)+_0xbb8a27+_0x52b981(0x133)+(_0x10368b?_0x52b981(0x176)+CLI_BIN_NAME+_0x52b981(0x158):''));_0x18f3c0=_0x3f5414['id'];const _0x3e5ff0=_0x10368b??_0xbb8a27,_0x583895=await listBffDatasetOperations(_0x17cb80[_0x52b981(0x148)],_0x18f3c0),_0x418d87=_0x583895?Object[_0x52b981(0x15a)](_0x583895):[];if(_0x418d87['length']===0x0)throw CliErrors[_0x52b981(0x15f)](_0x52b981(0x144)+_0x3e5ff0+'.');let _0x22a157;const _0x301bc4=_0x17cb80[_0x52b981(0x183)](_0x52b981(0x123));if(_0x301bc4){if(!_0x418d87[_0x52b981(0x15b)](_0x301bc4))throw CliErrors[_0x52b981(0x15f)](_0x52b981(0x12d)+_0x301bc4+_0x52b981(0x168)+_0x3e5ff0+'.\x20'+('Available:\x20'+_0x418d87[_0x52b981(0x13a)](',\x20')));_0x22a157=_0x301bc4;}else{if(_0x17cb80[_0x52b981(0x164)])throw CliErrors[_0x52b981(0x15f)](_0x52b981(0x131));const _0x473147=await promptSelect(_0x52b981(0x16f),_0x418d87);_0x22a157=_0x418d87[_0x473147]??_0x418d87[0x0];}let _0x11f8f8=normalizeHookFunctionNode(_0x17cb80[_0x52b981(0x183)](_0x52b981(0x11e)));if(!_0x11f8f8){if(_0x17cb80[_0x52b981(0x183)](_0x52b981(0x11e)))throw CliErrors['validation'](_0x52b981(0x147));if(_0x17cb80['nonInteractive'])throw CliErrors[_0x52b981(0x15f)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x3c6640=await promptSelect(_0x52b981(0x17a),[_0x52b981(0x161),_0x52b981(0x16b)]);_0x11f8f8=[_0x52b981(0x161),'after'][_0x3c6640]??_0x52b981(0x161);}return{'alias':_0x10368b,'datasetCode':_0xbb8a27,'datasetId':_0x18f3c0,'operationType':_0x22a157,'functionNode':_0x11f8f8};}async function promptSelect(_0x3bdf10,_0x4d26b5){const _0x290e35=a36_0x4c2442;if(_0x4d26b5[_0x290e35(0x12e)]===0x1)return 0x0;for(const [_0x5e6399,_0x5be7ca]of _0x4d26b5[_0x290e35(0x17f)]()){process[_0x290e35(0x165)]['write']('\x20\x20'+(_0x5e6399+0x1)+'.\x20'+_0x5be7ca+'\x0a');}const _0x315635=createInterface({'input':process[_0x290e35(0x152)],'output':process[_0x290e35(0x165)]});while(!![]){const _0x91d9c8=await new Promise(_0x59e1d2=>{const _0x313d08=_0x290e35;_0x315635[_0x313d08(0x14b)](_0x3bdf10+'\x20',_0x59e1d2);}),_0x5cc696=Number[_0x290e35(0x12f)](_0x91d9c8[_0x290e35(0x136)](),0xa);if(Number[_0x290e35(0x130)](_0x5cc696)&&_0x5cc696>=0x1&&_0x5cc696<=_0x4d26b5['length'])return _0x315635[_0x290e35(0x124)](),_0x5cc696-0x1;process[_0x290e35(0x165)][_0x290e35(0x149)](_0x290e35(0x177)+_0x4d26b5['length']+'.\x0a');}}function buildFilePath(_0x22acfb,_0x321dc8,_0x45b46e,_0x2417e8){const _0x582631=a36_0x4c2442;if(_0x321dc8===_0x582631(0x174)){if(!_0x2417e8)throw CliErrors[_0x582631(0x15f)](_0x582631(0x143));const _0x38d427=_0x2417e8['alias']??_0x2417e8[_0x582631(0x171)];return join(_0x22acfb['scriptsRootDir'],_0x582631(0x174),_0x38d427,_0x2417e8[_0x582631(0x167)],_0x2417e8['functionNode'],_0x45b46e+_0x582631(0x13f));}return join(_0x22acfb[_0x582631(0x15c)],_0x321dc8,_0x45b46e+'.js');}export function generateTemplate(_0x31a226,_0x4fa65e,_0x282099,_0x1f1e44,_0x4ea085){const _0x231340=a36_0x4c2442,_0x3fc85a=_0x1f1e44?.[_0x231340(0x136)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x4372e2=getAppBaseUrl(_0x282099),_0x54781b=_0x231340(0x17e);if(_0x31a226===_0x231340(0x12a))return _0x231340(0x175)+_0x3fc85a+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0x4fa65e+_0x231340(0x178)+_0x4372e2+_0x231340(0x186)+_0x282099+_0x231340(0x11f)+_0x4fa65e+_0x231340(0x179)+_0x4fa65e+_0x231340(0x13b)+_0x54781b+'\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'+_0x4fa65e+_0x231340(0x11b);if(_0x31a226==='ENDPOINT')return _0x231340(0x175)+_0x3fc85a+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20'+_0x4fa65e+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x282099+'/'+_0x4fa65e+_0x231340(0x178)+_0x4372e2+_0x231340(0x186)+_0x282099+_0x231340(0x146)+_0x4fa65e+_0x231340(0x17b)+_0x54781b+_0x231340(0x15d)+_0x4fa65e+_0x231340(0x11b);if(!_0x4ea085)throw CliErrors[_0x231340(0x15f)](_0x231340(0x163));const _0x25e52b=_0x4ea085['alias']??_0x4ea085[_0x231340(0x171)],_0x1de2d7=_0x4ea085[_0x231340(0x13e)]===_0x231340(0x161)?'当前请求参数':'当前响应结果',_0x5b19ee=_0x4ea085['functionNode']===_0x231340(0x161)?'修改后的请求参数':_0x231340(0x160);return _0x231340(0x175)+_0x3fc85a+_0x231340(0x169)+_0x4fa65e+_0x231340(0x17d)+_0x282099+'/'+_0x4ea085[_0x231340(0x171)]+'/'+_0x4ea085[_0x231340(0x167)]+_0x231340(0x178)+_0x4372e2+_0x231340(0x16d)+_0x4ea085[_0x231340(0x11a)]+_0x231340(0x157)+_0x282099+_0x231340(0x155)+_0x25e52b+'/'+_0x4ea085['operationType']+'/'+_0x4ea085[_0x231340(0x13e)]+'/'+_0x4fa65e+_0x231340(0x137)+_0x4ea085['functionNode']+'\x0a'+_0x54781b+_0x231340(0x16e)+_0x1de2d7+'\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20'+_0x5b19ee+_0x231340(0x12c)+_0x4fa65e+_0x231340(0x11b);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a37_0x19a8ee=a37_0xffd1;(function(_0x1a05f7,_0x41ef69){const _0x3a20a5=a37_0xffd1,_0x451655=_0x1a05f7();while(!![]){try{const _0x3365cc=-parseInt(_0x3a20a5(0x1a7))/0x1*(-parseInt(_0x3a20a5(0x1a0))/0x2)+-parseInt(_0x3a20a5(0x1c2))/0x3+-parseInt(_0x3a20a5(0x193))/0x4*(-parseInt(_0x3a20a5(0x196))/0x5)+parseInt(_0x3a20a5(0x1b8))/0x6*(-parseInt(_0x3a20a5(0x1b9))/0x7)+-parseInt(_0x3a20a5(0x19d))/0x8*(-parseInt(_0x3a20a5(0x1b4))/0x9)+parseInt(_0x3a20a5(0x1ac))/0xa*(-parseInt(_0x3a20a5(0x1a9))/0xb)+parseInt(_0x3a20a5(0x1a4))/0xc*(parseInt(_0x3a20a5(0x1b7))/0xd);if(_0x3365cc===_0x41ef69)break;else _0x451655['push'](_0x451655['shift']());}catch(_0x1110b6){_0x451655['push'](_0x451655['shift']());}}}(a37_0x9f91,0xee5e9));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteBffScript}from'../../core/api-client.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists,resolveLocalFilePathFromLockKey}from'../../core/bff/file-system.js';import{ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{sleep}from'../../utils/sleep.js';export const bffDelete={'service':a37_0x19a8ee(0x1ae),'command':'delete','description':a37_0x19a8ee(0x19a),'risk':'high-risk-write','flags':[{'name':a37_0x19a8ee(0x1a1),'type':'string','required':!![],'description':a37_0x19a8ee(0x1c1)}],async 'validate'(_0x56363e){const _0x15bd58=a37_0x19a8ee,_0x228574=loadBffProjectConfig(_0x56363e[_0x15bd58(0x1a3)]),_0x16741d=await readBffLockFile(_0x228574[_0x15bd58(0x1bf)]);if(!_0x16741d)throw CliErrors[_0x15bd58(0x197)]('Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.');},async 'dryRun'(_0x377c88){const _0x37f50d=a37_0x19a8ee,_0x2f0a38=loadBffProjectConfig(_0x377c88['appCode']),_0x3d41c3=await readBffLockFile(_0x2f0a38['lockFilePath']);if(!_0x3d41c3)throw CliErrors[_0x37f50d(0x197)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {appLock:_0x3911fe}=ensureLockScope(_0x3d41c3,_0x377c88[_0x37f50d(0x1a3)],_0x2f0a38[_0x37f50d(0x1a2)],_0x37f50d(0x190)),_0x554253=_0x377c88[_0x37f50d(0x1b6)](_0x37f50d(0x1a1)),_0x3a71d7=Object[_0x37f50d(0x1bb)](_0x3911fe['functions']),_0x13c02e=resolveDeleteTarget(_0x554253,_0x3a71d7),_0x46cea0=_0x3911fe[_0x37f50d(0x191)][_0x13c02e];if(!_0x46cea0)throw CliErrors[_0x37f50d(0x197)](_0x37f50d(0x1ad)+_0x13c02e+'\x22.');const _0x563b10=resolveLocalFilePathFromLockKey(_0x2f0a38,_0x13c02e),_0x54a2f4=relative(_0x2f0a38[_0x37f50d(0x198)],_0x563b10),_0x5f461e=join(_0x2f0a38[_0x37f50d(0x19e)],_0x37f50d(0x1b2),_0x54a2f4);return{'method':_0x37f50d(0x192),'url':'/api/management/library/scripts/delete','body':{'appCode':_0x377c88['appCode'],'target':_0x13c02e,'remoteId':_0x46cea0[_0x37f50d(0x19b)],'localFilePath':_0x563b10,'trashedPath':_0x5f461e},'description':_0x37f50d(0x1a6)+_0x13c02e+_0x37f50d(0x1b3)};},async 'execute'(_0x4219fa){const _0x3b20d4=a37_0x19a8ee,_0x5a11f3=loadBffProjectConfig(_0x4219fa['appCode']),_0x32fc4d=await readBffLockFile(_0x5a11f3[_0x3b20d4(0x1bf)]);if(!_0x32fc4d)throw CliErrors[_0x3b20d4(0x197)]('Backend\x20Function\x20lock\x20file\x20not\x20found.');const {lockData:_0x235ca8,appLock:_0x2b5ff5}=ensureLockScope(_0x32fc4d,_0x4219fa['appCode'],_0x5a11f3['scriptsRoot'],_0x3b20d4(0x190)),_0x1ff6f4=JSON[_0x3b20d4(0x1c0)](JSON[_0x3b20d4(0x19c)](_0x235ca8)),_0x865fa7=_0x1ff6f4[_0x3b20d4(0x1ba)][_0x4219fa['appCode']];if(!_0x865fa7)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x4219fa['appCode']+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x4f3252=_0x4219fa[_0x3b20d4(0x1b6)](_0x3b20d4(0x1a1)),_0x54ce10=Object[_0x3b20d4(0x1bb)](_0x865fa7[_0x3b20d4(0x191)]),_0x16b757=resolveDeleteTarget(_0x4f3252,_0x54ce10),_0x322a7c=_0x865fa7[_0x3b20d4(0x191)][_0x16b757];if(!_0x322a7c)throw CliErrors[_0x3b20d4(0x197)](_0x3b20d4(0x1ad)+_0x16b757+'\x22.');await deleteBffScript(_0x322a7c['remoteId']),delete _0x865fa7[_0x3b20d4(0x191)][_0x16b757],_0x865fa7[_0x3b20d4(0x19f)]=new Date()[_0x3b20d4(0x1a5)](),await writeBffLockFile(_0x5a11f3[_0x3b20d4(0x1bf)],_0x1ff6f4);const _0x14be06=resolveLocalFilePathFromLockKey(_0x5a11f3,_0x16b757);let _0x2413f4;await fileExists(_0x14be06)&&(_0x2413f4=await moveToTrash(_0x5a11f3['projectRoot'],_0x5a11f3['trashDir'],_0x14be06),await cleanupEmptyDirectories(dirname(_0x14be06),_0x5a11f3['scriptsRootDir']));await waitForDeleteSettlement(_0x5a11f3[_0x3b20d4(0x1bf)],_0x4219fa[_0x3b20d4(0x1a3)],_0x16b757,_0x14be06),await sleep(0x96);const _0x31fd45={'deleted':_0x16b757,'remoteId':_0x322a7c[_0x3b20d4(0x19b)]};if(_0x2413f4)_0x31fd45[_0x3b20d4(0x1b0)]=_0x2413f4;return{'ok':!![],'data':_0x31fd45,'message':_0x3b20d4(0x199)+_0x16b757+(_0x2413f4?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function resolveDeleteTarget(_0x183bd6,_0x183159){const _0x1134ae=a37_0x19a8ee;if(_0x183bd6[_0x1134ae(0x1a8)]('/')){const _0x571602=_0x183159[_0x1134ae(0x194)](_0x227310=>_0x227310===_0x183bd6);if(!_0x571602)throw CliErrors[_0x1134ae(0x197)](_0x1134ae(0x1be)+_0x183bd6);return _0x571602;}const _0x598c7d=_0x183159[_0x1134ae(0x1bc)](_0x5cf874=>_0x5cf874[_0x1134ae(0x1b5)]('/')['at'](-0x1)===_0x183bd6);if(_0x598c7d[_0x1134ae(0x1aa)]===0x0)throw CliErrors[_0x1134ae(0x197)](_0x1134ae(0x1be)+_0x183bd6);if(_0x598c7d[_0x1134ae(0x1aa)]>0x1)throw CliErrors[_0x1134ae(0x197)]('Multiple\x20functions\x20match\x20\x22'+_0x183bd6+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0x598c7d[_0x1134ae(0x1ab)](_0x34c5a1=>_0x1134ae(0x195)+_0x34c5a1)[_0x1134ae(0x1bd)]('\x0a'));return _0x598c7d[0x0];}async function moveToTrash(_0x16e130,_0x79e936,_0x4c0e58){const _0xc6fdff=a37_0x19a8ee,_0x241841=new Date()[_0xc6fdff(0x1a5)]()[_0xc6fdff(0x1b1)](/[:.]/g,'-'),_0x4d1869=relative(_0x16e130,_0x4c0e58),_0x47c0e0=join(_0x79e936,_0x241841,_0x4d1869);return await mkdir(dirname(_0x47c0e0),{'recursive':!![]}),await rename(_0x4c0e58,_0x47c0e0),_0x47c0e0;}async function cleanupEmptyDirectories(_0x1b51a0,_0x5ebf02){const _0x1aed8a=a37_0x19a8ee;let _0x363532=resolve(_0x1b51a0);const _0x4f3cbc=resolve(_0x5ebf02);while(_0x363532['startsWith'](''+_0x4f3cbc+sep)||_0x363532===_0x4f3cbc){if(_0x363532===_0x4f3cbc)return;try{const _0x4e247c=await readdir(_0x363532);if(_0x4e247c[_0x1aed8a(0x1aa)]>0x0)return;await rmdir(_0x363532);}catch{return;}_0x363532=dirname(_0x363532);}}function a37_0xffd1(_0x4aa7da,_0x8dd333){_0x4aa7da=_0x4aa7da-0x190;const _0x9f9110=a37_0x9f91();let _0xffd17c=_0x9f9110[_0x4aa7da];return _0xffd17c;}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;function a37_0x9f91(){const _0x1c8599=['includes','194337ouMrTL','length','map','930zzAscL','No\x20lock\x20entry\x20found\x20for\x20\x22','bff','Local\x20delete\x20not\x20settled\x20for\x20','trashedTo','replace','<timestamp>','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','113103orKEeh','split','str','525226cWQTWY','126UhBLqP','420651AAQFts','apps','keys','filter','join','Function\x20not\x20found:\x20','lockFilePath','parse','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','5506995BMFJjr','delete','functions','POST','64QZdSfX','find','\x20\x20-\x20','237525mbSsCe','validation','projectRoot','Deleted\x20','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','remoteId','stringify','856VFPUMf','trashDir','lastSync','11162zuzDtT','target','scriptsRoot','appCode','564NCewag','toISOString','Would\x20delete\x20','307tVfusB'];a37_0x9f91=function(){return _0x1c8599;};return a37_0x9f91();}async function waitForDeleteSettlement(_0xd15bc,_0x4d6d28,_0x18fa54,_0x3da2c4){const _0x40da1b=a37_0x19a8ee;for(let _0x85f4c7=0x0;_0x85f4c7<DELETE_SETTLE_RETRY_COUNT;_0x85f4c7+=0x1){const _0xdf372b=await readBffLockFile(_0xd15bc),_0x30d34c=!!_0xdf372b?.[_0x40da1b(0x1ba)]?.[_0x4d6d28]?.[_0x40da1b(0x191)]?.[_0x18fa54],_0x1c9c5a=await fileExists(_0x3da2c4);if(!_0x30d34c&&!_0x1c9c5a)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x40da1b(0x1af)+_0x18fa54+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0x210064=a38_0x15c8;(function(_0x27ddc4,_0x400ca4){const _0x47fcbd=a38_0x15c8,_0x3feda7=_0x27ddc4();while(!![]){try{const _0xa851c8=-parseInt(_0x47fcbd(0x19b))/0x1*(-parseInt(_0x47fcbd(0x1a2))/0x2)+parseInt(_0x47fcbd(0x194))/0x3+-parseInt(_0x47fcbd(0x193))/0x4*(parseInt(_0x47fcbd(0x1a8))/0x5)+parseInt(_0x47fcbd(0x19e))/0x6*(-parseInt(_0x47fcbd(0x1a5))/0x7)+-parseInt(_0x47fcbd(0x190))/0x8*(parseInt(_0x47fcbd(0x1a7))/0x9)+-parseInt(_0x47fcbd(0x197))/0xa*(parseInt(_0x47fcbd(0x198))/0xb)+parseInt(_0x47fcbd(0x19d))/0xc;if(_0xa851c8===_0x400ca4)break;else _0x3feda7['push'](_0x3feda7['shift']());}catch(_0x321b5b){_0x3feda7['push'](_0x3feda7['shift']());}}}(a38_0x555a,0x2dd89));function a38_0x555a(){const _0x1351fe=['28rAZGQg','appCode','1719FzxLWt','5PeflBF','description','number','8616ZygTyV','updatedTime','read','1004324CKmZdI','168255CEzbNO','verbose','updateUserName','2184580RIKxKr','11jyYYYt','bool','functionName','106009zOQtzb','(none)','7931184Bwhkro','99006lvaEYi','bff','scriptType','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID','4BHsIZh','version','num'];a38_0x555a=function(){return _0x1351fe;};return a38_0x555a();}import{getBffScriptInfo}from'../../core/api-client.js';function a38_0x15c8(_0x39b57b,_0x310635){_0x39b57b=_0x39b57b-0x18e;const _0x555a06=a38_0x555a();let _0x15c8a3=_0x555a06[_0x39b57b];return _0x15c8a3;}export const bffDetail={'service':a38_0x210064(0x19f),'command':'detail','description':a38_0x210064(0x1a1),'risk':a38_0x210064(0x192),'flags':[{'name':'id','type':a38_0x210064(0x18f),'required':!![],'description':'Script\x20ID'},{'name':a38_0x210064(0x195),'type':'boolean','description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x3334e2){const _0x1a757a=a38_0x210064,_0x229398=await getBffScriptInfo(_0x3334e2[_0x1a757a(0x1a4)]('id')),_0x5b247d=_0x3334e2[_0x1a757a(0x199)](_0x1a757a(0x195));if(_0x5b247d)return{'ok':!![],'data':_0x229398};return{'ok':!![],'data':{'id':_0x229398['id'],'functionName':_0x229398[_0x1a757a(0x19a)]??'','version':_0x229398[_0x1a757a(0x1a3)]??'','updateUserName':_0x229398[_0x1a757a(0x196)]??'','appCode':_0x229398[_0x1a757a(0x1a6)],'scriptType':_0x229398[_0x1a757a(0x1a0)],'description':_0x229398[_0x1a757a(0x18e)]||_0x1a757a(0x19c),'createdTime':_0x229398['createdTime']??'','updatedTime':_0x229398[_0x1a757a(0x191)]??'','scriptContent':_0x229398['scriptContent']??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5ebe85,_0x4d404d){const _0x38bfb7=a39_0x4ac1,_0x5db265=_0x5ebe85();while(!![]){try{const _0x4fd44d=parseInt(_0x38bfb7(0x17d))/0x1*(-parseInt(_0x38bfb7(0x186))/0x2)+-parseInt(_0x38bfb7(0x187))/0x3*(parseInt(_0x38bfb7(0x183))/0x4)+-parseInt(_0x38bfb7(0x188))/0x5+-parseInt(_0x38bfb7(0x181))/0x6+parseInt(_0x38bfb7(0x17f))/0x7*(-parseInt(_0x38bfb7(0x184))/0x8)+parseInt(_0x38bfb7(0x185))/0x9*(-parseInt(_0x38bfb7(0x180))/0xa)+-parseInt(_0x38bfb7(0x17e))/0xb*(-parseInt(_0x38bfb7(0x182))/0xc);if(_0x4fd44d===_0x4d404d)break;else _0x5db265['push'](_0x5db265['shift']());}catch(_0x316781){_0x5db265['push'](_0x5db265['shift']());}}}(a39_0x4b13,0x8efe2));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';function a39_0x4ac1(_0x308098,_0x498f8d){_0x308098=_0x308098-0x17d;const _0x4b1325=a39_0x4b13();let _0x4ac195=_0x4b1325[_0x308098];return _0x4ac195;}import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';function a39_0x4b13(){const _0x3bead3=['49048VkzcXV','8wmROly','393696gkhPkD','22XJcnip','105QGscUA','3136425Igbqse','46303epuEQn','1129612IuBqRX','6486186xrdtZB','100kpefFH','1088328vztIXF','432egIhjs'];a39_0x4b13=function(){return _0x3bead3;};return a39_0x4b13();}export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a40_0xe602(_0xd15bbe,_0x9f8cbd){_0xd15bbe=_0xd15bbe-0xe5;const _0x3cf3df=a40_0x3cf3();let _0xe602d3=_0x3cf3df[_0xd15bbe];return _0xe602d3;}const a40_0x291ff8=a40_0xe602;(function(_0x5b2dc1,_0x3a6ef4){const _0x12f4bf=a40_0xe602,_0x1d890d=_0x5b2dc1();while(!![]){try{const _0x70c1e2=-parseInt(_0x12f4bf(0xfc))/0x1*(-parseInt(_0x12f4bf(0xea))/0x2)+-parseInt(_0x12f4bf(0xf7))/0x3+-parseInt(_0x12f4bf(0xed))/0x4+parseInt(_0x12f4bf(0xf0))/0x5+parseInt(_0x12f4bf(0xeb))/0x6*(parseInt(_0x12f4bf(0xe9))/0x7)+parseInt(_0x12f4bf(0xfb))/0x8+-parseInt(_0x12f4bf(0xf5))/0x9;if(_0x70c1e2===_0x3a6ef4)break;else _0x1d890d['push'](_0x1d890d['shift']());}catch(_0x5311cf){_0x1d890d['push'](_0x1d890d['shift']());}}}(a40_0x3cf3,0xa9378));function a40_0x3cf3(){const _0x35d255=['str','Return\x20full\x20script\x20objects','type','No\x20Backend\x20Function\x20scripts\x20found.','388843wSMrgi','60666uyeHrR','114XdsBAk','COMMON','3662204RccDsZ','length','name','4841255TEBdot','string','Filter\x20by\x20script\x20name','appCode','description','9316485TiYccb','Script\x20type\x20filter','1498215aKVPCn','read','verbose','bff','2647144ilZxrq','26LOoyas','functionName','list','map'];a40_0x3cf3=function(){return _0x35d255;};return a40_0x3cf3();}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':a40_0x291ff8(0xfa),'command':a40_0x291ff8(0xfe),'description':'List\x20Backend\x20Function\x20scripts','risk':a40_0x291ff8(0xf8),'flags':[{'name':a40_0x291ff8(0xe7),'type':a40_0x291ff8(0xf1),'description':a40_0x291ff8(0xf6),'default':'ENDPOINT','enum':['ENDPOINT',a40_0x291ff8(0xec)]},{'name':a40_0x291ff8(0xef),'type':a40_0x291ff8(0xf1),'description':a40_0x291ff8(0xf2)},{'name':a40_0x291ff8(0xf9),'type':'boolean','description':a40_0x291ff8(0xe6)}],async 'execute'(_0x1752c5){const _0x26b908=a40_0x291ff8,_0x3a6ef8=await listBffScripts(_0x1752c5[_0x26b908(0xf3)],_0x1752c5['str'](_0x26b908(0xe7)),{'scriptName':_0x1752c5[_0x26b908(0xe5)](_0x26b908(0xef))||undefined}),_0x18a693=_0x1752c5['bool'](_0x26b908(0xf9));return{'ok':!![],'data':_0x18a693?_0x3a6ef8:_0x3a6ef8[_0x26b908(0xff)](_0x165351=>({'id':_0x165351['id'],'functionName':_0x165351[_0x26b908(0xfd)]??'','description':_0x165351[_0x26b908(0xf4)]||'(unnamed)','scriptType':_0x165351['scriptType']})),'message':_0x3a6ef8[_0x26b908(0xee)]===0x0?_0x26b908(0xe8):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x750cdf=a41_0x54ba;(function(_0x187f1c,_0x3b7f90){const _0x58d3c3=a41_0x54ba,_0x431a33=_0x187f1c();while(!![]){try{const _0x3f4ec0=parseInt(_0x58d3c3(0xda))/0x1*(-parseInt(_0x58d3c3(0xaf))/0x2)+parseInt(_0x58d3c3(0xdb))/0x3*(-parseInt(_0x58d3c3(0xb1))/0x4)+-parseInt(_0x58d3c3(0xac))/0x5+-parseInt(_0x58d3c3(0xd7))/0x6*(-parseInt(_0x58d3c3(0xc5))/0x7)+-parseInt(_0x58d3c3(0xde))/0x8+-parseInt(_0x58d3c3(0xd4))/0x9*(-parseInt(_0x58d3c3(0xce))/0xa)+-parseInt(_0x58d3c3(0xad))/0xb*(-parseInt(_0x58d3c3(0xc6))/0xc);if(_0x3f4ec0===_0x3b7f90)break;else _0x431a33['push'](_0x431a33['shift']());}catch(_0x48e6b2){_0x431a33['push'](_0x431a33['shift']());}}}(a41_0x4e4e,0x20765));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=['DEBUG',a41_0x750cdf(0xbd),a41_0x750cdf(0xb8),a41_0x750cdf(0xcb)];export function resolveBffLogQuery(_0x2ab9e5,_0x3b4be4=Date['now']()){const _0x243d8f=a41_0x750cdf,_0x348301=_0x2ab9e5[_0x243d8f(0xd5)](_0x243d8f(0xd8)),_0x25dbff=_0x2ab9e5[_0x243d8f(0xd5)](_0x243d8f(0xd6)),_0x5dc274=_0x2ab9e5[_0x243d8f(0xd5)](_0x243d8f(0xdd));if(_0x348301!==undefined&&_0x25dbff!==undefined)throw CliErrors[_0x243d8f(0xcc)](_0x243d8f(0xbf));const _0x30fe2b=_0x5dc274===undefined?_0x3b4be4:readPositiveInteger(_0x2ab9e5[_0x243d8f(0xcd)](_0x243d8f(0xdd)),_0x243d8f(0xbe)),_0x249bad=_0x25dbff===undefined?_0x30fe2b-readSinceMinutes(_0x2ab9e5)*0xea60:readPositiveInteger(_0x2ab9e5['num']('start-time'),_0x243d8f(0xb5));if(_0x249bad<=0x0)throw CliErrors[_0x243d8f(0xcc)](_0x243d8f(0xc0));if(_0x249bad>_0x30fe2b)throw CliErrors[_0x243d8f(0xcc)](_0x243d8f(0xd0));const _0x22b05c=readPositiveInteger(_0x2ab9e5[_0x243d8f(0xcd)](_0x243d8f(0xc9),DEFAULT_LIMIT),'--limit');if(_0x22b05c>MAX_LIMIT)throw CliErrors[_0x243d8f(0xcc)](_0x243d8f(0xc2)+MAX_LIMIT+'.');const _0x2569b7=_0x2ab9e5[_0x243d8f(0xc1)](_0x243d8f(0xc4))['trim']()[_0x243d8f(0xb9)]()||undefined,_0x35ca89=_0x2ab9e5[_0x243d8f(0xc1)]('keyword')[_0x243d8f(0xd1)]()||undefined;return{'appCode':_0x2ab9e5[_0x243d8f(0xd9)],'startTime':_0x249bad,'endTime':_0x30fe2b,..._0x25dbff===undefined?{'sinceMinutes':readSinceMinutes(_0x2ab9e5)}:{},..._0x2569b7?{'level':_0x2569b7}:{},..._0x35ca89?{'keyword':_0x35ca89}:{},'limit':_0x22b05c};}function readSinceMinutes(_0x49779e){const _0x2cced2=a41_0x750cdf;return readPositiveInteger(_0x49779e[_0x2cced2(0xcd)](_0x2cced2(0xd8),DEFAULT_SINCE_MINUTES),_0x2cced2(0xc3));}function readPositiveInteger(_0x5a27fd,_0x18a551){const _0x5dd34a=a41_0x750cdf;if(!Number[_0x5dd34a(0xb0)](_0x5a27fd)||_0x5a27fd<=0x0)throw CliErrors['validation'](_0x18a551+_0x5dd34a(0xb2));return _0x5a27fd;}function a41_0x54ba(_0x3e22e0,_0x227358){_0x3e22e0=_0x3e22e0-0xac;const _0x4e4e68=a41_0x4e4e();let _0x54baf7=_0x4e4e68[_0x3e22e0];return _0x54baf7;}export const bffLogs={'service':a41_0x750cdf(0xbc),'command':a41_0x750cdf(0xb7),'description':a41_0x750cdf(0xba),'risk':a41_0x750cdf(0xd2),'structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a41_0x750cdf(0xd8),'type':a41_0x750cdf(0xc8),'description':a41_0x750cdf(0xc7)+DEFAULT_SINCE_MINUTES+')'},{'name':a41_0x750cdf(0xd6),'type':a41_0x750cdf(0xc8),'description':a41_0x750cdf(0xb6)},{'name':a41_0x750cdf(0xdd),'type':a41_0x750cdf(0xc8),'description':a41_0x750cdf(0xcf)},{'name':a41_0x750cdf(0xc4),'type':a41_0x750cdf(0xb3),'description':a41_0x750cdf(0xbb),'enum':LOG_LEVELS},{'name':'keyword','type':a41_0x750cdf(0xb3),'description':a41_0x750cdf(0xb4)},{'name':a41_0x750cdf(0xc9),'type':a41_0x750cdf(0xc8),'description':'Maximum\x20log\x20lines\x20to\x20return\x20(1-'+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x4366f5){resolveBffLogQuery(_0x4366f5);},async 'execute'(_0x20df27){const _0x5a9843=a41_0x750cdf,_0x23e8ad=resolveBffLogQuery(_0x20df27),{sinceMinutes:_0x4cdd15,..._0x46e7ea}=_0x23e8ad,_0xd6ae24=await searchBffScriptLogs(_0x46e7ea);return{'ok':!![],'data':{'query':_0x23e8ad,'count':_0xd6ae24['length'],'logs':_0xd6ae24},'message':_0xd6ae24[_0x5a9843(0xca)]===0x0?_0x5a9843(0xdc):_0x5a9843(0xd3)+_0xd6ae24[_0x5a9843(0xca)]+_0x5a9843(0xae)};}};function a41_0x4e4e(){const _0x3562f8=['--start-time','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','logs','WARN','toUpperCase','Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','Filter\x20by\x20log\x20level','bff','INFO','--end-time','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','str','--limit\x20must\x20be\x20between\x201\x20and\x20','--since','level','1351021iVgchp','1448820rMOdfJ','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','number','limit','length','ERROR','validation','num','590nZpQGQ','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','trim','read','Found\x20','37026ienQYh','flag','start-time','6kqCSvg','since','appCode','384qFtayh','4773takdgN','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','end-time','724968laPrzj','728245MxXVRC','11SllLDi','\x20Backend\x20Function\x20log\x20line(s).','884otEHqB','isSafeInteger','44yaadmp','\x20must\x20be\x20a\x20positive\x20integer.','string','Filter\x20formatted\x20log\x20lines\x20by\x20keyword'];a41_0x4e4e=function(){return _0x3562f8;};return a41_0x4e4e();}
|
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_0x4d1eea=a42_0x38c0;(function(_0x130fd0,_0x40f3a5){const _0x51188c=a42_0x38c0,_0x308c47=_0x130fd0();while(!![]){try{const _0x7d2b72=-parseInt(_0x51188c(0x188))/0x1+-parseInt(_0x51188c(0x128))/0x2+-parseInt(_0x51188c(0x18d))/0x3+parseInt(_0x51188c(0x12b))/0x4*(-parseInt(_0x51188c(0x147))/0x5)+parseInt(_0x51188c(0x1a5))/0x6*(parseInt(_0x51188c(0x1a2))/0x7)+parseInt(_0x51188c(0x1af))/0x8+parseInt(_0x51188c(0x132))/0x9;if(_0x7d2b72===_0x40f3a5)break;else _0x308c47['push'](_0x308c47['shift']());}catch(_0xacd6c6){_0x308c47['push'](_0x308c47['shift']());}}}(a42_0x4ea7,0xba3af));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';function a42_0x38c0(_0x2608ee,_0x1ee54f){_0x2608ee=_0x2608ee-0x11d;const _0x4ea78d=a42_0x4ea7();let _0x38c03d=_0x4ea78d[_0x2608ee];return _0x38c03d;}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';function a42_0x4ea7(){const _0x253d80=['4002456rkUYlT','cancelled','toISOString','sourceDirectoryPathByNewDirectory','unresolvable\x20target\x20path','\x22\x20and\x20\x22','close','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','type','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','requires','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','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.','hookLocation','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','886620gOeXDJ','has','\x22\x20from\x20the\x20lock\x20file.','1528BFtgsT','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','keyChanges','force','\x22\x20may\x20remain.','some','string','36292365JePkXI','apiDir','normalize','entry','newDirectoryPath','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','mergedCli','oldDirectory','/api/management/library/scripts/list?appCode=','.js','GET','profileName','functions','functionName','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','&type=','scriptType','HOOK/','scriptContent','BFF_LOCAL_UNSYNCED','19695jWWCcr','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','nonInteractive','Pull\x20only\x20this\x20script\x20type','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','\x22\x20from\x20\x22','functionNode','validation','includes','NFC','migrations','lastSync','lockFilePath','conflict','scriptsRootDir','appCode','\x22:\x20its\x20target\x20\x22','split','pull','newLockKey','code','\x22:\x20','str','oldDirectoryPath','stdin','\x20--format\x20compress','filePath','dev','rekey','Failed\x20to\x20write\x20local\x20script\x20\x22','defaultApp','\x20--name\x20','\x20Recovery\x20errors:\x20','write','Would\x20inspect\x20','trim','Pull\x20complete:\x20','\x20resolution','question','boolean','ino','would_pull','utf8','apps','version','lockKey','flatMap','datasetCode','projectedFunctions','bool','ENOENT','sourceFilePathByNewLockKey','skipped','stringify','message','length','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','selectedAppName','operationType','push','\x22:\x20both\x20target\x20\x22','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','map','scriptsRoot','HOOK','872604YLQRHJ','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','reverse','set','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','4235265yrprYu','remoteId','join','.hook-directory-migrate-','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22','\x20conflict','oldLockKey','yes','Force\x20pull\x20cancelled.','hash','alias','newDirectory','move','values','get','rollback','existed','require','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','toLowerCase','\x20skipped','1618309njxiNP','Force\x20overwrite\x20local\x20unsynced\x20changes','mode','12Vfqzpq','content','stderr','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','Could\x20not\x20restore\x20local\x20script\x20\x22','all','case-rename','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','\x22\x20to\x20\x22','currentApp'];a42_0x4ea7=function(){return _0x253d80;};return a42_0x4ea7();}import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':'pull','description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':'read','structuredErrors':!![],'flags':[{'name':'type','type':a42_0x4d1eea(0x131),'description':a42_0x4d1eea(0x14a),'enum':['COMMON','ENDPOINT',a42_0x4d1eea(0x187)]},{'name':a42_0x4d1eea(0x12e),'type':a42_0x4d1eea(0x16e),'description':a42_0x4d1eea(0x1a3)}],async 'dryRun'(_0x30f94a){const _0x7d048d=a42_0x4d1eea,_0x42f47a=loadBffProjectConfig(_0x30f94a[_0x7d048d(0x156)]),_0x2abfb0=await readBffLockFile(_0x42f47a['lockFilePath']),{appLock:_0xefcfdb}=ensureLockScope(_0x2abfb0??createEmptyBffLock(),_0x30f94a[_0x7d048d(0x156)],_0x42f47a[_0x7d048d(0x186)],_0x7d048d(0x159)),_0x49ba03=normalizeBffType(_0x30f94a[_0x7d048d(0x15d)](_0x7d048d(0x121)))??undefined,[_0x2dd506,_0x2b9dd7]=await Promise[_0x7d048d(0x1aa)]([listBffScripts(_0x30f94a[_0x7d048d(0x156)],_0x49ba03),getBffScriptStatistics(_0x30f94a[_0x7d048d(0x156)])]),_0x4be308=_0x2dd506[_0x7d048d(0x130)](_0x7e25ff=>normalizeBffType(_0x7e25ff[_0x7d048d(0x143)])===_0x7d048d(0x187)),_0x2b958d=_0x4be308?buildDatasetCodeToAliasMap(_0x30f94a['apiDir'],_0x30f94a[_0x7d048d(0x156)],_0x30f94a[_0x7d048d(0x180)]||_0x30f94a[_0x7d048d(0x138)]?.[_0x7d048d(0x1ae)]||_0x30f94a[_0x7d048d(0x138)]?.[_0x7d048d(0x165)]):new Map(),_0x14e44e=_0x4be308?await planHookDirectoryMigration(_0x42f47a,_0xefcfdb,_0x2b958d,await scanLocalBffFunctions(_0x42f47a,'HOOK')):undefined,_0x5b6d28=createHookLocationMap(_0x2b9dd7),_0x2b47db=[];for(const _0x6ebd1 of _0x2dd506){const _0x244490=resolveRemoteScriptTarget(_0x42f47a,_0x6ebd1,_0x5b6d28,_0x14e44e?.[_0x7d048d(0x177)]??_0xefcfdb[_0x7d048d(0x13e)],_0x2b958d);if(!_0x244490){_0x2b47db[_0x7d048d(0x182)]({'scriptType':_0x6ebd1[_0x7d048d(0x143)],'functionName':_0x6ebd1['functionName']??'','status':_0x7d048d(0x17b),'reason':_0x7d048d(0x11d)});continue;}const _0x243de0=(_0x14e44e?.['projectedFunctions']??_0xefcfdb[_0x7d048d(0x13e)])[_0x244490[_0x7d048d(0x174)]],_0x5c3216=_0x6ebd1['scriptContent']!=null?computeContentHash(_0x6ebd1[_0x7d048d(0x145)]):undefined,_0x45e9f6=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x14e44e,_0x244490)??_0x244490['filePath'],_0x243de0,_0x5c3216),_0x5cc655=_0x45e9f6?localUnsyncedConflict(_0x244490,_0x6ebd1['id']):undefined;_0x2b47db[_0x7d048d(0x182)]({'lockKey':_0x244490['lockKey'],'filePath':_0x244490[_0x7d048d(0x161)],'remoteId':_0x6ebd1['id']??null,'status':_0x5cc655?_0x7d048d(0x154):_0x7d048d(0x170),..._0x5cc655?{'conflict':_0x5cc655}:{},..._0x244490[_0x7d048d(0x126)]?{'alias':_0x244490[_0x7d048d(0x126)][_0x7d048d(0x197)]??null,'datasetCode':_0x244490['hookLocation']['datasetCode'],'operationType':_0x244490['hookLocation']['operationType'],'functionNode':_0x244490[_0x7d048d(0x126)][_0x7d048d(0x14d)]}:{}});}return{'method':_0x7d048d(0x13c),'url':_0x7d048d(0x13a)+_0x30f94a['appCode']+(_0x49ba03?_0x7d048d(0x142)+_0x49ba03:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x30f94a[_0x7d048d(0x156)],'filterType':_0x49ba03??null,..._0x14e44e&&_0x14e44e[_0x7d048d(0x151)][_0x7d048d(0x17e)]>0x0?{'hookDirectoryMigrations':_0x14e44e[_0x7d048d(0x151)][_0x7d048d(0x185)](_0x1e7854=>({'from':_0x1e7854[_0x7d048d(0x139)],'to':_0x1e7854[_0x7d048d(0x198)]}))}:{},'files':_0x2b47db},'description':_0x7d048d(0x169)+_0x2b47db[_0x7d048d(0x17e)]+_0x7d048d(0x19f)};},async 'execute'(_0x440473){const _0x16432b=a42_0x4d1eea,_0x386e0e=loadBffProjectConfig(_0x440473[_0x16432b(0x156)]),_0x2fa8dc=await readBffLockFile(_0x386e0e['lockFilePath']),{lockData:_0x21257b,appLock:_0x643d2c}=ensureLockScope(_0x2fa8dc??createEmptyBffLock(),_0x440473[_0x16432b(0x156)],_0x386e0e[_0x16432b(0x186)],_0x16432b(0x159)),_0x4e3a6f=normalizeBffType(_0x440473[_0x16432b(0x15d)]('type'))??undefined;if(_0x440473[_0x16432b(0x15d)](_0x16432b(0x121))&&!_0x4e3a6f)throw CliErrors[_0x16432b(0x14e)](_0x16432b(0x127));const [_0x534f01,_0x12d4c7]=await Promise[_0x16432b(0x1aa)]([listBffScripts(_0x440473[_0x16432b(0x156)],_0x4e3a6f),getBffScriptStatistics(_0x440473[_0x16432b(0x156)])]);if(_0x534f01['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':'No\x20remote\x20Backend\x20Function\x20scripts\x20found.'};const _0x4c667b=_0x440473[_0x16432b(0x178)](_0x16432b(0x12e));if(_0x4c667b&&!_0x440473[_0x16432b(0x149)]){const _0x18d38e=await confirmForce();if(!_0x18d38e)throw CliErrors[_0x16432b(0x1b0)](_0x16432b(0x195));}if(_0x4c667b&&_0x440473[_0x16432b(0x149)]){}const _0x9f3c4b=_0x534f01[_0x16432b(0x130)](_0x51b5e6=>normalizeBffType(_0x51b5e6[_0x16432b(0x143)])===_0x16432b(0x187)),_0x32d6f3=_0x9f3c4b?buildDatasetCodeToAliasMap(_0x440473[_0x16432b(0x133)],_0x440473['appCode'],_0x440473[_0x16432b(0x180)]||_0x440473['mergedCli']?.[_0x16432b(0x1ae)]||_0x440473['mergedCli']?.[_0x16432b(0x165)]):new Map(),_0xc81211=createHookLocationMap(_0x12d4c7),_0x220234=JSON['parse'](JSON[_0x16432b(0x17c)](_0x21257b)),_0x5b1512=_0x440473[_0x16432b(0x156)],_0x5e6e13=_0x220234[_0x16432b(0x172)][_0x5b1512];if(!_0x5e6e13)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x5b1512+'\x22\x20not\x20found\x20after\x20ensureLockScope.');const _0x425cf0=_0x9f3c4b?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x386e0e,_0x5e6e13,_0x32d6f3,await scanLocalBffFunctions(_0x386e0e,_0x16432b(0x187))),_0x5e6e13):undefined,_0x16ce62=createPullFileTransaction(),_0xc49731=[],_0x4c633c=[],_0xc6945d=[],_0x30849f=[];for(const _0x3bd3c3 of _0x534f01){const _0x375df8=resolveRemoteScriptTarget(_0x386e0e,_0x3bd3c3,_0xc81211,_0x5e6e13[_0x16432b(0x13e)],_0x32d6f3);if(!_0x375df8){_0x4c633c['push']({'lockKey':_0x3bd3c3[_0x16432b(0x143)]+'/'+_0x3bd3c3[_0x16432b(0x13f)],'reason':'unresolvable\x20target\x20path'});continue;}const _0x283f85=_0x5e6e13[_0x16432b(0x13e)][_0x375df8[_0x16432b(0x174)]];try{if(!_0x3bd3c3['id'])throw new Error('Remote\x20script\x20missing\x20id.');if(_0x3bd3c3[_0x16432b(0x145)]==null)throw new Error('Remote\x20script\x20missing\x20content.');const _0x9fa8f=_0x3bd3c3[_0x16432b(0x145)],_0x33c501=computeContentHash(_0x9fa8f);if(!_0x4c667b){const _0x207ff1=await hasUnsyncedLocalChanges(_0x375df8[_0x16432b(0x161)],_0x283f85,_0x33c501);if(_0x207ff1){_0xc6945d[_0x16432b(0x182)](localUnsyncedConflict(_0x375df8,_0x3bd3c3['id']));continue;}}await _0x16ce62[_0x16432b(0x168)](_0x375df8[_0x16432b(0x161)],_0x9fa8f);const _0x117355={'hash':_0x33c501,'remoteId':_0x3bd3c3['id'],'version':_0x3bd3c3[_0x16432b(0x173)]};_0x375df8[_0x16432b(0x121)]===_0x16432b(0x187)&&_0x375df8[_0x16432b(0x126)]&&(_0x117355[_0x16432b(0x197)]=_0x375df8[_0x16432b(0x126)]['alias'],_0x117355[_0x16432b(0x176)]=_0x375df8[_0x16432b(0x126)][_0x16432b(0x176)],_0x117355['operationType']=_0x375df8[_0x16432b(0x126)][_0x16432b(0x181)],_0x117355['functionNode']=_0x375df8[_0x16432b(0x126)][_0x16432b(0x14d)]),_0x5e6e13['functions'][_0x375df8[_0x16432b(0x174)]]=_0x117355,_0xc49731[_0x16432b(0x182)]({'lockKey':_0x375df8[_0x16432b(0x174)],'remoteId':_0x3bd3c3['id']});}catch(_0x44bfa9){_0x30849f[_0x16432b(0x182)]({'lockKey':_0x375df8['lockKey'],'error':_0x44bfa9 instanceof Error?_0x44bfa9[_0x16432b(0x17d)]:String(_0x44bfa9)});}}_0x5e6e13['lastSync']=new Date()[_0x16432b(0x1b1)]();try{await writeBffLockFile(_0x386e0e[_0x16432b(0x153)],_0x220234);}catch(_0x3e0d66){const _0x243043=[...await _0x16ce62[_0x16432b(0x19c)](),...await _0x425cf0?.['rollback']()??[]];throw withRollbackErrors(_0x3e0d66,'Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0x243043);}return{'ok':_0x30849f[_0x16432b(0x17e)]===0x0,'data':{'pulled':_0xc49731,'skipped':_0x4c633c,'conflicts':_0xc6945d,'failed':_0x30849f},'message':formatPullMessage(_0xc49731[_0x16432b(0x17e)],_0x4c633c[_0x16432b(0x17e)],_0xc6945d[_0x16432b(0x17e)],_0x30849f[_0x16432b(0x17e)])};}};function localUnsyncedConflict(_0x52dbb5,_0x449e16){const _0x29e72d=a42_0x4d1eea,_0x3f5c9a=_0x52dbb5[_0x29e72d(0x174)]['split']('/')['at'](-0x1);return{'code':_0x29e72d(0x146),'lockKey':_0x52dbb5['lockKey'],'filePath':_0x52dbb5[_0x29e72d(0x161)],..._0x449e16!=null?{'remoteId':_0x449e16}:{},'message':_0x29e72d(0x120),'nextAction':{'action':'push_local','command':CLI_BIN_NAME+'\x20bff\x20push\x20--type\x20'+_0x52dbb5[_0x29e72d(0x121)]+_0x29e72d(0x166)+_0x3f5c9a+_0x29e72d(0x160),'requiresReview':!![],'message':_0x29e72d(0x125)}};}function formatPullMessage(_0x57b14,_0x35099e,_0x401817,_0xf06cbe){const _0x2b331e=a42_0x4d1eea,_0x519757=[_0x2b331e(0x16b)+_0x57b14+'\x20pulled',_0x35099e+_0x2b331e(0x1a1)];_0x401817>0x0&&_0x519757['push'](_0x401817+_0x2b331e(0x192)+(_0x401817===0x1?'':'s')+'\x20'+(_0x401817===0x1?_0x2b331e(0x123):_0x2b331e(0x19e))+_0x2b331e(0x16c));if(_0xf06cbe>0x0)_0x519757[_0x2b331e(0x182)](_0xf06cbe+'\x20failed');return _0x519757['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x4f6b35,_0x22d0d8,_0x52c048){const _0x2cd920=a42_0x4d1eea;if(!await fileExists(_0x4f6b35))return![];const _0x90201d=await computeFileHash(_0x4f6b35);if(!_0x22d0d8)return _0x52c048?_0x90201d!==_0x52c048:!![];return _0x90201d!==_0x22d0d8[_0x2cd920(0x196)];}function createPullFileTransaction(){const _0xbece07=new Map(),_0x4d35a8=async(_0x3484b4,_0x5c5ff4)=>{const _0x235586=a42_0x38c0;try{if(_0x5c5ff4[_0x235586(0x19d)])await ensureParentDirectory(_0x3484b4),await writeFile(_0x3484b4,_0x5c5ff4[_0x235586(0x1a6)]);else try{await unlink(_0x3484b4);}catch(_0x557731){if(_0x557731[_0x235586(0x15b)]!==_0x235586(0x179))throw _0x557731;}return undefined;}catch(_0x34bf90){return _0x34bf90 instanceof Error?_0x34bf90:new Error(String(_0x34bf90));}};return{async 'write'(_0xe0e2ed,_0x283c3e){const _0x451002=a42_0x38c0;if(!_0xbece07[_0x451002(0x129)](_0xe0e2ed))try{_0xbece07['set'](_0xe0e2ed,{'existed':!![],'content':await readFile(_0xe0e2ed)});}catch(_0x2b8a22){if(_0x2b8a22[_0x451002(0x15b)]!==_0x451002(0x179))throw _0x2b8a22;_0xbece07[_0x451002(0x18b)](_0xe0e2ed,{'existed':![]});}try{await ensureParentDirectory(_0xe0e2ed),await writeFile(_0xe0e2ed,_0x283c3e,_0x451002(0x171));}catch(_0x4fd834){const _0x650410=await _0x4d35a8(_0xe0e2ed,_0xbece07['get'](_0xe0e2ed));if(!_0x650410)_0xbece07['delete'](_0xe0e2ed);throw withRollbackErrors(_0x4fd834,_0x451002(0x164)+_0xe0e2ed+'\x22.',_0x650410?[_0x650410]:[]);}},async 'rollback'(){const _0x108ce2=a42_0x38c0,_0x49622f=[];for(const [_0x10067c,_0x1ab9c5]of[..._0xbece07['entries']()][_0x108ce2(0x18a)]()){const _0x179ce2=await _0x4d35a8(_0x10067c,_0x1ab9c5);_0x179ce2&&_0x49622f[_0x108ce2(0x182)](new Error(_0x108ce2(0x1a9)+_0x10067c+'\x22:\x20'+_0x179ce2[_0x108ce2(0x17d)]));}return _0x49622f;}};}function withRollbackErrors(_0x1016ff,_0xfde594,_0x539dfd){const _0xadd50e=a42_0x4d1eea,_0xd5b9d5=_0x1016ff instanceof Error?_0x1016ff:new Error(String(_0x1016ff));if(_0x539dfd[_0xadd50e(0x17e)]===0x0)return _0xd5b9d5;return new AggregateError([_0xd5b9d5,..._0x539dfd],_0xfde594+_0xadd50e(0x167)+_0x539dfd['map'](_0x2e7d78=>_0x2e7d78[_0xadd50e(0x17d)])[_0xadd50e(0x18f)](';\x20'));}function buildDatasetCodeToAliasMap(_0x5ae7bd,_0x2b8de1,_0x586075){const _0x4a95d7=a42_0x4d1eea,_0x1ee47a=resolveApiModelSource(_0x5ae7bd,_0x2b8de1,_0x586075),_0x3dd84b=loadAliasMap(_0x5ae7bd,undefined,_0x1ee47a['filePath'],_0x1ee47a[_0x4a95d7(0x13d)]);return assertUnambiguousHookAliases(_0x3dd84b),new Map(_0x3dd84b[_0x4a95d7(0x185)](_0x4ee065=>[_0x4ee065[_0x4a95d7(0x176)][_0x4a95d7(0x1a0)](),_0x4ee065[_0x4a95d7(0x197)]]));}async function planHookDirectoryMigration(_0x2b61b8,_0x6877bc,_0x44ac1f,_0x4320c1){const _0x1414b3=a42_0x4d1eea,_0x36d21c=new Map();for(const [_0x3d1185,_0x3f9295]of Object['entries'](_0x6877bc[_0x1414b3(0x13e)])){const [_0x5d0aab,_0x246929,_0x8126dd,_0x461d3d,_0x1fc0c8,..._0x4e36d1]=_0x3d1185[_0x1414b3(0x158)]('/');if(_0x5d0aab!==_0x1414b3(0x187)||!_0x246929||!_0x8126dd||!_0x461d3d||!_0x1fc0c8||_0x4e36d1['length']>0x0||!_0x3f9295[_0x1414b3(0x176)])continue;const _0x210d7e=_0x44ac1f[_0x1414b3(0x19b)](_0x3f9295[_0x1414b3(0x176)][_0x1414b3(0x1a0)]()),_0x392c31=_0x210d7e??_0x3f9295[_0x1414b3(0x176)];if(!isSafeHookDirectorySegment(_0x246929))throw CliErrors['validation']('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x246929+_0x1414b3(0x12a));if(!isSafeHookDirectorySegment(_0x392c31))throw CliErrors[_0x1414b3(0x14e)](_0x1414b3(0x1a8)+_0x246929+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x246929===_0x392c31)continue;const _0x12f4f9=_0x36d21c[_0x1414b3(0x19b)](_0x246929)??{'datasetCode':_0x3f9295['datasetCode'],'alias':_0x210d7e,'keyChanges':[]};if(_0x12f4f9['datasetCode']!==_0x3f9295[_0x1414b3(0x176)])throw CliErrors['validation'](_0x1414b3(0x1a8)+_0x246929+_0x1414b3(0x18c));const _0x58f818=_0x1414b3(0x144)+_0x392c31+'/'+_0x8126dd+'/'+_0x461d3d+'/'+_0x1fc0c8;try{resolveLocalFilePathFromLockKey(_0x2b61b8,_0x3d1185),resolveLocalFilePathFromLockKey(_0x2b61b8,_0x58f818);}catch(_0x4beae8){throw CliErrors[_0x1414b3(0x14e)](_0x1414b3(0x191)+_0x3d1185+_0x1414b3(0x15c)+(_0x4beae8 instanceof Error?_0x4beae8[_0x1414b3(0x17d)]:String(_0x4beae8)));}_0x12f4f9[_0x1414b3(0x12d)][_0x1414b3(0x182)]({'oldLockKey':_0x3d1185,'newLockKey':_0x58f818,'entry':_0x3f9295}),_0x36d21c['set'](_0x246929,_0x12f4f9);}const _0x26e6c2=new Set([..._0x36d21c[_0x1414b3(0x19a)]()][_0x1414b3(0x175)](_0x2b7c07=>_0x2b7c07[_0x1414b3(0x12d)][_0x1414b3(0x185)](_0x2443ab=>_0x2443ab[_0x1414b3(0x193)]))),_0x7ab528=new Map(),_0x5130af=new Map();for(const [_0x8470f1,_0x304cb9]of _0x36d21c){const _0x20547f=_0x304cb9['alias']??_0x304cb9[_0x1414b3(0x176)],_0x2fc93b=hookDirectoryIdentity(_0x20547f),_0x2a63db=_0x7ab528[_0x1414b3(0x19b)](_0x2fc93b);if(_0x2a63db&&_0x2a63db!==_0x8470f1)throw CliErrors[_0x1414b3(0x14e)](_0x1414b3(0x184)+_0x2a63db+_0x1414b3(0x11e)+_0x8470f1+_0x1414b3(0x183)+_0x20547f+_0x1414b3(0x137));_0x7ab528[_0x1414b3(0x18b)](_0x2fc93b,_0x8470f1);for(const _0x210560 of _0x304cb9['keyChanges']){const _0x56a7ef=_0x5130af[_0x1414b3(0x19b)](_0x210560[_0x1414b3(0x15a)]);if(_0x56a7ef&&_0x56a7ef!==_0x210560[_0x1414b3(0x193)])throw CliErrors[_0x1414b3(0x14e)](_0x1414b3(0x1ac)+_0x56a7ef+'\x22\x20and\x20\x22'+_0x210560['oldLockKey']+_0x1414b3(0x183)+_0x210560['newLockKey']+'\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');if(_0x26e6c2[_0x1414b3(0x129)](_0x210560['newLockKey']))throw CliErrors[_0x1414b3(0x14e)]('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x210560[_0x1414b3(0x193)]+_0x1414b3(0x157)+_0x210560[_0x1414b3(0x15a)]+_0x1414b3(0x140));_0x5130af[_0x1414b3(0x18b)](_0x210560['newLockKey'],_0x210560[_0x1414b3(0x193)]);}}const _0x1cda6b=new Map();for(const [_0x158b41,_0x531f61]of _0x44ac1f){_0x1cda6b[_0x1414b3(0x18b)](hookDirectoryIdentity(_0x531f61),_0x158b41);}const _0x3b4def=[];for(const [_0x589f47,_0x176e25]of _0x36d21c){const _0x275d66=_0x176e25['alias']??_0x176e25['datasetCode'],_0x5baec3=join(_0x2b61b8[_0x1414b3(0x155)],_0x1414b3(0x187),_0x589f47),_0x671340=join(_0x2b61b8[_0x1414b3(0x155)],_0x1414b3(0x187),_0x275d66),_0x2b589f=await directoryExists(_0x5baec3),_0x41289b=await directoryExists(_0x671340),_0x13da6f=_0x2b589f?_0x41289b?await sameDirectory(_0x5baec3,_0x671340)?_0x1414b3(0x1ab):undefined:_0x1414b3(0x199):_0x1414b3(0x163);if(!_0x13da6f)throw CliErrors[_0x1414b3(0x14e)](_0x1414b3(0x1a8)+_0x589f47+_0x1414b3(0x1ad)+_0x275d66+_0x1414b3(0x141));const _0x58facc=_0x1cda6b[_0x1414b3(0x19b)](hookDirectoryIdentity(_0x589f47));if(_0x58facc&&_0x58facc!==_0x176e25['datasetCode'][_0x1414b3(0x1a0)]()){const _0x4ccd0b=new Set(_0x176e25[_0x1414b3(0x12d)][_0x1414b3(0x185)](_0x18f49f=>_0x18f49f['oldLockKey'])),_0x254b91=_0x4320c1['filter'](_0x33dc95=>_0x33dc95[_0x1414b3(0x121)]==='HOOK'&&_0x33dc95['alias']!=null&&hookDirectoryIdentity(_0x33dc95['alias'])===hookDirectoryIdentity(_0x589f47)&&!_0x4ccd0b['has'](_0x33dc95[_0x1414b3(0x174)]));if(_0x254b91[_0x1414b3(0x17e)]>0x0)throw CliErrors[_0x1414b3(0x14e)]('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x589f47+'\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');}const _0x32597a=_0x1cda6b[_0x1414b3(0x19b)](hookDirectoryIdentity(_0x275d66));if(_0x32597a&&_0x32597a!==_0x176e25[_0x1414b3(0x176)]['toLowerCase']())throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20directory\x20\x22'+_0x589f47+_0x1414b3(0x1ad)+_0x275d66+_0x1414b3(0x124));for(const _0x594311 of _0x176e25['keyChanges']){const _0x36e7ef=_0x6877bc[_0x1414b3(0x13e)][_0x594311['newLockKey']];if(_0x36e7ef&&!_0x26e6c2[_0x1414b3(0x129)](_0x594311[_0x1414b3(0x15a)])&&!sameHookIdentity(_0x594311['entry'],_0x36e7ef))throw CliErrors['validation'](_0x1414b3(0x1a8)+_0x589f47+_0x1414b3(0x1ad)+_0x275d66+_0x1414b3(0x189));}_0x3b4def['push']({'oldDirectory':_0x589f47,'newDirectory':_0x275d66,'oldDirectoryPath':_0x5baec3,'newDirectoryPath':_0x671340,'mode':_0x13da6f,'alias':_0x176e25[_0x1414b3(0x197)],'keyChanges':_0x176e25[_0x1414b3(0x12d)]});}const _0x182882={..._0x6877bc['functions']},_0x1acf28=new Map(),_0x3653b2=new Map();for(const _0x464dac of _0x3b4def){const _0x377c15=_0x464dac[_0x1414b3(0x1a4)]!==_0x1414b3(0x163);_0x377c15&&_0x3653b2[_0x1414b3(0x18b)](hookDirectoryIdentity(_0x464dac['newDirectory']),_0x464dac['oldDirectoryPath']);for(const _0xbf803 of _0x464dac[_0x1414b3(0x12d)]){const _0x5b948b=_0x182882[_0xbf803[_0x1414b3(0x15a)]],_0x878a07=_0x377c15?_0xbf803[_0x1414b3(0x135)]:_0x5b948b??_0xbf803['entry'];_0x182882[_0xbf803[_0x1414b3(0x15a)]]=canonicalizeHookEntry(_0x878a07,_0x464dac[_0x1414b3(0x197)]),delete _0x182882[_0xbf803[_0x1414b3(0x193)]],_0x377c15&&_0x1acf28[_0x1414b3(0x18b)](_0xbf803[_0x1414b3(0x15a)],resolveLocalFilePathFromLockKey(_0x2b61b8,_0xbf803['oldLockKey']));}}return{'migrations':_0x3b4def,'projectedFunctions':_0x182882,'sourceFilePathByNewLockKey':_0x1acf28,'sourceDirectoryPathByNewDirectory':_0x3653b2};}function resolveMigratedSourceFilePath(_0x3763ec,_0x2f9a4d){const _0x5626f7=a42_0x4d1eea;if(!_0x3763ec||!_0x2f9a4d)return undefined;const _0x166893=_0x3763ec[_0x5626f7(0x17a)][_0x5626f7(0x19b)](_0x2f9a4d['lockKey']);if(_0x166893)return _0x166893;if(_0x2f9a4d[_0x5626f7(0x121)]!==_0x5626f7(0x187))return undefined;const [,_0x478b5c,..._0x5f9708]=_0x2f9a4d['lockKey']['split']('/');if(!_0x478b5c||_0x5f9708[_0x5626f7(0x17e)]===0x0)return undefined;const _0x147334=_0x3763ec[_0x5626f7(0x1b2)][_0x5626f7(0x19b)](hookDirectoryIdentity(_0x478b5c));return _0x147334?join(_0x147334,..._0x5f9708)+_0x5626f7(0x13b):undefined;}function sameHookIdentity(_0x58ec07,_0x59c879){const _0x28e377=a42_0x4d1eea;return _0x58ec07[_0x28e377(0x18e)]===_0x59c879[_0x28e377(0x18e)]&&_0x58ec07[_0x28e377(0x176)]===_0x59c879['datasetCode']&&_0x58ec07[_0x28e377(0x181)]===_0x59c879['operationType']&&_0x58ec07[_0x28e377(0x14d)]===_0x59c879['functionNode'];}function canonicalizeHookEntry(_0x229902,_0x212e31){const {alias:_0x35232a,..._0x3557ad}=_0x229902;return _0x212e31?{..._0x3557ad,'alias':_0x212e31}:_0x3557ad;}function hookDirectoryIdentity(_0x4a865a){const _0x37acc5=a42_0x4d1eea;return _0x4a865a[_0x37acc5(0x134)](_0x37acc5(0x150))[_0x37acc5(0x1a0)]();}function isSafeHookDirectorySegment(_0x5f118c){return isSafeLockKeySegment(_0x5f118c);}async function sameDirectory(_0xac0c8d,_0xbd4ed4){const _0x8e4774=a42_0x4d1eea,[_0x54a2f3,_0x498274]=await Promise[_0x8e4774(0x1aa)]([stat(_0xac0c8d),stat(_0xbd4ed4)]);return _0x54a2f3['dev']===_0x498274[_0x8e4774(0x162)]&&_0x54a2f3[_0x8e4774(0x16f)]===_0x498274['ino'];}async function applyHookDirectoryMigration(_0x2455e2,_0x7223bd){const _0x12dff3=a42_0x4d1eea,_0x72d89b=_0x7223bd[_0x12dff3(0x13e)],_0x5871fb=_0x7223bd[_0x12dff3(0x152)],_0x4f1990=[],_0x59224f=async()=>{const _0x283fc9=_0x12dff3,_0x446126=[];_0x7223bd[_0x283fc9(0x13e)]=_0x72d89b,_0x7223bd[_0x283fc9(0x152)]=_0x5871fb;for(const {migration:_0x530b65,temporaryPath:_0x4c3897}of[..._0x4f1990][_0x283fc9(0x18a)]()){try{_0x4c3897?(await rename(_0x530b65[_0x283fc9(0x136)],_0x4c3897),await rename(_0x4c3897,_0x530b65[_0x283fc9(0x15e)])):await rename(_0x530b65[_0x283fc9(0x136)],_0x530b65['oldDirectoryPath']);}catch(_0x3cf32e){_0x446126['push'](new Error(_0x283fc9(0x122)+_0x530b65[_0x283fc9(0x139)]+_0x283fc9(0x14c)+_0x530b65[_0x283fc9(0x198)]+_0x283fc9(0x15c)+(_0x3cf32e instanceof Error?_0x3cf32e[_0x283fc9(0x17d)]:String(_0x3cf32e))));}}return _0x446126;};try{for(const _0x856af of _0x2455e2[_0x12dff3(0x151)]){if(_0x856af[_0x12dff3(0x1a4)]===_0x12dff3(0x199))await ensureParentDirectory(_0x856af[_0x12dff3(0x136)]),await rename(_0x856af['oldDirectoryPath'],_0x856af[_0x12dff3(0x136)]),_0x4f1990[_0x12dff3(0x182)]({'migration':_0x856af});else{if(_0x856af[_0x12dff3(0x1a4)]===_0x12dff3(0x1ab)){const _0x1026f5=join(dirname(_0x856af['oldDirectoryPath']),_0x12dff3(0x190)+randomUUID());await rename(_0x856af[_0x12dff3(0x15e)],_0x1026f5);try{await rename(_0x1026f5,_0x856af['newDirectoryPath']);}catch(_0x2d4cfc){try{await rename(_0x1026f5,_0x856af[_0x12dff3(0x15e)]);}catch(_0x30257c){throw withRollbackErrors(_0x2d4cfc,_0x12dff3(0x148)+_0x856af[_0x12dff3(0x139)]+_0x12dff3(0x1ad)+_0x856af[_0x12dff3(0x198)]+'\x22;\x20temporary\x20directory\x20\x22'+_0x1026f5+_0x12dff3(0x12f),[new Error(_0x12dff3(0x14b)+_0x1026f5+_0x12dff3(0x1ad)+_0x856af[_0x12dff3(0x139)]+_0x12dff3(0x15c)+(_0x30257c instanceof Error?_0x30257c[_0x12dff3(0x17d)]:String(_0x30257c)))]);}throw _0x2d4cfc;}_0x4f1990[_0x12dff3(0x182)]({'migration':_0x856af,'temporaryPath':_0x1026f5});}}}return _0x7223bd[_0x12dff3(0x13e)]=_0x2455e2[_0x12dff3(0x177)],{'rollback':_0x59224f};}catch(_0x2afe21){const _0x4a5943=await _0x59224f();throw withRollbackErrors(_0x2afe21,_0x12dff3(0x17f),_0x4a5943);}}async function confirmForce(){const _0x327bed=a42_0x4d1eea,_0x5c5dd4=createInterface({'input':process[_0x327bed(0x15f)],'output':process[_0x327bed(0x1a7)]}),_0x53aac3=await new Promise(_0x29ed6b=>{const _0x5652e9=_0x327bed;_0x5c5dd4[_0x5652e9(0x16d)](_0x5652e9(0x12c),_0x29ed6b);});return _0x5c5dd4[_0x327bed(0x11f)](),['y',_0x327bed(0x194)][_0x327bed(0x14f)](_0x53aac3[_0x327bed(0x16a)]()[_0x327bed(0x1a0)]());}
|