@lovrabet/rabetbase-cli 2.5.3-beta.2 → 2.5.3-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-group.d.ts +22 -0
- package/lib/api/api-group.js +1 -0
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +18 -2
- 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.d.ts +11 -0
- package/lib/api/legacy-api-file.js +1 -0
- package/lib/api/model-registry-file.d.ts +36 -0
- package/lib/api/model-registry-file.js +1 -0
- package/lib/api/model-registry-scaffold.d.ts +7 -0
- package/lib/api/model-registry-scaffold.js +1 -0
- package/lib/api/model-source.d.ts +6 -0
- package/lib/api/model-source.js +1 -0
- 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.d.ts +7 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +1 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +1 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/dataset/batch-design.js +1 -1
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/cross-relation-create.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-create.js +1 -0
- package/lib/commands/dataset/cross-relation-delete.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-delete.js +1 -0
- package/lib/commands/dataset/cross-relation-list.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-list.js +1 -0
- package/lib/commands/dataset/cross-relation-shared.d.ts +190 -0
- package/lib/commands/dataset/cross-relation-shared.js +1 -0
- package/lib/commands/dataset/cross-relation-update.d.ts +2 -0
- package/lib/commands/dataset/cross-relation-update.js +1 -0
- 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.d.ts +28 -0
- package/lib/commands/project/api-architecture-upgrade.js +1 -0
- 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.d.ts +30 -1
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +1 -1
- package/lib/commands/rule/shared.js +1 -1
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +1 -1
- package/lib/config/project-domain-routing.js +1 -1
- package/lib/config/region-config.js +1 -1
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.d.ts +5 -3
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.d.ts +2 -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.d.ts +2 -1
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.d.ts +13 -17
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +6 -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.d.ts +41 -0
- package/lib/core/cross-db-relation.js +1 -0
- 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.d.ts +1 -1
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +1 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/postinstall.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +1 -1
- package/lib/skills/builtin-skill.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.d.ts +0 -10
- 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/types/index.d.ts +11 -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.d.ts +19 -0
- 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 +6 -1
- package/skills/rabetbase/SKILL.md +16 -10
- package/skills/rabetbase/guides/backend-function.md +5 -1
- package/skills/rabetbase/guides/bff-creation-workflow.md +3 -1
- package/skills/rabetbase/guides/cross-database-bff.md +70 -0
- package/skills/rabetbase/guides/data-api-guidelines.md +35 -33
- package/skills/rabetbase/guides/sdk-client-generation.md +112 -61
- package/skills/rabetbase/guides/sql-creation-workflow.md +2 -0
- package/skills/rabetbase/guides/typescript-sdk.md +9 -0
- package/skills/rabetbase/references/rabetbase-api-pull.md +30 -19
- package/skills/rabetbase/references/rabetbase-app-list.md +1 -1
- package/skills/rabetbase/references/rabetbase-config.md +2 -1
- package/skills/rabetbase/references/rabetbase-dataset-cross-relations.md +64 -0
- package/skills/rabetbase/references/rabetbase-project-create.md +3 -3
- package/skills/rabetbase/references/rabetbase-project-upgrade.md +24 -13
- package/skills/rabetbase.manifest.json +5 -3
- package/templates/README.md +46 -6
- package/templates/generate-api/model-runtime.ts.tpl +101 -0
- package/templates/generate-api/profile-api.ts.tpl +21 -0
- package/templates/generate-api/profile-client.ts.tpl +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a34_0x3a1b86=a34_0x5297;(function(_0x590be2,_0x3a0751){const _0x3dd8c9=a34_0x5297,_0x5c984e=_0x590be2();while(!![]){try{const _0x4a9d18=parseInt(_0x3dd8c9(0xd4))/0x1+parseInt(_0x3dd8c9(0xd2))/0x2+-parseInt(_0x3dd8c9(0xe9))/0x3+parseInt(_0x3dd8c9(0xd5))/0x4+parseInt(_0x3dd8c9(0xf0))/0x5*(parseInt(_0x3dd8c9(0xfb))/0x6)+-parseInt(_0x3dd8c9(0xc6))/0x7*(parseInt(_0x3dd8c9(0xfc))/0x8)+parseInt(_0x3dd8c9(0xf3))/0x9*(-parseInt(_0x3dd8c9(0xc2))/0xa);if(_0x4a9d18===_0x3a0751)break;else _0x5c984e['push'](_0x5c984e['shift']());}catch(_0x3d7703){_0x5c984e['push'](_0x5c984e['shift']());}}}(a34_0x3891,0xcacf8));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':a34_0x3a1b86(0xe1),'description':a34_0x3a1b86(0xbf),'required':!![]};export const VALUE_ARG={'name':a34_0x3a1b86(0xc0),'description':a34_0x3a1b86(0xdc),'required':![]};export const TAGS_FLAG={'name':a34_0x3a1b86(0xca),'type':'string','description':a34_0x3a1b86(0xfa)};export const STDIN_FLAG={'name':'stdin','type':a34_0x3a1b86(0xe6),'description':a34_0x3a1b86(0xbe),'default':![]};function a34_0x3891(){const _0xb8e44f=['Failed\x20to\x20','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','validation','error','path','22645mUPgmQ','reveal','env','27414pyafhN','Environment\x20variable\x20is\x20not\x20set:\x20','kind','hasValue','length','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','setEncoding','Config\x20tags\x20for\x20filtering/display\x20metadata','1032FVqmGH','32TIOdEq','file','join','str','appCode:\x20','utf8','args','data','Read\x20config\x20value\x20from\x20stdin','Runtime\x20app-config\x20key','value','gmtModified','3730tTwxWw','Missing\x20app-config\x20value\x20source.','argument','name','976409BdxEtr','before','gmtCreate','appCode','tags','stdin','\x20app\x20config.','operation','flag','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','from-env','App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.','1254374ypjeoj','App\x20config\x20value\x20source\x20is\x20ambiguous.','1480153OwBJIa','278188LCcelA','Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','apiError','string','warnings','Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','trim','Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','Value\x20file\x20is\x20not\x20readable:\x20','method','end','dryRun','key','url','bool','defineProperties','key:\x20','boolean','push','after','1293171iATQly','slice'];a34_0x3891=function(){return _0xb8e44f;};return a34_0x3891();}export const FROM_ENV_FLAG={'name':'from-env','type':a34_0x3a1b86(0xd8),'description':'Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable'};export const REVEAL_FLAG={'name':a34_0x3a1b86(0xf1),'type':'boolean','description':a34_0x3a1b86(0xec),'default':![]};export function readKeyArg(_0x4dd56a){const _0x30ed30=a34_0x3a1b86,_0x4008da=_0x4dd56a['args'][0x0]?.[_0x30ed30(0xdb)]()??'';return validateKey(_0x4008da),_0x4008da;}export function readOptionalTags(_0x2bc0df){const _0x4ddf6c=a34_0x3a1b86,_0x49e847=_0x2bc0df[_0x4ddf6c(0xff)](_0x4ddf6c(0xca))['trim']();if(!_0x49e847)return undefined;if(_0x49e847[_0x4ddf6c(0xf7)]>0x20)throw CliErrors['validation'](_0x4ddf6c(0xf8));return _0x49e847;}function a34_0x5297(_0x2ca249,_0x3c899f){_0x2ca249=_0x2ca249-0xbe;const _0x3891ef=a34_0x3891();let _0x52974c=_0x3891ef[_0x2ca249];return _0x52974c;}export function validateKey(_0x59b40d){const _0x5b59a3=a34_0x3a1b86;if(!_0x59b40d)throw CliErrors[_0x5b59a3(0xed)]('Missing\x20app-config\x20key.');if(_0x59b40d['length']>0x100)throw CliErrors[_0x5b59a3(0xed)](_0x5b59a3(0xd1));}export function projectAppConfig(_0x47384b,_0x16c570){const _0x9ede22=a34_0x3a1b86,_0x53316e=_0x47384b[_0x9ede22(0xc0)]!==undefined&&_0x47384b[_0x9ede22(0xc0)]!==null&&_0x47384b['value']!=='',_0x5ee509={'appCode':_0x47384b[_0x9ede22(0xc9)],'key':_0x47384b['key'],'tags':_0x47384b[_0x9ede22(0xca)]??undefined,'hasValue':_0x53316e,'valueRedacted':_0x53316e&&!_0x16c570?.[_0x9ede22(0xf1)],'gmtCreate':_0x47384b[_0x9ede22(0xc8)],'gmtModified':_0x47384b[_0x9ede22(0xc1)]};return _0x16c570?.[_0x9ede22(0xf1)]&&(_0x5ee509['value']=_0x47384b[_0x9ede22(0xc0)]??'',_0x5ee509['valueRedacted']=![]),_0x5ee509;}export function plannedAppConfig(_0x59bd39){const _0x2d8d95=a34_0x3a1b86,_0x3c9e96=_0x59bd39[_0x2d8d95(0xf6)]??!![];return{'appCode':_0x59bd39[_0x2d8d95(0xc9)],'key':_0x59bd39['key'],'tags':_0x59bd39[_0x2d8d95(0xca)]??undefined,'hasValue':_0x3c9e96,'valueRedacted':_0x3c9e96};}export function buildMutationData(_0x107e3c){const _0x2c4fff=a34_0x3a1b86;return{'operation':_0x107e3c[_0x2c4fff(0xcd)],'selector':{'appCode':_0x107e3c[_0x2c4fff(0xc9)],'key':_0x107e3c[_0x2c4fff(0xe1)]},'before':_0x107e3c[_0x2c4fff(0xc7)],'after':_0x107e3c[_0x2c4fff(0xe8)],'dryRun':_0x107e3c[_0x2c4fff(0xe0)],'warnings':_0x107e3c[_0x2c4fff(0xd9)]??[]};}export async function withAppConfigApiBoundary(_0x36f1fb,_0xaa6cf0,_0x1749c9){const _0x694144=a34_0x3a1b86;try{return await _0x1749c9();}catch{const _0x4c8e84=[_0x694144(0x100)+_0xaa6cf0['appCode']];if(_0xaa6cf0['key'])_0x4c8e84[_0x694144(0xe7)](_0x694144(0xe5)+_0xaa6cf0[_0x694144(0xe1)]);_0x4c8e84['push']('value\x20is\x20redacted');throw CliErrors[_0x694144(0xd7)](_0x694144(0xeb)+_0x36f1fb+_0x694144(0xcc),_0x4c8e84[_0x694144(0xfe)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x562721,_0x17138a){const _0x3cc7bf=a34_0x3a1b86;return Object[_0x3cc7bf(0xe4)](_0x562721,{'method':{'value':_0x17138a[_0x3cc7bf(0xde)],'enumerable':![]},'url':{'value':_0x17138a[_0x3cc7bf(0xe2)],'enumerable':![]}});}export function assertSingleValueSource(_0x222a71){const _0x46288b=a34_0x3a1b86,_0x38ecff=[];_0x222a71[_0x46288b(0x102)]['length']>0x1&&_0x38ecff[_0x46288b(0xe7)]({'kind':_0x46288b(0xc4),'value':_0x222a71[_0x46288b(0x102)][_0x46288b(0xea)](0x1)[_0x46288b(0xfe)]('\x20')});const _0xcf8397=_0x222a71[_0x46288b(0xce)]('value');_0xcf8397!==undefined&&_0xcf8397!==null&&_0x38ecff['push']({'kind':_0x46288b(0xc4),'value':String(_0xcf8397)});_0x222a71[_0x46288b(0xe3)]('stdin')&&_0x38ecff[_0x46288b(0xe7)]({'kind':_0x46288b(0xcb)});const _0x78bb62=_0x222a71[_0x46288b(0xff)](_0x46288b(0xd0))[_0x46288b(0xdb)]();_0x78bb62&&_0x38ecff[_0x46288b(0xe7)]({'kind':_0x46288b(0xf2),'name':_0x78bb62});const _0xa89652=_0x222a71[_0x46288b(0xff)](_0x46288b(0xfd))['trim']();_0xa89652&&_0x38ecff[_0x46288b(0xe7)]({'kind':_0x46288b(0xfd),'path':_0xa89652});if(_0x38ecff[_0x46288b(0xf7)]===0x0)throw CliErrors['validation'](_0x46288b(0xc3),_0x46288b(0xcf));if(_0x38ecff['length']>0x1)throw CliErrors['validation'](_0x46288b(0xd3),_0x46288b(0xd6));return _0x38ecff[0x0];}export async function assertValueSourceReadable(_0x3f1d68){const _0x25e86e=a34_0x3a1b86;if(_0x3f1d68[_0x25e86e(0xf5)]===_0x25e86e(0xf2)&&!(_0x3f1d68[_0x25e86e(0xc5)]in process.env))throw CliErrors[_0x25e86e(0xed)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x3f1d68[_0x25e86e(0xc5)]);if(_0x3f1d68[_0x25e86e(0xf5)]===_0x25e86e(0xfd))try{await access(_0x3f1d68['path']);}catch{throw CliErrors['validation'](_0x25e86e(0xdd)+_0x3f1d68[_0x25e86e(0xef)]);}}export async function readAppConfigValue(_0x3f9a06){const _0x297856=a34_0x3a1b86,_0x23f834=assertSingleValueSource(_0x3f9a06),_0x468e2a=[];if(_0x23f834['kind']===_0x297856(0xc4))return _0x468e2a[_0x297856(0xe7)](_0x297856(0xda)),{'value':_0x23f834[_0x297856(0xc0)]??'','source':_0x23f834['kind'],'warnings':_0x468e2a};if(_0x23f834[_0x297856(0xf5)]===_0x297856(0xcb))return{'value':await readStdin(),'source':_0x23f834[_0x297856(0xf5)],'warnings':_0x468e2a};if(_0x23f834[_0x297856(0xf5)]===_0x297856(0xf2)){if(!(_0x23f834[_0x297856(0xc5)]in process.env))throw CliErrors['validation'](_0x297856(0xf4)+_0x23f834[_0x297856(0xc5)]);return{'value':process.env[_0x23f834.name]??'','source':_0x23f834[_0x297856(0xf5)],'warnings':_0x468e2a};}return{'value':await readFile(_0x23f834[_0x297856(0xef)],_0x297856(0x101)),'source':_0x23f834['kind'],'warnings':_0x468e2a};}function readStdin(){return new Promise((_0x789b83,_0x411ac0)=>{const _0x5c22a4=a34_0x5297;let _0x4774e6='';process[_0x5c22a4(0xcb)][_0x5c22a4(0xf9)](_0x5c22a4(0x101)),process[_0x5c22a4(0xcb)]['on'](_0x5c22a4(0x103),_0x4a751=>{_0x4774e6+=_0x4a751;}),process[_0x5c22a4(0xcb)]['once'](_0x5c22a4(0xdf),()=>_0x789b83(_0x4774e6)),process[_0x5c22a4(0xcb)]['once'](_0x5c22a4(0xee),_0x411ac0);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a35_0x3d90(){const _0x3889d8=['843821vJlmBS','1680MRcZak','143418lcYOsw','logout','✓\x20Logged\x20out','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','log','52885rfYInS','nonInteractive','auth','285114vQUDzN','!\x20Not\x20logged\x20in','40rpSGHz','Clear\x20login\x20session','16YLpOaG','bool','login','2510peTAFP','Login\x20via\x20browser','31568uXIHGd','yes','66mLuZlg','boolean','write','../../auth/auth-server-ui.js','384597ueZOmu'];a35_0x3d90=function(){return _0x3889d8;};return a35_0x3d90();}const a35_0x19ba80=a35_0x46e7;(function(_0x360e5f,_0x1b0c75){const _0x52f185=a35_0x46e7,_0x532079=_0x360e5f();while(!![]){try{const _0x1bc8cd=parseInt(_0x52f185(0x9c))/0x1+-parseInt(_0x52f185(0x94))/0x2+parseInt(_0x52f185(0xa7))/0x3*(-parseInt(_0x52f185(0xa5))/0x4)+-parseInt(_0x52f185(0xa3))/0x5*(parseInt(_0x52f185(0x93))/0x6)+parseInt(_0x52f185(0x99))/0x7+-parseInt(_0x52f185(0xa0))/0x8*(-parseInt(_0x52f185(0x91))/0x9)+parseInt(_0x52f185(0x9e))/0xa*(parseInt(_0x52f185(0x92))/0xb);if(_0x1bc8cd===_0x1b0c75)break;else _0x532079['push'](_0x532079['shift']());}catch(_0x300da5){_0x532079['push'](_0x532079['shift']());}}}(a35_0x3d90,0x4904e));function a35_0x46e7(_0x45475b,_0x1868c1){_0x45475b=_0x45475b-0x8f;const _0x3d9010=a35_0x3d90();let _0x46e75c=_0x3d9010[_0x45475b];return _0x46e75c;}import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a35_0x19ba80(0x9b),'command':a35_0x19ba80(0xa2),'description':a35_0x19ba80(0xa4),'risk':a35_0x19ba80(0x8f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a35_0x19ba80(0xa6),'type':a35_0x19ba80(0xa8),'description':a35_0x19ba80(0x97),'default':![]}],async 'execute'(_0x27644f){const _0x2bb15c=a35_0x19ba80,{runAuthServer:_0x165515}=await import(_0x2bb15c(0x90));return await _0x165515({'autoYes':_0x27644f[_0x2bb15c(0xa1)](_0x2bb15c(0xa6)),'nonInteractive':_0x27644f[_0x2bb15c(0x9a)]}),{'ok':!![]};}},{'service':a35_0x19ba80(0x9b),'command':a35_0x19ba80(0x95),'description':a35_0x19ba80(0x9f),'risk':a35_0x19ba80(0x8f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x24f49e){const _0x37e78a=a35_0x19ba80;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x37e78a(0x98)](_0x37e78a(0x96))):console[_0x37e78a(0x98)](_0x37e78a(0x9d)),{'ok':!![]};}}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x4ac471=a31_0x5487;(function(_0x5ade3f,_0x12ce3f){const _0xdf3bcd=a31_0x5487,_0x57b33b=_0x5ade3f();while(!![]){try{const _0x179b27=-parseInt(_0xdf3bcd(0x13c))/0x1*(parseInt(_0xdf3bcd(0x16d))/0x2)+-parseInt(_0xdf3bcd(0x126))/0x3+-parseInt(_0xdf3bcd(0x15f))/0x4*(parseInt(_0xdf3bcd(0x159))/0x5)+-parseInt(_0xdf3bcd(0x171))/0x6+-parseInt(_0xdf3bcd(0x15d))/0x7+-parseInt(_0xdf3bcd(0x11c))/0x8+parseInt(_0xdf3bcd(0x128))/0x9;if(_0x179b27===_0x12ce3f)break;else _0x57b33b['push'](_0x57b33b['shift']());}catch(_0x1e68fa){_0x57b33b['push'](_0x57b33b['shift']());}}}(a31_0xeafb,0x5fd7b));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';import{loadAliasMap,resolveAlias}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.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':a31_0x4ac471(0x160),'command':a31_0x4ac471(0x16a),'description':a31_0x4ac471(0x129),'risk':a31_0x4ac471(0x12b),'flags':[{'name':'type','type':'string','required':!![],'enum':[a31_0x4ac471(0x13d),a31_0x4ac471(0x17e),a31_0x4ac471(0x17d)],'description':a31_0x4ac471(0x143)},{'name':a31_0x4ac471(0x158),'type':a31_0x4ac471(0x12c),'required':!![],'description':'Function\x20name\x20(valid\x20JS\x20identifier)'},{'name':a31_0x4ac471(0x153),'type':'string','description':a31_0x4ac471(0x125)},{'name':a31_0x4ac471(0x164),'type':a31_0x4ac471(0x12c),'description':a31_0x4ac471(0x124)},{'name':a31_0x4ac471(0x16f),'type':a31_0x4ac471(0x12c),'description':a31_0x4ac471(0x11e)},{'name':a31_0x4ac471(0x13b),'type':'string','description':a31_0x4ac471(0x145)},{'name':'function-node','type':'string','description':a31_0x4ac471(0x123),'enum':[a31_0x4ac471(0x139),a31_0x4ac471(0x12d)]}],async 'validate'(_0x1d5aca){const _0x3d02e1=a31_0x4ac471,_0x2b98f1=_0x1d5aca[_0x3d02e1(0x135)](_0x3d02e1(0x158));if(!isValidBffFunctionName(_0x2b98f1))throw CliErrors[_0x3d02e1(0x13e)](_0x3d02e1(0x147)+_0x2b98f1+_0x3d02e1(0x168));},async 'execute'(_0x32e4b3){const _0x4c944c=a31_0x4ac471,_0x411fd0=loadBffProjectConfig(_0x32e4b3[_0x4c944c(0x14b)]),_0x581405=_0x32e4b3[_0x4c944c(0x135)]('type'),_0x3c9600=_0x32e4b3[_0x4c944c(0x135)](_0x4c944c(0x158)),_0x4c89e7=_0x32e4b3[_0x4c944c(0x135)](_0x4c944c(0x153))||undefined,_0x47077f=_0x581405===_0x4c944c(0x17d)?await resolveHookOptions(_0x411fd0,_0x32e4b3):undefined,_0x55a10e=buildFilePath(_0x411fd0,_0x581405,_0x3c9600,_0x47077f);if(await fileExists(_0x55a10e))throw CliErrors[_0x4c944c(0x13e)](_0x4c944c(0x155)+_0x55a10e);await mkdir(dirname(_0x55a10e),{'recursive':!![]});const _0x42996d=generateTemplate(_0x581405,_0x3c9600,_0x32e4b3[_0x4c944c(0x14b)],_0x4c89e7,_0x47077f);await writeFile(_0x55a10e,_0x42996d,'utf8');const _0xfde8ad={'type':_0x581405,'name':_0x3c9600,'path':_0x55a10e};if(_0x4c89e7)_0xfde8ad[_0x4c944c(0x153)]=_0x4c89e7;if(_0x47077f){if(_0x47077f[_0x4c944c(0x164)])_0xfde8ad[_0x4c944c(0x164)]=_0x47077f['alias'];_0xfde8ad[_0x4c944c(0x140)]=_0x47077f[_0x4c944c(0x140)],_0xfde8ad[_0x4c944c(0x17a)]=_0x47077f[_0x4c944c(0x17a)],_0xfde8ad['functionNode']=_0x47077f['functionNode'];}return{'ok':!![],'data':_0xfde8ad,'message':_0x4c944c(0x14d)+_0x581405+_0x4c944c(0x120)+_0x3c9600};}};function a31_0x5487(_0x1d1bfe,_0x6c6b3d){_0x1d1bfe=_0x1d1bfe-0x11a;const _0xeafbab=a31_0xeafb();let _0x5487c8=_0xeafbab[_0x1d1bfe];return _0x5487c8;}async function resolveHookOptions(_0x4296c5,_0x19ecfa){const _0x5aea4e=a31_0x4ac471,_0x43cf1a=loadAliasMap(_0x19ecfa[_0x5aea4e(0x122)],undefined,resolveApiFilePath(_0x19ecfa[_0x5aea4e(0x122)],_0x19ecfa['appCode'])),_0x1de279=_0x43cf1a[_0x5aea4e(0x142)]>0x0;let _0x13962e,_0x2e9bc4,_0x4eb0dd;const _0x9d205b=_0x19ecfa[_0x5aea4e(0x135)](_0x5aea4e(0x164)),_0x1dc31e=_0x19ecfa[_0x5aea4e(0x135)]('datasetcode');if(_0x9d205b){const _0x453636=resolveAlias(_0x19ecfa['apiDir'],_0x9d205b,undefined,resolveApiFilePath(_0x19ecfa[_0x5aea4e(0x122)],_0x19ecfa['appCode']));if(!_0x453636){const _0x3d13dc=_0x1de279?_0x5aea4e(0x121)+_0x43cf1a['map'](_0x45daf7=>_0x45daf7[_0x5aea4e(0x164)])[_0x5aea4e(0x152)](',\x20'):_0x5aea4e(0x13f)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x5aea4e(0x13e)]('Alias\x20\x22'+_0x9d205b+_0x5aea4e(0x167)+_0x3d13dc);}_0x13962e=_0x9d205b,_0x2e9bc4=_0x453636;}else{if(_0x1dc31e){_0x2e9bc4=_0x1dc31e;const _0x1bf59b=_0x43cf1a['find'](_0x589f26=>_0x589f26[_0x5aea4e(0x140)]===_0x1dc31e);_0x13962e=_0x1bf59b?.[_0x5aea4e(0x164)];}else{if(_0x19ecfa[_0x5aea4e(0x162)])throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x175));else{if(_0x1de279){const _0x3fb155=_0x43cf1a[_0x5aea4e(0x12a)](_0x72a23=>_0x72a23[_0x5aea4e(0x164)]+'\x20('+_0x72a23[_0x5aea4e(0x11b)]+')'),_0x277b28=await promptSelect('Select\x20dataset:',_0x3fb155),_0x176761=_0x43cf1a[_0x277b28];if(!_0x176761)throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x172));_0x13962e=_0x176761[_0x5aea4e(0x164)],_0x2e9bc4=_0x176761[_0x5aea4e(0x140)];}else{const _0x26134a=await listDatasets(_0x19ecfa['appCode']);if(_0x26134a[_0x5aea4e(0x142)]===0x0)throw CliErrors[_0x5aea4e(0x13e)]('No\x20datasets\x20found\x20for\x20this\x20app.');const _0x7301c8=_0x26134a['map'](_0x3d2d44=>_0x3d2d44[_0x5aea4e(0x158)]+'\x20['+(_0x3d2d44[_0x5aea4e(0x131)]??_0x5aea4e(0x15a))+_0x5aea4e(0x15b)+_0x3d2d44[_0x5aea4e(0x132)]+')'),_0x322ad3=await promptSelect('Select\x20dataset:',_0x7301c8),_0x26849d=_0x26134a[_0x322ad3];if(!_0x26849d)throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x172));_0x2e9bc4=_0x26849d[_0x5aea4e(0x132)],_0x13962e=undefined;}}}}const _0x5b6f64=await listDatasets(_0x19ecfa['appCode']),_0x1c346c=_0x5b6f64[_0x5aea4e(0x149)](_0x29236b=>_0x29236b[_0x5aea4e(0x132)]===_0x2e9bc4);if(!_0x1c346c)throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x161)+_0x2e9bc4+_0x5aea4e(0x136)+(_0x13962e?'The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+'\x20api\x20pull`\x20to\x20refresh.':''));_0x4eb0dd=_0x1c346c['id'];const _0x4db4f9=_0x13962e??_0x2e9bc4,_0x42971d=await listBffDatasetOperations(_0x19ecfa[_0x5aea4e(0x14b)],_0x4eb0dd),_0xa7b317=_0x42971d?Object[_0x5aea4e(0x154)](_0x42971d):[];if(_0xa7b317[_0x5aea4e(0x142)]===0x0)throw CliErrors[_0x5aea4e(0x13e)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x4db4f9+'.');let _0x3b6efa;const _0x5685ee=_0x19ecfa[_0x5aea4e(0x135)](_0x5aea4e(0x13b));if(_0x5685ee){if(!_0xa7b317[_0x5aea4e(0x173)](_0x5685ee))throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x174)+_0x5685ee+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x4db4f9+'.\x20'+(_0x5aea4e(0x163)+_0xa7b317['join'](',\x20')));_0x3b6efa=_0x5685ee;}else{if(_0x19ecfa[_0x5aea4e(0x162)])throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x11f));const _0x2fd9d3=await promptSelect('Select\x20operation\x20type:',_0xa7b317);_0x3b6efa=_0xa7b317[_0x2fd9d3]??_0xa7b317[0x0];}let _0x2714bd=normalizeHookFunctionNode(_0x19ecfa[_0x5aea4e(0x135)](_0x5aea4e(0x146)));if(!_0x2714bd){if(_0x19ecfa['str'](_0x5aea4e(0x146)))throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x148));if(_0x19ecfa[_0x5aea4e(0x162)])throw CliErrors[_0x5aea4e(0x13e)](_0x5aea4e(0x138));const _0x8aa6fd=await promptSelect('Select\x20trigger\x20node:',[_0x5aea4e(0x139),_0x5aea4e(0x12d)]);_0x2714bd=['before',_0x5aea4e(0x12d)][_0x8aa6fd]??'before';}return{'alias':_0x13962e,'datasetCode':_0x2e9bc4,'datasetId':_0x4eb0dd,'operationType':_0x3b6efa,'functionNode':_0x2714bd};}async function promptSelect(_0xdaed20,_0x2d3960){const _0x304178=a31_0x4ac471;if(_0x2d3960['length']===0x1)return 0x0;for(const [_0x1b6588,_0x28009f]of _0x2d3960['entries']()){process[_0x304178(0x141)][_0x304178(0x178)]('\x20\x20'+(_0x1b6588+0x1)+'.\x20'+_0x28009f+'\x0a');}const _0x3dc73b=createInterface({'input':process[_0x304178(0x17b)],'output':process['stderr']});while(!![]){const _0x55ebbf=await new Promise(_0x437311=>{const _0x3db0a5=_0x304178;_0x3dc73b[_0x3db0a5(0x12e)](_0xdaed20+'\x20',_0x437311);}),_0x37bf65=Number['parseInt'](_0x55ebbf[_0x304178(0x14c)](),0xa);if(Number[_0x304178(0x151)](_0x37bf65)&&_0x37bf65>=0x1&&_0x37bf65<=_0x2d3960['length'])return _0x3dc73b[_0x304178(0x15e)](),_0x37bf65-0x1;process['stderr'][_0x304178(0x178)](_0x304178(0x130)+_0x2d3960[_0x304178(0x142)]+'.\x0a');}}function buildFilePath(_0x2c786c,_0x2e1930,_0x5e3215,_0x5f15a1){const _0x45c0a9=a31_0x4ac471;if(_0x2e1930===_0x45c0a9(0x17d)){if(!_0x5f15a1)throw CliErrors['validation'](_0x45c0a9(0x170));const _0x109ea3=_0x5f15a1[_0x45c0a9(0x164)]??_0x5f15a1[_0x45c0a9(0x140)];return join(_0x2c786c['scriptsRootDir'],_0x45c0a9(0x17d),_0x109ea3,_0x5f15a1[_0x45c0a9(0x17a)],_0x5f15a1['functionNode'],_0x5e3215+_0x45c0a9(0x133));}return join(_0x2c786c['scriptsRootDir'],_0x2e1930,_0x5e3215+_0x45c0a9(0x133));}function a31_0xeafb(){const _0x303bac=['172PlRgfD','COMMON','validation','No\x20api.ts\x20found.\x20Run\x20`','datasetCode','stderr','length','Script\x20type','functionNode','Operation\x20type\x20(HOOK\x20only)','function-node','Invalid\x20function\x20name\x20\x22','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','find','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','appCode','trim','Created\x20','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20请求参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','/COMMON/','isInteger','join','description','keys','File\x20already\x20exists:\x20','datasetId','/HOOK/','name','5WUrySF','UNKNOWN',']\x20(','\x0a\x20*\x20[参数字段]\x20按实际请求体为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20HTTP\x20请求体参数\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20TODO:\x20补充业务返回数据结构\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','5351255swxbnz','close','60596JokMoc','bff','Dataset\x20not\x20found\x20for\x20code\x20\x22','nonInteractive','Available:\x20','alias','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','.js\x0a','\x22\x20not\x20found.\x20','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','create','\x22,\x20params\x20})\x0a','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','8684mSwkCy','/ENDPOINT/','datasetcode','HOOK\x20requires\x20alias/operation/node\x20options.','4046682scobfg','Invalid\x20dataset\x20selection.','includes','Operation\x20type\x20\x22','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','write','\x0a\x20*\x20[平台配置]\x20','operationType','stdin','.js\x0a\x20*\x20[触发节点]\x20','HOOK','ENDPOINT','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','tableName','5524904nCoTvJ','/data/dataset/','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','\x20function:\x20','Available\x20aliases:\x20','apiDir','Trigger\x20node\x20(HOOK\x20only)','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Script\x20description','679452RRAiRl','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','31594977JmnskS','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','map','read','string','after','question','\x20*\x20[依赖数据集]\x20无(如有依赖,DB_TABLE\x20填物理表名;METADATA\x20填数据集编码与用途)\x0a\x20*\x20[调用\x20BF]\x20无(如有调用,填写脚本名称与用途)\x0a\x20*\x20[执行\x20SQL]\x20无(如有执行,填写\x20SQL\x20名称与用途)\x0a\x20*\x20[副作用]\x20无(如有通知或外部调用,说明影响与失败策略)','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','source','code','.js','/**\x0a\x20*\x20','str','\x22.\x20','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','before','当前响应结果','operation-type'];a31_0xeafb=function(){return _0x303bac;};return a31_0xeafb();}export function generateTemplate(_0x4d16c5,_0xba5b5c,_0x757594,_0x1fe7ea,_0x7f5be6){const _0x46ce79=a31_0x4ac471,_0x95d73c=_0x1fe7ea?.[_0x46ce79(0x14c)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x3cd8b2=getAppBaseUrl(_0x757594),_0x192baa=_0x46ce79(0x12f);if(_0x4d16c5==='COMMON')return _0x46ce79(0x134)+_0x95d73c+_0x46ce79(0x14e)+_0xba5b5c+'\x0a\x20*\x20[平台配置]\x20'+_0x3cd8b2+_0x46ce79(0x127)+_0x757594+_0x46ce79(0x150)+_0xba5b5c+_0x46ce79(0x165)+_0xba5b5c+_0x46ce79(0x16b)+_0x192baa+_0x46ce79(0x14f)+_0xba5b5c+_0x46ce79(0x11a);if(_0x4d16c5===_0x46ce79(0x17e))return _0x46ce79(0x134)+_0x95d73c+_0x46ce79(0x14a)+_0xba5b5c+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/'+_0x757594+'/'+_0xba5b5c+_0x46ce79(0x179)+_0x3cd8b2+_0x46ce79(0x127)+_0x757594+_0x46ce79(0x16e)+_0xba5b5c+_0x46ce79(0x166)+_0x192baa+_0x46ce79(0x15c)+_0xba5b5c+_0x46ce79(0x11a);if(!_0x7f5be6)throw CliErrors[_0x46ce79(0x13e)](_0x46ce79(0x16c));const _0x39d637=_0x7f5be6[_0x46ce79(0x164)]??_0x7f5be6[_0x46ce79(0x140)],_0x2923bf=_0x7f5be6[_0x46ce79(0x144)]===_0x46ce79(0x139)?'当前请求参数':_0x46ce79(0x13a),_0x2a0727=_0x7f5be6[_0x46ce79(0x144)]==='before'?'修改后的请求参数':'修改后的响应结果';return _0x46ce79(0x134)+_0x95d73c+_0x46ce79(0x177)+_0xba5b5c+_0x46ce79(0x176)+_0x757594+'/'+_0x7f5be6[_0x46ce79(0x140)]+'/'+_0x7f5be6[_0x46ce79(0x17a)]+_0x46ce79(0x179)+_0x3cd8b2+_0x46ce79(0x11d)+_0x7f5be6[_0x46ce79(0x156)]+_0x46ce79(0x169)+_0x757594+_0x46ce79(0x157)+_0x39d637+'/'+_0x7f5be6[_0x46ce79(0x17a)]+'/'+_0x7f5be6['functionNode']+'/'+_0xba5b5c+_0x46ce79(0x17c)+_0x7f5be6['functionNode']+'\x0a'+_0x192baa+'\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20'+_0x2923bf+_0x46ce79(0x137)+_0x2a0727+'\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'+_0xba5b5c+_0x46ce79(0x11a);}
|
|
1
|
+
const a36_0x45984b=a36_0x52f9;(function(_0x370ec0,_0x2a6b14){const _0x5ab867=a36_0x52f9,_0x2aa2da=_0x370ec0();while(!![]){try{const _0x17e77f=-parseInt(_0x5ab867(0x201))/0x1*(-parseInt(_0x5ab867(0x1d3))/0x2)+-parseInt(_0x5ab867(0x1d6))/0x3+parseInt(_0x5ab867(0x1a3))/0x4+-parseInt(_0x5ab867(0x1a8))/0x5*(-parseInt(_0x5ab867(0x19b))/0x6)+parseInt(_0x5ab867(0x1fe))/0x7*(-parseInt(_0x5ab867(0x1b9))/0x8)+-parseInt(_0x5ab867(0x1c4))/0x9*(parseInt(_0x5ab867(0x1d1))/0xa)+parseInt(_0x5ab867(0x1e4))/0xb;if(_0x17e77f===_0x2a6b14)break;else _0x2aa2da['push'](_0x2aa2da['shift']());}catch(_0x74ef6e){_0x2aa2da['push'](_0x2aa2da['shift']());}}}(a36_0x5092,0xe4462));import{createInterface}from'node:readline';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import{listDatasets,listBffDatasetOperations}from'../../core/api-client.js';function a36_0x5092(){const _0xae0256=['.js','Alias\x20\x22','utf8','filePath','entries','962874DZHHfW','当前响应结果','write','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/','includes','\x0a\x20*\x20[平台配置]\x20','stdin','Function\x20name\x20(valid\x20JS\x20identifier)','trim','selectedAppName','/data/backend-function\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','after','30KIBOHP','stderr','2dFvGmq','function-node','Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)','1680900mCwqmN','keys','\x22\x20not\x20found\x20for\x20dataset\x20','Available\x20aliases:\x20','\x22,\x20params\x20})\x0a','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20HOOK\x0a\x20*\x20[脚本名称]\x20','string','ENDPOINT','operationType','read','length','name','find','HOOK\x20requires\x20alias/operation/node\x20options.','18948952Ufnpwo','/**\x0a\x20*\x20','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','appCode','Script\x20type','\x0a\x20*\x0a\x20*\x20[脚本类型]\x20ENDPOINT\x0a\x20*\x20[脚本名称]\x20','Select\x20operation\x20type:','code','map','COMMON','Operation\x20type\x20\x22','UNKNOWN','str','\x20function:\x20','close','Select\x20dataset:','alias','parseInt','nonInteractive','datasetCode','description','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','scriptsRootDir','Dataset\x20not\x20found\x20for\x20code\x20\x22','isInteger','350PohxfL','operation-type','datasetId','153756gDqjLn','source','2717082VdfCBN','Invalid\x20function\x20name\x20\x22','validation','.js\x0a\x20*\x20[调用方式]\x20context.client.bff.execute({\x20scriptName:\x20\x22','defaultApp','No\x20datasets\x20found\x20for\x20this\x20app.','/data/dataset/','No\x20model\x20aliases\x20found.\x20Run\x20`','1797932bJgyYA','\x20api\x20pull`\x20to\x20refresh.','\x0a\x20*\x20@param\x20{Object}\x20context\x20平台注入的执行上下文\x0a\x20*\x20@returns\x20{Promise<Object>}\x20','before','修改后的响应结果','5lptmEB','mergedCli','#api-list\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/','question','Created\x20','type','Scaffold\x20a\x20new\x20Backend\x20Function\x20script\x20from\x20template','Trigger\x20node\x20(HOOK\x20only)','\x0a\x20*\x20[参数字段]\x20按实际输入为\x20params.<字段名>\x20补充\x20JSDoc\x20参数标签;无字段时仅保留根参数\x0a\x20*\x20[异常说明]\x20无;显式抛出异常时补充异常类型与触发条件\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','create','Operation\x20type\x20(HOOK\x20only)','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','apiDir','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无(如有通知或外部调用,说明影响与失败策略)','153992OMraXy','profileName','bff','\x22.\x20','functionNode','HOOK'];a36_0x5092=function(){return _0xae0256;};return a36_0x5092();}function a36_0x52f9(_0x19a828,_0x27a8ad){_0x19a828=_0x19a828-0x19b;const _0x5092f2=a36_0x5092();let _0x52f975=_0x5092f2[_0x19a828];return _0x52f975;}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':a36_0x45984b(0x1bb),'command':a36_0x45984b(0x1b2),'description':a36_0x45984b(0x1ae),'risk':a36_0x45984b(0x1df),'flags':[{'name':a36_0x45984b(0x1ad),'type':a36_0x45984b(0x1dc),'required':!![],'enum':[a36_0x45984b(0x1ed),a36_0x45984b(0x1dd),'HOOK'],'description':a36_0x45984b(0x1e8)},{'name':a36_0x45984b(0x1e1),'type':a36_0x45984b(0x1dc),'required':!![],'description':a36_0x45984b(0x1cb)},{'name':a36_0x45984b(0x1f8),'type':'string','description':'Script\x20description'},{'name':a36_0x45984b(0x1f4),'type':a36_0x45984b(0x1dc),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':'datasetcode','type':'string','description':a36_0x45984b(0x1d5)},{'name':a36_0x45984b(0x1ff),'type':a36_0x45984b(0x1dc),'description':a36_0x45984b(0x1b3)},{'name':a36_0x45984b(0x1d4),'type':'string','description':a36_0x45984b(0x1af),'enum':['before',a36_0x45984b(0x1d0)]}],async 'validate'(_0x5eea64){const _0x57715e=a36_0x45984b,_0x405d70=_0x5eea64[_0x57715e(0x1f0)](_0x57715e(0x1e1));if(!isValidBffFunctionName(_0x405d70))throw CliErrors[_0x57715e(0x19d)](_0x57715e(0x19c)+_0x405d70+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x1c2e17){const _0x133872=a36_0x45984b,_0x5b1d31=loadBffProjectConfig(_0x1c2e17['appCode']),_0x5b82e8=_0x1c2e17['str'](_0x133872(0x1ad)),_0x59c115=_0x1c2e17[_0x133872(0x1f0)]('name'),_0x3cbb58=_0x1c2e17['str']('description')||undefined,_0xcee513=_0x5b82e8===_0x133872(0x1be)?await resolveHookOptions(_0x5b1d31,_0x1c2e17):undefined,_0x24bda2=buildFilePath(_0x5b1d31,_0x5b82e8,_0x59c115,_0xcee513);if(await fileExists(_0x24bda2))throw CliErrors[_0x133872(0x19d)]('File\x20already\x20exists:\x20'+_0x24bda2);await mkdir(dirname(_0x24bda2),{'recursive':!![]});const _0x8496fb=generateTemplate(_0x5b82e8,_0x59c115,_0x1c2e17['appCode'],_0x3cbb58,_0xcee513);await writeFile(_0x24bda2,_0x8496fb,_0x133872(0x1c1));const _0x57ebd9={'type':_0x5b82e8,'name':_0x59c115,'path':_0x24bda2};if(_0x3cbb58)_0x57ebd9[_0x133872(0x1f8)]=_0x3cbb58;if(_0xcee513){if(_0xcee513['alias'])_0x57ebd9[_0x133872(0x1f4)]=_0xcee513['alias'];_0x57ebd9[_0x133872(0x1f7)]=_0xcee513['datasetCode'],_0x57ebd9['operationType']=_0xcee513[_0x133872(0x1de)],_0x57ebd9[_0x133872(0x1bd)]=_0xcee513['functionNode'];}return{'ok':!![],'data':_0x57ebd9,'message':_0x133872(0x1ac)+_0x5b82e8+_0x133872(0x1f1)+_0x59c115};}};async function resolveHookOptions(_0x45dc53,_0x5cdc96){const _0x114193=a36_0x45984b,_0x3d3ca6=resolveApiModelSource(_0x5cdc96['apiDir'],_0x5cdc96[_0x114193(0x1e7)],_0x5cdc96[_0x114193(0x1cd)]||_0x5cdc96[_0x114193(0x1a9)]?.['currentApp']||_0x5cdc96['mergedCli']?.[_0x114193(0x19f)]),_0xac3dd7=loadAliasMap(_0x5cdc96[_0x114193(0x1b5)],undefined,_0x3d3ca6[_0x114193(0x1c2)],_0x3d3ca6[_0x114193(0x1ba)]),_0x2ce739=_0xac3dd7[_0x114193(0x1e0)]>0x0;let _0x52ff13,_0x323b59,_0x1f034a;const _0x457329=_0x5cdc96['str'](_0x114193(0x1f4)),_0x325e90=_0x5cdc96[_0x114193(0x1f0)]('datasetcode');if(_0x457329){const _0x4149e5=resolveAlias(_0x5cdc96[_0x114193(0x1b5)],_0x457329,undefined,_0x3d3ca6['filePath'],_0x3d3ca6[_0x114193(0x1ba)]);if(!_0x4149e5){const _0x119e2d=_0x2ce739?_0x114193(0x1d9)+_0xac3dd7[_0x114193(0x1ec)](_0x1c8645=>_0x1c8645[_0x114193(0x1f4)])['join'](',\x20'):_0x114193(0x1a2)+CLI_BIN_NAME+'\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.';throw CliErrors[_0x114193(0x19d)](_0x114193(0x1c0)+_0x457329+'\x22\x20not\x20found.\x20'+_0x119e2d);}_0x52ff13=_0x457329,_0x323b59=_0x4149e5;}else{if(_0x325e90){_0x323b59=_0x325e90;const _0x2bb2f7=_0xac3dd7[_0x114193(0x1e2)](_0x21d321=>_0x21d321[_0x114193(0x1f7)]===_0x325e90);_0x52ff13=_0x2bb2f7?.[_0x114193(0x1f4)];}else{if(_0x5cdc96[_0x114193(0x1f6)])throw CliErrors[_0x114193(0x19d)]('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x2ce739){const _0x547c31=_0xac3dd7['map'](_0x4b2c04=>_0x4b2c04['alias']+'\x20('+_0x4b2c04['tableName']+')'),_0x364eb1=await promptSelect(_0x114193(0x1f3),_0x547c31),_0xab961a=_0xac3dd7[_0x364eb1];if(!_0xab961a)throw CliErrors[_0x114193(0x19d)]('Invalid\x20dataset\x20selection.');_0x52ff13=_0xab961a[_0x114193(0x1f4)],_0x323b59=_0xab961a[_0x114193(0x1f7)];}else{const _0x222855=await listDatasets(_0x5cdc96[_0x114193(0x1e7)]);if(_0x222855[_0x114193(0x1e0)]===0x0)throw CliErrors[_0x114193(0x19d)](_0x114193(0x1a0));const _0x2e67e3=_0x222855[_0x114193(0x1ec)](_0x4423fa=>_0x4423fa[_0x114193(0x1e1)]+'\x20['+(_0x4423fa[_0x114193(0x202)]??_0x114193(0x1ef))+']\x20('+_0x4423fa[_0x114193(0x1eb)]+')'),_0x4cd0d2=await promptSelect(_0x114193(0x1f3),_0x2e67e3),_0x23a482=_0x222855[_0x4cd0d2];if(!_0x23a482)throw CliErrors[_0x114193(0x19d)]('Invalid\x20dataset\x20selection.');_0x323b59=_0x23a482[_0x114193(0x1eb)],_0x52ff13=undefined;}}}}const _0x405b20=await listDatasets(_0x5cdc96[_0x114193(0x1e7)]),_0x1de604=_0x405b20[_0x114193(0x1e2)](_0x110544=>_0x110544['code']===_0x323b59);if(!_0x1de604)throw CliErrors['validation'](_0x114193(0x1fc)+_0x323b59+_0x114193(0x1bc)+(_0x52ff13?'The\x20generated\x20model\x20facts\x20may\x20be\x20stale\x20—\x20run\x20`'+CLI_BIN_NAME+_0x114193(0x1a4):''));_0x1f034a=_0x1de604['id'];const _0x5f04ea=_0x52ff13??_0x323b59,_0x2b75c4=await listBffDatasetOperations(_0x5cdc96['appCode'],_0x1f034a),_0x5acf25=_0x2b75c4?Object[_0x114193(0x1d7)](_0x2b75c4):[];if(_0x5acf25[_0x114193(0x1e0)]===0x0)throw CliErrors[_0x114193(0x19d)](_0x114193(0x1b6)+_0x5f04ea+'.');let _0x4037d5;const _0x3bcd38=_0x5cdc96['str'](_0x114193(0x1ff));if(_0x3bcd38){if(!_0x5acf25[_0x114193(0x1c8)](_0x3bcd38))throw CliErrors[_0x114193(0x19d)](_0x114193(0x1ee)+_0x3bcd38+_0x114193(0x1d8)+_0x5f04ea+'.\x20'+('Available:\x20'+_0x5acf25['join'](',\x20')));_0x4037d5=_0x3bcd38;}else{if(_0x5cdc96['nonInteractive'])throw CliErrors[_0x114193(0x19d)]('--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x3aa7fe=await promptSelect(_0x114193(0x1ea),_0x5acf25);_0x4037d5=_0x5acf25[_0x3aa7fe]??_0x5acf25[0x0];}let _0x13bad0=normalizeHookFunctionNode(_0x5cdc96[_0x114193(0x1f0)](_0x114193(0x1d4)));if(!_0x13bad0){if(_0x5cdc96[_0x114193(0x1f0)](_0x114193(0x1d4)))throw CliErrors[_0x114193(0x19d)](_0x114193(0x1cf));if(_0x5cdc96[_0x114193(0x1f6)])throw CliErrors[_0x114193(0x19d)]('--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');const _0x1f13a6=await promptSelect('Select\x20trigger\x20node:',[_0x114193(0x1a6),_0x114193(0x1d0)]);_0x13bad0=[_0x114193(0x1a6),_0x114193(0x1d0)][_0x1f13a6]??_0x114193(0x1a6);}return{'alias':_0x52ff13,'datasetCode':_0x323b59,'datasetId':_0x1f034a,'operationType':_0x4037d5,'functionNode':_0x13bad0};}async function promptSelect(_0x334a05,_0x21715b){const _0x55ffba=a36_0x45984b;if(_0x21715b[_0x55ffba(0x1e0)]===0x1)return 0x0;for(const [_0x59bcea,_0xa138a7]of _0x21715b[_0x55ffba(0x1c3)]()){process[_0x55ffba(0x1d2)][_0x55ffba(0x1c6)]('\x20\x20'+(_0x59bcea+0x1)+'.\x20'+_0xa138a7+'\x0a');}const _0x50fe95=createInterface({'input':process[_0x55ffba(0x1ca)],'output':process[_0x55ffba(0x1d2)]});while(!![]){const _0x199521=await new Promise(_0x1deead=>{const _0x514fe4=_0x55ffba;_0x50fe95[_0x514fe4(0x1ab)](_0x334a05+'\x20',_0x1deead);}),_0x3145c8=Number[_0x55ffba(0x1f5)](_0x199521[_0x55ffba(0x1cc)](),0xa);if(Number[_0x55ffba(0x1fd)](_0x3145c8)&&_0x3145c8>=0x1&&_0x3145c8<=_0x21715b['length'])return _0x50fe95[_0x55ffba(0x1f2)](),_0x3145c8-0x1;process['stderr']['write'](_0x55ffba(0x1b4)+_0x21715b[_0x55ffba(0x1e0)]+'.\x0a');}}function buildFilePath(_0x221741,_0x5843c9,_0x5451e3,_0x3073be){const _0x3fbf00=a36_0x45984b;if(_0x5843c9===_0x3fbf00(0x1be)){if(!_0x3073be)throw CliErrors[_0x3fbf00(0x19d)](_0x3fbf00(0x1e3));const _0x5a624c=_0x3073be[_0x3fbf00(0x1f4)]??_0x3073be['datasetCode'];return join(_0x221741[_0x3fbf00(0x1fb)],_0x3fbf00(0x1be),_0x5a624c,_0x3073be['operationType'],_0x3073be[_0x3fbf00(0x1bd)],_0x5451e3+_0x3fbf00(0x1bf));}return join(_0x221741[_0x3fbf00(0x1fb)],_0x5843c9,_0x5451e3+_0x3fbf00(0x1bf));}export function generateTemplate(_0x4615cf,_0xe2d8e7,_0x175c06,_0x18c429,_0x1e5fc1){const _0x408473=a36_0x45984b,_0x124e23=_0x18c429?.[_0x408473(0x1cc)]()||DEFAULT_BFF_SCRIPT_DESCRIPTION,_0x4511c1=getAppBaseUrl(_0x175c06),_0x1bca6b=_0x408473(0x1b8);if(_0x4615cf===_0x408473(0x1ed))return _0x408473(0x1e5)+_0x124e23+'\x0a\x20*\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[脚本名称]\x20'+_0xe2d8e7+'\x0a\x20*\x20[平台配置]\x20'+_0x4511c1+_0x408473(0x1ce)+_0x175c06+'/COMMON/'+_0xe2d8e7+_0x408473(0x19e)+_0xe2d8e7+_0x408473(0x1da)+_0x1bca6b+'\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'+_0xe2d8e7+_0x408473(0x1e6);if(_0x4615cf===_0x408473(0x1dd))return'/**\x0a\x20*\x20'+_0x124e23+_0x408473(0x1e9)+_0xe2d8e7+_0x408473(0x1c7)+_0x175c06+'/'+_0xe2d8e7+'\x0a\x20*\x20[平台配置]\x20'+_0x4511c1+_0x408473(0x1ce)+_0x175c06+'/ENDPOINT/'+_0xe2d8e7+'.js\x0a'+_0x1bca6b+'\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'+_0xe2d8e7+_0x408473(0x1e6);if(!_0x1e5fc1)throw CliErrors['validation'](_0x408473(0x1b1));const _0x13a410=_0x1e5fc1[_0x408473(0x1f4)]??_0x1e5fc1[_0x408473(0x1f7)],_0x2e1083=_0x1e5fc1['functionNode']===_0x408473(0x1a6)?'当前请求参数':_0x408473(0x1c5),_0x24da1c=_0x1e5fc1['functionNode']==='before'?_0x408473(0x1b7):_0x408473(0x1a7);return'/**\x0a\x20*\x20'+_0x124e23+_0x408473(0x1db)+_0xe2d8e7+_0x408473(0x1f9)+_0x175c06+'/'+_0x1e5fc1['datasetCode']+'/'+_0x1e5fc1[_0x408473(0x1de)]+_0x408473(0x1c9)+_0x4511c1+_0x408473(0x1a1)+_0x1e5fc1[_0x408473(0x200)]+_0x408473(0x1aa)+_0x175c06+'/HOOK/'+_0x13a410+'/'+_0x1e5fc1['operationType']+'/'+_0x1e5fc1[_0x408473(0x1bd)]+'/'+_0xe2d8e7+'.js\x0a\x20*\x20[触发节点]\x20'+_0x1e5fc1['functionNode']+'\x0a'+_0x1bca6b+_0x408473(0x1b0)+_0x2e1083+_0x408473(0x1a5)+_0x24da1c+_0x408473(0x1fa)+_0xe2d8e7+_0x408473(0x1e6);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a37_0x1764(){const _0x54873b=['Function\x20not\x20found:\x20','remoteId','scriptsRoot','high-risk-write','includes','trashedTo','1582pizaiU','find','stringify','6739182LUXUId','Would\x20delete\x20','map','No\x20lock\x20entry\x20found\x20for\x20\x22','1158SHtKvE','Deleted\x20','appCode','Lock\x20scope\x20for\x20app\x20\x22','lockFilePath','/api/management/library/scripts/delete','apps','trashDir','Backend\x20Function\x20lock\x20file\x20not\x20found.','validation','replace','keys','scriptsRootDir','toISOString','string','delete','Multiple\x20functions\x20match\x20\x22','Delete\x20a\x20Backend\x20Function\x20script\x20from\x20remote\x20and\x20local','functions','POST','parse','target','\x20\x20-\x20','1549952FwBTLz','\x22\x20not\x20found\x20after\x20ensureLockScope.','\x20(local\x20file\x20moved\x20to\x20trash)','Backend\x20Function\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.','str','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a','2308NEJcAO','lastSync','split','filter','projectRoot','bff','217473IrBShA','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','1137330POswbv','1398MPjaym','length','Local\x20delete\x20not\x20settled\x20for\x20','89320dLtkRc'];a37_0x1764=function(){return _0x54873b;};return a37_0x1764();}const a37_0x50eb36=a37_0x598d;function a37_0x598d(_0x4557d3,_0x5d3612){_0x4557d3=_0x4557d3-0x1c9;const _0x1764bd=a37_0x1764();let _0x598d09=_0x1764bd[_0x4557d3];return _0x598d09;}(function(_0x1e82d7,_0x452c59){const _0x4001f5=a37_0x598d,_0x5f0864=_0x1e82d7();while(!![]){try{const _0x29618e=parseInt(_0x4001f5(0x1f3))/0x1+-parseInt(_0x4001f5(0x1f9))/0x2+parseInt(_0x4001f5(0x1cf))/0x3*(parseInt(_0x4001f5(0x1ed))/0x4)+parseInt(_0x4001f5(0x1f5))/0x5+-parseInt(_0x4001f5(0x1f6))/0x6*(-parseInt(_0x4001f5(0x200))/0x7)+parseInt(_0x4001f5(0x1e6))/0x8+-parseInt(_0x4001f5(0x1cb))/0x9;if(_0x29618e===_0x452c59)break;else _0x5f0864['push'](_0x5f0864['shift']());}catch(_0x54b1a2){_0x5f0864['push'](_0x5f0864['shift']());}}}(a37_0x1764,0x1d71d));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_0x50eb36(0x1f2),'command':a37_0x50eb36(0x1de),'description':a37_0x50eb36(0x1e0),'risk':a37_0x50eb36(0x1fd),'flags':[{'name':'target','type':a37_0x50eb36(0x1dd),'required':!![],'description':a37_0x50eb36(0x1f4)}],async 'validate'(_0x37d926){const _0x2da553=a37_0x50eb36,_0x521247=loadBffProjectConfig(_0x37d926[_0x2da553(0x1d1)]),_0x404a19=await readBffLockFile(_0x521247[_0x2da553(0x1d3)]);if(!_0x404a19)throw CliErrors['validation'](_0x2da553(0x1e9));},async 'dryRun'(_0x402e52){const _0x4b3390=a37_0x50eb36,_0x256eff=loadBffProjectConfig(_0x402e52[_0x4b3390(0x1d1)]),_0x3dc1b5=await readBffLockFile(_0x256eff[_0x4b3390(0x1d3)]);if(!_0x3dc1b5)throw CliErrors['validation'](_0x4b3390(0x1d7));const {appLock:_0x11cb78}=ensureLockScope(_0x3dc1b5,_0x402e52[_0x4b3390(0x1d1)],_0x256eff['scriptsRoot'],_0x4b3390(0x1de)),_0x420e0f=_0x402e52[_0x4b3390(0x1ea)](_0x4b3390(0x1e4)),_0xc465a2=Object['keys'](_0x11cb78[_0x4b3390(0x1e1)]),_0x42f67e=resolveDeleteTarget(_0x420e0f,_0xc465a2),_0x5138db=_0x11cb78[_0x4b3390(0x1e1)][_0x42f67e];if(!_0x5138db)throw CliErrors[_0x4b3390(0x1d8)](_0x4b3390(0x1ce)+_0x42f67e+'\x22.');const _0x19818f=resolveLocalFilePathFromLockKey(_0x256eff,_0x42f67e),_0x15db0a=relative(_0x256eff['projectRoot'],_0x19818f),_0x2e4438=join(_0x256eff[_0x4b3390(0x1d6)],'<timestamp>',_0x15db0a);return{'method':_0x4b3390(0x1e2),'url':_0x4b3390(0x1d4),'body':{'appCode':_0x402e52[_0x4b3390(0x1d1)],'target':_0x42f67e,'remoteId':_0x5138db['remoteId'],'localFilePath':_0x19818f,'trashedPath':_0x2e4438},'description':_0x4b3390(0x1cc)+_0x42f67e+_0x4b3390(0x1eb)};},async 'execute'(_0x2753b1){const _0x3055fa=a37_0x50eb36,_0x23dd6c=loadBffProjectConfig(_0x2753b1['appCode']),_0x54bc45=await readBffLockFile(_0x23dd6c[_0x3055fa(0x1d3)]);if(!_0x54bc45)throw CliErrors[_0x3055fa(0x1d8)](_0x3055fa(0x1d7));const {lockData:_0x5ef65c,appLock:_0x14ff25}=ensureLockScope(_0x54bc45,_0x2753b1['appCode'],_0x23dd6c[_0x3055fa(0x1fc)],_0x3055fa(0x1de)),_0x5ba018=JSON[_0x3055fa(0x1e3)](JSON[_0x3055fa(0x1ca)](_0x5ef65c)),_0x56dbe4=_0x5ba018['apps'][_0x2753b1[_0x3055fa(0x1d1)]];if(!_0x56dbe4)throw new Error(_0x3055fa(0x1d2)+_0x2753b1[_0x3055fa(0x1d1)]+_0x3055fa(0x1e7));const _0x479c5f=_0x2753b1[_0x3055fa(0x1ea)](_0x3055fa(0x1e4)),_0x458c20=Object[_0x3055fa(0x1da)](_0x56dbe4['functions']),_0x3240f3=resolveDeleteTarget(_0x479c5f,_0x458c20),_0x15dcf6=_0x56dbe4['functions'][_0x3240f3];if(!_0x15dcf6)throw CliErrors[_0x3055fa(0x1d8)](_0x3055fa(0x1ce)+_0x3240f3+'\x22.');await deleteBffScript(_0x15dcf6['remoteId']),delete _0x56dbe4[_0x3055fa(0x1e1)][_0x3240f3],_0x56dbe4[_0x3055fa(0x1ee)]=new Date()['toISOString'](),await writeBffLockFile(_0x23dd6c['lockFilePath'],_0x5ba018);const _0x3ee12a=resolveLocalFilePathFromLockKey(_0x23dd6c,_0x3240f3);let _0x1d8a41;await fileExists(_0x3ee12a)&&(_0x1d8a41=await moveToTrash(_0x23dd6c[_0x3055fa(0x1f1)],_0x23dd6c['trashDir'],_0x3ee12a),await cleanupEmptyDirectories(dirname(_0x3ee12a),_0x23dd6c[_0x3055fa(0x1db)]));await waitForDeleteSettlement(_0x23dd6c[_0x3055fa(0x1d3)],_0x2753b1[_0x3055fa(0x1d1)],_0x3240f3,_0x3ee12a),await sleep(0x96);const _0x911190={'deleted':_0x3240f3,'remoteId':_0x15dcf6[_0x3055fa(0x1fb)]};if(_0x1d8a41)_0x911190[_0x3055fa(0x1ff)]=_0x1d8a41;return{'ok':!![],'data':_0x911190,'message':_0x3055fa(0x1d0)+_0x3240f3+(_0x1d8a41?_0x3055fa(0x1e8):'')};}};function resolveDeleteTarget(_0x3adb19,_0x404418){const _0x5dc50a=a37_0x50eb36;if(_0x3adb19[_0x5dc50a(0x1fe)]('/')){const _0x4ddc3d=_0x404418[_0x5dc50a(0x1c9)](_0x3cb548=>_0x3cb548===_0x3adb19);if(!_0x4ddc3d)throw CliErrors[_0x5dc50a(0x1d8)](_0x5dc50a(0x1fa)+_0x3adb19);return _0x4ddc3d;}const _0x45c6df=_0x404418[_0x5dc50a(0x1f0)](_0x327993=>_0x327993[_0x5dc50a(0x1ef)]('/')['at'](-0x1)===_0x3adb19);if(_0x45c6df[_0x5dc50a(0x1f7)]===0x0)throw CliErrors[_0x5dc50a(0x1d8)](_0x5dc50a(0x1fa)+_0x3adb19);if(_0x45c6df[_0x5dc50a(0x1f7)]>0x1)throw CliErrors[_0x5dc50a(0x1d8)](_0x5dc50a(0x1df)+_0x3adb19+_0x5dc50a(0x1ec)+_0x45c6df[_0x5dc50a(0x1cd)](_0x18312d=>_0x5dc50a(0x1e5)+_0x18312d)['join']('\x0a'));return _0x45c6df[0x0];}async function moveToTrash(_0x106a8e,_0x3ac8a5,_0x35e0e8){const _0x19af8d=a37_0x50eb36,_0x3b2ba6=new Date()[_0x19af8d(0x1dc)]()[_0x19af8d(0x1d9)](/[:.]/g,'-'),_0x1aec86=relative(_0x106a8e,_0x35e0e8),_0x31bf97=join(_0x3ac8a5,_0x3b2ba6,_0x1aec86);return await mkdir(dirname(_0x31bf97),{'recursive':!![]}),await rename(_0x35e0e8,_0x31bf97),_0x31bf97;}async function cleanupEmptyDirectories(_0x545ed3,_0x204837){const _0x1100f6=a37_0x50eb36;let _0x546155=resolve(_0x545ed3);const _0x1b8cea=resolve(_0x204837);while(_0x546155['startsWith'](''+_0x1b8cea+sep)||_0x546155===_0x1b8cea){if(_0x546155===_0x1b8cea)return;try{const _0x3b879a=await readdir(_0x546155);if(_0x3b879a[_0x1100f6(0x1f7)]>0x0)return;await rmdir(_0x546155);}catch{return;}_0x546155=dirname(_0x546155);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x11500f,_0x5b03d0,_0x27950e,_0x1d6089){const _0x5511c1=a37_0x50eb36;for(let _0x3d6fb6=0x0;_0x3d6fb6<DELETE_SETTLE_RETRY_COUNT;_0x3d6fb6+=0x1){const _0x5311be=await readBffLockFile(_0x11500f),_0x4577a7=!!_0x5311be?.[_0x5511c1(0x1d5)]?.[_0x5b03d0]?.[_0x5511c1(0x1e1)]?.[_0x27950e],_0x432f2c=await fileExists(_0x1d6089);if(!_0x4577a7&&!_0x432f2c)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error(_0x5511c1(0x1f8)+_0x27950e+'.');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a38_0x532ca5=a38_0xed54;(function(_0x4140b2,_0x3e7ad2){const _0x4dd535=a38_0xed54,_0x3375bb=_0x4140b2();while(!![]){try{const _0x4c8f9b=-parseInt(_0x4dd535(0xd6))/0x1+-parseInt(_0x4dd535(0xe1))/0x2*(parseInt(_0x4dd535(0xde))/0x3)+parseInt(_0x4dd535(0xcb))/0x4+parseInt(_0x4dd535(0xd2))/0x5*(parseInt(_0x4dd535(0xd0))/0x6)+parseInt(_0x4dd535(0xcc))/0x7+parseInt(_0x4dd535(0xcd))/0x8+-parseInt(_0x4dd535(0xd3))/0x9*(-parseInt(_0x4dd535(0xd7))/0xa);if(_0x4c8f9b===_0x3e7ad2)break;else _0x3375bb['push'](_0x3375bb['shift']());}catch(_0x22dcfe){_0x3375bb['push'](_0x3375bb['shift']());}}}(a38_0x56da,0xc8e8b));function a38_0x56da(){const _0x3eea1d=['138BBOeEg','number','21960fyQrfk','9wQoaPL','version','scriptContent','1519826xhNbrP','1213780zKFgqf','num','detail','read','(none)','description','verbose','4863yveBzZ','bff','scriptType','278UeVhRE','boolean','createdTime','functionName','updateUserName','132616FdTzDo','5663364KVTULt','12027744mRuwof','bool','Get\x20Backend\x20Function\x20script\x20details\x20by\x20ID'];a38_0x56da=function(){return _0x3eea1d;};return a38_0x56da();}import{getBffScriptInfo}from'../../core/api-client.js';function a38_0xed54(_0x1c079a,_0x5719ec){_0x1c079a=_0x1c079a-0xca;const _0x56da61=a38_0x56da();let _0xed5456=_0x56da61[_0x1c079a];return _0xed5456;}export const bffDetail={'service':a38_0x532ca5(0xdf),'command':a38_0x532ca5(0xd9),'description':a38_0x532ca5(0xcf),'risk':a38_0x532ca5(0xda),'flags':[{'name':'id','type':a38_0x532ca5(0xd1),'required':!![],'description':'Script\x20ID'},{'name':a38_0x532ca5(0xdd),'type':a38_0x532ca5(0xe2),'description':'Return\x20full\x20raw\x20script\x20object'}],async 'execute'(_0x4bbe9f){const _0x11d936=a38_0x532ca5,_0x4525eb=await getBffScriptInfo(_0x4bbe9f[_0x11d936(0xd8)]('id')),_0x21ddda=_0x4bbe9f[_0x11d936(0xce)]('verbose');if(_0x21ddda)return{'ok':!![],'data':_0x4525eb};return{'ok':!![],'data':{'id':_0x4525eb['id'],'functionName':_0x4525eb[_0x11d936(0xe4)]??'','version':_0x4525eb[_0x11d936(0xd4)]??'','updateUserName':_0x4525eb[_0x11d936(0xca)]??'','appCode':_0x4525eb['appCode'],'scriptType':_0x4525eb[_0x11d936(0xe0)],'description':_0x4525eb[_0x11d936(0xdc)]||_0x11d936(0xdb),'createdTime':_0x4525eb[_0x11d936(0xe3)]??'','updatedTime':_0x4525eb['updatedTime']??'','scriptContent':_0x4525eb[_0x11d936(0xd5)]??''}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x57379c,_0x6fb29b){const _0x200395=a39_0xf05b,_0x3cb6c=_0x57379c();while(!![]){try{const _0x45c120=parseInt(_0x200395(0xb7))/0x1+parseInt(_0x200395(0xba))/0x2*(-parseInt(_0x200395(0xbf))/0x3)+-parseInt(_0x200395(0xb8))/0x4*(-parseInt(_0x200395(0xc0))/0x5)+parseInt(_0x200395(0xbd))/0x6+parseInt(_0x200395(0xbc))/0x7+-parseInt(_0x200395(0xbb))/0x8+-parseInt(_0x200395(0xbe))/0x9*(parseInt(_0x200395(0xb9))/0xa);if(_0x45c120===_0x6fb29b)break;else _0x3cb6c['push'](_0x3cb6c['shift']());}catch(_0x52028a){_0x3cb6c['push'](_0x3cb6c['shift']());}}}(a39_0x1776,0x61097));import{bffList}from'../../commands/bff/list.js';function a39_0x1776(){const _0x295723=['2331822EoIwXs','5GRThzj','268805mYtqRb','3115516sXXtUH','11233070tNOobb','2PIWJtr','40560EjUwYt','5010852AjQXVv','3237564rVgKZs','9SueEqs'];a39_0x1776=function(){return _0x295723;};return a39_0x1776();}import{bffDetail}from'../../commands/bff/detail.js';function a39_0xf05b(_0x105fa1,_0x2162b1){_0x105fa1=_0x105fa1-0xb7;const _0x17769a=a39_0x1776();let _0xf05b48=_0x17769a[_0x105fa1];return _0xf05b48;}import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';import{bffLogs}from'../../commands/bff/logs.js';export const bffDefinitions=[bffList,bffDetail,bffLogs,bffStatus,bffCreate,bffPush,bffPull,bffDelete];
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a40_0x4738e3=a40_0x20d5;(function(_0x3a2200,_0x1cd64b){const _0x431a4b=a40_0x20d5,_0x404ae2=_0x3a2200();while(!![]){try{const _0x3461df=-parseInt(_0x431a4b(0xe8))/0x1+-parseInt(_0x431a4b(0xe5))/0x2*(-parseInt(_0x431a4b(0xe4))/0x3)+-parseInt(_0x431a4b(0xe7))/0x4+-parseInt(_0x431a4b(0xe9))/0x5+parseInt(_0x431a4b(0xd8))/0x6*(parseInt(_0x431a4b(0xda))/0x7)+parseInt(_0x431a4b(0xd2))/0x8+-parseInt(_0x431a4b(0xde))/0x9;if(_0x3461df===_0x1cd64b)break;else _0x404ae2['push'](_0x404ae2['shift']());}catch(_0x57740e){_0x404ae2['push'](_0x404ae2['shift']());}}}(a40_0x5725,0xcb6bc));function a40_0x5725(){const _0x366629=['type','7209153VEnYNW','name','bool','list','COMMON','Return\x20full\x20script\x20objects','11679AkTJhd','810ErxNGY','Filter\x20by\x20script\x20name','3686948IKivuy','829297fxQTwa','639940NKrJLD','scriptType','Script\x20type\x20filter','description','3586944retSWI','boolean','verbose','(unnamed)','str','length','8929308eaEPYo','List\x20Backend\x20Function\x20scripts','7hbpyyI','No\x20Backend\x20Function\x20scripts\x20found.','ENDPOINT'];a40_0x5725=function(){return _0x366629;};return a40_0x5725();}function a40_0x20d5(_0x412ff4,_0x4a2aa1){_0x412ff4=_0x412ff4-0xd0;const _0x57257e=a40_0x5725();let _0x20d5ee=_0x57257e[_0x412ff4];return _0x20d5ee;}import{listBffScripts}from'../../core/api-client.js';export const bffList={'service':'bff','command':a40_0x4738e3(0xe1),'description':a40_0x4738e3(0xd9),'risk':'read','flags':[{'name':'type','type':'string','description':a40_0x4738e3(0xd0),'default':a40_0x4738e3(0xdc),'enum':['ENDPOINT',a40_0x4738e3(0xe2)]},{'name':a40_0x4738e3(0xdf),'type':'string','description':a40_0x4738e3(0xe6)},{'name':a40_0x4738e3(0xd4),'type':a40_0x4738e3(0xd3),'description':a40_0x4738e3(0xe3)}],async 'execute'(_0x5963c3){const _0x3ff205=a40_0x4738e3,_0x2c9147=await listBffScripts(_0x5963c3['appCode'],_0x5963c3['str'](_0x3ff205(0xdd)),{'scriptName':_0x5963c3[_0x3ff205(0xd6)](_0x3ff205(0xdf))||undefined}),_0x14e66c=_0x5963c3[_0x3ff205(0xe0)](_0x3ff205(0xd4));return{'ok':!![],'data':_0x14e66c?_0x2c9147:_0x2c9147['map'](_0x9dd5c1=>({'id':_0x9dd5c1['id'],'functionName':_0x9dd5c1['functionName']??'','description':_0x9dd5c1[_0x3ff205(0xd1)]||_0x3ff205(0xd5),'scriptType':_0x9dd5c1[_0x3ff205(0xea)]})),'message':_0x2c9147[_0x3ff205(0xd7)]===0x0?_0x3ff205(0xdb):undefined};}};
|
package/lib/commands/bff/logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x2fd151=a41_0x593a;(function(_0x4a7ed3,_0x553ceb){const _0x37a94b=a41_0x593a,_0x351b6d=_0x4a7ed3();while(!![]){try{const _0x21c64b=parseInt(_0x37a94b(0xf2))/0x1*(-parseInt(_0x37a94b(0xeb))/0x2)+-parseInt(_0x37a94b(0xf1))/0x3*(-parseInt(_0x37a94b(0xf5))/0x4)+parseInt(_0x37a94b(0xef))/0x5*(-parseInt(_0x37a94b(0xe2))/0x6)+parseInt(_0x37a94b(0xfd))/0x7*(-parseInt(_0x37a94b(0xfe))/0x8)+-parseInt(_0x37a94b(0xd7))/0x9+-parseInt(_0x37a94b(0xe5))/0xa*(parseInt(_0x37a94b(0xd2))/0xb)+parseInt(_0x37a94b(0xe1))/0xc;if(_0x21c64b===_0x553ceb)break;else _0x351b6d['push'](_0x351b6d['shift']());}catch(_0xe043af){_0x351b6d['push'](_0x351b6d['shift']());}}}(a41_0xfe55,0xf2ed8));import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a41_0x593a(_0x3ec895,_0xb00c42){_0x3ec895=_0x3ec895-0xce;const _0xfe55dd=a41_0xfe55();let _0x593ae0=_0xfe55dd[_0x3ec895];return _0x593ae0;}import{searchBffScriptLogs}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';const DEFAULT_SINCE_MINUTES=0x1e,DEFAULT_LIMIT=0xc8,MAX_LIMIT=0x3e8,LOG_LEVELS=[a41_0x2fd151(0xde),a41_0x2fd151(0xe6),a41_0x2fd151(0xf0),a41_0x2fd151(0xcf)];export function resolveBffLogQuery(_0x5e617a,_0x52df58=Date[a41_0x2fd151(0xe7)]()){const _0x2974f8=a41_0x2fd151,_0x182a9f=_0x5e617a['flag']('since'),_0xd1bf8e=_0x5e617a[_0x2974f8(0xf7)](_0x2974f8(0xd6)),_0x3b2e8e=_0x5e617a['flag'](_0x2974f8(0x101));if(_0x182a9f!==undefined&&_0xd1bf8e!==undefined)throw CliErrors['validation'](_0x2974f8(0xd3));const _0x46ec05=_0x3b2e8e===undefined?_0x52df58:readPositiveInteger(_0x5e617a['num'](_0x2974f8(0x101)),_0x2974f8(0xfa)),_0x1642ac=_0xd1bf8e===undefined?_0x46ec05-readSinceMinutes(_0x5e617a)*0xea60:readPositiveInteger(_0x5e617a['num'](_0x2974f8(0xd6)),_0x2974f8(0xf6));if(_0x1642ac<=0x0)throw CliErrors[_0x2974f8(0xd5)](_0x2974f8(0xec));if(_0x1642ac>_0x46ec05)throw CliErrors[_0x2974f8(0xd5)](_0x2974f8(0xce));const _0x1cf838=readPositiveInteger(_0x5e617a[_0x2974f8(0xe0)](_0x2974f8(0xdd),DEFAULT_LIMIT),_0x2974f8(0xf4));if(_0x1cf838>MAX_LIMIT)throw CliErrors['validation'](_0x2974f8(0xff)+MAX_LIMIT+'.');const _0xa70fc8=_0x5e617a['str'](_0x2974f8(0xf3))[_0x2974f8(0xdb)]()[_0x2974f8(0xd0)]()||undefined,_0x3d6a0e=_0x5e617a[_0x2974f8(0xea)](_0x2974f8(0xd1))[_0x2974f8(0xdb)]()||undefined;return{'appCode':_0x5e617a[_0x2974f8(0xd9)],'startTime':_0x1642ac,'endTime':_0x46ec05,..._0xd1bf8e===undefined?{'sinceMinutes':readSinceMinutes(_0x5e617a)}:{},..._0xa70fc8?{'level':_0xa70fc8}:{},..._0x3d6a0e?{'keyword':_0x3d6a0e}:{},'limit':_0x1cf838};}function a41_0xfe55(){const _0x41d868=['6378300vmaDxG','--start-time','flag','isSafeInteger','logs','--end-time','since','Query\x20start\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds','148568lmjLjp','560CeZozs','--limit\x20must\x20be\x20between\x201\x20and\x20','Query\x20end\x20time\x20as\x20a\x20Unix\x20timestamp\x20in\x20milliseconds\x20(default:\x20now)','end-time','--start-time\x20must\x20be\x20less\x20than\x20or\x20equal\x20to\x20--end-time.','ERROR','toUpperCase','keyword','11IhdVHa','--since\x20cannot\x20be\x20combined\x20with\x20--start-time.','\x20must\x20be\x20a\x20positive\x20integer.','validation','start-time','17573022hUEiSE','Filter\x20by\x20log\x20level','appCode','Filter\x20formatted\x20log\x20lines\x20by\x20keyword','trim','Found\x20','limit','DEBUG','Minutes\x20before\x20the\x20end\x20time\x20to\x20query\x20(default:\x20','num','72778872NQGXGw','2430rmdaLV','No\x20Backend\x20Function\x20logs\x20found\x20for\x20the\x20selected\x20range.','\x20Backend\x20Function\x20log\x20line(s).','2656420xEIoAQ','INFO','now','string','Maximum\x20log\x20lines\x20to\x20return\x20(1-','str','2AWAqYQ','The\x20resolved\x20log\x20start\x20time\x20must\x20be\x20greater\x20than\x200.','number','length','18235PHdvKS','WARN','3CyuOXI','1483534AqHdbZ','level','--limit'];a41_0xfe55=function(){return _0x41d868;};return a41_0xfe55();}function readSinceMinutes(_0x50821c){const _0x140376=a41_0x2fd151;return readPositiveInteger(_0x50821c['num'](_0x140376(0xfb),DEFAULT_SINCE_MINUTES),'--since');}function readPositiveInteger(_0x55e898,_0x55d8f2){const _0x3e6872=a41_0x2fd151;if(!Number[_0x3e6872(0xf8)](_0x55e898)||_0x55e898<=0x0)throw CliErrors[_0x3e6872(0xd5)](_0x55d8f2+_0x3e6872(0xd4));return _0x55e898;}export const bffLogs={'service':'bff','command':a41_0x2fd151(0xf9),'description':'Query\x20recent\x20Backend\x20Function\x20runtime\x20logs\x20for\x20development\x20debugging','risk':'read','structuredErrors':!![],'flags':[APPCODE_FLAG_OPTIONAL,{'name':a41_0x2fd151(0xfb),'type':a41_0x2fd151(0xed),'description':a41_0x2fd151(0xdf)+DEFAULT_SINCE_MINUTES+')'},{'name':a41_0x2fd151(0xd6),'type':'number','description':a41_0x2fd151(0xfc)},{'name':a41_0x2fd151(0x101),'type':a41_0x2fd151(0xed),'description':a41_0x2fd151(0x100)},{'name':'level','type':a41_0x2fd151(0xe8),'description':a41_0x2fd151(0xd8),'enum':LOG_LEVELS},{'name':'keyword','type':a41_0x2fd151(0xe8),'description':a41_0x2fd151(0xda)},{'name':a41_0x2fd151(0xdd),'type':a41_0x2fd151(0xed),'description':a41_0x2fd151(0xe9)+MAX_LIMIT+')','default':DEFAULT_LIMIT}],async 'validate'(_0x101a7f){resolveBffLogQuery(_0x101a7f);},async 'execute'(_0x3a1d1f){const _0x27c48b=a41_0x2fd151,_0x3c2cc5=resolveBffLogQuery(_0x3a1d1f),{sinceMinutes:_0x3566fd,..._0x4042e9}=_0x3c2cc5,_0x214c4e=await searchBffScriptLogs(_0x4042e9);return{'ok':!![],'data':{'query':_0x3c2cc5,'count':_0x214c4e['length'],'logs':_0x214c4e},'message':_0x214c4e[_0x27c48b(0xee)]===0x0?_0x27c48b(0xe3):_0x27c48b(0xdc)+_0x214c4e[_0x27c48b(0xee)]+_0x27c48b(0xe4)};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a37_0x388fe5=a37_0xc32f;(function(_0x21c068,_0x1db5d0){const _0x4fd599=a37_0xc32f,_0x30221f=_0x21c068();while(!![]){try{const _0x3bc70a=-parseInt(_0x4fd599(0x12c))/0x1*(parseInt(_0x4fd599(0x18f))/0x2)+parseInt(_0x4fd599(0x11c))/0x3*(parseInt(_0x4fd599(0x19c))/0x4)+parseInt(_0x4fd599(0x11d))/0x5*(parseInt(_0x4fd599(0x159))/0x6)+-parseInt(_0x4fd599(0x191))/0x7+parseInt(_0x4fd599(0x14f))/0x8*(-parseInt(_0x4fd599(0x11a))/0x9)+parseInt(_0x4fd599(0x16d))/0xa+parseInt(_0x4fd599(0x136))/0xb*(parseInt(_0x4fd599(0x187))/0xc);if(_0x3bc70a===_0x1db5d0)break;else _0x30221f['push'](_0x30221f['shift']());}catch(_0x15a9a8){_0x30221f['push'](_0x30221f['shift']());}}}(a37_0xc97c,0xebbcc));import{createInterface}from'node:readline';import{readFile,rename,stat,unlink,writeFile}from'node:fs/promises';import{randomUUID}from'node:crypto';import{dirname,join}from'node:path';import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiFilePath}from'../../context.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';function a37_0xc32f(_0x4e4516,_0x3ce64f){_0x4e4516=_0x4e4516-0x11a;const _0xc97c18=a37_0xc97c();let _0xc32f37=_0xc97c18[_0x4e4516];return _0xc32f37;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':a37_0x388fe5(0x135),'command':a37_0x388fe5(0x15a),'description':'Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','risk':a37_0x388fe5(0x172),'structuredErrors':!![],'flags':[{'name':'type','type':a37_0x388fe5(0x19b),'description':a37_0x388fe5(0x183),'enum':['COMMON',a37_0x388fe5(0x13d),'HOOK']},{'name':a37_0x388fe5(0x14d),'type':'boolean','description':a37_0x388fe5(0x11e)}],async 'dryRun'(_0xb31f22){const _0x56b758=a37_0x388fe5,_0x3105d6=loadBffProjectConfig(_0xb31f22[_0x56b758(0x17e)]),_0x3c7693=await readBffLockFile(_0x3105d6[_0x56b758(0x139)]),{appLock:_0x2313a9}=ensureLockScope(_0x3c7693??createEmptyBffLock(),_0xb31f22[_0x56b758(0x17e)],_0x3105d6[_0x56b758(0x170)],_0x56b758(0x15a)),_0x4990cb=normalizeBffType(_0xb31f22[_0x56b758(0x120)]('type'))??undefined,[_0x2c75c4,_0x1ea3d7]=await Promise[_0x56b758(0x174)]([listBffScripts(_0xb31f22[_0x56b758(0x17e)],_0x4990cb),getBffScriptStatistics(_0xb31f22[_0x56b758(0x17e)])]),_0x52c9da=_0x2c75c4[_0x56b758(0x15e)](_0x1f3d83=>normalizeBffType(_0x1f3d83[_0x56b758(0x16e)])===_0x56b758(0x1a3)),_0x56f43c=_0x52c9da?buildDatasetCodeToAliasMap(_0xb31f22['apiDir'],_0xb31f22[_0x56b758(0x17e)]):new Map(),_0x1c9cb3=_0x52c9da?await planHookDirectoryMigration(_0x3105d6,_0x2313a9,_0x56f43c,await scanLocalBffFunctions(_0x3105d6,_0x56b758(0x1a3))):undefined,_0x4cdbe4=createHookLocationMap(_0x1ea3d7),_0x2dff39=[];for(const _0x3b225e of _0x2c75c4){const _0x2735f8=resolveRemoteScriptTarget(_0x3105d6,_0x3b225e,_0x4cdbe4,_0x1c9cb3?.[_0x56b758(0x198)]??_0x2313a9[_0x56b758(0x121)],_0x56f43c);if(!_0x2735f8){_0x2dff39['push']({'scriptType':_0x3b225e[_0x56b758(0x16e)],'functionName':_0x3b225e['functionName']??'','status':_0x56b758(0x1aa),'reason':_0x56b758(0x143)});continue;}const _0x3234cb=(_0x1c9cb3?.['projectedFunctions']??_0x2313a9[_0x56b758(0x121)])[_0x2735f8[_0x56b758(0x123)]],_0x4c122f=_0x3b225e['scriptContent']!=null?computeContentHash(_0x3b225e[_0x56b758(0x144)]):undefined,_0x4301c8=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x1c9cb3,_0x2735f8)??_0x2735f8[_0x56b758(0x13e)],_0x3234cb,_0x4c122f),_0x29b703=_0x4301c8?localUnsyncedConflict(_0x2735f8,_0x3b225e['id']):undefined;_0x2dff39[_0x56b758(0x13f)]({'lockKey':_0x2735f8[_0x56b758(0x123)],'filePath':_0x2735f8[_0x56b758(0x13e)],'remoteId':_0x3b225e['id']??null,'status':_0x29b703?_0x56b758(0x1a4):_0x56b758(0x169),..._0x29b703?{'conflict':_0x29b703}:{},..._0x2735f8['hookLocation']?{'alias':_0x2735f8['hookLocation'][_0x56b758(0x134)]??null,'datasetCode':_0x2735f8['hookLocation'][_0x56b758(0x19d)],'operationType':_0x2735f8[_0x56b758(0x161)][_0x56b758(0x12b)],'functionNode':_0x2735f8[_0x56b758(0x161)][_0x56b758(0x1a6)]}:{}});}return{'method':_0x56b758(0x175),'url':'/api/management/library/scripts/list?appCode='+_0xb31f22[_0x56b758(0x17e)]+(_0x4990cb?_0x56b758(0x167)+_0x4990cb:'')+'¤tPage=1&pageSize='+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0xb31f22[_0x56b758(0x17e)],'filterType':_0x4990cb??null,..._0x1c9cb3&&_0x1c9cb3['migrations'][_0x56b758(0x127)]>0x0?{'hookDirectoryMigrations':_0x1c9cb3[_0x56b758(0x168)][_0x56b758(0x128)](_0x318e98=>({'from':_0x318e98[_0x56b758(0x130)],'to':_0x318e98[_0x56b758(0x182)]}))}:{},'files':_0x2dff39},'description':'Would\x20inspect\x20'+_0x2dff39[_0x56b758(0x127)]+_0x56b758(0x19a)};},async 'execute'(_0x5d1edc){const _0x1d83c9=a37_0x388fe5,_0x30bf65=loadBffProjectConfig(_0x5d1edc[_0x1d83c9(0x17e)]),_0x4115d9=await readBffLockFile(_0x30bf65['lockFilePath']),{lockData:_0x167b1c,appLock:_0x19ec63}=ensureLockScope(_0x4115d9??createEmptyBffLock(),_0x5d1edc['appCode'],_0x30bf65['scriptsRoot'],_0x1d83c9(0x15a)),_0x568fe4=normalizeBffType(_0x5d1edc[_0x1d83c9(0x120)](_0x1d83c9(0x14a)))??undefined;if(_0x5d1edc[_0x1d83c9(0x120)](_0x1d83c9(0x14a))&&!_0x568fe4)throw CliErrors[_0x1d83c9(0x178)](_0x1d83c9(0x14c));const [_0x333a5c,_0x557fe7]=await Promise[_0x1d83c9(0x174)]([listBffScripts(_0x5d1edc[_0x1d83c9(0x17e)],_0x568fe4),getBffScriptStatistics(_0x5d1edc[_0x1d83c9(0x17e)])]);if(_0x333a5c[_0x1d83c9(0x127)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x1d83c9(0x156)};const _0x46a419=_0x5d1edc['bool']('force');if(_0x46a419&&!_0x5d1edc[_0x1d83c9(0x196)]){const _0x13f8b4=await confirmForce();if(!_0x13f8b4)throw CliErrors['cancelled'](_0x1d83c9(0x153));}if(_0x46a419&&_0x5d1edc[_0x1d83c9(0x196)]){}const _0x2ead55=_0x333a5c[_0x1d83c9(0x15e)](_0x1687af=>normalizeBffType(_0x1687af['scriptType'])===_0x1d83c9(0x1a3)),_0xe3b6e9=_0x2ead55?buildDatasetCodeToAliasMap(_0x5d1edc[_0x1d83c9(0x1a5)],_0x5d1edc[_0x1d83c9(0x17e)]):new Map(),_0x35e7e0=createHookLocationMap(_0x557fe7),_0x1819f5=JSON[_0x1d83c9(0x13a)](JSON[_0x1d83c9(0x16b)](_0x167b1c)),_0x546923=_0x5d1edc[_0x1d83c9(0x17e)],_0x32ca42=_0x1819f5[_0x1d83c9(0x19f)][_0x546923];if(!_0x32ca42)throw new Error(_0x1d83c9(0x16c)+_0x546923+_0x1d83c9(0x15f));const _0x16890a=_0x2ead55?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x30bf65,_0x32ca42,_0xe3b6e9,await scanLocalBffFunctions(_0x30bf65,_0x1d83c9(0x1a3))),_0x32ca42):undefined,_0x14de53=createPullFileTransaction(),_0x822413=[],_0x2acba9=[],_0x5bd3a9=[],_0x2e9154=[];for(const _0x3aad22 of _0x333a5c){const _0x31de3b=resolveRemoteScriptTarget(_0x30bf65,_0x3aad22,_0x35e7e0,_0x32ca42['functions'],_0xe3b6e9);if(!_0x31de3b){_0x2acba9['push']({'lockKey':_0x3aad22[_0x1d83c9(0x16e)]+'/'+_0x3aad22['functionName'],'reason':'unresolvable\x20target\x20path'});continue;}const _0x736453=_0x32ca42[_0x1d83c9(0x121)][_0x31de3b[_0x1d83c9(0x123)]];try{if(!_0x3aad22['id'])throw new Error(_0x1d83c9(0x124));if(_0x3aad22[_0x1d83c9(0x144)]==null)throw new Error(_0x1d83c9(0x140));const _0x4c6ce9=_0x3aad22[_0x1d83c9(0x144)],_0x4c7672=computeContentHash(_0x4c6ce9);if(!_0x46a419){const _0x421c4f=await hasUnsyncedLocalChanges(_0x31de3b[_0x1d83c9(0x13e)],_0x736453,_0x4c7672);if(_0x421c4f){_0x5bd3a9[_0x1d83c9(0x13f)](localUnsyncedConflict(_0x31de3b,_0x3aad22['id']));continue;}}await _0x14de53[_0x1d83c9(0x148)](_0x31de3b[_0x1d83c9(0x13e)],_0x4c6ce9);const _0x34ffee={'hash':_0x4c7672,'remoteId':_0x3aad22['id'],'version':_0x3aad22[_0x1d83c9(0x145)]};_0x31de3b[_0x1d83c9(0x14a)]===_0x1d83c9(0x1a3)&&_0x31de3b['hookLocation']&&(_0x34ffee['alias']=_0x31de3b[_0x1d83c9(0x161)]['alias'],_0x34ffee[_0x1d83c9(0x19d)]=_0x31de3b[_0x1d83c9(0x161)][_0x1d83c9(0x19d)],_0x34ffee[_0x1d83c9(0x12b)]=_0x31de3b[_0x1d83c9(0x161)][_0x1d83c9(0x12b)],_0x34ffee[_0x1d83c9(0x1a6)]=_0x31de3b[_0x1d83c9(0x161)][_0x1d83c9(0x1a6)]),_0x32ca42[_0x1d83c9(0x121)][_0x31de3b['lockKey']]=_0x34ffee,_0x822413['push']({'lockKey':_0x31de3b[_0x1d83c9(0x123)],'remoteId':_0x3aad22['id']});}catch(_0x425c4e){_0x2e9154[_0x1d83c9(0x13f)]({'lockKey':_0x31de3b[_0x1d83c9(0x123)],'error':_0x425c4e instanceof Error?_0x425c4e[_0x1d83c9(0x15d)]:String(_0x425c4e)});}}_0x32ca42['lastSync']=new Date()[_0x1d83c9(0x162)]();try{await writeBffLockFile(_0x30bf65[_0x1d83c9(0x139)],_0x1819f5);}catch(_0x5f4e55){const _0x3e531d=[...await _0x14de53['rollback'](),...await _0x16890a?.[_0x1d83c9(0x1a9)]()??[]];throw withRollbackErrors(_0x5f4e55,_0x1d83c9(0x14e),_0x3e531d);}return{'ok':_0x2e9154[_0x1d83c9(0x127)]===0x0,'data':{'pulled':_0x822413,'skipped':_0x2acba9,'conflicts':_0x5bd3a9,'failed':_0x2e9154},'message':formatPullMessage(_0x822413['length'],_0x2acba9[_0x1d83c9(0x127)],_0x5bd3a9[_0x1d83c9(0x127)],_0x2e9154['length'])};}};function localUnsyncedConflict(_0x2aa6a6,_0x3c00b5){const _0x1afc89=a37_0x388fe5,_0x20bd68=_0x2aa6a6[_0x1afc89(0x123)][_0x1afc89(0x131)]('/')['at'](-0x1);return{'code':_0x1afc89(0x199),'lockKey':_0x2aa6a6[_0x1afc89(0x123)],'filePath':_0x2aa6a6[_0x1afc89(0x13e)],..._0x3c00b5!=null?{'remoteId':_0x3c00b5}:{},'message':_0x1afc89(0x173),'nextAction':{'action':_0x1afc89(0x15c),'command':CLI_BIN_NAME+_0x1afc89(0x1a2)+_0x2aa6a6[_0x1afc89(0x14a)]+_0x1afc89(0x1a1)+_0x20bd68+_0x1afc89(0x126),'requiresReview':!![],'message':'If\x20the\x20reviewed\x20local\x20script\x20should\x20win,\x20run\x20this\x20command\x20to\x20update\x20the\x20remote\x20script.\x20Do\x20not\x20use\x20--force\x20to\x20resolve\x20a\x20content\x20conflict.'}};}function formatPullMessage(_0x1159ad,_0x2a9f44,_0x23b771,_0x17617f){const _0x59f02c=a37_0x388fe5,_0x5e0510=[_0x59f02c(0x171)+_0x1159ad+_0x59f02c(0x17d),_0x2a9f44+_0x59f02c(0x163)];_0x23b771>0x0&&_0x5e0510[_0x59f02c(0x13f)](_0x23b771+_0x59f02c(0x18d)+(_0x23b771===0x1?'':'s')+'\x20'+(_0x23b771===0x1?_0x59f02c(0x184):_0x59f02c(0x15b))+_0x59f02c(0x11f));if(_0x17617f>0x0)_0x5e0510['push'](_0x17617f+_0x59f02c(0x193));return _0x5e0510['join'](',\x20');}async function hasUnsyncedLocalChanges(_0x17d15a,_0x19bc6c,_0x3a8417){const _0x771d65=a37_0x388fe5;if(!await fileExists(_0x17d15a))return![];const _0x31518a=await computeFileHash(_0x17d15a);if(!_0x19bc6c)return _0x3a8417?_0x31518a!==_0x3a8417:!![];return _0x31518a!==_0x19bc6c[_0x771d65(0x1ab)];}function createPullFileTransaction(){const _0x2c5790=new Map(),_0x563309=async(_0x3a08ce,_0x54db8e)=>{const _0x19cfc5=a37_0xc32f;try{if(_0x54db8e[_0x19cfc5(0x17a)])await ensureParentDirectory(_0x3a08ce),await writeFile(_0x3a08ce,_0x54db8e[_0x19cfc5(0x165)]);else try{await unlink(_0x3a08ce);}catch(_0x39c96c){if(_0x39c96c[_0x19cfc5(0x188)]!==_0x19cfc5(0x14b))throw _0x39c96c;}return undefined;}catch(_0x20fc64){return _0x20fc64 instanceof Error?_0x20fc64:new Error(String(_0x20fc64));}};return{async 'write'(_0xda249d,_0x4a4327){const _0x48fa2b=a37_0xc32f;if(!_0x2c5790[_0x48fa2b(0x180)](_0xda249d))try{_0x2c5790[_0x48fa2b(0x189)](_0xda249d,{'existed':!![],'content':await readFile(_0xda249d)});}catch(_0x6194ef){if(_0x6194ef[_0x48fa2b(0x188)]!==_0x48fa2b(0x14b))throw _0x6194ef;_0x2c5790[_0x48fa2b(0x189)](_0xda249d,{'existed':![]});}try{await ensureParentDirectory(_0xda249d),await writeFile(_0xda249d,_0x4a4327,_0x48fa2b(0x158));}catch(_0x396c3f){const _0x4a3c0f=await _0x563309(_0xda249d,_0x2c5790[_0x48fa2b(0x157)](_0xda249d));if(!_0x4a3c0f)_0x2c5790[_0x48fa2b(0x12e)](_0xda249d);throw withRollbackErrors(_0x396c3f,_0x48fa2b(0x152)+_0xda249d+'\x22.',_0x4a3c0f?[_0x4a3c0f]:[]);}},async 'rollback'(){const _0x3bada8=a37_0xc32f,_0x27ca3c=[];for(const [_0x576a3a,_0x135898]of[..._0x2c5790['entries']()]['reverse']()){const _0x2025c2=await _0x563309(_0x576a3a,_0x135898);_0x2025c2&&_0x27ca3c['push'](new Error('Could\x20not\x20restore\x20local\x20script\x20\x22'+_0x576a3a+_0x3bada8(0x155)+_0x2025c2[_0x3bada8(0x15d)]));}return _0x27ca3c;}};}function withRollbackErrors(_0x4194ef,_0xb0d1aa,_0x4b8ec3){const _0x1eb9ff=a37_0x388fe5,_0xedfe2b=_0x4194ef instanceof Error?_0x4194ef:new Error(String(_0x4194ef));if(_0x4b8ec3[_0x1eb9ff(0x127)]===0x0)return _0xedfe2b;return new AggregateError([_0xedfe2b,..._0x4b8ec3],_0xb0d1aa+_0x1eb9ff(0x138)+_0x4b8ec3['map'](_0x368671=>_0x368671[_0x1eb9ff(0x15d)])['join'](';\x20'));}function buildDatasetCodeToAliasMap(_0x4c7c0f,_0x264e8b){const _0xab3b50=a37_0x388fe5,_0x318528=loadAliasMap(_0x4c7c0f,undefined,resolveApiFilePath(_0x4c7c0f,_0x264e8b));return assertUnambiguousHookAliases(_0x318528),new Map(_0x318528[_0xab3b50(0x128)](_0xc16d5c=>[_0xc16d5c[_0xab3b50(0x19d)][_0xab3b50(0x1a0)](),_0xc16d5c[_0xab3b50(0x134)]]));}async function planHookDirectoryMigration(_0x5f0b50,_0x9d1ee1,_0x252769,_0x8000a9){const _0x252a3f=a37_0x388fe5,_0x23156d=new Map();for(const [_0x4f6481,_0x412830]of Object['entries'](_0x9d1ee1[_0x252a3f(0x121)])){const [_0xbdba65,_0x25c8d9,_0x3e7042,_0x4e7754,_0x5586e3,..._0xdf7f44]=_0x4f6481[_0x252a3f(0x131)]('/');if(_0xbdba65!==_0x252a3f(0x1a3)||!_0x25c8d9||!_0x3e7042||!_0x4e7754||!_0x5586e3||_0xdf7f44['length']>0x0||!_0x412830[_0x252a3f(0x19d)])continue;const _0x5e0bef=_0x252769[_0x252a3f(0x157)](_0x412830[_0x252a3f(0x19d)][_0x252a3f(0x1a0)]()),_0xa70268=_0x5e0bef??_0x412830['datasetCode'];if(!isSafeHookDirectorySegment(_0x25c8d9))throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x154)+_0x25c8d9+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0xa70268))throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x13c)+_0x25c8d9+'\x22:\x20its\x20target\x20directory\x20is\x20unsafe.');if(_0x25c8d9===_0xa70268)continue;const _0x2383e9=_0x23156d[_0x252a3f(0x157)](_0x25c8d9)??{'datasetCode':_0x412830[_0x252a3f(0x19d)],'alias':_0x5e0bef,'keyChanges':[]};if(_0x2383e9[_0x252a3f(0x19d)]!==_0x412830[_0x252a3f(0x19d)])throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x13c)+_0x25c8d9+_0x252a3f(0x137));const _0x1613dd=_0x252a3f(0x194)+_0xa70268+'/'+_0x3e7042+'/'+_0x4e7754+'/'+_0x5586e3;try{resolveLocalFilePathFromLockKey(_0x5f0b50,_0x4f6481),resolveLocalFilePathFromLockKey(_0x5f0b50,_0x1613dd);}catch(_0x34ba68){throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x186)+_0x4f6481+_0x252a3f(0x155)+(_0x34ba68 instanceof Error?_0x34ba68[_0x252a3f(0x15d)]:String(_0x34ba68)));}_0x2383e9[_0x252a3f(0x179)]['push']({'oldLockKey':_0x4f6481,'newLockKey':_0x1613dd,'entry':_0x412830}),_0x23156d[_0x252a3f(0x189)](_0x25c8d9,_0x2383e9);}const _0x57ca33=new Set([..._0x23156d[_0x252a3f(0x11b)]()][_0x252a3f(0x133)](_0x159f09=>_0x159f09[_0x252a3f(0x179)][_0x252a3f(0x128)](_0x18bd17=>_0x18bd17[_0x252a3f(0x192)]))),_0x4cd525=new Map(),_0x15fa76=new Map();for(const [_0x6a83ad,_0x5edfee]of _0x23156d){const _0x5dbf39=_0x5edfee['alias']??_0x5edfee[_0x252a3f(0x19d)],_0x1439a3=hookDirectoryIdentity(_0x5dbf39),_0x3fca59=_0x4cd525[_0x252a3f(0x157)](_0x1439a3);if(_0x3fca59&&_0x3fca59!==_0x6a83ad)throw CliErrors[_0x252a3f(0x178)]('Cannot\x20migrate\x20HOOK\x20directories\x20\x22'+_0x3fca59+_0x252a3f(0x160)+_0x6a83ad+_0x252a3f(0x1a8)+_0x5dbf39+_0x252a3f(0x141));_0x4cd525[_0x252a3f(0x189)](_0x1439a3,_0x6a83ad);for(const _0x2d0cbc of _0x5edfee[_0x252a3f(0x179)]){const _0x5cd9ab=_0x15fa76[_0x252a3f(0x157)](_0x2d0cbc[_0x252a3f(0x17f)]);if(_0x5cd9ab&&_0x5cd9ab!==_0x2d0cbc[_0x252a3f(0x192)])throw CliErrors[_0x252a3f(0x178)]('Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22'+_0x5cd9ab+_0x252a3f(0x160)+_0x2d0cbc[_0x252a3f(0x192)]+_0x252a3f(0x1a8)+_0x2d0cbc[_0x252a3f(0x17f)]+_0x252a3f(0x146));if(_0x57ca33[_0x252a3f(0x180)](_0x2d0cbc[_0x252a3f(0x17f)]))throw CliErrors['validation']('Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22'+_0x2d0cbc['oldLockKey']+_0x252a3f(0x151)+_0x2d0cbc['newLockKey']+'\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.');_0x15fa76[_0x252a3f(0x189)](_0x2d0cbc['newLockKey'],_0x2d0cbc['oldLockKey']);}}const _0x40550b=new Map();for(const [_0x202bb1,_0x2e856a]of _0x252769){_0x40550b[_0x252a3f(0x189)](hookDirectoryIdentity(_0x2e856a),_0x202bb1);}const _0x1e3038=[];for(const [_0x48c375,_0x16fab1]of _0x23156d){const _0xb23a70=_0x16fab1[_0x252a3f(0x134)]??_0x16fab1[_0x252a3f(0x19d)],_0x356f57=join(_0x5f0b50[_0x252a3f(0x18c)],_0x252a3f(0x1a3),_0x48c375),_0x48adf0=join(_0x5f0b50[_0x252a3f(0x18c)],_0x252a3f(0x1a3),_0xb23a70),_0x2e657e=await directoryExists(_0x356f57),_0x2a04e2=await directoryExists(_0x48adf0),_0x42db59=_0x2e657e?_0x2a04e2?await sameDirectory(_0x356f57,_0x48adf0)?_0x252a3f(0x185):undefined:'move':_0x252a3f(0x1ad);if(!_0x42db59)throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x13c)+_0x48c375+_0x252a3f(0x166)+_0xb23a70+_0x252a3f(0x190));const _0x8237bd=_0x40550b['get'](hookDirectoryIdentity(_0x48c375));if(_0x8237bd&&_0x8237bd!==_0x16fab1[_0x252a3f(0x19d)][_0x252a3f(0x1a0)]()){const _0x6a5bb1=new Set(_0x16fab1[_0x252a3f(0x179)]['map'](_0x196bc4=>_0x196bc4[_0x252a3f(0x192)])),_0x50b983=_0x8000a9[_0x252a3f(0x12a)](_0x5a7018=>_0x5a7018[_0x252a3f(0x14a)]===_0x252a3f(0x1a3)&&_0x5a7018[_0x252a3f(0x134)]!=null&&hookDirectoryIdentity(_0x5a7018[_0x252a3f(0x134)])===hookDirectoryIdentity(_0x48c375)&&!_0x6a5bb1[_0x252a3f(0x180)](_0x5a7018[_0x252a3f(0x123)]));if(_0x50b983['length']>0x0)throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x13c)+_0x48c375+_0x252a3f(0x129));}const _0x49e5ae=_0x40550b[_0x252a3f(0x157)](hookDirectoryIdentity(_0xb23a70));if(_0x49e5ae&&_0x49e5ae!==_0x16fab1[_0x252a3f(0x19d)][_0x252a3f(0x1a0)]())throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x13c)+_0x48c375+_0x252a3f(0x166)+_0xb23a70+_0x252a3f(0x164));for(const _0x2bacb0 of _0x16fab1[_0x252a3f(0x179)]){const _0x4dfa32=_0x9d1ee1[_0x252a3f(0x121)][_0x2bacb0[_0x252a3f(0x17f)]];if(_0x4dfa32&&!_0x57ca33['has'](_0x2bacb0[_0x252a3f(0x17f)])&&!sameHookIdentity(_0x2bacb0[_0x252a3f(0x177)],_0x4dfa32))throw CliErrors[_0x252a3f(0x178)](_0x252a3f(0x13c)+_0x48c375+_0x252a3f(0x166)+_0xb23a70+_0x252a3f(0x12f));}_0x1e3038[_0x252a3f(0x13f)]({'oldDirectory':_0x48c375,'newDirectory':_0xb23a70,'oldDirectoryPath':_0x356f57,'newDirectoryPath':_0x48adf0,'mode':_0x42db59,'alias':_0x16fab1['alias'],'keyChanges':_0x16fab1['keyChanges']});}const _0x41923a={..._0x9d1ee1['functions']},_0x2a410=new Map(),_0x19e943=new Map();for(const _0x12443f of _0x1e3038){const _0x22cd15=_0x12443f[_0x252a3f(0x19e)]!==_0x252a3f(0x1ad);_0x22cd15&&_0x19e943[_0x252a3f(0x189)](hookDirectoryIdentity(_0x12443f[_0x252a3f(0x182)]),_0x12443f[_0x252a3f(0x149)]);for(const _0x3653a7 of _0x12443f[_0x252a3f(0x179)]){const _0x4edb68=_0x41923a[_0x3653a7['newLockKey']],_0x25942d=_0x22cd15?_0x3653a7[_0x252a3f(0x177)]:_0x4edb68??_0x3653a7[_0x252a3f(0x177)];_0x41923a[_0x3653a7[_0x252a3f(0x17f)]]=canonicalizeHookEntry(_0x25942d,_0x12443f[_0x252a3f(0x134)]),delete _0x41923a[_0x3653a7[_0x252a3f(0x192)]],_0x22cd15&&_0x2a410['set'](_0x3653a7[_0x252a3f(0x17f)],resolveLocalFilePathFromLockKey(_0x5f0b50,_0x3653a7[_0x252a3f(0x192)]));}}return{'migrations':_0x1e3038,'projectedFunctions':_0x41923a,'sourceFilePathByNewLockKey':_0x2a410,'sourceDirectoryPathByNewDirectory':_0x19e943};}function resolveMigratedSourceFilePath(_0x40dcd8,_0x24864f){const _0x5ae936=a37_0x388fe5;if(!_0x40dcd8||!_0x24864f)return undefined;const _0x53cc1a=_0x40dcd8[_0x5ae936(0x125)][_0x5ae936(0x157)](_0x24864f[_0x5ae936(0x123)]);if(_0x53cc1a)return _0x53cc1a;if(_0x24864f['type']!==_0x5ae936(0x1a3))return undefined;const [,_0x1bc043,..._0x4c147e]=_0x24864f[_0x5ae936(0x123)][_0x5ae936(0x131)]('/');if(!_0x1bc043||_0x4c147e['length']===0x0)return undefined;const _0x11d93c=_0x40dcd8[_0x5ae936(0x181)][_0x5ae936(0x157)](hookDirectoryIdentity(_0x1bc043));return _0x11d93c?join(_0x11d93c,..._0x4c147e)+_0x5ae936(0x18b):undefined;}function sameHookIdentity(_0x155a20,_0x19dc85){const _0x5c10d6=a37_0x388fe5;return _0x155a20[_0x5c10d6(0x12d)]===_0x19dc85[_0x5c10d6(0x12d)]&&_0x155a20[_0x5c10d6(0x19d)]===_0x19dc85[_0x5c10d6(0x19d)]&&_0x155a20['operationType']===_0x19dc85[_0x5c10d6(0x12b)]&&_0x155a20[_0x5c10d6(0x1a6)]===_0x19dc85[_0x5c10d6(0x1a6)];}function canonicalizeHookEntry(_0x23dcd9,_0x4c07fe){const {alias:_0x346f4c,..._0xab5d28}=_0x23dcd9;return _0x4c07fe?{..._0xab5d28,'alias':_0x4c07fe}:_0xab5d28;}function hookDirectoryIdentity(_0x380c63){const _0x562763=a37_0x388fe5;return _0x380c63['normalize'](_0x562763(0x18a))['toLowerCase']();}function a37_0xc97c(){const _0x3ae493=['14007540RjkcFA','code','set','NFC','.js','scriptsRootDir','\x20conflict','stdin','2yLRCZf','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','5022514BnFjvx','oldLockKey','\x20failed','HOOK/','ino','nonInteractive','yes','projectedFunctions','BFF_LOCAL_UNSYNCED','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','string','4544IdEQlY','datasetCode','mode','apps','toLowerCase','\x20--name\x20','\x20bff\x20push\x20--type\x20','HOOK','conflict','apiDir','functionNode','\x22;\x20temporary\x20directory\x20\x22','\x22:\x20both\x20target\x20\x22','rollback','skipped','hash','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','rekey','197937hCtPrT','values','2118ljGJsD','5711105etqyYx','Force\x20overwrite\x20local\x20unsynced\x20changes','\x20resolution','str','functions','\x22\x20from\x20\x22','lockKey','Remote\x20script\x20missing\x20id.','sourceFilePathByNewLockKey','\x20--format\x20compress','length','map','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','filter','operationType','1121699rfgOGu','remoteId','delete','\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','oldDirectory','split','close','flatMap','alias','bff','11CEcicB','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','\x20Recovery\x20errors:\x20','lockFilePath','parse','stderr','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','ENDPOINT','filePath','push','Remote\x20script\x20missing\x20content.','\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.','trim','unresolvable\x20target\x20path','scriptContent','version','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','write','oldDirectoryPath','type','ENOENT','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','force','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','352ivBqBb','newDirectoryPath','\x22:\x20its\x20target\x20\x22','Failed\x20to\x20write\x20local\x20script\x20\x22','Force\x20pull\x20cancelled.','Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22','\x22:\x20','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','get','utf8','6sZsGEl','pull','require','push_local','message','some','\x22\x20not\x20found\x20after\x20ensureLockScope.','\x22\x20and\x20\x22','hookLocation','toISOString','\x20skipped','\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','content','\x22\x20to\x20\x22','&type=','migrations','would_pull','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','stringify','Lock\x20scope\x20for\x20app\x20\x22','6609410FeGDiL','scriptType','question','scriptsRoot','Pull\x20complete:\x20','read','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','all','GET','dev','entry','validation','keyChanges','existed','Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','lastSync','\x20pulled','appCode','newLockKey','has','sourceDirectoryPathByNewDirectory','newDirectory','Pull\x20only\x20this\x20script\x20type','requires','case-rename','Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'];a37_0xc97c=function(){return _0x3ae493;};return a37_0xc97c();}function isSafeHookDirectorySegment(_0x651970){return isSafeLockKeySegment(_0x651970);}async function sameDirectory(_0x2cc64f,_0x4f41a1){const _0x254ec2=a37_0x388fe5,[_0x569352,_0x541ba2]=await Promise[_0x254ec2(0x174)]([stat(_0x2cc64f),stat(_0x4f41a1)]);return _0x569352['dev']===_0x541ba2[_0x254ec2(0x176)]&&_0x569352[_0x254ec2(0x195)]===_0x541ba2[_0x254ec2(0x195)];}async function applyHookDirectoryMigration(_0x4622c8,_0x4c8ac7){const _0x356e37=a37_0x388fe5,_0x34e6f0=_0x4c8ac7[_0x356e37(0x121)],_0x5c6be4=_0x4c8ac7['lastSync'],_0x2b3c23=[],_0x2850e8=async()=>{const _0x36bb52=_0x356e37,_0x568c49=[];_0x4c8ac7[_0x36bb52(0x121)]=_0x34e6f0,_0x4c8ac7[_0x36bb52(0x17c)]=_0x5c6be4;for(const {migration:_0x50c799,temporaryPath:_0x1acd3b}of[..._0x2b3c23]['reverse']()){try{_0x1acd3b?(await rename(_0x50c799[_0x36bb52(0x150)],_0x1acd3b),await rename(_0x1acd3b,_0x50c799[_0x36bb52(0x149)])):await rename(_0x50c799[_0x36bb52(0x150)],_0x50c799['oldDirectoryPath']);}catch(_0x3a5ff2){_0x568c49['push'](new Error(_0x36bb52(0x147)+_0x50c799[_0x36bb52(0x130)]+_0x36bb52(0x122)+_0x50c799[_0x36bb52(0x182)]+_0x36bb52(0x155)+(_0x3a5ff2 instanceof Error?_0x3a5ff2[_0x36bb52(0x15d)]:String(_0x3a5ff2))));}}return _0x568c49;};try{for(const _0x119122 of _0x4622c8[_0x356e37(0x168)]){if(_0x119122['mode']==='move')await ensureParentDirectory(_0x119122[_0x356e37(0x150)]),await rename(_0x119122[_0x356e37(0x149)],_0x119122['newDirectoryPath']),_0x2b3c23[_0x356e37(0x13f)]({'migration':_0x119122});else{if(_0x119122[_0x356e37(0x19e)]===_0x356e37(0x185)){const _0x82798e=join(dirname(_0x119122['oldDirectoryPath']),'.hook-directory-migrate-'+randomUUID());await rename(_0x119122[_0x356e37(0x149)],_0x82798e);try{await rename(_0x82798e,_0x119122[_0x356e37(0x150)]);}catch(_0x4de02c){try{await rename(_0x82798e,_0x119122[_0x356e37(0x149)]);}catch(_0x3d9543){throw withRollbackErrors(_0x4de02c,_0x356e37(0x16a)+_0x119122['oldDirectory']+_0x356e37(0x166)+_0x119122['newDirectory']+_0x356e37(0x1a7)+_0x82798e+'\x22\x20may\x20remain.',[new Error(_0x356e37(0x1ac)+_0x82798e+_0x356e37(0x166)+_0x119122['oldDirectory']+_0x356e37(0x155)+(_0x3d9543 instanceof Error?_0x3d9543[_0x356e37(0x15d)]:String(_0x3d9543)))]);}throw _0x4de02c;}_0x2b3c23[_0x356e37(0x13f)]({'migration':_0x119122,'temporaryPath':_0x82798e});}}}return _0x4c8ac7['functions']=_0x4622c8[_0x356e37(0x198)],{'rollback':_0x2850e8};}catch(_0x27d8b1){const _0x4cba80=await _0x2850e8();throw withRollbackErrors(_0x27d8b1,_0x356e37(0x17b),_0x4cba80);}}async function confirmForce(){const _0x237845=a37_0x388fe5,_0x272b77=createInterface({'input':process[_0x237845(0x18e)],'output':process[_0x237845(0x13b)]}),_0x35bfc4=await new Promise(_0x245d79=>{const _0x56cebc=_0x237845;_0x272b77[_0x56cebc(0x16f)]('Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20',_0x245d79);});return _0x272b77[_0x237845(0x132)](),['y',_0x237845(0x197)]['includes'](_0x35bfc4[_0x237845(0x142)]()[_0x237845(0x1a0)]());}
|
|
1
|
+
const a42_0x4347eb=a42_0xebcf;(function(_0x2cc54f,_0x314e29){const _0x4018e1=a42_0xebcf,_0x5087ab=_0x2cc54f();while(!![]){try{const _0xfd1d28=-parseInt(_0x4018e1(0x1fa))/0x1+-parseInt(_0x4018e1(0x21c))/0x2*(-parseInt(_0x4018e1(0x282))/0x3)+-parseInt(_0x4018e1(0x250))/0x4+parseInt(_0x4018e1(0x227))/0x5*(-parseInt(_0x4018e1(0x272))/0x6)+-parseInt(_0x4018e1(0x268))/0x7*(-parseInt(_0x4018e1(0x25e))/0x8)+parseInt(_0x4018e1(0x275))/0x9+-parseInt(_0x4018e1(0x1f8))/0xa*(parseInt(_0x4018e1(0x1ef))/0xb);if(_0xfd1d28===_0x314e29)break;else _0x5087ab['push'](_0x5087ab['shift']());}catch(_0x1a9b81){_0x5087ab['push'](_0x5087ab['shift']());}}}(a42_0x2151,0x978a3));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_0xebcf(_0x47adca,_0x6daf72){_0x47adca=_0x47adca-0x1eb;const _0x2151e3=a42_0x2151();let _0xebcfa4=_0x2151e3[_0x47adca];return _0xebcfa4;}import{BFF_LIST_PAGE_SIZE,listBffScripts,getBffScriptStatistics}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';import{resolveApiModelSource}from'../../api/model-source.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{createHookLocationMap,directoryExists,ensureParentDirectory,fileExists,isSafeLockKeySegment,normalizeBffType,resolveLocalFilePathFromLockKey,resolveRemoteScriptTarget,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';import{assertUnambiguousHookAliases}from'../../core/bff/hook-directory.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffPull={'service':'bff','command':'pull','description':a42_0x4347eb(0x203),'risk':a42_0x4347eb(0x205),'structuredErrors':!![],'flags':[{'name':'type','type':a42_0x4347eb(0x20a),'description':a42_0x4347eb(0x23a),'enum':[a42_0x4347eb(0x27f),a42_0x4347eb(0x27e),a42_0x4347eb(0x258)]},{'name':a42_0x4347eb(0x22b),'type':a42_0x4347eb(0x247),'description':a42_0x4347eb(0x276)}],async 'dryRun'(_0x4fe904){const _0x447572=a42_0x4347eb,_0x439ee4=loadBffProjectConfig(_0x4fe904[_0x447572(0x266)]),_0x3412e1=await readBffLockFile(_0x439ee4['lockFilePath']),{appLock:_0x4853c4}=ensureLockScope(_0x3412e1??createEmptyBffLock(),_0x4fe904[_0x447572(0x266)],_0x439ee4[_0x447572(0x219)],'pull'),_0x26f8e3=normalizeBffType(_0x4fe904[_0x447572(0x238)]('type'))??undefined,[_0xb6e962,_0x3b7b71]=await Promise[_0x447572(0x21f)]([listBffScripts(_0x4fe904[_0x447572(0x266)],_0x26f8e3),getBffScriptStatistics(_0x4fe904['appCode'])]),_0x1530ae=_0xb6e962[_0x447572(0x257)](_0x5ac752=>normalizeBffType(_0x5ac752[_0x447572(0x1f4)])===_0x447572(0x258)),_0x1b1e8e=_0x1530ae?buildDatasetCodeToAliasMap(_0x4fe904[_0x447572(0x231)],_0x4fe904[_0x447572(0x266)],_0x4fe904[_0x447572(0x1ff)]||_0x4fe904[_0x447572(0x201)]?.[_0x447572(0x24b)]||_0x4fe904[_0x447572(0x201)]?.['defaultApp']):new Map(),_0x21b0ab=_0x1530ae?await planHookDirectoryMigration(_0x439ee4,_0x4853c4,_0x1b1e8e,await scanLocalBffFunctions(_0x439ee4,_0x447572(0x258))):undefined,_0x554677=createHookLocationMap(_0x3b7b71),_0x5d37f5=[];for(const _0x17422d of _0xb6e962){const _0x567f6c=resolveRemoteScriptTarget(_0x439ee4,_0x17422d,_0x554677,_0x21b0ab?.[_0x447572(0x21e)]??_0x4853c4[_0x447572(0x273)],_0x1b1e8e);if(!_0x567f6c){_0x5d37f5['push']({'scriptType':_0x17422d[_0x447572(0x1f4)],'functionName':_0x17422d[_0x447572(0x21b)]??'','status':_0x447572(0x200),'reason':_0x447572(0x235)});continue;}const _0x1aa842=(_0x21b0ab?.['projectedFunctions']??_0x4853c4[_0x447572(0x273)])[_0x567f6c[_0x447572(0x206)]],_0x5ea450=_0x17422d[_0x447572(0x212)]!=null?computeContentHash(_0x17422d[_0x447572(0x212)]):undefined,_0xb4608a=await hasUnsyncedLocalChanges(resolveMigratedSourceFilePath(_0x21b0ab,_0x567f6c)??_0x567f6c[_0x447572(0x274)],_0x1aa842,_0x5ea450),_0x1dd216=_0xb4608a?localUnsyncedConflict(_0x567f6c,_0x17422d['id']):undefined;_0x5d37f5[_0x447572(0x224)]({'lockKey':_0x567f6c[_0x447572(0x206)],'filePath':_0x567f6c[_0x447572(0x274)],'remoteId':_0x17422d['id']??null,'status':_0x1dd216?_0x447572(0x26e):_0x447572(0x1eb),..._0x1dd216?{'conflict':_0x1dd216}:{},..._0x567f6c[_0x447572(0x23c)]?{'alias':_0x567f6c[_0x447572(0x23c)][_0x447572(0x255)]??null,'datasetCode':_0x567f6c['hookLocation'][_0x447572(0x240)],'operationType':_0x567f6c[_0x447572(0x23c)][_0x447572(0x1f1)],'functionNode':_0x567f6c[_0x447572(0x23c)][_0x447572(0x263)]}:{}});}return{'method':_0x447572(0x24f),'url':_0x447572(0x217)+_0x4fe904[_0x447572(0x266)]+(_0x26f8e3?_0x447572(0x261)+_0x26f8e3:'')+_0x447572(0x207)+BFF_LIST_PAGE_SIZE,'body':{'appCode':_0x4fe904['appCode'],'filterType':_0x26f8e3??null,..._0x21b0ab&&_0x21b0ab[_0x447572(0x1ee)]['length']>0x0?{'hookDirectoryMigrations':_0x21b0ab['migrations'][_0x447572(0x280)](_0x27e51a=>({'from':_0x27e51a[_0x447572(0x27a)],'to':_0x27e51a['newDirectory']}))}:{},'files':_0x5d37f5},'description':_0x447572(0x269)+_0x5d37f5[_0x447572(0x25a)]+_0x447572(0x226)};},async 'execute'(_0xf7e605){const _0x60a015=a42_0x4347eb,_0x15a83b=loadBffProjectConfig(_0xf7e605['appCode']),_0xbb3a8=await readBffLockFile(_0x15a83b[_0x60a015(0x21d)]),{lockData:_0x13ef09,appLock:_0x58e9ef}=ensureLockScope(_0xbb3a8??createEmptyBffLock(),_0xf7e605[_0x60a015(0x266)],_0x15a83b['scriptsRoot'],_0x60a015(0x264)),_0x3b581f=normalizeBffType(_0xf7e605[_0x60a015(0x238)](_0x60a015(0x259)))??undefined;if(_0xf7e605['str'](_0x60a015(0x259))&&!_0x3b581f)throw CliErrors[_0x60a015(0x23e)](_0x60a015(0x234));const [_0x1f9c54,_0x1f031a]=await Promise[_0x60a015(0x21f)]([listBffScripts(_0xf7e605[_0x60a015(0x266)],_0x3b581f),getBffScriptStatistics(_0xf7e605[_0x60a015(0x266)])]);if(_0x1f9c54[_0x60a015(0x25a)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'conflicts':[],'failed':[]},'message':_0x60a015(0x262)};const _0x195788=_0xf7e605[_0x60a015(0x211)](_0x60a015(0x22b));if(_0x195788&&!_0xf7e605[_0x60a015(0x1f9)]){const _0x5a7118=await confirmForce();if(!_0x5a7118)throw CliErrors['cancelled'](_0x60a015(0x22d));}if(_0x195788&&_0xf7e605['nonInteractive']){}const _0x34450e=_0x1f9c54[_0x60a015(0x257)](_0x11084c=>normalizeBffType(_0x11084c[_0x60a015(0x1f4)])===_0x60a015(0x258)),_0xc7c624=_0x34450e?buildDatasetCodeToAliasMap(_0xf7e605['apiDir'],_0xf7e605['appCode'],_0xf7e605[_0x60a015(0x1ff)]||_0xf7e605[_0x60a015(0x201)]?.[_0x60a015(0x24b)]||_0xf7e605[_0x60a015(0x201)]?.[_0x60a015(0x237)]):new Map(),_0x2804d8=createHookLocationMap(_0x1f031a),_0x186a84=JSON[_0x60a015(0x260)](JSON['stringify'](_0x13ef09)),_0x45fca9=_0xf7e605[_0x60a015(0x266)],_0x8d5825=_0x186a84[_0x60a015(0x265)][_0x45fca9];if(!_0x8d5825)throw new Error(_0x60a015(0x221)+_0x45fca9+_0x60a015(0x22c));const _0x54f389=_0x34450e?await applyHookDirectoryMigration(await planHookDirectoryMigration(_0x15a83b,_0x8d5825,_0xc7c624,await scanLocalBffFunctions(_0x15a83b,_0x60a015(0x258))),_0x8d5825):undefined,_0x5160ad=createPullFileTransaction(),_0xcda1e2=[],_0x239831=[],_0x28abf8=[],_0x5405d6=[];for(const _0xfbadb9 of _0x1f9c54){const _0x1f8301=resolveRemoteScriptTarget(_0x15a83b,_0xfbadb9,_0x2804d8,_0x8d5825[_0x60a015(0x273)],_0xc7c624);if(!_0x1f8301){_0x239831[_0x60a015(0x224)]({'lockKey':_0xfbadb9[_0x60a015(0x1f4)]+'/'+_0xfbadb9[_0x60a015(0x21b)],'reason':_0x60a015(0x235)});continue;}const _0x2f6a7e=_0x8d5825['functions'][_0x1f8301[_0x60a015(0x206)]];try{if(!_0xfbadb9['id'])throw new Error(_0x60a015(0x283));if(_0xfbadb9[_0x60a015(0x212)]==null)throw new Error(_0x60a015(0x236));const _0x53f2e0=_0xfbadb9[_0x60a015(0x212)],_0x5bc369=computeContentHash(_0x53f2e0);if(!_0x195788){const _0xfc9c82=await hasUnsyncedLocalChanges(_0x1f8301['filePath'],_0x2f6a7e,_0x5bc369);if(_0xfc9c82){_0x28abf8[_0x60a015(0x224)](localUnsyncedConflict(_0x1f8301,_0xfbadb9['id']));continue;}}await _0x5160ad[_0x60a015(0x26c)](_0x1f8301[_0x60a015(0x274)],_0x53f2e0);const _0x35cd3d={'hash':_0x5bc369,'remoteId':_0xfbadb9['id'],'version':_0xfbadb9[_0x60a015(0x24e)]};_0x1f8301['type']===_0x60a015(0x258)&&_0x1f8301[_0x60a015(0x23c)]&&(_0x35cd3d[_0x60a015(0x255)]=_0x1f8301[_0x60a015(0x23c)][_0x60a015(0x255)],_0x35cd3d['datasetCode']=_0x1f8301[_0x60a015(0x23c)][_0x60a015(0x240)],_0x35cd3d[_0x60a015(0x1f1)]=_0x1f8301[_0x60a015(0x23c)][_0x60a015(0x1f1)],_0x35cd3d[_0x60a015(0x263)]=_0x1f8301[_0x60a015(0x23c)][_0x60a015(0x263)]),_0x8d5825[_0x60a015(0x273)][_0x1f8301[_0x60a015(0x206)]]=_0x35cd3d,_0xcda1e2['push']({'lockKey':_0x1f8301[_0x60a015(0x206)],'remoteId':_0xfbadb9['id']});}catch(_0x683d80){_0x5405d6[_0x60a015(0x224)]({'lockKey':_0x1f8301[_0x60a015(0x206)],'error':_0x683d80 instanceof Error?_0x683d80['message']:String(_0x683d80)});}}_0x8d5825[_0x60a015(0x1fe)]=new Date()[_0x60a015(0x20c)]();try{await writeBffLockFile(_0x15a83b[_0x60a015(0x21d)],_0x186a84);}catch(_0x574ef3){const _0xf826d5=[...await _0x5160ad['rollback'](),...await _0x54f389?.[_0x60a015(0x20f)]()??[]];throw withRollbackErrors(_0x574ef3,_0x60a015(0x281),_0xf826d5);}return{'ok':_0x5405d6[_0x60a015(0x25a)]===0x0,'data':{'pulled':_0xcda1e2,'skipped':_0x239831,'conflicts':_0x28abf8,'failed':_0x5405d6},'message':formatPullMessage(_0xcda1e2[_0x60a015(0x25a)],_0x239831[_0x60a015(0x25a)],_0x28abf8[_0x60a015(0x25a)],_0x5405d6['length'])};}};function localUnsyncedConflict(_0x1ca2a5,_0xabeb53){const _0x51c18c=a42_0x4347eb,_0x82dfde=_0x1ca2a5[_0x51c18c(0x206)][_0x51c18c(0x1f0)]('/')['at'](-0x1);return{'code':_0x51c18c(0x26d),'lockKey':_0x1ca2a5[_0x51c18c(0x206)],'filePath':_0x1ca2a5[_0x51c18c(0x274)],..._0xabeb53!=null?{'remoteId':_0xabeb53}:{},'message':_0x51c18c(0x279),'nextAction':{'action':'push_local','command':CLI_BIN_NAME+_0x51c18c(0x248)+_0x1ca2a5[_0x51c18c(0x259)]+_0x51c18c(0x20b)+_0x82dfde+_0x51c18c(0x246),'requiresReview':!![],'message':_0x51c18c(0x214)}};}function formatPullMessage(_0x5f2a8e,_0x2678a9,_0x246521,_0x2078f4){const _0x131f22=a42_0x4347eb,_0x38acbb=[_0x131f22(0x230)+_0x5f2a8e+_0x131f22(0x216),_0x2678a9+_0x131f22(0x25f)];_0x246521>0x0&&_0x38acbb['push'](_0x246521+_0x131f22(0x233)+(_0x246521===0x1?'':'s')+'\x20'+(_0x246521===0x1?_0x131f22(0x22e):'require')+_0x131f22(0x21a));if(_0x2078f4>0x0)_0x38acbb[_0x131f22(0x224)](_0x2078f4+_0x131f22(0x26a));return _0x38acbb[_0x131f22(0x229)](',\x20');}async function hasUnsyncedLocalChanges(_0xc24aa9,_0x33ccf0,_0x383c8a){const _0x11b3af=a42_0x4347eb;if(!await fileExists(_0xc24aa9))return![];const _0x497444=await computeFileHash(_0xc24aa9);if(!_0x33ccf0)return _0x383c8a?_0x497444!==_0x383c8a:!![];return _0x497444!==_0x33ccf0[_0x11b3af(0x1f5)];}function createPullFileTransaction(){const _0x162883=new Map(),_0x382c16=async(_0x5cb721,_0x2ed764)=>{const _0x596ed2=a42_0xebcf;try{if(_0x2ed764[_0x596ed2(0x210)])await ensureParentDirectory(_0x5cb721),await writeFile(_0x5cb721,_0x2ed764[_0x596ed2(0x24a)]);else try{await unlink(_0x5cb721);}catch(_0x28ef4b){if(_0x28ef4b[_0x596ed2(0x1ed)]!==_0x596ed2(0x20d))throw _0x28ef4b;}return undefined;}catch(_0x24e78a){return _0x24e78a instanceof Error?_0x24e78a:new Error(String(_0x24e78a));}};return{async 'write'(_0x21ae4d,_0x1d8fa3){const _0x119110=a42_0xebcf;if(!_0x162883[_0x119110(0x26f)](_0x21ae4d))try{_0x162883[_0x119110(0x208)](_0x21ae4d,{'existed':!![],'content':await readFile(_0x21ae4d)});}catch(_0x4889ac){if(_0x4889ac[_0x119110(0x1ed)]!==_0x119110(0x20d))throw _0x4889ac;_0x162883[_0x119110(0x208)](_0x21ae4d,{'existed':![]});}try{await ensureParentDirectory(_0x21ae4d),await writeFile(_0x21ae4d,_0x1d8fa3,_0x119110(0x284));}catch(_0x41e649){const _0x2bc91d=await _0x382c16(_0x21ae4d,_0x162883[_0x119110(0x202)](_0x21ae4d));if(!_0x2bc91d)_0x162883[_0x119110(0x25c)](_0x21ae4d);throw withRollbackErrors(_0x41e649,'Failed\x20to\x20write\x20local\x20script\x20\x22'+_0x21ae4d+'\x22.',_0x2bc91d?[_0x2bc91d]:[]);}},async 'rollback'(){const _0x105517=a42_0xebcf,_0xee4b15=[];for(const [_0x53eb7a,_0x569e96]of[..._0x162883[_0x105517(0x22f)]()]['reverse']()){const _0x2c04ed=await _0x382c16(_0x53eb7a,_0x569e96);_0x2c04ed&&_0xee4b15[_0x105517(0x224)](new Error(_0x105517(0x27c)+_0x53eb7a+_0x105517(0x252)+_0x2c04ed[_0x105517(0x25b)]));}return _0xee4b15;}};}function withRollbackErrors(_0xb16fbc,_0x3e2e6e,_0xb34d23){const _0x280409=a42_0x4347eb,_0x5b0208=_0xb16fbc instanceof Error?_0xb16fbc:new Error(String(_0xb16fbc));if(_0xb34d23[_0x280409(0x25a)]===0x0)return _0x5b0208;return new AggregateError([_0x5b0208,..._0xb34d23],_0x3e2e6e+'\x20Recovery\x20errors:\x20'+_0xb34d23[_0x280409(0x280)](_0x308f3f=>_0x308f3f['message'])[_0x280409(0x229)](';\x20'));}function a42_0x2151(){const _0x4f02aa=['\x22:\x20target\x20lock\x20key\x20is\x20already\x20bound\x20to\x20another\x20script.','\x22:\x20its\x20target\x20directory\x20is\x20unsafe.','Local\x20script\x20differs\x20from\x20the\x20last\x20pulled\x20version.\x20Review\x20it\x20before\x20choosing\x20the\x20source\x20of\x20truth.','oldDirectory','\x22.\x20Resolve\x20the\x20lock\x20entries\x20manually\x20before\x20retrying.','Could\x20not\x20restore\x20local\x20script\x20\x22','Cannot\x20migrate\x20HOOK\x20lock\x20key\x20\x22','ENDPOINT','COMMON','map','Failed\x20to\x20write\x20the\x20Backend\x20Function\x20lock\x20file;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.','3WmbGTA','Remote\x20script\x20missing\x20id.','utf8','mode','would_pull','\x22:\x20it\x20is\x20tracked\x20by\x20multiple\x20Datasets.','code','migrations','210969qjDVDh','split','operationType','trim','\x22:\x20the\x20target\x20directory\x20already\x20exists.\x20Resolve\x20the\x20directories\x20and\x20retry.','scriptType','hash','toLowerCase','reverse','790MNmBYv','nonInteractive','497463kasczs','newDirectory','newLockKey','ino','lastSync','selectedAppName','skipped','mergedCli','get','Pull\x20remote\x20Backend\x20Function\x20scripts\x20to\x20local','\x22:\x20it\x20is\x20now\x20another\x20Dataset\x20alias\x20and\x20contains\x20untracked\x20scripts.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.','read','lockKey','¤tPage=1&pageSize=','set','dev','string','\x20--name\x20','toISOString','ENOENT','sourceFilePathByNewLockKey','rollback','existed','bool','scriptContent','\x22\x20is\x20another\x20legacy\x20key\x20being\x20migrated.\x20Resolve\x20the\x20lock\x20entries\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.','includes','\x20pulled','/api/management/library/scripts/list?appCode=','move','scriptsRoot','\x20resolution','functionName','1431938PajYgv','lockFilePath','projectedFunctions','all','\x22\x20and\x20\x22','Lock\x20scope\x20for\x20app\x20\x22','case-rename','HOOK/','push','keyChanges','\x20remote\x20Backend\x20Function\x20script(s)\x20for\x20pull','1210aHtspz','filter','join','newDirectoryPath','force','\x22\x20not\x20found\x20after\x20ensureLockScope.','Force\x20pull\x20cancelled.','requires','entries','Pull\x20complete:\x20','apiDir','\x22:\x20its\x20target\x20\x22','\x20conflict','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','unresolvable\x20target\x20path','Remote\x20script\x20missing\x20content.','defaultApp','str','Cannot\x20migrate\x20HOOK\x20directories\x20\x22','Pull\x20only\x20this\x20script\x20type','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','hookLocation','\x22:\x20both\x20target\x20\x22','validation','\x22\x20to\x20\x22','datasetCode','yes','scriptsRootDir','\x22\x20may\x20remain.','oldDirectoryPath','values','\x20--format\x20compress','boolean','\x20bff\x20push\x20--type\x20','Failed\x20to\x20rename\x20HOOK\x20directory\x20\x22','content','currentApp','Could\x20not\x20restore\x20HOOK\x20directory\x20\x22','flatMap','version','GET','546180rYCjPe','Cannot\x20migrate\x20HOOK\x20lock\x20keys\x20\x22','\x22:\x20','rekey','Cannot\x20migrate\x20HOOK\x20directory\x20\x22','alias','oldLockKey','some','HOOK','type','length','message','delete','close','2881912FVnKMi','\x20skipped','parse','&type=','No\x20remote\x20Backend\x20Function\x20scripts\x20found.','functionNode','pull','apps','appCode','stderr','21mjTGBw','Would\x20inspect\x20','\x20failed','Could\x20not\x20restore\x20temporary\x20HOOK\x20directory\x20\x22','write','BFF_LOCAL_UNSYNCED','conflict','has','\x22;\x20temporary\x20directory\x20\x22','entry','1506FMOrAh','functions','filePath','9305208zGepQU','Force\x20overwrite\x20local\x20unsynced\x20changes'];a42_0x2151=function(){return _0x4f02aa;};return a42_0x2151();}function buildDatasetCodeToAliasMap(_0x531ecf,_0x2e33e5,_0x27fde3){const _0x252852=a42_0x4347eb,_0x1576d1=resolveApiModelSource(_0x531ecf,_0x2e33e5,_0x27fde3),_0x55103b=loadAliasMap(_0x531ecf,undefined,_0x1576d1['filePath'],_0x1576d1['profileName']);return assertUnambiguousHookAliases(_0x55103b),new Map(_0x55103b[_0x252852(0x280)](_0x52c506=>[_0x52c506[_0x252852(0x240)]['toLowerCase'](),_0x52c506[_0x252852(0x255)]]));}async function planHookDirectoryMigration(_0x52a9af,_0x4b4939,_0x4d97fa,_0x1d27b5){const _0x16f824=a42_0x4347eb,_0x4fbf1e=new Map();for(const [_0x4f3b97,_0x107b28]of Object['entries'](_0x4b4939['functions'])){const [_0x4717d1,_0x193033,_0x40a7d3,_0x4473a9,_0x298152,..._0x130c99]=_0x4f3b97[_0x16f824(0x1f0)]('/');if(_0x4717d1!==_0x16f824(0x258)||!_0x193033||!_0x40a7d3||!_0x4473a9||!_0x298152||_0x130c99['length']>0x0||!_0x107b28[_0x16f824(0x240)])continue;const _0x4a40a1=_0x4d97fa[_0x16f824(0x202)](_0x107b28[_0x16f824(0x240)][_0x16f824(0x1f6)]()),_0x2a3b7f=_0x4a40a1??_0x107b28[_0x16f824(0x240)];if(!isSafeHookDirectorySegment(_0x193033))throw CliErrors[_0x16f824(0x23e)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20directory\x20\x22'+_0x193033+'\x22\x20from\x20the\x20lock\x20file.');if(!isSafeHookDirectorySegment(_0x2a3b7f))throw CliErrors[_0x16f824(0x23e)](_0x16f824(0x254)+_0x193033+_0x16f824(0x278));if(_0x193033===_0x2a3b7f)continue;const _0x33a114=_0x4fbf1e[_0x16f824(0x202)](_0x193033)??{'datasetCode':_0x107b28[_0x16f824(0x240)],'alias':_0x4a40a1,'keyChanges':[]};if(_0x33a114[_0x16f824(0x240)]!==_0x107b28[_0x16f824(0x240)])throw CliErrors[_0x16f824(0x23e)](_0x16f824(0x254)+_0x193033+_0x16f824(0x1ec));const _0x2fa439=_0x16f824(0x223)+_0x2a3b7f+'/'+_0x40a7d3+'/'+_0x4473a9+'/'+_0x298152;try{resolveLocalFilePathFromLockKey(_0x52a9af,_0x4f3b97),resolveLocalFilePathFromLockKey(_0x52a9af,_0x2fa439);}catch(_0x4e4833){throw CliErrors[_0x16f824(0x23e)]('Cannot\x20migrate\x20unsafe\x20HOOK\x20lock\x20key\x20\x22'+_0x4f3b97+_0x16f824(0x252)+(_0x4e4833 instanceof Error?_0x4e4833[_0x16f824(0x25b)]:String(_0x4e4833)));}_0x33a114[_0x16f824(0x225)][_0x16f824(0x224)]({'oldLockKey':_0x4f3b97,'newLockKey':_0x2fa439,'entry':_0x107b28}),_0x4fbf1e[_0x16f824(0x208)](_0x193033,_0x33a114);}const _0x569b19=new Set([..._0x4fbf1e[_0x16f824(0x245)]()][_0x16f824(0x24d)](_0xaf74d0=>_0xaf74d0[_0x16f824(0x225)][_0x16f824(0x280)](_0x331599=>_0x331599[_0x16f824(0x256)]))),_0x3fc197=new Map(),_0x5b5af7=new Map();for(const [_0x25d6aa,_0xa84af4]of _0x4fbf1e){const _0x45e20b=_0xa84af4[_0x16f824(0x255)]??_0xa84af4['datasetCode'],_0x15c43e=hookDirectoryIdentity(_0x45e20b),_0x145bd0=_0x3fc197[_0x16f824(0x202)](_0x15c43e);if(_0x145bd0&&_0x145bd0!==_0x25d6aa)throw CliErrors['validation'](_0x16f824(0x239)+_0x145bd0+_0x16f824(0x220)+_0x25d6aa+_0x16f824(0x23d)+_0x45e20b+'\x22.\x20Resolve\x20the\x20directories\x20manually\x20before\x20retrying.');_0x3fc197[_0x16f824(0x208)](_0x15c43e,_0x25d6aa);for(const _0x10196e of _0xa84af4[_0x16f824(0x225)]){const _0x19997e=_0x5b5af7['get'](_0x10196e['newLockKey']);if(_0x19997e&&_0x19997e!==_0x10196e[_0x16f824(0x256)])throw CliErrors[_0x16f824(0x23e)](_0x16f824(0x251)+_0x19997e+_0x16f824(0x220)+_0x10196e[_0x16f824(0x256)]+_0x16f824(0x23d)+_0x10196e[_0x16f824(0x1fc)]+_0x16f824(0x27b));if(_0x569b19[_0x16f824(0x26f)](_0x10196e[_0x16f824(0x1fc)]))throw CliErrors[_0x16f824(0x23e)](_0x16f824(0x27d)+_0x10196e['oldLockKey']+_0x16f824(0x232)+_0x10196e[_0x16f824(0x1fc)]+_0x16f824(0x213));_0x5b5af7[_0x16f824(0x208)](_0x10196e[_0x16f824(0x1fc)],_0x10196e[_0x16f824(0x256)]);}}const _0x8c092d=new Map();for(const [_0x1a6613,_0x855087]of _0x4d97fa){_0x8c092d[_0x16f824(0x208)](hookDirectoryIdentity(_0x855087),_0x1a6613);}const _0x57cafa=[];for(const [_0x5da91f,_0x234d1c]of _0x4fbf1e){const _0x17ddd7=_0x234d1c['alias']??_0x234d1c[_0x16f824(0x240)],_0x4b8786=join(_0x52a9af[_0x16f824(0x242)],'HOOK',_0x5da91f),_0x219738=join(_0x52a9af[_0x16f824(0x242)],_0x16f824(0x258),_0x17ddd7),_0x16baa5=await directoryExists(_0x4b8786),_0x16ba6d=await directoryExists(_0x219738),_0x1f8549=_0x16baa5?_0x16ba6d?await sameDirectory(_0x4b8786,_0x219738)?_0x16f824(0x222):undefined:'move':_0x16f824(0x253);if(!_0x1f8549)throw CliErrors['validation'](_0x16f824(0x254)+_0x5da91f+_0x16f824(0x23f)+_0x17ddd7+_0x16f824(0x1f3));const _0x575d57=_0x8c092d[_0x16f824(0x202)](hookDirectoryIdentity(_0x5da91f));if(_0x575d57&&_0x575d57!==_0x234d1c[_0x16f824(0x240)]['toLowerCase']()){const _0x33f81f=new Set(_0x234d1c[_0x16f824(0x225)]['map'](_0x45a453=>_0x45a453[_0x16f824(0x256)])),_0x8723c2=_0x1d27b5[_0x16f824(0x228)](_0xa88c7d=>_0xa88c7d[_0x16f824(0x259)]===_0x16f824(0x258)&&_0xa88c7d['alias']!=null&&hookDirectoryIdentity(_0xa88c7d[_0x16f824(0x255)])===hookDirectoryIdentity(_0x5da91f)&&!_0x33f81f['has'](_0xa88c7d[_0x16f824(0x206)]));if(_0x8723c2['length']>0x0)throw CliErrors[_0x16f824(0x23e)](_0x16f824(0x254)+_0x5da91f+_0x16f824(0x204));}const _0x490e80=_0x8c092d[_0x16f824(0x202)](hookDirectoryIdentity(_0x17ddd7));if(_0x490e80&&_0x490e80!==_0x234d1c[_0x16f824(0x240)][_0x16f824(0x1f6)]())throw CliErrors[_0x16f824(0x23e)](_0x16f824(0x254)+_0x5da91f+_0x16f824(0x23f)+_0x17ddd7+'\x22:\x20the\x20destination\x20is\x20another\x20Dataset\x20alias.\x20Resolve\x20the\x20directory\x20manually\x20before\x20retrying.');for(const _0x41a304 of _0x234d1c['keyChanges']){const _0x648856=_0x4b4939['functions'][_0x41a304[_0x16f824(0x1fc)]];if(_0x648856&&!_0x569b19[_0x16f824(0x26f)](_0x41a304[_0x16f824(0x1fc)])&&!sameHookIdentity(_0x41a304['entry'],_0x648856))throw CliErrors['validation'](_0x16f824(0x254)+_0x5da91f+_0x16f824(0x23f)+_0x17ddd7+_0x16f824(0x277));}_0x57cafa['push']({'oldDirectory':_0x5da91f,'newDirectory':_0x17ddd7,'oldDirectoryPath':_0x4b8786,'newDirectoryPath':_0x219738,'mode':_0x1f8549,'alias':_0x234d1c[_0x16f824(0x255)],'keyChanges':_0x234d1c[_0x16f824(0x225)]});}const _0x242ac6={..._0x4b4939[_0x16f824(0x273)]},_0x276957=new Map(),_0x53b7aa=new Map();for(const _0x4cbc5e of _0x57cafa){const _0x26fec7=_0x4cbc5e[_0x16f824(0x285)]!==_0x16f824(0x253);_0x26fec7&&_0x53b7aa['set'](hookDirectoryIdentity(_0x4cbc5e[_0x16f824(0x1fb)]),_0x4cbc5e['oldDirectoryPath']);for(const _0x2bbd07 of _0x4cbc5e[_0x16f824(0x225)]){const _0x4a6f24=_0x242ac6[_0x2bbd07[_0x16f824(0x1fc)]],_0x3acb9b=_0x26fec7?_0x2bbd07[_0x16f824(0x271)]:_0x4a6f24??_0x2bbd07[_0x16f824(0x271)];_0x242ac6[_0x2bbd07[_0x16f824(0x1fc)]]=canonicalizeHookEntry(_0x3acb9b,_0x4cbc5e[_0x16f824(0x255)]),delete _0x242ac6[_0x2bbd07['oldLockKey']],_0x26fec7&&_0x276957['set'](_0x2bbd07[_0x16f824(0x1fc)],resolveLocalFilePathFromLockKey(_0x52a9af,_0x2bbd07[_0x16f824(0x256)]));}}return{'migrations':_0x57cafa,'projectedFunctions':_0x242ac6,'sourceFilePathByNewLockKey':_0x276957,'sourceDirectoryPathByNewDirectory':_0x53b7aa};}function resolveMigratedSourceFilePath(_0x10f867,_0x3a5eca){const _0x5df7a1=a42_0x4347eb;if(!_0x10f867||!_0x3a5eca)return undefined;const _0x5d1c13=_0x10f867[_0x5df7a1(0x20e)][_0x5df7a1(0x202)](_0x3a5eca[_0x5df7a1(0x206)]);if(_0x5d1c13)return _0x5d1c13;if(_0x3a5eca[_0x5df7a1(0x259)]!=='HOOK')return undefined;const [,_0x4e8cf9,..._0x508d31]=_0x3a5eca['lockKey'][_0x5df7a1(0x1f0)]('/');if(!_0x4e8cf9||_0x508d31[_0x5df7a1(0x25a)]===0x0)return undefined;const _0xadbe30=_0x10f867['sourceDirectoryPathByNewDirectory'][_0x5df7a1(0x202)](hookDirectoryIdentity(_0x4e8cf9));return _0xadbe30?join(_0xadbe30,..._0x508d31)+'.js':undefined;}function sameHookIdentity(_0x360d7b,_0x4c4acc){const _0x561afa=a42_0x4347eb;return _0x360d7b['remoteId']===_0x4c4acc['remoteId']&&_0x360d7b[_0x561afa(0x240)]===_0x4c4acc[_0x561afa(0x240)]&&_0x360d7b[_0x561afa(0x1f1)]===_0x4c4acc['operationType']&&_0x360d7b[_0x561afa(0x263)]===_0x4c4acc['functionNode'];}function canonicalizeHookEntry(_0x1cdf53,_0x156d5a){const {alias:_0x1ad242,..._0x50eb3d}=_0x1cdf53;return _0x156d5a?{..._0x50eb3d,'alias':_0x156d5a}:_0x50eb3d;}function hookDirectoryIdentity(_0x3f4a3f){const _0x18d546=a42_0x4347eb;return _0x3f4a3f['normalize']('NFC')[_0x18d546(0x1f6)]();}function isSafeHookDirectorySegment(_0x33229c){return isSafeLockKeySegment(_0x33229c);}async function sameDirectory(_0x24caef,_0x73aaaa){const _0x18a83d=a42_0x4347eb,[_0x28fd66,_0x6aa05f]=await Promise[_0x18a83d(0x21f)]([stat(_0x24caef),stat(_0x73aaaa)]);return _0x28fd66[_0x18a83d(0x209)]===_0x6aa05f[_0x18a83d(0x209)]&&_0x28fd66[_0x18a83d(0x1fd)]===_0x6aa05f[_0x18a83d(0x1fd)];}async function applyHookDirectoryMigration(_0x521d69,_0xaa939f){const _0x28f8ea=a42_0x4347eb,_0x2e777b=_0xaa939f[_0x28f8ea(0x273)],_0x4026b8=_0xaa939f[_0x28f8ea(0x1fe)],_0x2f6339=[],_0xef035a=async()=>{const _0x9aaaea=_0x28f8ea,_0x536a78=[];_0xaa939f[_0x9aaaea(0x273)]=_0x2e777b,_0xaa939f[_0x9aaaea(0x1fe)]=_0x4026b8;for(const {migration:_0x3ee354,temporaryPath:_0x215386}of[..._0x2f6339][_0x9aaaea(0x1f7)]()){try{_0x215386?(await rename(_0x3ee354['newDirectoryPath'],_0x215386),await rename(_0x215386,_0x3ee354[_0x9aaaea(0x244)])):await rename(_0x3ee354[_0x9aaaea(0x22a)],_0x3ee354[_0x9aaaea(0x244)]);}catch(_0x33771e){_0x536a78['push'](new Error(_0x9aaaea(0x24c)+_0x3ee354[_0x9aaaea(0x27a)]+'\x22\x20from\x20\x22'+_0x3ee354[_0x9aaaea(0x1fb)]+'\x22:\x20'+(_0x33771e instanceof Error?_0x33771e[_0x9aaaea(0x25b)]:String(_0x33771e))));}}return _0x536a78;};try{for(const _0x37d059 of _0x521d69['migrations']){if(_0x37d059['mode']===_0x28f8ea(0x218))await ensureParentDirectory(_0x37d059['newDirectoryPath']),await rename(_0x37d059[_0x28f8ea(0x244)],_0x37d059['newDirectoryPath']),_0x2f6339['push']({'migration':_0x37d059});else{if(_0x37d059[_0x28f8ea(0x285)]===_0x28f8ea(0x222)){const _0x59377f=join(dirname(_0x37d059['oldDirectoryPath']),'.hook-directory-migrate-'+randomUUID());await rename(_0x37d059[_0x28f8ea(0x244)],_0x59377f);try{await rename(_0x59377f,_0x37d059['newDirectoryPath']);}catch(_0x1696cf){try{await rename(_0x59377f,_0x37d059[_0x28f8ea(0x244)]);}catch(_0x1aa01d){throw withRollbackErrors(_0x1696cf,_0x28f8ea(0x249)+_0x37d059['oldDirectory']+_0x28f8ea(0x23f)+_0x37d059['newDirectory']+_0x28f8ea(0x270)+_0x59377f+_0x28f8ea(0x243),[new Error(_0x28f8ea(0x26b)+_0x59377f+_0x28f8ea(0x23f)+_0x37d059[_0x28f8ea(0x27a)]+'\x22:\x20'+(_0x1aa01d instanceof Error?_0x1aa01d[_0x28f8ea(0x25b)]:String(_0x1aa01d)))]);}throw _0x1696cf;}_0x2f6339['push']({'migration':_0x37d059,'temporaryPath':_0x59377f});}}}return _0xaa939f['functions']=_0x521d69[_0x28f8ea(0x21e)],{'rollback':_0xef035a};}catch(_0x117e37){const _0xc2ce48=await _0xef035a();throw withRollbackErrors(_0x117e37,'Failed\x20to\x20migrate\x20HOOK\x20directories;\x20local\x20changes\x20could\x20not\x20be\x20completely\x20rolled\x20back.',_0xc2ce48);}}async function confirmForce(){const _0x276add=a42_0x4347eb,_0x40305c=createInterface({'input':process['stdin'],'output':process[_0x276add(0x267)]}),_0xf9cc25=await new Promise(_0x38d63f=>{const _0x904eca=_0x276add;_0x40305c['question'](_0x904eca(0x23b),_0x38d63f);});return _0x40305c[_0x276add(0x25d)](),['y',_0x276add(0x241)][_0x276add(0x215)](_0xf9cc25[_0x276add(0x1f2)]()[_0x276add(0x1f6)]());}
|