@arms/rum-core 0.0.25-beta.7 → 0.0.25-beta.8
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/reporter.js +1 -1
- package/lib/model/shell.d.ts +6 -2
- package/lib/model/shell.js +17 -1
- package/lib/types/client.d.ts +4 -0
- package/package.json +1 -1
package/lib/model/reporter.js
CHANGED
|
@@ -6,7 +6,7 @@ var _rumEvent = require("../types/rum-event");
|
|
|
6
6
|
var _exception = require("../utils/exception");
|
|
7
7
|
var _is = require("../utils/is");
|
|
8
8
|
var FLUSH_TIME = 3000;
|
|
9
|
-
var MAX_EVENT_COUNT =
|
|
9
|
+
var MAX_EVENT_COUNT = 20;
|
|
10
10
|
var Reporter = exports["default"] = /*#__PURE__*/function () {
|
|
11
11
|
function Reporter() {
|
|
12
12
|
this.name = 'reporter';
|
package/lib/model/shell.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, IConfiguration } from "../types/client";
|
|
2
|
-
import { RumEvent } from "../types/rum-event";
|
|
2
|
+
import { RumEvent, RumExceptionEvent } from "../types/rum-event";
|
|
3
3
|
import { IShell } from "../types/shell";
|
|
4
4
|
export default abstract class Shell implements IShell {
|
|
5
5
|
client: IClient;
|
|
@@ -19,7 +19,11 @@ export default abstract class Shell implements IShell {
|
|
|
19
19
|
abstract setConfig<T extends keyof IConfiguration>(key: T, value: IConfiguration[T]): void;
|
|
20
20
|
abstract setConfig(value: IConfiguration): void;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* 自定义事件上报
|
|
23
23
|
*/
|
|
24
24
|
sendCustom(payload: RumEvent): void;
|
|
25
|
+
/**
|
|
26
|
+
* 自定义异常上报
|
|
27
|
+
*/
|
|
28
|
+
sendException(payload: RumExceptionEvent): void;
|
|
25
29
|
}
|
package/lib/model/shell.js
CHANGED
|
@@ -38,7 +38,7 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
38
38
|
* set config
|
|
39
39
|
*/;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* 自定义事件上报
|
|
42
42
|
*/
|
|
43
43
|
_proto.sendCustom = function sendCustom(payload) {
|
|
44
44
|
if (!payload.name || !payload.type) {
|
|
@@ -49,5 +49,21 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
49
49
|
});
|
|
50
50
|
this.sendEvent(data);
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* 自定义异常上报
|
|
54
|
+
*/
|
|
55
|
+
_proto.sendException = function sendException(payload) {
|
|
56
|
+
if (!payload.name || !payload.message) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var data = (0, _extends2["default"])({
|
|
60
|
+
times: 1
|
|
61
|
+
}, payload, {
|
|
62
|
+
event_type: _rumEvent.RumEventType.EXCEPTION,
|
|
63
|
+
type: 'custom',
|
|
64
|
+
source: 'custom'
|
|
65
|
+
});
|
|
66
|
+
this.sendEvent(data);
|
|
67
|
+
};
|
|
52
68
|
return Shell;
|
|
53
69
|
}();
|
package/lib/types/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ICollector } from './collector';
|
|
|
2
2
|
import { IProcessor } from './processor';
|
|
3
3
|
import { IReporter } from './reporter';
|
|
4
4
|
import { RumEvent, RumEventBundle, IViewData } from './rum-event';
|
|
5
|
+
import { MatchOption } from "../utils/match";
|
|
5
6
|
export declare enum EventType {
|
|
6
7
|
/**
|
|
7
8
|
* 收集数据
|
|
@@ -98,5 +99,8 @@ export interface IConfiguration {
|
|
|
98
99
|
* 各个 collector config
|
|
99
100
|
*/
|
|
100
101
|
collectors?: any;
|
|
102
|
+
filters?: {
|
|
103
|
+
[key: string]: MatchOption | MatchOption[];
|
|
104
|
+
};
|
|
101
105
|
[key: string]: any;
|
|
102
106
|
}
|