@lovrabet/rabetbase-cli 2.5.13-beta.1 → 2.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -17
- package/lib/api/api-doc.js +3 -1
- package/lib/api/api-group.js +3 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +8 -1
- package/lib/api/generate-sdk-config-file.js +1 -1
- package/lib/api/legacy-api-file.js +2 -1
- package/lib/api/model-registry-file.js +11 -1
- package/lib/api/model-registry-scaffold.js +2 -1
- package/lib/api/model-source.js +3 -1
- package/lib/auth/auth-server-ui.js +2 -1
- package/lib/auth/auth-server.js +5 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/get-session-user.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/login-success-html.js +3 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.js +1 -1
- package/lib/cli.js +5 -1
- package/lib/commands/api/generate.js +4 -1
- package/lib/commands/api/index.js +1 -1
- package/lib/commands/api/list.js +2 -1
- package/lib/commands/api/pull.js +10 -1
- package/lib/commands/api/shared.js +1 -1
- package/lib/commands/app/detail.js +1 -1
- package/lib/commands/app/index.js +1 -1
- package/lib/commands/app/list.js +5 -1
- package/lib/commands/app/members-list.js +1 -1
- package/lib/commands/app/remote-directory.js +1 -1
- package/lib/commands/app/shared.js +4 -1
- package/lib/commands/app-config/delete.js +2 -1
- package/lib/commands/app-config/get.js +2 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/app-config/list.js +2 -1
- package/lib/commands/app-config/set.js +3 -1
- package/lib/commands/app-config/shared.d.ts +9 -2
- package/lib/commands/app-config/shared.js +6 -1
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/bff/create.js +11 -1
- package/lib/commands/bff/delete.js +6 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/bff/list.js +1 -1
- package/lib/commands/bff/logs.js +4 -1
- package/lib/commands/bff/pull.js +22 -1
- package/lib/commands/bff/push.js +16 -1
- package/lib/commands/bff/status.js +3 -1
- package/lib/commands/cli-skill/index.js +2 -1
- package/lib/commands/cli-update.js +7 -1
- package/lib/commands/codegen/index.js +1 -1
- package/lib/commands/codegen/sdk.js +1 -1
- package/lib/commands/codegen/sql.js +1 -1
- package/lib/commands/common/app-registry.js +4 -1
- package/lib/commands/common/app-selector.js +4 -1
- package/lib/commands/common/async-task.js +2 -1
- package/lib/commands/common/dry-run.js +1 -1
- package/lib/commands/common/flags.js +3 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/common/validate.js +1 -1
- package/lib/commands/config/delete.js +2 -1
- package/lib/commands/config/get.js +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/init.js +5 -1
- package/lib/commands/config/list.js +1 -1
- package/lib/commands/config/set.js +4 -1
- package/lib/commands/config/shared.js +2 -1
- package/lib/commands/dataset/batch-design.js +9 -1
- package/lib/commands/dataset/business-group-update.js +10 -1
- package/lib/commands/dataset/business-groups.js +1 -1
- package/lib/commands/dataset/capability.js +3 -1
- package/lib/commands/dataset/cross-relation-create.js +2 -1
- package/lib/commands/dataset/cross-relation-delete.js +1 -1
- package/lib/commands/dataset/cross-relation-list.js +2 -1
- package/lib/commands/dataset/cross-relation-shared.js +10 -1
- package/lib/commands/dataset/cross-relation-update.js +2 -1
- package/lib/commands/dataset/delete.js +6 -1
- package/lib/commands/dataset/design-context.js +1 -1
- package/lib/commands/dataset/design-start.js +1 -1
- package/lib/commands/dataset/design-status.js +1 -1
- package/lib/commands/dataset/design-sync-retry.js +1 -1
- package/lib/commands/dataset/design-sync-status.js +1 -1
- package/lib/commands/dataset/design-validate.js +1 -1
- package/lib/commands/dataset/detail.js +5 -1
- package/lib/commands/dataset/extend-update.js +7 -1
- package/lib/commands/dataset/field-restore.js +7 -1
- package/lib/commands/dataset/field-update.js +7 -1
- package/lib/commands/dataset/generate.js +19 -1
- package/lib/commands/dataset/index.js +3 -1
- package/lib/commands/dataset/list.js +2 -1
- package/lib/commands/dataset/operations.js +2 -1
- package/lib/commands/dataset/relation-audit.js +7 -1
- package/lib/commands/dataset/relation-create.js +3 -1
- package/lib/commands/dataset/relation-delete.js +3 -1
- package/lib/commands/dataset/relation-shared.js +21 -1
- package/lib/commands/dataset/relation-update.js +4 -1
- package/lib/commands/dataset/relations.js +7 -1
- package/lib/commands/dataset/rename.js +4 -1
- package/lib/commands/dataset/restore.js +7 -1
- package/lib/commands/dataset/user-deleted-field-list.js +3 -1
- package/lib/commands/db/analysis-batching.js +3 -1
- package/lib/commands/db/analyze-batch-plan.js +2 -1
- package/lib/commands/db/analyze-cancel.js +1 -1
- package/lib/commands/db/analyze-start.js +3 -1
- package/lib/commands/db/analyze-status.js +6 -1
- package/lib/commands/db/create.js +4 -1
- package/lib/commands/db/cross-db-analysis-shared.js +3 -1
- package/lib/commands/db/cross-db-analyze-latest.js +1 -1
- package/lib/commands/db/cross-db-analyze-start.js +2 -1
- package/lib/commands/db/cross-db-analyze-status.js +1 -1
- package/lib/commands/db/delete.js +3 -1
- package/lib/commands/db/detail.js +1 -1
- package/lib/commands/db/diff-refresh-start.js +1 -1
- package/lib/commands/db/diff-refresh-status.js +2 -1
- package/lib/commands/db/diff.js +3 -1
- package/lib/commands/db/index.js +2 -1
- package/lib/commands/db/list.js +2 -1
- package/lib/commands/db/shared.js +3 -1
- package/lib/commands/db/table-diff-shared.js +2 -1
- package/lib/commands/db/tables.js +2 -1
- package/lib/commands/db/test.js +2 -1
- package/lib/commands/db/update.js +4 -1
- package/lib/commands/deployment/index.js +1 -1
- package/lib/commands/deployment/sync-all.js +3 -1
- package/lib/commands/deployment/sync-jobs.js +2 -1
- package/lib/commands/deployment/sync-status.js +2 -1
- package/lib/commands/doctor.js +12 -1
- package/lib/commands/file/index.js +3 -1
- package/lib/commands/flow/create.js +2 -1
- package/lib/commands/flow/detail.js +3 -1
- package/lib/commands/flow/index.js +1 -1
- package/lib/commands/flow/list.js +2 -1
- package/lib/commands/flow/page-list.js +2 -1
- package/lib/commands/flow/publish.js +2 -1
- package/lib/commands/flow/runtime-resources-shared.js +3 -1
- package/lib/commands/flow/runtime-role-list.js +2 -1
- package/lib/commands/flow/runtime-role-user-list.js +2 -1
- package/lib/commands/flow/runtime-user-search.js +2 -1
- package/lib/commands/flow/shared.js +6 -1
- package/lib/commands/flow/update.js +4 -1
- package/lib/commands/flow/validate.js +2 -1
- package/lib/commands/instant-api-policy/current.js +1 -1
- package/lib/commands/instant-api-policy/index.js +1 -1
- package/lib/commands/instant-api-policy/init.js +2 -1
- package/lib/commands/instant-api-policy/publish.js +5 -1
- package/lib/commands/instant-api-policy/pull.js +2 -1
- package/lib/commands/instant-api-policy/revision.js +1 -1
- package/lib/commands/instant-api-policy/revisions.js +1 -1
- package/lib/commands/instant-api-policy/rollback.js +5 -1
- package/lib/commands/instant-api-policy/shared.js +5 -1
- package/lib/commands/instant-api-policy/validate.js +1 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/nudge.js +2 -1
- package/lib/commands/issue/report.js +5 -1
- package/lib/commands/kb/create.js +5 -1
- package/lib/commands/kb/delete.js +5 -1
- package/lib/commands/kb/detail.js +1 -1
- package/lib/commands/kb/import-api.d.ts +3 -0
- package/lib/commands/kb/import-api.js +1 -0
- package/lib/commands/kb/import-resume.d.ts +2 -0
- package/lib/commands/kb/import-resume.js +2 -0
- package/lib/commands/kb/import-shared.d.ts +69 -0
- package/lib/commands/kb/import-shared.js +9 -0
- package/lib/commands/kb/import-status.d.ts +2 -0
- package/lib/commands/kb/import-status.js +1 -0
- package/lib/commands/kb/import.d.ts +2 -0
- package/lib/commands/kb/import.js +3 -0
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/kb/list.js +1 -1
- package/lib/commands/kb/search.js +3 -1
- package/lib/commands/kb/shared.js +9 -1
- package/lib/commands/kb/update.js +7 -1
- package/lib/commands/logs/index.js +2 -1
- package/lib/commands/menu/asset-update.js +8 -1
- package/lib/commands/menu/delete.js +15 -1
- package/lib/commands/menu/external-link-create.js +16 -1
- package/lib/commands/menu/external-link-update.js +10 -1
- package/lib/commands/menu/group-create.js +8 -1
- package/lib/commands/menu/group-update.js +6 -1
- package/lib/commands/menu/index.js +2 -1
- package/lib/commands/menu/list.js +1 -1
- package/lib/commands/menu/move.js +6 -1
- package/lib/commands/menu/regroup-start.js +11 -1
- package/lib/commands/menu/rename.js +9 -1
- package/lib/commands/menu/shared/compare-table.js +2 -1
- package/lib/commands/menu/shared/delete-plan.js +13 -1
- package/lib/commands/menu/shared/facts.js +5 -1
- package/lib/commands/menu/shared/index.js +1 -1
- package/lib/commands/menu/shared/inquirer.js +4 -1
- package/lib/commands/menu/shared/local-pages.js +5 -1
- package/lib/commands/menu/shared/logic.js +3 -1
- package/lib/commands/menu/shared/mutations.js +9 -1
- package/lib/commands/menu/shared/path.js +1 -1
- package/lib/commands/menu/shared/service.js +4 -1
- package/lib/commands/menu/shared/subapp-assets.js +4 -1
- package/lib/commands/menu/shared/sync-core.js +7 -1
- package/lib/commands/menu/shared/types.js +1 -1
- package/lib/commands/menu/shared/update-core.js +8 -1
- package/lib/commands/menu/shared/valid-url.js +1 -1
- package/lib/commands/menu/subapp-assets-status.js +1 -1
- package/lib/commands/menu/subapp-assets-update.js +7 -1
- package/lib/commands/menu/sync.js +7 -1
- package/lib/commands/menu/visibility-update.js +13 -1
- package/lib/commands/metric/contract.d.ts +8 -0
- package/lib/commands/metric/contract.js +5 -0
- package/lib/commands/metric/definition.d.ts +43 -0
- package/lib/commands/metric/definition.js +4 -0
- package/lib/commands/metric/delete.d.ts +2 -0
- package/lib/commands/metric/delete.js +3 -0
- package/lib/commands/metric/detail.d.ts +2 -0
- package/lib/commands/metric/detail.js +1 -0
- package/lib/commands/metric/example.d.ts +2 -0
- package/lib/commands/metric/example.js +1 -0
- package/lib/commands/metric/index.d.ts +2 -0
- package/lib/commands/metric/index.js +1 -0
- package/lib/commands/metric/list.d.ts +2 -0
- package/lib/commands/metric/list.js +2 -0
- package/lib/commands/metric/publication-diff.d.ts +8 -0
- package/lib/commands/metric/publication-diff.js +1 -0
- package/lib/commands/metric/publish.d.ts +2 -0
- package/lib/commands/metric/publish.js +4 -0
- package/lib/commands/metric/schema.d.ts +2 -0
- package/lib/commands/metric/schema.js +1 -0
- package/lib/commands/metric/shared.d.ts +14 -0
- package/lib/commands/metric/shared.js +2 -0
- package/lib/commands/metric/validate.d.ts +2 -0
- package/lib/commands/metric/validate.js +1 -0
- package/lib/commands/notification/config-create.js +4 -1
- package/lib/commands/notification/config-delete.js +4 -1
- package/lib/commands/notification/config-list.js +2 -1
- package/lib/commands/notification/config-update.js +4 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +18 -1
- package/lib/commands/ocr/index.js +4 -1
- package/lib/commands/page/create.js +6 -1
- package/lib/commands/page/custom/detail.js +2 -1
- package/lib/commands/page/custom/list.js +2 -1
- package/lib/commands/page/custom/publish.js +3 -1
- package/lib/commands/page/custom/shared.js +3 -1
- package/lib/commands/page/custom/syntax.js +2 -1
- package/lib/commands/page/custom/update.js +3 -1
- package/lib/commands/page/data-list-status.js +2 -1
- package/lib/commands/page/generate-start.js +5 -1
- package/lib/commands/page/generate-status.js +4 -1
- package/lib/commands/page/index.js +2 -1
- package/lib/commands/page/pull.js +6 -1
- package/lib/commands/page/push.js +11 -1
- package/lib/commands/page/relation-audit.js +15 -1
- package/lib/commands/page/restore.js +5 -1
- package/lib/commands/page/shared.js +16 -1
- package/lib/commands/page/sync.js +2 -1
- package/lib/commands/project/api-architecture-upgrade.js +11 -1
- package/lib/commands/project/create/enhanced-guided-create.js +2 -1
- package/lib/commands/project/create/format-elapsed.js +1 -1
- package/lib/commands/project/create/main.js +13 -1
- package/lib/commands/project/create/materialize-project-template.js +12 -1
- package/lib/commands/project/create/project-name.js +1 -1
- package/lib/commands/project/create/project-template-archive.js +5 -1
- package/lib/commands/project/create/project-template-path.js +1 -1
- package/lib/commands/project/create/use-copy-project-template.js +2 -1
- package/lib/commands/project/create/use-format-code.js +1 -1
- package/lib/commands/project/create/use-install-dependencies.js +1 -1
- package/lib/commands/project/domain-routing-sync.js +1 -1
- package/lib/commands/project/index.js +4 -1
- package/lib/commands/project/upgrade.js +7 -1
- package/lib/commands/registry.js +10 -1
- package/lib/commands/role/delete.js +2 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +2 -1
- package/lib/commands/role/shared.js +8 -1
- package/lib/commands/role/update.js +3 -1
- package/lib/commands/role/user-add.js +2 -1
- package/lib/commands/role/user-remove.js +2 -1
- package/lib/commands/role/user-resolve.js +1 -1
- package/lib/commands/rule/get.js +1 -1
- package/lib/commands/rule/index.js +1 -1
- package/lib/commands/rule/list.js +1 -1
- package/lib/commands/rule/set.js +7 -1
- package/lib/commands/rule/shared.js +4 -1
- package/lib/commands/run/index.js +5 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/sql/create.js +7 -1
- package/lib/commands/sql/delete.js +4 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/sql/list.js +2 -1
- package/lib/commands/sql/pull.js +10 -1
- package/lib/commands/sql/push.js +9 -1
- package/lib/commands/sql/shared.js +5 -1
- package/lib/commands/sql/status.js +3 -1
- package/lib/commands/sql/validate.js +5 -1
- package/lib/commands/task/index.js +1 -1
- package/lib/commands/task/status.js +2 -1
- package/lib/commands/tenant/index.js +1 -1
- package/lib/commands/tenant/members-list.js +2 -1
- package/lib/commands/tenant/shared.js +2 -1
- package/lib/commands/user-account/dingding-sandbox-bind.js +2 -1
- package/lib/commands/user-account/feishu-bind.js +2 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/add.js +1 -1
- package/lib/commands/workspace/index.js +7 -1
- package/lib/commands/workspace/remove.js +1 -1
- package/lib/config/domain-config.js +8 -1
- package/lib/config/project-domain-routing.js +3 -1
- package/lib/config/region-config.js +2 -1
- package/lib/config/schema.js +7 -1
- package/lib/constant/cdn.js +2 -1
- package/lib/constant/cli.js +8 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/domain.js +4 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/paths.js +1 -1
- package/lib/constant/region.js +1 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/routing-profile.js +1 -1
- package/lib/context/app-resolver.js +7 -1
- package/lib/context/auth-resolver.js +1 -1
- package/lib/context/config-loader.js +7 -1
- package/lib/context.js +9 -1
- package/lib/core/alias-resolver.js +5 -1
- package/lib/core/api-client.d.ts +14 -7
- package/lib/core/api-client.js +69 -1
- package/lib/core/bff/config.js +1 -1
- package/lib/core/bff/file-system.js +6 -1
- package/lib/core/bff/hash.js +1 -1
- package/lib/core/bff/hook-directory.js +9 -1
- package/lib/core/bff/lock.js +2 -1
- package/lib/core/bff/types.js +1 -1
- package/lib/core/bff/utils.js +3 -1
- package/lib/core/cross-db-analysis.js +1 -1
- package/lib/core/cross-db-relation.js +1 -1
- package/lib/core/db-resolver.js +2 -1
- package/lib/core/flow-config.js +49 -1
- package/lib/core/instant-api-policy/config.js +7 -1
- package/lib/core/instant-api-policy/endpoints.js +1 -1
- package/lib/core/kb-management-client.d.ts +11 -0
- package/lib/core/kb-management-client.js +4 -1
- package/lib/core/kb-search-client.js +3 -1
- package/lib/core/page/file-system.js +2 -1
- package/lib/core/page/hash.js +1 -1
- package/lib/core/page/lock.js +2 -1
- package/lib/core/page/lr-smart-jsx.js +4 -1
- package/lib/core/page/types.js +1 -1
- package/lib/core/sql-index-auditor.js +14 -1
- package/lib/core/sql-sync/config.js +1 -1
- package/lib/core/sql-sync/file-system.js +3 -1
- package/lib/core/sql-sync/hash.js +1 -1
- package/lib/core/sql-sync/lock.js +2 -1
- package/lib/core/sql-sync/types.js +1 -1
- package/lib/core/sql-sync/utils.js +2 -1
- package/lib/core/sql-validator.js +15 -1
- package/lib/errors.js +3 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/error-output.js +1 -1
- package/lib/framework/explicit-yes.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +2 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +2 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-alias.js +2 -1
- package/lib/framework/runner.js +9 -1
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/supported-flags.js +2 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +3 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/runtime/confirmation.js +2 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +4 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +2 -1
- package/lib/runtime/types.js +1 -1
- package/lib/services/dataset-design/checkpoint.js +2 -1
- package/lib/services/dataset-design/commands.js +14 -1
- package/lib/services/dataset-design/contract.js +8 -1
- package/lib/skills/builtin-skill.js +8 -1
- package/lib/skills/install-updated-skill.d.ts +8 -0
- package/lib/skills/install-updated-skill.js +3 -0
- package/lib/skills/local-skills-installer.d.ts +2 -0
- package/lib/skills/local-skills-installer.js +1 -0
- package/lib/skills/main.js +2 -1
- package/lib/skills/npx-skills-add.d.ts +6 -6
- package/lib/skills/npx-skills-add.js +5 -1
- package/lib/skills/skill-presence.d.ts +1 -30
- package/lib/skills/skill-presence.js +2 -1
- package/lib/telemetry/cli-command-trace.js +2 -1
- package/lib/telemetry/cli-help-trace.js +1 -1
- package/lib/telemetry/ensure-cli-otel-config.js +1 -1
- package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
- package/lib/telemetry/send-cli-trace-log.js +1 -1
- package/lib/types/index.js +1 -1
- package/lib/utils/ai_config.js +3 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +5 -1
- package/lib/utils/cli-version-check.js +4 -1
- package/lib/utils/cli-version-policy.js +3 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/entity-with-id.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +3 -1
- package/lib/utils/http-client.js +2 -1
- package/lib/utils/is-non-interactive.js +1 -1
- package/lib/utils/logger.js +3 -1
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +5 -1
- package/lib/utils/update-notice.js +3 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/with-active-cookie.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +10 -7
- package/skills/rabetbase/SKILL.md +11 -7
- package/skills/rabetbase/guides/backend-function.md +3 -1
- package/skills/rabetbase/guides/data-api-guidelines.md +1 -1
- package/skills/rabetbase/guides/frontend-development.md +1 -0
- package/skills/rabetbase/guides/metric-development.md +185 -0
- package/skills/rabetbase/references/rabetbase-app-config.md +4 -3
- package/skills/rabetbase/references/rabetbase-cli-skill-install.md +5 -5
- package/skills/rabetbase/references/rabetbase-dataset-design.md +1 -1
- package/skills/rabetbase/references/rabetbase-kb.md +16 -0
- package/skills/rabetbase/references/rabetbase-metric.md +119 -0
- package/skills/rabetbase/references/rabetbase-update.md +7 -5
- package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
- package/skills/rabetbase-dataset-generation/references/workflow.md +1 -1
- package/skills/rabetbase-metrics-generation/SKILL.md +22 -0
- package/skills/rabetbase-metrics-generation/references/verification.md +19 -0
- package/skills/rabetbase-metrics-generation/references/workflow.md +41 -0
- package/skills/rabetbase-metrics-generation/templates/statistics-delivery.md +11 -0
- package/skills/rabetbase-page-generation/SKILL.md +1 -1
- package/skills/rabetbase-page-generation/references/generation.md +1 -1
- package/skills/rabetbase.manifest.json +5 -3
- package/templates/metrics/definition.json +78 -0
- package/templates/metrics/metric-definition.schema.json +136 -0
- package/lib/postinstall.d.ts +0 -3
- package/lib/postinstall.js +0 -1
- package/scripts/postinstall.mjs +0 -24
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{asDryRunResult}from"../../commands/common/dry-run.js";import{bindFeishuAccount,FEISHU_BIND_PATH}from"../../core/api-client.js";import{CliErrors}from"../../errors.js";const PROVIDER_ID="feishu";const CURRENT_BINDING_WARNING="The current binding is not exposed by the server; before is unavailable.";function readUnionId(ctx){const unionId=ctx.str("union-id").trim();if(!/^on_[A-Za-z0-9_-]+$/.test(unionId)){throw CliErrors.validation("--union-id must match on_ followed by letters, digits, underscores, or hyphens.","Pass a Feishu union id such as on_example_001.")}return unionId}function buildBindingData(unionId,dryRun){return{operation:"bind",selector:{providerId:PROVIDER_ID,unionId:unionId},before:null,after:{providerId:PROVIDER_ID,unionId:unionId,bound:true},dryRun:dryRun,backend:{method:"POST",path:FEISHU_BIND_PATH},warnings:[CURRENT_BINDING_WARNING]}}export const feishuBind={service:"user-account",command:"feishu-bind",
|
|
2
|
+
description:"Bind the current platform user to a Feishu account",risk:"write",requiresAuth:true,requiresAppCode:false,structuredErrors:true,flags:[{name:"union-id",type:"string",required:true,description:"Feishu union_id for the configured Feishu application developer"}],async validate(ctx){readUnionId(ctx)},async dryRun(ctx){const unionId=readUnionId(ctx);return asDryRunResult(buildBindingData(unionId,true),{method:"POST",url:FEISHU_BIND_PATH})},async execute(ctx){const unionId=readUnionId(ctx);const confirmed=await bindFeishuAccount(unionId);if(confirmed!==true){throw CliErrors.apiError("Feishu account binding was not confirmed.","Verify the current binding through the platform before explicitly retrying; do not automatically retry.")}return{ok:true,data:buildBindingData(unionId,false),message:"Bound current user to Feishu account."}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{dingTalkSandboxBind}from"../../commands/user-account/dingding-sandbox-bind.js";import{feishuBind}from"../../commands/user-account/feishu-bind.js";export const userAccountDefinitions=[dingTalkSandboxBind,feishuBind];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{buildAppAddFlags,runAppAdd,validateAppName}from"../../commands/common/app-registry.js";export const workspaceAddDefinition={service:"workspace",command:"add",description:"Register an app profile in the current workspace (or --global)",risk:"write",requiresAuth:false,requiresAppCode:false,args:[{name:"name",description:"App profile name",required:true}],flags:buildAppAddFlags(),validate:ctx=>validateAppName(ctx,"workspace add"),execute:ctx=>runAppAdd(ctx,"workspace add")};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import{CliErrors}from"../../errors.js";import{CLI_BIN_NAME}from"../../constant/cli.js";import{RABETBASE_ENV_VALUES}from"../../constant/env.js";import{RABETBASE_OUTPUT_FORMAT_VALUES}from"../../constant/output.js";import{RISK_LEVEL_VALUES}from"../../constant/risk.js";import{validateAppcode}from"../../commands/common/validate.js";import{readConfigFile,readRawConfigWithLayers,resolveWriteConfigPath,writeConfigFile}from"../../context.js";import{workspaceAddDefinition}from"../../commands/workspace/add.js";import{workspaceRemoveDefinition}from"../../commands/workspace/remove.js";import{normalizeStoredDefaultApp}from"../../config/schema.js";import{ENABLED_LOVRABET_REGION_VALUES}from"../../constant/region.js";const WORKSPACE_USAGE=`${CLI_BIN_NAME} workspace <init|use> --app <name> [--appcode <code>]`;const SAFE_PROFILE_KEYS=["appcode","apiGroup","region","env","apiDir","format","pageSize","riskLevel","locale"];const workspaceFlags=[{name:"app",type:"string",
|
|
2
|
+
description:"App profile name to use in this workspace"},{name:"appcode",type:"string",description:"App code to bind to this workspace"},{name:"apiGroup",type:"string",description:"Join key for app profiles that share one generated API model registry"},{name:"region",type:"string",description:"Country/region for this workspace app profile",enum:[...ENABLED_LOVRABET_REGION_VALUES]},{name:"env",type:"string",description:"Target environment",enum:[...RABETBASE_ENV_VALUES]},{name:"apiDir",type:"string",description:"API directory path for this workspace app profile"},{name:"defaultFormat",type:"string",description:"Default output format for this workspace app profile",enum:[...RABETBASE_OUTPUT_FORMAT_VALUES]},{name:"pageSize",type:"number",description:"Default page size for this workspace app profile"},{name:"riskLevel",type:"string",description:"Risk level for this workspace app profile",enum:[...RISK_LEVEL_VALUES]},{name:"locale",type:"string",
|
|
3
|
+
description:"App locale for this workspace app profile (not CLI language; reserved for later app use)"}];function isRecord(value){return!!value&&typeof value==="object"&&!Array.isArray(value)}function assertValidAppcode(appcode){const{valid:valid,message:message}=validateAppcode(appcode);if(!valid){throw CliErrors.validation(`Invalid appcode: ${appcode}`,message)}}function sanitizeProfile(profile){if(!isRecord(profile))return{};const sanitized={};for(const key of SAFE_PROFILE_KEYS){if(profile[key]!==undefined)sanitized[key]=profile[key]}return sanitized}function cloneProfile(profile){return isRecord(profile)?{...profile}:{}}function collectWorkspaceProfileOverrides(ctx){const profile={};const apiGroup=ctx.str("apiGroup");const region=ctx.str("region");const env=ctx.str("env");const apiDir=ctx.str("apiDir");const defaultFormat=ctx.str("defaultFormat");const pageSize=ctx.flag("pageSize");const riskLevel=ctx.str("riskLevel");const locale=ctx.str("locale")
|
|
4
|
+
;if(apiGroup)profile.apiGroup=apiGroup;if(region)profile.region=region;if(env)profile.env=env;if(apiDir)profile.apiDir=apiDir;if(defaultFormat)profile.format=defaultFormat;if(pageSize!==undefined&&pageSize!=="")profile.pageSize=Number(pageSize);if(riskLevel)profile.riskLevel=riskLevel;if(locale)profile.locale=locale;return profile}async function validateWorkspaceArgs(ctx){const app=ctx.str("app").trim();const appcode=ctx.str("appcode").trim();if(!app&&!appcode){throw CliErrors.validation("Missing workspace app selector.",`Use \`${CLI_BIN_NAME} workspace init --appcode <code>\` or \`${CLI_BIN_NAME} workspace use --app <name>\`.`)}if(appcode)assertValidAppcode(appcode)}function resolveKnownApps(){const{config:merged,layers:layers}=readRawConfigWithLayers();const mergedApps=isRecord(merged.apps)?merged.apps:{};const globalApps=isRecord(layers.globalConfig.apps)?layers.globalConfig.apps:{};return{...globalApps,...mergedApps}}async function configureWorkspace(ctx,operation){
|
|
5
|
+
const inputApp=ctx.str("app").trim();const inputAppcode=ctx.str("appcode").trim();const appName=inputApp||inputAppcode;if(!appName){throw CliErrors.validation("Missing workspace app selector.",`Use \`${CLI_BIN_NAME} workspace init --appcode <code>\` or \`${CLI_BIN_NAME} workspace use --app <name>\`.`)}if(inputAppcode)assertValidAppcode(inputAppcode);const configPath=resolveWriteConfigPath("project");const config=readConfigFile(configPath);const knownApps=resolveKnownApps();const projectApps=isRecord(config.apps)?{...config.apps}:{};const existingProjectProfile=cloneProfile(projectApps[appName]);const knownProfile=sanitizeProfile(knownApps[appName]);const sourceProfile=inputAppcode?{}:knownProfile;const resolvedAppcode=inputAppcode||sourceProfile.appcode;if(!resolvedAppcode){const available=Object.keys(knownApps)
|
|
6
|
+
;const hint=available.length===0?`Use \`${CLI_BIN_NAME} workspace ${operation} --app ${appName} --appcode <code>\`.`:`Pass --appcode <code>, or choose one of: ${available.join(", ")}`;throw CliErrors.validation(`App "${appName}" not found.`,hint)}assertValidAppcode(String(resolvedAppcode));const profile={...sourceProfile,...existingProjectProfile,appcode:String(resolvedAppcode),...collectWorkspaceProfileOverrides(ctx)};projectApps[appName]=profile;config.apps=projectApps;normalizeStoredDefaultApp(config,appName);delete config.appcode;delete config.app;if(profile.env){config.env=profile.env}writeConfigFile(configPath,config);return{ok:true,message:`Workspace ${operation==="init"?"initialized":"updated"}: ${appName} (appcode: ${profile.appcode}). Config: ${configPath}. Credentials: not written.`,data:{operation:`workspace.${operation}`,configPath:configPath,app:appName,appcode:profile.appcode,apiGroup:profile.apiGroup??null,region:profile.region??null,env:profile.env??null,
|
|
7
|
+
credentialsWritten:false}}}const workspaceInitDefinition={service:"workspace",command:"init",description:"Initialize the current workspace app binding",risk:"write",requiresAuth:false,requiresAppCode:false,args:[],flags:workspaceFlags,validate:validateWorkspaceArgs,execute:ctx=>configureWorkspace(ctx,"init")};const workspaceUseDefinition={service:"workspace",command:"use",description:"Switch the current workspace app binding",risk:"write",requiresAuth:false,requiresAppCode:false,args:[],flags:workspaceFlags,validate:validateWorkspaceArgs,execute:ctx=>configureWorkspace(ctx,"use")};export const workspaceDefinitions=[workspaceInitDefinition,workspaceUseDefinition,workspaceAddDefinition,workspaceRemoveDefinition];export{WORKSPACE_USAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{buildAppRemoveFlags,runAppRemove,validateAppName}from"../../commands/common/app-registry.js";export const workspaceRemoveDefinition={service:"workspace",command:"remove",description:"Remove an app profile from the current workspace (or --global)",risk:"write",requiresAuth:false,requiresAppCode:false,args:[{name:"name",description:"App profile name to remove",required:true}],flags:buildAppRemoveFlags(),validate:ctx=>validateAppName(ctx,"workspace remove"),execute:ctx=>runAppRemove(ctx,"workspace remove")};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
function a269_0x515d(_0x2b182c,_0x48d902){_0x2b182c=_0x2b182c-0x119;const _0x50b279=a269_0x50b2();let _0x515d95=_0x50b279[_0x2b182c];return _0x515d95;}const a269_0x71b363=a269_0x515d;(function(_0x5ddaea,_0x4eb6ea){const _0x121873=a269_0x515d,_0x3322ce=_0x5ddaea();while(!![]){try{const _0xf8672a=-parseInt(_0x121873(0x127))/0x1*(parseInt(_0x121873(0x14c))/0x2)+parseInt(_0x121873(0x13f))/0x3+parseInt(_0x121873(0x14a))/0x4*(-parseInt(_0x121873(0x167))/0x5)+parseInt(_0x121873(0x11b))/0x6+-parseInt(_0x121873(0x138))/0x7+-parseInt(_0x121873(0x119))/0x8+parseInt(_0x121873(0x13c))/0x9*(parseInt(_0x121873(0x163))/0xa);if(_0xf8672a===_0x4eb6ea)break;else _0x3322ce['push'](_0x3322ce['shift']());}catch(_0x28d344){_0x3322ce['push'](_0x3322ce['shift']());}}}(a269_0x50b2,0x990c2));import{existsSync,readFileSync}from'node:fs';import{isAbsolute,resolve}from'node:path';import{CliErrors}from'../errors.js';import{ENTERPRISE_ROUTING_CDN_FIELDS,ENTERPRISE_ROUTING_DOMAIN_FIELDS,ENTERPRISE_ROUTING_KIND,ENTERPRISE_ROUTING_PROTOCOL,REQUIRED_ENTERPRISE_ROUTING_CDN_FIELDS,REQUIRED_ENTERPRISE_ROUTING_DOMAIN_FIELDS}from'../generated/routing-contract.js';export const DOMAIN_CONFIG_FIELDS=[a269_0x71b363(0x156),a269_0x71b363(0x124),a269_0x71b363(0x15f),a269_0x71b363(0x125),'kbDomain',a269_0x71b363(0x162),a269_0x71b363(0x137),a269_0x71b363(0x14f),'certificateDomain'];function a269_0x50b2(){const _0x21ba28=['app-domain','join','platformDomain','pathname','runtimeDomain','skillHubDomain','\x20without\x20credentials,\x20query,\x20or\x20fragment.','kbServiceDomain','590OdlJzJ','password',':\x20expected\x20an\x20HTTPS\x20origin\x20without\x20credentials,\x20path,\x20query,\x20or\x20fragment.','string','30SZZynq','trim','Invalid\x20domain\x20config:\x20expected\x20a\x20JSON\x20object.','kind',':\x20expected\x20a\x20non-empty\x20HTTPS\x20origin.','9316248mnEVLm','keys','5428206fBlDfj','kb-service-domain','Unsupported\x20routing\x20manifest:\x20expected\x20protocol\x20\x22','certificateDomain','cwd','includes','Invalid\x20cdn.','protocol','isArray','apiDomain','skillDomain','origin','1bIxcSv','Enterprise\x20','Update\x20the\x20manifest\x20so\x20both\x20CLIs\x20consume\x20the\x20same\x20routing\x20data.','Enterprise\x20routing\x20manifest\x20requires\x20localDomain\x20and\x20certificateDomain\x20together.',':\x20expected\x20a\x20non-empty\x20HTTPS\x20URL.','Invalid\x20enterprise\x20routing\x20manifest:\x20domains\x20must\x20be\x20an\x20object.','base\x20URL','user-domain','hash','Unsupported\x20domain\x20config\x20field(s):\x20','username','domains','For\x20internal\x20deployments,\x20terminate\x20TLS\x20at\x20the\x20ingress,\x20reverse\x20proxy,\x20or\x20load\x20balancer;\x20an\x20internal\x20CA\x20is\x20supported.','replace','Enterprise\x20routing\x20manifests\x20cannot\x20be\x20combined\x20with\x20individual\x20Domain\x20flags.','skill-domain','appDomain','2956030rnpfdZ','local-domain','enterprise-v1',':\x20expected\x20an\x20HTTPS\x20','112797BdKWNE','api-domain','Invalid\x20enterprise\x20routing\x20config:\x20expected\x20an\x20object.','3712386lxVgiB','Invalid\x20enterprise\x20routing\x20manifest:\x20cdn\x20must\x20be\x20an\x20object.','Allowed\x20fields:\x20','search','object','Invalid\x20','https:','\x22\x20is\x20not\x20a\x20valid\x20URL.','Unsupported\x20enterprise\x20CDN\x20field(s):\x20','\x20does\x20not\x20provide\x20a\x20Domain\x20for\x20','agentDomain','122892mrFYYk','runtime-domain','967138qgztjt','Enterprise\x20routing\x20manifest\x20is\x20missing\x20required\x20Domain(s):\x20','filter','localDomain','cdn','\x20and\x20has\x20no\x20default.','\x22\x20and\x20kind\x20\x22',':\x20\x22','validation','Enterprise\x20routing\x20manifest\x20is\x20missing\x20required\x20CDN\x20field(s):\x20','userDomain','length','str','kbDomain','rabetbase-cli'];a269_0x50b2=function(){return _0x21ba28;};return a269_0x50b2();}const DOMAIN_FLAGS={'userDomain':a269_0x71b363(0x12e),'apiDomain':a269_0x71b363(0x13d),'runtimeDomain':a269_0x71b363(0x14b),'skillDomain':a269_0x71b363(0x136),'kbDomain':'kb-domain','kbServiceDomain':a269_0x71b363(0x11c),'appDomain':a269_0x71b363(0x15b),'localDomain':a269_0x71b363(0x139),'certificateDomain':'certificate-domain'};export const LEGACY_DOMAIN_CONFIG_FIELDS=[a269_0x71b363(0x149),a269_0x71b363(0x15d),a269_0x71b363(0x160)];const ENTERPRISE_TO_LOCAL_FIELD={'userDomain':a269_0x71b363(0x156),'apiDomain':a269_0x71b363(0x124),'runtimeDomain':a269_0x71b363(0x15f),'skillDomain':a269_0x71b363(0x125),'kbDomain':a269_0x71b363(0x159),'kbServiceDomain':a269_0x71b363(0x162),'appDomain':a269_0x71b363(0x137),'localDomain':a269_0x71b363(0x14f),'certificateDomain':a269_0x71b363(0x11e)},ROUTING_CONSUMER=a269_0x71b363(0x15a);export function normalizeDomainOrigin(_0x305230,_0x10cd0f){const _0x8800f7=a269_0x71b363;if(typeof _0x10cd0f!==_0x8800f7(0x166)||!_0x10cd0f[_0x8800f7(0x168)]())throw CliErrors[_0x8800f7(0x154)](_0x8800f7(0x144)+_0x305230+_0x8800f7(0x16b));let _0x2f72f7;try{_0x2f72f7=new URL(_0x10cd0f[_0x8800f7(0x168)]());}catch{throw CliErrors[_0x8800f7(0x154)]('Invalid\x20'+_0x305230+':\x20\x22'+_0x10cd0f+_0x8800f7(0x146));}if(_0x2f72f7[_0x8800f7(0x122)]!=='https:'||_0x2f72f7[_0x8800f7(0x131)]||_0x2f72f7[_0x8800f7(0x164)]||_0x2f72f7[_0x8800f7(0x15e)]!=='/'&&_0x2f72f7[_0x8800f7(0x15e)]!==''||_0x2f72f7[_0x8800f7(0x142)]||_0x2f72f7['hash'])throw CliErrors['validation'](_0x8800f7(0x144)+_0x305230+_0x8800f7(0x165),_0x8800f7(0x133));return _0x2f72f7[_0x8800f7(0x126)];}export function normalizeRoutingDomainValue(_0x41af51,_0x46f51a){const _0x26504e=a269_0x71b363;if(typeof _0x46f51a===_0x26504e(0x166))return normalizeDomainOrigin(_0x41af51,_0x46f51a);if(!_0x46f51a||typeof _0x46f51a!==_0x26504e(0x143)||Array['isArray'](_0x46f51a))throw CliErrors[_0x26504e(0x154)](_0x26504e(0x144)+_0x41af51+':\x20expected\x20an\x20HTTPS\x20origin\x20or\x20consumer\x20Domain\x20object.');const _0x49c1e6=_0x46f51a,_0x16b0b8=_0x49c1e6[ROUTING_CONSUMER]??_0x49c1e6['default'];if(_0x16b0b8===undefined)throw CliErrors[_0x26504e(0x154)](_0x26504e(0x128)+_0x41af51+_0x26504e(0x148)+ROUTING_CONSUMER+_0x26504e(0x151));return normalizeDomainOrigin(_0x41af51,_0x16b0b8);}export function normalizeCdnBaseUrl(_0x4a576c,_0x4b6ef7){const _0x4537a2=a269_0x71b363;if(typeof _0x4b6ef7!==_0x4537a2(0x166)||!_0x4b6ef7[_0x4537a2(0x168)]())throw CliErrors[_0x4537a2(0x154)]('Invalid\x20cdn.'+_0x4a576c+_0x4537a2(0x12b));const _0x4549f4=_0x4b6ef7['trim']()[_0x4537a2(0x134)](/\/$/,'');let _0x2154fe;try{_0x2154fe=new URL(_0x4549f4);}catch{throw CliErrors[_0x4537a2(0x154)](_0x4537a2(0x121)+_0x4a576c+_0x4537a2(0x153)+_0x4b6ef7+_0x4537a2(0x146));}if(_0x2154fe[_0x4537a2(0x122)]!==_0x4537a2(0x145)||_0x2154fe[_0x4537a2(0x131)]||_0x2154fe[_0x4537a2(0x164)]||_0x2154fe['search']||_0x2154fe[_0x4537a2(0x12f)]||_0x2154fe['href'][_0x4537a2(0x134)](/\/$/,'')!==_0x4549f4||_0x4a576c==='lovrabet'&&_0x2154fe[_0x4537a2(0x126)]!==_0x4549f4)throw CliErrors[_0x4537a2(0x154)](_0x4537a2(0x121)+_0x4a576c+_0x4537a2(0x13b)+(_0x4a576c==='lovrabet'?_0x4537a2(0x126):_0x4537a2(0x12d))+_0x4537a2(0x161));return _0x4549f4;}export function resolveEnterpriseRoutingConfig(_0x165a89){const _0x1d7ce6=a269_0x71b363;return resolveEnterpriseRoutingManifest(_0x165a89)?.[_0x1d7ce6(0x132)];}export function resolveEnterpriseRoutingManifest(_0x2369a6){const _0xde29f7=a269_0x71b363;if(_0x2369a6===undefined)return undefined;if(!_0x2369a6||typeof _0x2369a6!==_0xde29f7(0x143)||Array[_0xde29f7(0x123)](_0x2369a6))throw CliErrors[_0xde29f7(0x154)](_0xde29f7(0x13e));return parseEnterpriseRoutingManifest(_0x2369a6);}export function readDomainConfigInput(_0x36790b){const _0x27ccaa=a269_0x71b363,_0x205501=isAbsolute(_0x36790b)?_0x36790b:resolve(process[_0x27ccaa(0x11f)](),_0x36790b);if(!existsSync(_0x205501))throw CliErrors[_0x27ccaa(0x154)]('Domain\x20config\x20file\x20not\x20found:\x20'+_0x205501);let _0x42b82c;try{_0x42b82c=JSON['parse'](readFileSync(_0x205501,'utf8'));}catch{throw CliErrors[_0x27ccaa(0x154)]('Invalid\x20domain\x20config\x20JSON:\x20'+_0x205501);}if(!_0x42b82c||typeof _0x42b82c!=='object'||Array[_0x27ccaa(0x123)](_0x42b82c))throw CliErrors[_0x27ccaa(0x154)](_0x27ccaa(0x169));const _0x433da1=_0x42b82c;if(_0x27ccaa(0x122)in _0x433da1)return parseEnterpriseRoutingManifest(_0x433da1);const _0x2b01a1=Object['keys'](_0x433da1)['filter'](_0x39257f=>!DOMAIN_CONFIG_FIELDS[_0x27ccaa(0x120)](_0x39257f));if(_0x2b01a1['length']>0x0)throw CliErrors['validation'](_0x27ccaa(0x130)+_0x2b01a1['join'](',\x20'),_0x27ccaa(0x141)+DOMAIN_CONFIG_FIELDS[_0x27ccaa(0x15c)](',\x20'));const _0x49311f={};for(const _0x346a0b of DOMAIN_CONFIG_FIELDS){_0x433da1[_0x346a0b]!==undefined&&(_0x49311f[_0x346a0b]=normalizeDomainOrigin(_0x346a0b,_0x433da1[_0x346a0b]));}if(Object[_0x27ccaa(0x11a)](_0x49311f)[_0x27ccaa(0x157)]===0x0)throw CliErrors['validation']('Invalid\x20domain\x20config:\x20provide\x20at\x20least\x20one\x20supported\x20Domain.');return{'mode':'legacy','domains':_0x49311f};}export function readDomainConfig(_0x1db9dc){const _0x36f03d=a269_0x71b363;return readDomainConfigInput(_0x1db9dc)[_0x36f03d(0x132)];}export function resolveDomainConfigInput(_0x57994f){const _0x4c7c20=a269_0x71b363,_0x27a79f=(_0x57994f[_0x4c7c20(0x158)]('domain-config')||'')[_0x4c7c20(0x168)](),_0x3fe560=_0x27a79f?readDomainConfigInput(_0x27a79f):{'mode':'legacy','domains':{}},_0x1783bd=DOMAIN_CONFIG_FIELDS[_0x4c7c20(0x14e)](_0x89e62b=>Boolean((_0x57994f[_0x4c7c20(0x158)](DOMAIN_FLAGS[_0x89e62b])||'')[_0x4c7c20(0x168)]()));if(_0x3fe560['mode']===_0x4c7c20(0x13a)&&_0x1783bd[_0x4c7c20(0x157)]>0x0)throw CliErrors[_0x4c7c20(0x154)](_0x4c7c20(0x135),_0x4c7c20(0x129));for(const _0x80f5e8 of DOMAIN_CONFIG_FIELDS){const _0x1de840=(_0x57994f[_0x4c7c20(0x158)](DOMAIN_FLAGS[_0x80f5e8])||'')[_0x4c7c20(0x168)]();if(_0x1de840)_0x3fe560[_0x4c7c20(0x132)][_0x80f5e8]=normalizeDomainOrigin(_0x80f5e8,_0x1de840);}return _0x3fe560;}export function resolveDomainFlags(_0xa5b8ef){return resolveDomainConfigInput(_0xa5b8ef)['domains'];}export function parseEnterpriseRoutingManifest(_0x241f6c){const _0x50fada=a269_0x71b363;if(_0x241f6c[_0x50fada(0x122)]!==ENTERPRISE_ROUTING_PROTOCOL||_0x241f6c[_0x50fada(0x16a)]!==ENTERPRISE_ROUTING_KIND)throw CliErrors[_0x50fada(0x154)](_0x50fada(0x11d)+ENTERPRISE_ROUTING_PROTOCOL+_0x50fada(0x152)+ENTERPRISE_ROUTING_KIND+'\x22.');if(!_0x241f6c[_0x50fada(0x132)]||typeof _0x241f6c['domains']!==_0x50fada(0x143)||Array[_0x50fada(0x123)](_0x241f6c[_0x50fada(0x132)]))throw CliErrors[_0x50fada(0x154)](_0x50fada(0x12c));if(!_0x241f6c[_0x50fada(0x150)]||typeof _0x241f6c[_0x50fada(0x150)]!==_0x50fada(0x143)||Array[_0x50fada(0x123)](_0x241f6c[_0x50fada(0x150)]))throw CliErrors['validation'](_0x50fada(0x140));const _0x27f1fa=_0x241f6c[_0x50fada(0x132)],_0x408a73=REQUIRED_ENTERPRISE_ROUTING_DOMAIN_FIELDS[_0x50fada(0x14e)](_0x427811=>_0x27f1fa[_0x427811]===undefined);if(_0x408a73[_0x50fada(0x157)]>0x0)throw CliErrors[_0x50fada(0x154)](_0x50fada(0x14d)+_0x408a73[_0x50fada(0x15c)](',\x20'));if(_0x27f1fa[_0x50fada(0x14f)]===undefined!==(_0x27f1fa[_0x50fada(0x11e)]===undefined))throw CliErrors[_0x50fada(0x154)](_0x50fada(0x12a));const _0xee0670=_0x241f6c['cdn'],_0x4e0a53=Object[_0x50fada(0x11a)](_0xee0670)['filter'](_0x25c773=>!ENTERPRISE_ROUTING_CDN_FIELDS[_0x50fada(0x120)](_0x25c773));if(_0x4e0a53[_0x50fada(0x157)]>0x0)throw CliErrors[_0x50fada(0x154)](_0x50fada(0x147)+_0x4e0a53[_0x50fada(0x15c)](',\x20'),_0x50fada(0x141)+ENTERPRISE_ROUTING_CDN_FIELDS[_0x50fada(0x15c)](',\x20'));const _0x1caf4f=REQUIRED_ENTERPRISE_ROUTING_CDN_FIELDS[_0x50fada(0x14e)](_0x1109ba=>_0xee0670[_0x1109ba]===undefined);if(_0x1caf4f[_0x50fada(0x157)]>0x0)throw CliErrors['validation'](_0x50fada(0x155)+_0x1caf4f[_0x50fada(0x15c)](',\x20'));const _0x354c4e={};for(const _0x5af6f6 of ENTERPRISE_ROUTING_CDN_FIELDS){_0x354c4e[_0x5af6f6]=normalizeCdnBaseUrl(_0x5af6f6,_0xee0670[_0x5af6f6]);}const _0x1546a9={},_0x15515b={};for(const _0x501e5d of ENTERPRISE_ROUTING_DOMAIN_FIELDS){const _0x1fd3e4=_0x27f1fa[_0x501e5d];if(_0x1fd3e4===undefined)continue;const _0x251698=normalizeRoutingDomainValue(_0x501e5d,_0x1fd3e4);_0x1546a9[_0x501e5d]=_0x251698;const _0x4b3b50=ENTERPRISE_TO_LOCAL_FIELD[_0x501e5d];_0x4b3b50&&(_0x15515b[_0x4b3b50]=_0x251698);}return{'mode':_0x50fada(0x13a),'domains':_0x15515b,'manifestDomains':_0x1546a9,'cdn':_0x354c4e};}
|
|
1
|
+
import{existsSync,readFileSync}from"node:fs";import{isAbsolute,resolve}from"node:path";import{CliErrors}from"../errors.js";import{ENTERPRISE_ROUTING_CDN_FIELDS,ENTERPRISE_ROUTING_DOMAIN_FIELDS,ENTERPRISE_ROUTING_KIND,ENTERPRISE_ROUTING_PROTOCOL,REQUIRED_ENTERPRISE_ROUTING_CDN_FIELDS,REQUIRED_ENTERPRISE_ROUTING_DOMAIN_FIELDS}from"../generated/routing-contract.js";export const DOMAIN_CONFIG_FIELDS=["userDomain","apiDomain","runtimeDomain","skillDomain","kbDomain","kbServiceDomain","appDomain","localDomain","certificateDomain"];const DOMAIN_FLAGS={userDomain:"user-domain",apiDomain:"api-domain",runtimeDomain:"runtime-domain",skillDomain:"skill-domain",kbDomain:"kb-domain",kbServiceDomain:"kb-service-domain",appDomain:"app-domain",localDomain:"local-domain",certificateDomain:"certificate-domain"};export const LEGACY_DOMAIN_CONFIG_FIELDS=["agentDomain","platformDomain","skillHubDomain"];const ENTERPRISE_TO_LOCAL_FIELD={userDomain:"userDomain",apiDomain:"apiDomain",
|
|
2
|
+
runtimeDomain:"runtimeDomain",skillDomain:"skillDomain",kbDomain:"kbDomain",kbServiceDomain:"kbServiceDomain",appDomain:"appDomain",localDomain:"localDomain",certificateDomain:"certificateDomain"};const ROUTING_CONSUMER="rabetbase-cli";export function normalizeDomainOrigin(field,input){if(typeof input!=="string"||!input.trim()){throw CliErrors.validation(`Invalid ${field}: expected a non-empty HTTPS origin.`)}let url;try{url=new URL(input.trim())}catch{throw CliErrors.validation(`Invalid ${field}: "${input}" is not a valid URL.`)}if(url.protocol!=="https:"||url.username||url.password||url.pathname!=="/"&&url.pathname!==""||url.search||url.hash){throw CliErrors.validation(`Invalid ${field}: expected an HTTPS origin without credentials, path, query, or fragment.`,"For internal deployments, terminate TLS at the ingress, reverse proxy, or load balancer; an internal CA is supported.")}return url.origin}export function normalizeRoutingDomainValue(field,input){
|
|
3
|
+
if(typeof input==="string")return normalizeDomainOrigin(field,input);if(!input||typeof input!=="object"||Array.isArray(input)){throw CliErrors.validation(`Invalid ${field}: expected an HTTPS origin or consumer Domain object.`)}const source=input;const resolved=source[ROUTING_CONSUMER]??source.default;if(resolved===undefined){throw CliErrors.validation(`Enterprise ${field} does not provide a Domain for ${ROUTING_CONSUMER} and has no default.`)}return normalizeDomainOrigin(field,resolved)}export function normalizeCdnBaseUrl(field,input){if(typeof input!=="string"||!input.trim()){throw CliErrors.validation(`Invalid cdn.${field}: expected a non-empty HTTPS URL.`)}const value=input.trim().replace(/\/$/,"");let url;try{url=new URL(value)}catch{throw CliErrors.validation(`Invalid cdn.${field}: "${input}" is not a valid URL.`)}if(url.protocol!=="https:"||url.username||url.password||url.search||url.hash||url.href.replace(/\/$/,"")!==value||field==="lovrabet"&&url.origin!==value){
|
|
4
|
+
throw CliErrors.validation(`Invalid cdn.${field}: expected an HTTPS ${field==="lovrabet"?"origin":"base URL"} without credentials, query, or fragment.`)}return value}export function resolveEnterpriseRoutingConfig(input){return resolveEnterpriseRoutingManifest(input)?.domains}export function resolveEnterpriseRoutingManifest(input){if(input===undefined)return undefined;if(!input||typeof input!=="object"||Array.isArray(input)){throw CliErrors.validation("Invalid enterprise routing config: expected an object.")}return parseEnterpriseRoutingManifest(input)}export function readDomainConfigInput(filePath){const absolutePath=isAbsolute(filePath)?filePath:resolve(process.cwd(),filePath);if(!existsSync(absolutePath)){throw CliErrors.validation(`Domain config file not found: ${absolutePath}`)}let parsed;try{parsed=JSON.parse(readFileSync(absolutePath,"utf8"))}catch{throw CliErrors.validation(`Invalid domain config JSON: ${absolutePath}`)}
|
|
5
|
+
if(!parsed||typeof parsed!=="object"||Array.isArray(parsed)){throw CliErrors.validation("Invalid domain config: expected a JSON object.")}const source=parsed;if("protocol"in source)return parseEnterpriseRoutingManifest(source);const unknown=Object.keys(source).filter(key=>!DOMAIN_CONFIG_FIELDS.includes(key));if(unknown.length>0){throw CliErrors.validation(`Unsupported domain config field(s): ${unknown.join(", ")}`,`Allowed fields: ${DOMAIN_CONFIG_FIELDS.join(", ")}`)}const result={};for(const field of DOMAIN_CONFIG_FIELDS){if(source[field]!==undefined){result[field]=normalizeDomainOrigin(field,source[field])}}if(Object.keys(result).length===0){throw CliErrors.validation("Invalid domain config: provide at least one supported Domain.")}return{mode:"legacy",domains:result}}export function readDomainConfig(filePath){return readDomainConfigInput(filePath).domains}export function resolveDomainConfigInput(ctx){const filePath=(ctx.str("domain-config")||"").trim()
|
|
6
|
+
;const input=filePath?readDomainConfigInput(filePath):{mode:"legacy",domains:{}};const explicitFields=DOMAIN_CONFIG_FIELDS.filter(field=>Boolean((ctx.str(DOMAIN_FLAGS[field])||"").trim()));if(input.mode==="enterprise-v1"&&explicitFields.length>0){throw CliErrors.validation("Enterprise routing manifests cannot be combined with individual Domain flags.","Update the manifest so both CLIs consume the same routing data.")}for(const field of DOMAIN_CONFIG_FIELDS){const value=(ctx.str(DOMAIN_FLAGS[field])||"").trim();if(value)input.domains[field]=normalizeDomainOrigin(field,value)}return input}export function resolveDomainFlags(ctx){return resolveDomainConfigInput(ctx).domains}export function parseEnterpriseRoutingManifest(source){if(source.protocol!==ENTERPRISE_ROUTING_PROTOCOL||source.kind!==ENTERPRISE_ROUTING_KIND){throw CliErrors.validation(`Unsupported routing manifest: expected protocol "${ENTERPRISE_ROUTING_PROTOCOL}" and kind "${ENTERPRISE_ROUTING_KIND}".`)}
|
|
7
|
+
if(!source.domains||typeof source.domains!=="object"||Array.isArray(source.domains)){throw CliErrors.validation("Invalid enterprise routing manifest: domains must be an object.")}if(!source.cdn||typeof source.cdn!=="object"||Array.isArray(source.cdn)){throw CliErrors.validation("Invalid enterprise routing manifest: cdn must be an object.")}const rawDomains=source.domains;const missing=REQUIRED_ENTERPRISE_ROUTING_DOMAIN_FIELDS.filter(field=>rawDomains[field]===undefined);if(missing.length>0){throw CliErrors.validation(`Enterprise routing manifest is missing required Domain(s): ${missing.join(", ")}`)}if(rawDomains.localDomain===undefined!==(rawDomains.certificateDomain===undefined)){throw CliErrors.validation("Enterprise routing manifest requires localDomain and certificateDomain together.")}const rawCdn=source.cdn;const unknownCdnFields=Object.keys(rawCdn).filter(field=>!ENTERPRISE_ROUTING_CDN_FIELDS.includes(field));if(unknownCdnFields.length>0){
|
|
8
|
+
throw CliErrors.validation(`Unsupported enterprise CDN field(s): ${unknownCdnFields.join(", ")}`,`Allowed fields: ${ENTERPRISE_ROUTING_CDN_FIELDS.join(", ")}`)}const missingCdnFields=REQUIRED_ENTERPRISE_ROUTING_CDN_FIELDS.filter(field=>rawCdn[field]===undefined);if(missingCdnFields.length>0){throw CliErrors.validation(`Enterprise routing manifest is missing required CDN field(s): ${missingCdnFields.join(", ")}`)}const cdn={};for(const field of ENTERPRISE_ROUTING_CDN_FIELDS){cdn[field]=normalizeCdnBaseUrl(field,rawCdn[field])}const manifestDomains={};const domains={};for(const field of ENTERPRISE_ROUTING_DOMAIN_FIELDS){const value=rawDomains[field];if(value===undefined)continue;const normalized=normalizeRoutingDomainValue(field,value);manifestDomains[field]=normalized;const localField=ENTERPRISE_TO_LOCAL_FIELD[field];if(localField){domains[localField]=normalized}}return{mode:"enterprise-v1",domains:domains,manifestDomains:manifestDomains,cdn:cdn}}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import{readFileSync,renameSync,unlinkSync,writeFileSync}from"node:fs";import{join}from"node:path";import{getActiveRegion,getActiveCdn,getApiDomain,getAppDomain,getCertificateDomain,getKbDomain,getLocalDomain,getRuntimeDomain,getSkillDomain,getUserDomain,isIndependentDeployment}from"../constant/domain.js";import{getOfficialRoutingProfile}from"../constant/routing-profile.js";export const PROJECT_DOMAIN_ROUTING_FILE_NAME="rabetbase.domain-routing.json";export const PROJECT_DOMAIN_ROUTING_PROTOCOL="lovrabet-project-domain-routing/v1";export function getProjectDomainRoutingManifest(){const region=getActiveRegion();const independent=isIndependentDeployment();const officialProfile=getOfficialRoutingProfile(region);const localDomain=getLocalDomain();const certificateDomain=getCertificateDomain();const cdn=getActiveCdn();if(!!localDomain!==!!certificateDomain){throw new Error("Independent deployment routing requires localDomain and certificateDomain together.")}return{
|
|
2
|
+
protocol:PROJECT_DOMAIN_ROUTING_PROTOCOL,mode:independent?"independent":"official",region:independent?null:region,domains:{api:getApiDomain(),runtime:getRuntimeDomain(),user:getUserDomain(),app:getAppDomain(),skill:getSkillDomain(),kb:getKbDomain()},cdn:cdn,local:localDomain&&certificateDomain?{origin:localDomain,certificateUrl:`${certificateDomain}/cert/lovrabet-dev.json`}:independent?{origin:"http://localhost"}:{origin:officialProfile.local.origin,certificateUrl:`${cdn.lovrabet}/cert/lovrabet-dev.json`}}}export function writeProjectDomainRoutingManifest(projectRoot){const manifest=getProjectDomainRoutingManifest();const filePath=join(projectRoot,PROJECT_DOMAIN_ROUTING_FILE_NAME);const content=`${JSON.stringify(manifest,null,2)}\n`;try{if(readFileSync(filePath,"utf8")===content){return{path:filePath,manifest:manifest,changed:false}}}catch{}const tempPath=`${filePath}.${process.pid}.${Date.now()}.tmp`;try{writeFileSync(tempPath,content,{encoding:"utf8",mode:420})
|
|
3
|
+
;renameSync(tempPath,filePath)}catch(error){try{unlinkSync(tempPath)}catch{}throw error}return{path:filePath,manifest:manifest,changed:true}}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{CLI_BIN_NAME}from"../constant/cli.js";import{DEFAULT_LOVRABET_REGION,isInvalidLovrabetRegion,normalizeLovrabetRegion}from"../constant/region.js";import{CliErrors}from"../errors.js";export function selectConfiguredRegion(options){if(options.appRegion!==undefined&&options.appRegion!==null&&options.appRegion!==""){return{value:options.appRegion,source:"app"}}if(options.projectRegion!==undefined&&options.projectRegion!==null&&options.projectRegion!==""){return{value:options.projectRegion,source:"project"}}if(options.globalRegion!==undefined&&options.globalRegion!==null&&options.globalRegion!==""){return{value:options.globalRegion,source:"global"}}if(options.mergedRegion!==undefined&&options.mergedRegion!==null&&options.mergedRegion!==""){return{value:options.mergedRegion,source:"config"}}return{value:undefined,source:"default"}}function describeConfiguredRegion(value){return typeof value==="string"?JSON.stringify(value):`a value of type ${value===null?"null":typeof value}`}
|
|
2
|
+
export function resolveConfiguredRegion(value,location="Rabetbase configuration"){if(isInvalidLovrabetRegion(value)){throw CliErrors.validation(`Invalid country/region ${describeConfiguredRegion(value)} in ${location}.`,`Run \`${CLI_BIN_NAME} doctor\` to locate and repair the invalid configuration before retrying.`)}return normalizeLovrabetRegion(value)??DEFAULT_LOVRABET_REGION}export function resolveEffectiveRegion(options){const selected=selectConfiguredRegion(options);const location=selected.source==="app"?options.appName?`app profile "${options.appName}"`:"selected app profile":selected.source==="project"?"project Rabetbase configuration":selected.source==="global"?"global Rabetbase configuration":"Rabetbase configuration";return{region:resolveConfiguredRegion(selected.value,location),source:selected.source}}
|
package/lib/config/schema.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
const a272_0x52ac85=a272_0x26ba;(function(_0x4f8787,_0x4bd9cc){const _0x5637d6=a272_0x26ba,_0x5628bd=_0x4f8787();while(!![]){try{const _0x3bdacc=-parseInt(_0x5637d6(0x197))/0x1*(parseInt(_0x5637d6(0x18d))/0x2)+-parseInt(_0x5637d6(0x1a4))/0x3*(parseInt(_0x5637d6(0x17c))/0x4)+parseInt(_0x5637d6(0x184))/0x5+-parseInt(_0x5637d6(0x1a6))/0x6*(parseInt(_0x5637d6(0x193))/0x7)+-parseInt(_0x5637d6(0x19a))/0x8+parseInt(_0x5637d6(0x191))/0x9*(-parseInt(_0x5637d6(0x1a5))/0xa)+parseInt(_0x5637d6(0x1ad))/0xb;if(_0x3bdacc===_0x4bd9cc)break;else _0x5628bd['push'](_0x5628bd['shift']());}catch(_0x5870f0){_0x5628bd['push'](_0x5628bd['shift']());}}}(a272_0x3799,0xbfb0e));import{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';import{isDaily,isProduction,RABETBASE_ENV_VALUES}from'../constant/env.js';function a272_0x3799(){const _0x35d85b=['App\x20locale\x20(not\x20CLI\x20language;\x20reserved\x20for\x20later\x20app\x20use)','trim','3TXjaeq','35390URNOCS','414jaywpB','appcode','apiDir','env','values','Default\x20output\x20format\x20for\x20this\x20app\x20(profile)','keys','50910860lLUtQp','number','kbDomain','region','string','kbServiceDomain','Risk\x20level','locale','some','2975204YyouDt','Access\x20key','en-US','apiDomain','pageSize','certificateDomain','cookie','app','5369610qxEUkD','accessKey','object','map','defaultFormat','has','Default\x20page\x20size','Target\x20environment','appDomain','24554icwCuV','defaultApp','API\x20directory\x20path','length','1944UjaJAO','runtimeDomain','148547QGWoIW','format','riskLevel','apps','111ORXwkY','entries','userDomain','4654360AYfEhq','apiGroup','localDomain','filter','inherit','toLowerCase','zh-CN','Join\x20key\x20for\x20app\x20profiles\x20that\x20share\x20one\x20generated\x20API\x20model\x20registry'];a272_0x3799=function(){return _0x35d85b;};return a272_0x3799();}import{RABETBASE_OUTPUT_FORMAT_VALUES}from'../constant/output.js';import{RISK_LEVEL_VALUES}from'../constant/risk.js';import{ENABLED_LOVRABET_REGION_VALUES}from'../constant/region.js';export{DEFAULT_CONFIG_VALUES}from'../constant/defaults.js';export const PROJECT_CREATE_INHERITABLE_KEYS=[a272_0x52ac85(0x182),a272_0x52ac85(0x185),a272_0x52ac85(0x1b4),a272_0x52ac85(0x194),'riskLevel',a272_0x52ac85(0x1b0),'routing',a272_0x52ac85(0x199),a272_0x52ac85(0x17f),a272_0x52ac85(0x192),'skillDomain',a272_0x52ac85(0x1af),a272_0x52ac85(0x1b2),a272_0x52ac85(0x18c),a272_0x52ac85(0x19c),a272_0x52ac85(0x181)];export const TOP_LEVEL_CONFIG_KEYS=new Set([a272_0x52ac85(0x1a7),a272_0x52ac85(0x1a9),'locale',a272_0x52ac85(0x194),'cookie',a272_0x52ac85(0x185),a272_0x52ac85(0x1a8),a272_0x52ac85(0x1b0),a272_0x52ac85(0x199),'apiDomain',a272_0x52ac85(0x192),'skillDomain','kbDomain','kbServiceDomain',a272_0x52ac85(0x18c),a272_0x52ac85(0x19c),a272_0x52ac85(0x181)]);export const CONFIG_ENUM_VALUES={'env':[...RABETBASE_ENV_VALUES],'format':[...RABETBASE_OUTPUT_FORMAT_VALUES],'region':[...ENABLED_LOVRABET_REGION_VALUES]};export function formatConfigKeyList(_0x244a52){return[..._0x244a52]['join'](',\x20');}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS];}export function isTopLevelConfigKey(_0x51a3fa){const _0xbb2a6e=a272_0x52ac85;return TOP_LEVEL_CONFIG_KEYS[_0xbb2a6e(0x189)](_0x51a3fa);}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList());}export function getConfigCommandKeyDescription(){return'Config\x20key\x20('+getTopLevelConfigKeySummary()+')';}export const APP_PROFILE_FLAG_KEY_MAP={'apiGroup':a272_0x52ac85(0x19b),'region':a272_0x52ac85(0x1b0),'env':'env','apiDir':a272_0x52ac85(0x1a8),'cookie':a272_0x52ac85(0x182),'accessKey':a272_0x52ac85(0x185),'defaultFormat':'format','pageSize':a272_0x52ac85(0x180),'riskLevel':a272_0x52ac85(0x195),'locale':a272_0x52ac85(0x1b4)};export function getAppProfileFlagDefs(){const _0x3e5f38=a272_0x52ac85;return[{'name':'apiGroup','type':_0x3e5f38(0x1b1),'description':_0x3e5f38(0x1a1)},{'name':_0x3e5f38(0x1b0),'type':_0x3e5f38(0x1b1),'description':'Country/region\x20for\x20this\x20app\x20profile','enum':[...ENABLED_LOVRABET_REGION_VALUES]},{'name':'env','type':'string','description':_0x3e5f38(0x18b),'enum':[...RABETBASE_ENV_VALUES]},{'name':_0x3e5f38(0x1a8),'type':_0x3e5f38(0x1b1),'description':_0x3e5f38(0x18f)},{'name':_0x3e5f38(0x182),'type':_0x3e5f38(0x1b1),'description':'Auth\x20cookie','hidden':!![]},{'name':_0x3e5f38(0x185),'type':'string','description':_0x3e5f38(0x17d),'hidden':!![]},{'name':_0x3e5f38(0x188),'type':'string','description':_0x3e5f38(0x1ab),'enum':[...RABETBASE_OUTPUT_FORMAT_VALUES]},{'name':_0x3e5f38(0x180),'type':_0x3e5f38(0x1ae),'description':_0x3e5f38(0x18a)},{'name':_0x3e5f38(0x195),'type':_0x3e5f38(0x1b1),'description':_0x3e5f38(0x1b3),'enum':[...RISK_LEVEL_VALUES]},{'name':_0x3e5f38(0x1b4),'type':_0x3e5f38(0x1b1),'description':_0x3e5f38(0x1a2)}];}export function collectAppProfileOverrides(_0x3c9500){const _0x2efb18=a272_0x52ac85,_0x102b9d={};for(const [_0x47b6bd,_0x319bb4]of Object[_0x2efb18(0x198)](APP_PROFILE_FLAG_KEY_MAP)){const _0x1aaa15=_0x3c9500(_0x47b6bd);if(!_0x1aaa15)continue;_0x102b9d[_0x319bb4]=_0x319bb4===_0x2efb18(0x180)?Number(_0x1aaa15):_0x1aaa15;}return _0x102b9d;}function a272_0x26ba(_0x29b6a5,_0x5c4ba9){_0x29b6a5=_0x29b6a5-0x17b;const _0x3799d3=a272_0x3799();let _0x26baa7=_0x3799d3[_0x29b6a5];return _0x26baa7;}export function buildAppProfileListFields(_0x32ce05){const _0x629482=a272_0x52ac85;return{'apiGroup':_0x32ce05[_0x629482(0x19b)]??null,'region':_0x32ce05['region']??null,'env':_0x32ce05[_0x629482(0x1a9)]??null,'apiDir':_0x32ce05[_0x629482(0x1a8)]??null,'hasCookie':!!_0x32ce05[_0x629482(0x182)],'hasAccessKey':!!_0x32ce05[_0x629482(0x185)],'format':_0x32ce05[_0x629482(0x194)]??null,'pageSize':_0x32ce05[_0x629482(0x180)]??null,'riskLevel':_0x32ce05[_0x629482(0x195)]??null,'locale':_0x32ce05[_0x629482(0x1b4)]??null};}export function buildAppDoctorFields(_0x34ab42,_0x5c00ee){const _0x41f65f=a272_0x52ac85;return{'region':{'value':_0x34ab42[_0x41f65f(0x1b0)]||_0x5c00ee[_0x41f65f(0x1b0)],'source':_0x34ab42[_0x41f65f(0x1b0)]?'app':_0x41f65f(0x19e)},'env':{'value':_0x34ab42[_0x41f65f(0x1a9)]||_0x5c00ee[_0x41f65f(0x1a9)],'source':_0x34ab42[_0x41f65f(0x1a9)]?'app':_0x41f65f(0x19e)},'apiDir':{'value':_0x34ab42['apiDir']||_0x5c00ee[_0x41f65f(0x1a8)],'source':_0x34ab42[_0x41f65f(0x1a8)]?_0x41f65f(0x183):'inherit'},'cookie':{'value':_0x34ab42[_0x41f65f(0x182)]||_0x5c00ee[_0x41f65f(0x182)],'source':_0x34ab42[_0x41f65f(0x182)]?_0x41f65f(0x183):_0x41f65f(0x19e)},'accessKey':{'value':_0x34ab42['accessKey']||_0x5c00ee[_0x41f65f(0x185)],'source':_0x34ab42[_0x41f65f(0x185)]?_0x41f65f(0x183):_0x41f65f(0x19e)}};}export function buildCanonicalAppConfig(_0x153f72,_0x1c138c){const _0x4c5cdf=a272_0x52ac85,_0x23d4dd=_0x153f72[_0x4c5cdf(0x187)](_0x379e84=>String(_0x379e84||'')[_0x4c5cdf(0x1a3)]())[_0x4c5cdf(0x19d)](Boolean);if(_0x23d4dd[_0x4c5cdf(0x190)]===0x0)return{};const _0x2dc115={};for(const _0xae3ff1 of _0x23d4dd){_0x2dc115[_0xae3ff1]=_0x1c138c&&!isProduction(_0x1c138c)?{'appcode':_0xae3ff1,'env':_0x1c138c}:{'appcode':_0xae3ff1};}return _0x23d4dd[_0x4c5cdf(0x190)]>0x1?{'apps':_0x2dc115,'defaultApp':_0x23d4dd[0x0]}:{'apps':_0x2dc115};}export function normalizeStoredDefaultApp(_0x1a03c8,_0x4f5f87){const _0x51e9ab=a272_0x52ac85,_0x2daaae=_0x1a03c8['apps']&&typeof _0x1a03c8[_0x51e9ab(0x196)]===_0x51e9ab(0x186)?_0x1a03c8[_0x51e9ab(0x196)]:{},_0x3ace60=Object[_0x51e9ab(0x1ac)](_0x2daaae);if(_0x3ace60[_0x51e9ab(0x190)]<=0x1)return delete _0x1a03c8[_0x51e9ab(0x18e)],undefined;const _0x1febd8=typeof _0x1a03c8[_0x51e9ab(0x18e)]===_0x51e9ab(0x1b1)&&_0x2daaae[_0x1a03c8['defaultApp']]?_0x1a03c8[_0x51e9ab(0x18e)]:undefined,_0x29789d=_0x4f5f87&&_0x2daaae[_0x4f5f87]?_0x4f5f87:_0x1febd8;if(_0x29789d)return _0x1a03c8[_0x51e9ab(0x18e)]=_0x29789d,_0x29789d;return delete _0x1a03c8[_0x51e9ab(0x18e)],undefined;}export function buildCanonicalProjectConfig(_0x5d33a8,_0x16004c){const _0x354e8e=a272_0x52ac85,{appCodes:appCodes=[],env:_0x2ca329,metadata:_0x29ed62}=_0x16004c,_0x4be512={..._0x5d33a8,..._0x29ed62||{}};delete _0x4be512[_0x354e8e(0x1a7)],delete _0x4be512['app'];const _0xa271a7=_0x2ca329||(typeof _0x4be512['env']===_0x354e8e(0x1b1)?_0x4be512[_0x354e8e(0x1a9)]:'')||DEFAULT_CONFIG_VALUES[_0x354e8e(0x1a9)];if(isProduction(_0xa271a7))delete _0x4be512[_0x354e8e(0x1a9)];else _0x4be512[_0x354e8e(0x1a9)]=_0xa271a7;const _0x2f6463=buildCanonicalAppConfig(appCodes,_0xa271a7);if(Object[_0x354e8e(0x1ac)](_0x2f6463)[_0x354e8e(0x190)]>0x0){_0x4be512['apps']=_0x2f6463['apps'];if(_0x2f6463[_0x354e8e(0x18e)])_0x4be512[_0x354e8e(0x18e)]=_0x2f6463[_0x354e8e(0x18e)];else delete _0x4be512['defaultApp'];}return normalizeConfigForWrite(_0x4be512);}function isRecord(_0x491257){const _0x6d23ff=a272_0x52ac85;return!!_0x491257&&typeof _0x491257===_0x6d23ff(0x186)&&!Array['isArray'](_0x491257);}export function normalizeConfigForWrite(_0x2a59b5){const _0x3fb67b=a272_0x52ac85,_0x3b69d5={..._0x2a59b5},_0x1fca31=isRecord(_0x2a59b5[_0x3fb67b(0x196)])?_0x2a59b5[_0x3fb67b(0x196)]:undefined,_0x4db719=_0x1fca31?Object['fromEntries'](Object[_0x3fb67b(0x198)](_0x1fca31)['map'](([_0x56ccec,_0x4afad2])=>[_0x56ccec,isRecord(_0x4afad2)?{..._0x4afad2}:_0x4afad2])):undefined;if(_0x4db719){const _0xb8d5e7=typeof _0x3b69d5['env']===_0x3fb67b(0x1b1)?_0x3b69d5['env']:undefined,_0x3b8e23=Object[_0x3fb67b(0x1aa)](_0x4db719)[_0x3fb67b(0x17b)](_0x4dff2c=>isRecord(_0x4dff2c)&&typeof _0x4dff2c[_0x3fb67b(0x1a9)]===_0x3fb67b(0x1b1)&&isProduction(_0x4dff2c[_0x3fb67b(0x1a9)]));if(_0xb8d5e7&&isDaily(_0xb8d5e7)&&_0x3b8e23){for(const _0x41e16f of Object[_0x3fb67b(0x1aa)](_0x4db719)){if(!isRecord(_0x41e16f))continue;if(_0x41e16f[_0x3fb67b(0x1a9)]===undefined)_0x41e16f['env']=_0xb8d5e7;}delete _0x3b69d5[_0x3fb67b(0x1a9)];}for(const _0x281c98 of Object[_0x3fb67b(0x1aa)](_0x4db719)){isRecord(_0x281c98)&&typeof _0x281c98['env']===_0x3fb67b(0x1b1)&&isProduction(_0x281c98[_0x3fb67b(0x1a9)])&&delete _0x281c98[_0x3fb67b(0x1a9)];}_0x3b69d5['apps']=_0x4db719;}return typeof _0x3b69d5[_0x3fb67b(0x1a9)]===_0x3fb67b(0x1b1)&&isProduction(_0x3b69d5[_0x3fb67b(0x1a9)])&&delete _0x3b69d5[_0x3fb67b(0x1a9)],_0x3b69d5;}const LOCALE_MAP={'zh':'zh-CN','zh-cn':a272_0x52ac85(0x1a0),'zh_cn':a272_0x52ac85(0x1a0),'en':'en-US','en-us':'en-US','en_us':a272_0x52ac85(0x17e)};export function normalizeLocale(_0xe40e06){const _0x120640=a272_0x52ac85;if(!_0xe40e06)return null;return LOCALE_MAP[_0xe40e06[_0x120640(0x19f)]()]??null;}
|
|
1
|
+
import{DEFAULT_CONFIG_VALUES}from"../constant/defaults.js";import{isDaily,isProduction,RABETBASE_ENV_VALUES}from"../constant/env.js";import{RABETBASE_OUTPUT_FORMAT_VALUES}from"../constant/output.js";import{RISK_LEVEL_VALUES}from"../constant/risk.js";import{ENABLED_LOVRABET_REGION_VALUES}from"../constant/region.js";export{DEFAULT_CONFIG_VALUES}from"../constant/defaults.js";export const PROJECT_CREATE_INHERITABLE_KEYS=["cookie","accessKey","locale","format","riskLevel","region","routing","userDomain","apiDomain","runtimeDomain","skillDomain","kbDomain","kbServiceDomain","appDomain","localDomain","certificateDomain"];export const TOP_LEVEL_CONFIG_KEYS=new Set(["appcode","env","locale","format","cookie","accessKey","apiDir","region","userDomain","apiDomain","runtimeDomain","skillDomain","kbDomain","kbServiceDomain","appDomain","localDomain","certificateDomain"]);export const CONFIG_ENUM_VALUES={env:[...RABETBASE_ENV_VALUES],format:[...RABETBASE_OUTPUT_FORMAT_VALUES],
|
|
2
|
+
region:[...ENABLED_LOVRABET_REGION_VALUES]};export function formatConfigKeyList(keys){return[...keys].join(", ")}export function getTopLevelConfigKeyList(){return[...TOP_LEVEL_CONFIG_KEYS]}export function isTopLevelConfigKey(key){return TOP_LEVEL_CONFIG_KEYS.has(key)}export function getTopLevelConfigKeySummary(){return formatConfigKeyList(getTopLevelConfigKeyList())}export function getConfigCommandKeyDescription(){return`Config key (${getTopLevelConfigKeySummary()})`}export const APP_PROFILE_FLAG_KEY_MAP={apiGroup:"apiGroup",region:"region",env:"env",apiDir:"apiDir",cookie:"cookie",accessKey:"accessKey",defaultFormat:"format",pageSize:"pageSize",riskLevel:"riskLevel",locale:"locale"};export function getAppProfileFlagDefs(){return[{name:"apiGroup",type:"string",description:"Join key for app profiles that share one generated API model registry"},{name:"region",type:"string",description:"Country/region for this app profile",enum:[...ENABLED_LOVRABET_REGION_VALUES]},{name:"env",
|
|
3
|
+
type:"string",description:"Target environment",enum:[...RABETBASE_ENV_VALUES]},{name:"apiDir",type:"string",description:"API directory path"},{name:"cookie",type:"string",description:"Auth cookie",hidden:true},{name:"accessKey",type:"string",description:"Access key",hidden:true},{name:"defaultFormat",type:"string",description:"Default output format for this app (profile)",enum:[...RABETBASE_OUTPUT_FORMAT_VALUES]},{name:"pageSize",type:"number",description:"Default page size"},{name:"riskLevel",type:"string",description:"Risk level",enum:[...RISK_LEVEL_VALUES]},{name:"locale",type:"string",description:"App locale (not CLI language; reserved for later app use)"}]}export function collectAppProfileOverrides(getFlagValue){const profile={};for(const[flagKey,profileKey]of Object.entries(APP_PROFILE_FLAG_KEY_MAP)){const val=getFlagValue(flagKey);if(!val)continue;profile[profileKey]=profileKey==="pageSize"?Number(val):val}return profile}export function buildAppProfileListFields(profile){return{
|
|
4
|
+
apiGroup:profile.apiGroup??null,region:profile.region??null,env:profile.env??null,apiDir:profile.apiDir??null,hasCookie:!!profile.cookie,hasAccessKey:!!profile.accessKey,format:profile.format??null,pageSize:profile.pageSize??null,riskLevel:profile.riskLevel??null,locale:profile.locale??null}}export function buildAppDoctorFields(profile,effective){return{region:{value:profile.region||effective.region,source:profile.region?"app":"inherit"},env:{value:profile.env||effective.env,source:profile.env?"app":"inherit"},apiDir:{value:profile.apiDir||effective.apiDir,source:profile.apiDir?"app":"inherit"},cookie:{value:profile.cookie||effective.cookie,source:profile.cookie?"app":"inherit"},accessKey:{value:profile.accessKey||effective.accessKey,source:profile.accessKey?"app":"inherit"}}}export function buildCanonicalAppConfig(appCodes,env){const normalized=appCodes.map(code=>String(code||"").trim()).filter(Boolean);if(normalized.length===0)return{};const apps={};for(const appCode of normalized){
|
|
5
|
+
apps[appCode]=env&&!isProduction(env)?{appcode:appCode,env:env}:{appcode:appCode}}return normalized.length>1?{apps:apps,defaultApp:normalized[0]}:{apps:apps}}export function normalizeStoredDefaultApp(config,preferredApp){const apps=config.apps&&typeof config.apps==="object"?config.apps:{};const names=Object.keys(apps);if(names.length<=1){delete config.defaultApp;return undefined}const current=typeof config.defaultApp==="string"&&apps[config.defaultApp]?config.defaultApp:undefined;const selected=preferredApp&&apps[preferredApp]?preferredApp:current;if(selected){config.defaultApp=selected;return selected}delete config.defaultApp;return undefined}export function buildCanonicalProjectConfig(base,options){const{appCodes:appCodes=[],env:env,metadata:metadata}=options;const config={...base,...metadata||{}};delete config.appcode;delete config.app;const effectiveEnv=env||(typeof config.env==="string"?config.env:"")||DEFAULT_CONFIG_VALUES.env
|
|
6
|
+
;if(isProduction(effectiveEnv))delete config.env;else config.env=effectiveEnv;const appConfig=buildCanonicalAppConfig(appCodes,effectiveEnv);if(Object.keys(appConfig).length>0){config.apps=appConfig.apps;if(appConfig.defaultApp)config.defaultApp=appConfig.defaultApp;else delete config.defaultApp}return normalizeConfigForWrite(config)}function isRecord(value){return!!value&&typeof value==="object"&&!Array.isArray(value)}export function normalizeConfigForWrite(input){const config={...input};const inputApps=isRecord(input.apps)?input.apps:undefined;const apps=inputApps?Object.fromEntries(Object.entries(inputApps).map(([name,profile])=>[name,isRecord(profile)?{...profile}:profile])):undefined;if(apps){const topLevelEnv=typeof config.env==="string"?config.env:undefined;const hasDefaultOverride=Object.values(apps).some(profile=>isRecord(profile)&&typeof profile.env==="string"&&isProduction(profile.env));if(topLevelEnv&&isDaily(topLevelEnv)&&hasDefaultOverride){
|
|
7
|
+
for(const profile of Object.values(apps)){if(!isRecord(profile))continue;if(profile.env===undefined)profile.env=topLevelEnv}delete config.env}for(const profile of Object.values(apps)){if(isRecord(profile)&&typeof profile.env==="string"&&isProduction(profile.env)){delete profile.env}}config.apps=apps}if(typeof config.env==="string"&&isProduction(config.env)){delete config.env}return config}const LOCALE_MAP={zh:"zh-CN","zh-cn":"zh-CN",zh_cn:"zh-CN",en:"en-US","en-us":"en-US",en_us:"en-US"};export function normalizeLocale(value){if(!value)return null;return LOCALE_MAP[value.toLowerCase()]??null}
|
package/lib/constant/cdn.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{getActiveCdn}from"../constant/domain.js";const RABETBASE_CDN_PROJECT="rabetbase-cli";const RABETBASE_CDN_CONFIG_ORIGIN="https://g.lovrabet.com";const CDN_CONFIG_PATH="config/index.json";const PROJECT_TEMPLATE_ASSET_PATH="templates/projects";const PROJECT_TEMPLATE_ARCHIVE_NAMES=Object.freeze({release:"sub-app-react-demo.zip",beta:"sub-app-react-demo-beta.zip"});export const RABETBASE_CDN_PROJECT_PATH=`/dist/${RABETBASE_CDN_PROJECT}`;function getRabetbaseCdnBaseUrl(){return`${getActiveCdn().lovrabet}${RABETBASE_CDN_PROJECT_PATH}`}export function getCliVersionPolicyUrl(){return`${RABETBASE_CDN_CONFIG_ORIGIN}${RABETBASE_CDN_PROJECT_PATH}/${CDN_CONFIG_PATH}`}export function getProjectTemplateAssetBaseUrl(){return`${getRabetbaseCdnBaseUrl()}/${PROJECT_TEMPLATE_ASSET_PATH}`}export function getProjectTemplateLegacyAssetBaseUrl(){return`${RABETBASE_CDN_CONFIG_ORIGIN}${RABETBASE_CDN_PROJECT_PATH}/${PROJECT_TEMPLATE_ASSET_PATH}`}
|
|
2
|
+
export function getProjectTemplateRelativeUrl(channel,version){const archiveName=version?`sub-app-react-demo-${version}.zip`:PROJECT_TEMPLATE_ARCHIVE_NAMES[channel];return`${RABETBASE_CDN_PROJECT_PATH}/${PROJECT_TEMPLATE_ASSET_PATH}/${archiveName}`}
|
package/lib/constant/cli.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
function a274_0x13e4(){const _0x4c8e76=['fromEntries','tags','Comma-separated\x20menu\x20IDs','reveal','name','dataset-code','Verbose\x20output','locale','Target\x20path','Description','non-interactive','Output\x20format','verbose','Flow\x20code','remote','value','Dataset\x20code','format','51062jFPEPY','task-id','Config\x20value','file','Preview\x20operation\x20without\x20executing','sort','Confirm\x20destructive\x20action','Schemas','expectedChildrenCount','flowType','stdin','dry-run','dryRun','sql','rabetbase','SQL\x20string','boolean','Maximum\x20search\x20hits','9AkZRLS','expectPath','clear','2266880BecwmR','5573560wdatmG','expect-path','pagesize','skipImports','all','Force\x20non-interactive\x20mode\x20(CI)','Name','Description\x20file','Select\x20app\x20profile\x20by\x20name','2953348DZxYCP','Menu\x20sort\x20value','sqlcode','Expected\x20affected\x20count','Function\x20node','Read\x20value\x20from\x20stdin','Watch\x20mode','map','label','<name>','query','Expected\x20current\x20menu\x20path','flowStatus','Page\x20size','parentId','topk','appcode','Flow\x20type','Skip\x20confirmation\x20for\x20high-risk\x20writes','codes','operation','watch','Config\x20key','Enable\x20Backend\x20Function\x20save','force','flow-name','code','operation-type','help','Code\x20filter','Operation\x20type','function-node','Flow\x20status','target','meowKey','Environment','menu-ids','expected-count','Filter\x20JSON\x20output\x20(JQ_PATH\x20>\x20bundled\x20jq\x20>\x20PATH;\x20use\x20with\x20--format\x20json\x20or\x20compress)','Read\x20value\x20from\x20environment\x20variable','db-id','Apply\x20to\x20all','string','production\x20|\x20daily','Parent\x20menu\x20id','<code>','flowCode','Reveal\x20sensitive\x20value','Record\x20ID','datasetCode','global','DB\x20ID','Output\x20path','Keyword\x20filter','SQL\x20name','Search\x20query','output','datasetcode','zh-CN\x20|\x20en-US','flow-code','from-env','operationType','6247746kKqied','3277136rsSVIw','Use\x20remote','flow-status','functionNode','Type\x20filter','params','app','confirm','Menu\x20label','env','Page\x20number','App\x20locale\x20(workspace\x20pass-through;\x20not\x20CLI\x20language)','description-file','schemas','yes','enableBffSave','Alias\x20for\x20--non-interactive','title','@lovrabet/rabetbase-cli','Flow\x20name','keyword','Override\x20appcode','File\x20path','project','881910ACmrvr','expect-parent-id','expected-children-count','dbId','pageSize','Rabetbase\x20CLI','page','<expr>','type','description','Use\x20global\x20config\x20scope','skip-imports'];a274_0x13e4=function(){return _0x4c8e76;};return a274_0x13e4();}const a274_0x2e8707=a274_0x20cc;(function(_0x51a436,_0x28b7c4){const _0x308f88=a274_0x20cc,_0x422ea1=_0x51a436();while(!![]){try{const _0x14a1a9=-parseInt(_0x308f88(0x1c9))/0x1+-parseInt(_0x308f88(0x1e7))/0x2*(-parseInt(_0x308f88(0x165))/0x3)+parseInt(_0x308f88(0x172))/0x4+-parseInt(_0x308f88(0x169))/0x5+parseInt(_0x308f88(0x1b0))/0x6+parseInt(_0x308f88(0x168))/0x7+parseInt(_0x308f88(0x1b1))/0x8;if(_0x14a1a9===_0x28b7c4)break;else _0x422ea1['push'](_0x422ea1['shift']());}catch(_0x2caf00){_0x422ea1['push'](_0x422ea1['shift']());}}}(a274_0x13e4,0x90cb9));export const CLI_BIN_NAME=a274_0x2e8707(0x161);export const CLI_DISPLAY_NAME=a274_0x2e8707(0x1ce);export const NPM_PACKAGE_NAME=a274_0x2e8707(0x1c3);export const GLOBAL_FLAGS=[{'name':a274_0x2e8707(0x182),'meowKey':a274_0x2e8707(0x182),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1c6),'hint':a274_0x2e8707(0x19f)},{'name':a274_0x2e8707(0x1b7),'meowKey':a274_0x2e8707(0x1b7),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x171),'hint':a274_0x2e8707(0x17b)},{'name':a274_0x2e8707(0x1ba),'meowKey':'env','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x195),'hint':a274_0x2e8707(0x19d)},{'name':a274_0x2e8707(0x1e6),'meowKey':a274_0x2e8707(0x1e6),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1e0),'hint':'json\x20|\x20pretty\x20|\x20compress'},{'name':'jq','meowKey':'jq','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x198),'hint':a274_0x2e8707(0x1d0)},{'name':a274_0x2e8707(0x15e),'meowKey':a274_0x2e8707(0x15f),'type':'boolean','description':a274_0x2e8707(0x1eb)},{'name':a274_0x2e8707(0x1bf),'meowKey':a274_0x2e8707(0x1bf),'type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x184)},{'name':a274_0x2e8707(0x1df),'meowKey':'nonInteractive','type':'boolean','description':a274_0x2e8707(0x16e)},{'name':'global','meowKey':a274_0x2e8707(0x1a4),'type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x1d3)},{'name':a274_0x2e8707(0x1c8),'meowKey':a274_0x2e8707(0x1c8),'type':a274_0x2e8707(0x163),'description':'Use\x20project\x20config\x20scope'},{'name':'ci','meowKey':'ci','type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x1c1),'hidden':!![]},{'name':a274_0x2e8707(0x18e),'meowKey':a274_0x2e8707(0x18e),'type':'boolean','description':'Show\x20help'},{'name':'locale','meowKey':a274_0x2e8707(0x1dc),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1bc),'hidden':!![],'hint':a274_0x2e8707(0x1ac)},{'name':'name','meowKey':a274_0x2e8707(0x1d9),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x16f),'hidden':!![]},{'name':a274_0x2e8707(0x1c2),'meowKey':a274_0x2e8707(0x1c2),'type':a274_0x2e8707(0x19c),'description':'Title','hidden':!![]},{'name':'query','meowKey':a274_0x2e8707(0x17c),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1a9),'hidden':!![]},{'name':'topk','meowKey':a274_0x2e8707(0x181),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x164),'hidden':!![]},{'name':a274_0x2e8707(0x167),'meowKey':a274_0x2e8707(0x167),'type':a274_0x2e8707(0x163),'description':'Clear','hidden':!![]},{'name':a274_0x2e8707(0x187),'meowKey':'watch','type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x178),'hidden':!![]},{'name':a274_0x2e8707(0x1aa),'meowKey':'output','type':'string','description':a274_0x2e8707(0x1a6),'hidden':!![]},{'name':a274_0x2e8707(0x1b6),'meowKey':a274_0x2e8707(0x1b6),'type':a274_0x2e8707(0x19c),'description':'JSON\x20params','hidden':!![]},{'name':a274_0x2e8707(0x1ab),'meowKey':a274_0x2e8707(0x1ab),'type':a274_0x2e8707(0x19c),'description':'Dataset\x20code','hidden':!![]},{'name':a274_0x2e8707(0x16d),'meowKey':a274_0x2e8707(0x16d),'type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x19b),'hidden':!![]},{'name':'enable-bff-save','meowKey':a274_0x2e8707(0x1c0),'type':'boolean','description':a274_0x2e8707(0x189),'hidden':!![]},{'name':'id','meowKey':'id','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1a2),'hidden':!![]},{'name':'type','meowKey':'type','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1b5),'hidden':!![]},{'name':a274_0x2e8707(0x1ea),'meowKey':a274_0x2e8707(0x1ea),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1c7),'hidden':!![]},{'name':a274_0x2e8707(0x1ad),'meowKey':a274_0x2e8707(0x1a0),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1e2),'hidden':!![]},{'name':a274_0x2e8707(0x18b),'meowKey':'flowName','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1c4),'hidden':!![]},{'name':a274_0x2e8707(0x1b3),'meowKey':a274_0x2e8707(0x17e),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x192),'hidden':!![]},{'name':'flow-type','meowKey':a274_0x2e8707(0x15c),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x183),'hidden':!![]},{'name':a274_0x2e8707(0x1da),'meowKey':a274_0x2e8707(0x1a3),'type':'string','description':a274_0x2e8707(0x1e5),'hidden':!![]},{'name':a274_0x2e8707(0x174),'meowKey':a274_0x2e8707(0x174),'type':a274_0x2e8707(0x19c),'description':'SQL\x20code','hidden':!![]},{'name':'sql-name','meowKey':'sqlName','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1a8),'hidden':!![]},{'name':'sqlname','meowKey':'sqlname','type':'string','description':a274_0x2e8707(0x1a8),'hidden':!![]},{'name':a274_0x2e8707(0x19a),'meowKey':a274_0x2e8707(0x1cc),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1a5),'hidden':!![]},{'name':'dbid','meowKey':'dbid','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1a5),'hidden':!![]},{'name':a274_0x2e8707(0x1d2),'meowKey':a274_0x2e8707(0x1d2),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1de),'hidden':!![]},{'name':a274_0x2e8707(0x1bd),'meowKey':'descriptionFile','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x170),'hidden':!![]},{'name':a274_0x2e8707(0x1cf),'meowKey':a274_0x2e8707(0x1cf),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1bb),'hidden':!![]},{'name':'page-size','meowKey':a274_0x2e8707(0x1cd),'type':a274_0x2e8707(0x19c),'description':'Page\x20size','hidden':!![]},{'name':a274_0x2e8707(0x16b),'meowKey':a274_0x2e8707(0x16b),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x17f),'hidden':!![]},{'name':a274_0x2e8707(0x1c5),'meowKey':a274_0x2e8707(0x1c5),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1a7),'hidden':!![]},{'name':a274_0x2e8707(0x18c),'meowKey':'code','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x18f),'hidden':!![]},{'name':a274_0x2e8707(0x160),'meowKey':a274_0x2e8707(0x160),'type':'string','description':a274_0x2e8707(0x162),'hidden':!![]},{'name':a274_0x2e8707(0x1be),'meowKey':a274_0x2e8707(0x1be),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1ee),'hidden':!![]},{'name':a274_0x2e8707(0x186),'meowKey':'operation','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x190),'hidden':!![]},{'name':a274_0x2e8707(0x193),'meowKey':a274_0x2e8707(0x193),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1dd),'hidden':!![]},{'name':a274_0x2e8707(0x1d4),'meowKey':a274_0x2e8707(0x16c),'type':a274_0x2e8707(0x163),'description':'Skip\x20import\x20generation','hidden':!![]},{'name':'key','meowKey':'key','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x188),'hidden':!![]},{'name':'value','meowKey':a274_0x2e8707(0x1e4),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1e9),'hidden':!![]},{'name':a274_0x2e8707(0x1d6),'meowKey':a274_0x2e8707(0x1d6),'type':a274_0x2e8707(0x19c),'description':'Tags','hidden':!![]},{'name':a274_0x2e8707(0x15d),'meowKey':a274_0x2e8707(0x15d),'type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x177),'hidden':!![]},{'name':a274_0x2e8707(0x1ae),'meowKey':'fromEnv','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x199),'hidden':!![]},{'name':a274_0x2e8707(0x1d8),'meowKey':'reveal','type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x1a1),'hidden':!![]},{'name':'force','meowKey':a274_0x2e8707(0x18a),'type':a274_0x2e8707(0x163),'description':'Force\x20overwrite','hidden':!![]},{'name':a274_0x2e8707(0x1b8),'meowKey':a274_0x2e8707(0x1b8),'type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x1ed),'hidden':!![]},{'name':'remote','meowKey':a274_0x2e8707(0x1e3),'type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x1b2),'hidden':!![]},{'name':a274_0x2e8707(0x1e1),'meowKey':a274_0x2e8707(0x1e1),'type':a274_0x2e8707(0x163),'description':a274_0x2e8707(0x1db),'hidden':!![]},{'name':a274_0x2e8707(0x197),'meowKey':'expectedCount','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x175),'hidden':!![]},{'name':a274_0x2e8707(0x17a),'meowKey':a274_0x2e8707(0x17a),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1b9),'hidden':!![]},{'name':'parent-id','meowKey':a274_0x2e8707(0x180),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x19e),'hidden':!![]},{'name':a274_0x2e8707(0x1ec),'meowKey':'sort','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x173),'hidden':!![]},{'name':a274_0x2e8707(0x1ca),'meowKey':'expectParentId','type':'string','description':'Expected\x20current\x20parent\x20menu\x20id','hidden':!![]},{'name':a274_0x2e8707(0x16a),'meowKey':a274_0x2e8707(0x166),'type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x17d),'hidden':!![]},{'name':a274_0x2e8707(0x1cb),'meowKey':a274_0x2e8707(0x15b),'type':'string','description':'Expected\x20current\x20child\x20count','hidden':!![]},{'name':a274_0x2e8707(0x196),'meowKey':'menuIds','type':a274_0x2e8707(0x19c),'description':a274_0x2e8707(0x1d7),'hidden':!![]},{'name':a274_0x2e8707(0x1e8),'meowKey':'taskId','type':a274_0x2e8707(0x19c),'description':'Asynchronous\x20task\x20ID','hidden':!![]},{'name':a274_0x2e8707(0x18d),'meowKey':a274_0x2e8707(0x1af),'type':a274_0x2e8707(0x19c),'description':'Operation\x20type','hidden':!![]},{'name':a274_0x2e8707(0x191),'meowKey':a274_0x2e8707(0x1b4),'type':'string','description':a274_0x2e8707(0x176),'hidden':!![]},{'name':'codes','meowKey':a274_0x2e8707(0x185),'type':a274_0x2e8707(0x19c),'description':'Comma-separated\x20metadata\x20codes','hidden':!![]}];function a274_0x20cc(_0x4a71fc,_0x466a08){_0x4a71fc=_0x4a71fc-0x15b;const _0x13e4eb=a274_0x13e4();let _0x20cc57=_0x13e4eb[_0x4a71fc];return _0x20cc57;}export const PIPELINE_FLAG_NAMES=new Set([a274_0x2e8707(0x182),'app','env',a274_0x2e8707(0x1e6),'jq',a274_0x2e8707(0x15e),a274_0x2e8707(0x1bf),a274_0x2e8707(0x1df),'ci']);export function buildMeowFlags(){const _0x3698b5=a274_0x2e8707;return Object[_0x3698b5(0x1d5)](GLOBAL_FLAGS[_0x3698b5(0x179)](_0x439884=>[_0x439884[_0x3698b5(0x194)],{'type':_0x439884[_0x3698b5(0x1d1)]}]));}
|
|
1
|
+
export const CLI_BIN_NAME="rabetbase";export const CLI_DISPLAY_NAME="Rabetbase CLI";export const NPM_PACKAGE_NAME="@lovrabet/rabetbase-cli";export const GLOBAL_FLAGS=[{name:"appcode",meowKey:"appcode",type:"string",description:"Override appcode",hint:"<code>"},{name:"app",meowKey:"app",type:"string",description:"Select app profile by name",hint:"<name>"},{name:"env",meowKey:"env",type:"string",description:"Environment",hint:"production | daily"},{name:"format",meowKey:"format",type:"string",description:"Output format",hint:"json | pretty | compress"},{name:"jq",meowKey:"jq",type:"string",description:"Filter JSON output (JQ_PATH > bundled jq > PATH; use with --format json or compress)",hint:"<expr>"},{name:"dry-run",meowKey:"dryRun",type:"boolean",description:"Preview operation without executing"},{name:"yes",meowKey:"yes",type:"boolean",description:"Skip confirmation for high-risk writes"},{name:"non-interactive",meowKey:"nonInteractive",type:"boolean",
|
|
2
|
+
description:"Force non-interactive mode (CI)"},{name:"global",meowKey:"global",type:"boolean",description:"Use global config scope"},{name:"project",meowKey:"project",type:"boolean",description:"Use project config scope"},{name:"ci",meowKey:"ci",type:"boolean",description:"Alias for --non-interactive",hidden:true},{name:"help",meowKey:"help",type:"boolean",description:"Show help"},{name:"locale",meowKey:"locale",type:"string",description:"App locale (workspace pass-through; not CLI language)",hidden:true,hint:"zh-CN | en-US"},{name:"name",meowKey:"name",type:"string",description:"Name",hidden:true},{name:"title",meowKey:"title",type:"string",description:"Title",hidden:true},{name:"query",meowKey:"query",type:"string",description:"Search query",hidden:true},{name:"topk",meowKey:"topk",type:"string",description:"Maximum search hits",hidden:true},{name:"clear",meowKey:"clear",type:"boolean",description:"Clear",hidden:true},{name:"watch",meowKey:"watch",type:"boolean",
|
|
3
|
+
description:"Watch mode",hidden:true},{name:"output",meowKey:"output",type:"string",description:"Output path",hidden:true},{name:"params",meowKey:"params",type:"string",description:"JSON params",hidden:true},{name:"datasetcode",meowKey:"datasetcode",type:"string",description:"Dataset code",hidden:true},{name:"all",meowKey:"all",type:"boolean",description:"Apply to all",hidden:true},{name:"enable-bff-save",meowKey:"enableBffSave",type:"boolean",description:"Enable Backend Function save",hidden:true},{name:"id",meowKey:"id",type:"string",description:"Record ID",hidden:true},{name:"type",meowKey:"type",type:"string",description:"Type filter",hidden:true},{name:"file",meowKey:"file",type:"string",description:"File path",hidden:true},{name:"flow-code",meowKey:"flowCode",type:"string",description:"Flow code",hidden:true},{name:"flow-name",meowKey:"flowName",type:"string",description:"Flow name",hidden:true},{name:"flow-status",meowKey:"flowStatus",type:"string",description:"Flow status",
|
|
4
|
+
hidden:true},{name:"flow-type",meowKey:"flowType",type:"string",description:"Flow type",hidden:true},{name:"dataset-code",meowKey:"datasetCode",type:"string",description:"Dataset code",hidden:true},{name:"sqlcode",meowKey:"sqlcode",type:"string",description:"SQL code",hidden:true},{name:"sql-name",meowKey:"sqlName",type:"string",description:"SQL name",hidden:true},{name:"sqlname",meowKey:"sqlname",type:"string",description:"SQL name",hidden:true},{name:"db-id",meowKey:"dbId",type:"string",description:"DB ID",hidden:true},{name:"dbid",meowKey:"dbid",type:"string",description:"DB ID",hidden:true},{name:"description",meowKey:"description",type:"string",description:"Description",hidden:true},{name:"description-file",meowKey:"descriptionFile",type:"string",description:"Description file",hidden:true},{name:"page",meowKey:"page",type:"string",description:"Page number",hidden:true},{name:"page-size",meowKey:"pageSize",type:"string",description:"Page size",hidden:true},{name:"pagesize",
|
|
5
|
+
meowKey:"pagesize",type:"string",description:"Page size",hidden:true},{name:"keyword",meowKey:"keyword",type:"string",description:"Keyword filter",hidden:true},{name:"code",meowKey:"code",type:"string",description:"Code filter",hidden:true},{name:"sql",meowKey:"sql",type:"string",description:"SQL string",hidden:true},{name:"schemas",meowKey:"schemas",type:"string",description:"Schemas",hidden:true},{name:"operation",meowKey:"operation",type:"string",description:"Operation type",hidden:true},{name:"target",meowKey:"target",type:"string",description:"Target path",hidden:true},{name:"skip-imports",meowKey:"skipImports",type:"boolean",description:"Skip import generation",hidden:true},{name:"key",meowKey:"key",type:"string",description:"Config key",hidden:true},{name:"value",meowKey:"value",type:"string",description:"Config value",hidden:true},{name:"tags",meowKey:"tags",type:"string",description:"Tags",hidden:true},{name:"stdin",meowKey:"stdin",type:"boolean",
|
|
6
|
+
description:"Read value from stdin",hidden:true},{name:"from-env",meowKey:"fromEnv",type:"string",description:"Read value from environment variable",hidden:true},{name:"reveal",meowKey:"reveal",type:"boolean",description:"Reveal sensitive value",hidden:true},{name:"force",meowKey:"force",type:"boolean",description:"Force overwrite",hidden:true},{name:"confirm",meowKey:"confirm",type:"boolean",description:"Confirm destructive action",hidden:true},{name:"remote",meowKey:"remote",type:"boolean",description:"Use remote",hidden:true},{name:"verbose",meowKey:"verbose",type:"boolean",description:"Verbose output",hidden:true},{name:"expected-count",meowKey:"expectedCount",type:"string",description:"Expected affected count",hidden:true},{name:"label",meowKey:"label",type:"string",description:"Menu label",hidden:true},{name:"parent-id",meowKey:"parentId",type:"string",description:"Parent menu id",hidden:true},{name:"sort",meowKey:"sort",type:"string",description:"Menu sort value",hidden:true},{
|
|
7
|
+
name:"expect-parent-id",meowKey:"expectParentId",type:"string",description:"Expected current parent menu id",hidden:true},{name:"expect-path",meowKey:"expectPath",type:"string",description:"Expected current menu path",hidden:true},{name:"expected-children-count",meowKey:"expectedChildrenCount",type:"string",description:"Expected current child count",hidden:true},{name:"menu-ids",meowKey:"menuIds",type:"string",description:"Comma-separated menu IDs",hidden:true},{name:"task-id",meowKey:"taskId",type:"string",description:"Asynchronous task ID",hidden:true},{name:"operation-type",meowKey:"operationType",type:"string",description:"Operation type",hidden:true},{name:"function-node",meowKey:"functionNode",type:"string",description:"Function node",hidden:true},{name:"codes",meowKey:"codes",type:"string",description:"Comma-separated metadata codes",hidden:true}];export const PIPELINE_FLAG_NAMES=new Set(["appcode","app","env","format","jq","dry-run","yes","non-interactive","ci"])
|
|
8
|
+
;export function buildMeowFlags(){return Object.fromEntries(GLOBAL_FLAGS.map(f=>[f.meowKey,{type:f.type}]))}
|
package/lib/constant/defaults.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{DEFAULT_API_DIR}from"../constant/paths.js";export const DEFAULT_CONFIG_VALUES={env:"production",format:"compress",locale:"en-US",riskLevel:"write",apiDir:DEFAULT_API_DIR};export const DEFAULT_COMMAND_OUTPUT_FORMAT="compress";
|
package/lib/constant/domain.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{getEnv,isProduction}from"../constant/env.js";import{DEFAULT_LOVRABET_REGION}from"../constant/region.js";import{getOfficialRoutingCdn,getOfficialRoutingProfile}from"../constant/routing-profile.js";let customApiDomain;let customUserDomain;let customRuntimeDomain;let customSkillDomain;let customKbDomain;let customKbServiceDomain;let allowOfficialKbServiceDefault=true;let customAppDomain;let customLocalDomain;let customCertificateDomain;let customCdn;let activeRegion=DEFAULT_LOVRABET_REGION;function getActiveRegionDomains(){const profile=getOfficialRoutingProfile(activeRegion);return isProduction(getEnv())?profile.serviceDomains.production:profile.serviceDomains.daily??profile.serviceDomains.production}export function initDomains(domains){customApiDomain=domains?.apiDomain;customUserDomain=domains?.userDomain;customRuntimeDomain=domains?.runtimeDomain;customSkillDomain=domains?.skillDomain;customKbDomain=domains?.kbDomain;customKbServiceDomain=domains?.kbServiceDomain
|
|
2
|
+
;allowOfficialKbServiceDefault=domains?.allowOfficialKbServiceDefault??true;customAppDomain=domains?.appDomain;customLocalDomain=domains?.localDomain;customCertificateDomain=domains?.certificateDomain;customCdn=domains?.cdn;activeRegion=domains?.region??DEFAULT_LOVRABET_REGION}export const getUserDomain=()=>customUserDomain||getActiveRegionDomains().user;export const getApiDomain=()=>customApiDomain||getActiveRegionDomains().api;export const getRuntimeDomain=()=>customRuntimeDomain||getActiveRegionDomains().runtime;export const getSkillDomain=()=>customSkillDomain||getActiveRegionDomains().skill;export const getKbDomain=()=>customKbDomain||customApiDomain||getActiveRegionDomains().kb;export const getKbServiceDomain=()=>{if(customKbServiceDomain)return customKbServiceDomain;if(!allowOfficialKbServiceDefault)return undefined;return getActiveRegionDomains().kbService};export const getAppDomain=()=>customAppDomain||getActiveRegionDomains().app;export const getActiveRegion=()=>activeRegion
|
|
3
|
+
;export const getLocalDomain=()=>customLocalDomain;export const getCertificateDomain=()=>customCertificateDomain;export const getActiveCdn=()=>customCdn||getOfficialRoutingCdn(activeRegion);export function isIndependentDeployment(){return!!(customApiDomain||customUserDomain||customRuntimeDomain||customSkillDomain||customKbDomain||customAppDomain||customLocalDomain||customCertificateDomain)}export function getSdkClientRoutingConfig(){if(customRuntimeDomain&&customRuntimeDomain!==getActiveRegionDomains().runtime){return{runtimeDomain:customRuntimeDomain}}if(activeRegion!==DEFAULT_LOVRABET_REGION){return{runtimeDomain:getRuntimeDomain()}}return{}}export const getAppBaseUrl=appCode=>{const encodedAppCode=encodeURIComponent(appCode.trim());return isProduction(getEnv())?`${getAppDomain()}/app/${encodedAppCode}`:`${getAppDomain()}/web-app/app/${encodedAppCode}`};export const getPublishedAppDomain=appCode=>{const appUrl=new URL(getAppDomain())
|
|
4
|
+
;appUrl.hostname=`${appCode.trim()}.${appUrl.hostname}`;return appUrl.origin};
|
package/lib/constant/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export const RABETBASE_ENV_VALUES=["production","daily"];export function normalizeEnv(e){return e==="online"?"production":e}export function isProduction(e){return normalizeEnv(e)==="production"}export function isDaily(e){return normalizeEnv(e)==="daily"}export function isDev(e){const c=normalizeEnv(e);return c==="development"||c==="dev"}let env=normalizeEnv(process.env.RABETBASE_ENV||process.env.LOVRABET_ENV||"production");export function getEnv(){return env}export function initEnv(_env){env=normalizeEnv(_env)}
|
package/lib/constant/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export const RABETBASE_OUTPUT_FORMAT_VALUES=["json","pretty","compress"];
|
package/lib/constant/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export const DEFAULT_API_DIR="./src/api";
|
package/lib/constant/region.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{DEFAULT_REGION,ENABLED_REGION_VALUES,REGION_ALIASES,REGION_VALUES}from"../generated/official-routing.js";export const LOVRABET_REGION_VALUES=REGION_VALUES;export const ENABLED_LOVRABET_REGION_VALUES=ENABLED_REGION_VALUES;export const DEFAULT_LOVRABET_REGION=DEFAULT_REGION;export function isLovrabetRegion(value){return typeof value==="string"&&LOVRABET_REGION_VALUES.includes(value)}export function isEnabledLovrabetRegion(value){return typeof value==="string"&&ENABLED_LOVRABET_REGION_VALUES.includes(value)}export function normalizeLovrabetRegion(value){if(typeof value!=="string")return undefined;const normalized=REGION_ALIASES[value]??value;return isLovrabetRegion(normalized)?normalized:undefined}export function isInvalidLovrabetRegion(value){return value!==undefined&&value!==null&&value!==""&&normalizeLovrabetRegion(value)===undefined}
|
package/lib/constant/risk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export const RISK_LEVEL_VALUES=["read","write","high-risk-write"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{OFFICIAL_ROUTING_PROFILES as GENERATED_OFFICIAL_ROUTING_PROFILES,ROUTING_CATALOG_DIGEST}from"../generated/official-routing.js";export const OFFICIAL_ROUTING_PROFILES=GENERATED_OFFICIAL_ROUTING_PROFILES;export{ROUTING_CATALOG_DIGEST};export function getOfficialRoutingProfile(region){return OFFICIAL_ROUTING_PROFILES[region]}export function getOfficialRoutingCdn(region){const cdn=getOfficialRoutingProfile(region).cdn;if(!cdn.lovrabet){throw new Error(`Official routing for region "${region}" is not ready: Lovrabet CDN Domain is not configured.`)}return{libraries:cdn.libraries,lovrabet:cdn.lovrabet}}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import{DEFAULT_CONFIG_VALUES}from"../constant/defaults.js";import{isDaily,normalizeEnv}from"../constant/env.js";import{normalizeLegacyOutputFormat,riskLevelOrder}from"../framework/types.js";import{DEFAULT_LOVRABET_REGION,normalizeLovrabetRegion}from"../constant/region.js";import{selectConfiguredRegion}from"../config/region-config.js";function stringConfigValue(value){return typeof value==="string"&&value.trim()?value.trim():undefined}function appProfiles(config){return config.apps&&typeof config.apps==="object"?config.apps:{}}function resolveDefaultAppName(config){const defaultApp=stringConfigValue(config.defaultApp);if(defaultApp)return defaultApp;const names=Object.keys(appProfiles(config));return names.length===1?names[0]:undefined}function resolveTopLevelAppCode(config){return stringConfigValue(config.appcode)||stringConfigValue(config.app)}function normalizeRiskCeiling(value){if(value===undefined||value===null)return undefined
|
|
2
|
+
;if(value==="read"||value==="write"||value==="high-risk-write"){return value}return"read"}function resolveRiskCeiling(...values){let resolved;for(const value of values){const candidate=normalizeRiskCeiling(value);if(candidate&&(!resolved||riskLevelOrder(candidate)<riskLevelOrder(resolved))){resolved=candidate}}return resolved??DEFAULT_CONFIG_VALUES.riskLevel}export function resolveAppConfig({raw:raw,flags:flags,layers:layers,readEnv:readEnv}){const projectConfig=layers?.projectConfig??{};const globalConfig=layers?.globalConfig??{};const hasProjectConfig=!!layers?.projectPath||Object.keys(projectConfig).length>0;const canUseGlobalAppConfig=!hasProjectConfig;const projectDefaultApp=hasProjectConfig?resolveDefaultAppName(projectConfig):undefined;const globalDefaultApp=canUseGlobalAppConfig?resolveDefaultAppName(globalConfig):undefined;const flagApp=stringConfigValue(flags.app);const envApp=readEnv("APP");const apps={};if(raw.apps&&typeof raw.apps==="object"){
|
|
3
|
+
for(const[name,profile]of Object.entries(raw.apps)){if(profile&&typeof profile==="object"&&profile.appcode){apps[name]=profile}}}const defaultApp=projectDefaultApp||globalDefaultApp||resolveDefaultAppName(raw);const isMultiApp=Object.keys(apps).length>0;const baseCurrentApp=flagApp||projectDefaultApp||envApp||globalDefaultApp||defaultApp||undefined;const explicitAppCode=stringConfigValue(flags.appcode);const matchedAppEntries=explicitAppCode?Object.entries(apps).filter(([,profile])=>profile?.appcode===explicitAppCode):[];const flagAppEntry=flagApp&&apps[flagApp]?.appcode===explicitAppCode?[flagApp,apps[flagApp]]:undefined;const matchedAppEntry=flagAppEntry??(matchedAppEntries.length===1?matchedAppEntries[0]:undefined);const matchedAppName=matchedAppEntry?.[0];const matchedAppProfile=matchedAppEntry?.[1];const currentApp=explicitAppCode?matchedAppName:baseCurrentApp;let activeProfile=currentApp&&apps[currentApp]?apps[currentApp]:undefined;if(explicitAppCode&&matchedAppProfile){
|
|
4
|
+
activeProfile=matchedAppProfile}const profileForResolution=explicitAppCode?matchedAppProfile??activeProfile:activeProfile;const envAppIsActive=!flagApp&&!projectDefaultApp&&envApp&¤tApp===envApp;const explicitAppName=flagApp||(envAppIsActive?envApp:undefined)||(explicitAppCode?matchedAppName:undefined);const selectedProfileAppCode=profileForResolution?.appcode;const projectTopLevelAppCode=hasProjectConfig?resolveTopLevelAppCode(projectConfig):undefined;const globalTopLevelAppCode=canUseGlobalAppConfig?resolveTopLevelAppCode(globalConfig):undefined;const selectedProfileBeforeEnv=flagApp||projectDefaultApp?selectedProfileAppCode:undefined;const selectedProfileAfterEnv=!flagApp&&!projectDefaultApp?selectedProfileAppCode:undefined;const appCode=explicitAppCode||selectedProfileBeforeEnv||projectTopLevelAppCode||selectedProfileAfterEnv||globalTopLevelAppCode||undefined;const projectTopLevelEnv=hasProjectConfig?stringConfigValue(projectConfig.env):undefined
|
|
5
|
+
;const globalTopLevelEnv=canUseGlobalAppConfig?stringConfigValue(globalConfig.env):undefined;const resolvedEnv=flags.env||profileForResolution?.env||projectTopLevelEnv||readEnv("ENV")||globalTopLevelEnv||raw.env||DEFAULT_CONFIG_VALUES.env;const locale=profileForResolution?.locale||raw.locale||DEFAULT_CONFIG_VALUES.locale;const cookie=readEnv("COOKIE")||profileForResolution?.cookie||raw.cookie||undefined;const accessKey=readEnv("ACCESS_KEY")||profileForResolution?.accessKey||raw.accessKey||undefined;const rawFormat=flags.format||readEnv("FORMAT")||profileForResolution?.format||raw.format;const format=normalizeLegacyOutputFormat(rawFormat);const rawPageSize=readEnv("PAGE_SIZE")||profileForResolution?.pageSize||raw.pageSize;const pageSize=rawPageSize?Number(rawPageSize)||undefined:undefined;const configuredCeilings=layers?[layers.globalConfig.riskLevel,layers.projectConfig.riskLevel]:[raw.riskLevel]
|
|
6
|
+
;const configuredRiskLevel=resolveRiskCeiling(...configuredCeilings,profileForResolution?.riskLevel);const riskLevel=resolveRiskCeiling(configuredRiskLevel,readEnv("RISK_LEVEL"));const verboseVal=readEnv("VERBOSE");const verbose=verboseVal==="1"||verboseVal==="true";const apiDir=profileForResolution?.apiDir||raw.apiDir||DEFAULT_CONFIG_VALUES.apiDir;const selectedRegion=selectConfiguredRegion({appRegion:profileForResolution?.region,projectRegion:hasProjectConfig?projectConfig.region:undefined,globalRegion:hasProjectConfig||canUseGlobalAppConfig?globalConfig.region:undefined,mergedRegion:raw.region});const region=normalizeLovrabetRegion(selectedRegion.value)??DEFAULT_LOVRABET_REGION;const configEnv=isDaily(normalizeEnv(String(resolvedEnv)))?"daily":"production";return{appCode:typeof appCode==="string"&&appCode.trim()?appCode.trim():undefined,region:region,regionConfiguredValue:selectedRegion.value,regionSource:selectedRegion.source,env:configEnv,locale:locale,cookie:cookie,
|
|
7
|
+
accessKey:accessKey,format:format,pageSize:pageSize,riskLevel:riskLevel,verbose:verbose,apiDir:apiDir,apps:apps,defaultApp:defaultApp,currentApp:isMultiApp?currentApp:undefined,explicitAppName:explicitAppName}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{getIsSessionValid}from"../auth/is-session-valid.js";import{CliErrors}from"../errors.js";export async function buildAuth(config){const{getCookie:getCookie}=await(import("../auth/get-cookie.js"));const cookie=config.cookie||getCookie();const isLoggedIn=cookie?await getIsSessionValid():false;return{cookie:cookie,isLoggedIn:isLoggedIn,async getOrLogin(){if(cookie&&isLoggedIn)return cookie;throw CliErrors.authRequired()}}}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import{existsSync,mkdirSync,readFileSync,renameSync,unlinkSync,writeFileSync}from"node:fs";import{dirname,parse,resolve}from"node:path";import{homedir}from"node:os";import{CLI_BIN_NAME}from"../constant/cli.js";import{normalizeConfigForWrite}from"../config/schema.js";export const NEW_CONFIG_NAME=".rabetbase.json";export const CONFIG_NAMES=[NEW_CONFIG_NAME];const normalizedWriteCache=new Map;export function resolveConfigPath(base){for(const name of CONFIG_NAMES){const p=resolve(base,name);if(existsSync(p))return p}return undefined}export function findProjectRootDirectory(startDir=process.cwd()){let dir=resolve(startDir);const{root:root}=parse(dir);const home=homedir();while(true){if(resolveConfigPath(dir)){if(dir===home)break;return dir}if(dir===root||dir===home)break;const parent=dirname(dir);if(parent===dir)break;dir=parent}return resolve(startDir)}export function getProjectConfigPath(){return resolveConfigPath(process.cwd())}export function getGlobalConfigPath(){
|
|
2
|
+
return resolveConfigPath(homedir())}export function isInProject(){return!!getProjectConfigPath()}export function inspectCliConfigJsonFile(filePath){if(!existsSync(filePath))return{status:"missing"};try{const raw=readFileSync(filePath,{encoding:"utf8"});if(!raw?.trim())return{status:"empty"};const data=JSON.parse(raw);return{status:"ok",data:data}}catch(err){return{status:"error",message:err instanceof Error?err.message:String(err)}}}function parseCliConfigJsonFile(filePath,onParseError,scopeLabel){const r=inspectCliConfigJsonFile(filePath);if(r.status==="missing"||r.status==="empty")return{};if(r.status==="ok")return r.data;if(onParseError==="warn"&&scopeLabel){console.error(`${CLI_BIN_NAME}: ${scopeLabel} config file ignored (invalid JSON or unreadable): ${filePath}\n ${r.message}`)}return{}}function normalizeLegacyConfigShape(input){if(!input||typeof input!=="object")return{config:{},migrated:false};const config={...input};const apps=config.apps&&typeof config.apps==="object"?{
|
|
3
|
+
...config.apps}:{};const appCount=Object.keys(apps).length;const legacyAppcode=config.appcode||config.app;let migrated=false;if(legacyAppcode&&appCount===0){const appName=typeof config.defaultApp==="string"&&config.defaultApp.trim()?config.defaultApp:String(legacyAppcode).trim();apps[appName]={appcode:String(legacyAppcode).trim(),...config.env!=null?{env:config.env}:{},...config.apiDir!=null?{apiDir:config.apiDir}:{},...config.cookie!=null?{cookie:config.cookie}:{},...config.accessKey!=null?{accessKey:config.accessKey}:{},...config.format!=null?{format:config.format}:{},...config.pageSize!=null?{pageSize:config.pageSize}:{},...config.riskLevel!=null?{riskLevel:config.riskLevel}:{},...config.locale!=null?{locale:config.locale}:{}};config.apps=apps;delete config.defaultApp;migrated=true}if("appcode"in config||"app"in config){delete config.appcode;delete config.app;migrated=true}return{config:config,migrated:migrated}}function writeNormalizedConfigIfNeeded(filePath,config){
|
|
4
|
+
const serialized=JSON.stringify(normalizeConfigForWrite(config),null,2)+"\n";if(normalizedWriteCache.get(filePath)===serialized)return;writeConfigFile(filePath,config);normalizedWriteCache.set(filePath,serialized)}function parseAndNormalizeConfig(filePath,mode,sourceLabel){const parsed=parseCliConfigJsonFile(filePath,mode,sourceLabel);const normalized=normalizeLegacyConfigShape(parsed);if(normalized.migrated){try{writeNormalizedConfigIfNeeded(filePath,normalized.config)}catch{}}return normalized.config}export function loadRawConfigLayers(projectRoot){let globalConfig={};let projectConfig={};const globalPath=resolveConfigPath(homedir());if(globalPath){globalConfig=parseAndNormalizeConfig(globalPath,"warn","Global")}const base=projectRoot??findProjectRootDirectory();const projectPath=resolveConfigPath(base);if(projectPath){projectConfig=parseAndNormalizeConfig(projectPath,"warn","Project")}return{globalPath:globalPath,projectPath:projectPath,globalConfig:globalConfig,
|
|
5
|
+
projectConfig:projectConfig}}const INHERIT_WHITELIST=["cookie","accessKey","locale","format","riskLevel","pageSize","region","routing","userDomain","apiDomain","runtimeDomain","skillDomain","kbDomain","kbServiceDomain","appDomain","localDomain","certificateDomain"];export function mergeRawConfigLayers(layers){const{globalConfig:globalConfig,projectConfig:projectConfig}=layers;const hasProject=!!layers.projectPath||Object.keys(projectConfig).length>0;if(!hasProject)return mergeGlobalOnly(globalConfig);return mergeProjectFirst(globalConfig,projectConfig)}function mergeGlobalOnly(globalConfig){const config={...globalConfig};delete config.inherit;const globalApps=globalConfig.apps&&typeof globalConfig.apps==="object"?globalConfig.apps:{};if(Object.keys(globalApps).length>0)config.apps=globalApps;if(globalConfig.defaultApp)config.defaultApp=globalConfig.defaultApp;return config}function mergeProjectFirst(globalConfig,projectConfig){const config={...projectConfig};delete config.inherit
|
|
6
|
+
;for(const field of INHERIT_WHITELIST){if(!(field in config)&&field in globalConfig){config[field]=globalConfig[field]}}const projectApps=projectConfig.apps&&typeof projectConfig.apps==="object"?projectConfig.apps:{};if(Object.keys(projectApps).length>0){config.apps=projectApps}else{delete config.apps}if("defaultApp"in projectConfig){config.defaultApp=projectConfig.defaultApp}else{delete config.defaultApp}return config}export function readRawConfigWithLayers(projectRoot){const layers=loadRawConfigLayers(projectRoot);return{config:mergeRawConfigLayers(layers),layers:layers}}export function readRawConfig(projectRoot){return mergeRawConfigLayers(loadRawConfigLayers(projectRoot))}export function readConfigFile(filePath){return parseAndNormalizeConfig(filePath,"silent")}export function writeConfigFile(filePath,data){const dir=dirname(filePath);if(!existsSync(dir)){mkdirSync(dir,{recursive:true})}const tempPath=`${filePath}.tmp`;try{const persisted=normalizeConfigForWrite(data)
|
|
7
|
+
;writeFileSync(tempPath,JSON.stringify(persisted,null,2)+"\n",{encoding:"utf8",mode:384});renameSync(tempPath,filePath)}catch(err){try{unlinkSync(tempPath)}catch{}throw err}}export function resolveWriteConfigPath(scope){const base=scope==="project"?process.cwd():homedir();const existing=resolveConfigPath(base);return existing??resolve(base,NEW_CONFIG_NAME)}
|