node-opcua-address-space 2.111.0 → 2.113.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 (65) hide show
  1. package/dist/source/loader/decode_xml_extension_object.js +0 -2
  2. package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
  3. package/dist/source/loader/load_nodeset2.js +4 -2
  4. package/dist/source/loader/load_nodeset2.js.map +1 -1
  5. package/dist/source/loader/make_xml_extension_object_parser.js +1 -3
  6. package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
  7. package/dist/source/loader/namespace_post_step.js +1 -0
  8. package/dist/source/loader/namespace_post_step.js.map +1 -1
  9. package/dist/src/address_space.js +6 -14
  10. package/dist/src/address_space.js.map +1 -1
  11. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +2 -5
  12. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
  13. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +6 -2
  14. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
  15. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +5 -5
  16. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  17. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +0 -1
  18. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  19. package/dist/src/alarms_and_conditions/ua_condition_impl.js +3 -7
  20. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  21. package/dist/src/base_node_impl.js +9 -19
  22. package/dist/src/base_node_impl.js.map +1 -1
  23. package/dist/src/namespace_impl.js +5 -6
  24. package/dist/src/namespace_impl.js.map +1 -1
  25. package/dist/src/nodeset_tools/construct_namespace_dependency.js +11 -6
  26. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  27. package/dist/src/nodeset_tools/nodeset_to_xml.js +8 -9
  28. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  29. package/dist/src/reference_impl.js +4 -1
  30. package/dist/src/reference_impl.js.map +1 -1
  31. package/dist/src/state_machine/finite_state_machine.js +2 -3
  32. package/dist/src/state_machine/finite_state_machine.js.map +1 -1
  33. package/dist/src/state_machine/ua_shelving_state_machine_ex.js +2 -2
  34. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
  35. package/dist/src/state_machine/ua_two_state_variable.js +0 -1
  36. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
  37. package/dist/src/ua_data_type_impl.js +0 -23
  38. package/dist/src/ua_data_type_impl.js.map +1 -1
  39. package/dist/src/ua_reference_type_impl.d.ts +1 -1
  40. package/dist/src/ua_variable_impl_ext_obj.js +15 -8
  41. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  42. package/dist/tsconfig_common.tsbuildinfo +1 -1
  43. package/distHelpers/add_event_generator_object.js +0 -4
  44. package/distHelpers/add_event_generator_object.js.map +1 -1
  45. package/package.json +31 -31
  46. package/source/loader/decode_xml_extension_object.ts +0 -2
  47. package/source/loader/load_nodeset2.ts +4 -2
  48. package/source/loader/make_xml_extension_object_parser.ts +1 -4
  49. package/source/loader/namespace_post_step.ts +1 -0
  50. package/src/address_space.ts +7 -15
  51. package/src/alarms_and_conditions/condition_snapshot_impl.ts +2 -6
  52. package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +6 -3
  53. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +6 -6
  54. package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +0 -1
  55. package/src/alarms_and_conditions/ua_condition_impl.ts +3 -7
  56. package/src/base_node_impl.ts +12 -20
  57. package/src/namespace_impl.ts +5 -6
  58. package/src/nodeset_tools/construct_namespace_dependency.ts +12 -7
  59. package/src/nodeset_tools/nodeset_to_xml.ts +8 -9
  60. package/src/reference_impl.ts +5 -1
  61. package/src/state_machine/finite_state_machine.ts +3 -4
  62. package/src/state_machine/ua_shelving_state_machine_ex.ts +2 -3
  63. package/src/state_machine/ua_two_state_variable.ts +0 -1
  64. package/src/ua_data_type_impl.ts +0 -24
  65. package/src/ua_variable_impl_ext_obj.ts +110 -82
@@ -1709,7 +1709,7 @@ export class NamespaceImpl implements NamespacePrivate {
1709
1709
  break;
1710
1710
  default:
1711
1711
  // tslint:disable-next-line:no-console
1712
- console.log("Invalid class Name", node.nodeClass);
1712
+ errorLog("Invalid class Name", node.nodeClass);
1713
1713
  throw new Error("Invalid class name specified");
1714
1714
  }
1715
1715
  }
@@ -1733,13 +1733,13 @@ export class NamespaceImpl implements NamespacePrivate {
1733
1733
  if (match) {
1734
1734
  const correctedName = match[1];
1735
1735
  // the application is using an old scheme
1736
- console.log(
1736
+ warningLog(
1737
1737
  chalk.green(
1738
1738
  "Warning : since node-opcua 0.4.2 " + "namespace index should not be prepended to the browse name anymore"
1739
1739
  )
1740
1740
  );
1741
- console.log(" ", options.browseName, " will be replaced with ", correctedName);
1742
- console.log(" Please update your code");
1741
+ warningLog(" ", options.browseName, " will be replaced with ", correctedName);
1742
+ warningLog(" Please update your code");
1743
1743
 
1744
1744
  const indexVerify = parseInt(match[0], 10);
1745
1745
  if (indexVerify !== this.index) {
@@ -1819,7 +1819,7 @@ export class NamespaceImpl implements NamespacePrivate {
1819
1819
  break;
1820
1820
  default:
1821
1821
  // tslint:disable:no-console
1822
- console.log("Invalid class Name", node.nodeClass);
1822
+ warningLog("Invalid class Name", node.nodeClass);
1823
1823
  throw new Error("Invalid class name specified");
1824
1824
  }
1825
1825
  const deleted = this._nodeid_index.delete(hashKey);
@@ -2234,7 +2234,6 @@ function _create_node_version_if_needed(node: BaseNode, options: { nodeVersion:
2234
2234
  propertyOf: node
2235
2235
  });
2236
2236
  const initialValue = typeof options.nodeVersion === "string" ? options.nodeVersion : "0";
2237
- // xx console.log(" init value =",initialValue);
2238
2237
  nodeVersion.setValueFromSource({ dataType: "String", value: initialValue });
2239
2238
  }
2240
2239
  }
@@ -1,11 +1,12 @@
1
1
  import { INamespace, UADataType, UAVariable, UAVariableType } from "node-opcua-address-space-base";
2
2
  import { NodeClass } from "node-opcua-data-model";
3
3
  import { StructureField } from "node-opcua-types";
4
- import { make_warningLog } from "node-opcua-debug";
4
+ import { make_debugLog, make_warningLog } from "node-opcua-debug";
5
5
  import { NamespacePrivate } from "../namespace_private";
6
6
  import { BaseNodeImpl, getReferenceType } from "../base_node_impl";
7
7
 
8
8
  const warningLog = make_warningLog(__filename);
9
+ const debugLog = make_debugLog(__filename);
9
10
 
10
11
  function _constructNamespaceDependency(
11
12
  namespace: INamespace,
@@ -71,7 +72,7 @@ function _constructNamespaceDependency(
71
72
  } else {
72
73
  // istanbul ignore next
73
74
  if (dataTypeNodeId.value != 0) {
74
- console.log("Internal error: Cannot find dataType", dataTypeNodeId.toString());
75
+ warningLog("Warning: Cannot find dataType", dataTypeNodeId.toString());
75
76
  }
76
77
  }
77
78
  }
@@ -151,12 +152,16 @@ export function constructNamespaceDependency(namespace: INamespace, priorityTabl
151
152
 
152
153
  _constructNamespaceDependency(namespace, dependency, depMap, _visitedDataType, priorityTable);
153
154
 
154
- doDebug && console.log("namespace : ", namespace.index, namespace.namespaceUri);
155
- doDebug && console.log(" ", dependency.map((d)=>d.index + " " + d.namespaceUri).join("\n "));
155
+ // istanbul ignore next
156
+ doDebug && debugLog("namespace : ", namespace.index, namespace.namespaceUri);
157
+ // istanbul ignore next
158
+ doDebug && debugLog(" ", dependency.map((d) => d.index + " " + d.namespaceUri).join("\n "));
156
159
 
157
- const sorted = dependency.sort((a, b) => priorityTable![a.index] < priorityTable![b.index] ? -1 : 1);
158
- doDebug && console.log("sorted:")
159
- doDebug && console.log(" ", sorted.map((d)=>d.index + " " + d.namespaceUri).join("\n "));
160
+ const sorted = dependency.sort((a, b) => (priorityTable![a.index] < priorityTable![b.index] ? -1 : 1));
161
+ // istanbul ignore next
162
+ doDebug && debugLog("sorted:");
163
+ // istanbul ignore next
164
+ doDebug && debugLog(" ", sorted.map((d) => d.index + " " + d.namespaceUri).join("\n "));
160
165
 
161
166
  return sorted;
162
167
  }
@@ -48,6 +48,7 @@ import { UAMethodImpl } from "../ua_method_impl";
48
48
  import { UADataTypeImpl } from "../ua_data_type_impl";
49
49
  import { UAVariableTypeImpl } from "../ua_variable_type_impl";
50
50
  import { SessionContext } from "../index_current";
51
+ import { UAViewImpl } from "../ua_view_impl";
51
52
 
52
53
  import { DefinitionMap2, TypeInfo } from "../../source/loader/make_xml_extension_object_parser";
53
54
  import { makeDefinitionMap } from "../../source/loader/decode_xml_extension_object";
@@ -56,7 +57,6 @@ import {
56
57
  constructNamespacePriorityTable,
57
58
  hasHigherPriorityThan
58
59
  } from "./construct_namespace_dependency";
59
- import { UAViewImpl } from "../ua_view_impl";
60
60
 
61
61
  // tslint:disable:no-var-requires
62
62
  const XMLWriter = require("xml-writer");
@@ -141,7 +141,6 @@ function _dumpReferences(xw: XmlWriter, node: BaseNode) {
141
141
  if (reference.nodeId.namespace !== node.nodeId.namespace) {
142
142
  // todo: may be check that reference.nodeId.namespace is one of the namespace
143
143
  // on which our namespace is build and not a derived one !
144
- // xx console.log("xxxxxxxxxxxxxx Keeping => ", referenceType.toString(), reference.node?.nodeId.toString());
145
144
  return true;
146
145
  }
147
146
  }
@@ -374,8 +373,8 @@ function _dumpVariantInnerExtensionObject(
374
373
  if (types.isNativeError(err)) {
375
374
  errorLog("Error in _dumpVariantExtensionObjectValue_Body !!!", err.message);
376
375
  }
377
- console.log(name);
378
- console.log(field);
376
+ debugLog(name);
377
+ debugLog(field);
379
378
  // throw err;
380
379
  }
381
380
  restoreDefaultNamespace(xw);
@@ -616,7 +615,7 @@ function _dumpValue(xw: XmlWriter, node: UAVariable | UAVariableType, value: Var
616
615
 
617
616
  const dataTypeNode = addressSpace.findDataType(node.dataType);
618
617
  if (!dataTypeNode) {
619
- console.log("Cannot find dataType:", node.dataType);
618
+ debugLog("Cannot find dataType:", node.dataType);
620
619
  return;
621
620
  }
622
621
  const dataTypeName = dataTypeNode.browseName.name!.toString();
@@ -764,7 +763,7 @@ function dumpReferencedNodes(xw: XmlWriter, node: BaseNode, forward: boolean) {
764
763
  assert(nodeChild instanceof BaseNodeImpl);
765
764
  if (nodeChild.nodeId.namespace === node.nodeId.namespace) {
766
765
  if (!xw.visitedNode[_hash(nodeChild)]) {
767
- console.log(
766
+ debugLog(
768
767
  node.nodeId.toString(),
769
768
  " dumping child ",
770
769
  nodeChild.browseName.toString(),
@@ -1053,7 +1052,7 @@ function dumpUAVariableType(xw: XmlWriter, node: UAVariableType) {
1053
1052
  const dataTypeNode = addressSpace.findNode(node.dataType);
1054
1053
  if (!dataTypeNode) {
1055
1054
  // throw new Error(" cannot find datatype " + node.dataType);
1056
- console.log(
1055
+ debugLog(
1057
1056
  " cannot find datatype " +
1058
1057
  node.dataType +
1059
1058
  " for node " +
@@ -1418,8 +1417,8 @@ NamespaceImpl.prototype.toNodeset2XML = function (this: NamespaceImpl) {
1418
1417
  // let's sort the dependencies in the same order as the translation table
1419
1418
  const sortedDependencies = dependency.sort((a, b) => translationTable[a.index] > translationTable[b.index] ? 1 : -1);
1420
1419
 
1421
- doDebug && console.log(sortedDependencies.map((a) => a.index + " + " + a.namespaceUri).join("\n"));
1422
- doDebug && console.log("translation table ", translationTable);
1420
+ doDebug && debugLog(sortedDependencies.map((a) => a.index + " + " + a.namespaceUri).join("\n"));
1421
+ doDebug && debugLog("translation table ", translationTable);
1423
1422
 
1424
1423
  for (const depend of sortedDependencies) {
1425
1424
  if (depend.index === 0) {
@@ -78,7 +78,7 @@ export function resolveReferenceType(addressSpace: MinimalistAddressSpace, refer
78
78
  const _reference = reference as ReferenceImpl;
79
79
  if (!_reference._referenceType) {
80
80
  if (!_reference.referenceType) {
81
- console.log(chalk.red("ERROR MISSING reference"), reference);
81
+ errorLog(chalk.red("ERROR MISSING reference"), reference);
82
82
  }
83
83
  _reference._referenceType = addressSpace.findReferenceType(reference.referenceType)!;
84
84
  }
@@ -169,3 +169,7 @@ export class ReferenceImpl implements UAReference {
169
169
  */
170
170
  }
171
171
  }
172
+ function errorLog(arg0: string, reference: UAReference) {
173
+ throw new Error("Function not implemented.");
174
+ }
175
+
@@ -14,7 +14,7 @@ import {
14
14
  QualifiedName
15
15
  } from "node-opcua-data-model";
16
16
  import { AttributeIds } from "node-opcua-data-model";
17
- import { make_warningLog } from "node-opcua-debug";
17
+ import { make_debugLog, make_warningLog } from "node-opcua-debug";
18
18
  import { NodeId, sameNodeId } from "node-opcua-nodeid";
19
19
  import { StatusCodes } from "node-opcua-status-code";
20
20
  import { DataType, Variant, VariantArrayType } from "node-opcua-variant";
@@ -35,6 +35,7 @@ import { UAObjectTypeImpl } from "../ua_object_type_impl";
35
35
  const warningLog = make_warningLog(__filename);
36
36
 
37
37
  const doDebug = false;
38
+ const debugLog = make_debugLog(__filename);
38
39
 
39
40
  export declare interface UATransitionImpl extends UATransition, UATransitionEx {}
40
41
  export class UATransitionImpl implements UATransition, UATransitionEx {}
@@ -217,8 +218,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
217
218
  if (!transition) {
218
219
  // istanbul ignore next
219
220
  if (doDebug) {
220
- // tslint:disable-next-line: no-console
221
- console.log(" No transition from ", this.currentStateNode.browseName.toString(), " to ", toStateNode.toString());
221
+ debugLog(" No transition from ", this.currentStateNode.browseName.toString(), " to ", toStateNode.toString());
222
222
  }
223
223
  return false;
224
224
  }
@@ -522,7 +522,6 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
522
522
  }
523
523
  };
524
524
  applyLastTransitionOptionalProps();
525
- // xx console.log("transitionNode ",transitionNode.toString());
526
525
  // The inherited Property SourceNode shall be filled with the NodeId of the StateMachine instance where the
527
526
  // Transition occurs. If the Transition occurs in a SubStateMachine, then the NodeId of the SubStateMachine
528
527
  // has to be used. If the Transition occurs between a StateMachine and a SubStateMachine, then the NodeId of
@@ -125,7 +125,6 @@ function _unshelve_method(inputArguments: VariantLike[], context: ISessionContex
125
125
  export function _clear_timer_if_any(shelvingState: UAShelvedStateMachineExImpl): void {
126
126
  if (shelvingState._timer) {
127
127
  clearTimeout(shelvingState._timer);
128
- // xx console.log("_clear_timer_if_any shelvingState = ",shelvingState._timer,shelvingState.constructor.name);
129
128
  shelvingState._timer = null;
130
129
  }
131
130
  }
@@ -134,6 +133,7 @@ function _automatically_unshelve(shelvingState: UAShelvedStateMachineExImpl) {
134
133
  assert(shelvingState._timer, "expecting timerId to be set");
135
134
  shelvingState._timer = null;
136
135
 
136
+ // istanbul ignore next
137
137
  if (doDebug) {
138
138
  debugLog("Automatically unshelving variable ", shelvingState.browseName.toString());
139
139
  }
@@ -157,6 +157,7 @@ function _start_timer_for_automatic_unshelve(shelvingState: UAShelvedStateMachin
157
157
  shelvingState._sheveldTime = new Date(); // now
158
158
  shelvingState._duration = duration;
159
159
 
160
+ // istanbul ignore next
160
161
  if (doDebug) {
161
162
  debugLog("shelvingState._duration", shelvingState._duration);
162
163
  }
@@ -217,8 +218,6 @@ function _timedShelve_method(
217
218
  assert(inputArguments[0].dataType === DataType.Double); // Duration
218
219
  assert(inputArguments[0] instanceof Variant);
219
220
 
220
- // xx console.log("inputArguments",inputArguments[0].toString());
221
-
222
221
  const proposedDuration = inputArguments[0].value; // as double (milliseconds)
223
222
  if (proposedDuration > maxTimeShelved) {
224
223
  return callback(null, {
@@ -63,7 +63,6 @@ function _updateTransitionTime(node: UATwoStateVariableEx, _subState?: UAVariabl
63
63
 
64
64
  function _updateEffectiveTransitionTime(node: UATwoStateVariableImpl) {
65
65
  if (node.effectiveTransitionTime) {
66
- // xx console.log("xxxx _updateEffectiveTransitionTime
67
66
  // because subStateNode ",subStateNode.browseName.toString());
68
67
  node.effectiveTransitionTime.setValueFromSource({
69
68
  dataType: DataType.DateTime,
@@ -431,27 +431,3 @@ function makeStructureDefinition(
431
431
  });
432
432
  return sd;
433
433
  }
434
-
435
- /*
436
- function lockReadOnlyWithWriteDetection<T>(obj: T): T {
437
- if (obj instanceof Array) {
438
- return obj.map(lockReadOnlyWithWriteDetection) as unknown as T;
439
- }
440
- if (obj instanceof Object) {
441
- const _org = obj;
442
- for (const [key, value] of Object.entries(obj)) {
443
- lockReadOnlyWithWriteDetection(value);
444
- }
445
- obj = new Proxy(obj, {
446
- get: (target: any, prop: string) => {
447
- return target[prop];
448
- },
449
- set: (target: any, prop: string | symbol, value: any, receiver: any) => {
450
- console.log("QQQQQ Cannot modify stuff ");
451
- throw new Error("Invalid");
452
- }
453
- });
454
- }
455
- return obj;
456
- }
457
- */