@arms/rum-core 0.0.34 → 0.0.35
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 -4
- package/lib/model/shell.d.ts +2 -1
- package/lib/model/shell.js +26 -20
- package/package.json +1 -1
package/lib/model/reporter.js
CHANGED
|
@@ -125,7 +125,6 @@ var Reporter = exports["default"] = /*#__PURE__*/function () {
|
|
|
125
125
|
this.eventQueue = [];
|
|
126
126
|
};
|
|
127
127
|
_proto.mergeEvent = function mergeEvent(ctx, events, view) {
|
|
128
|
-
var _config$net;
|
|
129
128
|
var config = ctx.getConfig();
|
|
130
129
|
var session = ctx.session;
|
|
131
130
|
var sessionId = session.getSessionId();
|
|
@@ -157,9 +156,7 @@ var Reporter = exports["default"] = /*#__PURE__*/function () {
|
|
|
157
156
|
session: {
|
|
158
157
|
id: sessionId
|
|
159
158
|
},
|
|
160
|
-
net: {
|
|
161
|
-
model: (_config$net = config.net) === null || _config$net === void 0 ? void 0 : _config$net.model
|
|
162
|
-
},
|
|
159
|
+
net: {},
|
|
163
160
|
view: view,
|
|
164
161
|
events: events
|
|
165
162
|
};
|
package/lib/model/shell.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { IShell } from "../types/shell";
|
|
|
4
4
|
export default abstract class Shell implements IShell {
|
|
5
5
|
client: IClient;
|
|
6
6
|
constructor(config?: IConfiguration);
|
|
7
|
-
|
|
7
|
+
getCombinedConfig(config?: IConfiguration): any;
|
|
8
|
+
updateFromRemoteConfig(config: any, reSetup?: boolean): void;
|
|
8
9
|
/**
|
|
9
10
|
* 初始化
|
|
10
11
|
*/
|
package/lib/model/shell.js
CHANGED
|
@@ -15,36 +15,47 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
15
15
|
this.client = void 0;
|
|
16
16
|
this.client = new _client["default"]();
|
|
17
17
|
if (config && this.init) {
|
|
18
|
-
|
|
19
|
-
if ((0, _combineConfig.isRemoteConfigEnable)(config) && (0, _is.isFunction)(this.getLocalConfig)) {
|
|
20
|
-
var localConfig = this.getLocalConfig(0, config.pid);
|
|
21
|
-
combinedConf = (0, _combineConfig["default"])(config, localConfig);
|
|
22
|
-
}
|
|
23
|
-
this.init(combinedConf || config);
|
|
24
|
-
|
|
25
|
-
// 拉取远程配置进行更新
|
|
26
|
-
this.updateFromRemoteConfig(config);
|
|
18
|
+
this.init(config);
|
|
27
19
|
}
|
|
20
|
+
// if (config && this.init) {
|
|
21
|
+
// this.init(this.getCombinedConfig(config));
|
|
22
|
+
|
|
23
|
+
// // 拉取远程配置进行更新
|
|
24
|
+
// this.updateFromRemoteConfig(config);
|
|
25
|
+
// }
|
|
28
26
|
}
|
|
29
27
|
var _proto = Shell.prototype;
|
|
30
|
-
_proto.
|
|
28
|
+
_proto.getCombinedConfig = function getCombinedConfig(config) {
|
|
29
|
+
var combinedConf;
|
|
30
|
+
if ((0, _combineConfig.isRemoteConfigEnable)(config) && (0, _is.isFunction)(this.getLocalConfig)) {
|
|
31
|
+
var localConfig = this.getLocalConfig(0, config.pid);
|
|
32
|
+
combinedConf = (0, _combineConfig["default"])(config, localConfig);
|
|
33
|
+
}
|
|
34
|
+
return combinedConf || config;
|
|
35
|
+
};
|
|
36
|
+
_proto.updateFromRemoteConfig = function updateFromRemoteConfig(config, reSetup) {
|
|
37
|
+
if (reSetup === void 0) {
|
|
38
|
+
reSetup = true;
|
|
39
|
+
}
|
|
31
40
|
// 请求动态配置
|
|
32
41
|
if (config.pid && (0, _combineConfig.isRemoteConfigEnable)(config) && (0, _is.isFunction)(this.getRemoteConfig)) {
|
|
33
42
|
var that = this;
|
|
34
|
-
this.getRemoteConfig((0, _combineConfig.getRemoteConfigUrl)(config), config)
|
|
43
|
+
var proms = this.getRemoteConfig((0, _combineConfig.getRemoteConfigUrl)(config), config);
|
|
44
|
+
proms === null || proms === void 0 ? void 0 : proms.then(function (remoteConfig) {
|
|
35
45
|
if (!remoteConfig || remoteConfig.errorStatus !== undefined) return;
|
|
36
46
|
var combinedConf = (0, _combineConfig["default"])(config, remoteConfig);
|
|
37
47
|
|
|
38
48
|
// 无有效的新配置,无需更新
|
|
39
49
|
if (!combinedConf) return;
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
|
|
51
|
+
// 存储到本地
|
|
52
|
+
if ((0, _is.isFunction)(that.storeRemoteConfig)) {
|
|
53
|
+
that.storeRemoteConfig(remoteConfig, config.pid);
|
|
42
54
|
}
|
|
55
|
+
if (reSetup === false || config.remoteConfig.reSetup === false) return;
|
|
43
56
|
var context = that.client.getContext();
|
|
44
|
-
|
|
45
57
|
// 更新配置
|
|
46
58
|
context.setConfig(combinedConf);
|
|
47
|
-
|
|
48
59
|
// 逐个更新collector
|
|
49
60
|
var collectors = that.client.getCollectors();
|
|
50
61
|
collectors.forEach(function (collector) {
|
|
@@ -53,11 +64,6 @@ var Shell = exports["default"] = /*#__PURE__*/function () {
|
|
|
53
64
|
collector.setup(context, that.client.sendEvent);
|
|
54
65
|
}
|
|
55
66
|
});
|
|
56
|
-
|
|
57
|
-
// 存储到本地
|
|
58
|
-
if ((0, _is.isFunction)(that.storeRemoteConfig)) {
|
|
59
|
-
that.storeRemoteConfig(remoteConfig, config.pid);
|
|
60
|
-
}
|
|
61
67
|
});
|
|
62
68
|
}
|
|
63
69
|
}
|