feat: 接通后台渲染异常上报与响应契约校验

This commit is contained in:
que01 committed 2026-10-21 11:43:41 +08:00
1 parent 330d67adc1
commit adcaa12970
22 files changed
+845 -33

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { IsOptional, IsString, Matches, MaxLength, MinLength } from "class-validator";
/** 后台渲染异常上报:只接受白名单字段,避免把任意浏览器数据写进日志。 */
export class CreateClientErrorDto {
@IsString()
@Matches(/^[A-Za-z0-9._-]{4,128}$/, { message: "errorId 格式不正确" })
errorId!: string;
@IsString()
@MinLength(1, { message: "message 不能为空" })
@MaxLength(2000, { message: "message 过长" })
message!: string;
@IsString()
@Matches(/^\//, { message: "route 必须以 / 开头" })
@MaxLength(500, { message: "route 过长" })
route!: string;
@IsOptional()
@IsString()
@MaxLength(20000, { message: "componentStack 过长" })
componentStack?: string;
}