node-opcua-address-space 2.172.0 → 2.173.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
- "version": "2.172.0",
3
+ "version": "2.173.0",
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",
@@ -21,48 +21,48 @@
21
21
  "@types/semver": "7.7.1",
22
22
  "chalk": "4.1.2",
23
23
  "dequeue": "^1.0.5",
24
- "node-opcua-address-space-base": "2.172.0",
24
+ "node-opcua-address-space-base": "2.173.0",
25
25
  "node-opcua-assert": "2.164.0",
26
- "node-opcua-basic-types": "2.172.0",
27
- "node-opcua-binary-stream": "2.172.0",
28
- "node-opcua-client-dynamic-extension-object": "2.172.0",
26
+ "node-opcua-basic-types": "2.173.0",
27
+ "node-opcua-binary-stream": "2.173.0",
28
+ "node-opcua-client-dynamic-extension-object": "2.173.0",
29
29
  "node-opcua-constants": "2.157.0",
30
30
  "node-opcua-crypto": "5.3.6",
31
- "node-opcua-data-access": "2.172.0",
32
- "node-opcua-data-model": "2.172.0",
33
- "node-opcua-data-value": "2.172.0",
34
- "node-opcua-date-time": "2.172.0",
31
+ "node-opcua-data-access": "2.173.0",
32
+ "node-opcua-data-model": "2.173.0",
33
+ "node-opcua-data-value": "2.173.0",
34
+ "node-opcua-date-time": "2.173.0",
35
35
  "node-opcua-debug": "2.172.0",
36
- "node-opcua-enum": "2.172.0",
37
- "node-opcua-extension-object": "2.172.0",
38
- "node-opcua-factory": "2.172.0",
39
- "node-opcua-nodeid": "2.172.0",
40
- "node-opcua-nodeset-ua": "2.172.0",
41
- "node-opcua-numeric-range": "2.172.0",
36
+ "node-opcua-enum": "2.173.0",
37
+ "node-opcua-extension-object": "2.173.0",
38
+ "node-opcua-factory": "2.173.0",
39
+ "node-opcua-nodeid": "2.173.0",
40
+ "node-opcua-nodeset-ua": "2.173.0",
41
+ "node-opcua-numeric-range": "2.173.0",
42
42
  "node-opcua-object-registry": "2.172.0",
43
- "node-opcua-pseudo-session": "2.172.0",
44
- "node-opcua-service-browse": "2.172.0",
45
- "node-opcua-service-call": "2.172.0",
46
- "node-opcua-service-history": "2.172.0",
47
- "node-opcua-service-translate-browse-path": "2.172.0",
48
- "node-opcua-service-write": "2.172.0",
49
- "node-opcua-status-code": "2.172.0",
50
- "node-opcua-types": "2.172.0",
51
- "node-opcua-utils": "2.172.0",
52
- "node-opcua-variant": "2.172.0",
53
- "node-opcua-xml2json": "2.172.0",
43
+ "node-opcua-pseudo-session": "2.173.0",
44
+ "node-opcua-service-browse": "2.173.0",
45
+ "node-opcua-service-call": "2.173.0",
46
+ "node-opcua-service-history": "2.173.0",
47
+ "node-opcua-service-translate-browse-path": "2.173.0",
48
+ "node-opcua-service-write": "2.173.0",
49
+ "node-opcua-status-code": "2.173.0",
50
+ "node-opcua-types": "2.173.0",
51
+ "node-opcua-utils": "2.173.0",
52
+ "node-opcua-variant": "2.173.0",
53
+ "node-opcua-xml2json": "2.173.0",
54
54
  "semver": "^7.8.0",
55
55
  "thenify-ex": "4.4.0",
56
56
  "xml-writer": "^1.7.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "humanize": "0.0.9",
60
- "node-opcua-benchmarker": "2.172.0",
60
+ "node-opcua-benchmarker": "2.173.0",
61
61
  "node-opcua-leak-detector": "2.172.0",
62
62
  "node-opcua-nodesets": "2.163.1",
63
- "node-opcua-packet-analyzer": "2.172.0",
64
- "node-opcua-schemas": "2.172.0",
65
- "node-opcua-service-filter": "2.172.0",
63
+ "node-opcua-packet-analyzer": "2.173.0",
64
+ "node-opcua-schemas": "2.173.0",
65
+ "node-opcua-service-filter": "2.173.0",
66
66
  "node-opcua-test-fixtures": "2.157.0"
67
67
  },
68
68
  "author": "Etienne Rossignon",
@@ -80,7 +80,7 @@
80
80
  "internet of things"
81
81
  ],
82
82
  "homepage": "http://node-opcua.github.io/",
83
- "gitHead": "dfe9993a93b5c3897825e898b5f07b25952c7f45",
83
+ "gitHead": "4aa6634e2e1e14e223fa46a632438295be12744c",
84
84
  "files": [
85
85
  "dist",
86
86
  "distHelpers",
@@ -1,5 +1,5 @@
1
1
  // import type { UAVariable } from "node-opcua-address-space-base";
2
- import type { NodeId } from "node-opcua-nodeid/source/nodeid";
2
+ import type { NodeId } from "node-opcua-nodeid";
3
3
  import type { UAVariable } from "../..";
4
4
  import type { InstantiateAlarmConditionOptions } from "./instantiate_alarm_condition_options";
5
5
 
@@ -2,7 +2,6 @@
2
2
  * @module node-opcua-address-space
3
3
  */
4
4
 
5
- import { randomBytes } from "node:crypto";
6
5
  import chalk from "chalk";
7
6
  import type {
8
7
  AddReferenceOpts,
@@ -52,7 +51,7 @@ import type {
52
51
  RelativePathElement
53
52
  } from "node-opcua-types";
54
53
  import { BrowsePath, BrowsePathResult } from "node-opcua-types";
55
- import { isNullOrUndefined, lowerFirstLetter } from "node-opcua-utils";
54
+ import { isNullOrUndefined, lowerFirstLetter, randomBytes } from "node-opcua-utils";
56
55
  import { DataType, Variant, VariantArrayType, type VariantOptions, type VariantT } from "node-opcua-variant";
57
56
  import { adjustBrowseDirection } from "../source/helpers/adjust_browse_direction";
58
57
  import type { ExtensionObjectConstructorFuncWithSchema } from "../source/interfaces/extension_object_constructor";
@@ -209,12 +209,13 @@ export function _getCompleteRequiredModelsFromValuesAndReferences(
209
209
  }
210
210
  };
211
211
 
212
+ const addressSpace = namespace.addressSpace;
213
+ const nonHierarchicalReferencesType = addressSpace.findReferenceType("NonHierarchicalReferences");
214
+
212
215
  //const maxIndex = Math.max(...requiredNamespaceIndexes);
213
216
  for (const node of namespace_.nodeIterator()) {
214
217
  const references = (<BaseNodeImpl>node).allReferences();
215
218
  for (const reference of references) {
216
- // if (reference.isForward) continue;
217
- // only look at backward reference
218
219
  // check referenceId
219
220
  const namespaceIndexOfReferenceType = getReferenceType(reference)?.nodeId.namespace;
220
221
  if (namespaceIndexOfReferenceType !== 0 && namespaceIndexOfReferenceType !== namespace.index) {
@@ -228,6 +229,18 @@ export function _getCompleteRequiredModelsFromValuesAndReferences(
228
229
  const refPriority = priorityList[namespaceIndexOfTargetNode];
229
230
  if (refPriority <= thisPriority) {
230
231
  consider(namespaceIndexOfTargetNode);
232
+ } else {
233
+ // For forward NonHierarchicalReferences (e.g. HasInterface),
234
+ // always include the target namespace as a dependency
235
+ // regardless of priority, since the current node owns
236
+ // this relationship.
237
+ const referenceType = getReferenceType(reference);
238
+ if (reference.isForward
239
+ && referenceType
240
+ && nonHierarchicalReferencesType
241
+ && referenceType.isSubtypeOf(nonHierarchicalReferencesType)) {
242
+ consider(namespaceIndexOfTargetNode);
243
+ }
231
244
  }
232
245
  }
233
246
  }
@@ -133,11 +133,6 @@ function _dumpReferences(xw: XmlWriter, node: BaseNode) {
133
133
  function referenceToKeep(reference: UAReference): boolean {
134
134
  const referenceType = (reference as ReferenceImpl)._referenceType!;
135
135
  const targetedNamespaceIndex = reference.nodeId.namespace;
136
- if (_hasHigherPriorityThan(xw, targetedNamespaceIndex, node.nodeId.namespace)) {
137
- // this reference has nothing to do here ! drop it
138
- // because the target namespace is higher in the hierarchy
139
- return false;
140
- }
141
136
 
142
137
  // get the direct backward reference to a external namespace
143
138
  if (referenceType.isSubtypeOf(aggregateReferenceType) && !reference.isForward) {
@@ -152,14 +147,19 @@ function _dumpReferences(xw: XmlWriter, node: BaseNode) {
152
147
  }
153
148
  // only keep
154
149
  if (referenceType.isSubtypeOf(aggregateReferenceType) && reference.isForward) {
150
+ if (_hasHigherPriorityThan(xw, targetedNamespaceIndex, node.nodeId.namespace)) {
151
+ return false;
152
+ }
155
153
  return true;
156
154
  } else if (referenceType.isSubtypeOf(hasSubtypeReferenceType) && !reference.isForward) {
157
155
  return true;
158
156
  } else if (referenceType.isSubtypeOf(hasTypeDefinitionReferenceType) && reference.isForward) {
159
157
  return true;
160
158
  } else if (referenceType.isSubtypeOf(nonHierarchicalReferencesType) && reference.isForward) {
159
+ // e.g. HasInterface — always keep, the current node owns this reference
161
160
  return true;
162
161
  } else if (referenceType.isSubtypeOf(organizesReferencesType) && !reference.isForward) {
162
+ // Organizes inverse — the current node is organized by an external folder
163
163
  return true;
164
164
  } else if (connectsToReferenceType && referenceType.isSubtypeOf(connectsToReferenceType) && reference.isForward) {
165
165
  return true;