unetjs 3.2.3 → 4.0.0
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/README.md +6 -0
- package/dist/cjs/unet.cjs +10 -12
- package/dist/esm/unet.js +10 -12
- package/dist/unetjs.js +9 -11
- package/dist/unetjs.js.map +1 -1
- package/dist/unetjs.min.js +1 -1
- package/dist/unetjs.min.js.map +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -15,6 +15,12 @@ $ npm install unetjs
|
|
|
15
15
|
|
|
16
16
|
The API documentation of the latest version of unet.js is published at [https://github.com/org-arl/unet-contrib/tree/master/unetsocket/js/docs](https://github.com/org-arl/unet-contrib/tree/master/unetsocket/js/docs)
|
|
17
17
|
|
|
18
|
+
## Versions
|
|
19
|
+
|
|
20
|
+
### unetjs v4.0.0
|
|
21
|
+
|
|
22
|
+
unetjs v4.0.0 picks up the breaking change in fjage.js v2.0.0. It enables automatic registration of subscriptions with the master container using `WANTS_MESSAGES_FOR` action. This is done everytime a fjage.js client subscribes to a topic. A change in fjåge to support a non-aggregating `WebSocketConnector` enabled this performance in fjage.js. So **unetjs v4.0.0 is only compatible with fjage.js v2.0.0 and above**.
|
|
23
|
+
|
|
18
24
|
## Usage
|
|
19
25
|
|
|
20
26
|
### Pre-defined Messages and Services
|
package/dist/cjs/unet.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* unet.js
|
|
1
|
+
/* unet.js v4.0.0 2025-04-30T04:14:27.851Z */
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/* fjage.js
|
|
5
|
+
/* fjage.js v2.0.0 */
|
|
6
6
|
|
|
7
7
|
const isBrowser =
|
|
8
8
|
typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
@@ -561,9 +561,10 @@ class AgentID {
|
|
|
561
561
|
} else if (Array.isArray(params)) {
|
|
562
562
|
if (!rsp.values) rsp.values = {};
|
|
563
563
|
if (rsp.param) rsp.values[rsp.param] = rsp.value;
|
|
564
|
-
const
|
|
565
|
-
return params.map(p => {
|
|
566
|
-
|
|
564
|
+
const rkeys = Object.keys(rsp.values);
|
|
565
|
+
return params.map( p => {
|
|
566
|
+
if (p.includes('.')) p = p.split('.').pop();
|
|
567
|
+
let f = rkeys.find(k => (k.includes('.') ? k.split('.').pop() : k) == p);
|
|
567
568
|
return f ? rsp.values[f] : undefined;
|
|
568
569
|
});
|
|
569
570
|
} else {
|
|
@@ -991,13 +992,10 @@ class Gateway {
|
|
|
991
992
|
|
|
992
993
|
/** @private */
|
|
993
994
|
_update_watch() {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
// watch.push(this.aid.getName());
|
|
999
|
-
// let rq = { action: 'wantsMessagesFor', agentIDs: watch };
|
|
1000
|
-
// this._msgTx(rq);
|
|
995
|
+
let watch = Object.keys(this.subscriptions);
|
|
996
|
+
watch.push(this.aid.getName());
|
|
997
|
+
let rq = { action: 'wantsMessagesFor', agentIDs: watch };
|
|
998
|
+
this._msgTx(rq);
|
|
1001
999
|
}
|
|
1002
1000
|
|
|
1003
1001
|
/**
|
package/dist/esm/unet.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* unet.js
|
|
1
|
+
/* unet.js v4.0.0 2025-04-30T04:14:27.851Z */
|
|
2
2
|
|
|
3
|
-
/* fjage.js
|
|
3
|
+
/* fjage.js v2.0.0 */
|
|
4
4
|
|
|
5
5
|
const isBrowser =
|
|
6
6
|
typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
@@ -559,9 +559,10 @@ class AgentID {
|
|
|
559
559
|
} else if (Array.isArray(params)) {
|
|
560
560
|
if (!rsp.values) rsp.values = {};
|
|
561
561
|
if (rsp.param) rsp.values[rsp.param] = rsp.value;
|
|
562
|
-
const
|
|
563
|
-
return params.map(p => {
|
|
564
|
-
|
|
562
|
+
const rkeys = Object.keys(rsp.values);
|
|
563
|
+
return params.map( p => {
|
|
564
|
+
if (p.includes('.')) p = p.split('.').pop();
|
|
565
|
+
let f = rkeys.find(k => (k.includes('.') ? k.split('.').pop() : k) == p);
|
|
565
566
|
return f ? rsp.values[f] : undefined;
|
|
566
567
|
});
|
|
567
568
|
} else {
|
|
@@ -989,13 +990,10 @@ class Gateway {
|
|
|
989
990
|
|
|
990
991
|
/** @private */
|
|
991
992
|
_update_watch() {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
// watch.push(this.aid.getName());
|
|
997
|
-
// let rq = { action: 'wantsMessagesFor', agentIDs: watch };
|
|
998
|
-
// this._msgTx(rq);
|
|
993
|
+
let watch = Object.keys(this.subscriptions);
|
|
994
|
+
watch.push(this.aid.getName());
|
|
995
|
+
let rq = { action: 'wantsMessagesFor', agentIDs: watch };
|
|
996
|
+
this._msgTx(rq);
|
|
999
997
|
}
|
|
1000
998
|
|
|
1001
999
|
/**
|
package/dist/unetjs.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.unet = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
/* fjage.js
|
|
7
|
+
/* fjage.js v2.0.0 */
|
|
8
8
|
|
|
9
9
|
const isBrowser =
|
|
10
10
|
typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
@@ -563,9 +563,10 @@
|
|
|
563
563
|
} else if (Array.isArray(params)) {
|
|
564
564
|
if (!rsp.values) rsp.values = {};
|
|
565
565
|
if (rsp.param) rsp.values[rsp.param] = rsp.value;
|
|
566
|
-
const
|
|
567
|
-
return params.map(p => {
|
|
568
|
-
|
|
566
|
+
const rkeys = Object.keys(rsp.values);
|
|
567
|
+
return params.map( p => {
|
|
568
|
+
if (p.includes('.')) p = p.split('.').pop();
|
|
569
|
+
let f = rkeys.find(k => (k.includes('.') ? k.split('.').pop() : k) == p);
|
|
569
570
|
return f ? rsp.values[f] : undefined;
|
|
570
571
|
});
|
|
571
572
|
} else {
|
|
@@ -993,13 +994,10 @@
|
|
|
993
994
|
|
|
994
995
|
/** @private */
|
|
995
996
|
_update_watch() {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
// watch.push(this.aid.getName());
|
|
1001
|
-
// let rq = { action: 'wantsMessagesFor', agentIDs: watch };
|
|
1002
|
-
// this._msgTx(rq);
|
|
997
|
+
let watch = Object.keys(this.subscriptions);
|
|
998
|
+
watch.push(this.aid.getName());
|
|
999
|
+
let rq = { action: 'wantsMessagesFor', agentIDs: watch };
|
|
1000
|
+
this._msgTx(rq);
|
|
1003
1001
|
}
|
|
1004
1002
|
|
|
1005
1003
|
/**
|