node-opcua-address-space 2.113.0 → 2.114.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 (87) hide show
  1. package/dist/source/helpers/call_helpers.js +1 -2
  2. package/dist/source/helpers/call_helpers.js.map +1 -1
  3. package/dist/source/helpers/resolve_opaque_on_address_space.js +15 -26
  4. package/dist/source/helpers/resolve_opaque_on_address_space.js.map +1 -1
  5. package/dist/source/loader/ensure_datatype_extracted.js +19 -30
  6. package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
  7. package/dist/source/loader/generateAddressSpaceRaw.js +16 -27
  8. package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
  9. package/dist/source/loader/load_nodeset2.js +98 -97
  10. package/dist/source/loader/load_nodeset2.js.map +1 -1
  11. package/dist/source/loader/make_xml_extension_object_parser.js +1 -1
  12. package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
  13. package/dist/source/loader/namespace_post_step.js +24 -38
  14. package/dist/source/loader/namespace_post_step.js.map +1 -1
  15. package/dist/source/session_context.js +3 -6
  16. package/dist/source/session_context.js.map +1 -1
  17. package/dist/source/set_namespace_meta_data.js +2 -3
  18. package/dist/source/set_namespace_meta_data.js.map +1 -1
  19. package/dist/src/address_space.js +12 -23
  20. package/dist/src/address_space.js.map +1 -1
  21. package/dist/src/address_space_change_event_tools.js +1 -1
  22. package/dist/src/address_space_change_event_tools.js.map +1 -1
  23. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +1 -2
  24. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
  25. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +1 -2
  26. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  27. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +2 -4
  28. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  29. package/dist/src/alarms_and_conditions/ua_condition_impl.js +1 -1
  30. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  31. package/dist/src/base_node_private.js +17 -11
  32. package/dist/src/base_node_private.js.map +1 -1
  33. package/dist/src/data_access/ua_multistate_discrete_impl.js +7 -1
  34. package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -1
  35. package/dist/src/data_access/ua_multistate_value_discrete_impl.d.ts +2 -2
  36. package/dist/src/data_access/ua_multistate_value_discrete_impl.js +10 -5
  37. package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
  38. package/dist/src/extension_object_array_node.js +1 -2
  39. package/dist/src/extension_object_array_node.js.map +1 -1
  40. package/dist/src/get_basic_datatype.d.ts +8 -0
  41. package/dist/src/get_basic_datatype.js +26 -0
  42. package/dist/src/get_basic_datatype.js.map +1 -0
  43. package/dist/src/historical_access/address_space_historical_data_node.js +31 -48
  44. package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
  45. package/dist/src/namespace_impl.js +12 -7
  46. package/dist/src/namespace_impl.js.map +1 -1
  47. package/dist/src/nodeset_tools/construct_namespace_dependency.js +47 -3
  48. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  49. package/dist/src/nodeset_tools/dump_to_bsd.js +4 -6
  50. package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
  51. package/dist/src/nodeset_tools/nodeset_to_xml.js +29 -27
  52. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  53. package/dist/src/private_namespace.js +1 -1
  54. package/dist/src/private_namespace.js.map +1 -1
  55. package/dist/src/reference_impl.js +1 -1
  56. package/dist/src/reference_impl.js.map +1 -1
  57. package/dist/src/state_machine/ua_two_state_variable.js +1 -2
  58. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
  59. package/dist/src/ua_data_type_impl.js +6 -6
  60. package/dist/src/ua_data_type_impl.js.map +1 -1
  61. package/dist/src/ua_method_impl.js +6 -4
  62. package/dist/src/ua_method_impl.js.map +1 -1
  63. package/dist/src/ua_object_impl.js +5 -1
  64. package/dist/src/ua_object_impl.js.map +1 -1
  65. package/dist/src/ua_object_type_impl.js +1 -2
  66. package/dist/src/ua_object_type_impl.js.map +1 -1
  67. package/dist/src/ua_reference_type_impl.d.ts +1 -1
  68. package/dist/src/ua_variable_impl.js +18 -26
  69. package/dist/src/ua_variable_impl.js.map +1 -1
  70. package/dist/src/ua_variable_impl_ext_obj.js +10 -9
  71. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  72. package/dist/src/ua_variable_type_impl.d.ts +2 -0
  73. package/dist/src/ua_variable_type_impl.js +7 -6
  74. package/dist/src/ua_variable_type_impl.js.map +1 -1
  75. package/dist/tsconfig_common.tsbuildinfo +1 -1
  76. package/distNodeJS/generate_address_space.js +10 -21
  77. package/distNodeJS/generate_address_space.js.map +1 -1
  78. package/package.json +38 -38
  79. package/source/loader/load_nodeset2.ts +12 -10
  80. package/src/data_access/ua_multistate_value_discrete_impl.ts +9 -11
  81. package/src/get_basic_datatype.ts +32 -0
  82. package/src/nodeset_tools/construct_namespace_dependency.ts +48 -11
  83. package/src/nodeset_tools/nodeset_to_xml.ts +35 -31
  84. package/src/ua_data_type_impl.ts +6 -2
  85. package/src/ua_variable_impl.ts +5 -22
  86. package/src/ua_variable_impl_ext_obj.ts +9 -4
  87. package/src/ua_variable_type_impl.ts +5 -4
@@ -30,6 +30,7 @@ import * as tools from "./tool_isSubtypeOf";
30
30
  import { get_subtypeOf } from "./tool_isSubtypeOf";
31
31
  import { get_subtypeOfObj } from "./tool_isSubtypeOf";
32
32
  import { BaseNode_getCache } from "./base_node_private";
33
+ import { Int64, coerceInt32, coerceInt64, coerceInt64toInt32 } from "node-opcua-basic-types";
33
34
 
34
35
  export interface UADataTypeImpl {
35
36
  _extensionObjectConstructor: ExtensionObjectConstructorFuncWithSchema;
@@ -230,7 +231,7 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
230
231
  definition = enumValues.map((e: any) => {
231
232
  return {
232
233
  name: e.displayName.text,
233
- value: e.value[1]
234
+ value: coerceInt64toInt32(e.value)
234
235
  };
235
236
  });
236
237
  }
@@ -395,12 +396,15 @@ export function DataType_toString(this: UADataTypeImpl, options: ToStringOption)
395
396
  dataTypeDefinition_toString.call(this, options);
396
397
  }
397
398
 
399
+
400
+ const defaultEnumValue: Int64 = coerceInt64(-1);
401
+
398
402
  function makeEnumDefinition(definitionFields: EnumFieldOptions[]) {
399
403
  return new EnumDefinition({
400
404
  fields: definitionFields.map((x) => ({
401
405
  description: x.description,
402
406
  name: x.name,
403
- value: x.value
407
+ value: x.value === undefined ? defaultEnumValue : coerceInt64(x.value)
404
408
  }))
405
409
  });
406
410
  }
@@ -1,11 +1,7 @@
1
1
  /* eslint-disable max-statements */
2
- /* eslint-disable complexity */
3
2
  /**
4
3
  * @module node-opcua-address-space
5
4
  */
6
- // tslint:disable:no-bitwise
7
- // tslint:disable:no-console
8
- // tslint:disable:max-line-length
9
5
  import { types } from "util";
10
6
  import chalk from "chalk";
11
7
 
@@ -97,6 +93,7 @@ import {
97
93
  _touchValue
98
94
  } from "./ua_variable_impl_ext_obj";
99
95
  import { adjustDataValueStatusCode } from "./data_access/adjust_datavalue_status_code";
96
+ import { _getBasicDataType } from "./get_basic_datatype";
100
97
 
101
98
  const debugLog = make_debugLog(__filename);
102
99
  const warningLog = make_warningLog(__filename);
@@ -714,23 +711,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
714
711
  }
715
712
 
716
713
  public getBasicDataType(): DataType {
717
- if (this._basicDataType) {
718
- return this._basicDataType;
719
- }
720
- if (this.dataType.namespace === 0 && this.dataType.value === 0) {
721
- return DataType.Null;
722
- }
723
- const addressSpace = this.addressSpace;
724
- if (!addressSpace) {
725
- // may be node has been deleted already
726
- return DataType.Null;
727
- }
728
- const dataTypeNode = addressSpace.findDataType(this.dataType)!;
729
- const basicDataType =
730
- dataTypeNode && dataTypeNode.nodeClass === NodeClass.DataType ? dataTypeNode.getBasicDataType() : DataType.Null;
731
- // const basicDataType = addressSpace.findCorrespondingBasicDataType(this.dataType);
732
- this._basicDataType = basicDataType;
733
- return basicDataType;
714
+ return _getBasicDataType(this);
734
715
  }
735
716
  public adjustVariant(variant: Variant): Variant {
736
717
  return adjustVariant(variant, this.valueRank, this.getBasicDataType());
@@ -1425,7 +1406,9 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1425
1406
  // has not yet been loaded !
1426
1407
  return true;
1427
1408
  }
1428
-
1409
+ if (dataType.nodeId.namespace === 0 && dataType.nodeId.value === DataType.ExtensionObject) {
1410
+ return true;
1411
+ }
1429
1412
  const Constructor = addressSpace.getExtensionObjectConstructor(this.dataType);
1430
1413
 
1431
1414
  if (this.valueRank === -1) {
@@ -523,11 +523,16 @@ export function _bindExtensionObject(
523
523
  return uaVariable.$extensionObject;
524
524
  }
525
525
 
526
- // istanbul ignore next
527
526
  if (uaVariable.dataTypeObj.isAbstract) {
528
- warningLog("Warning the DataType associated with this Variable is abstract ", uaVariable.dataTypeObj.browseName.toString());
529
- warningLog("You need to provide a extension object yourself ");
530
- throw new Error("bindExtensionObject requires a extensionObject as associated dataType is only abstract");
527
+ // istanbul ignore next
528
+ if (!optionalExtensionObject) {
529
+ warningLog(
530
+ "Warning the DataType associated with this Variable is abstract ",
531
+ uaVariable.dataTypeObj.browseName.toString()
532
+ );
533
+ warningLog("You need to provide a extension object yourself ");
534
+ throw new Error("bindExtensionObject requires a extensionObject as associated dataType is only abstract");
535
+ }
531
536
  }
532
537
 
533
538
  const s = uaVariable.readValue();
@@ -13,10 +13,9 @@ import {
13
13
  ModellingRuleType,
14
14
  INamespace,
15
15
  UAVariable,
16
- UAVariableType,
16
+ UAVariableType
17
17
  } from "node-opcua-address-space-base";
18
18
 
19
-
20
19
  import { coerceQualifiedName, NodeClass, QualifiedName, BrowseDirection, AttributeIds } from "node-opcua-data-model";
21
20
  import { DataValue, DataValueLike } from "node-opcua-data-value";
22
21
  import { checkDebugFlag, make_debugLog, make_warningLog, make_errorLog } from "node-opcua-debug";
@@ -36,6 +35,7 @@ import * as tools from "./tool_isSubtypeOf";
36
35
  import { get_subtypeOfObj } from "./tool_isSubtypeOf";
37
36
  import { get_subtypeOf } from "./tool_isSubtypeOf";
38
37
  import { checkValueRankCompatibility } from "./check_value_rank_compatibility";
38
+ import { _getBasicDataType } from "./get_basic_datatype";
39
39
 
40
40
  const debugLog = make_debugLog(__filename);
41
41
  const doDebug = checkDebugFlag(__filename);
@@ -306,9 +306,11 @@ export class UAVariableTypeImpl extends BaseNodeImpl implements UAVariableType {
306
306
 
307
307
  return instance;
308
308
  }
309
+ public getBasicDataType(): DataType {
310
+ return _getBasicDataType(this);
311
+ }
309
312
  }
310
313
 
311
-
312
314
  /**
313
315
  * @method hasChildWithBrowseName
314
316
  * returns true if the parent object has a child with the provided browseName
@@ -365,4 +367,3 @@ export function assertUnusedChildBrowseName(addressSpace: AddressSpacePrivate, o
365
367
  );
366
368
  }
367
369
  }
368
-