node-opcua-address-space 2.90.0 → 2.91.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.
Files changed (80) hide show
  1. package/dist/source/helpers/argument_list.js +3 -3
  2. package/dist/source/helpers/argument_list.js.map +1 -1
  3. package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +13 -1
  4. package/dist/source/loader/load_nodeset2.js +5 -5
  5. package/dist/source/loader/load_nodeset2.js.map +1 -1
  6. package/dist/src/address_space.js +8 -8
  7. package/dist/src/address_space.js.map +1 -1
  8. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +1 -1
  9. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  10. package/dist/src/alarms_and_conditions/ua_condition_impl.js +2 -2
  11. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  12. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +1 -1
  13. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
  14. package/dist/src/base_node_impl.js +3 -3
  15. package/dist/src/base_node_impl.js.map +1 -1
  16. package/dist/src/base_node_private.js +4 -4
  17. package/dist/src/base_node_private.js.map +1 -1
  18. package/dist/src/check_value_rank_compatibility.d.ts +15 -0
  19. package/dist/src/check_value_rank_compatibility.js +82 -0
  20. package/dist/src/check_value_rank_compatibility.js.map +1 -0
  21. package/dist/src/extension_object_array_node.js +3 -3
  22. package/dist/src/extension_object_array_node.js.map +1 -1
  23. package/dist/src/index_current.d.ts +1 -1
  24. package/dist/src/index_current.js +2 -1
  25. package/dist/src/index_current.js.map +1 -1
  26. package/dist/src/namespace_impl.js +0 -2
  27. package/dist/src/namespace_impl.js.map +1 -1
  28. package/dist/src/nodeset_tools/nodeset_to_xml.js +9 -9
  29. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  30. package/dist/src/state_machine/finite_state_machine.d.ts +16 -2
  31. package/dist/src/state_machine/finite_state_machine.js +83 -44
  32. package/dist/src/state_machine/finite_state_machine.js.map +1 -1
  33. package/dist/src/tool_isSubtypeOf.d.ts +18 -0
  34. package/dist/src/tool_isSubtypeOf.js +125 -0
  35. package/dist/src/tool_isSubtypeOf.js.map +1 -0
  36. package/dist/src/tool_isSupertypeOf.d.ts +4 -4
  37. package/dist/src/ua_data_type_impl.d.ts +6 -4
  38. package/dist/src/ua_data_type_impl.js +13 -11
  39. package/dist/src/ua_data_type_impl.js.map +1 -1
  40. package/dist/src/ua_object_type_impl.d.ts +4 -2
  41. package/dist/src/ua_object_type_impl.js +7 -5
  42. package/dist/src/ua_object_type_impl.js.map +1 -1
  43. package/dist/src/ua_reference_type_impl.d.ts +5 -3
  44. package/dist/src/ua_reference_type_impl.js +8 -6
  45. package/dist/src/ua_reference_type_impl.js.map +1 -1
  46. package/dist/src/ua_variable_impl.d.ts +19 -7
  47. package/dist/src/ua_variable_impl.js +38 -23
  48. package/dist/src/ua_variable_impl.js.map +1 -1
  49. package/dist/src/ua_variable_impl_ext_obj.js +22 -13
  50. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  51. package/dist/src/ua_variable_type_impl.d.ts +15 -3
  52. package/dist/src/ua_variable_type_impl.js +17 -6
  53. package/dist/src/ua_variable_type_impl.js.map +1 -1
  54. package/distHelpers/boiler_system.js +5 -5
  55. package/distHelpers/boiler_system.js.map +1 -1
  56. package/package.json +34 -34
  57. package/source/helpers/argument_list.ts +3 -3
  58. package/source/interfaces/state_machine/ua_state_machine_type.ts +19 -1
  59. package/source/loader/load_nodeset2.ts +11 -10
  60. package/src/address_space.ts +8 -8
  61. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +1 -1
  62. package/src/alarms_and_conditions/ua_condition_impl.ts +2 -2
  63. package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +1 -1
  64. package/src/base_node_impl.ts +3 -3
  65. package/src/base_node_private.ts +3 -3
  66. package/src/check_value_rank_compatibility.ts +79 -0
  67. package/src/extension_object_array_node.ts +3 -3
  68. package/src/index_current.ts +1 -1
  69. package/src/namespace_impl.ts +0 -4
  70. package/src/nodeset_tools/nodeset_to_xml.ts +9 -9
  71. package/src/state_machine/finite_state_machine.ts +105 -60
  72. package/src/{tool_isSupertypeOf.ts → tool_isSubtypeOf.ts} +9 -9
  73. package/src/ua_data_type_impl.ts +21 -19
  74. package/src/ua_object_type_impl.ts +9 -3
  75. package/src/ua_reference_type_impl.ts +7 -4
  76. package/src/ua_variable_impl.ts +2033 -2006
  77. package/src/ua_variable_impl_ext_obj.ts +28 -15
  78. package/src/ua_variable_type_impl.ts +31 -5
  79. package/test_helpers/boiler_system.ts +5 -5
  80. package/test_helpers/test_fixtures/eurange_issue.xml +3 -2
@@ -105,7 +105,7 @@ export function createExtObjArrayNode<T extends ExtensionObject>(parentFolder: U
105
105
  throw new Error("cannot find Data Type");
106
106
  }
107
107
 
108
- assert(dataType.isSupertypeOf(structure as any), "expecting a structure (= ExtensionObject) here ");
108
+ assert(dataType.isSubtypeOf(structure as any), "expecting a structure (= ExtensionObject) here ");
109
109
 
110
110
  const inner_options = {
111
111
  componentOf: parentFolder,
@@ -165,7 +165,7 @@ export function bindExtObjArrayNode<T extends ExtensionObject>(
165
165
  throw new Error("Cannot find DataType " + variableType.dataType.toString());
166
166
  }
167
167
 
168
- assert(dataType.isSupertypeOf(structure), "expecting a structure (= ExtensionObject) here ");
168
+ assert(dataType.isSubtypeOf(structure), "expecting a structure (= ExtensionObject) here ");
169
169
 
170
170
  assert(!uaArrayVariableNode.$$variableType, "uaArrayVariableNode has already been bound !");
171
171
 
@@ -173,7 +173,7 @@ export function bindExtObjArrayNode<T extends ExtensionObject>(
173
173
 
174
174
  // verify that an object with same doesn't already exist
175
175
  dataType = addressSpace.findDataType(variableType.dataType)! as UADataType;
176
- assert(dataType!.isSupertypeOf(structure), "expecting a structure (= ExtensionObject) here ");
176
+ assert(dataType!.isSubtypeOf(structure), "expecting a structure (= ExtensionObject) here ");
177
177
  assert(!uaArrayVariableNode.$$extensionObjectArray, "UAVariable ExtensionObject array already bounded");
178
178
  uaArrayVariableNode.$$dataType = dataType;
179
179
  uaArrayVariableNode.$$extensionObjectArray = [];
@@ -29,7 +29,7 @@ export * from "../source/loader/register_node_promoter";
29
29
 
30
30
  export { ContinuationPointManager } from "../source/continuation_points/continuation_point_manager";
31
31
 
32
- export { promoteToStateMachine } from "./state_machine/finite_state_machine";
32
+ export { promoteToStateMachine, promoteToStateMachineType } from "./state_machine/finite_state_machine";
33
33
  export * from "../source/interfaces/state_machine/ua_transition_ex";
34
34
 
35
35
  export * from "./namespace_impl";
@@ -512,8 +512,6 @@ export class NamespaceImpl implements NamespacePrivate {
512
512
  referenceType: "HasTypeDefinition"
513
513
  });
514
514
 
515
- // xx assert(this.FolderTypeId && this.BaseObjectTypeId); // is default address space generated.?
516
-
517
515
  const createOptions = options as CreateNodeOptions;
518
516
  assert(!createOptions.nodeClass);
519
517
  createOptions.nodeClass = NodeClass.View;
@@ -1967,8 +1965,6 @@ export class NamespaceImpl implements NamespacePrivate {
1967
1965
 
1968
1966
  options.historizing = !!options.historizing;
1969
1967
 
1970
- // xx assert(this.FolderTypeId && this.BaseObjectTypeId); // is default address space generated.?
1971
-
1972
1968
  // istanbul ignore next
1973
1969
  if (Object.prototype.hasOwnProperty.call(options, "hasTypeDefinition")) {
1974
1970
  throw new Error("hasTypeDefinition option is invalid. Do you mean typeDefinition instead ?");
@@ -134,7 +134,7 @@ function _dumpReferences(xw: XmlWriter, node: BaseNode) {
134
134
  }
135
135
 
136
136
  // get the direct backward reference to a external namespace
137
- if (referenceType.isSupertypeOf(aggregateReferenceType) && !reference.isForward) {
137
+ if (referenceType.isSubtypeOf(aggregateReferenceType) && !reference.isForward) {
138
138
  if (reference.nodeId.namespace !== node.nodeId.namespace) {
139
139
  // todo: may be check that reference.nodeId.namespace is one of the namespace
140
140
  // on which our namespace is build and not a derived one !
@@ -142,23 +142,23 @@ function _dumpReferences(xw: XmlWriter, node: BaseNode) {
142
142
  return true;
143
143
  }
144
144
  }
145
- if (referenceType.isSupertypeOf(hasSubtypeReferenceType) && reference.isForward) {
145
+ if (referenceType.isSubtypeOf(hasSubtypeReferenceType) && reference.isForward) {
146
146
  // return false;
147
147
  }
148
148
  // only keep
149
- if (referenceType.isSupertypeOf(aggregateReferenceType) && reference.isForward) {
149
+ if (referenceType.isSubtypeOf(aggregateReferenceType) && reference.isForward) {
150
150
  return true;
151
- } else if (referenceType.isSupertypeOf(hasSubtypeReferenceType) && !reference.isForward) {
151
+ } else if (referenceType.isSubtypeOf(hasSubtypeReferenceType) && !reference.isForward) {
152
152
  return true;
153
- } else if (referenceType.isSupertypeOf(hasTypeDefinitionReferenceType) && reference.isForward) {
153
+ } else if (referenceType.isSubtypeOf(hasTypeDefinitionReferenceType) && reference.isForward) {
154
154
  return true;
155
- } else if (referenceType.isSupertypeOf(nonHierarchicalReferencesType) && reference.isForward) {
155
+ } else if (referenceType.isSubtypeOf(nonHierarchicalReferencesType) && reference.isForward) {
156
156
  return true;
157
- } else if (referenceType.isSupertypeOf(organizesReferencesType) && !reference.isForward) {
157
+ } else if (referenceType.isSubtypeOf(organizesReferencesType) && !reference.isForward) {
158
158
  return true;
159
- } else if (connectsToReferenceType && referenceType.isSupertypeOf(connectsToReferenceType) && reference.isForward) {
159
+ } else if (connectsToReferenceType && referenceType.isSubtypeOf(connectsToReferenceType) && reference.isForward) {
160
160
  return true;
161
- } else if (referenceType.isSupertypeOf(hasEventSourceReferenceType) && reference.isForward) {
161
+ } else if (referenceType.isSubtypeOf(hasEventSourceReferenceType) && reference.isForward) {
162
162
  return true;
163
163
  }
164
164
  return false;
@@ -10,18 +10,20 @@ import { AttributeIds } from "node-opcua-data-model";
10
10
  import { NodeId } from "node-opcua-nodeid";
11
11
  import { StatusCodes } from "node-opcua-status-code";
12
12
  import { DataType } from "node-opcua-variant";
13
- import { BaseNode, UAMethod, UAObject, UAObjectType, UAVariable } from "node-opcua-address-space-base";
13
+ import { UAString } from "node-opcua-basic-types";
14
+ import { BaseNode, UAMethod, UAObject, UAObjectType, UAVariable, UAVariableT } from "node-opcua-address-space-base";
14
15
  import { registerNodePromoter } from "../../source/loader/register_node_promoter";
15
16
 
16
- import { UAStateMachineEx, TransitionSelector } from "../../source/interfaces/state_machine/ua_state_machine_type";
17
+ import { UAStateMachineEx, TransitionSelector, UAStateMachineTypeHelper } from "../../source/interfaces/state_machine/ua_state_machine_type";
17
18
  import { UAObjectImpl } from "../ua_object_impl";
18
19
  import { UATransitionEx } from "../../source/interfaces/state_machine/ua_transition_ex";
19
20
  import { BaseNodeImpl } from "../base_node_impl";
21
+ import { UAObjectTypeImpl } from "../ua_object_type_impl";
20
22
 
21
23
  const doDebug = false;
22
24
 
23
- export declare interface UATransitionImpl extends UATransition, UATransitionEx {}
24
- export class UATransitionImpl implements UATransition, UATransitionEx {}
25
+ export declare interface UATransitionImpl extends UATransition, UATransitionEx { }
26
+ export class UATransitionImpl implements UATransition, UATransitionEx { }
25
27
 
26
28
  function getComponentFromTypeAndSubtype(typeDef: UAObjectType): UAObject[] {
27
29
  const components_parts: BaseNode[][] = [];
@@ -65,6 +67,68 @@ const defaultPredicate = (transitions: UATransition[], fromState: UAState, toSta
65
67
  return transitions[0];
66
68
  };
67
69
 
70
+
71
+
72
+ export function getFiniteStateMachineTypeStates(uaFiniteStateMachineType: UAObjectType): UAState[] {
73
+ const addressSpace = uaFiniteStateMachineType.addressSpace;
74
+
75
+ const initialStateType = addressSpace.findObjectType("InitialStateType");
76
+ // istanbul ignore next
77
+ if (!initialStateType) {
78
+ throw new Error("cannot find InitialStateType");
79
+ }
80
+
81
+ const stateType = addressSpace.findObjectType("StateType");
82
+ // istanbul ignore next
83
+ if (!stateType) {
84
+ throw new Error("cannot find StateType");
85
+ }
86
+
87
+ assert(initialStateType.isSubtypeOf(stateType));
88
+
89
+
90
+ let comp = getComponentFromTypeAndSubtype(uaFiniteStateMachineType);
91
+
92
+ comp = comp.filter((c) => {
93
+ if (!c.typeDefinitionObj || c.typeDefinitionObj.nodeClass !== NodeClass.ObjectType) {
94
+ return false;
95
+ }
96
+ return c.typeDefinitionObj.isSubtypeOf(stateType);
97
+ });
98
+
99
+ return comp as UAState[];
100
+ }
101
+ export function getFiniteStateMachineTypeTransitions(uaFiniteStateMachineType: UAObjectType): UATransitionEx[] {
102
+ const addressSpace = uaFiniteStateMachineType.addressSpace;
103
+
104
+ const transitionType = addressSpace.findObjectType("TransitionType");
105
+ // istanbul ignore next
106
+ if (!transitionType) {
107
+ throw new Error("cannot find TransitionType");
108
+ }
109
+
110
+ let comp = getComponentFromTypeAndSubtype(uaFiniteStateMachineType);
111
+
112
+ comp = comp.filter((c) => {
113
+ if (!c.typeDefinitionObj || c.typeDefinitionObj.nodeClass !== NodeClass.ObjectType) {
114
+ return false;
115
+ }
116
+ return c.typeDefinitionObj.isSubtypeOf(transitionType);
117
+ });
118
+
119
+ return comp as UATransitionEx[];
120
+
121
+ }
122
+
123
+ export function getFiniteStateMachineTypeStateByName(uaFiniteStateMachineType: UAObjectType, stateName: string): UAState | null {
124
+ let states = getFiniteStateMachineTypeStates(uaFiniteStateMachineType);
125
+ states = states.filter((s: any) => {
126
+ return s.browseName.name === stateName;
127
+ });
128
+ assert(states.length <= 1);
129
+ return states.length === 1 ? (states[0] as any as UAState) : null;
130
+ }
131
+
68
132
  /*
69
133
  *
70
134
  * @class StateMachine
@@ -75,34 +139,8 @@ const defaultPredicate = (transitions: UATransition[], fromState: UAState, toSta
75
139
  */
76
140
  export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx {
77
141
  public getStates(): UAState[] {
78
- const addressSpace = this.addressSpace;
79
-
80
- const initialStateType = addressSpace.findObjectType("InitialStateType");
81
- // istanbul ignore next
82
- if (!initialStateType) {
83
- throw new Error("cannot find InitialStateType");
84
- }
85
-
86
- const stateType = addressSpace.findObjectType("StateType");
87
- // istanbul ignore next
88
- if (!stateType) {
89
- throw new Error("cannot find StateType");
90
- }
91
-
92
- assert(initialStateType.isSupertypeOf(stateType));
93
-
94
142
  const typeDef = this.typeDefinitionObj;
95
-
96
- let comp = getComponentFromTypeAndSubtype(typeDef);
97
-
98
- comp = comp.filter((c) => {
99
- if (!c.typeDefinitionObj || c.typeDefinitionObj.nodeClass !== NodeClass.ObjectType) {
100
- return false;
101
- }
102
- return c.typeDefinitionObj.isSupertypeOf(stateType);
103
- });
104
-
105
- return comp as UAState[];
143
+ return getFiniteStateMachineTypeStates(typeDef);
106
144
  }
107
145
 
108
146
  public get states(): UAState[] {
@@ -115,34 +153,12 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
115
153
  * @return the state with the given name
116
154
  */
117
155
  public getStateByName(name: string): UAState | null {
118
- let states = this.getStates();
119
- states = states.filter((s: any) => {
120
- return s.browseName.name === name;
121
- });
122
- assert(states.length <= 1);
123
- return states.length === 1 ? (states[0] as any as UAState) : null;
156
+ return getFiniteStateMachineTypeStateByName(this.typeDefinitionObj, name);
124
157
  }
125
158
 
126
159
  public getTransitions(): UATransitionEx[] {
127
- const addressSpace = this.addressSpace;
128
-
129
- const transitionType = addressSpace.findObjectType("TransitionType");
130
- // istanbul ignore next
131
- if (!transitionType) {
132
- throw new Error("cannot find TransitionType");
133
- }
134
160
  const typeDef = this.typeDefinitionObj;
135
-
136
- let comp = getComponentFromTypeAndSubtype(typeDef);
137
-
138
- comp = comp.filter((c) => {
139
- if (!c.typeDefinitionObj || c.typeDefinitionObj.nodeClass !== NodeClass.ObjectType) {
140
- return false;
141
- }
142
- return c.typeDefinitionObj.isSupertypeOf(transitionType);
143
- });
144
-
145
- return comp as UATransitionEx[];
161
+ return getFiniteStateMachineTypeTransitions(typeDef);
146
162
  }
147
163
 
148
164
  public get transitions(): UATransitionEx[] {
@@ -245,8 +261,8 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
245
261
  if (!stateType) {
246
262
  throw new Error("Cannot find StateType");
247
263
  }
248
- assert((_fromStateNode.typeDefinitionObj as any).isSupertypeOf(stateType));
249
- assert((_toStateNode.typeDefinitionObj as any).isSupertypeOf(stateType));
264
+ assert((_fromStateNode.typeDefinitionObj as any).isSubtypeOf(stateType));
265
+ assert((_toStateNode.typeDefinitionObj as any).isSubtypeOf(stateType));
250
266
 
251
267
  let transitions = _fromStateNode.findReferencesAsObject("FromState", false) as UATransitionImpl[];
252
268
 
@@ -358,8 +374,8 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
358
374
  "fromState.id": fromStateNode
359
375
  ? fromStateNode.stateNumber.readValue().value
360
376
  : {
361
- dataType: "Null"
362
- },
377
+ dataType: "Null"
378
+ },
363
379
 
364
380
  toState: {
365
381
  dataType: "LocalizedText",
@@ -398,7 +414,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
398
414
  }
399
415
 
400
416
  // xx assert(this.typeDefinitionObj && !this.subtypeOfObj);
401
- // xx assert(!this.typeDefinitionObj || this.typeDefinitionObj.isSupertypeOf(finiteStateMachineType));
417
+ // xx assert(!this.typeDefinitionObj || this.typeDefinitionObj.isSubtypeOf(finiteStateMachineType));
402
418
  // get current Status
403
419
 
404
420
  const d = this.currentState.readValue();
@@ -424,3 +440,32 @@ export function promoteToStateMachine(node: UAObject): UAStateMachineEx {
424
440
  return _node;
425
441
  }
426
442
  registerNodePromoter(ObjectTypeIds.FiniteStateMachineType, promoteToStateMachine);
443
+
444
+
445
+ export class UAStateMachineTypeImpl extends UAObjectTypeImpl implements UAStateMachineTypeHelper {
446
+ getStateByName(name: string): UAState | null {
447
+ return getFiniteStateMachineTypeStateByName(this, name);
448
+ }
449
+ getStates(): UAState[] {
450
+ return getFiniteStateMachineTypeStates(this);
451
+
452
+ }
453
+ getTransitions(): UATransitionEx[] {
454
+ return getFiniteStateMachineTypeTransitions(this);
455
+ }
456
+ nodeVersion?: UAVariableT<UAString, DataType.String> | undefined;
457
+ _post_initialize(): void {
458
+ /** */
459
+ }
460
+
461
+ }
462
+ export function promoteToStateMachineType(node: UAObject): UAStateMachineTypeHelper {
463
+ if (node instanceof UAStateMachineTypeImpl) {
464
+ return node; // already promoted
465
+ }
466
+ Object.setPrototypeOf(node, UAStateMachineTypeImpl.prototype);
467
+ assert(node instanceof UAStateMachineTypeImpl, "should now be a State Machine");
468
+ const _node = node as unknown as UAStateMachineTypeImpl;
469
+ _node._post_initialize();
470
+ return _node;
471
+ }
@@ -5,12 +5,12 @@
5
5
  import { assert } from "node-opcua-assert";
6
6
  import { NodeId, NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
7
7
  import { sameNodeId } from "node-opcua-nodeid";
8
+ import { NodeClass } from "node-opcua-data-model";
8
9
  import { BaseNode, UADataType, UAObjectType, UAReference, UAReferenceType, UAVariableType } from "node-opcua-address-space-base";
9
10
 
10
11
  import { BaseNode_getCache } from "./base_node_private";
11
12
  import { ReferenceImpl } from "./reference_impl";
12
13
  import { BaseNodeImpl } from "./base_node_impl";
13
- import { NodeClass } from "node-opcua-data-model";
14
14
 
15
15
  const HasSubTypeNodeId = resolveNodeId("HasSubtype");
16
16
 
@@ -20,13 +20,13 @@ function _filterSubType(reference: UAReference) {
20
20
 
21
21
  export type BaseNodeConstructor<T extends BaseNode> = new () => T;
22
22
 
23
- function _slow_isSupertypeOf<T extends UAType>(this: T, Class: typeof BaseNodeImpl, baseType: T | NodeIdLike): boolean {
23
+ function _slow_isSubtypeOf<T extends UAType>(this: T, Class: typeof BaseNodeImpl, baseType: T | NodeIdLike): boolean {
24
24
  if (!(baseType instanceof Class)) {
25
25
  const node = this.addressSpace.findNode(baseType as NodeIdLike);
26
26
  if (!node || !(node instanceof Class)) {
27
27
  throw new Error("Invalid argument");
28
28
  }
29
- return _slow_isSupertypeOf.call(this, Class, node as unknown as T);
29
+ return _slow_isSubtypeOf.call(this, Class, node as unknown as T);
30
30
  }
31
31
  assert(this instanceof Class);
32
32
  assert(baseType instanceof Class, " Object must have same type");
@@ -50,7 +50,7 @@ function _slow_isSupertypeOf<T extends UAType>(this: T, Class: typeof BaseNodeIm
50
50
  if (sameNodeId(subTypeNode.nodeId, baseType.nodeId)) {
51
51
  return true;
52
52
  } else {
53
- if (_slow_isSupertypeOf.call(subTypeNode, Class, baseType)) {
53
+ if (_slow_isSubtypeOf.call(subTypeNode, Class, baseType)) {
54
54
  return true;
55
55
  }
56
56
  }
@@ -96,11 +96,11 @@ function hashBaseNode(e: BaseNode): string {
96
96
  return e.nodeId.value.toString();
97
97
  }
98
98
 
99
- export type IsSupertypeOfFunc<T extends UAType> = (this: T, baseType: T) => boolean;
99
+ export type IsSubtypeOfFunc<T extends UAType> = (this: T, baseType: T) => boolean;
100
100
 
101
101
  export type UAType = UAReferenceType | UADataType | UAObjectType | UAVariableType;
102
102
 
103
- export function construct_isSupertypeOf<T extends UAType>(Class: typeof BaseNodeImpl): IsSupertypeOfFunc<T> {
103
+ export function construct_isSubtypeOf<T extends UAType>(Class: typeof BaseNodeImpl): IsSubtypeOfFunc<T> {
104
104
  return wrap_memoize(function (this: T, baseType: T | NodeIdLike): boolean {
105
105
  if (!(baseType instanceof Class)) {
106
106
  throw new Error(
@@ -115,13 +115,13 @@ export function construct_isSupertypeOf<T extends UAType>(Class: typeof BaseNode
115
115
  if (!(this instanceof Class)) {
116
116
  throw new Error("expecting this to be " + Class.name + " but got " + baseType.constructor.name);
117
117
  }
118
- return _slow_isSupertypeOf.call(this, Class, baseType as T);
118
+ return _slow_isSubtypeOf.call(this, Class, baseType as T);
119
119
  }, hashBaseNode);
120
120
  }
121
121
 
122
- export function construct_slow_isSupertypeOf<T extends UAType>(Class: typeof BaseNodeImpl) {
122
+ export function construct_slow_isSubtypeOf<T extends UAType>(Class: typeof BaseNodeImpl) {
123
123
  return function (this: T, baseType: T | NodeIdLike): boolean {
124
- return _slow_isSupertypeOf.call(this, Class, baseType);
124
+ return _slow_isSubtypeOf.call(this, Class, baseType);
125
125
  };
126
126
  }
127
127
 
@@ -26,9 +26,9 @@ import { SessionContext } from "../source/session_context";
26
26
  import { ExtensionObjectConstructorFuncWithSchema } from "../source/interfaces/extension_object_constructor";
27
27
  import { BaseNodeImpl, InternalBaseNodeOptions } from "./base_node_impl";
28
28
  import { BaseNode_References_toString, BaseNode_toString, ToStringBuilder, ToStringOption } from "./base_node_private";
29
- import * as tools from "./tool_isSupertypeOf";
30
- import { get_subtypeOf } from "./tool_isSupertypeOf";
31
- import { get_subtypeOfObj } from "./tool_isSupertypeOf";
29
+ import * as tools from "./tool_isSubtypeOf";
30
+ import { get_subtypeOf } from "./tool_isSubtypeOf";
31
+ import { get_subtypeOfObj } from "./tool_isSubtypeOf";
32
32
  import { BaseNode_getCache } from "./base_node_private";
33
33
 
34
34
  export interface UADataTypeImpl {
@@ -62,8 +62,8 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
62
62
  *
63
63
  * var dataTypeDouble = addressSpace.findDataType("Double");
64
64
  * var dataTypeNumber = addressSpace.findDataType("Number");
65
- * assert(dataTypeDouble.isSupertypeOf(dataTypeNumber));
66
- * assert(!dataTypeNumber.isSupertypeOf(dataTypeDouble));
65
+ * assert(dataTypeDouble.isSubtypeOf(dataTypeNumber));
66
+ * assert(!dataTypeNumber.isSubtypeOf(dataTypeDouble));
67
67
  *
68
68
  */
69
69
  public get subtypeOf(): NodeId | null {
@@ -74,7 +74,9 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
74
74
  return get_subtypeOfObj.call(this) as any as UADataType;
75
75
  }
76
76
 
77
- public isSupertypeOf = tools.construct_isSupertypeOf<UADataType>(UADataTypeImpl);
77
+ /** @deprecated */
78
+ public isSupertypeOf = tools.construct_isSubtypeOf<UADataType>(UADataTypeImpl);
79
+ public isSubtypeOf = tools.construct_isSubtypeOf<UADataType>(UADataTypeImpl);
78
80
 
79
81
  public readonly isAbstract: boolean;
80
82
 
@@ -277,9 +279,9 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
277
279
 
278
280
  // we have a data type from a companion specification
279
281
  // let's see if this data type need to be registered
280
- const isEnumeration = enumeration && this.isSupertypeOf(enumeration);
281
- const isStructure = structure && this.isSupertypeOf(structure);
282
- const isUnion = !!(structure && union && this.isSupertypeOf(union));
282
+ const isEnumeration = enumeration && this.isSubtypeOf(enumeration);
283
+ const isStructure = structure && this.isSubtypeOf(structure);
284
+ const isUnion = !!(structure && union && this.isSubtypeOf(union));
283
285
 
284
286
  const isRootDataType = (n: UADataType) => n.nodeId.namespace === 0 && n.nodeId.value === DataTypeIds.BaseDataType;
285
287
  // https://reference.opcfoundation.org/v104/Core/docs/Part3/8.49/#Table34
@@ -367,24 +369,24 @@ export function DataType_toString(this: UADataTypeImpl, options: ToStringOption)
367
369
 
368
370
  options.add(
369
371
  options.padding +
370
- chalk.yellow(" binaryEncodingNodeId: ") +
371
- (this.binaryEncodingNodeId ? this.binaryEncodingNodeId.toString() : "<none>")
372
+ chalk.yellow(" binaryEncodingNodeId: ") +
373
+ (this.binaryEncodingNodeId ? this.binaryEncodingNodeId.toString() : "<none>")
372
374
  );
373
375
  options.add(
374
376
  options.padding +
375
- chalk.yellow(" xmlEncodingNodeId : ") +
376
- (this.xmlEncodingNodeId ? this.xmlEncodingNodeId.toString() : "<none>")
377
+ chalk.yellow(" xmlEncodingNodeId : ") +
378
+ (this.xmlEncodingNodeId ? this.xmlEncodingNodeId.toString() : "<none>")
377
379
  );
378
380
  options.add(
379
381
  options.padding +
380
- chalk.yellow(" jsonEncodingNodeId : ") +
381
- (this.jsonEncodingNodeId ? this.jsonEncodingNodeId.toString() : "<none>")
382
+ chalk.yellow(" jsonEncodingNodeId : ") +
383
+ (this.jsonEncodingNodeId ? this.jsonEncodingNodeId.toString() : "<none>")
382
384
  );
383
385
  if (this.subtypeOfObj) {
384
386
  options.add(
385
387
  options.padding +
386
- chalk.yellow(" subtypeOfObj : ") +
387
- (this.subtypeOfObj ? this.subtypeOfObj.browseName.toString() : "")
388
+ chalk.yellow(" subtypeOfObj : ") +
389
+ (this.subtypeOfObj ? this.subtypeOfObj.browseName.toString() : "")
388
390
  );
389
391
  }
390
392
  // references
@@ -418,8 +420,8 @@ function makeStructureDefinition(
418
420
  const structureType = isUnion
419
421
  ? StructureType.Union
420
422
  : hasOptionalFields
421
- ? StructureType.StructureWithOptionalFields
422
- : StructureType.Structure;
423
+ ? StructureType.StructureWithOptionalFields
424
+ : StructureType.Structure;
423
425
 
424
426
  const sd = new StructureDefinition({
425
427
  baseDataType,
@@ -21,8 +21,8 @@ import {
21
21
  import { SessionContext } from "../source/session_context";
22
22
  import { BaseNodeImpl } from "./base_node_impl";
23
23
  import { ToStringBuilder, UAObjectType_toString } from "./base_node_private";
24
- import { get_subtypeOf, get_subtypeOfObj } from "./tool_isSupertypeOf";
25
- import * as tools from "./tool_isSupertypeOf";
24
+ import { get_subtypeOf, get_subtypeOfObj } from "./tool_isSubtypeOf";
25
+ import * as tools from "./tool_isSubtypeOf";
26
26
  import {
27
27
  assertUnusedChildBrowseName,
28
28
  initialize_properties_and_components,
@@ -42,10 +42,16 @@ export class UAObjectTypeImpl extends BaseNodeImpl implements UAObjectType {
42
42
  public get subtypeOf(): NodeId | null {
43
43
  return get_subtypeOf.call(this);
44
44
  }
45
+
46
+
45
47
  public get subtypeOfObj(): UAObjectType | null {
46
48
  return get_subtypeOfObj.call(this) as any as UAObjectType;
47
49
  }
48
- public isSupertypeOf = tools.construct_isSupertypeOf<UAObjectType>(UAObjectTypeImpl);
50
+
51
+
52
+ public isSubtypeOf = tools.construct_isSubtypeOf<UAObjectType>(UAObjectTypeImpl);
53
+ /** @deprecated - use isSubtypeOf instead */
54
+ public isSupertypeOf = tools.construct_isSubtypeOf<UAObjectType>(UAObjectTypeImpl);
49
55
 
50
56
  constructor(options: any) {
51
57
  super(options);
@@ -14,8 +14,8 @@ import { DataType } from "node-opcua-variant";
14
14
 
15
15
  import { SessionContext, UAReferenceType as UAReferenceTypePublic } from "../source";
16
16
  import { BaseNodeImpl, InternalBaseNodeOptions } from "./base_node_impl";
17
- import * as tools from "./tool_isSupertypeOf";
18
- import { get_subtypeOf, get_subtypeOfObj } from "./tool_isSupertypeOf";
17
+ import * as tools from "./tool_isSubtypeOf";
18
+ import { get_subtypeOf, get_subtypeOfObj } from "./tool_isSubtypeOf";
19
19
  import { ReferenceImpl } from "./reference_impl";
20
20
  import { BaseNode_getCache } from "./base_node_private";
21
21
 
@@ -98,12 +98,15 @@ export class UAReferenceTypeImpl extends BaseNodeImpl implements UAReferenceType
98
98
  /**
99
99
  * returns true if self is a super type of baseType
100
100
  */
101
- public isSupertypeOf = tools.construct_isSupertypeOf<UAReferenceType>(UAReferenceTypeImpl);
101
+ public isSubtypeOf = tools.construct_isSubtypeOf<UAReferenceType>(UAReferenceTypeImpl);
102
+
103
+ /** @deprecated - use `isSubtypeOf` instead*/
104
+ public isSupertypeOf = tools.construct_isSubtypeOf<UAReferenceType>(UAReferenceTypeImpl);
102
105
 
103
106
  /**
104
107
  * @private
105
108
  */
106
- public _slow_isSupertypeOf = tools.construct_slow_isSupertypeOf<UAReferenceType>(UAReferenceTypeImpl);
109
+ public _slow_isSubtypeOf = tools.construct_slow_isSubtypeOf<UAReferenceType>(UAReferenceTypeImpl);
107
110
 
108
111
  constructor(options: UAReferenceTypeOptions) {
109
112
  super(options);