@weave-js/core 0.14.1 → 0.15.1
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/errorHandler.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.errorHandler = ({ options }, error) => {
|
|
|
8
8
|
exports.fatalErrorHandler = (runtime, message, error, killProcess = true) => {
|
|
9
9
|
const { options, log } = runtime;
|
|
10
10
|
if (options.logger.enabled) {
|
|
11
|
-
log.fatal(error, message);
|
|
11
|
+
log.fatal({ error }, message);
|
|
12
12
|
} else {
|
|
13
13
|
console.error(message, error);
|
|
14
14
|
}
|
|
@@ -7,7 +7,7 @@ module.exports = (runtime) => {
|
|
|
7
7
|
context.service._trackedContexts.push(context);
|
|
8
8
|
} else {
|
|
9
9
|
// remote actions
|
|
10
|
-
|
|
10
|
+
runtime.state.trackedContexts.push(context);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -19,9 +19,9 @@ module.exports = (runtime) => {
|
|
|
19
19
|
context.service._trackedContexts.splice(index, 1);
|
|
20
20
|
}
|
|
21
21
|
} else {
|
|
22
|
-
const index =
|
|
22
|
+
const index = runtime.state.trackedContexts.indexOf(context);
|
|
23
23
|
if (index !== -1) {
|
|
24
|
-
|
|
24
|
+
runtime.state.trackedContexts.splice(index, 1);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -85,14 +85,18 @@ exports.createServiceCollection = (registry) => {
|
|
|
85
85
|
withActions = false,
|
|
86
86
|
withEvents = false,
|
|
87
87
|
withNodeService = false,
|
|
88
|
-
withSettings = false
|
|
88
|
+
withSettings = false,
|
|
89
|
+
withPrivate = false
|
|
89
90
|
} = {}) => {
|
|
90
91
|
const result = [];
|
|
91
92
|
services.forEach((service) => {
|
|
92
93
|
if (/^\$node/.test(service.name) && !withNodeService) {
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
+
|
|
97
|
+
const isPrivate = service.settings && service.settings.$private;
|
|
98
|
+
|
|
99
|
+
if (isPrivate && withPrivate === false) {
|
|
96
100
|
return;
|
|
97
101
|
}
|
|
98
102
|
|
|
@@ -104,7 +108,8 @@ exports.createServiceCollection = (registry) => {
|
|
|
104
108
|
name: service.name,
|
|
105
109
|
nodeId: service.node.id,
|
|
106
110
|
version: service.version,
|
|
107
|
-
isAvailable: service.node.isAvailable
|
|
111
|
+
isAvailable: service.node.isAvailable,
|
|
112
|
+
isPrivate
|
|
108
113
|
};
|
|
109
114
|
|
|
110
115
|
if (withSettings) {
|
|
@@ -431,11 +431,12 @@ module.exports = (runtime, transport) => {
|
|
|
431
431
|
// todo: check protocol version
|
|
432
432
|
// todo: check node ID conflict
|
|
433
433
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
434
|
+
if (payload.sender === runtime.nodeId) {
|
|
435
|
+
if (type === MessageTypes.MESSAGE_INFO && payload.instanceId !== runtime.state.instanceId) {
|
|
436
|
+
runtime.fatalError(`Weave broker has detected a node ID conflict. "nodeId" of broker needs to be unique, but there is an broker with node ID "${runtime.nodeId}". Broker will be stopped.`);
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
439
440
|
|
|
440
441
|
switch (type) {
|
|
441
442
|
case MessageTypes.MESSAGE_DISCOVERY:
|
package/lib/types.js
CHANGED
|
@@ -626,6 +626,7 @@ const { EventEmitter2: EventEmitter } = require('eventemitter2');
|
|
|
626
626
|
* @property {boolean} [withEvents=false] Include events in result.
|
|
627
627
|
* @property {boolean} [withNodeService=false] Include node service.
|
|
628
628
|
* @property {boolean} [withSettings=false] Include service settings.
|
|
629
|
+
* @property {boolean} [withPrivate=false] Include private services.
|
|
629
630
|
*/
|
|
630
631
|
|
|
631
632
|
/**
|