feat(rules): 条件系统增强,支持 all/any 组合条件和 original/current 数据源切换

- evaluate_condition 支持递归 all/any 组合节点和 source 字段
- header_rules 支持 condition 条件触发,HeaderBuilder.apply_rules 透传 body/original_body
- 提取 EndpointConditionEditor 组件统一请求头/请求体规则的条件编辑 UI
- header_rules 新增服务端结构校验(action/key/from/to/condition)
- 新增组合条件、source 切换、fail-closed 等测试用例
This commit is contained in:
fawney19
2026-03-15 20:27:53 +08:00
parent 6b23c9b3ce
commit 3c7ad81d62
14 changed files with 1395 additions and 314 deletions

View File

@@ -42,8 +42,6 @@ export interface HeaderRuleRename {
to: string
}
export type HeaderRule = HeaderRuleSet | HeaderRuleDrop | HeaderRuleRename
/**
* 请求体规则类型
* - set: 设置/覆盖字段
@@ -136,10 +134,28 @@ export type BodyRuleConditionOp =
| 'exists' | 'not_exists'
| 'in' | 'type_is'
export interface BodyRuleCondition {
export interface BodyRuleConditionLeaf {
path: string
op: BodyRuleConditionOp
value?: unknown // exists / not_exists 不需要 value
source?: 'original' | 'current'
}
export interface BodyRuleConditionAll {
all: BodyRuleCondition[]
}
export interface BodyRuleConditionAny {
any: BodyRuleCondition[]
}
export type BodyRuleCondition =
| BodyRuleConditionLeaf
| BodyRuleConditionAll
| BodyRuleConditionAny
export type HeaderRule = (HeaderRuleSet | HeaderRuleDrop | HeaderRuleRename) & {
condition?: BodyRuleCondition
}
/**