node-opcua-address-space 2.58.0 → 2.62.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/dist/source/address_space_ts.d.ts +0 -2
- package/dist/source/helpers/argument_list.js +12 -1
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/multiform_func.d.ts +11 -0
- package/dist/source/helpers/multiform_func.js +74 -0
- package/dist/source/helpers/multiform_func.js.map +1 -0
- package/dist/source/loader/load_nodeset2.js +47 -64
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/set_namespace_meta_data.js +1 -1
- package/dist/src/address_space.js +12 -6
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot.js +3 -3
- package/dist/src/alarms_and_conditions/condition_snapshot.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +8 -6
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/base_node_impl.js +2 -0
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.d.ts +3 -3
- package/dist/src/base_node_private.js +198 -25
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/event_data.js +1 -1
- package/dist/src/event_data.js.map +1 -1
- package/dist/src/namespace_impl.js +5 -5
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +15 -9
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/nodeset_tools/typedictionary_to_xml.js +17 -10
- package/dist/src/nodeset_tools/typedictionary_to_xml.js.map +1 -1
- package/dist/src/reference_impl.js +1 -1
- package/dist/src/reference_impl.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +20 -13
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/ua_data_type_impl.d.ts +15 -5
- package/dist/src/ua_data_type_impl.js +129 -51
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_method_impl.js +2 -1
- package/dist/src/ua_method_impl.js.map +1 -1
- package/dist/src/ua_object_impl.js +2 -1
- package/dist/src/ua_object_impl.js.map +1 -1
- package/dist/src/ua_object_type_impl.js +1 -0
- package/dist/src/ua_object_type_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.d.ts +12 -18
- package/dist/src/ua_variable_impl.js +285 -215
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_type_impl.d.ts +3 -4
- package/dist/src/ua_variable_type_impl.js +61 -52
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/src/ua_view_impl.js +1 -1
- package/dist/src/ua_view_impl.js.map +1 -1
- package/distHelpers/mock_session.js +1 -1
- package/distHelpers/mock_session.js.map +1 -1
- package/package.json +35 -35
- package/source/address_space_ts.ts +0 -1
- package/source/helpers/argument_list.ts +13 -3
- package/source/helpers/multiform_func.ts +76 -0
- package/source/loader/load_nodeset2.ts +64 -80
- package/source/set_namespace_meta_data.ts +1 -1
- package/src/address_space.ts +16 -7
- package/src/alarms_and_conditions/condition_snapshot.ts +4 -4
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +2 -2
- package/src/alarms_and_conditions/ua_condition_impl.ts +18 -8
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +1 -1
- package/src/base_node_impl.ts +3 -1
- package/src/base_node_private.ts +282 -36
- package/src/event_data.ts +1 -1
- package/src/namespace_impl.ts +6 -6
- package/src/nodeset_tools/nodeset_to_xml.ts +20 -10
- package/src/nodeset_tools/typedictionary_to_xml.ts +17 -7
- package/src/reference_impl.ts +3 -3
- package/src/state_machine/ua_shelving_state_machine_ex.ts +28 -16
- package/src/ua_data_type_impl.ts +168 -61
- package/src/ua_method_impl.ts +10 -2
- package/src/ua_object_impl.ts +10 -2
- package/src/ua_object_type_impl.ts +1 -0
- package/src/ua_variable_impl.ts +419 -325
- package/src/ua_variable_type_impl.ts +87 -52
- package/src/ua_view_impl.ts +1 -1
- package/test_helpers/mock_session.ts +1 -1
- package/test_helpers/test_fixtures/fixture_simple_statemachine_nodeset2.xml +18 -0
- package/test_helpers/test_fixtures/fixuture_nodeset_objects_with_some_methods.xml +9 -1
- package/test_helpers/test_fixtures/mini.Node.Set2.xml +22 -1
package/src/address_space.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object
|
|
|
10
10
|
import { DataTypeIds, VariableTypeIds } from "node-opcua-constants";
|
|
11
11
|
import { BrowseDirection, NodeClass, QualifiedName } from "node-opcua-data-model";
|
|
12
12
|
import { ExtensionObject } from "node-opcua-extension-object";
|
|
13
|
-
import { coerceExpandedNodeId, makeNodeId, NodeId, NodeIdLike, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
13
|
+
import { coerceExpandedNodeId, coerceNodeId, makeNodeId, NodeId, NodeIdLike, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
14
14
|
import { ObjectRegistry } from "node-opcua-object-registry";
|
|
15
15
|
import { BrowseResult } from "node-opcua-service-browse";
|
|
16
16
|
import { StatusCodes } from "node-opcua-status-code";
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
UAView,
|
|
45
45
|
RaiseEventData
|
|
46
46
|
} from "node-opcua-address-space-base";
|
|
47
|
+
import { make_errorLog } from "node-opcua-debug";
|
|
47
48
|
|
|
48
49
|
import { adjustBrowseDirection } from "../source/helpers/adjust_browse_direction";
|
|
49
50
|
import { UARootFolder } from "../source/ua_root_folder";
|
|
@@ -65,10 +66,13 @@ import { UAReferenceTypeImpl } from "./ua_reference_type_impl";
|
|
|
65
66
|
import { BaseNodeImpl } from "./base_node_impl";
|
|
66
67
|
|
|
67
68
|
const doDebug = false;
|
|
69
|
+
const errorLog = make_errorLog(__filename);
|
|
70
|
+
|
|
68
71
|
// tslint:disable-next-line:no-var-requires
|
|
69
72
|
const Dequeue = require("dequeue");
|
|
70
73
|
|
|
71
74
|
const regexNumberColumnString = /^([0-9]+):(.*)/;
|
|
75
|
+
const enumerationTypeNodeId = coerceNodeId(DataTypeIds.Enumeration);
|
|
72
76
|
|
|
73
77
|
function _extract_namespace_and_browse_name_as_string(
|
|
74
78
|
addressSpace: AddressSpace,
|
|
@@ -472,10 +476,8 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
472
476
|
dataTypeNode.constructor.name
|
|
473
477
|
);
|
|
474
478
|
}
|
|
475
|
-
dataTypeNode = dataTypeNode as UADataType;
|
|
476
479
|
|
|
477
|
-
|
|
478
|
-
if (sameNodeId(enumerationType.nodeId, dataTypeNode!.nodeId)) {
|
|
480
|
+
if (sameNodeId(enumerationTypeNodeId, dataTypeNode!.nodeId)) {
|
|
479
481
|
return DataType.Int32;
|
|
480
482
|
}
|
|
481
483
|
|
|
@@ -484,10 +486,17 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
484
486
|
return DataType.Null; //which one ?
|
|
485
487
|
}
|
|
486
488
|
|
|
487
|
-
if (dataTypeNode.nodeId.namespace === 0 &&
|
|
489
|
+
if (dataTypeNode.nodeId.namespace === 0 && dataTypeNode.nodeId.value === 0) {
|
|
490
|
+
return DataType.Null;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (dataTypeNode.nodeId.namespace === 0 && dataTypeNode.nodeId.value <= 25) {
|
|
488
494
|
return dataTypeNode.nodeId.value as DataType;
|
|
489
495
|
}
|
|
490
|
-
|
|
496
|
+
|
|
497
|
+
const result = this.findCorrespondingBasicDataType(dataTypeNode.subtypeOfObj as UADataType);
|
|
498
|
+
|
|
499
|
+
return result;
|
|
491
500
|
}
|
|
492
501
|
|
|
493
502
|
/**
|
|
@@ -1267,7 +1276,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1267
1276
|
try {
|
|
1268
1277
|
func();
|
|
1269
1278
|
} catch (err) {
|
|
1270
|
-
|
|
1279
|
+
errorLog("modelChangeTransaction", (err as Error)?.message);
|
|
1271
1280
|
throw err;
|
|
1272
1281
|
} finally {
|
|
1273
1282
|
endModelChange.call(this);
|
|
@@ -9,7 +9,7 @@ import { UInt16 } from "node-opcua-basic-types";
|
|
|
9
9
|
import { coerceLocalizedText, LocalizedText, LocalizedTextLike, NodeClass } from "node-opcua-data-model";
|
|
10
10
|
import { DataValue } from "node-opcua-data-value";
|
|
11
11
|
import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
|
|
12
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
12
|
+
import { NodeId, sameNodeId } from "node-opcua-nodeid";
|
|
13
13
|
import { UAAcknowledgeableCondition } from "node-opcua-nodeset-ua";
|
|
14
14
|
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
15
15
|
import { SimpleAttributeOperand, TimeZoneDataType } from "node-opcua-types";
|
|
@@ -175,14 +175,14 @@ export class ConditionSnapshot extends EventEmitter {
|
|
|
175
175
|
// a nodeId/Variant map
|
|
176
176
|
_record_condition_state(this, condition);
|
|
177
177
|
|
|
178
|
-
if (branchId
|
|
178
|
+
if (sameNodeId(branchId, NodeId.nullNodeId)) {
|
|
179
179
|
_installOnChangeEventHandlers(this, condition, "");
|
|
180
180
|
}
|
|
181
181
|
this._set_var("branchId", DataType.NodeId, branchId);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
public _constructEventData(): IEventData {
|
|
185
|
-
if (this.branchId
|
|
185
|
+
if (this.branchId && sameNodeId(this.branchId, NodeId.nullNodeId)) {
|
|
186
186
|
_ensure_condition_values_correctness(this, this.condition!, "", []);
|
|
187
187
|
}
|
|
188
188
|
const c = this.condition as UAConditionImpl;
|
|
@@ -594,7 +594,7 @@ export class ConditionSnapshot extends EventEmitter {
|
|
|
594
594
|
}
|
|
595
595
|
|
|
596
596
|
public isCurrentBranch(): boolean {
|
|
597
|
-
return this._get_var("branchId")
|
|
597
|
+
return sameNodeId(this._get_var("branchId"), NodeId.nullNodeId);
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
// -- ACKNOWLEDGEABLE -------------------------------------------------------------------
|
|
@@ -6,7 +6,7 @@ import { isEqual } from "lodash";
|
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
7
|
import { NodeClass } from "node-opcua-data-model";
|
|
8
8
|
import { DataValue } from "node-opcua-data-value";
|
|
9
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
9
|
+
import { NodeId, sameNodeId } from "node-opcua-nodeid";
|
|
10
10
|
import { StatusCodes } from "node-opcua-status-code";
|
|
11
11
|
import { DataType } from "node-opcua-variant";
|
|
12
12
|
import { UAAlarmCondition_Base } from "node-opcua-nodeset-ua";
|
|
@@ -498,7 +498,7 @@ export class UAAlarmConditionImpl extends UAAcknowledgeableConditionImpl impleme
|
|
|
498
498
|
if (this.currentBranch().getRetain()) {
|
|
499
499
|
// we need to create a new branch so the previous state could be acknowledged
|
|
500
500
|
const newBranch = this.createBranch();
|
|
501
|
-
assert(newBranch.getBranchId()
|
|
501
|
+
assert(!sameNodeId(newBranch.getBranchId(), NodeId.nullNodeId));
|
|
502
502
|
// also raised a new Event for the new branch as branchId has changed
|
|
503
503
|
this.raiseNewBranchState(newBranch);
|
|
504
504
|
}
|
|
@@ -238,7 +238,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
238
238
|
*/
|
|
239
239
|
public post_initialize(): void {
|
|
240
240
|
assert(!this._branch0);
|
|
241
|
-
this._branch0 = new ConditionSnapshot(this, NodeId
|
|
241
|
+
this._branch0 = new ConditionSnapshot(this, new NodeId());
|
|
242
242
|
|
|
243
243
|
// the condition OPCUA object alway reflects the default branch states
|
|
244
244
|
// so we set a mechanism that automatically keeps self in sync
|
|
@@ -284,7 +284,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
284
284
|
*/
|
|
285
285
|
public deleteBranch(branch: ConditionSnapshot): void {
|
|
286
286
|
const key = branch.getBranchId().toString();
|
|
287
|
-
assert(branch.getBranchId()
|
|
287
|
+
assert(!sameNodeId(branch.getBranchId(), NodeId.nullNodeId), "cannot delete branch zero");
|
|
288
288
|
assert(Object.prototype.hasOwnProperty.call(this._branches, key));
|
|
289
289
|
delete this._branches[key];
|
|
290
290
|
this.emit("branch_deleted", key);
|
|
@@ -560,7 +560,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
560
560
|
public raiseNewBranchState(branch: ConditionSnapshot): void {
|
|
561
561
|
this.raiseConditionEvent(branch, true);
|
|
562
562
|
|
|
563
|
-
if (branch.getBranchId()
|
|
563
|
+
if (!sameNodeId(branch.getBranchId(), NodeId.nullNodeId) && !branch.getRetain()) {
|
|
564
564
|
// xx console.log(" Deleting not longer needed branch ", branch.getBranchId().toString());
|
|
565
565
|
// branch can be deleted
|
|
566
566
|
this.deleteBranch(branch);
|
|
@@ -789,7 +789,7 @@ function UACondition_instantiate(
|
|
|
789
789
|
// install initial branch ID (null NodeId);
|
|
790
790
|
conditionNode.branchId.setValueFromSource({
|
|
791
791
|
dataType: DataType.NodeId,
|
|
792
|
-
value: NodeId
|
|
792
|
+
value: new NodeId()
|
|
793
793
|
});
|
|
794
794
|
|
|
795
795
|
// install 'Comment' condition variable
|
|
@@ -920,7 +920,9 @@ function UACondition_instantiate(
|
|
|
920
920
|
conditionNode.sourceNode.setValueFromSource(conditionSourceNode.readAttribute(null, AttributeIds.NodeId).value);
|
|
921
921
|
|
|
922
922
|
// set source Name (defined in UABaseEventType)
|
|
923
|
-
|
|
923
|
+
const displayName: LocalizedText = conditionSourceNode.readAttribute(null, AttributeIds.DisplayName).value
|
|
924
|
+
.value as LocalizedText;
|
|
925
|
+
conditionNode.sourceName.setValueFromSource({ dataType: DataType.String, value: displayName.text });
|
|
924
926
|
}
|
|
925
927
|
}
|
|
926
928
|
|
|
@@ -953,7 +955,7 @@ function UACondition_instantiate(
|
|
|
953
955
|
*/
|
|
954
956
|
const baseConditionClassType = addressSpace.findObjectType("ProcessConditionClassType");
|
|
955
957
|
// assert(baseConditionClassType,"Expecting BaseConditionClassType to be in addressSpace");
|
|
956
|
-
let conditionClassId = baseConditionClassType ? baseConditionClassType.nodeId : NodeId
|
|
958
|
+
let conditionClassId = baseConditionClassType ? baseConditionClassType.nodeId : new NodeId();
|
|
957
959
|
let conditionClassName = baseConditionClassType ? baseConditionClassType.displayName[0] : "";
|
|
958
960
|
if (options.conditionClass) {
|
|
959
961
|
if (typeof options.conditionClass === "string") {
|
|
@@ -1123,7 +1125,11 @@ function _perform_condition_refresh(addressSpace: AddressSpacePrivate, inputArgu
|
|
|
1123
1125
|
return StatusCodes.Good;
|
|
1124
1126
|
}
|
|
1125
1127
|
|
|
1126
|
-
function _condition_refresh2_method(
|
|
1128
|
+
function _condition_refresh2_method(
|
|
1129
|
+
inputArguments: VariantLike[],
|
|
1130
|
+
context: ISessionContext,
|
|
1131
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
1132
|
+
) {
|
|
1127
1133
|
// arguments : IntegerId SubscriptionId
|
|
1128
1134
|
// arguments : IntegerId MonitoredItemId
|
|
1129
1135
|
assert(inputArguments.length === 2);
|
|
@@ -1146,7 +1152,11 @@ function _condition_refresh2_method(inputArguments: VariantLike[], context: ISes
|
|
|
1146
1152
|
});
|
|
1147
1153
|
}
|
|
1148
1154
|
|
|
1149
|
-
function _add_comment_method(
|
|
1155
|
+
function _add_comment_method(
|
|
1156
|
+
inputArguments: VariantLike[],
|
|
1157
|
+
context: ISessionContext,
|
|
1158
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
1159
|
+
) {
|
|
1150
1160
|
//
|
|
1151
1161
|
// The AddComment Method is used to apply a comment to a specific state of a Condition
|
|
1152
1162
|
// instance. Normally, the NodeId of the object instance as the ObjectId is passed to the Call
|
|
@@ -79,7 +79,7 @@ export class UAOffNormalAlarmImpl extends UADiscreteAlarmImpl implements UAOffNo
|
|
|
79
79
|
const normalState = addressSpace._coerceNode(options.normalState)! as UAVariable;
|
|
80
80
|
// assert(normalState, "Expecting a valid normalState node");
|
|
81
81
|
|
|
82
|
-
const normalStateNodeId = normalState ? normalState.nodeId : NodeId
|
|
82
|
+
const normalStateNodeId = normalState ? normalState.nodeId : new NodeId();
|
|
83
83
|
alarmNode.normalState.setValueFromSource({ dataType: DataType.NodeId, value: normalStateNodeId });
|
|
84
84
|
|
|
85
85
|
if (inputNode) {
|
package/src/base_node_impl.ts
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
AccessRestrictionsFlag
|
|
39
39
|
} from "node-opcua-data-model";
|
|
40
40
|
import { DataValue } from "node-opcua-data-value";
|
|
41
|
-
import { dumpIf, make_warningLog } from "node-opcua-debug";
|
|
41
|
+
import { dumpIf, make_warningLog, make_errorLog } from "node-opcua-debug";
|
|
42
42
|
import { coerceNodeId, makeNodeId, NodeId, NodeIdLike, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
43
43
|
import { NumericRange } from "node-opcua-numeric-range";
|
|
44
44
|
import { ReferenceDescription } from "node-opcua-service-browse";
|
|
@@ -83,6 +83,7 @@ import { coerceRolePermissions } from "./role_permissions";
|
|
|
83
83
|
|
|
84
84
|
const doDebug = false;
|
|
85
85
|
const warningLog = make_warningLog(__filename);
|
|
86
|
+
const errorLog = make_errorLog(__filename);
|
|
86
87
|
|
|
87
88
|
function defaultBrowseFilterFunc(context?: ISessionContext): boolean {
|
|
88
89
|
return true;
|
|
@@ -1205,6 +1206,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
1205
1206
|
result = this.addressSpace.findReferenceType(referenceType)!;
|
|
1206
1207
|
/* istanbul ignore next */
|
|
1207
1208
|
if (!result) {
|
|
1209
|
+
errorLog("referenceType ", referenceType, " cannot be found");
|
|
1208
1210
|
throw new Error("Cannot coerce reference with name " + referenceType);
|
|
1209
1211
|
}
|
|
1210
1212
|
} else if (referenceType instanceof NodeId) {
|