@lovrabet/rabetbase-cli 2.3.16-beta.4 → 2.3.16-beta.5
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.d.ts +9 -0
- package/lib/api/api-doc.js +1 -1
- package/lib/api/fetch-model-list.d.ts +2 -0
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.d.ts +8 -0
- package/lib/api/generate-api-file.js +1 -1
- package/lib/auth/auth-server-ui.d.ts +13 -0
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.d.ts +25 -0
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.d.ts +2 -0
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.d.ts +1 -0
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.d.ts +51 -0
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.d.ts +1 -0
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.d.ts +5 -0
- package/lib/auth/login-success-html.js +1 -1
- package/lib/auth/logout.d.ts +1 -0
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.d.ts +12 -0
- package/lib/cli-flags.js +1 -1
- package/lib/cli.d.ts +2 -0
- package/lib/cli.js +1 -1
- package/lib/commands/api/generate.d.ts +2 -0
- package/lib/commands/api/generate.js +1 -1
- package/lib/commands/api/index.d.ts +2 -0
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.d.ts +2 -0
- package/lib/commands/api/list.js +1 -1
- package/lib/commands/api/pull.d.ts +2 -0
- package/lib/commands/api/pull.js +1 -1
- package/lib/commands/api/shared.d.ts +18 -0
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/index.d.ts +5 -0
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.d.ts +10 -0
- package/lib/commands/app/list.js +1 -1
- package/lib/commands/app/members-list.d.ts +2 -0
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.d.ts +11 -0
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.d.ts +46 -0
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/delete.d.ts +2 -0
- package/lib/commands/app-config/delete.js +1 -1
- package/lib/commands/app-config/get.d.ts +2 -0
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.d.ts +2 -0
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.d.ts +2 -0
- package/lib/commands/app-config/list.js +1 -1
- package/lib/commands/app-config/set.d.ts +2 -0
- package/lib/commands/app-config/set.js +1 -1
- package/lib/commands/app-config/shared.d.ts +105 -0
- package/lib/commands/app-config/shared.js +1 -1
- package/lib/commands/auth/index.d.ts +2 -0
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.d.ts +4 -0
- package/lib/commands/bff/create.js +1 -1
- package/lib/commands/bff/delete.d.ts +2 -0
- package/lib/commands/bff/delete.js +1 -1
- package/lib/commands/bff/detail.d.ts +2 -0
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.d.ts +5 -0
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.d.ts +2 -0
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/pull.d.ts +2 -0
- package/lib/commands/bff/pull.js +1 -1
- package/lib/commands/bff/push.d.ts +2 -0
- package/lib/commands/bff/push.js +1 -1
- package/lib/commands/bff/status.d.ts +2 -0
- package/lib/commands/bff/status.js +1 -1
- package/lib/commands/cli-skill/index.d.ts +8 -0
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/cli-update.d.ts +2 -0
- package/lib/commands/cli-update.js +1 -1
- package/lib/commands/codegen/index.d.ts +2 -0
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.d.ts +2 -0
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.d.ts +2 -0
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.d.ts +17 -0
- package/lib/commands/common/app-registry.js +1 -1
- package/lib/commands/common/app-selector.d.ts +17 -0
- package/lib/commands/common/app-selector.js +1 -1
- package/lib/commands/common/async-task.d.ts +11 -0
- package/lib/commands/common/async-task.js +1 -1
- package/lib/commands/common/dry-run.d.ts +12 -0
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.d.ts +26 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.d.ts +6 -0
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.d.ts +13 -0
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/get.d.ts +5 -0
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.d.ts +5 -0
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/list.d.ts +5 -0
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.d.ts +5 -0
- package/lib/commands/config/set.js +1 -1
- package/lib/commands/config/shared.d.ts +16 -0
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/filter.d.ts +7 -0
- package/lib/commands/data/filter.js +1 -1
- package/lib/commands/data/getOne.d.ts +7 -0
- package/lib/commands/data/getOne.js +1 -1
- package/lib/commands/data/index.d.ts +8 -0
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/data/shared.d.ts +33 -0
- package/lib/commands/data/shared.js +1 -1
- package/lib/commands/dataset/business-group-update.d.ts +18 -0
- package/lib/commands/dataset/business-group-update.js +1 -1
- package/lib/commands/dataset/capability.d.ts +11 -0
- package/lib/commands/dataset/capability.js +1 -1
- package/lib/commands/dataset/delete.d.ts +2 -0
- package/lib/commands/dataset/delete.js +1 -1
- package/lib/commands/dataset/detail.d.ts +2 -0
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/extend-update.d.ts +26 -0
- package/lib/commands/dataset/extend-update.js +1 -1
- package/lib/commands/dataset/field-update.d.ts +27 -0
- package/lib/commands/dataset/field-update.js +1 -1
- package/lib/commands/dataset/generate.d.ts +3 -0
- package/lib/commands/dataset/generate.js +1 -1
- package/lib/commands/dataset/index.d.ts +2 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.d.ts +2 -0
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/operations.d.ts +2 -0
- package/lib/commands/dataset/operations.js +1 -1
- package/lib/commands/dataset/relation-audit.d.ts +2 -0
- package/lib/commands/dataset/relation-audit.js +1 -1
- package/lib/commands/dataset/relation-create.d.ts +2 -0
- package/lib/commands/dataset/relation-create.js +1 -1
- package/lib/commands/dataset/relation-delete.d.ts +2 -0
- package/lib/commands/dataset/relation-delete.js +1 -1
- package/lib/commands/dataset/relation-shared.d.ts +128 -0
- package/lib/commands/dataset/relation-shared.js +1 -1
- package/lib/commands/dataset/relation-update.d.ts +2 -0
- package/lib/commands/dataset/relation-update.js +1 -1
- package/lib/commands/dataset/relations.d.ts +53 -0
- package/lib/commands/dataset/relations.js +1 -1
- package/lib/commands/dataset/rename.d.ts +17 -0
- package/lib/commands/dataset/rename.js +1 -1
- package/lib/commands/dataset/restore.d.ts +2 -0
- package/lib/commands/dataset/restore.js +1 -1
- package/lib/commands/db/analysis-batching.d.ts +30 -0
- package/lib/commands/db/analysis-batching.js +1 -1
- package/lib/commands/db/analyze-batch-plan.d.ts +2 -0
- package/lib/commands/db/analyze-batch-plan.js +1 -1
- package/lib/commands/db/analyze-cancel.d.ts +2 -0
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.d.ts +2 -0
- package/lib/commands/db/analyze-start.js +1 -1
- package/lib/commands/db/analyze-status.d.ts +2 -0
- package/lib/commands/db/analyze-status.js +1 -1
- package/lib/commands/db/create.d.ts +2 -0
- package/lib/commands/db/create.js +1 -1
- package/lib/commands/db/delete.d.ts +2 -0
- package/lib/commands/db/delete.js +1 -1
- package/lib/commands/db/detail.d.ts +2 -0
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff.d.ts +2 -0
- package/lib/commands/db/diff.js +1 -1
- package/lib/commands/db/index.d.ts +5 -0
- package/lib/commands/db/index.js +1 -1
- package/lib/commands/db/list.d.ts +2 -0
- package/lib/commands/db/list.js +1 -1
- package/lib/commands/db/shared.d.ts +15 -0
- package/lib/commands/db/shared.js +1 -1
- package/lib/commands/db/tables.d.ts +2 -0
- package/lib/commands/db/tables.js +1 -1
- package/lib/commands/db/test.d.ts +2 -0
- package/lib/commands/db/test.js +1 -1
- package/lib/commands/db/update.d.ts +2 -0
- package/lib/commands/db/update.js +1 -1
- package/lib/commands/doctor.d.ts +2 -0
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.d.ts +2 -0
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init/index.d.ts +11 -0
- package/lib/commands/init/index.js +1 -1
- package/lib/commands/issue/index.d.ts +2 -0
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.d.ts +23 -0
- package/lib/commands/issue/nudge.js +1 -1
- package/lib/commands/issue/report.d.ts +2 -0
- package/lib/commands/issue/report.js +1 -1
- package/lib/commands/issue/shared.d.ts +32 -0
- package/lib/commands/issue/shared.js +1 -1
- package/lib/commands/kb/create.d.ts +2 -0
- package/lib/commands/kb/create.js +1 -1
- package/lib/commands/kb/delete.d.ts +2 -0
- package/lib/commands/kb/delete.js +1 -1
- package/lib/commands/kb/detail.d.ts +2 -0
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/index.d.ts +2 -0
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.d.ts +2 -0
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/shared.d.ts +33 -0
- package/lib/commands/kb/shared.js +1 -1
- package/lib/commands/kb/update.d.ts +2 -0
- package/lib/commands/kb/update.js +1 -1
- package/lib/commands/logs/index.d.ts +5 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/menu/asset-update.d.ts +2 -0
- package/lib/commands/menu/asset-update.js +1 -1
- package/lib/commands/menu/delete.d.ts +2 -0
- package/lib/commands/menu/delete.js +1 -1
- package/lib/commands/menu/external-link-create.d.ts +3 -0
- package/lib/commands/menu/external-link-create.js +1 -1
- package/lib/commands/menu/external-link-update.d.ts +2 -0
- package/lib/commands/menu/external-link-update.js +1 -1
- package/lib/commands/menu/group-create.d.ts +2 -0
- package/lib/commands/menu/group-create.js +1 -1
- package/lib/commands/menu/group-update.d.ts +2 -0
- package/lib/commands/menu/group-update.js +1 -1
- package/lib/commands/menu/index.d.ts +17 -0
- package/lib/commands/menu/index.js +1 -1
- package/lib/commands/menu/list.d.ts +2 -0
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.d.ts +2 -0
- package/lib/commands/menu/move.js +1 -1
- package/lib/commands/menu/regroup-start.d.ts +2 -0
- package/lib/commands/menu/regroup-start.js +1 -1
- package/lib/commands/menu/rename.d.ts +2 -0
- package/lib/commands/menu/rename.js +1 -1
- package/lib/commands/menu/shared/compare-table.d.ts +27 -0
- package/lib/commands/menu/shared/compare-table.js +1 -1
- package/lib/commands/menu/shared/delete-plan.d.ts +51 -0
- package/lib/commands/menu/shared/delete-plan.js +1 -1
- package/lib/commands/menu/shared/facts.d.ts +12 -0
- package/lib/commands/menu/shared/facts.js +1 -1
- package/lib/commands/menu/shared/index.d.ts +12 -0
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.d.ts +10 -0
- package/lib/commands/menu/shared/inquirer.js +1 -1
- package/lib/commands/menu/shared/local-pages.d.ts +12 -0
- package/lib/commands/menu/shared/local-pages.js +1 -1
- package/lib/commands/menu/shared/logic.d.ts +28 -0
- package/lib/commands/menu/shared/logic.js +1 -1
- package/lib/commands/menu/shared/mutations.d.ts +69 -0
- package/lib/commands/menu/shared/mutations.js +1 -1
- package/lib/commands/menu/shared/service.d.ts +17 -0
- package/lib/commands/menu/shared/service.js +1 -1
- package/lib/commands/menu/shared/sync-core.d.ts +7 -0
- package/lib/commands/menu/shared/sync-core.js +1 -1
- package/lib/commands/menu/shared/types.d.ts +162 -0
- package/lib/commands/menu/shared/update-core.d.ts +11 -0
- package/lib/commands/menu/shared/update-core.js +1 -1
- package/lib/commands/menu/shared/valid-url.d.ts +6 -0
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/sync.d.ts +2 -0
- package/lib/commands/menu/sync.js +1 -1
- package/lib/commands/notification/config-list.d.ts +2 -0
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.d.ts +2 -0
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/ocr/index.d.ts +2 -0
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/page/generate-start.d.ts +2 -0
- package/lib/commands/page/generate-start.js +1 -1
- package/lib/commands/page/generate-status.d.ts +2 -0
- package/lib/commands/page/generate-status.js +1 -1
- package/lib/commands/page/index.d.ts +2 -0
- package/lib/commands/page/index.js +1 -1
- package/lib/commands/page/pull.d.ts +2 -0
- package/lib/commands/page/pull.js +1 -1
- package/lib/commands/page/push.d.ts +2 -0
- package/lib/commands/page/push.js +1 -1
- package/lib/commands/page/relation-audit.d.ts +2 -0
- package/lib/commands/page/relation-audit.js +1 -1
- package/lib/commands/page/restore.d.ts +2 -0
- package/lib/commands/page/restore.js +1 -1
- package/lib/commands/page/shared.d.ts +105 -0
- package/lib/commands/page/shared.js +1 -1
- package/lib/commands/page/standard-page-status.d.ts +2 -0
- package/lib/commands/page/standard-page-status.js +1 -1
- package/lib/commands/page/sync.d.ts +2 -0
- package/lib/commands/page/sync.js +1 -1
- package/lib/commands/permit/index.d.ts +2 -0
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.d.ts +2 -0
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.d.ts +2 -0
- package/lib/commands/permit/page-set.js +1 -1
- package/lib/commands/permit/role-apis-set.d.ts +2 -0
- package/lib/commands/permit/role-apis-set.js +1 -1
- package/lib/commands/permit/role-menus-set.d.ts +2 -0
- package/lib/commands/permit/role-menus-set.js +1 -1
- package/lib/commands/permit/role-menus.d.ts +2 -0
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.d.ts +74 -0
- package/lib/commands/permit/shared.js +1 -1
- package/lib/commands/project/create/enhanced-guided-create.d.ts +7 -0
- package/lib/commands/project/create/enhanced-guided-create.js +1 -1
- package/lib/commands/project/create/format-elapsed.d.ts +1 -0
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.d.ts +6 -0
- package/lib/commands/project/create/main.js +1 -1
- package/lib/commands/project/create/non-interactive.d.ts +9 -0
- package/lib/commands/project/create/non-interactive.js +1 -1
- package/lib/commands/project/create/project-template-path.d.ts +4 -0
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.d.ts +1 -0
- package/lib/commands/project/create/use-copy-project-template.js +1 -1
- package/lib/commands/project/create/use-format-code.d.ts +1 -0
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.d.ts +1 -0
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/index.d.ts +2 -0
- package/lib/commands/project/index.js +1 -1
- package/lib/commands/project/upgrade.d.ts +1 -0
- package/lib/commands/project/upgrade.js +1 -1
- package/lib/commands/registry.d.ts +66 -0
- package/lib/commands/registry.js +1 -1
- package/lib/commands/role/create.d.ts +2 -0
- package/lib/commands/role/create.js +1 -1
- package/lib/commands/role/delete.d.ts +2 -0
- package/lib/commands/role/delete.js +1 -1
- package/lib/commands/role/detail.d.ts +2 -0
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.d.ts +2 -0
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.d.ts +2 -0
- package/lib/commands/role/list.js +1 -1
- package/lib/commands/role/shared.d.ts +107 -0
- package/lib/commands/role/shared.js +1 -1
- package/lib/commands/role/update.d.ts +2 -0
- package/lib/commands/role/update.js +1 -1
- package/lib/commands/role/user-add.d.ts +2 -0
- package/lib/commands/role/user-add.js +1 -1
- package/lib/commands/role/user-remove.d.ts +2 -0
- package/lib/commands/role/user-remove.js +1 -1
- package/lib/commands/role/user-resolve.d.ts +2 -0
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/run/index.d.ts +2 -0
- package/lib/commands/run/index.js +1 -1
- package/lib/commands/schema.d.ts +5 -0
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.d.ts +10 -0
- package/lib/commands/sql/create.js +1 -1
- package/lib/commands/sql/delete.d.ts +5 -0
- package/lib/commands/sql/delete.js +1 -1
- package/lib/commands/sql/detail.d.ts +2 -0
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.d.ts +2 -0
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.d.ts +5 -0
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.d.ts +2 -0
- package/lib/commands/sql/list.js +1 -1
- package/lib/commands/sql/pull.d.ts +5 -0
- package/lib/commands/sql/pull.js +1 -1
- package/lib/commands/sql/push.d.ts +5 -0
- package/lib/commands/sql/push.js +1 -1
- package/lib/commands/sql/shared.d.ts +23 -0
- package/lib/commands/sql/shared.js +1 -1
- package/lib/commands/sql/status.d.ts +5 -0
- package/lib/commands/sql/status.js +1 -1
- package/lib/commands/sql/validate.d.ts +2 -0
- package/lib/commands/sql/validate.js +1 -1
- package/lib/commands/task/index.d.ts +2 -0
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.d.ts +2 -0
- package/lib/commands/task/status.js +1 -1
- package/lib/commands/tenant/index.d.ts +2 -0
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.d.ts +2 -0
- package/lib/commands/tenant/members-list.js +1 -1
- package/lib/commands/tenant/shared.d.ts +10 -0
- package/lib/commands/tenant/shared.js +1 -1
- package/lib/commands/workspace/add.d.ts +6 -0
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.d.ts +11 -0
- package/lib/commands/workspace/index.js +1 -1
- package/lib/commands/workspace/remove.d.ts +6 -0
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/schema.d.ts +50 -0
- package/lib/config/schema.js +1 -1
- package/lib/constant/cdn.d.ts +1 -0
- package/lib/constant/cdn.js +1 -1
- package/lib/constant/cli.d.ts +34 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.d.ts +10 -0
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.d.ts +14 -0
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.d.ts +11 -0
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.d.ts +1 -0
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.d.ts +5 -0
- package/lib/constant/paths.js +1 -1
- package/lib/constant/risk.d.ts +1 -0
- package/lib/constant/risk.js +1 -1
- package/lib/context/app-resolver.d.ts +36 -0
- package/lib/context/app-resolver.js +1 -1
- package/lib/context/auth-resolver.d.ts +5 -0
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.d.ts +61 -0
- package/lib/context/config-loader.js +1 -1
- package/lib/context.d.ts +102 -0
- package/lib/context.js +1 -1
- package/lib/core/alias-resolver.d.ts +31 -0
- package/lib/core/alias-resolver.js +1 -1
- package/lib/core/api-client.d.ts +1018 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/bff/config.d.ts +8 -0
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.d.ts +28 -0
- package/lib/core/bff/file-system.js +1 -1
- package/lib/core/bff/hash.d.ts +7 -0
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/lock.d.ts +25 -0
- package/lib/core/bff/lock.js +1 -1
- package/lib/core/bff/types.d.ts +92 -0
- package/lib/core/bff/utils.d.ts +25 -0
- package/lib/core/bff/utils.js +1 -1
- package/lib/core/db-resolver.d.ts +43 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/page/file-system.d.ts +6 -0
- package/lib/core/page/file-system.js +1 -1
- package/lib/core/page/hash.d.ts +4 -0
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.d.ts +8 -0
- package/lib/core/page/lock.js +1 -1
- package/lib/core/page/types.d.ts +22 -0
- package/lib/core/sql-index-auditor.d.ts +33 -0
- package/lib/core/sql-index-auditor.js +1 -1
- package/lib/core/sql-sync/config.d.ts +7 -0
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.d.ts +7 -0
- package/lib/core/sql-sync/file-system.js +1 -1
- package/lib/core/sql-sync/hash.d.ts +5 -0
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.d.ts +14 -0
- package/lib/core/sql-sync/lock.js +1 -1
- package/lib/core/sql-sync/types.d.ts +43 -0
- package/lib/core/sql-sync/utils.d.ts +10 -0
- package/lib/core/sql-sync/utils.js +1 -1
- package/lib/core/sql-validator.d.ts +34 -0
- package/lib/core/sql-validator.js +1 -1
- package/lib/errors.d.ts +3 -0
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.d.ts +2 -0
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.d.ts +9 -0
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.d.ts +3 -0
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.d.ts +3 -0
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.d.ts +4 -0
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.d.ts +11 -0
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.d.ts +15 -0
- package/lib/framework/output.js +1 -1
- package/lib/framework/response.d.ts +2 -0
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.d.ts +14 -0
- package/lib/framework/runner-alias.js +1 -1
- package/lib/framework/runner.d.ts +36 -0
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.d.ts +3 -0
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/types.d.ts +63 -0
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -0
- package/lib/generated/build-info.js +1 -1
- package/lib/help.d.ts +1 -0
- package/lib/help.js +1 -1
- package/lib/runtime/confirmation.d.ts +4 -0
- package/lib/runtime/confirmation.js +1 -0
- package/lib/runtime/event.d.ts +5 -0
- package/lib/runtime/event.js +1 -0
- package/lib/runtime/index.d.ts +7 -0
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/queue.d.ts +5 -0
- package/lib/runtime/queue.js +1 -0
- package/lib/runtime/resolve.d.ts +8 -0
- package/lib/runtime/resolve.js +1 -0
- package/lib/runtime/types.d.ts +50 -0
- package/lib/runtime/types.js +1 -0
- package/lib/skills/main.d.ts +41 -0
- package/lib/skills/main.js +1 -1
- package/lib/skills/npx-skills-add.d.ts +99 -0
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/skill-presence.d.ts +44 -0
- package/lib/skills/skill-presence.js +1 -1
- package/lib/telemetry/cli-command-trace.d.ts +12 -0
- package/lib/telemetry/cli-command-trace.js +1 -1
- package/lib/telemetry/cli-help-trace.d.ts +8 -0
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.d.ts +6 -0
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.d.ts +3 -0
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.d.ts +17 -0
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/telemetry/send-platform-issue-collect-log.d.ts +26 -0
- package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
- package/lib/types/index.d.ts +93 -0
- package/lib/utils/ai_config.d.ts +47 -0
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/apply-jq-filter.d.ts +1 -0
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.d.ts +42 -0
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.d.ts +23 -0
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.d.ts +37 -0
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/cli-version-policy.d.ts +9 -0
- package/lib/utils/cli-version-policy.js +1 -1
- package/lib/utils/config.d.ts +42 -0
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.d.ts +1 -0
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/entity-with-id.d.ts +30 -0
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.d.ts +25 -0
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.d.ts +80 -0
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.d.ts +30 -0
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/is-non-interactive.d.ts +7 -0
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.d.ts +62 -0
- package/lib/utils/logger.js +1 -1
- package/lib/utils/params.d.ts +15 -0
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.d.ts +21 -0
- package/lib/utils/platform.js +1 -1
- package/lib/utils/rules-cdn.d.ts +38 -0
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.d.ts +1 -0
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.d.ts +55 -0
- package/lib/utils/template-replacer.js +1 -1
- package/lib/utils/update-notice.d.ts +10 -0
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.d.ts +1 -0
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.d.ts +1 -0
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.d.ts +6 -0
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { AppConfigItem } from "../../core/api-client.js";
|
|
2
|
+
import type { CommandDefinition, DryRunResult, RuntimeContext } from "../../framework/types.js";
|
|
3
|
+
export interface AppConfigProjection {
|
|
4
|
+
appCode: string;
|
|
5
|
+
key: string;
|
|
6
|
+
tags?: string | null;
|
|
7
|
+
hasValue: boolean;
|
|
8
|
+
valueRedacted: boolean;
|
|
9
|
+
gmtCreate?: string;
|
|
10
|
+
gmtModified?: string;
|
|
11
|
+
value?: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface AppConfigMutationData {
|
|
14
|
+
operation: "create" | "update" | "delete";
|
|
15
|
+
selector: {
|
|
16
|
+
appCode: string;
|
|
17
|
+
key: string;
|
|
18
|
+
};
|
|
19
|
+
before: AppConfigProjection | null;
|
|
20
|
+
after: AppConfigProjection | null;
|
|
21
|
+
dryRun: boolean;
|
|
22
|
+
warnings: string[];
|
|
23
|
+
}
|
|
24
|
+
type AppConfigContext = Parameters<NonNullable<CommandDefinition["execute"]>>[0];
|
|
25
|
+
type ValueSource = {
|
|
26
|
+
kind: "argument";
|
|
27
|
+
value?: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "stdin";
|
|
30
|
+
} | {
|
|
31
|
+
kind: "env";
|
|
32
|
+
name: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "file";
|
|
35
|
+
path: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const KEY_ARG: {
|
|
38
|
+
readonly name: "key";
|
|
39
|
+
readonly description: "Runtime app-config key";
|
|
40
|
+
readonly required: true;
|
|
41
|
+
};
|
|
42
|
+
export declare const VALUE_ARG: {
|
|
43
|
+
readonly name: "value";
|
|
44
|
+
readonly description: "Sensitive config value. Prefer --stdin, --from-env, or --file for secrets.";
|
|
45
|
+
readonly required: false;
|
|
46
|
+
};
|
|
47
|
+
export declare const TAGS_FLAG: {
|
|
48
|
+
readonly name: "tags";
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly description: "Config tags for filtering/display metadata";
|
|
51
|
+
};
|
|
52
|
+
export declare const STDIN_FLAG: {
|
|
53
|
+
readonly name: "stdin";
|
|
54
|
+
readonly type: "boolean";
|
|
55
|
+
readonly description: "Read config value from stdin";
|
|
56
|
+
readonly default: false;
|
|
57
|
+
};
|
|
58
|
+
export declare const FROM_ENV_FLAG: {
|
|
59
|
+
readonly name: "from-env";
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly description: "Read config value from the named environment variable";
|
|
62
|
+
};
|
|
63
|
+
export declare const REVEAL_FLAG: {
|
|
64
|
+
readonly name: "reveal";
|
|
65
|
+
readonly type: "boolean";
|
|
66
|
+
readonly description: "Reveal the sensitive value for this single key";
|
|
67
|
+
readonly default: false;
|
|
68
|
+
};
|
|
69
|
+
export declare function readKeyArg(ctx: RuntimeContext | AppConfigContext): string;
|
|
70
|
+
export declare function readOptionalTags(ctx: RuntimeContext | AppConfigContext): string | undefined;
|
|
71
|
+
export declare function validateKey(key: string): void;
|
|
72
|
+
export declare function projectAppConfig(item: AppConfigItem, options?: {
|
|
73
|
+
reveal?: boolean;
|
|
74
|
+
}): AppConfigProjection;
|
|
75
|
+
export declare function plannedAppConfig(params: {
|
|
76
|
+
appCode: string;
|
|
77
|
+
key: string;
|
|
78
|
+
tags?: string | null;
|
|
79
|
+
hasValue?: boolean;
|
|
80
|
+
}): AppConfigProjection;
|
|
81
|
+
export declare function buildMutationData(params: {
|
|
82
|
+
operation: AppConfigMutationData["operation"];
|
|
83
|
+
appCode: string;
|
|
84
|
+
key: string;
|
|
85
|
+
before: AppConfigProjection | null;
|
|
86
|
+
after: AppConfigProjection | null;
|
|
87
|
+
dryRun: boolean;
|
|
88
|
+
warnings?: string[];
|
|
89
|
+
}): AppConfigMutationData;
|
|
90
|
+
export declare function withAppConfigApiBoundary<T>(operation: string, selector: {
|
|
91
|
+
appCode: string;
|
|
92
|
+
key?: string;
|
|
93
|
+
}, fn: () => Promise<T>): Promise<T>;
|
|
94
|
+
export declare function asAppConfigDryRunResult(data: AppConfigMutationData, backend: {
|
|
95
|
+
method: "POST";
|
|
96
|
+
url: string;
|
|
97
|
+
}): DryRunResult & AppConfigMutationData;
|
|
98
|
+
export declare function assertSingleValueSource(ctx: AppConfigContext): ValueSource;
|
|
99
|
+
export declare function assertValueSourceReadable(source: ValueSource): Promise<void>;
|
|
100
|
+
export declare function readAppConfigValue(ctx: AppConfigContext): Promise<{
|
|
101
|
+
value: string;
|
|
102
|
+
source: ValueSource["kind"];
|
|
103
|
+
warnings: string[];
|
|
104
|
+
}>;
|
|
105
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0xbe6680=a28_0x2087;(function(_0x25b175,_0x32087a){const _0x29893a=a28_0x2087,_0x3ca023=_0x25b175();while(!![]){try{const _0x252936=-parseInt(_0x29893a(0x1f5))/0x1+parseInt(_0x29893a(0x203))/0x2*(parseInt(_0x29893a(0x1eb))/0x3)+-parseInt(_0x29893a(0x1d2))/0x4+-parseInt(_0x29893a(0x20d))/0x5+parseInt(_0x29893a(0x1e8))/0x6+-parseInt(_0x29893a(0x201))/0x7+-parseInt(_0x29893a(0x1d9))/0x8*(-parseInt(_0x29893a(0x1da))/0x9);if(_0x252936===_0x32087a)break;else _0x3ca023['push'](_0x3ca023['shift']());}catch(_0x29cbc1){_0x3ca023['push'](_0x3ca023['shift']());}}}(a28_0x340d,0x763f3));import{access,readFile}from'node:fs/promises';import{CliErrors}from'../../errors.js';export const KEY_ARG={'name':'key','description':a28_0xbe6680(0x1dd),'required':!![]};export const VALUE_ARG={'name':a28_0xbe6680(0x1fc),'description':'Sensitive\x20config\x20value.\x20Prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.','required':![]};export const TAGS_FLAG={'name':a28_0xbe6680(0x1d4),'type':a28_0xbe6680(0x1f8),'description':'Config\x20tags\x20for\x20filtering/display\x20metadata'};export const STDIN_FLAG={'name':'stdin','type':a28_0xbe6680(0x1d5),'description':a28_0xbe6680(0x20e),'default':![]};export const FROM_ENV_FLAG={'name':a28_0xbe6680(0x1ea),'type':a28_0xbe6680(0x1f8),'description':a28_0xbe6680(0x20a)};export const REVEAL_FLAG={'name':a28_0xbe6680(0x200),'type':a28_0xbe6680(0x1d5),'description':a28_0xbe6680(0x1fd),'default':![]};function a28_0x2087(_0x5a2e48,_0x376546){_0x5a2e48=_0x5a2e48-0x1d2;const _0x340db1=a28_0x340d();let _0x20872f=_0x340db1[_0x5a2e48];return _0x20872f;}export function readKeyArg(_0x10b624){const _0x23d629=a28_0xbe6680,_0x4eaf01=_0x10b624[_0x23d629(0x207)][0x0]?.['trim']()??'';return validateKey(_0x4eaf01),_0x4eaf01;}function a28_0x340d(){const _0x50769e=['path','error','args','operation','Use\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.','Read\x20config\x20value\x20from\x20the\x20named\x20environment\x20variable','stdin','before','3720240odwfsv','Read\x20config\x20value\x20from\x20stdin','2081844UmWveO','data','tags','boolean','key:\x20','Environment\x20variable\x20is\x20not\x20set:\x20','appCode','6248aRmLYG','23454rJuzMo','utf8','length','Runtime\x20app-config\x20key','bool','trim','once','dryRun','defineProperties','setEncoding','kind','valueRedacted','Missing\x20app-config\x20key.','apiError','1649124xIVSag','argument','from-env','655770XgKWsk','Failed\x20to\x20','Missing\x20app-config\x20value\x20source.','after','validation','slice','hasValue','key','join','env','778087vjmPdx','App\x20config\x20value\x20source\x20is\x20ambiguous.','\x20app\x20config.','string','str','method','flag','value','Reveal\x20the\x20sensitive\x20value\x20for\x20this\x20single\x20key','file','push','reveal','12565xsupXx','App\x20config\x20tags\x20length\x20cannot\x20exceed\x2032.','2mbBkGu','name'];a28_0x340d=function(){return _0x50769e;};return a28_0x340d();}export function readOptionalTags(_0x15f64c){const _0x4e9a2b=a28_0xbe6680,_0x336dd9=_0x15f64c[_0x4e9a2b(0x1f9)](_0x4e9a2b(0x1d4))[_0x4e9a2b(0x1df)]();if(!_0x336dd9)return undefined;if(_0x336dd9[_0x4e9a2b(0x1dc)]>0x20)throw CliErrors['validation'](_0x4e9a2b(0x202));return _0x336dd9;}export function validateKey(_0x572bc3){const _0x3bb119=a28_0xbe6680;if(!_0x572bc3)throw CliErrors['validation'](_0x3bb119(0x1e6));if(_0x572bc3[_0x3bb119(0x1dc)]>0x100)throw CliErrors[_0x3bb119(0x1ef)]('App\x20config\x20key\x20length\x20cannot\x20exceed\x20256.');}export function projectAppConfig(_0x4ab0f7,_0x5fecf9){const _0x3f2da7=a28_0xbe6680,_0x3601fb=_0x4ab0f7['value']!==undefined&&_0x4ab0f7[_0x3f2da7(0x1fc)]!==null&&_0x4ab0f7['value']!=='',_0x128361={'appCode':_0x4ab0f7['appCode'],'key':_0x4ab0f7[_0x3f2da7(0x1f2)],'tags':_0x4ab0f7[_0x3f2da7(0x1d4)]??undefined,'hasValue':_0x3601fb,'valueRedacted':_0x3601fb&&!_0x5fecf9?.[_0x3f2da7(0x200)],'gmtCreate':_0x4ab0f7['gmtCreate'],'gmtModified':_0x4ab0f7['gmtModified']};return _0x5fecf9?.[_0x3f2da7(0x200)]&&(_0x128361[_0x3f2da7(0x1fc)]=_0x4ab0f7[_0x3f2da7(0x1fc)]??'',_0x128361[_0x3f2da7(0x1e5)]=![]),_0x128361;}export function plannedAppConfig(_0x22d53c){const _0x2cd2b0=a28_0xbe6680,_0x429d01=_0x22d53c[_0x2cd2b0(0x1f1)]??!![];return{'appCode':_0x22d53c[_0x2cd2b0(0x1d8)],'key':_0x22d53c['key'],'tags':_0x22d53c['tags']??undefined,'hasValue':_0x429d01,'valueRedacted':_0x429d01};}export function buildMutationData(_0xf06aec){const _0xa034de=a28_0xbe6680;return{'operation':_0xf06aec[_0xa034de(0x208)],'selector':{'appCode':_0xf06aec[_0xa034de(0x1d8)],'key':_0xf06aec[_0xa034de(0x1f2)]},'before':_0xf06aec[_0xa034de(0x20c)],'after':_0xf06aec[_0xa034de(0x1ee)],'dryRun':_0xf06aec[_0xa034de(0x1e1)],'warnings':_0xf06aec['warnings']??[]};}export async function withAppConfigApiBoundary(_0x4cc725,_0x56f8b0,_0x3ab429){const _0x3a21a0=a28_0xbe6680;try{return await _0x3ab429();}catch{const _0x23fe61=['appCode:\x20'+_0x56f8b0['appCode']];if(_0x56f8b0['key'])_0x23fe61[_0x3a21a0(0x1ff)](_0x3a21a0(0x1d6)+_0x56f8b0['key']);_0x23fe61['push']('value\x20is\x20redacted');throw CliErrors[_0x3a21a0(0x1e7)](_0x3a21a0(0x1ec)+_0x4cc725+_0x3a21a0(0x1f7),_0x23fe61[_0x3a21a0(0x1f3)](';\x20')+'.');}}export function asAppConfigDryRunResult(_0x48a9e7,_0x1621d6){const _0x3e7015=a28_0xbe6680;return Object[_0x3e7015(0x1e2)](_0x48a9e7,{'method':{'value':_0x1621d6[_0x3e7015(0x1fa)],'enumerable':![]},'url':{'value':_0x1621d6['url'],'enumerable':![]}});}export function assertSingleValueSource(_0x26c2bb){const _0x55d64c=a28_0xbe6680,_0x4ee359=[];_0x26c2bb[_0x55d64c(0x207)][_0x55d64c(0x1dc)]>0x1&&_0x4ee359[_0x55d64c(0x1ff)]({'kind':'argument','value':_0x26c2bb[_0x55d64c(0x207)][_0x55d64c(0x1f0)](0x1)[_0x55d64c(0x1f3)]('\x20')});const _0x8756d3=_0x26c2bb[_0x55d64c(0x1fb)](_0x55d64c(0x1fc));_0x8756d3!==undefined&&_0x8756d3!==null&&_0x4ee359[_0x55d64c(0x1ff)]({'kind':_0x55d64c(0x1e9),'value':String(_0x8756d3)});_0x26c2bb[_0x55d64c(0x1de)]('stdin')&&_0x4ee359[_0x55d64c(0x1ff)]({'kind':'stdin'});const _0x184feb=_0x26c2bb['str']('from-env')[_0x55d64c(0x1df)]();_0x184feb&&_0x4ee359[_0x55d64c(0x1ff)]({'kind':_0x55d64c(0x1f4),'name':_0x184feb});const _0x3a7c7b=_0x26c2bb[_0x55d64c(0x1f9)](_0x55d64c(0x1fe))[_0x55d64c(0x1df)]();_0x3a7c7b&&_0x4ee359[_0x55d64c(0x1ff)]({'kind':_0x55d64c(0x1fe),'path':_0x3a7c7b});if(_0x4ee359['length']===0x0)throw CliErrors[_0x55d64c(0x1ef)](_0x55d64c(0x1ed),_0x55d64c(0x209));if(_0x4ee359['length']>0x1)throw CliErrors[_0x55d64c(0x1ef)](_0x55d64c(0x1f6),'Use\x20exactly\x20one\x20of:\x20positional\x20<value>,\x20--stdin,\x20--from-env\x20<NAME>,\x20or\x20--file\x20<path>.');return _0x4ee359[0x0];}export async function assertValueSourceReadable(_0x11eb42){const _0x5e4abd=a28_0xbe6680;if(_0x11eb42[_0x5e4abd(0x1e4)]===_0x5e4abd(0x1f4)&&!(_0x11eb42[_0x5e4abd(0x204)]in process.env))throw CliErrors[_0x5e4abd(0x1ef)](_0x5e4abd(0x1d7)+_0x11eb42[_0x5e4abd(0x204)]);if(_0x11eb42['kind']===_0x5e4abd(0x1fe))try{await access(_0x11eb42[_0x5e4abd(0x205)]);}catch{throw CliErrors['validation']('Value\x20file\x20is\x20not\x20readable:\x20'+_0x11eb42[_0x5e4abd(0x205)]);}}export async function readAppConfigValue(_0x5dd48c){const _0xdbaf3=a28_0xbe6680,_0x383231=assertSingleValueSource(_0x5dd48c),_0x42cd2b=[];if(_0x383231[_0xdbaf3(0x1e4)]===_0xdbaf3(0x1e9))return _0x42cd2b[_0xdbaf3(0x1ff)]('Value\x20was\x20provided\x20as\x20a\x20command\x20argument;\x20prefer\x20--stdin,\x20--from-env,\x20or\x20--file\x20for\x20secrets.'),{'value':_0x383231[_0xdbaf3(0x1fc)]??'','source':_0x383231[_0xdbaf3(0x1e4)],'warnings':_0x42cd2b};if(_0x383231[_0xdbaf3(0x1e4)]===_0xdbaf3(0x20b))return{'value':await readStdin(),'source':_0x383231['kind'],'warnings':_0x42cd2b};if(_0x383231[_0xdbaf3(0x1e4)]===_0xdbaf3(0x1f4)){if(!(_0x383231[_0xdbaf3(0x204)]in process.env))throw CliErrors[_0xdbaf3(0x1ef)]('Environment\x20variable\x20is\x20not\x20set:\x20'+_0x383231['name']);return{'value':process.env[_0x383231.name]??'','source':_0x383231[_0xdbaf3(0x1e4)],'warnings':_0x42cd2b};}return{'value':await readFile(_0x383231[_0xdbaf3(0x205)],_0xdbaf3(0x1db)),'source':_0x383231[_0xdbaf3(0x1e4)],'warnings':_0x42cd2b};}function readStdin(){return new Promise((_0x38baa4,_0x200744)=>{const _0x5c7be9=a28_0x2087;let _0x55b490='';process['stdin'][_0x5c7be9(0x1e3)]('utf8'),process['stdin']['on'](_0x5c7be9(0x1d3),_0x76cdba=>{_0x55b490+=_0x76cdba;}),process[_0x5c7be9(0x20b)][_0x5c7be9(0x1e0)]('end',()=>_0x38baa4(_0x55b490)),process['stdin']['once'](_0x5c7be9(0x206),_0x200744);});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x25d1bf=a29_0x176b;(function(_0x1346fd,_0x5c2181){const _0x3b8383=a29_0x176b,_0x2700df=_0x1346fd();while(!![]){try{const _0x1b6417=-parseInt(_0x3b8383(0x161))/0x1*(parseInt(_0x3b8383(0x174))/0x2)+-parseInt(_0x3b8383(0x15f))/0x3*(parseInt(_0x3b8383(0x16f))/0x4)+parseInt(_0x3b8383(0x162))/0x5*(parseInt(_0x3b8383(0x166))/0x6)+parseInt(_0x3b8383(0x171))/0x7*(parseInt(_0x3b8383(0x172))/0x8)+-parseInt(_0x3b8383(0x165))/0x9*(-parseInt(_0x3b8383(0x15a))/0xa)+-parseInt(_0x3b8383(0x173))/0xb+-parseInt(_0x3b8383(0x15e))/0xc*(-parseInt(_0x3b8383(0x16a))/0xd);if(_0x1b6417===_0x5c2181)break;else _0x2700df['push'](_0x2700df['shift']());}catch(_0x1e784c){_0x2700df['push'](_0x2700df['shift']());}}}(a29_0x29da,0x80a19));function a29_0x176b(_0x37321a,_0x758b43){_0x37321a=_0x37321a-0x15a;const _0x29da39=a29_0x29da();let _0x176b35=_0x29da39[_0x37321a];return _0x176b35;}import{unlinkSync,existsSync}from'node:fs';import{cookieFile}from'../../auth/constant.js';export const authDefinitions=[{'service':a29_0x25d1bf(0x15b),'command':a29_0x25d1bf(0x163),'description':a29_0x25d1bf(0x16d),'risk':a29_0x25d1bf(0x164),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'yes','type':a29_0x25d1bf(0x160),'description':a29_0x25d1bf(0x170),'default':![]}],async 'execute'(_0x56f70b){const _0x1731f4=a29_0x25d1bf,{runAuthServer:_0x40ed1c}=await import(_0x1731f4(0x169));return await _0x40ed1c({'autoYes':_0x56f70b[_0x1731f4(0x16c)](_0x1731f4(0x167)),'nonInteractive':_0x56f70b['nonInteractive']}),{'ok':!![]};}},{'service':a29_0x25d1bf(0x15b),'command':a29_0x25d1bf(0x15d),'description':a29_0x25d1bf(0x168),'risk':a29_0x25d1bf(0x15c),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x287839){const _0x69d5eb=a29_0x25d1bf;return existsSync(cookieFile)?(unlinkSync(cookieFile),console[_0x69d5eb(0x16b)]('✓\x20Logged\x20out')):console[_0x69d5eb(0x16b)](_0x69d5eb(0x16e)),{'ok':!![]};}}];function a29_0x29da(){const _0x515a58=['read','63UoMXgW','30ZpEaLg','yes','Clear\x20login\x20session','../../auth/auth-server-ui.js','13xIoiPn','log','bool','Login\x20via\x20browser','!\x20Not\x20logged\x20in','4iRIuAl','Skip\x20login\x20confirmation\x20and\x20start\x20browser\x20auth\x20immediately','7xmycfr','1768800rtAkpP','1833634chzBVl','86NxYqhj','451010mRWRWi','auth','write','logout','8348412BnpUYj','2931099tlhyLJ','boolean','6671HCAJwR','724945sDlLyX','login'];a29_0x29da=function(){return _0x515a58;};return a29_0x29da();}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BffScriptType, HookCreationOptions } from "../../core/bff/types.js";
|
|
2
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
3
|
+
export declare const bffCreate: CommandDefinition;
|
|
4
|
+
export declare function generateTemplate(scriptType: BffScriptType, functionName: string, appCode: string, description?: string, hookOptions?: HookCreationOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a30_0x3474b0=a30_0x40e2;(function(_0x151c01,_0x36bb5e){const _0x513ee2=a30_0x40e2,_0x327572=_0x151c01();while(!![]){try{const _0x2a7b5c=parseInt(_0x513ee2(0x108))/0x1*(parseInt(_0x513ee2(0xf5))/0x2)+parseInt(_0x513ee2(0x122))/0x3*(parseInt(_0x513ee2(0x13f))/0x4)+-parseInt(_0x513ee2(0x12e))/0x5+-parseInt(_0x513ee2(0x112))/0x6+parseInt(_0x513ee2(0x10f))/0x7*(parseInt(_0x513ee2(0xef))/0x8)+-parseInt(_0x513ee2(0x136))/0x9+-parseInt(_0x513ee2(0x110))/0xa*(parseInt(_0x513ee2(0x140))/0xb);if(_0x2a7b5c===_0x36bb5e)break;else _0x327572['push'](_0x327572['shift']());}catch(_0x5c5887){_0x327572['push'](_0x327572['shift']());}}}(a30_0x2898,0xb647a));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';function a30_0x2898(){const _0x576e18=['parseInt','Invalid\x20dataset\x20selection.','ENDPOINT','code','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','\x0a\x20*\x20[脚本名称]\x20','str','94675dNyeJM','apiDir','question','\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).','operation-type','appCode','after','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','11762631cCBzDs','HOOK\x20requires\x20alias/operation/node\x20options.','stderr','string','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','Trigger\x20node\x20(HOOK\x20only)','No\x20datasets\x20found\x20for\x20this\x20app.','scriptsRootDir','\x0a\x20*\x20[接口路径]\x20POST\x20/api/','5567612WZxEmK','231bEGqDm','validation','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Request\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Business\x20result\x20(wrapped\x20in\x20response.data).\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','alias','join','Operation\x20type\x20\x22','8241272lQyumE','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Current\x20request\x20params\x20or\x20response\x20result.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Modified\x20params\x20object.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','\x20api\x20pull`\x20to\x20refresh.','bff','description','type','8kyUSyG','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','\x20function:\x20','Operation\x20type\x20(HOOK\x20only)','Select\x20dataset:','operationType','before','--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.','includes','Script\x20description','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','Script\x20type','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','.js','\x0a\x20*\x20[触发节点]\x20','name','UNKNOWN','HOOK','234564ZyRayM','nonInteractive','Invalid\x20function\x20name\x20\x22','read','map','Select\x20trigger\x20node:','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','7VsPomq','596280pqroPI','Available\x20aliases:\x20','213708hdhONm','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','isInteger','HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.','length','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/{appCode}/{scriptName}\x0a\x20*\x20[当前示例]\x20POST\x20/api/endpoint/','find','trim','\x22.\x20','functionNode','datasetcode','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','write','\x22\x20not\x20found.\x20','create','datasetCode','3jlhJva','.js\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Input\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Processing\x20result.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','Function\x20name\x20(valid\x20JS\x20identifier)',']\x20('];a30_0x2898=function(){return _0x576e18;};return a30_0x2898();}import{isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';function a30_0x40e2(_0x30e503,_0x5cb380){_0x30e503=_0x30e503-0xea;const _0x289819=a30_0x2898();let _0x40e2eb=_0x289819[_0x30e503];return _0x40e2eb;}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffCreate={'service':a30_0x3474b0(0xf2),'command':a30_0x3474b0(0x120),'description':a30_0x3474b0(0xf6),'risk':a30_0x3474b0(0x10b),'flags':[{'name':a30_0x3474b0(0xf4),'type':a30_0x3474b0(0x139),'required':!![],'enum':['COMMON',a30_0x3474b0(0x129),a30_0x3474b0(0x107)],'description':a30_0x3474b0(0x101)},{'name':a30_0x3474b0(0x105),'type':a30_0x3474b0(0x139),'required':!![],'description':a30_0x3474b0(0x125)},{'name':a30_0x3474b0(0xf3),'type':a30_0x3474b0(0x139),'description':a30_0x3474b0(0xfe)},{'name':a30_0x3474b0(0xec),'type':a30_0x3474b0(0x139),'description':'Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)'},{'name':a30_0x3474b0(0x11c),'type':a30_0x3474b0(0x139),'description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a30_0x3474b0(0x132),'type':'string','description':a30_0x3474b0(0xf8)},{'name':'function-node','type':'string','description':a30_0x3474b0(0x13b),'enum':[a30_0x3474b0(0xfb),a30_0x3474b0(0x134)]}],async 'validate'(_0x100f85){const _0x25703a=a30_0x3474b0,_0x33ae00=_0x100f85['str']('name');if(!isValidBffFunctionName(_0x33ae00))throw CliErrors['validation'](_0x25703a(0x10a)+_0x33ae00+_0x25703a(0x131));},async 'execute'(_0x435f8e){const _0x368b29=a30_0x3474b0,_0x2551b0=loadBffProjectConfig(_0x435f8e[_0x368b29(0x133)]),_0x103d6c=_0x435f8e['str'](_0x368b29(0xf4)),_0x49e77c=_0x435f8e[_0x368b29(0x12d)]('name'),_0x3d9382=_0x435f8e[_0x368b29(0x12d)](_0x368b29(0xf3))||undefined,_0x507220=_0x103d6c===_0x368b29(0x107)?await resolveHookOptions(_0x2551b0,_0x435f8e):undefined,_0x7eefa8=buildFilePath(_0x2551b0,_0x103d6c,_0x49e77c,_0x507220);if(await fileExists(_0x7eefa8))throw CliErrors[_0x368b29(0xea)]('File\x20already\x20exists:\x20'+_0x7eefa8);await mkdir(dirname(_0x7eefa8),{'recursive':!![]});const _0x30d304=generateTemplate(_0x103d6c,_0x49e77c,_0x435f8e['appCode'],_0x3d9382,_0x507220);await writeFile(_0x7eefa8,_0x30d304,'utf8');const _0x405b91={'type':_0x103d6c,'name':_0x49e77c,'path':_0x7eefa8};if(_0x3d9382)_0x405b91[_0x368b29(0xf3)]=_0x3d9382;if(_0x507220){if(_0x507220['alias'])_0x405b91[_0x368b29(0xec)]=_0x507220[_0x368b29(0xec)];_0x405b91[_0x368b29(0x121)]=_0x507220[_0x368b29(0x121)],_0x405b91[_0x368b29(0xfa)]=_0x507220['operationType'],_0x405b91[_0x368b29(0x11b)]=_0x507220[_0x368b29(0x11b)];}return{'ok':!![],'data':_0x405b91,'message':'Created\x20'+_0x103d6c+_0x368b29(0xf7)+_0x49e77c};}};async function resolveHookOptions(_0x3cd519,_0x33a54f){const _0x40b058=a30_0x3474b0,_0x2079c7=loadAliasMap(_0x33a54f[_0x40b058(0x12f)],undefined,resolveApiFilePath(_0x33a54f[_0x40b058(0x12f)],_0x33a54f[_0x40b058(0x133)])),_0x38061d=_0x2079c7[_0x40b058(0x116)]>0x0;let _0x4a653f,_0xddcb59,_0x257280;const _0x930ac2=_0x33a54f[_0x40b058(0x12d)](_0x40b058(0xec)),_0x1e1a62=_0x33a54f[_0x40b058(0x12d)](_0x40b058(0x11c));if(_0x930ac2){const _0x4d7f27=resolveAlias(_0x33a54f[_0x40b058(0x12f)],_0x930ac2,undefined,resolveApiFilePath(_0x33a54f[_0x40b058(0x12f)],_0x33a54f['appCode']));if(!_0x4d7f27){const _0x4adaf1=_0x38061d?_0x40b058(0x111)+_0x2079c7[_0x40b058(0x10c)](_0x3ccb38=>_0x3ccb38['alias'])[_0x40b058(0xed)](',\x20'):'No\x20api.ts\x20found.\x20Run\x20`'+CLI_BIN_NAME+_0x40b058(0x113);throw CliErrors[_0x40b058(0xea)]('Alias\x20\x22'+_0x930ac2+_0x40b058(0x11f)+_0x4adaf1);}_0x4a653f=_0x930ac2,_0xddcb59=_0x4d7f27;}else{if(_0x1e1a62){_0xddcb59=_0x1e1a62;const _0x5f1084=_0x2079c7[_0x40b058(0x118)](_0x289450=>_0x289450[_0x40b058(0x121)]===_0x1e1a62);_0x4a653f=_0x5f1084?.['alias'];}else{if(_0x33a54f['nonInteractive'])throw CliErrors[_0x40b058(0xea)](_0x40b058(0x100));else{if(_0x38061d){const _0x162185=_0x2079c7[_0x40b058(0x10c)](_0x133fbb=>_0x133fbb['alias']+'\x20('+_0x133fbb['tableName']+')'),_0x55d99c=await promptSelect(_0x40b058(0xf9),_0x162185),_0x4d75d6=_0x2079c7[_0x55d99c];if(!_0x4d75d6)throw CliErrors[_0x40b058(0xea)]('Invalid\x20dataset\x20selection.');_0x4a653f=_0x4d75d6[_0x40b058(0xec)],_0xddcb59=_0x4d75d6[_0x40b058(0x121)];}else{const _0x5409b2=await listDatasets(_0x33a54f[_0x40b058(0x133)]);if(_0x5409b2[_0x40b058(0x116)]===0x0)throw CliErrors[_0x40b058(0xea)](_0x40b058(0x13c));const _0x19d629=_0x5409b2[_0x40b058(0x10c)](_0x5a44b1=>_0x5a44b1[_0x40b058(0x105)]+'\x20['+(_0x5a44b1['source']??_0x40b058(0x106))+_0x40b058(0x126)+_0x5a44b1[_0x40b058(0x12a)]+')'),_0x18e1cd=await promptSelect('Select\x20dataset:',_0x19d629),_0x4954db=_0x5409b2[_0x18e1cd];if(!_0x4954db)throw CliErrors[_0x40b058(0xea)](_0x40b058(0x128));_0xddcb59=_0x4954db['code'],_0x4a653f=undefined;}}}}const _0x518192=await listDatasets(_0x33a54f[_0x40b058(0x133)]),_0x155c3b=_0x518192[_0x40b058(0x118)](_0x15f370=>_0x15f370[_0x40b058(0x12a)]===_0xddcb59);if(!_0x155c3b)throw CliErrors[_0x40b058(0xea)]('Dataset\x20not\x20found\x20for\x20code\x20\x22'+_0xddcb59+_0x40b058(0x11a)+(_0x4a653f?_0x40b058(0x102)+CLI_BIN_NAME+_0x40b058(0xf1):''));_0x257280=_0x155c3b['id'];const _0x11338c=_0x4a653f??_0xddcb59,_0x55f859=await listBffDatasetOperations(_0x33a54f[_0x40b058(0x133)],_0x257280),_0x107c24=_0x55f859?Object['keys'](_0x55f859):[];if(_0x107c24[_0x40b058(0x116)]===0x0)throw CliErrors[_0x40b058(0xea)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x11338c+'.');let _0x5eabf8;const _0x239e5d=_0x33a54f[_0x40b058(0x12d)](_0x40b058(0x132));if(_0x239e5d){if(!_0x107c24[_0x40b058(0xfd)](_0x239e5d))throw CliErrors[_0x40b058(0xea)](_0x40b058(0xee)+_0x239e5d+'\x22\x20not\x20found\x20for\x20dataset\x20'+_0x11338c+'.\x20'+('Available:\x20'+_0x107c24[_0x40b058(0xed)](',\x20')));_0x5eabf8=_0x239e5d;}else{if(_0x33a54f[_0x40b058(0x109)])throw CliErrors[_0x40b058(0xea)](_0x40b058(0x135));const _0x26cef9=await promptSelect('Select\x20operation\x20type:',_0x107c24);_0x5eabf8=_0x107c24[_0x26cef9]??_0x107c24[0x0];}let _0x1eb4c6=normalizeHookFunctionNode(_0x33a54f[_0x40b058(0x12d)]('function-node'));if(!_0x1eb4c6){if(_0x33a54f['str']('function-node'))throw CliErrors[_0x40b058(0xea)](_0x40b058(0xfc));if(_0x33a54f['nonInteractive'])throw CliErrors[_0x40b058(0xea)](_0x40b058(0x10e));const _0x682fd7=await promptSelect(_0x40b058(0x10d),[_0x40b058(0xfb),_0x40b058(0x134)]);_0x1eb4c6=[_0x40b058(0xfb),_0x40b058(0x134)][_0x682fd7]??_0x40b058(0xfb);}return{'alias':_0x4a653f,'datasetCode':_0xddcb59,'datasetId':_0x257280,'operationType':_0x5eabf8,'functionNode':_0x1eb4c6};}async function promptSelect(_0x1d4df6,_0x4c1bdc){const _0x566272=a30_0x3474b0;if(_0x4c1bdc['length']===0x1)return 0x0;for(const [_0x5b037a,_0x5825e3]of _0x4c1bdc['entries']()){process[_0x566272(0x138)][_0x566272(0x11e)]('\x20\x20'+(_0x5b037a+0x1)+'.\x20'+_0x5825e3+'\x0a');}const _0x69b7b8=createInterface({'input':process['stdin'],'output':process['stderr']});while(!![]){const _0x2b2c53=await new Promise(_0x3e74b0=>{const _0x1622ba=_0x566272;_0x69b7b8[_0x1622ba(0x130)](_0x1d4df6+'\x20',_0x3e74b0);}),_0x7a5078=Number[_0x566272(0x127)](_0x2b2c53[_0x566272(0x119)](),0xa);if(Number[_0x566272(0x114)](_0x7a5078)&&_0x7a5078>=0x1&&_0x7a5078<=_0x4c1bdc[_0x566272(0x116)])return _0x69b7b8['close'](),_0x7a5078-0x1;process['stderr'][_0x566272(0x11e)]('\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20'+_0x4c1bdc[_0x566272(0x116)]+'.\x0a');}}function buildFilePath(_0x340946,_0x43f20b,_0x5b2561,_0x1c712c){const _0x3a5114=a30_0x3474b0;if(_0x43f20b==='HOOK'){if(!_0x1c712c)throw CliErrors['validation'](_0x3a5114(0x137));const _0x1f3a1e=_0x1c712c[_0x3a5114(0xec)]??_0x1c712c['datasetCode'];return join(_0x340946[_0x3a5114(0x13d)],_0x3a5114(0x107),_0x1f3a1e,_0x1c712c[_0x3a5114(0xfa)],_0x1c712c[_0x3a5114(0x11b)],_0x5b2561+'.js');}return join(_0x340946[_0x3a5114(0x13d)],_0x43f20b,_0x5b2561+_0x3a5114(0x103));}export function generateTemplate(_0x34aa63,_0x466942,_0x38d3fc,_0x124ceb,_0x3fa669){const _0x23419e=a30_0x3474b0,_0x9a890f=_0x124ceb?.['trim']()||'TODO:\x20add\x20script\x20description';if(_0x34aa63==='COMMON')return _0x23419e(0x124)+_0x9a890f+_0x23419e(0x12c)+_0x466942+_0x23419e(0x12b)+_0x466942+_0x23419e(0x123)+_0x466942+_0x23419e(0x13a);if(_0x34aa63===_0x23419e(0x129))return _0x23419e(0xff)+_0x9a890f+_0x23419e(0x117)+_0x38d3fc+'/'+_0x466942+_0x23419e(0xeb)+_0x466942+'(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a';if(!_0x3fa669)throw CliErrors[_0x23419e(0xea)](_0x23419e(0x115));return _0x23419e(0x11d)+_0x9a890f+_0x23419e(0x13e)+_0x38d3fc+'/'+_0x3fa669[_0x23419e(0x121)]+'/'+_0x3fa669['operationType']+_0x23419e(0x104)+_0x3fa669[_0x23419e(0x11b)]+_0x23419e(0xf0)+_0x466942+_0x23419e(0x13a);}
|
|
1
|
+
const a30_0x102b87=a30_0x143c;function a30_0x143c(_0x13f236,_0x120a18){_0x13f236=_0x13f236-0x178;const _0x57648e=a30_0x5764();let _0x143cde=_0x57648e[_0x13f236];return _0x143cde;}(function(_0x5168d0,_0x1155a5){const _0x2f2e60=a30_0x143c,_0x16a60d=_0x5168d0();while(!![]){try{const _0x51ab7b=parseInt(_0x2f2e60(0x183))/0x1+-parseInt(_0x2f2e60(0x17e))/0x2+-parseInt(_0x2f2e60(0x1d6))/0x3*(parseInt(_0x2f2e60(0x19c))/0x4)+-parseInt(_0x2f2e60(0x1cb))/0x5+-parseInt(_0x2f2e60(0x1ce))/0x6+-parseInt(_0x2f2e60(0x1a1))/0x7*(parseInt(_0x2f2e60(0x1b5))/0x8)+parseInt(_0x2f2e60(0x1c8))/0x9*(parseInt(_0x2f2e60(0x1b2))/0xa);if(_0x51ab7b===_0x1155a5)break;else _0x16a60d['push'](_0x16a60d['shift']());}catch(_0xcf99ea){_0x16a60d['push'](_0x16a60d['shift']());}}}(a30_0x5764,0x51fda));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';function a30_0x5764(){const _0x38e4a9=['alias','COMMON','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Current\x20request\x20params\x20or\x20response\x20result.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Modified\x20params\x20object.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','Script\x20description','validation','\x0a\x20*\x20[接口路径]\x20POST\x20/api/endpoint/{appCode}/{scriptName}\x0a\x20*\x20[当前示例]\x20POST\x20/api/endpoint/','ENDPOINT','question','(params,\x20context)\x20{\x0a\x20\x20return\x20params;\x0a}\x0a','create','Select\x20operation\x20type:','\x20\x20Enter\x20a\x20number\x20between\x201\x20and\x20','HOOK','parseInt','nonInteractive','stdin','Invalid\x20function\x20name\x20\x22','scriptsRootDir','name','Invalid\x20dataset\x20selection.','910104cMARTT','datasetCode','includes','function-node',']\x20(','28DEKZPT','Operation\x20type\x20(HOOK\x20only)','Function\x20name\x20(valid\x20JS\x20identifier)','join','No\x20datasets\x20found\x20for\x20this\x20app.','HOOK\x20requires\x20alias/operation/node\x20options.','\x20api\x20pull`\x20first,\x20or\x20use\x20--datasetcode\x20instead.','before','read','Select\x20trigger\x20node:','\x20api\x20pull`\x20to\x20refresh.','--function-node\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','functionNode','\x0a\x20*\x20[脚本类型]\x20COMMON\x0a\x20*\x20[本地路径]\x20.rabetbase/bff/COMMON/','/**\x0a\x20*\x20HOOK\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','Dataset\x20not\x20found\x20for\x20code\x20\x22','Operation\x20type\x20\x22','686050PiIQST','.js','entries','1172216epKkjm','apiDir','/**\x0a\x20*\x20ENDPOINT\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','source','File\x20already\x20exists:\x20','bff','operationType','close','operation-type','after','description','datasetcode','\x0a\x20*\x20[脚本名称]\x20','/**\x0a\x20*\x20COMMON\x20function\x20template.\x0a\x20*\x0a\x20*\x20[脚本描述]\x20','\x22\x20not\x20found.\x20','\x22\x20not\x20found\x20for\x20dataset\x20','\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Request\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Business\x20result\x20(wrapped\x20in\x20response.data).\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20','UNKNOWN','Scaffold\x20a\x20new\x20BFF\x20function\x20from\x20template','279FrPQpG','length','string','3316035wbPMXL','Alias\x20\x22','appCode','869190qcFPjG','\x0a\x20*\x20[触发节点]\x20','No\x20api.ts\x20found.\x20Run\x20`','Available:\x20','isInteger','\x20function:\x20','tableName','type','6NdFZgg','Dataset\x20alias\x20from\x20api.ts\x20(HOOK\x20only,\x20preferred)','Select\x20dataset:','write','map','str','find','325806QsLcco','--operation-type\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.','code','stderr','trim','221214VKXBGP','The\x20api.ts\x20may\x20be\x20stale\x20—\x20run\x20`','\x22.\x20','TODO:\x20add\x20script\x20description','.js\x0a\x20*\x0a\x20*\x20@param\x20{Object}\x20params\x20-\x20Input\x20parameters.\x0a\x20*\x20@param\x20{Object}\x20context\x20-\x20Execution\x20context\x20(injected\x20by\x20platform).\x0a\x20*\x20@returns\x20{Promise<Object>}\x20Processing\x20result.\x0a\x20*/\x0aexport\x20default\x20async\x20function\x20'];a30_0x5764=function(){return _0x38e4a9;};return a30_0x5764();}import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{fileExists}from'../../core/bff/file-system.js';import{isValidBffFunctionName,normalizeHookFunctionNode}from'../../core/bff/utils.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const bffCreate={'service':a30_0x102b87(0x1ba),'command':a30_0x102b87(0x191),'description':a30_0x102b87(0x1c7),'risk':a30_0x102b87(0x1a9),'flags':[{'name':'type','type':'string','required':!![],'enum':[a30_0x102b87(0x189),a30_0x102b87(0x18e),'HOOK'],'description':'Script\x20type'},{'name':'name','type':a30_0x102b87(0x1ca),'required':!![],'description':a30_0x102b87(0x1a3)},{'name':'description','type':a30_0x102b87(0x1ca),'description':a30_0x102b87(0x18b)},{'name':a30_0x102b87(0x188),'type':a30_0x102b87(0x1ca),'description':a30_0x102b87(0x178)},{'name':a30_0x102b87(0x1c0),'type':a30_0x102b87(0x1ca),'description':'Dataset\x20code\x20(HOOK\x20only,\x20fallback\x20when\x20alias\x20unavailable)'},{'name':a30_0x102b87(0x1bd),'type':a30_0x102b87(0x1ca),'description':a30_0x102b87(0x1a2)},{'name':a30_0x102b87(0x19f),'type':a30_0x102b87(0x1ca),'description':'Trigger\x20node\x20(HOOK\x20only)','enum':['before',a30_0x102b87(0x1be)]}],async 'validate'(_0x3952af){const _0x202701=a30_0x102b87,_0x43a092=_0x3952af[_0x202701(0x17c)]('name');if(!isValidBffFunctionName(_0x43a092))throw CliErrors[_0x202701(0x18c)](_0x202701(0x198)+_0x43a092+'\x22.\x20Must\x20be\x20a\x20valid\x20JS\x20identifier\x20(e.g.\x20createOrder,\x20beforeFilter).');},async 'execute'(_0x3d024f){const _0xc7f182=a30_0x102b87,_0x1ccdea=loadBffProjectConfig(_0x3d024f[_0xc7f182(0x1cd)]),_0x437bba=_0x3d024f[_0xc7f182(0x17c)](_0xc7f182(0x1d5)),_0x24e1f8=_0x3d024f[_0xc7f182(0x17c)]('name'),_0x4781ef=_0x3d024f['str'](_0xc7f182(0x1bf))||undefined,_0x7699b=_0x437bba===_0xc7f182(0x194)?await resolveHookOptions(_0x1ccdea,_0x3d024f):undefined,_0xb3b62d=buildFilePath(_0x1ccdea,_0x437bba,_0x24e1f8,_0x7699b);if(await fileExists(_0xb3b62d))throw CliErrors[_0xc7f182(0x18c)](_0xc7f182(0x1b9)+_0xb3b62d);await mkdir(dirname(_0xb3b62d),{'recursive':!![]});const _0x16e9b5=generateTemplate(_0x437bba,_0x24e1f8,_0x3d024f[_0xc7f182(0x1cd)],_0x4781ef,_0x7699b);await writeFile(_0xb3b62d,_0x16e9b5,'utf8');const _0x207748={'type':_0x437bba,'name':_0x24e1f8,'path':_0xb3b62d};if(_0x4781ef)_0x207748[_0xc7f182(0x1bf)]=_0x4781ef;if(_0x7699b){if(_0x7699b[_0xc7f182(0x188)])_0x207748[_0xc7f182(0x188)]=_0x7699b[_0xc7f182(0x188)];_0x207748[_0xc7f182(0x19d)]=_0x7699b[_0xc7f182(0x19d)],_0x207748[_0xc7f182(0x1bb)]=_0x7699b[_0xc7f182(0x1bb)],_0x207748[_0xc7f182(0x1ad)]=_0x7699b[_0xc7f182(0x1ad)];}return{'ok':!![],'data':_0x207748,'message':'Created\x20'+_0x437bba+_0xc7f182(0x1d3)+_0x24e1f8};}};async function resolveHookOptions(_0x3e3605,_0x3e84f0){const _0x15fad6=a30_0x102b87,_0xc074ad=loadAliasMap(_0x3e84f0[_0x15fad6(0x1b6)],undefined,resolveApiFilePath(_0x3e84f0['apiDir'],_0x3e84f0['appCode'])),_0x830686=_0xc074ad[_0x15fad6(0x1c9)]>0x0;let _0x58d0e1,_0xcf74ca,_0x14a7f9;const _0x1ec0d4=_0x3e84f0[_0x15fad6(0x17c)]('alias'),_0x5a8e0c=_0x3e84f0[_0x15fad6(0x17c)]('datasetcode');if(_0x1ec0d4){const _0x5ddeab=resolveAlias(_0x3e84f0['apiDir'],_0x1ec0d4,undefined,resolveApiFilePath(_0x3e84f0[_0x15fad6(0x1b6)],_0x3e84f0[_0x15fad6(0x1cd)]));if(!_0x5ddeab){const _0x5d634c=_0x830686?'Available\x20aliases:\x20'+_0xc074ad['map'](_0x2ab6ce=>_0x2ab6ce[_0x15fad6(0x188)])[_0x15fad6(0x1a4)](',\x20'):_0x15fad6(0x1d0)+CLI_BIN_NAME+_0x15fad6(0x1a7);throw CliErrors[_0x15fad6(0x18c)](_0x15fad6(0x1cc)+_0x1ec0d4+_0x15fad6(0x1c3)+_0x5d634c);}_0x58d0e1=_0x1ec0d4,_0xcf74ca=_0x5ddeab;}else{if(_0x5a8e0c){_0xcf74ca=_0x5a8e0c;const _0x5405ed=_0xc074ad[_0x15fad6(0x17d)](_0x393b74=>_0x393b74[_0x15fad6(0x19d)]===_0x5a8e0c);_0x58d0e1=_0x5405ed?.[_0x15fad6(0x188)];}else{if(_0x3e84f0['nonInteractive'])throw CliErrors['validation']('--alias\x20or\x20--datasetcode\x20is\x20required\x20for\x20HOOK\x20in\x20non-interactive\x20mode.');else{if(_0x830686){const _0x239c94=_0xc074ad[_0x15fad6(0x17b)](_0xff8819=>_0xff8819[_0x15fad6(0x188)]+'\x20('+_0xff8819[_0x15fad6(0x1d4)]+')'),_0x4040b6=await promptSelect(_0x15fad6(0x179),_0x239c94),_0x4790b4=_0xc074ad[_0x4040b6];if(!_0x4790b4)throw CliErrors[_0x15fad6(0x18c)]('Invalid\x20dataset\x20selection.');_0x58d0e1=_0x4790b4[_0x15fad6(0x188)],_0xcf74ca=_0x4790b4['datasetCode'];}else{const _0x1d23c8=await listDatasets(_0x3e84f0[_0x15fad6(0x1cd)]);if(_0x1d23c8[_0x15fad6(0x1c9)]===0x0)throw CliErrors['validation'](_0x15fad6(0x1a5));const _0x14b55a=_0x1d23c8[_0x15fad6(0x17b)](_0x558726=>_0x558726[_0x15fad6(0x19a)]+'\x20['+(_0x558726[_0x15fad6(0x1b8)]??_0x15fad6(0x1c6))+_0x15fad6(0x1a0)+_0x558726[_0x15fad6(0x180)]+')'),_0x5e0abc=await promptSelect('Select\x20dataset:',_0x14b55a),_0x1a51c1=_0x1d23c8[_0x5e0abc];if(!_0x1a51c1)throw CliErrors[_0x15fad6(0x18c)](_0x15fad6(0x19b));_0xcf74ca=_0x1a51c1[_0x15fad6(0x180)],_0x58d0e1=undefined;}}}}const _0x1b21b3=await listDatasets(_0x3e84f0[_0x15fad6(0x1cd)]),_0x2b4bb0=_0x1b21b3[_0x15fad6(0x17d)](_0x2e9c65=>_0x2e9c65[_0x15fad6(0x180)]===_0xcf74ca);if(!_0x2b4bb0)throw CliErrors[_0x15fad6(0x18c)](_0x15fad6(0x1b0)+_0xcf74ca+_0x15fad6(0x185)+(_0x58d0e1?_0x15fad6(0x184)+CLI_BIN_NAME+_0x15fad6(0x1ab):''));_0x14a7f9=_0x2b4bb0['id'];const _0x2a7b5b=_0x58d0e1??_0xcf74ca,_0x4cabcf=await listBffDatasetOperations(_0x3e84f0['appCode'],_0x14a7f9),_0xdfcfbc=_0x4cabcf?Object['keys'](_0x4cabcf):[];if(_0xdfcfbc[_0x15fad6(0x1c9)]===0x0)throw CliErrors[_0x15fad6(0x18c)]('No\x20operation\x20types\x20found\x20for\x20dataset\x20'+_0x2a7b5b+'.');let _0x45ef16;const _0x2f653e=_0x3e84f0['str'](_0x15fad6(0x1bd));if(_0x2f653e){if(!_0xdfcfbc[_0x15fad6(0x19e)](_0x2f653e))throw CliErrors[_0x15fad6(0x18c)](_0x15fad6(0x1b1)+_0x2f653e+_0x15fad6(0x1c4)+_0x2a7b5b+'.\x20'+(_0x15fad6(0x1d1)+_0xdfcfbc[_0x15fad6(0x1a4)](',\x20')));_0x45ef16=_0x2f653e;}else{if(_0x3e84f0[_0x15fad6(0x196)])throw CliErrors[_0x15fad6(0x18c)](_0x15fad6(0x17f));const _0x5670bd=await promptSelect(_0x15fad6(0x192),_0xdfcfbc);_0x45ef16=_0xdfcfbc[_0x5670bd]??_0xdfcfbc[0x0];}let _0x1a910e=normalizeHookFunctionNode(_0x3e84f0[_0x15fad6(0x17c)](_0x15fad6(0x19f)));if(!_0x1a910e){if(_0x3e84f0[_0x15fad6(0x17c)]('function-node'))throw CliErrors[_0x15fad6(0x18c)]('--function-node\x20must\x20be\x20\x27before\x27\x20or\x20\x27after\x27.');if(_0x3e84f0['nonInteractive'])throw CliErrors[_0x15fad6(0x18c)](_0x15fad6(0x1ac));const _0x3b0451=await promptSelect(_0x15fad6(0x1aa),[_0x15fad6(0x1a8),'after']);_0x1a910e=[_0x15fad6(0x1a8),_0x15fad6(0x1be)][_0x3b0451]??_0x15fad6(0x1a8);}return{'alias':_0x58d0e1,'datasetCode':_0xcf74ca,'datasetId':_0x14a7f9,'operationType':_0x45ef16,'functionNode':_0x1a910e};}async function promptSelect(_0x1252ef,_0x4560e1){const _0x4fed5e=a30_0x102b87;if(_0x4560e1[_0x4fed5e(0x1c9)]===0x1)return 0x0;for(const [_0x398236,_0x28a103]of _0x4560e1[_0x4fed5e(0x1b4)]()){process['stderr'][_0x4fed5e(0x17a)]('\x20\x20'+(_0x398236+0x1)+'.\x20'+_0x28a103+'\x0a');}const _0x5cf5b9=createInterface({'input':process[_0x4fed5e(0x197)],'output':process[_0x4fed5e(0x181)]});while(!![]){const _0x4052e0=await new Promise(_0x4cb93d=>{const _0x283c5b=_0x4fed5e;_0x5cf5b9[_0x283c5b(0x18f)](_0x1252ef+'\x20',_0x4cb93d);}),_0x451369=Number[_0x4fed5e(0x195)](_0x4052e0['trim'](),0xa);if(Number[_0x4fed5e(0x1d2)](_0x451369)&&_0x451369>=0x1&&_0x451369<=_0x4560e1[_0x4fed5e(0x1c9)])return _0x5cf5b9[_0x4fed5e(0x1bc)](),_0x451369-0x1;process[_0x4fed5e(0x181)][_0x4fed5e(0x17a)](_0x4fed5e(0x193)+_0x4560e1[_0x4fed5e(0x1c9)]+'.\x0a');}}function buildFilePath(_0x56f076,_0x5a730e,_0x3900f8,_0x509991){const _0x1bc53f=a30_0x102b87;if(_0x5a730e===_0x1bc53f(0x194)){if(!_0x509991)throw CliErrors[_0x1bc53f(0x18c)](_0x1bc53f(0x1a6));const _0xf6fb5b=_0x509991[_0x1bc53f(0x188)]??_0x509991['datasetCode'];return join(_0x56f076[_0x1bc53f(0x199)],_0x1bc53f(0x194),_0xf6fb5b,_0x509991[_0x1bc53f(0x1bb)],_0x509991['functionNode'],_0x3900f8+'.js');}return join(_0x56f076['scriptsRootDir'],_0x5a730e,_0x3900f8+_0x1bc53f(0x1b3));}export function generateTemplate(_0x2da1cc,_0x326322,_0x5d2e21,_0x4a9b4e,_0x43ca45){const _0x1ef82f=a30_0x102b87,_0x1c4b1c=_0x4a9b4e?.[_0x1ef82f(0x182)]()||_0x1ef82f(0x186);if(_0x2da1cc===_0x1ef82f(0x189))return _0x1ef82f(0x1c2)+_0x1c4b1c+_0x1ef82f(0x1c1)+_0x326322+_0x1ef82f(0x1ae)+_0x326322+_0x1ef82f(0x187)+_0x326322+_0x1ef82f(0x190);if(_0x2da1cc===_0x1ef82f(0x18e))return _0x1ef82f(0x1b7)+_0x1c4b1c+_0x1ef82f(0x18d)+_0x5d2e21+'/'+_0x326322+_0x1ef82f(0x1c5)+_0x326322+_0x1ef82f(0x190);if(!_0x43ca45)throw CliErrors['validation']('HOOK\x20requires\x20hookOptions\x20for\x20template\x20generation.');return _0x1ef82f(0x1af)+_0x1c4b1c+'\x0a\x20*\x20[接口路径]\x20POST\x20/api/'+_0x5d2e21+'/'+_0x43ca45[_0x1ef82f(0x19d)]+'/'+_0x43ca45['operationType']+_0x1ef82f(0x1cf)+_0x43ca45[_0x1ef82f(0x1ad)]+_0x1ef82f(0x18a)+_0x326322+_0x1ef82f(0x190);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a31_0x3f4b6e=a31_0x45f0;(function(_0x63e67e,_0x1bf61c){const _0x40d481=a31_0x45f0,_0x127228=_0x63e67e();while(!![]){try{const _0x213fb8=-parseInt(_0x40d481(0x130))/0x1*(-parseInt(_0x40d481(0x13e))/0x2)+-parseInt(_0x40d481(0x12b))/0x3+parseInt(_0x40d481(0x157))/0x4+parseInt(_0x40d481(0x14a))/0x5+-parseInt(_0x40d481(0x12e))/0x6*(parseInt(_0x40d481(0x132))/0x7)+-parseInt(_0x40d481(0x133))/0x8+parseInt(_0x40d481(0x158))/0x9;if(_0x213fb8===_0x1bf61c)break;else _0x127228['push'](_0x127228['shift']());}catch(_0x2090c2){_0x127228['push'](_0x127228['shift']());}}}(a31_0xa984,0x283da));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';function a31_0x45f0(_0x548eb8,_0x34252a){_0x548eb8=_0x548eb8-0x127;const _0xa98410=a31_0xa984();let _0x45f054=_0xa98410[_0x548eb8];return _0x45f054;}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':a31_0x3f4b6e(0x14f),'command':'delete','description':a31_0x3f4b6e(0x136),'risk':'high-risk-write','flags':[{'name':a31_0x3f4b6e(0x13f),'type':a31_0x3f4b6e(0x14c),'required':!![],'description':a31_0x3f4b6e(0x127)}],async 'validate'(_0x23d9e6){const _0x3c7cdb=a31_0x3f4b6e,_0x49cf59=loadBffProjectConfig(_0x23d9e6['appCode']),_0x2b5bfd=await readBffLockFile(_0x49cf59[_0x3c7cdb(0x156)]);if(!_0x2b5bfd)throw CliErrors['validation']('BFF\x20lock\x20file\x20not\x20found.\x20Run\x20`push`\x20or\x20`pull`\x20first\x20to\x20initialize\x20sync\x20state.');},async 'dryRun'(_0x3a610e){const _0x182782=a31_0x3f4b6e,_0x42f228=loadBffProjectConfig(_0x3a610e['appCode']),_0x1deaf5=await readBffLockFile(_0x42f228['lockFilePath']);if(!_0x1deaf5)throw CliErrors[_0x182782(0x12c)](_0x182782(0x128));const {appLock:_0x36639c}=ensureLockScope(_0x1deaf5,_0x3a610e['appCode'],_0x42f228[_0x182782(0x139)],'delete'),_0x44c06f=_0x3a610e['str'](_0x182782(0x13f)),_0x2832b3=Object[_0x182782(0x153)](_0x36639c[_0x182782(0x150)]),_0x580bf1=resolveDeleteTarget(_0x44c06f,_0x2832b3),_0xa418c4=_0x36639c[_0x182782(0x150)][_0x580bf1];if(!_0xa418c4)throw CliErrors['validation'](_0x182782(0x142)+_0x580bf1+'\x22.');const _0xe4850d=resolveLocalFilePathFromLockKey(_0x42f228,_0x580bf1),_0x1bcb89=relative(_0x42f228[_0x182782(0x148)],_0xe4850d),_0x5cf80e=join(_0x42f228['trashDir'],_0x182782(0x13d),_0x1bcb89);return{'method':_0x182782(0x134),'url':_0x182782(0x146),'body':{'appCode':_0x3a610e[_0x182782(0x154)],'target':_0x580bf1,'remoteId':_0xa418c4['remoteId'],'localFilePath':_0xe4850d,'trashedPath':_0x5cf80e},'description':_0x182782(0x140)+_0x580bf1+_0x182782(0x151)};},async 'execute'(_0x1db95e){const _0x54a25a=a31_0x3f4b6e,_0x8b0b08=loadBffProjectConfig(_0x1db95e['appCode']),_0x2fce7c=await readBffLockFile(_0x8b0b08['lockFilePath']);if(!_0x2fce7c)throw CliErrors[_0x54a25a(0x12c)](_0x54a25a(0x128));const {lockData:_0x3783da,appLock:_0x3b38c4}=ensureLockScope(_0x2fce7c,_0x1db95e[_0x54a25a(0x154)],_0x8b0b08['scriptsRoot'],_0x54a25a(0x138)),_0x40ca4c=JSON[_0x54a25a(0x147)](JSON[_0x54a25a(0x145)](_0x3783da)),_0x210d7b=_0x40ca4c[_0x54a25a(0x149)][_0x1db95e[_0x54a25a(0x154)]];if(!_0x210d7b)throw new Error(_0x54a25a(0x13c)+_0x1db95e[_0x54a25a(0x154)]+_0x54a25a(0x12d));const _0x2f42d2=_0x1db95e[_0x54a25a(0x155)](_0x54a25a(0x13f)),_0x72e730=Object['keys'](_0x210d7b[_0x54a25a(0x150)]),_0x39ab91=resolveDeleteTarget(_0x2f42d2,_0x72e730),_0x44f3ae=_0x210d7b[_0x54a25a(0x150)][_0x39ab91];if(!_0x44f3ae)throw CliErrors[_0x54a25a(0x12c)](_0x54a25a(0x142)+_0x39ab91+'\x22.');await deleteBffScript(_0x44f3ae[_0x54a25a(0x13a)]),delete _0x210d7b['functions'][_0x39ab91],_0x210d7b[_0x54a25a(0x135)]=new Date()[_0x54a25a(0x159)](),await writeBffLockFile(_0x8b0b08[_0x54a25a(0x156)],_0x40ca4c);const _0x35741b=resolveLocalFilePathFromLockKey(_0x8b0b08,_0x39ab91);let _0x5bc9de;await fileExists(_0x35741b)&&(_0x5bc9de=await moveToTrash(_0x8b0b08[_0x54a25a(0x148)],_0x8b0b08[_0x54a25a(0x129)],_0x35741b),await cleanupEmptyDirectories(dirname(_0x35741b),_0x8b0b08['scriptsRootDir']));await waitForDeleteSettlement(_0x8b0b08[_0x54a25a(0x156)],_0x1db95e['appCode'],_0x39ab91,_0x35741b),await sleep(0x96);const _0x148b04={'deleted':_0x39ab91,'remoteId':_0x44f3ae['remoteId']};if(_0x5bc9de)_0x148b04[_0x54a25a(0x137)]=_0x5bc9de;return{'ok':!![],'data':_0x148b04,'message':_0x54a25a(0x15a)+_0x39ab91+(_0x5bc9de?_0x54a25a(0x141):'')};}};function resolveDeleteTarget(_0x4624f2,_0x190e0d){const _0x1f529f=a31_0x3f4b6e;if(_0x4624f2[_0x1f529f(0x12a)]('/')){const _0x433711=_0x190e0d[_0x1f529f(0x143)](_0x15c3c7=>_0x15c3c7===_0x4624f2);if(!_0x433711)throw CliErrors[_0x1f529f(0x12c)](_0x1f529f(0x14d)+_0x4624f2);return _0x433711;}const _0xa392f=_0x190e0d[_0x1f529f(0x152)](_0x5a439c=>_0x5a439c['split']('/')['at'](-0x1)===_0x4624f2);if(_0xa392f[_0x1f529f(0x144)]===0x0)throw CliErrors[_0x1f529f(0x12c)](_0x1f529f(0x14d)+_0x4624f2);if(_0xa392f[_0x1f529f(0x144)]>0x1)throw CliErrors[_0x1f529f(0x12c)](_0x1f529f(0x13b)+_0x4624f2+'\x22.\x20Use\x20the\x20full\x20lock\x20key:\x0a'+_0xa392f[_0x1f529f(0x14e)](_0x523faa=>_0x1f529f(0x14b)+_0x523faa)['join']('\x0a'));return _0xa392f[0x0];}async function moveToTrash(_0xd45c01,_0x24873b,_0x261f5f){const _0x2873af=a31_0x3f4b6e,_0x463863=new Date()['toISOString']()[_0x2873af(0x131)](/[:.]/g,'-'),_0x248775=relative(_0xd45c01,_0x261f5f),_0x436945=join(_0x24873b,_0x463863,_0x248775);return await mkdir(dirname(_0x436945),{'recursive':!![]}),await rename(_0x261f5f,_0x436945),_0x436945;}async function cleanupEmptyDirectories(_0x561e1c,_0x485593){const _0xabae1b=a31_0x3f4b6e;let _0x2bdd7a=resolve(_0x561e1c);const _0x2b217f=resolve(_0x485593);while(_0x2bdd7a[_0xabae1b(0x12f)](''+_0x2b217f+sep)||_0x2bdd7a===_0x2b217f){if(_0x2bdd7a===_0x2b217f)return;try{const _0x34257f=await readdir(_0x2bdd7a);if(_0x34257f[_0xabae1b(0x144)]>0x0)return;await rmdir(_0x2bdd7a);}catch{return;}_0x2bdd7a=dirname(_0x2bdd7a);}}const DELETE_SETTLE_RETRY_COUNT=0x14,DELETE_SETTLE_DELAY_MS=0x64;async function waitForDeleteSettlement(_0x3909b7,_0x4439d7,_0x40087b,_0x304c65){const _0x5e9ddb=a31_0x3f4b6e;for(let _0x41e4b4=0x0;_0x41e4b4<DELETE_SETTLE_RETRY_COUNT;_0x41e4b4+=0x1){const _0xdbba90=await readBffLockFile(_0x3909b7),_0x232d0a=!!_0xdbba90?.[_0x5e9ddb(0x149)]?.[_0x4439d7]?.['functions']?.[_0x40087b],_0x139e99=await fileExists(_0x304c65);if(!_0x232d0a&&!_0x139e99)return;await sleep(DELETE_SETTLE_DELAY_MS);}throw new Error('Local\x20delete\x20not\x20settled\x20for\x20'+_0x40087b+'.');}function a31_0xa984(){const _0x20ea83=['143376SzSjSJ','validation','\x22\x20not\x20found\x20after\x20ensureLockScope.','531504PfPxme','startsWith','22416jgCOSG','replace','7gyhldT','1680304XQIMfw','POST','lastSync','Delete\x20a\x20BFF\x20script\x20from\x20remote\x20and\x20local','trashedTo','delete','scriptsRoot','remoteId','Multiple\x20functions\x20match\x20\x22','Lock\x20scope\x20for\x20app\x20\x22','<timestamp>','18HYjhbJ','target','Would\x20delete\x20','\x20(local\x20file\x20moved\x20to\x20trash)','No\x20lock\x20entry\x20found\x20for\x20\x22','find','length','stringify','/api/management/library/scripts/delete','parse','projectRoot','apps','207335xIoCFw','\x20\x20-\x20','string','Function\x20not\x20found:\x20','map','bff','functions','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20trash','filter','keys','appCode','str','lockFilePath','882172kAPaSa','427374xAIqYT','toISOString','Deleted\x20','Lock\x20key\x20(e.g.\x20ENDPOINT/createOrder)\x20or\x20short\x20function\x20name','BFF\x20lock\x20file\x20not\x20found.','trashDir','includes'];a31_0xa984=function(){return _0x20ea83;};return a31_0xa984();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a32_0x9c62(_0x1b041e,_0x4cd93c){_0x1b041e=_0x1b041e-0x13c;const _0x4b2dee=a32_0x4b2d();let _0x9c62=_0x4b2dee[_0x1b041e];return _0x9c62;}const a32_0x271085=a32_0x9c62;(function(_0x5a3d80,_0x55214f){const _0x160c82=a32_0x9c62,_0x5c0d98=_0x5a3d80();while(!![]){try{const _0x12dbc9=parseInt(_0x160c82(0x143))/0x1*(parseInt(_0x160c82(0x146))/0x2)+-parseInt(_0x160c82(0x147))/0x3+parseInt(_0x160c82(0x152))/0x4*(-parseInt(_0x160c82(0x144))/0x5)+parseInt(_0x160c82(0x13e))/0x6+-parseInt(_0x160c82(0x150))/0x7*(-parseInt(_0x160c82(0x148))/0x8)+-parseInt(_0x160c82(0x14f))/0x9+-parseInt(_0x160c82(0x13c))/0xa*(-parseInt(_0x160c82(0x153))/0xb);if(_0x12dbc9===_0x55214f)break;else _0x5c0d98['push'](_0x5c0d98['shift']());}catch(_0x3ca82c){_0x5c0d98['push'](_0x5c0d98['shift']());}}}(a32_0x4b2d,0xbc1f9));import{getBffScriptInfo}from'../../core/api-client.js';export const bffDetail={'service':'bff','command':a32_0x271085(0x13f),'description':a32_0x271085(0x13d),'risk':a32_0x271085(0x14a),'flags':[{'name':'id','type':a32_0x271085(0x14c),'required':!![],'description':a32_0x271085(0x151)},{'name':'verbose','type':a32_0x271085(0x14b),'description':a32_0x271085(0x149)}],async 'execute'(_0x2045f2){const _0x51d9f3=a32_0x271085,_0x51509e=await getBffScriptInfo(_0x2045f2['num']('id')),_0x168450=_0x2045f2[_0x51d9f3(0x141)](_0x51d9f3(0x145));if(_0x168450)return{'ok':!![],'data':_0x51509e};return{'ok':!![],'data':{'id':_0x51509e['id'],'appCode':_0x51509e['appCode'],'scriptType':_0x51509e['scriptType'],'description':_0x51509e['description']||_0x51d9f3(0x142),'createdTime':_0x51509e[_0x51d9f3(0x14d)]??'','updatedTime':_0x51509e[_0x51d9f3(0x140)]??'','scriptContent':_0x51509e[_0x51d9f3(0x14e)]??''}};}};function a32_0x4b2d(){const _0x213058=['4382901HhNmly','553JCMHLw','Script\x20ID','10784pMlYsc','2424037SsvCAK','70yBdZtD','Get\x20BFF\x20script\x20details\x20by\x20ID','577488cmrbhS','detail','updatedTime','bool','(none)','2sWrNQK','95HNNTtI','verbose','172502NOVhtO','1833297MCOBpc','10992vUOJkm','Return\x20full\x20raw\x20script\x20object','read','boolean','number','createdTime','scriptContent'];a32_0x4b2d=function(){return _0x213058;};return a32_0x4b2d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x888702,_0x3f5981){const _0x4351cc=a33_0x135b,_0x2b31c8=_0x888702();while(!![]){try{const _0x1e9083=parseInt(_0x4351cc(0x16d))/0x1+-parseInt(_0x4351cc(0x16e))/0x2+-parseInt(_0x4351cc(0x174))/0x3+parseInt(_0x4351cc(0x171))/0x4*(-parseInt(_0x4351cc(0x16c))/0x5)+-parseInt(_0x4351cc(0x170))/0x6*(parseInt(_0x4351cc(0x173))/0x7)+parseInt(_0x4351cc(0x16b))/0x8+-parseInt(_0x4351cc(0x16f))/0x9*(-parseInt(_0x4351cc(0x172))/0xa);if(_0x1e9083===_0x3f5981)break;else _0x2b31c8['push'](_0x2b31c8['shift']());}catch(_0x2da50f){_0x2b31c8['push'](_0x2b31c8['shift']());}}}(a33_0x1e92,0x6e608));import{bffList}from'../../commands/bff/list.js';import{bffDetail}from'../../commands/bff/detail.js';import{bffStatus}from'../../commands/bff/status.js';import{bffCreate}from'../../commands/bff/create.js';import{bffPush}from'../../commands/bff/push.js';import{bffPull}from'../../commands/bff/pull.js';import{bffDelete}from'../../commands/bff/delete.js';function a33_0x135b(_0x53dcf5,_0x329cf8){_0x53dcf5=_0x53dcf5-0x16b;const _0x1e921f=a33_0x1e92();let _0x135b24=_0x1e921f[_0x53dcf5];return _0x135b24;}export const bffDefinitions=[bffList,bffDetail,bffStatus,bffCreate,bffPush,bffPull,bffDelete];function a33_0x1e92(){const _0x6b3f81=['261LjqquI','4176KymjZe','4DDlzwr','770410GkQMQx','8071qYycPx','95163BhgEmy','646240rCbANd','1271915DVqCYW','94882XBCAgt','1738310ADqzMT'];a33_0x1e92=function(){return _0x6b3f81;};return a33_0x1e92();}
|
package/lib/commands/bff/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a34_0x4dc76=a34_0x59a8;function a34_0x59a8(_0x550963,_0x221bed){_0x550963=_0x550963-0x198;const _0x208e2d=a34_0x208e();let _0x59a89f=_0x208e2d[_0x550963];return _0x59a89f;}(function(_0x49ed46,_0x33dca1){const _0x49d051=a34_0x59a8,_0x12f1f4=_0x49ed46();while(!![]){try{const _0x4758cc=-parseInt(_0x49d051(0x1a4))/0x1+parseInt(_0x49d051(0x1ac))/0x2*(parseInt(_0x49d051(0x1b6))/0x3)+parseInt(_0x49d051(0x19f))/0x4*(-parseInt(_0x49d051(0x1a5))/0x5)+parseInt(_0x49d051(0x1b7))/0x6+-parseInt(_0x49d051(0x1b2))/0x7*(parseInt(_0x49d051(0x1b3))/0x8)+-parseInt(_0x49d051(0x1ab))/0x9*(parseInt(_0x49d051(0x19e))/0xa)+parseInt(_0x49d051(0x1a3))/0xb;if(_0x4758cc===_0x33dca1)break;else _0x12f1f4['push'](_0x12f1f4['shift']());}catch(_0x47c669){_0x12f1f4['push'](_0x12f1f4['shift']());}}}(a34_0x208e,0x32d3f));import{listBffScripts}from'../../core/api-client.js';function a34_0x208e(){const _0x3c7c6f=['17710EoIjFL','name','length','appCode','scriptType','description','9eXhsui','114888cCzBSc','str','functionName','map','Return\x20full\x20script\x20objects','verbose','64029ldZbnT','168voiOYp','ENDPOINT','Filter\x20by\x20script\x20name','21aVQKmq','2273214LSxGQl','string','bool','COMMON','List\x20BFF\x20scripts','list','(unnamed)','1859080pDLQmk','40aDuEWv','boolean','read','type','562452NupJZX','210503tryERu'];a34_0x208e=function(){return _0x3c7c6f;};return a34_0x208e();}export const bffList={'service':'bff','command':a34_0x4dc76(0x19c),'description':a34_0x4dc76(0x19b),'risk':a34_0x4dc76(0x1a1),'flags':[{'name':a34_0x4dc76(0x1a2),'type':a34_0x4dc76(0x198),'description':'Script\x20type\x20filter','default':'ENDPOINT','enum':[a34_0x4dc76(0x1b4),a34_0x4dc76(0x19a)]},{'name':a34_0x4dc76(0x1a6),'type':a34_0x4dc76(0x198),'description':a34_0x4dc76(0x1b5)},{'name':'verbose','type':a34_0x4dc76(0x1a0),'description':a34_0x4dc76(0x1b0)}],async 'execute'(_0x20d95a){const _0x38a767=a34_0x4dc76,_0x42d1b2=await listBffScripts(_0x20d95a[_0x38a767(0x1a8)],_0x20d95a[_0x38a767(0x1ad)](_0x38a767(0x1a2)),{'scriptName':_0x20d95a['str'](_0x38a767(0x1a6))||undefined}),_0x14decd=_0x20d95a[_0x38a767(0x199)](_0x38a767(0x1b1));return{'ok':!![],'data':_0x14decd?_0x42d1b2:_0x42d1b2[_0x38a767(0x1af)](_0x4c6729=>({'id':_0x4c6729['id'],'functionName':_0x4c6729[_0x38a767(0x1ae)]??'','description':_0x4c6729[_0x38a767(0x1aa)]||_0x38a767(0x19d),'scriptType':_0x4c6729[_0x38a767(0x1a9)]})),'message':_0x42d1b2[_0x38a767(0x1a7)]===0x0?'No\x20BFF\x20scripts\x20found.':undefined};}};
|
package/lib/commands/bff/pull.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x151f79=a35_0x526c;(function(_0x32ab6d,_0x168313){const _0x39d838=a35_0x526c,_0x35dcd6=_0x32ab6d();while(!![]){try{const _0x11c494=-parseInt(_0x39d838(0x19d))/0x1*(parseInt(_0x39d838(0x18b))/0x2)+parseInt(_0x39d838(0x181))/0x3+-parseInt(_0x39d838(0x1b6))/0x4+parseInt(_0x39d838(0x1ab))/0x5*(parseInt(_0x39d838(0x175))/0x6)+parseInt(_0x39d838(0x18f))/0x7*(parseInt(_0x39d838(0x19e))/0x8)+parseInt(_0x39d838(0x1a6))/0x9+parseInt(_0x39d838(0x187))/0xa*(-parseInt(_0x39d838(0x194))/0xb);if(_0x11c494===_0x168313)break;else _0x35dcd6['push'](_0x35dcd6['shift']());}catch(_0x516ce0){_0x35dcd6['push'](_0x35dcd6['shift']());}}}(a35_0xfbea,0xc5f77));function a35_0xfbea(){const _0x65de9=['appCode','functionNode','hash','HOOK','4990464YoGHrX','includes','Force\x20pull\x20cancelled.','local\x20unsynced\x20changes','hookLocation','5jUpCwZ','map','Pull\x20only\x20this\x20script\x20type','apiDir','COMMON','\x22\x20not\x20found\x20after\x20ensureLockScope.','lockKey','message','Remote\x20script\x20missing\x20content.','ENDPOINT','scriptContent','3524464CdCNhw','alias','stderr','\x20remote\x20BFF\x20script(s)\x20for\x20pull','scriptsRoot','stringify','boolean','scriptType','conflict','4478412nUcnZn','Force\x20pull\x20will\x20overwrite\x20local\x20unsynced\x20changes.\x20Continue?\x20[y/N]\x20','close','nonInteractive','toLowerCase','functions','functionName','stdin','Would\x20inspect\x20','toISOString','validation','pull','2429697ewmGEz','utf8','Pull\x20remote\x20BFF\x20scripts\x20to\x20local','str','lockFilePath','parse','1566230TDFhov','operationType','Force\x20overwrite\x20local\x20unsynced\x20changes','--type\x20must\x20be\x20COMMON,\x20ENDPOINT,\x20or\x20HOOK.','2jgPkIK','filePath','\x20pulled,\x20','push','28gHbPFn','/api/management/library/scripts/list?appCode=','datasetCode','Remote\x20script\x20missing\x20id.','\x20skipped,\x20','33SfOOvJ','string','skipped','&type=','read','Pull\x20complete:\x20','apps','yes','bff','992237BBcSAr','2086592YHcysG','type','length','\x20failed'];a35_0xfbea=function(){return _0x65de9;};return a35_0xfbea();}import{createInterface}from'node:readline';import{writeFile}from'node:fs/promises';import{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,ensureParentDirectory,fileExists,normalizeBffType,resolveRemoteScriptTarget}from'../../core/bff/file-system.js';import{computeContentHash,computeFileHash}from'../../core/bff/hash.js';function a35_0x526c(_0x511050,_0x28458f){_0x511050=_0x511050-0x16f;const _0xfbea8e=a35_0xfbea();let _0x526cae=_0xfbea8e[_0x511050];return _0x526cae;}import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{CliErrors}from'../../errors.js';export const bffPull={'service':a35_0x151f79(0x19c),'command':a35_0x151f79(0x180),'description':a35_0x151f79(0x183),'risk':a35_0x151f79(0x198),'flags':[{'name':a35_0x151f79(0x19f),'type':a35_0x151f79(0x195),'description':a35_0x151f79(0x1ad),'enum':[a35_0x151f79(0x1af),a35_0x151f79(0x1b4),a35_0x151f79(0x1a5)]},{'name':'force','type':a35_0x151f79(0x172),'description':a35_0x151f79(0x189)}],async 'dryRun'(_0x5c21ca){const _0x8cbe90=a35_0x151f79,_0x2a8498=loadBffProjectConfig(_0x5c21ca[_0x8cbe90(0x1a2)]),_0x43b1cf=await readBffLockFile(_0x2a8498['lockFilePath']),{appLock:_0x4cd164}=ensureLockScope(_0x43b1cf??createEmptyBffLock(),_0x5c21ca[_0x8cbe90(0x1a2)],_0x2a8498[_0x8cbe90(0x170)],'pull'),_0x45f1c2=normalizeBffType(_0x5c21ca[_0x8cbe90(0x184)]('type'))??undefined,_0x5c43f3=buildDatasetCodeToAliasMap(_0x5c21ca['apiDir'],_0x5c21ca[_0x8cbe90(0x1a2)]),[_0xefdf6f,_0x22ef88]=await Promise['all']([listBffScripts(_0x5c21ca[_0x8cbe90(0x1a2)],_0x45f1c2),getBffScriptStatistics(_0x5c21ca[_0x8cbe90(0x1a2)])]),_0x4900ff=createHookLocationMap(_0x22ef88),_0x17015c=[];for(const _0x53a904 of _0xefdf6f){const _0x2fb0c0=resolveRemoteScriptTarget(_0x2a8498,_0x53a904,_0x4900ff,_0x4cd164['functions'],_0x5c43f3);if(!_0x2fb0c0){_0x17015c[_0x8cbe90(0x18e)]({'scriptType':_0x53a904['scriptType'],'functionName':_0x53a904[_0x8cbe90(0x17b)]??'','status':_0x8cbe90(0x196),'reason':'unresolvable\x20target\x20path'});continue;}const _0x213fa5=_0x4cd164['functions'][_0x2fb0c0['lockKey']],_0x2760d6=_0x53a904['scriptContent']!=null?computeContentHash(_0x53a904[_0x8cbe90(0x1b5)]):undefined,_0x1a6c75=await hasUnsyncedLocalChanges(_0x2fb0c0[_0x8cbe90(0x18c)],_0x213fa5,_0x2760d6);_0x17015c[_0x8cbe90(0x18e)]({'lockKey':_0x2fb0c0[_0x8cbe90(0x1b1)],'filePath':_0x2fb0c0[_0x8cbe90(0x18c)],'remoteId':_0x53a904['id']??null,'status':_0x1a6c75?_0x8cbe90(0x174):'would_pull'});}return{'method':'GET','url':_0x8cbe90(0x190)+_0x5c21ca[_0x8cbe90(0x1a2)]+(_0x45f1c2?_0x8cbe90(0x197)+_0x45f1c2:''),'body':{'appCode':_0x5c21ca[_0x8cbe90(0x1a2)],'filterType':_0x45f1c2??null,'files':_0x17015c},'description':_0x8cbe90(0x17d)+_0x17015c[_0x8cbe90(0x1a0)]+_0x8cbe90(0x16f)};},async 'execute'(_0x3084b7){const _0x2a8571=a35_0x151f79,_0x77aab4=loadBffProjectConfig(_0x3084b7[_0x2a8571(0x1a2)]),_0x33c5b8=await readBffLockFile(_0x77aab4[_0x2a8571(0x185)]),{lockData:_0x22f93d,appLock:_0xc60fa0}=ensureLockScope(_0x33c5b8??createEmptyBffLock(),_0x3084b7[_0x2a8571(0x1a2)],_0x77aab4['scriptsRoot'],'pull'),_0x389e27=normalizeBffType(_0x3084b7[_0x2a8571(0x184)](_0x2a8571(0x19f)))??undefined;if(_0x3084b7[_0x2a8571(0x184)](_0x2a8571(0x19f))&&!_0x389e27)throw CliErrors[_0x2a8571(0x17f)](_0x2a8571(0x18a));const [_0x9052ee,_0x4c203c]=await Promise['all']([listBffScripts(_0x3084b7[_0x2a8571(0x1a2)],_0x389e27),getBffScriptStatistics(_0x3084b7[_0x2a8571(0x1a2)])]);if(_0x9052ee[_0x2a8571(0x1a0)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20BFF\x20scripts\x20found.'};const _0x4aa655=_0x3084b7['bool']('force');if(_0x4aa655&&!_0x3084b7[_0x2a8571(0x178)]){const _0x793ab2=await confirmForce();if(!_0x793ab2)throw CliErrors['cancelled'](_0x2a8571(0x1a8));}if(_0x4aa655&&_0x3084b7[_0x2a8571(0x178)]){}const _0x10c152=buildDatasetCodeToAliasMap(_0x3084b7[_0x2a8571(0x1ae)],_0x3084b7[_0x2a8571(0x1a2)]),_0x135802=createHookLocationMap(_0x4c203c),_0x34d2e5=JSON[_0x2a8571(0x186)](JSON[_0x2a8571(0x171)](_0x22f93d)),_0x31e212=_0x3084b7[_0x2a8571(0x1a2)],_0x3d63aa=_0x34d2e5[_0x2a8571(0x19a)][_0x31e212];if(!_0x3d63aa)throw new Error('Lock\x20scope\x20for\x20app\x20\x22'+_0x31e212+_0x2a8571(0x1b0));const _0x4b7dbc=[],_0x29c1c0=[],_0x19f51b=[];for(const _0x323f46 of _0x9052ee){const _0x43b2ea=resolveRemoteScriptTarget(_0x77aab4,_0x323f46,_0x135802,_0xc60fa0[_0x2a8571(0x17a)],_0x10c152);if(!_0x43b2ea){_0x29c1c0[_0x2a8571(0x18e)]({'lockKey':_0x323f46[_0x2a8571(0x173)]+'/'+_0x323f46['functionName'],'reason':'unresolvable\x20target\x20path'});continue;}const _0x11dc5b=_0xc60fa0[_0x2a8571(0x17a)][_0x43b2ea[_0x2a8571(0x1b1)]];try{if(!_0x323f46['id'])throw new Error(_0x2a8571(0x192));if(_0x323f46[_0x2a8571(0x1b5)]==null)throw new Error(_0x2a8571(0x1b3));const _0x31b661=_0x323f46[_0x2a8571(0x1b5)],_0x38261e=computeContentHash(_0x31b661);if(!_0x4aa655){const _0x47a2cf=await hasUnsyncedLocalChanges(_0x43b2ea[_0x2a8571(0x18c)],_0x11dc5b,_0x38261e);if(_0x47a2cf){_0x29c1c0[_0x2a8571(0x18e)]({'lockKey':_0x43b2ea['lockKey'],'reason':_0x2a8571(0x1a9)});continue;}}await ensureParentDirectory(_0x43b2ea[_0x2a8571(0x18c)]),await writeFile(_0x43b2ea['filePath'],_0x31b661,_0x2a8571(0x182));const _0x52bc76={'hash':_0x38261e,'remoteId':_0x323f46['id'],'version':_0x323f46['version']};_0x43b2ea[_0x2a8571(0x19f)]===_0x2a8571(0x1a5)&&_0x43b2ea['hookLocation']&&(_0x52bc76[_0x2a8571(0x1b7)]=_0x43b2ea[_0x2a8571(0x1aa)][_0x2a8571(0x1b7)],_0x52bc76['datasetCode']=_0x43b2ea[_0x2a8571(0x1aa)][_0x2a8571(0x191)],_0x52bc76[_0x2a8571(0x188)]=_0x43b2ea[_0x2a8571(0x1aa)]['operationType'],_0x52bc76[_0x2a8571(0x1a3)]=_0x43b2ea['hookLocation'][_0x2a8571(0x1a3)]),_0x3d63aa['functions'][_0x43b2ea[_0x2a8571(0x1b1)]]=_0x52bc76,_0x4b7dbc[_0x2a8571(0x18e)]({'lockKey':_0x43b2ea[_0x2a8571(0x1b1)],'remoteId':_0x323f46['id']});}catch(_0x400daf){_0x19f51b['push']({'lockKey':_0x43b2ea[_0x2a8571(0x1b1)],'error':_0x400daf instanceof Error?_0x400daf[_0x2a8571(0x1b2)]:String(_0x400daf)});}}return _0x3d63aa['lastSync']=new Date()[_0x2a8571(0x17e)](),await writeBffLockFile(_0x77aab4['lockFilePath'],_0x34d2e5),{'ok':_0x19f51b[_0x2a8571(0x1a0)]===0x0,'data':{'pulled':_0x4b7dbc,'skipped':_0x29c1c0,'failed':_0x19f51b},'message':_0x2a8571(0x199)+_0x4b7dbc[_0x2a8571(0x1a0)]+_0x2a8571(0x18d)+_0x29c1c0[_0x2a8571(0x1a0)]+_0x2a8571(0x193)+_0x19f51b[_0x2a8571(0x1a0)]+_0x2a8571(0x1a1)};}};async function hasUnsyncedLocalChanges(_0x1db768,_0x342176,_0x54024d){const _0x420e43=a35_0x151f79;if(!await fileExists(_0x1db768))return![];const _0x5a961c=await computeFileHash(_0x1db768);if(!_0x342176)return _0x54024d?_0x5a961c!==_0x54024d:!![];return _0x5a961c!==_0x342176[_0x420e43(0x1a4)];}function buildDatasetCodeToAliasMap(_0x5f0161,_0x59e39c){const _0x590792=a35_0x151f79,_0x3e7f64=loadAliasMap(_0x5f0161,undefined,resolveApiFilePath(_0x5f0161,_0x59e39c));return new Map(_0x3e7f64[_0x590792(0x1ac)](_0x29d867=>[_0x29d867[_0x590792(0x191)],_0x29d867[_0x590792(0x1b7)]]));}async function confirmForce(){const _0x5aa615=a35_0x151f79,_0x3a9a49=createInterface({'input':process[_0x5aa615(0x17c)],'output':process[_0x5aa615(0x1b8)]}),_0x57386b=await new Promise(_0x5b6d24=>{const _0x308946=_0x5aa615;_0x3a9a49['question'](_0x308946(0x176),_0x5b6d24);});return _0x3a9a49[_0x5aa615(0x177)](),['y',_0x5aa615(0x19b)][_0x5aa615(0x1a7)](_0x57386b['trim']()[_0x5aa615(0x179)]());}
|
package/lib/commands/bff/push.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a36_0x72519a=a36_0x14ab;(function(_0x1ec191,_0x38ff89){const _0x5845b4=a36_0x14ab,_0x3e100c=_0x1ec191();while(!![]){try{const _0x17bdff=-parseInt(_0x5845b4(0x1ac))/0x1*(parseInt(_0x5845b4(0x18e))/0x2)+parseInt(_0x5845b4(0x1b4))/0x3+parseInt(_0x5845b4(0x19f))/0x4*(-parseInt(_0x5845b4(0x17c))/0x5)+parseInt(_0x5845b4(0x1b9))/0x6*(-parseInt(_0x5845b4(0x167))/0x7)+-parseInt(_0x5845b4(0x1a4))/0x8*(parseInt(_0x5845b4(0x191))/0x9)+-parseInt(_0x5845b4(0x187))/0xa*(-parseInt(_0x5845b4(0x1a5))/0xb)+-parseInt(_0x5845b4(0x1a9))/0xc*(-parseInt(_0x5845b4(0x190))/0xd);if(_0x17bdff===_0x38ff89)break;else _0x3e100c['push'](_0x3e100c['shift']());}catch(_0x45a1c4){_0x3e100c['push'](_0x3e100c['shift']());}}}(a36_0x2e2d,0xdbc5b));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets,clearBffScriptCache}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{normalizeBffType,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';function a36_0x2e2d(){const _0x590a9f=['Push\x20only\x20this\x20script\x20type','lastSync','ENDPOINT','type','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','create','attempted','31890yCRfHb','bool','Would\x20inspect\x20','aliasToDatasetCode','push','datasetId','str','104088lNsAgf','map','3939eUKiir','6627267hwUBZt','functionNode','set','lockFilePath','utf8','force','\x22\x20not\x20found\x20after\x20ensureLockScope.','alias','lockKey','scriptsRoot','Lock\x20file\x20not\x20settled\x20after\x20push\x20for\x20','has','get','operationType','4656600FvPKAm','Push\x20local\x20BFF\x20scripts\x20to\x20remote','length','values','Cannot\x20resolve\x20dataset\x20for\x20\x22','8YaWeES','3597WIKrYD','COMMON','No\x20local\x20BFF\x20functions\x20found.','runtime\x20cache\x20clear\x20failed','72132JYWuFM','code','boolean','3aNWpLc','would_push',':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.','message','\x20skipped,\x20','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.','stringify','name','4264974WMAZoa','HOOK','\x22.\x20','Lock\x20scope\x20for\x20app\x20\x22','apps','20238QxGgAa','datasetCodeToDataset','script','Incomplete\x20HOOK\x20path:\x20','2758WpThHd','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','\x20failed,\x20','remoteId','runtime\x20cache\x20not\x20needed','some','datasetCode','filter','runtime\x20cache\x20cleared','unchanged','bff','\x20uploaded,\x20','Runtime\x20script\x20cache\x20cleared.','cleared','every','high-risk-write','hash','version','appCode','filePath','status','5AWLYvm','validation','functions','description'];a36_0x2e2d=function(){return _0x590a9f;};return a36_0x2e2d();}import{extractScriptDescription}from'../../core/bff/utils.js';import{sleep}from'../../utils/sleep.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';const CACHE_CLEAR_ATTEMPTS=0x2,CACHE_CLEAR_INTERVAL_MS=0x12c;export const bffPush={'service':a36_0x72519a(0x171),'command':a36_0x72519a(0x18b),'description':a36_0x72519a(0x1a0),'risk':a36_0x72519a(0x176),'flags':[{'name':'type','type':'string','description':a36_0x72519a(0x180),'enum':[a36_0x72519a(0x1a6),a36_0x72519a(0x182),a36_0x72519a(0x1b5)]},{'name':a36_0x72519a(0x1b3),'type':'string','description':a36_0x72519a(0x168)},{'name':a36_0x72519a(0x196),'type':a36_0x72519a(0x1ab),'description':'Force\x20push\x20ignoring\x20hash\x20protection'}],async 'dryRun'(_0x52ab3f){const _0x58357f=a36_0x72519a,_0x3b7a4e=loadBffProjectConfig(_0x52ab3f['appCode']),_0x2e01cf=await readBffLockFile(_0x3b7a4e['lockFilePath']),{appLock:_0x3ca11f}=ensureLockScope(_0x2e01cf??createEmptyBffLock(),_0x52ab3f[_0x58357f(0x179)],_0x3b7a4e[_0x58357f(0x19a)],_0x58357f(0x18b)),_0x3cbd37=await getTargetFunctions(_0x3b7a4e,_0x52ab3f),_0x2f808b=_0x52ab3f['bool'](_0x58357f(0x196)),_0x2728f0=[];for(const _0x470061 of _0x3cbd37){const _0x48b15c=await computeFileHash(_0x470061['filePath']),_0x584baf=_0x3ca11f[_0x58357f(0x17e)][_0x470061[_0x58357f(0x199)]],_0x390171=!!_0x584baf&&_0x584baf[_0x58357f(0x177)]===_0x48b15c;_0x2728f0['push']({'lockKey':_0x470061[_0x58357f(0x199)],'filePath':_0x470061['filePath'],'remoteId':_0x584baf?.[_0x58357f(0x16a)]??null,'mode':_0x584baf?.['remoteId']?'update':_0x58357f(0x185),'status':!_0x2f808b&&_0x390171?'unchanged':_0x58357f(0x1ad)});}return{'method':'POST','url':'/api/management/library/scripts/save','body':{'appCode':_0x52ab3f['appCode'],'force':_0x2f808b,'files':_0x2728f0,'cacheClearAtRuntime':_0x2728f0[_0x58357f(0x16c)](_0x5d00b4=>_0x5d00b4[_0x58357f(0x17b)]===_0x58357f(0x1ad)),'cacheClearAtRuntimeTimes':_0x2728f0[_0x58357f(0x16c)](_0x2328af=>_0x2328af[_0x58357f(0x17b)]===_0x58357f(0x1ad))?CACHE_CLEAR_ATTEMPTS:0x0},'description':_0x58357f(0x189)+_0x2728f0['length']+'\x20local\x20BFF\x20script(s)\x20for\x20push\x20and\x20clear\x20runtime\x20cache\x20if\x20files\x20are\x20uploaded'};},async 'execute'(_0x4240e2){const _0x510067=a36_0x72519a,_0x378905=loadBffProjectConfig(_0x4240e2[_0x510067(0x179)]),_0x335847=await readBffLockFile(_0x378905['lockFilePath']),{lockData:_0x28105f,appLock:_0x2f51a2}=ensureLockScope(_0x335847??createEmptyBffLock(),_0x4240e2['appCode'],_0x378905['scriptsRoot'],_0x510067(0x18b)),_0x115cb2=await getTargetFunctions(_0x378905,_0x4240e2);if(_0x115cb2['length']===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0x510067(0x1a7)};const _0x40441b=_0x4240e2[_0x510067(0x188)]('force'),_0x4233a0=JSON['parse'](JSON[_0x510067(0x1b2)](_0x28105f)),_0x3122ee=_0x4233a0[_0x510067(0x1b8)][_0x4240e2[_0x510067(0x179)]];if(!_0x3122ee)throw new Error(_0x510067(0x1b7)+_0x4240e2[_0x510067(0x179)]+_0x510067(0x197));const _0x40b3ba=await buildHookMaps(_0x4240e2[_0x510067(0x179)],_0x4240e2['apiDir'],_0x115cb2,_0x3122ee),_0x1b83bd=[],_0x2b659b=[],_0xe4365b=[];for(const _0x280552 of _0x115cb2){const _0x3926e8=await computeFileHash(_0x280552[_0x510067(0x17a)]),_0x4923d7=_0x3122ee['functions'][_0x280552['lockKey']];if(!_0x40441b&&_0x4923d7&&_0x4923d7[_0x510067(0x177)]===_0x3926e8){_0x2b659b[_0x510067(0x18b)]({'lockKey':_0x280552[_0x510067(0x199)],'reason':_0x510067(0x170)});continue;}try{await uploadSingleFunction(_0x4240e2['appCode'],_0x280552,_0x3122ee,_0x40b3ba);const _0x26acb8=_0x3122ee['functions'][_0x280552[_0x510067(0x199)]];_0x1b83bd[_0x510067(0x18b)]({'lockKey':_0x280552[_0x510067(0x199)],'remoteId':_0x26acb8?.[_0x510067(0x16a)]??0x0});}catch(_0x99d922){_0xe4365b['push']({'lockKey':_0x280552[_0x510067(0x199)],'error':_0x99d922 instanceof Error?_0x99d922[_0x510067(0x1af)]:String(_0x99d922)});}}_0x3122ee[_0x510067(0x181)]=new Date()['toISOString'](),await writeBffLockFile(_0x378905[_0x510067(0x194)],_0x4233a0),await waitForUploadedLockEntries(_0x378905[_0x510067(0x194)],_0x4240e2[_0x510067(0x179)],_0x1b83bd[_0x510067(0x18f)](_0xb15958=>_0xb15958['lockKey']));let _0x13030e={'attempted':![],'cleared':![]};if(_0x1b83bd[_0x510067(0x1a1)]>0x0)try{let _0x2c9587='';for(let _0x59ab45=0x0;_0x59ab45<CACHE_CLEAR_ATTEMPTS;_0x59ab45+=0x1){_0x2c9587=await clearBffScriptCache(),_0x59ab45<CACHE_CLEAR_ATTEMPTS-0x1&&await sleep(CACHE_CLEAR_INTERVAL_MS);}_0x13030e={'attempted':!![],'cleared':!![],'message':_0x2c9587||_0x510067(0x173)};}catch(_0x47fe3c){_0x13030e={'attempted':!![],'cleared':![],'error':_0x47fe3c instanceof Error?_0x47fe3c[_0x510067(0x1af)]:String(_0x47fe3c)};}const _0x4c261f=_0xe4365b[_0x510067(0x1a1)]===0x0&&(_0x13030e[_0x510067(0x186)]?_0x13030e[_0x510067(0x174)]:!![]),_0x2bd0ef=_0x13030e[_0x510067(0x186)]?_0x13030e['cleared']?_0x510067(0x16f):_0x510067(0x1a8):_0x510067(0x16b);return{'ok':_0x4c261f,'data':{'uploaded':_0x1b83bd,'skipped':_0x2b659b,'failed':_0xe4365b,'cacheClear':_0x13030e},'message':'Push\x20complete:\x20'+_0x1b83bd[_0x510067(0x1a1)]+_0x510067(0x172)+_0x2b659b[_0x510067(0x1a1)]+_0x510067(0x1b0)+_0xe4365b[_0x510067(0x1a1)]+_0x510067(0x169)+_0x2bd0ef};}};async function getTargetFunctions(_0x526acb,_0xc86898){const _0x3ec394=a36_0x72519a,_0x2abee8=_0xc86898[_0x3ec394(0x18d)](_0x3ec394(0x183)),_0x11a65d=_0xc86898[_0x3ec394(0x18d)](_0x3ec394(0x1b3)),_0x5aca07=normalizeBffType(_0x2abee8)??undefined;if(_0x11a65d&&!_0x5aca07)throw CliErrors['validation'](_0x3ec394(0x1b1));const _0x47c5c9=await scanLocalBffFunctions(_0x526acb,_0x5aca07);if(_0x11a65d){const _0x23fa1b=_0x47c5c9[_0x3ec394(0x16e)](_0x20669a=>_0x20669a[_0x3ec394(0x1b3)]===_0x11a65d);if(_0x23fa1b[_0x3ec394(0x1a1)]===0x0)throw CliErrors['validation']('Local\x20function\x20not\x20found:\x20'+_0x5aca07+'/'+_0x11a65d);return _0x23fa1b;}return _0x47c5c9;}async function buildHookMaps(_0x556753,_0x4580f6,_0x18c62a,_0x4818fd){const _0x5e8ac8=a36_0x72519a,_0x2b744d=_0x18c62a[_0x5e8ac8(0x16c)](_0x24c9a7=>_0x24c9a7['type']===_0x5e8ac8(0x1b5));if(!_0x2b744d)return{'aliasToDatasetCode':new Map(),'datasetCodeToDataset':new Map()};const _0x3f1e9b=loadAliasMap(_0x4580f6,undefined,resolveApiFilePath(_0x4580f6,_0x556753)),_0x235583=new Map(_0x3f1e9b[_0x5e8ac8(0x18f)](_0x47ce3a=>[_0x47ce3a['alias'],_0x47ce3a[_0x5e8ac8(0x16d)]]));for(const _0x5d0589 of Object[_0x5e8ac8(0x1a2)](_0x4818fd[_0x5e8ac8(0x17e)])){_0x5d0589[_0x5e8ac8(0x198)]&&_0x5d0589[_0x5e8ac8(0x16d)]&&!_0x235583['has'](_0x5d0589[_0x5e8ac8(0x198)])&&_0x235583[_0x5e8ac8(0x193)](_0x5d0589['alias'],_0x5d0589[_0x5e8ac8(0x16d)]);}const _0xc55ebc=await listDatasets(_0x556753),_0x4252ca=new Map(_0xc55ebc[_0x5e8ac8(0x18f)](_0x2e704f=>[_0x2e704f[_0x5e8ac8(0x1aa)],_0x2e704f]));return{'aliasToDatasetCode':_0x235583,'datasetCodeToDataset':_0x4252ca};}async function uploadSingleFunction(_0x3d2aaa,_0x2e4934,_0x368e67,_0x2d29c2){const _0x4ae706=a36_0x72519a,_0x41e0fb=await readFile(_0x2e4934[_0x4ae706(0x17a)],_0x4ae706(0x195)),_0x431cd7=await computeFileHash(_0x2e4934['filePath']),_0x3ec296=_0x368e67['functions'][_0x2e4934['lockKey']];if(_0x3ec296?.[_0x4ae706(0x16a)]&&_0x3ec296['version']==null)throw CliErrors[_0x4ae706(0x17d)](_0x2e4934[_0x4ae706(0x199)]+_0x4ae706(0x1ae));let _0x29a707=extractScriptDescription(_0x41e0fb);if(!_0x29a707&&_0x3ec296?.[_0x4ae706(0x16a)]){const _0x2c9e73=await getBffScriptInfo(_0x3ec296[_0x4ae706(0x16a)]);_0x29a707=_0x2c9e73['description']||undefined;}const _0x409bda={'appCode':_0x3d2aaa,'functionName':_0x2e4934['name'],'scriptType':_0x2e4934['type'],'scriptContent':_0x41e0fb};if(_0x3ec296?.[_0x4ae706(0x16a)])_0x409bda['id']=_0x3ec296['remoteId'];if(_0x3ec296?.['version']!=null)_0x409bda[_0x4ae706(0x178)]=_0x3ec296[_0x4ae706(0x178)];if(_0x29a707)_0x409bda[_0x4ae706(0x17f)]=_0x29a707;if(_0x2e4934[_0x4ae706(0x183)]===_0x4ae706(0x1b5)){const _0x422b4a=_0x2e4934[_0x4ae706(0x198)];if(!_0x422b4a||!_0x2e4934[_0x4ae706(0x19e)]||!_0x2e4934[_0x4ae706(0x192)])throw CliErrors[_0x4ae706(0x17d)](_0x4ae706(0x166)+_0x2e4934[_0x4ae706(0x199)]);const _0x53117d=_0x2d29c2[_0x4ae706(0x18a)][_0x4ae706(0x19d)](_0x422b4a)??_0x3ec296?.[_0x4ae706(0x16d)]??_0x422b4a,_0x2e6c0=_0x2d29c2[_0x4ae706(0x164)]['get'](_0x53117d);if(!_0x2e6c0)throw CliErrors[_0x4ae706(0x17d)](_0x4ae706(0x1a3)+_0x422b4a+_0x4ae706(0x1b6)+('Run\x20`'+CLI_BIN_NAME+_0x4ae706(0x184)));_0x409bda[_0x4ae706(0x18c)]=_0x2e6c0['id'],_0x409bda['operationType']=_0x2e4934[_0x4ae706(0x19e)],_0x409bda[_0x4ae706(0x192)]=_0x2e4934[_0x4ae706(0x192)];}const _0x294d98=await saveBffScript(_0x409bda),_0xf35f7b=_0x294d98['id'],_0x5dc7ec=_0x294d98[_0x4ae706(0x165)]??await getBffScriptInfo(_0xf35f7b),_0xe36bcf={'hash':_0x431cd7,'remoteId':_0xf35f7b,'version':_0x5dc7ec[_0x4ae706(0x178)]};if(_0x2e4934[_0x4ae706(0x183)]===_0x4ae706(0x1b5)){const _0x300a75=_0x2e4934[_0x4ae706(0x198)],_0x3ba32c=_0x2d29c2['aliasToDatasetCode'][_0x4ae706(0x19d)](_0x300a75)??_0x3ec296?.[_0x4ae706(0x16d)]??_0x300a75;_0x2d29c2['aliasToDatasetCode'][_0x4ae706(0x19c)](_0x300a75)?_0xe36bcf[_0x4ae706(0x198)]=_0x300a75:_0xe36bcf[_0x4ae706(0x198)]=_0x3ec296?.[_0x4ae706(0x198)],_0xe36bcf[_0x4ae706(0x16d)]=_0x3ba32c,_0xe36bcf[_0x4ae706(0x19e)]=_0x2e4934['operationType'],_0xe36bcf[_0x4ae706(0x192)]=_0x2e4934['functionNode'];}_0x368e67[_0x4ae706(0x17e)][_0x2e4934[_0x4ae706(0x199)]]=_0xe36bcf;}function a36_0x14ab(_0x4c34ba,_0x6ad379){_0x4c34ba=_0x4c34ba-0x164;const _0x2e2d22=a36_0x2e2d();let _0x14ab01=_0x2e2d22[_0x4c34ba];return _0x14ab01;}const LOCK_SETTLE_RETRY_COUNT=0x14,LOCK_SETTLE_DELAY_MS=0x64;async function waitForUploadedLockEntries(_0x9b020f,_0x3230af,_0x3772fb){const _0x672dc1=a36_0x72519a;if(_0x3772fb[_0x672dc1(0x1a1)]===0x0)return;for(let _0x2f52aa=0x0;_0x2f52aa<LOCK_SETTLE_RETRY_COUNT;_0x2f52aa+=0x1){const _0x334f0c=await readBffLockFile(_0x9b020f),_0xeeb52a=_0x334f0c?.['apps']?.[_0x3230af]?.[_0x672dc1(0x17e)]??{},_0x126d0f=_0x3772fb[_0x672dc1(0x175)](_0x4d9ee6=>!!_0xeeb52a[_0x4d9ee6]?.['remoteId']);if(_0x126d0f)return;await sleep(LOCK_SETTLE_DELAY_MS);}throw new Error(_0x672dc1(0x19b)+_0x3772fb['join'](',\x20')+'.');}
|
|
1
|
+
const a36_0x21a9e9=a36_0x2388;(function(_0x1460b0,_0x21d7b9){const _0x19cc6f=a36_0x2388,_0x262f55=_0x1460b0();while(!![]){try{const _0x1742dc=parseInt(_0x19cc6f(0x15b))/0x1+parseInt(_0x19cc6f(0x183))/0x2*(parseInt(_0x19cc6f(0x1a2))/0x3)+parseInt(_0x19cc6f(0x158))/0x4*(parseInt(_0x19cc6f(0x17c))/0x5)+-parseInt(_0x19cc6f(0x198))/0x6+parseInt(_0x19cc6f(0x187))/0x7+-parseInt(_0x19cc6f(0x18b))/0x8+-parseInt(_0x19cc6f(0x177))/0x9;if(_0x1742dc===_0x21d7b9)break;else _0x262f55['push'](_0x262f55['shift']());}catch(_0x502a24){_0x262f55['push'](_0x262f55['shift']());}}}(a36_0x4c97,0x983ff));import{readFile}from'node:fs/promises';import{saveBffScript,getBffScriptInfo,listDatasets,clearBffScriptCache}from'../../core/api-client.js';import{loadAliasMap}from'../../core/alias-resolver.js';function a36_0x4c97(){const _0x4b5458=['Run\x20`','Runtime\x20script\x20cache\x20cleared.','lastSync','1012465vOTMYs','datasetCode','lockFilePath','description','length','runtime\x20cache\x20not\x20needed','functionNode','2dAJkwl','utf8','ENDPOINT','\x22.\x20','6500032QNmXGx','name','Lock\x20file\x20not\x20settled\x20after\x20push\x20for\x20','datasetId','858320PVoySs','No\x20local\x20BFF\x20functions\x20found.','stringify','version','alias','validation','unchanged','runtime\x20cache\x20cleared','remoteId','some','Push\x20local\x20BFF\x20scripts\x20to\x20remote','HOOK','str','5861202uMrvCv','\x20api\x20pull`\x20to\x20refresh\x20api.ts,\x20or\x20verify\x20the\x20dataset\x20exists.','force','\x22\x20not\x20found\x20after\x20ensureLockScope.','Push\x20only\x20the\x20named\x20function\x20(requires\x20--type)','Would\x20inspect\x20','every','operationType','Cannot\x20resolve\x20dataset\x20for\x20\x22','filter','2835060WuMGKV','bool','COMMON','hash','would_push','has','16vGdMVl','cleared','\x20skipped,\x20','520206yscxRH','set','string','Incomplete\x20HOOK\x20path:\x20','script','filePath','get','appCode','--name\x20requires\x20--type\x20to\x20identify\x20the\x20function.','\x20local\x20BFF\x20script(s)\x20for\x20push\x20and\x20clear\x20runtime\x20cache\x20if\x20files\x20are\x20uploaded','Force\x20push\x20ignoring\x20hash\x20protection','type','values','Lock\x20scope\x20for\x20app\x20\x22','create','scriptsRoot','code','toISOString','parse','map','status','datasetCodeToDataset','push','functions','aliasToDatasetCode','message','POST','Push\x20only\x20this\x20script\x20type','13464018nlhPzZ','lockKey'];a36_0x4c97=function(){return _0x4b5458;};return a36_0x4c97();}import{resolveApiFilePath}from'../../context.js';import{loadBffProjectConfig}from'../../core/bff/config.js';import{normalizeBffType,scanLocalBffFunctions}from'../../core/bff/file-system.js';import{computeFileHash}from'../../core/bff/hash.js';import{createEmptyBffLock,ensureLockScope,readBffLockFile,writeBffLockFile}from'../../core/bff/lock.js';import{extractScriptDescription}from'../../core/bff/utils.js';import{sleep}from'../../utils/sleep.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';const CACHE_CLEAR_ATTEMPTS=0x2,CACHE_CLEAR_INTERVAL_MS=0x12c;export const bffPush={'service':'bff','command':a36_0x21a9e9(0x171),'description':a36_0x21a9e9(0x195),'risk':'high-risk-write','flags':[{'name':a36_0x21a9e9(0x166),'type':a36_0x21a9e9(0x15d),'description':a36_0x21a9e9(0x176),'enum':[a36_0x21a9e9(0x1a4),a36_0x21a9e9(0x185),'HOOK']},{'name':a36_0x21a9e9(0x188),'type':'string','description':a36_0x21a9e9(0x19c)},{'name':a36_0x21a9e9(0x19a),'type':'boolean','description':a36_0x21a9e9(0x165)}],async 'dryRun'(_0x2c656a){const _0x526fa3=a36_0x21a9e9,_0x23b2b4=loadBffProjectConfig(_0x2c656a[_0x526fa3(0x162)]),_0x54bc6b=await readBffLockFile(_0x23b2b4[_0x526fa3(0x17e)]),{appLock:_0x49d729}=ensureLockScope(_0x54bc6b??createEmptyBffLock(),_0x2c656a['appCode'],_0x23b2b4[_0x526fa3(0x16a)],_0x526fa3(0x171)),_0x376504=await getTargetFunctions(_0x23b2b4,_0x2c656a),_0x269e38=_0x2c656a[_0x526fa3(0x1a3)]('force'),_0x43d308=[];for(const _0x14af60 of _0x376504){const _0x3465b6=await computeFileHash(_0x14af60['filePath']),_0x38d426=_0x49d729[_0x526fa3(0x172)][_0x14af60[_0x526fa3(0x178)]],_0x5449c4=!!_0x38d426&&_0x38d426[_0x526fa3(0x1a5)]===_0x3465b6;_0x43d308['push']({'lockKey':_0x14af60['lockKey'],'filePath':_0x14af60[_0x526fa3(0x160)],'remoteId':_0x38d426?.[_0x526fa3(0x193)]??null,'mode':_0x38d426?.[_0x526fa3(0x193)]?'update':_0x526fa3(0x169),'status':!_0x269e38&&_0x5449c4?'unchanged':_0x526fa3(0x1a6)});}return{'method':_0x526fa3(0x175),'url':'/api/management/library/scripts/save','body':{'appCode':_0x2c656a[_0x526fa3(0x162)],'force':_0x269e38,'files':_0x43d308,'cacheClearAtRuntime':_0x43d308[_0x526fa3(0x194)](_0x4ff7cb=>_0x4ff7cb[_0x526fa3(0x16f)]===_0x526fa3(0x1a6)),'cacheClearAtRuntimeTimes':_0x43d308['some'](_0x19eea7=>_0x19eea7[_0x526fa3(0x16f)]==='would_push')?CACHE_CLEAR_ATTEMPTS:0x0},'description':_0x526fa3(0x19d)+_0x43d308[_0x526fa3(0x180)]+_0x526fa3(0x164)};},async 'execute'(_0x44e63e){const _0xf1418c=a36_0x21a9e9,_0x40897d=loadBffProjectConfig(_0x44e63e['appCode']),_0x43858b=await readBffLockFile(_0x40897d[_0xf1418c(0x17e)]),{lockData:_0x512bac,appLock:_0x8483a9}=ensureLockScope(_0x43858b??createEmptyBffLock(),_0x44e63e[_0xf1418c(0x162)],_0x40897d['scriptsRoot'],'push'),_0x26228d=await getTargetFunctions(_0x40897d,_0x44e63e);if(_0x26228d[_0xf1418c(0x180)]===0x0)return{'ok':!![],'data':{'uploaded':[],'skipped':[],'failed':[]},'message':_0xf1418c(0x18c)};const _0x2b137b=_0x44e63e[_0xf1418c(0x1a3)](_0xf1418c(0x19a)),_0x14e162=JSON[_0xf1418c(0x16d)](JSON[_0xf1418c(0x18d)](_0x512bac)),_0x34ba29=_0x14e162['apps'][_0x44e63e[_0xf1418c(0x162)]];if(!_0x34ba29)throw new Error(_0xf1418c(0x168)+_0x44e63e[_0xf1418c(0x162)]+_0xf1418c(0x19b));const _0xf6dfca=await buildHookMaps(_0x44e63e['appCode'],_0x44e63e['apiDir'],_0x26228d,_0x34ba29),_0x2a91ed=[],_0x569f16=[],_0x30cc35=[];for(const _0x5639bd of _0x26228d){const _0x3645b7=await computeFileHash(_0x5639bd[_0xf1418c(0x160)]),_0x11c66f=_0x34ba29[_0xf1418c(0x172)][_0x5639bd[_0xf1418c(0x178)]];if(!_0x2b137b&&_0x11c66f&&_0x11c66f['hash']===_0x3645b7){_0x569f16[_0xf1418c(0x171)]({'lockKey':_0x5639bd['lockKey'],'reason':_0xf1418c(0x191)});continue;}try{await uploadSingleFunction(_0x44e63e[_0xf1418c(0x162)],_0x5639bd,_0x34ba29,_0xf6dfca);const _0x1b83a8=_0x34ba29[_0xf1418c(0x172)][_0x5639bd[_0xf1418c(0x178)]];_0x2a91ed[_0xf1418c(0x171)]({'lockKey':_0x5639bd['lockKey'],'remoteId':_0x1b83a8?.[_0xf1418c(0x193)]??0x0});}catch(_0x3ddaf5){_0x30cc35[_0xf1418c(0x171)]({'lockKey':_0x5639bd[_0xf1418c(0x178)],'error':_0x3ddaf5 instanceof Error?_0x3ddaf5[_0xf1418c(0x174)]:String(_0x3ddaf5)});}}_0x34ba29[_0xf1418c(0x17b)]=new Date()[_0xf1418c(0x16c)](),await writeBffLockFile(_0x40897d[_0xf1418c(0x17e)],_0x14e162),await waitForUploadedLockEntries(_0x40897d[_0xf1418c(0x17e)],_0x44e63e['appCode'],_0x2a91ed[_0xf1418c(0x16e)](_0x3a24bd=>_0x3a24bd[_0xf1418c(0x178)]));let _0x5b8c9a={'attempted':![],'cleared':![]};if(_0x2a91ed[_0xf1418c(0x180)]>0x0)try{let _0x1b9e53='';for(let _0x66b7f6=0x0;_0x66b7f6<CACHE_CLEAR_ATTEMPTS;_0x66b7f6+=0x1){_0x1b9e53=await clearBffScriptCache(),_0x66b7f6<CACHE_CLEAR_ATTEMPTS-0x1&&await sleep(CACHE_CLEAR_INTERVAL_MS);}_0x5b8c9a={'attempted':!![],'cleared':!![],'message':_0x1b9e53||_0xf1418c(0x17a)};}catch(_0x5a31a2){_0x5b8c9a={'attempted':!![],'cleared':![],'error':_0x5a31a2 instanceof Error?_0x5a31a2['message']:String(_0x5a31a2)};}const _0x51152b=_0x30cc35[_0xf1418c(0x180)]===0x0&&(_0x5b8c9a['attempted']?_0x5b8c9a[_0xf1418c(0x159)]:!![]),_0x510a9f=_0x5b8c9a['attempted']?_0x5b8c9a[_0xf1418c(0x159)]?_0xf1418c(0x192):'runtime\x20cache\x20clear\x20failed':_0xf1418c(0x181);return{'ok':_0x51152b,'data':{'uploaded':_0x2a91ed,'skipped':_0x569f16,'failed':_0x30cc35,'cacheClear':_0x5b8c9a},'message':'Push\x20complete:\x20'+_0x2a91ed[_0xf1418c(0x180)]+'\x20uploaded,\x20'+_0x569f16[_0xf1418c(0x180)]+_0xf1418c(0x15a)+_0x30cc35[_0xf1418c(0x180)]+'\x20failed,\x20'+_0x510a9f};}};async function getTargetFunctions(_0x2d9c85,_0xcbd271){const _0x435bdf=a36_0x21a9e9,_0x31299e=_0xcbd271[_0x435bdf(0x197)](_0x435bdf(0x166)),_0x45b96a=_0xcbd271[_0x435bdf(0x197)]('name'),_0x1805ae=normalizeBffType(_0x31299e)??undefined;if(_0x45b96a&&!_0x1805ae)throw CliErrors[_0x435bdf(0x190)](_0x435bdf(0x163));const _0x43fdf1=await scanLocalBffFunctions(_0x2d9c85,_0x1805ae);if(_0x45b96a){const _0x304cea=_0x43fdf1[_0x435bdf(0x1a1)](_0xd59eaa=>_0xd59eaa[_0x435bdf(0x188)]===_0x45b96a);if(_0x304cea[_0x435bdf(0x180)]===0x0)throw CliErrors[_0x435bdf(0x190)]('Local\x20function\x20not\x20found:\x20'+_0x1805ae+'/'+_0x45b96a);return _0x304cea;}return _0x43fdf1;}async function buildHookMaps(_0x32459f,_0x34635a,_0x2d9904,_0x3edaee){const _0xef71d1=a36_0x21a9e9,_0x49ec86=_0x2d9904[_0xef71d1(0x194)](_0x123a09=>_0x123a09[_0xef71d1(0x166)]===_0xef71d1(0x196));if(!_0x49ec86)return{'aliasToDatasetCode':new Map(),'datasetCodeToDataset':new Map()};const _0x2f5077=loadAliasMap(_0x34635a,undefined,resolveApiFilePath(_0x34635a,_0x32459f)),_0x38c746=new Map(_0x2f5077[_0xef71d1(0x16e)](_0xa2ad61=>[_0xa2ad61[_0xef71d1(0x18f)],_0xa2ad61['datasetCode']]));for(const _0x4e495c of Object[_0xef71d1(0x167)](_0x3edaee[_0xef71d1(0x172)])){_0x4e495c[_0xef71d1(0x18f)]&&_0x4e495c[_0xef71d1(0x17d)]&&!_0x38c746[_0xef71d1(0x157)](_0x4e495c[_0xef71d1(0x18f)])&&_0x38c746[_0xef71d1(0x15c)](_0x4e495c['alias'],_0x4e495c[_0xef71d1(0x17d)]);}const _0xde5f5=await listDatasets(_0x32459f),_0x55b65c=new Map(_0xde5f5[_0xef71d1(0x16e)](_0x41252a=>[_0x41252a[_0xef71d1(0x16b)],_0x41252a]));return{'aliasToDatasetCode':_0x38c746,'datasetCodeToDataset':_0x55b65c};}async function uploadSingleFunction(_0x34d08f,_0x411bb5,_0x56588f,_0x35faf3){const _0x56a720=a36_0x21a9e9,_0x29e805=await readFile(_0x411bb5[_0x56a720(0x160)],_0x56a720(0x184)),_0x25b65a=await computeFileHash(_0x411bb5['filePath']),_0x117e5f=_0x56588f['functions'][_0x411bb5[_0x56a720(0x178)]];if(_0x117e5f?.['remoteId']&&_0x117e5f[_0x56a720(0x18e)]==null)throw CliErrors[_0x56a720(0x190)](_0x411bb5[_0x56a720(0x178)]+':\x20missing\x20remote\x20version.\x20Run\x20`push`\x20after\x20`pull`\x20to\x20sync\x20version\x20info.');let _0x5947a9=extractScriptDescription(_0x29e805);if(!_0x5947a9&&_0x117e5f?.['remoteId']){const _0x25d462=await getBffScriptInfo(_0x117e5f['remoteId']);_0x5947a9=_0x25d462[_0x56a720(0x17f)]||undefined;}const _0x1f3d6b={'appCode':_0x34d08f,'functionName':_0x411bb5[_0x56a720(0x188)],'scriptType':_0x411bb5['type'],'scriptContent':_0x29e805};if(_0x117e5f?.[_0x56a720(0x193)])_0x1f3d6b['id']=_0x117e5f[_0x56a720(0x193)];if(_0x117e5f?.[_0x56a720(0x18e)]!=null)_0x1f3d6b[_0x56a720(0x18e)]=_0x117e5f[_0x56a720(0x18e)];if(_0x5947a9)_0x1f3d6b[_0x56a720(0x17f)]=_0x5947a9;if(_0x411bb5[_0x56a720(0x166)]==='HOOK'){const _0xee211b=_0x411bb5[_0x56a720(0x18f)];if(!_0xee211b||!_0x411bb5[_0x56a720(0x19f)]||!_0x411bb5[_0x56a720(0x182)])throw CliErrors[_0x56a720(0x190)](_0x56a720(0x15e)+_0x411bb5['lockKey']);const _0x51d0f2=_0x35faf3['aliasToDatasetCode']['get'](_0xee211b)??_0x117e5f?.[_0x56a720(0x17d)]??_0xee211b,_0x13d016=_0x35faf3[_0x56a720(0x170)]['get'](_0x51d0f2);if(!_0x13d016)throw CliErrors[_0x56a720(0x190)](_0x56a720(0x1a0)+_0xee211b+_0x56a720(0x186)+(_0x56a720(0x179)+CLI_BIN_NAME+_0x56a720(0x199)));_0x1f3d6b[_0x56a720(0x18a)]=_0x13d016['id'],_0x1f3d6b['operationType']=_0x411bb5[_0x56a720(0x19f)],_0x1f3d6b[_0x56a720(0x182)]=_0x411bb5[_0x56a720(0x182)];}const _0x5c347e=await saveBffScript(_0x1f3d6b),_0x1dc2d2=_0x5c347e['id'],_0x49bf99=_0x5c347e[_0x56a720(0x15f)]??await getBffScriptInfo(_0x1dc2d2),_0x2ae672={'hash':_0x25b65a,'remoteId':_0x1dc2d2,'version':_0x49bf99['version']};if(_0x411bb5[_0x56a720(0x166)]===_0x56a720(0x196)){const _0xd34be3=_0x411bb5[_0x56a720(0x18f)],_0x132320=_0x35faf3[_0x56a720(0x173)][_0x56a720(0x161)](_0xd34be3)??_0x117e5f?.[_0x56a720(0x17d)]??_0xd34be3;_0x35faf3[_0x56a720(0x173)][_0x56a720(0x157)](_0xd34be3)?_0x2ae672[_0x56a720(0x18f)]=_0xd34be3:_0x2ae672[_0x56a720(0x18f)]=_0x117e5f?.[_0x56a720(0x18f)],_0x2ae672[_0x56a720(0x17d)]=_0x132320,_0x2ae672[_0x56a720(0x19f)]=_0x411bb5[_0x56a720(0x19f)],_0x2ae672[_0x56a720(0x182)]=_0x411bb5[_0x56a720(0x182)];}_0x56588f[_0x56a720(0x172)][_0x411bb5['lockKey']]=_0x2ae672;}const LOCK_SETTLE_RETRY_COUNT=0x14,LOCK_SETTLE_DELAY_MS=0x64;function a36_0x2388(_0x49051d,_0x13292d){_0x49051d=_0x49051d-0x157;const _0x4c97ca=a36_0x4c97();let _0x23884b=_0x4c97ca[_0x49051d];return _0x23884b;}async function waitForUploadedLockEntries(_0x3682c8,_0x300317,_0x4e951f){const _0x14397d=a36_0x21a9e9;if(_0x4e951f[_0x14397d(0x180)]===0x0)return;for(let _0x21a2b1=0x0;_0x21a2b1<LOCK_SETTLE_RETRY_COUNT;_0x21a2b1+=0x1){const _0x526230=await readBffLockFile(_0x3682c8),_0x55c206=_0x526230?.['apps']?.[_0x300317]?.[_0x14397d(0x172)]??{},_0x8e94c4=_0x4e951f[_0x14397d(0x19e)](_0x28bc62=>!!_0x55c206[_0x28bc62]?.[_0x14397d(0x193)]);if(_0x8e94c4)return;await sleep(LOCK_SETTLE_DELAY_MS);}throw new Error(_0x14397d(0x189)+_0x4e951f['join'](',\x20')+'.');}
|