total5 0.0.16-1 → 0.0.16-2
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/changelog.txt +5 -0
- package/flow-flowstream.js +19 -14
- package/index.js +13 -7
- package/package.json +1 -1
- package/websocket.js +17 -2
package/changelog.txt
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
- framework reads a `/config` file in `plugins`
|
|
7
7
|
- added `RESTBuilder.?.logerror()` method for printing errors into the console
|
|
8
8
|
- added `API.?.logerror()` method for printing errors into the console
|
|
9
|
+
- fixed handling of unexpected problems in the Flow with the main process becoming disconnected
|
|
10
|
+
- fixed `uptime` value in the framework stats
|
|
11
|
+
- improved auditlogs by adding `files`
|
|
12
|
+
- fixed unexpected errors when compressing/decompressing data via WebSocket
|
|
13
|
+
- fixed processing TMS data in the FlowStream
|
|
9
14
|
|
|
10
15
|
========================
|
|
11
16
|
0.0.15
|
package/flow-flowstream.js
CHANGED
|
@@ -97,7 +97,12 @@ Instance.prototype = {
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
Instance.prototype.postMessage = function(msg) {
|
|
100
|
-
|
|
100
|
+
if (this.flow.postMessage) {
|
|
101
|
+
// Try & Catch handles unexpected problems with the main process becoming disconnected.
|
|
102
|
+
try {
|
|
103
|
+
this.flow.postMessage(msg);
|
|
104
|
+
} catch {}
|
|
105
|
+
}
|
|
101
106
|
};
|
|
102
107
|
|
|
103
108
|
Instance.prototype.httprequest = function(opt, callback) {
|
|
@@ -2877,19 +2882,19 @@ TMS.connect = function(fs, sourceid, callback) {
|
|
|
2877
2882
|
if (!client.tmsready)
|
|
2878
2883
|
return;
|
|
2879
2884
|
|
|
2880
|
-
|
|
2885
|
+
let publishers = {};
|
|
2881
2886
|
|
|
2882
|
-
for (
|
|
2883
|
-
|
|
2884
|
-
|
|
2887
|
+
for (let key in fs.meta.flow) {
|
|
2888
|
+
let instance = fs.meta.flow[key];
|
|
2889
|
+
let com = fs.meta.components[instance.component];
|
|
2885
2890
|
if (com && com.itemid === item.id && com.outputs && com.outputs.length) {
|
|
2886
2891
|
if (Object.keys(instance.connections).length)
|
|
2887
2892
|
publishers[com.schema.id] = 1;
|
|
2888
2893
|
}
|
|
2889
2894
|
}
|
|
2890
2895
|
|
|
2891
|
-
|
|
2892
|
-
|
|
2896
|
+
let keys = Object.keys(publishers);
|
|
2897
|
+
let cache = keys.join(',');
|
|
2893
2898
|
|
|
2894
2899
|
if (!prev || prev !== cache) {
|
|
2895
2900
|
prev = cache;
|
|
@@ -2915,8 +2920,8 @@ TMS.connect = function(fs, sourceid, callback) {
|
|
|
2915
2920
|
|
|
2916
2921
|
client.on('message', function(msg) {
|
|
2917
2922
|
|
|
2918
|
-
|
|
2919
|
-
|
|
2923
|
+
let type = msg.type || msg.TYPE;
|
|
2924
|
+
let tmp;
|
|
2920
2925
|
|
|
2921
2926
|
switch (type) {
|
|
2922
2927
|
case 'meta':
|
|
@@ -2969,18 +2974,18 @@ TMS.connect = function(fs, sourceid, callback) {
|
|
|
2969
2974
|
|
|
2970
2975
|
case 'publish':
|
|
2971
2976
|
|
|
2972
|
-
if (fs.paused)
|
|
2977
|
+
if (fs.paused || !fs.meta || !fs.meta.flow)
|
|
2973
2978
|
return;
|
|
2974
2979
|
|
|
2975
2980
|
tmp = client.publishers[msg.id];
|
|
2976
2981
|
if (tmp) {
|
|
2977
2982
|
// HACK: very fast validation
|
|
2978
|
-
|
|
2979
|
-
|
|
2983
|
+
let err = new F.TBuilders.ErrorBuilder();
|
|
2984
|
+
let data = F.TJSONSchema.transform(tmp, err, msg.data, true);
|
|
2980
2985
|
if (data) {
|
|
2981
|
-
|
|
2986
|
+
let id = 'pub' + item.id + 'X' + msg.id;
|
|
2982
2987
|
for (let key in fs.meta.flow) {
|
|
2983
|
-
|
|
2988
|
+
let flow = fs.meta.flow[key];
|
|
2984
2989
|
if (flow.component === id)
|
|
2985
2990
|
flow.process(data, client);
|
|
2986
2991
|
}
|
package/index.js
CHANGED
|
@@ -2099,8 +2099,14 @@ F.audit = function(name, $, message, type) {
|
|
|
2099
2099
|
if ($.id)
|
|
2100
2100
|
data.action = $.id;
|
|
2101
2101
|
|
|
2102
|
-
|
|
2103
|
-
|
|
2102
|
+
let files = [];
|
|
2103
|
+
|
|
2104
|
+
if ($.files && $.files.length) {
|
|
2105
|
+
for (let file of $.files)
|
|
2106
|
+
files.push({ name: file.name, filename: file.filename, size: file.size, width: file.width, height: file.height });
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
data.data = JSON.stringify({ params: $.params, query: $.query, model: $.model, files: files }, auditjsonserialization);
|
|
2104
2110
|
|
|
2105
2111
|
if (F.clusterid)
|
|
2106
2112
|
data.instance = F.clusterid;
|
|
@@ -2800,7 +2806,7 @@ F.loadstats = function() {
|
|
|
2800
2806
|
|
|
2801
2807
|
F.usage = function() {
|
|
2802
2808
|
|
|
2803
|
-
|
|
2809
|
+
let memory = process.memoryUsage();
|
|
2804
2810
|
stats.date = NOW;
|
|
2805
2811
|
|
|
2806
2812
|
if (stats.id != F.clusterid)
|
|
@@ -2827,12 +2833,12 @@ F.loadstats = function() {
|
|
|
2827
2833
|
stats.errors = F.stats.error;
|
|
2828
2834
|
stats.timeouts = F.stats.response.timeout;
|
|
2829
2835
|
stats.online = F.stats.performance.online;
|
|
2830
|
-
stats.uptime = F.
|
|
2836
|
+
stats.uptime = F.internal.counter;
|
|
2831
2837
|
stats.download = F.stats.request.size.floor(3);
|
|
2832
2838
|
stats.upload = F.stats.response.size.floor(3);
|
|
2833
2839
|
|
|
2834
|
-
|
|
2835
|
-
|
|
2840
|
+
let err = F.errors[F.errors.length - 1];
|
|
2841
|
+
let timeout = F.timeouts[F.timeouts.length - 1];
|
|
2836
2842
|
|
|
2837
2843
|
stats.lasterror = err ? (err.date.toJSON() + ' ' + (err.name ? (err.name + ' - ') : '') + err.error) : undefined;
|
|
2838
2844
|
stats.lasttimeout = timeout;
|
|
@@ -2881,7 +2887,7 @@ process.on('unhandledRejection', function(e) {
|
|
|
2881
2887
|
});
|
|
2882
2888
|
|
|
2883
2889
|
process.on('uncaughtException', function(e) {
|
|
2884
|
-
|
|
2890
|
+
let err = e + '';
|
|
2885
2891
|
if (err.indexOf('listen EADDRINUSE') !== -1) {
|
|
2886
2892
|
console.log('\nThe IP address and the PORT is already in use.\nYou must change the PORT\'s number or IP address.\n');
|
|
2887
2893
|
process.send && process.send('total:eaddrinuse');
|
package/package.json
CHANGED
package/websocket.js
CHANGED
|
@@ -488,7 +488,14 @@ Controller.prototype.parseinflate = function() {
|
|
|
488
488
|
ctrl.inflatechunks = [];
|
|
489
489
|
ctrl.inflatechunkslength = 0;
|
|
490
490
|
ctrl.inflatelock = true;
|
|
491
|
-
|
|
491
|
+
|
|
492
|
+
try {
|
|
493
|
+
ctrl.inflate.write(buf);
|
|
494
|
+
} catch (e) {
|
|
495
|
+
// invalid block
|
|
496
|
+
self.onerror(e);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
492
499
|
|
|
493
500
|
if (!buf.$continue)
|
|
494
501
|
ctrl.inflate.write(Buffer.from(SOCKET_COMPRESS));
|
|
@@ -575,7 +582,15 @@ Controller.prototype.senddeflate = function() {
|
|
|
575
582
|
ctrl.deflatechunks = [];
|
|
576
583
|
ctrl.deflatechunkslength = 0;
|
|
577
584
|
ctrl.deflatelock = true;
|
|
578
|
-
|
|
585
|
+
|
|
586
|
+
try {
|
|
587
|
+
ctrl.deflate.write(buf);
|
|
588
|
+
} catch (e) {
|
|
589
|
+
// invalid block
|
|
590
|
+
self.onerror(e);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
|
|
579
594
|
ctrl.deflate.flush(function() {
|
|
580
595
|
if (ctrl.deflatechunks) {
|
|
581
596
|
var data = concat(ctrl.deflatechunks, ctrl.deflatechunkslength);
|