sobey-monitor-sdk 1.1.8 → 1.1.10

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.
@@ -70,6 +70,18 @@ export interface ReportConfig {
70
70
  /** 请求超时(ms) */
71
71
  timeout?: number;
72
72
  }
73
+ /**
74
+ * 业务错误检测规则
75
+ * 用于检测 HTTP 200 响应中的业务层错误
76
+ */
77
+ export interface BusinessErrorRule {
78
+ /** 字段路径,如 "status" 或 "data.code" */
79
+ field: string;
80
+ /** 比较操作符 */
81
+ operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'exists';
82
+ /** 比较值(当 operator 为 'exists' 时可不填) */
83
+ value?: string | number | boolean;
84
+ }
73
85
  /**
74
86
  * 错误监控配置
75
87
  */
@@ -86,6 +98,12 @@ export interface ErrorMonitorConfig {
86
98
  httpError?: boolean;
87
99
  /** 错误过滤函数 */
88
100
  filter?: (error: ErrorData) => boolean;
101
+ /**
102
+ * 业务错误检测规则
103
+ * 当 HTTP 状态码为 200 时,根据这些规则检测响应体中的业务错误
104
+ * 任一规则匹配时将上报 http_error
105
+ */
106
+ businessErrorRules?: BusinessErrorRule[];
89
107
  }
90
108
  /**
91
109
  * 性能监控配置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sobey-monitor-sdk",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "前端全方位监控 SDK,支持错误监控、性能监控、用户行为回溯。适合单页面应用及多端环境。",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",