node-opcua-address-space 2.183.0 → 2.183.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 (29) hide show
  1. package/api/interfaces/alarms_and_conditions/deviation_stuff.ts +30 -0
  2. package/api/loader/register_node_promoter.ts +10 -2
  3. package/dist/api/interfaces/alarms_and_conditions/deviation_stuff.d.ts +28 -0
  4. package/dist/api/loader/register_node_promoter.d.ts +9 -1
  5. package/dist/api/loader/register_node_promoter.js +9 -2
  6. package/dist/api/loader/register_node_promoter.js.map +1 -1
  7. package/dist/impl/alarms_and_conditions/deviation_alarm_helper.js +3 -0
  8. package/dist/impl/alarms_and_conditions/deviation_alarm_helper.js.map +1 -1
  9. package/dist/impl/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.d.ts +8 -0
  10. package/dist/impl/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +11 -1
  11. package/dist/impl/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -1
  12. package/dist/impl/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.d.ts +8 -0
  13. package/dist/impl/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +11 -1
  14. package/dist/impl/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -1
  15. package/dist/impl/nodeid_manager.d.ts +5 -0
  16. package/dist/impl/nodeid_manager.js +21 -5
  17. package/dist/impl/nodeid_manager.js.map +1 -1
  18. package/dist/impl/ua_object_type_impl.js +1 -0
  19. package/dist/impl/ua_object_type_impl.js.map +1 -1
  20. package/dist/impl/ua_variable_type_impl.js +1 -0
  21. package/dist/impl/ua_variable_type_impl.js.map +1 -1
  22. package/dist/tsconfig_base.tsbuildinfo +1 -1
  23. package/impl/alarms_and_conditions/deviation_alarm_helper.ts +3 -0
  24. package/impl/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +12 -1
  25. package/impl/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +12 -1
  26. package/impl/nodeid_manager.ts +27 -5
  27. package/impl/ua_object_type_impl.ts +1 -0
  28. package/impl/ua_variable_type_impl.ts +1 -0
  29. package/package.json +5 -5
@@ -61,6 +61,9 @@ export function DeviationAlarmHelper_install_setpoint(this: DeviationStuff, opti
61
61
  });
62
62
  // install inputNode monitoring for change
63
63
  this.setpointNodeNode.on("value_changed", (newDataValue: DataValue) => {
64
+ // deliberately the deprecated name, for the same reason as _setStateBasedOnInputValue:
65
+ // an old subclass that overrode `_onSetpointDataValueChange` is still reached, and a
66
+ // new assignment of the published name is reached through the delegate on the impl.
64
67
  this._onSetpointDataValueChange(newDataValue);
65
68
  });
66
69
  } else {
@@ -70,10 +70,21 @@ export class UAExclusiveDeviationAlarmImplBase extends UAExclusiveLimitAlarmImpl
70
70
  return DeviationAlarmHelper_getSetpointValue.call(this);
71
71
  }
72
72
 
73
- public _onSetpointDataValueChange(dataValue: DataValue): void {
73
+ /**
74
+ * What the alarm does when the value of its setpoint node changes: re-evaluate the state
75
+ * of the alarm against the new setpoint, since the deviation it watches has just moved.
76
+ */
77
+ public onSetpointDataValueChange(dataValue: DataValue): void {
74
78
  DeviationAlarmHelper_onSetpointDataValueChange.call(this, dataValue);
75
79
  }
76
80
 
81
+ /**
82
+ * @deprecated assign {@link onSetpointDataValueChange} instead; this delegates to it.
83
+ */
84
+ public _onSetpointDataValueChange(dataValue: DataValue): void {
85
+ this.onSetpointDataValueChange(dataValue);
86
+ }
87
+
77
88
  public _install_setpoint(options: InstallSetPointOptions): void {
78
89
  DeviationAlarmHelper_install_setpoint.call(this, options);
79
90
  }
@@ -79,10 +79,21 @@ export class UANonExclusiveDeviationAlarmImplBase
79
79
  return DeviationAlarmHelper_getSetpointValue.call(this);
80
80
  }
81
81
 
82
- public _onSetpointDataValueChange(dataValue: DataValue): void {
82
+ /**
83
+ * What the alarm does when the value of its setpoint node changes: re-evaluate the state
84
+ * of the alarm against the new setpoint, since the deviation it watches has just moved.
85
+ */
86
+ public onSetpointDataValueChange(dataValue: DataValue): void {
83
87
  DeviationAlarmHelper_onSetpointDataValueChange.call(this, dataValue);
84
88
  }
85
89
 
90
+ /**
91
+ * @deprecated assign {@link onSetpointDataValueChange} instead; this delegates to it.
92
+ */
93
+ public _onSetpointDataValueChange(dataValue: DataValue): void {
94
+ this.onSetpointDataValueChange(dataValue);
95
+ }
96
+
86
97
  public _install_setpoint(options: InstallSetPointOptions): void {
87
98
  DeviationAlarmHelper_install_setpoint.call(this, options);
88
99
  }
@@ -51,11 +51,17 @@ function _filterAggregates(addressSpace: AddressSpacePartial, references: UARefe
51
51
  return [ref.nodeId, ""];
52
52
  }
53
53
 
54
+ function _declaredParent(options: ConstructNodeIdOptions): NodeId | null {
55
+ const declared = options.parentNodeId;
56
+ if (!declared) return null;
57
+ if (declared instanceof BaseNodeImpl) return declared.nodeId;
58
+ const nodeId = resolveNodeId(declared as NodeIdLike);
59
+ return nodeId.isEmpty() ? null : nodeId;
60
+ }
61
+
54
62
  function _findParentNodeId(addressSpace: AddressSpacePartial, options: ConstructNodeIdOptions): [NodeId, Suffix] | null {
55
- if (!options.references) {
56
- return null;
57
- }
58
- for (const ref of options.references) {
63
+ const references = options.references ?? [];
64
+ for (const ref of references) {
59
65
  const _ref = ref as ReferenceImpl;
60
66
  _ref._referenceType = addressSpace.findReferenceType(ref.referenceType) ?? undefined;
61
67
  /* c8 ignore next */
@@ -64,8 +70,19 @@ function _findParentNodeId(addressSpace: AddressSpacePartial, options: Construct
64
70
  }
65
71
  _ref.referenceType = _ref._referenceType.nodeId;
66
72
  }
73
+ // A declared parent names the node, whatever reference links the two, as it
74
+ // is the node's parent: an Organizes-only member of a type is
75
+ // `<Type>_MachineryBuildingBlocks` in the ModelCompiler's NodeIds.csv, and a
76
+ // node with two aggregating parents is named after the declared one.
77
+ const declared = _declaredParent(options);
78
+ if (declared) {
79
+ const viaEncoding = references.some(
80
+ (ref) => !ref.isForward && sameNodeId(ref.nodeId, declared) && sameNodeId(ref.referenceType, hasEncoding)
81
+ );
82
+ return [declared, viaEncoding ? "_Encoding" : ""];
83
+ }
67
84
  // find HasComponent, or has Property reverse
68
- return _filterAggregates(addressSpace, options.references);
85
+ return references.length ? _filterAggregates(addressSpace, references) : null;
69
86
  }
70
87
 
71
88
  function prepareName(browseName?: QualifiedName | QualifiedNameOptions): string {
@@ -83,6 +100,11 @@ export interface ConstructNodeIdOptions {
83
100
  nodeClass?: NodeClass;
84
101
  references?: UAReference[];
85
102
  registerSymbolicNames?: boolean;
103
+ /**
104
+ * The declared parent (NodeSet `ParentNodeId`, or `parentNodeId` on the add* API).
105
+ * When present it names the node, as it is the node's parent (see `BaseNode.parent`).
106
+ */
107
+ parentNodeId?: NodeIdLike | BaseNode | null;
86
108
  }
87
109
  export type NodeEntry = [string, number, NodeClass];
88
110
  export type NodeEntry1 = [string, number, string /*"Object" | "Variable" etc...*/];
@@ -147,6 +147,7 @@ export class UAObjectTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements UA
147
147
  eventSourceOf: options.eventSourceOf,
148
148
  notifierOf: options.notifierOf,
149
149
  organizedBy: options.organizedBy,
150
+ parentNodeId: options.parentNodeId,
150
151
  addInOf: options.addInOf,
151
152
  references,
152
153
 
@@ -331,6 +331,7 @@ export class UAVariableTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements
331
331
  nodeId: options.nodeId,
332
332
  notifierOf: options.notifierOf,
333
333
  organizedBy: options.organizedBy,
334
+ parentNodeId: options.parentNodeId,
334
335
  // see InstantiateOptions.references: created with the node so the
335
336
  // NodeIdManager derives the symbolic name from that parent
336
337
  references: options.references,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
- "version": "2.183.0",
3
+ "version": "2.183.1",
4
4
  "description": "pure nodejs OPCUA SDK - module address-space",
5
5
  "main": "./dist/api/index.js",
6
6
  "types": "./dist/api/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "@types/semver": "7.8.0",
23
23
  "chalk": "4.1.2",
24
24
  "dequeue": "^1.0.5",
25
- "node-opcua-address-space-base": "2.183.0",
25
+ "node-opcua-address-space-base": "2.183.1",
26
26
  "node-opcua-assert": "2.183.0",
27
27
  "node-opcua-basic-types": "2.183.0",
28
28
  "node-opcua-binary-stream": "2.183.0",
@@ -38,7 +38,7 @@
38
38
  "node-opcua-extension-object": "2.183.0",
39
39
  "node-opcua-factory": "2.183.0",
40
40
  "node-opcua-nodeid": "2.183.0",
41
- "node-opcua-nodeset-ua": "2.183.0",
41
+ "node-opcua-nodeset-ua": "2.183.1",
42
42
  "node-opcua-numeric-range": "2.183.0",
43
43
  "node-opcua-object-registry": "2.183.0",
44
44
  "node-opcua-pseudo-session": "2.183.0",
@@ -63,7 +63,7 @@
63
63
  "node-opcua-nodesets": "2.183.0",
64
64
  "node-opcua-packet-analyzer": "2.183.0",
65
65
  "node-opcua-schemas": "2.183.0",
66
- "node-opcua-service-filter": "2.183.0",
66
+ "node-opcua-service-filter": "2.183.1",
67
67
  "node-opcua-test-fixtures": "2.181.0",
68
68
  "node-opcua-test-helpers": "2.183.0"
69
69
  },
@@ -82,7 +82,7 @@
82
82
  "internet of things"
83
83
  ],
84
84
  "homepage": "http://node-opcua.github.io/",
85
- "gitHead": "d9a9af54d162f0fbb8d287e168aaeeda2d5c38b7",
85
+ "gitHead": "2326127b73f78cae1f0957788f16850a3be70701",
86
86
  "files": [
87
87
  "dist",
88
88
  "distHelpers",