node-opcua-samples 2.124.0 → 2.125.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/bin/interactive_client.js +3 -40
- package/package.json +10 -11
|
@@ -17,7 +17,6 @@ const _ = require("underscore");
|
|
|
17
17
|
const { DataType, OPCUAClient, makeNodeId, coerceNodeId, ObjectIds, StatusCodes, parseEndpointUrl } = require("node-opcua");
|
|
18
18
|
const { UAProxyManager } = require("node-opcua-client-proxy");
|
|
19
19
|
const { analyze_object_binary_encoding } = require("node-opcua-packet-analyzer");
|
|
20
|
-
const { NodeCrawler } = require("node-opcua-client-crawler");
|
|
21
20
|
const utils = require("node-opcua-utils");
|
|
22
21
|
const { assert } = require("node-opcua-assert");
|
|
23
22
|
|
|
@@ -32,7 +31,6 @@ const client = OPCUAClient.create({
|
|
|
32
31
|
let the_session = null;
|
|
33
32
|
let proxyManager = null;
|
|
34
33
|
|
|
35
|
-
let crawler = null;
|
|
36
34
|
let dumpPacket = false;
|
|
37
35
|
const dumpMessageChunk = false;
|
|
38
36
|
let endpoints_history = [];
|
|
@@ -90,7 +88,7 @@ function completer(line, callback) {
|
|
|
90
88
|
completions = "open quit".split(" ");
|
|
91
89
|
}
|
|
92
90
|
} else {
|
|
93
|
-
completions = "browse read readall
|
|
91
|
+
completions = "browse read readall closeSession disconnect quit getEndpoints".split(" ");
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
assert(completions.length >= 0);
|
|
@@ -395,9 +393,6 @@ function open_session(callback) {
|
|
|
395
393
|
|
|
396
394
|
the_prompt = chalk.cyan("session:") + chalk.yellow(the_session.sessionId.toString()) + chalk.cyan(">");
|
|
397
395
|
rl.setPrompt(the_prompt);
|
|
398
|
-
|
|
399
|
-
assert(!crawler);
|
|
400
|
-
|
|
401
396
|
rl.prompt(the_prompt);
|
|
402
397
|
}
|
|
403
398
|
callback();
|
|
@@ -405,7 +400,6 @@ function open_session(callback) {
|
|
|
405
400
|
client.on("close", function () {
|
|
406
401
|
log(chalk.red(" Server has disconnected "));
|
|
407
402
|
the_session = null;
|
|
408
|
-
crawler = null;
|
|
409
403
|
});
|
|
410
404
|
}
|
|
411
405
|
}
|
|
@@ -414,7 +408,6 @@ function close_session(outer_callback) {
|
|
|
414
408
|
apply_on_valid_session("closeSession", function (session, inner_callback) {
|
|
415
409
|
session.close(function (err) {
|
|
416
410
|
the_session = null;
|
|
417
|
-
crawler = null;
|
|
418
411
|
if (!outer_callback) {
|
|
419
412
|
inner_callback(err);
|
|
420
413
|
} else {
|
|
@@ -573,7 +566,7 @@ function process_line(line) {
|
|
|
573
566
|
endTime = startTime;
|
|
574
567
|
startTime = tmp;
|
|
575
568
|
}
|
|
576
|
-
nodes = nodes.map(coerceNodeId);
|
|
569
|
+
nodes = nodes.map((n)=>coerceNodeId(n));
|
|
577
570
|
|
|
578
571
|
the_session.readHistoryValue(nodes, startTime, endTime, function (err, historyReadResults) {
|
|
579
572
|
if (err) {
|
|
@@ -600,7 +593,7 @@ function process_line(line) {
|
|
|
600
593
|
case "read":
|
|
601
594
|
apply_on_valid_session(cmd, function (the_session, callback) {
|
|
602
595
|
nodes = [args[1]];
|
|
603
|
-
nodes = nodes.map(coerceNodeId);
|
|
596
|
+
nodes = nodes.map((n)=>coerceNodeId(n));
|
|
604
597
|
|
|
605
598
|
the_session.readVariableValue(nodes, function (err, dataValues) {
|
|
606
599
|
if (err) {
|
|
@@ -652,36 +645,6 @@ function process_line(line) {
|
|
|
652
645
|
});
|
|
653
646
|
});
|
|
654
647
|
break;
|
|
655
|
-
case "crawl":
|
|
656
|
-
{
|
|
657
|
-
apply_on_valid_session(cmd, function (the_session, callback) {
|
|
658
|
-
if (!crawler) {
|
|
659
|
-
crawler = new NodeCrawler(the_session);
|
|
660
|
-
crawler.on("browsed", function (element) {
|
|
661
|
-
// log("->",element.browseName.name,element.nodeId.toString());
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
const nodeId = args[1] || "ObjectsFolder";
|
|
666
|
-
log("now crawling " + chalk.yellow(nodeId) + " ...please wait...");
|
|
667
|
-
crawler.read(nodeId, function (err, obj) {
|
|
668
|
-
if (!err) {
|
|
669
|
-
log(" crawling done ");
|
|
670
|
-
// todo : treeify.asTree performance is *very* slow on large object, replace with better implementation
|
|
671
|
-
//xx log(treeify.asTree(obj, true));
|
|
672
|
-
treeify.asLines(obj, true, true, function (line) {
|
|
673
|
-
log(line);
|
|
674
|
-
});
|
|
675
|
-
} else {
|
|
676
|
-
log("err ", err.message);
|
|
677
|
-
}
|
|
678
|
-
crawler = null;
|
|
679
|
-
callback();
|
|
680
|
-
});
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
break;
|
|
684
|
-
|
|
685
648
|
case ".info":
|
|
686
649
|
log(" bytesRead ", client.bytesRead, " bytes");
|
|
687
650
|
log(" bytesWritten ", client.bytesWritten, " bytes");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-samples",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.125.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module samples",
|
|
5
5
|
"bin": {
|
|
6
6
|
"simple_client": "./dist/simple_client_ts.js",
|
|
@@ -24,18 +24,17 @@
|
|
|
24
24
|
"easy-table": "^1.2.0",
|
|
25
25
|
"env-paths": "2.2.1",
|
|
26
26
|
"exit": "^0.1.2",
|
|
27
|
-
"node-opcua": "2.
|
|
28
|
-
"node-opcua-address-space": "2.
|
|
29
|
-
"node-opcua-address-space-for-conformance-testing": "2.
|
|
27
|
+
"node-opcua": "2.125.0",
|
|
28
|
+
"node-opcua-address-space": "2.125.0",
|
|
29
|
+
"node-opcua-address-space-for-conformance-testing": "2.125.0",
|
|
30
30
|
"node-opcua-assert": "2.120.0",
|
|
31
|
-
"node-opcua-client-
|
|
32
|
-
"node-opcua-client-proxy": "2.124.0",
|
|
31
|
+
"node-opcua-client-proxy": "2.125.0",
|
|
33
32
|
"node-opcua-crypto": "4.8.0",
|
|
34
|
-
"node-opcua-packet-analyzer": "2.
|
|
33
|
+
"node-opcua-packet-analyzer": "2.125.0",
|
|
35
34
|
"node-opcua-pki": "4.10.0",
|
|
36
|
-
"node-opcua-server-configuration": "2.
|
|
37
|
-
"node-opcua-utils": "2.
|
|
38
|
-
"node-opcua-vendor-diagnostic": "2.
|
|
35
|
+
"node-opcua-server-configuration": "2.125.0",
|
|
36
|
+
"node-opcua-utils": "2.125.0",
|
|
37
|
+
"node-opcua-vendor-diagnostic": "2.125.0",
|
|
39
38
|
"sprintf-js": "^1.1.3",
|
|
40
39
|
"treeify": "^1.1.0",
|
|
41
40
|
"underscore": "^1.13.6",
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
"internet of things"
|
|
57
56
|
],
|
|
58
57
|
"homepage": "http://node-opcua.github.io/",
|
|
59
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "a0e0a2f1045e6e402dd4619c625c90008f0617ed",
|
|
60
59
|
"files": [
|
|
61
60
|
"dist"
|
|
62
61
|
]
|