@arms/rum-core 0.0.30 → 0.0.32
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.
- package/lib/model/shell.d.ts +5 -1
- package/lib/model/shell.js +25 -0
- package/lib/types/client.d.ts +25 -2
- package/lib/types/rum-event.d.ts +10 -5
- package/lib/types/rum-event.js +2 -1
- package/package.json +1 -1
package/lib/model/shell.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, IConfiguration } from "../types/client";
|
|
2
|
-
import { RumCustomEvent, RumEvent, RumExceptionEvent, RumResourceEvent } from "../types/rum-event";
|
|
2
|
+
import { RumCustomEvent, RumEvent, RumExceptionEvent, RumResourceEvent, RumViewEvent } from "../types/rum-event";
|
|
3
3
|
import { IShell } from "../types/shell";
|
|
4
4
|
export default abstract class Shell implements IShell {
|
|
5
5
|
client: IClient;
|
|
@@ -22,6 +22,10 @@ export default abstract class Shell implements IShell {
|
|
|
22
22
|
* 自定义事件上报
|
|
23
23
|
*/
|
|
24
24
|
sendCustom(payload: RumCustomEvent): void;
|
|
25
|
+
/**
|
|
26
|
+
* 自定义视图上报
|
|
27
|
+
*/
|
|
28
|
+
sendView(payload: RumViewEvent): void;
|
|
25
29
|
/**
|
|
26
30
|
* 自定义异常上报
|
|
27
31
|
*/
|
package/lib/model/shell.js
CHANGED
|
@@ -50,6 +50,31 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
50
50
|
});
|
|
51
51
|
this.sendEvent(data);
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* 自定义视图上报
|
|
55
|
+
*/
|
|
56
|
+
_proto.sendView = function sendView(payload) {
|
|
57
|
+
if (!(0, _is.isObject)(payload)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!payload.type) {
|
|
61
|
+
payload.type = 'custom';
|
|
62
|
+
}
|
|
63
|
+
if (payload.type === 'custom') {
|
|
64
|
+
var n = 0;
|
|
65
|
+
['t1', 't2', 't3'].forEach(function (key) {
|
|
66
|
+
if (!(0, _is.isNumber)(payload[key])) {
|
|
67
|
+
delete payload[key];
|
|
68
|
+
}
|
|
69
|
+
key in payload && n++;
|
|
70
|
+
});
|
|
71
|
+
if (n === 0) return;
|
|
72
|
+
}
|
|
73
|
+
var data = (0, _extends2["default"])({}, payload, {
|
|
74
|
+
event_type: _rumEvent.RumEventType.VIEW
|
|
75
|
+
});
|
|
76
|
+
this.sendEvent(data);
|
|
77
|
+
};
|
|
53
78
|
/**
|
|
54
79
|
* 自定义异常上报
|
|
55
80
|
*/
|
package/lib/types/client.d.ts
CHANGED
|
@@ -89,6 +89,19 @@ export interface IConfiguration {
|
|
|
89
89
|
* 应用版本
|
|
90
90
|
*/
|
|
91
91
|
version?: string;
|
|
92
|
+
/**
|
|
93
|
+
* 应用配置
|
|
94
|
+
*/
|
|
95
|
+
app?: {
|
|
96
|
+
id?: string;
|
|
97
|
+
name?: string;
|
|
98
|
+
version?: string;
|
|
99
|
+
channel?: string;
|
|
100
|
+
env?: string;
|
|
101
|
+
type?: string;
|
|
102
|
+
package?: string;
|
|
103
|
+
framework?: string;
|
|
104
|
+
};
|
|
92
105
|
/**
|
|
93
106
|
* 用户配置
|
|
94
107
|
*/
|
|
@@ -96,7 +109,6 @@ export interface IConfiguration {
|
|
|
96
109
|
id?: string;
|
|
97
110
|
tags?: string;
|
|
98
111
|
name?: string;
|
|
99
|
-
[key: string]: any;
|
|
100
112
|
};
|
|
101
113
|
/**
|
|
102
114
|
* 上报地址
|
|
@@ -113,6 +125,11 @@ export interface IConfiguration {
|
|
|
113
125
|
flushTime?: number;
|
|
114
126
|
maxEventCount?: number;
|
|
115
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* 配置下发
|
|
130
|
+
* - 运行时动态配置更新,根据端侧特点来做定制化配置
|
|
131
|
+
*/
|
|
132
|
+
remoteConfig?: Boolean;
|
|
116
133
|
/**
|
|
117
134
|
* session config
|
|
118
135
|
*/
|
|
@@ -121,7 +138,7 @@ export interface IConfiguration {
|
|
|
121
138
|
* 各个 collector config
|
|
122
139
|
*/
|
|
123
140
|
collectors?: {
|
|
124
|
-
[key: string]:
|
|
141
|
+
[key: string]: boolean;
|
|
125
142
|
};
|
|
126
143
|
/**
|
|
127
144
|
* 事件过滤器配置
|
|
@@ -131,5 +148,11 @@ export interface IConfiguration {
|
|
|
131
148
|
resource?: MatchOption | MatchOption[];
|
|
132
149
|
exception?: MatchOption | MatchOption[];
|
|
133
150
|
};
|
|
151
|
+
/**
|
|
152
|
+
* 全局自定义属性
|
|
153
|
+
*/
|
|
154
|
+
properties?: {
|
|
155
|
+
[key: string]: number | string;
|
|
156
|
+
};
|
|
134
157
|
[key: string]: any;
|
|
135
158
|
}
|
package/lib/types/rum-event.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare enum RumEventType {
|
|
|
2
2
|
VIEW = "view",
|
|
3
3
|
RESOURCE = "resource",
|
|
4
4
|
EXCEPTION = "exception",
|
|
5
|
-
LONG_TASK = "
|
|
5
|
+
LONG_TASK = "longTask",
|
|
6
6
|
ACTION = "action",
|
|
7
7
|
CUSTOM = "custom",
|
|
8
8
|
APPLICATION = "application"
|
|
@@ -28,7 +28,7 @@ export interface RumBaseEvent extends BaseObject {
|
|
|
28
28
|
}
|
|
29
29
|
export interface RumViewEvent extends RumBaseEvent {
|
|
30
30
|
loading_type?: 'initial_load' | 'route_change';
|
|
31
|
-
type: 'pv' | 'perf' | 'webvitals';
|
|
31
|
+
type: 'pv' | 'perf' | 'webvitals' | 'custom';
|
|
32
32
|
largest_contentful_paint?: number;
|
|
33
33
|
first_input_delay?: number;
|
|
34
34
|
cumulative_layout_shift?: number;
|
|
@@ -40,6 +40,9 @@ export interface RumViewEvent extends RumBaseEvent {
|
|
|
40
40
|
dom_content_loaded?: number;
|
|
41
41
|
dom_complete?: number;
|
|
42
42
|
load_event?: number;
|
|
43
|
+
t1?: number;
|
|
44
|
+
t2?: number;
|
|
45
|
+
t3?: number;
|
|
43
46
|
referrer?: string;
|
|
44
47
|
url?: string;
|
|
45
48
|
timing_data?: string;
|
|
@@ -105,15 +108,16 @@ export interface RumCustomEvent extends RumBaseEvent {
|
|
|
105
108
|
value: number;
|
|
106
109
|
}
|
|
107
110
|
export interface RumApplicationEvent extends RumBaseEvent {
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
state: string;
|
|
112
|
+
scene: string;
|
|
110
113
|
duration: number;
|
|
111
114
|
}
|
|
112
115
|
export type RumEvent = RumViewEvent | RumResourceEvent | RumExceptionEvent | RumActionEvent | RumCustomEvent | RumApplicationEvent;
|
|
113
116
|
export declare enum AppType {
|
|
114
117
|
browser = "browser",
|
|
115
118
|
miniapp = "miniapp",
|
|
116
|
-
uniapp = "uniapp"
|
|
119
|
+
uniapp = "uniapp",
|
|
120
|
+
minigame = "minigame"
|
|
117
121
|
}
|
|
118
122
|
export interface RumEventBundle {
|
|
119
123
|
app: {
|
|
@@ -124,6 +128,7 @@ export interface RumEventBundle {
|
|
|
124
128
|
channel?: string;
|
|
125
129
|
env?: string;
|
|
126
130
|
package?: string;
|
|
131
|
+
framework?: string;
|
|
127
132
|
};
|
|
128
133
|
user: {
|
|
129
134
|
id: string;
|
package/lib/types/rum-event.js
CHANGED
|
@@ -6,7 +6,7 @@ var RumEventType = exports.RumEventType = /*#__PURE__*/function (RumEventType) {
|
|
|
6
6
|
RumEventType["VIEW"] = "view";
|
|
7
7
|
RumEventType["RESOURCE"] = "resource";
|
|
8
8
|
RumEventType["EXCEPTION"] = "exception";
|
|
9
|
-
RumEventType["LONG_TASK"] = "
|
|
9
|
+
RumEventType["LONG_TASK"] = "longTask";
|
|
10
10
|
RumEventType["ACTION"] = "action";
|
|
11
11
|
RumEventType["CUSTOM"] = "custom";
|
|
12
12
|
RumEventType["APPLICATION"] = "application";
|
|
@@ -25,5 +25,6 @@ var AppType = exports.AppType = /*#__PURE__*/function (AppType) {
|
|
|
25
25
|
AppType["browser"] = "browser";
|
|
26
26
|
AppType["miniapp"] = "miniapp";
|
|
27
27
|
AppType["uniapp"] = "uniapp";
|
|
28
|
+
AppType["minigame"] = "minigame";
|
|
28
29
|
return AppType;
|
|
29
30
|
}({});
|