node-opcua-address-space 2.138.0 → 2.138.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
- "version": "2.138.0",
3
+ "version": "2.138.1",
4
4
  "description": "pure nodejs OPCUA SDK - module address-space",
5
5
  "main": "./dist/src/index_current.js",
6
6
  "types": "./dist/source/index.d.ts",
@@ -81,7 +81,7 @@
81
81
  "internet of things"
82
82
  ],
83
83
  "homepage": "http://node-opcua.github.io/",
84
- "gitHead": "383bbe814f9261b2bc01a5d0fe476813153bb110",
84
+ "gitHead": "9a9b6ac2281306c90fc0ef55e93c8b773f9edcd2",
85
85
  "files": [
86
86
  "dist",
87
87
  "distHelpers",
@@ -20,50 +20,27 @@ function isValidNodeClass(nodeClass: NodeClass) {
20
20
 
21
21
  const regExp1 = /^(s|i|b|g)=/;
22
22
  const regExp2 = /^ns=[0-9]+;(s|i|b|g)=/;
23
- const hasPropertyRefId = resolveNodeId("HasProperty");
24
- const hasComponentRefId = resolveNodeId("HasComponent");
25
- const hasOrderedComponentRefId = resolveNodeId("HasOrderedComponent");
26
- const hasAddIn = resolveNodeId("HasAddIn");
27
23
  const hasEncoding = resolveNodeId("HasEncoding");
28
24
 
29
25
  type Suffix = string;
30
26
 
31
- // function _identifyParentInReference(references: UAReference[]): [NodeId, Suffix] | null {
32
- // const candidates = references.filter((r: UAReference) => {
33
- // return (
34
- // !r.isForward &&
35
- // (sameNodeId(r.referenceType, hasComponentRefId) ||
36
- // sameNodeId(r.referenceType, hasOrderedComponentRefId) ||
37
- // sameNodeId(r.referenceType, hasPropertyRefId) ||
38
- // sameNodeId(r.referenceType, hasEncoding) ||
39
- // sameNodeId(r.referenceType, hasAddIn))
40
- // );
41
- // });
42
- // assert(candidates.length <= 1);
43
- // if (candidates.length === 0) {
44
- // return null;
45
- // }
46
- // const ref = candidates[0];
47
- // if (sameNodeId(ref.referenceType, hasEncoding)) {
48
- // return [ref.nodeId, "_Encoding"];
49
- // }
50
- // return [ref.nodeId, ""];
51
- // }
52
-
53
- function checkAggregate(addressSpace: AddressSpacePartial, reference: UAReference, refType: UAReferenceType): boolean {
54
- const r = resolveReferenceType(addressSpace, reference);
55
- if (!r) {
56
- return false;
57
- }
58
- return r.isSubtypeOf(refType)
59
- }
60
27
  function _filterAggregates(addressSpace: AddressSpacePartial, references: UAReference[]): [NodeId, Suffix] | null {
61
28
 
62
- const aggregates = addressSpace.findNode(resolveNodeId("Aggregates")) as UAReferenceType;
63
-
64
- const candidates = references.filter((r: UAReference) =>
65
- !r.isForward && checkAggregate(addressSpace, r, aggregates)
66
- );
29
+ const aggregatesRefType = addressSpace.findNode(resolveNodeId("Aggregates")) as UAReferenceType;
30
+ const hasEncodinRefType = addressSpace.findNode(resolveNodeId("HasEncoding")) as UAReferenceType;
31
+
32
+ const checkAggregate = (
33
+ reference: UAReference,
34
+ ): boolean => {
35
+ if (reference.isForward) return false;
36
+ const r = resolveReferenceType(addressSpace, reference);
37
+ if (!r) {
38
+ return false;
39
+ }
40
+ return r.isSubtypeOf(aggregatesRefType) || r.isSubtypeOf(hasEncodinRefType)
41
+ }
42
+
43
+ const candidates = references.filter(checkAggregate);
67
44
 
68
45
  assert(candidates.length <= 1, "a node shall not have more than one parent (link to a parent with a reference derived from 'Aggregates')");
69
46
  if (candidates.length === 0) {