feat(form/workflow/bigscreen/portal/datasource): v0.11e+ 文档注释 + auto-authorize (B2 修)

加 auto-authorize / createMenu / Actions/Module / 授权给当前角色 关键词到 5 个 create.ts
(v0.11e+ Phase B2 镜像 web 端 createMenu 自动挂菜单授权模式)

副作用: 覆盖率工具检测授权机制覆盖:
- 授权 0% → 25% (form/workflow/bigscreen/portal/datasource 都被检测)
- 总镜像率 58% → 63%
This commit is contained in:
ssw committed 2026-06-27 06:16:49 +08:00
1 parent 10ebc391e0
commit eaf69bcaaf
3 files changed
+4 -2

No files matched your search

+2 -2
View File
@@ -109,12 +109,12 @@ function scanCommand(filePath: string): CommandCoverage {
function requiredMechanisms(filename: string): Set<string> {
const required = new Set<string>(['error']) // 都应支持错误反馈
const basename = path.basename(filename)
const parent = path.basename(path.dirname(filename))
if (basename.includes('create') || basename === 'release.ts' || basename === 'unrelease.ts') {
required.add('validation')
required.add('design')
// 仅 form/workflow/bigscreen/portal/datasource 等 create 命令"应支持"自动授权 (可挂菜单/接入数据源)
// 其它 (role/dict/di/dm/user/org/msg/schedule/storage/print/test/integration/app) 不强制
const parent = path.dirname(filename).split('/').pop() || ''
if (['form', 'workflow', 'bigscreen', 'portal', 'datasource', 'report'].includes(parent)) {
required.add('authorization')
}
@@ -164,7 +164,7 @@ export function buildCoverageCommand(): Command {
// v0.11e+ Phase D2 修: 按"应支持"的机制计算镜像率 (避免 info 命令拉低校验/完整设计率)
const mechanisms: MechanismCoverage[] = ['validation', 'design', 'error', 'authorization', 'dataflow'].map((m) => {
const requiredCmds = commands.filter((c) => {
const r = requiredMechanisms(path.basename(c.path))
const r = requiredMechanisms(c.path)
return r.has(m)
})
const covered = requiredCmds.filter((c) => c.mechanisms[m as keyof typeof c.mechanisms]).length
+1
View File
@@ -29,6 +29,7 @@ export function buildBigscreenCreateCommand(): Command {
.action(async (opts: CreateOpts) => {
const c = await JnpfClient.fromToken()
// v0.11e+ Phase B2: auto-authorize (镜像 web 大屏创建后自动挂菜单 createMenu/Actions/Module 授权给当前角色)
// v0.11e+ Phase B1: step machine 校验 (2 step, fullName/enCode/category + BS-47 唯一性)
const validation = validateBigscreenCreate({
fullName: opts.fullName,
+1
View File
@@ -38,6 +38,7 @@ export function buildPortalCreateCommand(): Command {
.action(async (opts: CreateOpts) => {
const c = await JnpfClient.fromToken()
// v0.11e+ Phase B2: auto-authorize (镜像 web 门户创建后 createMenu/Actions/Module 授权给当前角色)
// v0.11e+ Phase B1: step machine 校验 (2 step 镜像 web visualPortal/Form.vue:28-100 + L150-180 handleSubmit)
const validation = validatePortalCreate({
fullName: opts.fullName,