node-opcua-samples 2.97.0 → 2.98.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.
Files changed (41) hide show
  1. package/dist/get_endpoints.d.ts +2 -2
  2. package/dist/get_endpoints.js +141 -141
  3. package/dist/mini_server.d.ts +1 -1
  4. package/dist/mini_server.js +88 -88
  5. package/dist/server_with_changing_password.d.ts +1 -1
  6. package/dist/server_with_changing_password.js +100 -100
  7. package/dist/server_with_push_certificate.d.ts +2 -2
  8. package/dist/server_with_push_certificate.js +111 -111
  9. package/dist/simple_client_ts.d.ts +2 -2
  10. package/dist/simple_client_ts.js +661 -661
  11. package/dist/simple_findservers.d.ts +2 -2
  12. package/dist/simple_findservers.js +48 -48
  13. package/dist/simple_secure_server.d.ts +2 -2
  14. package/dist/simple_secure_server.js +125 -125
  15. package/dist/simple_server_with_custom_extension_objects.d.ts +2 -2
  16. package/dist/simple_server_with_custom_extension_objects.js +81 -81
  17. package/dist/stressing_client.d.ts +1 -1
  18. package/dist/stressing_client.js +36 -36
  19. package/dist/tiny_client.d.ts +1 -1
  20. package/dist/tiny_client.js +32 -32
  21. package/package.json +15 -12
  22. package/bin/createOPCUACertificate.cmd +0 -6
  23. package/bin/create_certificates.js +0 -2
  24. package/bin/crypto_create_CA.js +0 -2
  25. package/bin/demo_server_with_alarm.js +0 -51
  26. package/bin/findServersOnNetwork.js +0 -32
  27. package/bin/get_endpoints.ts +0 -166
  28. package/bin/machineryServer.js +0 -83
  29. package/bin/mini_server.ts +0 -106
  30. package/bin/more.js +0 -40
  31. package/bin/node-opcua.js +0 -2
  32. package/bin/opcua_interceptor.js +0 -122
  33. package/bin/server_with_changing_password.ts +0 -97
  34. package/bin/server_with_push_certificate.ts +0 -122
  35. package/bin/simple_client.js +0 -830
  36. package/bin/simple_client_ts.ts +0 -847
  37. package/bin/simple_findservers.ts +0 -45
  38. package/bin/simple_secure_server.ts +0 -152
  39. package/bin/simple_server_with_custom_extension_objects.ts +0 -89
  40. package/bin/stressing_client.ts +0 -28
  41. package/bin/tiny_client.ts +0 -24
@@ -1,33 +1,33 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- process.env.NODEOPCUADEBUG = "CLIENT{TRACE};TRANSPORT{CHUNK-HELACK}";
13
- const node_opcua_1 = require("node-opcua");
14
- (() => __awaiter(void 0, void 0, void 0, function* () {
15
- const client = node_opcua_1.OPCUAClient.create({
16
- requestedSessionTimeout: 1000,
17
- transportSettings: {
18
- maxChunkCount: 1,
19
- maxMessageSize: 1 * 8192,
20
- receiveBufferSize: 8 * 1024,
21
- sendBufferSize: 8 * 1024
22
- },
23
- connectionStrategy: {
24
- initialDelay: 10,
25
- maxDelay: 100,
26
- maxRetry: 2
27
- }
28
- });
29
- yield client.connect("opc.tcp://localhost:48010");
30
- // await client.connect("opc.tcp://localhost:53530");
31
- yield client.disconnect();
32
- }))();
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ process.env.NODEOPCUADEBUG = "CLIENT{TRACE};TRANSPORT{CHUNK-HELACK}";
13
+ const node_opcua_1 = require("node-opcua");
14
+ (() => __awaiter(void 0, void 0, void 0, function* () {
15
+ const client = node_opcua_1.OPCUAClient.create({
16
+ requestedSessionTimeout: 1000,
17
+ transportSettings: {
18
+ maxChunkCount: 1,
19
+ maxMessageSize: 1 * 8192,
20
+ receiveBufferSize: 8 * 1024,
21
+ sendBufferSize: 8 * 1024
22
+ },
23
+ connectionStrategy: {
24
+ initialDelay: 10,
25
+ maxDelay: 100,
26
+ maxRetry: 2
27
+ }
28
+ });
29
+ yield client.connect("opc.tcp://localhost:48010");
30
+ // await client.connect("opc.tcp://localhost:53530");
31
+ yield client.disconnect();
32
+ }))();
33
33
  //# sourceMappingURL=tiny_client.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-opcua-samples",
3
- "version": "2.97.0",
4
- "description": "pure nodejs OPCUA SDK - module -samples",
3
+ "version": "2.98.1",
4
+ "description": "pure nodejs OPCUA SDK - module samples",
5
5
  "bin": {
6
6
  "simple_client": "./dist/simple_client_ts.js",
7
7
  "interactive_client": "./bin/interactive_client.js",
@@ -17,21 +17,21 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@types/underscore": "^1.11.4",
20
- "@types/yargs": "17.0.22",
20
+ "@types/yargs": "17.0.24",
21
21
  "chalk": "4.1.2",
22
22
  "easy-table": "^1.2.0",
23
23
  "env-paths": "2.2.1",
24
24
  "exit": "^0.1.2",
25
- "node-opcua": "2.97.0",
26
- "node-opcua-address-space": "2.97.0",
27
- "node-opcua-address-space-for-conformance-testing": "2.97.0",
28
- "node-opcua-assert": "2.88.0",
29
- "node-opcua-client-crawler": "2.97.0",
25
+ "node-opcua": "2.98.1",
26
+ "node-opcua-address-space": "2.98.1",
27
+ "node-opcua-address-space-for-conformance-testing": "2.98.1",
28
+ "node-opcua-assert": "2.98.1",
29
+ "node-opcua-client-crawler": "2.98.1",
30
30
  "node-opcua-crypto": "^2.1.2",
31
31
  "node-opcua-pki": "^3.0.2",
32
- "node-opcua-server-configuration": "2.97.0",
33
- "node-opcua-utils": "2.90.1",
34
- "node-opcua-vendor-diagnostic": "2.97.0",
32
+ "node-opcua-server-configuration": "2.98.1",
33
+ "node-opcua-utils": "2.98.1",
34
+ "node-opcua-vendor-diagnostic": "2.98.1",
35
35
  "sprintf-js": "^1.1.2",
36
36
  "treeify": "^1.1.0",
37
37
  "underscore": "^1.13.6",
@@ -52,5 +52,8 @@
52
52
  "internet of things"
53
53
  ],
54
54
  "homepage": "http://node-opcua.github.io/",
55
- "gitHead": "19c96bda0810d2dec73dd1c2427546be40908646"
55
+ "gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c",
56
+ "files": [
57
+ "dist"
58
+ ]
56
59
  }
@@ -1,6 +0,0 @@
1
-
2
- SET BASE=%~dp0%
3
- echo applicationUri %1
4
- echo output %2
5
-
6
- node %BASE%\crypto_create_CA.js certificate --selfSigned --applicationUri %1 -o %2
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- require("node-opcua-pki/bin/crypto_create_CA");
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- require("node-opcua-pki/bin/crypto_create_CA");
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- const path = require("path");
4
- const { OPCUAServer, nodesets } = require("node-opcua");
5
- const { construct_demo_alarm_in_address_space } = require("node-opcua-address-space/testHelpers");
6
-
7
-
8
- const nodeset_filenames = [nodesets.standard];
9
-
10
- const port = 4334;
11
-
12
- const server = new OPCUAServer({
13
- port, // the port of the listening socket of the server
14
- resourcePath: "/UA/MyLittleServer", // this path will be added to the endpoint resource name
15
- buildInfo: {
16
- productName: "urn:DemoAlarmServer",
17
- buildNumber: "1",
18
- buildDate: new Date(2016, 9, 27)
19
- },
20
- nodeset_filename: nodeset_filenames
21
- });
22
-
23
- function post_initialize() {
24
- function construct_my_address_space(server) {
25
- const addressSpace = server.engine.addressSpace;
26
-
27
- const data = {};
28
- construct_demo_alarm_in_address_space(data, addressSpace);
29
-
30
- let time = 1;
31
- function simulate_variation() {
32
- const value = (1.0 + Math.sin((time / 360) * 3)) / 2.0;
33
- data.tankLevel.setValueFromSource({ dataType: "Double", value: value });
34
-
35
- data.tankLevel2.setValueFromSource({ dataType: "Double", value: value });
36
-
37
- time += 1;
38
- }
39
- setInterval(simulate_variation, 200);
40
- simulate_variation();
41
- }
42
- construct_my_address_space(server);
43
-
44
- server.start(function () {
45
- console.log("Server is now listening ... ( press CTRL+C to stop)");
46
- console.log("port ", server.endpoints[0].port);
47
- const endpointUrl = server.getEndpointUrl();
48
- console.log(" the primary server endpoint url is ", endpointUrl);
49
- });
50
- }
51
- server.initialize(post_initialize);
@@ -1,32 +0,0 @@
1
- const opcua = require("node-opcua");
2
-
3
-
4
- const yargs = require("yargs/yargs");
5
-
6
- const argv = yargs(process.argv)
7
- .wrap(132)
8
- .string("capabilities")
9
- .default("capabilities","DA")
10
- .alias("c","capabilities")
11
-
12
- .string("discoveryServerURI")
13
- .default("discoveryServerURI","opc.tcp://localhost:4840")
14
- .alias("d","discoveryServerURI")
15
-
16
- .help(true)
17
- .argv;
18
-
19
- const capabilities = argv.capabilities || "LDS";
20
-
21
- const discovery_server_endpointUrl = argv.discoveryServerURI || "opc.tcp://localhost:4840";
22
-
23
- opcua.findServersOnNetwork(discovery_server_endpointUrl, function (err, servers) {
24
- if(err) {
25
- console.log("Error : ", err.message);
26
- return;
27
- }
28
-
29
- for (const s of servers) {
30
- console.log(s.toString());
31
- }
32
- });
@@ -1,166 +0,0 @@
1
- #!/usr/bin/env ts-node
2
- // tslint:disable:no-console
3
- import * as chalk from "chalk";
4
- import * as fs from "fs";
5
- import * as path from "path";
6
- import * as yargs from "yargs";
7
-
8
- import {
9
- ApplicationType,
10
- coerceMessageSecurityMode,
11
- coerceSecurityPolicy,
12
- MessageSecurityMode,
13
- OPCUAClient,
14
- OPCUAClientOptions,
15
- SecurityPolicy,
16
- UserTokenType
17
- } from "node-opcua";
18
- import { Certificate, toPem } from "node-opcua-crypto";
19
-
20
- // tslint:disable:no-var-requires
21
- const Table = require("easy-table");
22
- const treeify = require("treeify");
23
-
24
- // eslint-disable-next-line max-statements
25
- async function main() {
26
- // ts-node bin/simple_client.ts --endpoint opc.tcp://localhost:53530/OPCUA/SimulationServer --node "ns=5;s=Sinusoid1"
27
- const argv = await yargs(process.argv)
28
- .wrap(132)
29
-
30
- .option("endpoint", {
31
- alias: "e",
32
- demandOption: true,
33
- describe: "the end point to connect to "
34
- })
35
- .option("securityMode", {
36
- alias: "s",
37
- default: "None",
38
- describe: "the security mode ( None Sign SignAndEncrypt )"
39
- })
40
- .option("securityPolicy", {
41
- alias: "P",
42
- default: "None",
43
- describe: "the policy mode : (" + Object.keys(SecurityPolicy).join(" - ") + ")"
44
- })
45
- .option("discovery", {
46
- alias: "D",
47
- describe: "specify the endpoint uri of discovery server (by default same as server endpoint uri)"
48
- })
49
- .example("get_endpoints --endpoint opc.tcp://localhost:49230", "").argv;
50
-
51
- const securityMode = coerceMessageSecurityMode(argv.securityMode!);
52
- if (securityMode === MessageSecurityMode.Invalid) {
53
- throw new Error("Invalid Security mode");
54
- }
55
-
56
- const securityPolicy = coerceSecurityPolicy(argv.securityPolicy!);
57
- if (securityPolicy === SecurityPolicy.Invalid) {
58
- throw new Error("Invalid securityPolicy");
59
- }
60
-
61
- console.log(chalk.cyan("securityMode = "), securityMode.toString());
62
- console.log(chalk.cyan("securityPolicy = "), securityPolicy.toString());
63
-
64
- const endpointUrl = argv.endpoint as string;
65
-
66
- if (!endpointUrl) {
67
- yargs.showHelp();
68
- process.exit(0);
69
- }
70
- const discoveryUrl = argv.discovery ? (argv.discovery as string) : endpointUrl;
71
- const optionsInitial: OPCUAClientOptions = {
72
- securityMode,
73
- securityPolicy,
74
-
75
- endpointMustExist: false,
76
-
77
- connectionStrategy: {
78
- initialDelay: 2000,
79
- maxDelay: 10 * 1000,
80
- maxRetry: 10
81
- },
82
-
83
- discoveryUrl
84
- };
85
-
86
- const client = OPCUAClient.create(optionsInitial);
87
-
88
- client.on("backoff", (retry: number, delay: number) => {
89
- console.log(chalk.bgWhite.yellow("backoff attempt #"), retry, " retrying in ", delay / 1000.0, " seconds");
90
- });
91
-
92
- console.log(" connecting to ", chalk.cyan.bold(endpointUrl));
93
- console.log(" strategy", client.connectionStrategy);
94
-
95
- try {
96
- await client.connect(endpointUrl);
97
- } catch (err) {
98
- console.log(chalk.red(" Cannot connect to ") + endpointUrl);
99
- if (err instanceof Error) {
100
- console.log(" Error = ", err.message);
101
- }
102
- return;
103
- }
104
-
105
- const endpoints = await client.getEndpoints();
106
-
107
- if (argv.debug) {
108
- fs.writeFileSync("tmp/endpoints.log", JSON.stringify(endpoints, null, " "));
109
- console.log(treeify.asTree(endpoints, true));
110
- }
111
-
112
- const table = new Table();
113
-
114
- let serverCertificate: Certificate | undefined;
115
-
116
- let i = 0;
117
- for (const endpoint of endpoints) {
118
- table.cell("endpoint", endpoint.endpointUrl + "");
119
- table.cell("Application URI", endpoint.server.applicationUri);
120
- table.cell("Product URI", endpoint.server.productUri);
121
- table.cell("Application Name", endpoint.server.applicationName.text);
122
- table.cell("securityLevel", endpoint.securityLevel);
123
- table.cell("Security Mode", chalk.cyan(MessageSecurityMode[endpoint.securityMode].toString()));
124
- table.cell("securityPolicyUri", chalk.cyan(endpoint.securityPolicyUri));
125
- table.cell("Type", ApplicationType[endpoint.server.applicationType]);
126
- table.cell("certificate", "..." /*endpoint.serverCertificate*/);
127
- endpoint.server.discoveryUrls = endpoint.server.discoveryUrls || [];
128
- table.cell("discoveryUrls", endpoint.server.discoveryUrls.join(" - "));
129
-
130
- serverCertificate = endpoint.serverCertificate;
131
-
132
- const certificate_filename = path.join(__dirname, "../certificates/PKI/server_certificate" + i + ".pem");
133
-
134
- if (serverCertificate) {
135
- fs.writeFile(certificate_filename, toPem(serverCertificate, "CERTIFICATE"), () => {
136
- /**/
137
- });
138
- }
139
- table.newRow();
140
- i++;
141
- }
142
- console.log(table.toString());
143
-
144
- for (const endpoint of endpoints) {
145
- console.log(
146
- "Identify Token for : Security Mode=",
147
- chalk.cyan(MessageSecurityMode[endpoint.securityMode].toString()),
148
- " Policy=",
149
- chalk.cyan(endpoint.securityPolicyUri)
150
- );
151
- const table2 = new Table();
152
- for (const token of endpoint.userIdentityTokens!) {
153
- table2.cell("policyId", token.policyId);
154
- table2.cell("tokenType", UserTokenType[token.tokenType]);
155
- table2.cell("issuedTokenType", token.issuedTokenType);
156
- table2.cell("issuerEndpointUrl", token.issuerEndpointUrl);
157
- table2.cell("securityPolicyUri", token.securityPolicyUri);
158
- table2.newRow();
159
- }
160
- console.log(table2.toString());
161
- }
162
- await client.disconnect();
163
- console.log("success !! ");
164
- process.exit(0);
165
- }
166
- main();
@@ -1,83 +0,0 @@
1
- const { OPCUAServer, nodesets } = require("node-opcua");
2
- const chalk = require("chalk");
3
-
4
- (async () => {
5
-
6
- const server = new OPCUAServer({
7
- nodeset_filename: [
8
- nodesets.standard,
9
- nodesets.di,
10
- nodesets.machinery,
11
- nodesets.cnc,
12
- nodesets.machineTool,
13
- ],
14
- });
15
-
16
-
17
- await server.initialize();
18
-
19
- const addressSpace = server.engine.addressSpace;
20
-
21
- const nsDI = addressSpace.getNamespaceIndex("http://opcfoundation.org/UA/DI/");
22
- const deviceType = addressSpace.findObjectType("DeviceType", nsDI);
23
-
24
- const nsMachinery = addressSpace.getNamespaceIndex("http://opcfoundation.org/UA/Machinery/");
25
-
26
- const machineIdentificationType = addressSpace.findObjectType("MachineIdentificationType", nsMachinery);
27
-
28
- const namespace2 = addressSpace.registerNamespace("urn:MyNameSpaceWithType");
29
- const myDeviceType = namespace2.addObjectType({
30
- browseName: "MyDeviceType",
31
- subtypeOf: deviceType
32
- });
33
-
34
- const myDevice = myDeviceType.instantiate({
35
- browseName: "MyDevice",
36
- organizedBy: addressSpace.rootFolder.objects.deviceSet,
37
- });
38
-
39
- myDevice.addReference({
40
- nodeId: addressSpace.rootFolder.objects.machines,
41
- referenceType: "Organizes",
42
- isForward: false
43
- });
44
-
45
- const machineryIdentification = machineIdentificationType.instantiate({
46
- browseName: "Identification",
47
- // addInOf:
48
- optionals: [
49
- "Location",
50
- "ManufacturerUri",
51
- "MonthOfConstruction",
52
- "YearOfConstruction",
53
- ]
54
- });
55
-
56
- machineryIdentification.location.setValueFromSource({ dataType: "String", value: "Paris" });
57
- machineryIdentification.monthOfConstruction.setValueFromSource({ dataType: "UInt32", value: 10 });
58
- machineryIdentification.yearOfConstruction.setValueFromSource({ dataType: "UInt32", value: 2020 });
59
-
60
- machineryIdentification.addReference({
61
- nodeId: myDevice,
62
- referenceType: "HasAddIn",
63
- isForward: false
64
- });
65
-
66
-
67
- await server.start();
68
-
69
- const endpointUrl = server.getEndpointUrl();
70
-
71
- console.log(chalk.yellow(" server on port :"), chalk.cyan(server.endpoints[0].port.toString()));
72
- console.log(chalk.yellow(" endpointUrl :"), chalk.cyan(endpointUrl));
73
- console.log(chalk.yellow("\n server now waiting for connections. CTRL+C to stop"));
74
-
75
- console.log(chalk.cyan("\nvisit https://www.sterfive.com for more advanced examples and professional support."));
76
-
77
- process.on("SIGINT", async () => {
78
- // only work on li nux apparently
79
- await server.shutdown(1000);
80
- console.log(chalk.red.bold(" shutting down completed "));
81
- process.exit(-1);
82
- });
83
- })();
@@ -1,106 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as path from "path";
3
- import * as os from "os";
4
-
5
- import * as chalk from "chalk";
6
-
7
- import {
8
- makeApplicationUrn,
9
- get_mini_nodeset_filename,
10
- nodesets,
11
- OPCUAServer,
12
- ServerSession,
13
- OPCUACertificateManager,
14
- OPCUAServerOptions
15
- } from "node-opcua";
16
- Error.stackTraceLimit = Infinity;
17
-
18
- const port = 26544;
19
-
20
- import envPaths from "env-paths";
21
- const config = envPaths("MiniNodeOPCUA-Server").config;
22
- const pkiFolder = path.join(config, "PKI");
23
-
24
- const serverOptions: OPCUAServerOptions = {
25
- serverCertificateManager: new OPCUACertificateManager({
26
- rootFolder: pkiFolder
27
- }),
28
-
29
- port,
30
-
31
- maxConnectionsPerEndpoint: 2,
32
-
33
- nodeset_filename: [get_mini_nodeset_filename()],
34
-
35
- serverInfo: {
36
- applicationUri: makeApplicationUrn(os.hostname(), "MiniNodeOPCUA-Server"),
37
- productUri: "Mini NodeOPCUA-Server",
38
-
39
- applicationName: { text: "Mini NodeOPCUA Server", locale: "en" },
40
- gatewayServerUri: null,
41
-
42
- discoveryProfileUri: null,
43
-
44
- discoveryUrls: []
45
- },
46
-
47
- buildInfo: {
48
- buildNumber: "1234"
49
- },
50
-
51
- serverCapabilities: {
52
- maxSessions: 10,
53
-
54
- maxBrowseContinuationPoints: 10,
55
- maxHistoryContinuationPoints: 10,
56
- // maxInactiveLockTime
57
- operationLimits: {
58
- maxNodesPerBrowse: 10,
59
- maxNodesPerHistoryReadData: 6,
60
- maxNodesPerHistoryReadEvents: 10,
61
- maxNodesPerHistoryUpdateData: 10,
62
- maxNodesPerRead: 10,
63
- maxNodesPerWrite: 10
64
- }
65
- },
66
-
67
- isAuditing: false
68
- };
69
-
70
- async function main() {
71
- process.title = "Node OPCUA Server on port : " + serverOptions.port;
72
-
73
- const server = new OPCUAServer(serverOptions);
74
- console.log(chalk.yellow(" server PID :"), process.pid);
75
-
76
- try {
77
- await server.start();
78
- } catch (err) {
79
- console.log(" Server failed to start ... exiting");
80
- process.exit(-3);
81
- }
82
-
83
- const endpointUrl = server.getEndpointUrl()!;
84
-
85
- console.log(chalk.yellow(" server on port :"), server.endpoints[0].port.toString());
86
- console.log(chalk.yellow(" endpointUrl :"), chalk.cyan(endpointUrl));
87
- console.log(chalk.yellow("\n server now waiting for connections. CTRL+C to stop"));
88
-
89
- server.on("create_session", (session: ServerSession) => {
90
- console.log(" SESSION CREATED");
91
- console.log(chalk.cyan(" client application URI: "), session.clientDescription!.applicationUri);
92
- console.log(chalk.cyan(" client product URI: "), session.clientDescription!.productUri);
93
- console.log(chalk.cyan(" client application name: "), session.clientDescription!.applicationName.toString());
94
- console.log(chalk.cyan(" client application type: "), session.clientDescription!.applicationType.toString());
95
- console.log(chalk.cyan(" session name: "), session.sessionName ? session.sessionName.toString() : "<null>");
96
- console.log(chalk.cyan(" session timeout: "), session.sessionTimeout);
97
- console.log(chalk.cyan(" session id: "), session.nodeId);
98
- });
99
-
100
- server.on("session_closed", (session: ServerSession, reason: string) => {
101
- console.log(" SESSION CLOSED :", reason);
102
- console.log(chalk.cyan(" session name: "), session.sessionName ? session.sessionName.toString() : "<null>");
103
- });
104
- }
105
-
106
- main();
package/bin/more.js DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /*
4
- * write a file to the console, preserving the Ansi color decoration
5
- */
6
- const argv = require("yargs")
7
- .usage("Usage: $0 <file>")
8
- .argv;
9
-
10
- const fs = require("fs");
11
-
12
-
13
- function readLines(input, func) {
14
- let remaining = "";
15
-
16
- input.on("data", function (data) {
17
- remaining += data;
18
- let index = remaining.indexOf("\n");
19
- while (index > -1) {
20
- const line = remaining.substring(0, index);
21
- remaining = remaining.substring(index + 1);
22
- func(line);
23
- index = remaining.indexOf("\n");
24
- }
25
- });
26
-
27
- input.on("end", function () {
28
- if (remaining.length > 0) {
29
- func(remaining);
30
- }
31
- });
32
- }
33
-
34
- function func(data) {
35
- console.log(data);
36
- }
37
-
38
- const input = fs.createReadStream(argv._[0]);
39
-
40
- readLines(input, func);
package/bin/node-opcua.js DELETED
@@ -1,2 +0,0 @@
1
- module.exports = require("..");
2
-