opcua-webapi-ts 1.1.28 → 1.2.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.
@@ -48,7 +48,7 @@ class UaReferenceTypeDictionary {
48
48
  return;
49
49
  // Read child type
50
50
  let nodeIdsToBrowse = [];
51
- let nodeReader = new UaNodeReader_1.UaNodeReader(this._client, false, false, false, common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), false, false, false, false, false);
51
+ let nodeReader = new UaNodeReader_1.UaNodeReader(this._client, false, false, false, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasProperty), false, false, false, false, false);
52
52
  let nodes = yield nodeReader.readByReferences(referencesToRead);
53
53
  for (let node of nodes) {
54
54
  if (opcua_webapi_1.NodeClass.ReferenceType != node.nodeClass)
@@ -25,7 +25,9 @@ class UaReferenceType extends _1.UaDefinitionNode {
25
25
  name: this._browseName,
26
26
  displayName: this._displayName.text,
27
27
  description: (this._description) ? this._description.text : undefined,
28
- isAbstract: this._isAbstract
28
+ isAbstract: this._isAbstract,
29
+ inverseName: this.inverseName.text,
30
+ symmetric: this.symmetric
29
31
  };
30
32
  return ret;
31
33
  }
@@ -41,17 +41,28 @@ class UaExpandedNodeId {
41
41
  return null;
42
42
  }
43
43
  toString() {
44
- // To be implemented
45
- return this._nodeId.toString();
44
+ let str = this._nodeId.toString();
45
+ if (this._serverIndex) {
46
+ str = "svr=" + this._serverIndex + ";" + str;
47
+ }
48
+ return str;
46
49
  }
47
50
  static from(nodeId) {
48
51
  return new UaExpandedNodeId(nodeId);
49
52
  }
50
53
  }
51
54
  exports.UaExpandedNodeId = UaExpandedNodeId;
55
+ const regexSvr = /^svr=([0-9]+);/;
52
56
  function parseUaExpandedNodeId(value) {
53
- let nodeId = (0, _1.parseUaNodeId)(value);
54
- return new UaExpandedNodeId(nodeId, null, 0);
57
+ let serverIndex = 0;
58
+ let nodeIdStr = value;
59
+ let matches = regexSvr.exec(value);
60
+ if (matches !== null) {
61
+ serverIndex = parseInt(matches[1], 10);
62
+ nodeIdStr = value.substring(matches[0].length);
63
+ }
64
+ let nodeId = (0, _1.parseUaNodeId)(nodeIdStr);
65
+ return new UaExpandedNodeId(nodeId, null, serverIndex);
55
66
  }
56
67
  function parseUaExpandedNodeIdOrNull(value) {
57
68
  if (!value)
@@ -48,7 +48,7 @@ class UaReferenceTypeDictionary {
48
48
  return;
49
49
  // Read child type
50
50
  let nodeIdsToBrowse = [];
51
- let nodeReader = new UaNodeReader_1.UaNodeReader(this._client, false, false, false, common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), false, false, false, false, false);
51
+ let nodeReader = new UaNodeReader_1.UaNodeReader(this._client, false, false, false, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasProperty), false, false, false, false, false);
52
52
  let nodes = yield nodeReader.readByReferences(referencesToRead);
53
53
  for (let node of nodes) {
54
54
  if (opcua_webapi_1.NodeClass.ReferenceType != node.nodeClass)
@@ -25,7 +25,9 @@ class UaReferenceType extends _1.UaDefinitionNode {
25
25
  name: this._browseName,
26
26
  displayName: this._displayName.text,
27
27
  description: (this._description) ? this._description.text : undefined,
28
- isAbstract: this._isAbstract
28
+ isAbstract: this._isAbstract,
29
+ inverseName: this.inverseName.text,
30
+ symmetric: this.symmetric
29
31
  };
30
32
  return ret;
31
33
  }
@@ -41,17 +41,28 @@ class UaExpandedNodeId {
41
41
  return null;
42
42
  }
43
43
  toString() {
44
- // To be implemented
45
- return this._nodeId.toString();
44
+ let str = this._nodeId.toString();
45
+ if (this._serverIndex) {
46
+ str = "svr=" + this._serverIndex + ";" + str;
47
+ }
48
+ return str;
46
49
  }
47
50
  static from(nodeId) {
48
51
  return new UaExpandedNodeId(nodeId);
49
52
  }
50
53
  }
51
54
  exports.UaExpandedNodeId = UaExpandedNodeId;
55
+ const regexSvr = /^svr=([0-9]+);/;
52
56
  function parseUaExpandedNodeId(value) {
53
- let nodeId = (0, _1.parseUaNodeId)(value);
54
- return new UaExpandedNodeId(nodeId, null, 0);
57
+ let serverIndex = 0;
58
+ let nodeIdStr = value;
59
+ let matches = regexSvr.exec(value);
60
+ if (matches !== null) {
61
+ serverIndex = parseInt(matches[1], 10);
62
+ nodeIdStr = value.substring(matches[0].length);
63
+ }
64
+ let nodeId = (0, _1.parseUaNodeId)(nodeIdStr);
65
+ return new UaExpandedNodeId(nodeId, null, serverIndex);
55
66
  }
56
67
  function parseUaExpandedNodeIdOrNull(value) {
57
68
  if (!value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opcua-webapi-ts",
3
- "version": "1.1.28",
3
+ "version": "1.2.1",
4
4
  "description": "Provides OPC UA WebAPI wrapper and client based on opcua-webapi-typescript",
5
5
  "author": "DingYan",
6
6
  "license": "MIT",