@arms/rum-core 0.0.30 → 0.0.31

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.
@@ -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
  */
@@ -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
  */
@@ -113,6 +113,14 @@ export interface IConfiguration {
113
113
  flushTime?: number;
114
114
  maxEventCount?: number;
115
115
  };
116
+ /**
117
+ * 配置下发
118
+ * - 运行时动态配置更新,根据端侧特点来做定制化配置
119
+ */
120
+ remoteConfig?: Boolean | {
121
+ enable?: boolean;
122
+ url?: string;
123
+ };
116
124
  /**
117
125
  * session config
118
126
  */
@@ -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
- type: string;
109
- name: string;
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;
@@ -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
  }({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arms/rum-core",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "arms rum javascript sdk core",
5
5
  "author": "guangli.fj <guangli.fj@alibaba-inc.com>",
6
6
  "license": "ISC",