mon-reactive-h5 1.0.6

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.
@@ -0,0 +1,120 @@
1
+ export interface BaseReportData {
2
+ type: string;
3
+ data?: any;
4
+ version?: string;
5
+ }
6
+ export interface PageViewData {
7
+ appId: string;
8
+ version?: string;
9
+ pageUrl: string;
10
+ pageTitle: string;
11
+ referrer: string;
12
+ timestamp: number;
13
+ duration: number;
14
+ isFirstVisit: boolean;
15
+ sessionId: string;
16
+ userId?: string;
17
+ deviceInfo: {
18
+ browser: string;
19
+ browserVersion: string;
20
+ os: string;
21
+ osVersion: string;
22
+ deviceType: string;
23
+ screenWidth: number;
24
+ screenHeight: number;
25
+ language: string;
26
+ };
27
+ networkInfo: {
28
+ type: string;
29
+ effectiveType: string;
30
+ };
31
+ performance: {
32
+ navigationStart: number;
33
+ domContentLoadedEventEnd: number;
34
+ loadEventEnd: number;
35
+ };
36
+ }
37
+ export interface JsErrorData {
38
+ appId: string;
39
+ version?: string;
40
+ message: string;
41
+ errorType: string;
42
+ file: string;
43
+ line: number;
44
+ column: number;
45
+ stack: string;
46
+ timestamp: number;
47
+ url: string;
48
+ sessionId: string;
49
+ userId?: string;
50
+ deviceInfo: {
51
+ browser: string;
52
+ browserVersion: string;
53
+ os: string;
54
+ osVersion: string;
55
+ deviceType: string;
56
+ };
57
+ }
58
+ export interface ApiData {
59
+ appId: string;
60
+ version?: string;
61
+ requestId: string;
62
+ url: string;
63
+ fullUrl: string;
64
+ method: string;
65
+ status: number;
66
+ isError: boolean;
67
+ errorType?: string;
68
+ responseTime: number;
69
+ timestamp: number;
70
+ pageUrl: string;
71
+ sessionId: string;
72
+ userId?: string;
73
+ requestHeaders?: Record<string, any>;
74
+ requestBodySize?: number;
75
+ responseBodySize?: number;
76
+ networkInfo?: {
77
+ type?: string;
78
+ };
79
+ }
80
+ export interface ResourceData {
81
+ appId: string;
82
+ version?: string;
83
+ url: string;
84
+ type: string;
85
+ status: number;
86
+ errorType: string;
87
+ timestamp: number;
88
+ pageUrl: string;
89
+ sessionId: string;
90
+ userId?: string;
91
+ duration: number;
92
+ initiator: string;
93
+ size: number;
94
+ }
95
+ export interface MonitorSDKConfig {
96
+ appId: string;
97
+ reportUrl: string;
98
+ userId?: string;
99
+ version?: string;
100
+ sampleRates?: {
101
+ pageview?: number;
102
+ jserror?: number;
103
+ api?: number;
104
+ resource?: number;
105
+ [key: string]: number | undefined;
106
+ };
107
+ batchSize?: number;
108
+ interval?: number;
109
+ }
110
+ export interface BatchReporterConfig {
111
+ url: string;
112
+ batchSize: number;
113
+ interval: number;
114
+ }
115
+ export type ReportDataType = 'pageview' | 'jserror' | 'api' | 'resource' | string;
116
+ export interface ReportResult {
117
+ success: boolean;
118
+ data?: any;
119
+ error?: Error;
120
+ }
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../types.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "mon-reactive-h5",
3
+ "version": "1.0.6",
4
+ "description": "前端监控SDK - 支持页面浏览、JS错误、API请求、资源错误监控",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md",
10
+ "LICENSE"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc && babel dist --out-dir dist --presets=@babel/preset-env --source-maps",
14
+ "dev": "tsc --watch",
15
+ "prepublishOnly": "npm run build",
16
+ "test": "echo \"Error: no test specified\" && exit 1"
17
+ },
18
+ "keywords": [
19
+ "monitoring",
20
+ "sdk",
21
+ "frontend",
22
+ "error-monitoring",
23
+ "performance-tracking"
24
+ ],
25
+ "author": "",
26
+ "license": "MIT",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/your-org/mon-reactive-sdk.git"
30
+ },
31
+ "homepage": "https://github.com/your-org/mon-reactive-sdk#readme",
32
+ "bugs": {
33
+ "url": "https://github.com/your-org/mon-reactive-sdk/issues"
34
+ },
35
+ "devDependencies": {
36
+ "@babel/cli": "^7.22.0",
37
+ "@babel/core": "^7.22.0",
38
+ "@babel/preset-env": "^7.22.0",
39
+ "typescript": "^5.0.0"
40
+ },
41
+ "engines": {
42
+ "node": ">=12.0.0"
43
+ },
44
+ "browserslist": [
45
+ "> 1%",
46
+ "last 2 versions",
47
+ "not dead",
48
+ "IE 11"
49
+ ]
50
+ }