node-opcua-samples 2.66.3 → 2.68.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/bin/di_server.js +5 -6
- package/bin/interactive_client.js +6 -6
- package/bin/simple_client.js +1 -1
- package/bin/simple_client_ts.ts +1 -1
- package/bin/simple_server.js +516 -505
- package/dist/simple_client_ts.js +1 -1
- package/dist/simple_client_ts.js.map +1 -1
- package/package.json +4 -4
package/bin/di_server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
const chalk = require("chalk");
|
|
4
|
-
const opcua = require("node-opcua");
|
|
5
3
|
const path = require("path");
|
|
6
4
|
const os = require("os");
|
|
5
|
+
const chalk = require("chalk");
|
|
6
|
+
const opcua = require("node-opcua");
|
|
7
7
|
|
|
8
8
|
Error.stackTraceLimit = Infinity;
|
|
9
9
|
|
|
@@ -107,7 +107,7 @@ server_options.alternateHostname = argv.alternateHostname;
|
|
|
107
107
|
const server = new OPCUAServer(server_options);
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
const hostname =
|
|
110
|
+
const hostname = os.hostname();
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
|
|
@@ -209,8 +209,7 @@ server.on("post_initialize", function() {
|
|
|
209
209
|
|
|
210
210
|
function dumpNode(node) {
|
|
211
211
|
function w(str, width) {
|
|
212
|
-
|
|
213
|
-
return tmp.substr(0, width);
|
|
212
|
+
return str.padEnd(width).substring(0, width);
|
|
214
213
|
}
|
|
215
214
|
return Object.entries(node).map((key,value) =>
|
|
216
215
|
" " + w(key, 30) + " : " + ((value === null) ? null : value.toString())
|
|
@@ -261,7 +260,7 @@ server.on("session_closed", function(session, reason) {
|
|
|
261
260
|
});
|
|
262
261
|
|
|
263
262
|
function w(s, w) {
|
|
264
|
-
return (
|
|
263
|
+
return s.toString().padStart(w,"0");
|
|
265
264
|
}
|
|
266
265
|
function t(d) {
|
|
267
266
|
return w(d.getHours(), 2) + ":" + w(d.getMinutes(), 2) + ":" + w(d.getSeconds(), 2) + ":" + w(d.getMilliseconds(), 3);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* eslint-disable no-case-declarations */
|
|
2
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-case-declarations */
|
|
3
3
|
/* eslint no-process-exit: 0 */
|
|
4
4
|
"use strict";
|
|
5
5
|
const chalk = require("chalk");
|
|
@@ -44,7 +44,7 @@ let curNodeCompletion = [];
|
|
|
44
44
|
|
|
45
45
|
function save_endpoint_history(callback) {
|
|
46
46
|
if (endpoints_history.length > 0) {
|
|
47
|
-
fs.writeFileSync(endpoints_history_file, endpoints_history.join("\n"), "
|
|
47
|
+
fs.writeFileSync(endpoints_history_file, endpoints_history.join("\n"), "utf-8");
|
|
48
48
|
}
|
|
49
49
|
if (callback) {
|
|
50
50
|
callback();
|
|
@@ -63,7 +63,7 @@ let lines = [];
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
if (fs.existsSync(endpoints_history_file)) {
|
|
66
|
-
lines = fs.readFileSync(endpoints_history_file, "
|
|
66
|
+
lines = fs.readFileSync(endpoints_history_file, "utf-8");
|
|
67
67
|
endpoints_history = lines.split(/\r\n|\n/);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -118,12 +118,12 @@ rl.prompt();
|
|
|
118
118
|
|
|
119
119
|
function save_history(callback) {
|
|
120
120
|
const history_uniq = _.uniq(rl.history);
|
|
121
|
-
fs.writeFileSync(history_file, history_uniq.join("\n"), "
|
|
121
|
+
fs.writeFileSync(history_file, history_uniq.join("\n"), "utf-8");
|
|
122
122
|
callback();
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
function w(str, width) {
|
|
126
|
-
return (
|
|
126
|
+
return str.padEnd(width," ").substring(0, width);
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* @method toDate
|
|
@@ -297,7 +297,7 @@ function colorize(value) {
|
|
|
297
297
|
if (rl.history) {
|
|
298
298
|
|
|
299
299
|
if (fs.existsSync(history_file)) {
|
|
300
|
-
lines = fs.readFileSync(history_file, "
|
|
300
|
+
lines = fs.readFileSync(history_file, "utf-8");
|
|
301
301
|
lines = lines.split(/\r\n|\n/);
|
|
302
302
|
}
|
|
303
303
|
if (lines.length === 0) {
|
package/bin/simple_client.js
CHANGED
package/bin/simple_client_ts.ts
CHANGED
|
@@ -50,7 +50,7 @@ const Table = require("easy-table");
|
|
|
50
50
|
const treeify = require("treeify");
|
|
51
51
|
|
|
52
52
|
function w(str: string, l: number): string {
|
|
53
|
-
return (
|
|
53
|
+
return str.padEnd(l).substring(0, l);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
async function enumerateAllConditionTypes(session: ClientSession) {
|