node-opcua-address-space 2.178.0 → 2.180.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 +16 -6
- package/dist/source/address_space_ts.js +1 -1
- package/dist/source/address_space_ts.js.map +1 -1
- package/dist/source/helpers/argument_list.js +2 -2
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/call_helpers.js +3 -0
- package/dist/source/helpers/call_helpers.js.map +1 -1
- package/dist/source/helpers/dump_tools.js +6 -2
- package/dist/source/helpers/dump_tools.js.map +1 -1
- package/dist/source/helpers/make_optionals_map.d.ts +3 -1
- package/dist/source/helpers/make_optionals_map.js.map +1 -1
- package/dist/source/interfaces/extension_object_constructor.d.ts +1 -1
- package/dist/source/interfaces/state_machine/ua_state_machine_type.js +0 -1
- package/dist/source/interfaces/state_machine/ua_state_machine_type.js.map +1 -1
- package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
- package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
- package/dist/source/loader/generateAddressSpaceRaw.js +2 -1
- package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +12 -8
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/loader/make_xml_extension_object_parser.js +26 -7
- package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
- package/dist/source/loader/namespace_post_step.js.map +1 -1
- package/dist/source/loader/parsers/extension_object_parser.d.ts +6 -4
- package/dist/source/loader/parsers/extension_object_parser.js +12 -6
- package/dist/source/loader/parsers/extension_object_parser.js.map +1 -1
- package/dist/source/loader/parsers/localized_text_parser.d.ts +1 -1
- package/dist/source/loader/parsers/nodeid_parser.d.ts +10 -2
- package/dist/source/loader/parsers/nodeid_parser.js.map +1 -1
- package/dist/source/loader/parsers/qualified_name_parser.d.ts +1 -2
- package/dist/source/loader/parsers/variant_parser.d.ts +8 -2
- package/dist/source/loader/parsers/variant_parser.js +11 -8
- package/dist/source/loader/parsers/variant_parser.js.map +1 -1
- package/dist/source/pseudo_session.js +70 -24
- package/dist/source/pseudo_session.js.map +1 -1
- package/dist/source/session_context.js +26 -19
- package/dist/source/session_context.js.map +1 -1
- package/dist/source/xml_writer.d.ts +1 -1
- package/dist/src/_instantiate_helpers.js +0 -3
- package/dist/src/_instantiate_helpers.js.map +1 -1
- package/dist/src/_mandatory_child_or_requested_optional_filter.d.ts +3 -2
- package/dist/src/_mandatory_child_or_requested_optional_filter.js +0 -2
- package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
- package/dist/src/address_space.d.ts +7 -2
- package/dist/src/address_space.js +36 -28
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/address_space_private.d.ts +1 -0
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +6 -9
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +6 -6
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +8 -4
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +6 -5
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +3 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +0 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/base_node_impl.js +17 -8
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.js +0 -6
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/extension_object_array_node.d.ts +9 -1
- package/dist/src/extension_object_array_node.js +20 -3
- package/dist/src/extension_object_array_node.js.map +1 -1
- package/dist/src/get_basic_datatype.js +3 -1
- package/dist/src/get_basic_datatype.js.map +1 -1
- package/dist/src/historical_access/address_space_historical_data_node.js +2 -4
- package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
- package/dist/src/namespace_impl.js +6 -5
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeid_manager.js +4 -5
- package/dist/src/nodeid_manager.js.map +1 -1
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +10 -11
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/src/nodeset_tools/dump_to_bsd.js +2 -4
- package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +71 -43
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/private_namespace.js.map +1 -1
- package/dist/src/reference_impl.d.ts +2 -2
- package/dist/src/reference_impl.js +5 -4
- package/dist/src/reference_impl.js.map +1 -1
- package/dist/src/state_machine/finite_state_machine.js +1 -1
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js +9 -7
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/tool_isSubtypeOf.js.map +1 -1
- package/dist/src/ua_data_type_impl.js +4 -4
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_method_impl.js +21 -11
- package/dist/src/ua_method_impl.js.map +1 -1
- package/dist/src/ua_object_type_impl.d.ts +5 -2
- package/dist/src/ua_object_type_impl.js +4 -3
- package/dist/src/ua_object_type_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.js +1 -2
- package/dist/src/ua_reference_type_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.d.ts +9 -11
- package/dist/src/ua_variable_impl.js +103 -65
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.d.ts +6 -6
- package/dist/src/ua_variable_impl_ext_obj.js +33 -22
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.js +6 -2
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/tsconfig_base.tsbuildinfo +1 -1
- package/distHelpers/add_event_generator_object.js +3 -0
- package/distHelpers/add_event_generator_object.js.map +1 -1
- package/distHelpers/boiler_system.js +27 -6
- package/distHelpers/boiler_system.js.map +1 -1
- package/distHelpers/create_minimalist_address_space_nodeset.js +3 -3
- package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -1
- package/distHelpers/date_utils.js.map +1 -1
- package/distHelpers/dump_statemachine.js +1 -1
- package/distHelpers/dump_statemachine.js.map +1 -1
- package/distHelpers/get_address_space_fixture.js +0 -1
- package/distHelpers/get_address_space_fixture.js.map +1 -1
- package/package.json +41 -41
- package/source/address_space_ts.ts +19 -9
- package/source/helpers/argument_list.ts +2 -2
- package/source/helpers/call_helpers.ts +4 -1
- package/source/helpers/dump_tools.ts +7 -3
- package/source/helpers/make_optionals_map.ts +4 -2
- package/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.ts +4 -3
- package/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.ts +10 -11
- package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +6 -7
- package/source/interfaces/extension_object_constructor.ts +1 -1
- package/source/interfaces/state_machine/ua_program_state_machine_type.ts +0 -1
- package/source/interfaces/state_machine/ua_state_machine_type.ts +0 -1
- package/source/loader/decode_xml_extension_object.ts +3 -3
- package/source/loader/ensure_datatype_extracted.ts +6 -2
- package/source/loader/generateAddressSpaceRaw.ts +5 -4
- package/source/loader/load_nodeset2.ts +12 -8
- package/source/loader/make_xml_extension_object_parser.ts +78 -45
- package/source/loader/namespace_post_step.ts +1 -1
- package/source/loader/parsers/extension_object_parser.ts +36 -27
- package/source/loader/parsers/localized_text_parser.ts +1 -1
- package/source/loader/parsers/nodeid_parser.ts +10 -2
- package/source/loader/parsers/qualified_name_parser.ts +1 -1
- package/source/loader/parsers/variant_parser.ts +53 -40
- package/source/pseudo_session.ts +81 -28
- package/source/session_context.ts +28 -19
- package/source/xml_writer.ts +1 -1
- package/src/_instantiate_helpers.ts +0 -3
- package/src/_mandatory_child_or_requested_optional_filter.ts +3 -4
- package/src/address_space.ts +58 -42
- package/src/address_space_private.ts +2 -0
- package/src/alarms_and_conditions/condition_snapshot_impl.ts +6 -10
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +5 -7
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +20 -13
- package/src/alarms_and_conditions/ua_base_event_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_condition_impl.ts +12 -10
- package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +8 -5
- package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +0 -1
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +0 -1
- package/src/apply_condition_refresh.ts +1 -1
- package/src/base_node_impl.ts +30 -35
- package/src/base_node_private.ts +0 -6
- package/src/extension_object_array_node.ts +44 -15
- package/src/get_basic_datatype.ts +4 -1
- package/src/historical_access/address_space_historical_data_node.ts +2 -5
- package/src/namespace_impl.ts +24 -17
- package/src/nodeid_manager.ts +8 -11
- package/src/nodeset_tools/construct_namespace_dependency.ts +18 -15
- package/src/nodeset_tools/dump_to_bsd.ts +6 -8
- package/src/nodeset_tools/nodeset_to_xml.ts +105 -75
- package/src/private_namespace.ts +7 -2
- package/src/reference_impl.ts +11 -10
- package/src/state_machine/finite_state_machine.ts +12 -10
- package/src/state_machine/ua_shelving_state_machine_ex.ts +4 -4
- package/src/state_machine/ua_two_state_variable.ts +12 -9
- package/src/tool_isSubtypeOf.ts +2 -9
- package/src/ua_data_type_impl.ts +4 -4
- package/src/ua_method_impl.ts +24 -14
- package/src/ua_object_type_impl.ts +12 -6
- package/src/ua_reference_type_impl.ts +2 -3
- package/src/ua_variable_impl.ts +142 -96
- package/src/ua_variable_impl_ext_obj.ts +110 -82
- package/src/ua_variable_type_impl.ts +17 -5
|
@@ -31,8 +31,8 @@ function normalizeName(str: string): string {
|
|
|
31
31
|
|
|
32
32
|
const disabledVar = new Variant({
|
|
33
33
|
dataType: "StatusCode",
|
|
34
|
-
value: StatusCodes.BadConditionDisabled
|
|
35
|
-
// statusCode: StatusCodes.BadConditionDisabled
|
|
34
|
+
value: StatusCodes.BadConditionDisabled
|
|
35
|
+
// statusCode: StatusCodes.BadConditionDisabled
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
// list of Condition variables that should not be published as BadConditionDisabled when the condition
|
|
@@ -94,7 +94,8 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
94
94
|
for (const fullBrowsePath of this._map.keys()) {
|
|
95
95
|
const node = this._node_index.get(fullBrowsePath);
|
|
96
96
|
if (!node) {
|
|
97
|
-
|
|
97
|
+
// c8 ignore next
|
|
98
|
+
doDebug && debugLog("cannot node for find key", fullBrowsePath);
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
if (isDisabled && !Object.hasOwn(_varTable, fullBrowsePath)) {
|
|
@@ -210,12 +211,6 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
210
211
|
}
|
|
211
212
|
return variant;
|
|
212
213
|
}
|
|
213
|
-
|
|
214
|
-
#_is_varValid(varName: string) {
|
|
215
|
-
const key = normalizeName(varName);
|
|
216
|
-
const variant = this._map.get(key);
|
|
217
|
-
return !(variant && variant.dataType === DataType.StatusCode && variant.value === StatusCodes.BadConditionDisabled);
|
|
218
|
-
}
|
|
219
214
|
#_get_varTDefault<T>(dataType: DataType, varName: string, defaultValue: T): T {
|
|
220
215
|
const variant = this.#_get_var_inner(varName);
|
|
221
216
|
if (variant.dataType !== dataType) {
|
|
@@ -281,7 +276,8 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
281
276
|
const node = this._node_index.get(key);
|
|
282
277
|
if (!node) {
|
|
283
278
|
// for instance localTime is optional
|
|
284
|
-
|
|
279
|
+
// c8 ignore next
|
|
280
|
+
doDebug && debugLog(`Cannot serVar ${varName} dataType ${DataType[dataType]}`);
|
|
285
281
|
return;
|
|
286
282
|
}
|
|
287
283
|
assert(node.nodeClass === NodeClass.Variable);
|
|
@@ -23,16 +23,14 @@ import { type UAConditionImpl, UAConditionImplBase } from "./ua_condition_impl";
|
|
|
23
23
|
const debugLog = make_debugLog(__filename);
|
|
24
24
|
const doDebug = false;
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
const $ = (a: UAAcknowledgeableConditionImplBase): UAAcknowledgeableConditionEx => a as unknown as UAAcknowledgeableConditionEx;
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
export interface UAAcknowegeableConditionEvents extends UAConditionEvents {
|
|
28
|
+
export interface UAAcknowegeableConditionEvents extends UAConditionEvents {
|
|
31
29
|
acknowledged: (eventId: Buffer | null, comment: LocalizedText | null, branch: ConditionSnapshot) => void;
|
|
32
30
|
confirmed: (eventId: Buffer | null, comment: LocalizedText | null, branch: ConditionSnapshot) => void;
|
|
33
31
|
}
|
|
34
32
|
export class UAAcknowledgeableConditionImplBase<
|
|
35
|
-
T extends UAAcknowegeableConditionEvents & ListenerSignature<T>
|
|
33
|
+
T extends UAAcknowegeableConditionEvents & ListenerSignature<T> = UAAcknowegeableConditionEvents
|
|
36
34
|
> extends UAConditionImplBase<T> {
|
|
37
35
|
/**
|
|
38
36
|
*/
|
|
@@ -201,7 +199,7 @@ export class UAAcknowledgeableConditionImplBase<
|
|
|
201
199
|
this.raiseNewBranchState(branch);
|
|
202
200
|
|
|
203
201
|
this._raiseAuditConditionAcknowledgeEvent(branch);
|
|
204
|
-
|
|
202
|
+
|
|
205
203
|
/**
|
|
206
204
|
* @event acknowledged
|
|
207
205
|
* @param eventId {Buffer|null}
|
|
@@ -240,7 +238,7 @@ export class UAAcknowledgeableConditionImplBase<
|
|
|
240
238
|
|
|
241
239
|
this.raiseNewBranchState(branch);
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
/**
|
|
244
242
|
* @event confirmed
|
|
245
243
|
* @param eventId
|
|
246
244
|
* @param comment
|
|
@@ -251,7 +249,7 @@ export class UAAcknowledgeableConditionImplBase<
|
|
|
251
249
|
}
|
|
252
250
|
|
|
253
251
|
/**
|
|
254
|
-
*
|
|
252
|
+
*
|
|
255
253
|
*/
|
|
256
254
|
public autoConfirmBranch(branch: ConditionSnapshot, comment: LocalizedTextLike): void {
|
|
257
255
|
assert(branch instanceof ConditionSnapshotImpl);
|
|
@@ -6,7 +6,7 @@ import type { BaseNode, INamespace, UAEventType, UAVariable } from "node-opcua-a
|
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
7
|
import { NodeClass } from "node-opcua-data-model";
|
|
8
8
|
import type { DataValue } from "node-opcua-data-value";
|
|
9
|
-
import { make_debugLog } from "node-opcua-debug";
|
|
9
|
+
import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
|
|
10
10
|
import { NodeId, sameNodeId } from "node-opcua-nodeid";
|
|
11
11
|
import { StatusCodes } from "node-opcua-status-code";
|
|
12
12
|
import { DataType, type VariantOptions } from "node-opcua-variant";
|
|
@@ -14,12 +14,17 @@ import type { ConditionInfo } from "../../source/interfaces/alarms_and_condition
|
|
|
14
14
|
import type { InstantiateAlarmConditionOptions } from "../../source/interfaces/alarms_and_conditions/instantiate_alarm_condition_options";
|
|
15
15
|
import type { UAAlarmConditionEx } from "../../source/interfaces/alarms_and_conditions/ua_alarm_condition_ex";
|
|
16
16
|
import type { AddressSpacePrivate } from "../address_space_private";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
_clear_timer_if_any,
|
|
19
|
+
type UAShelvedStateMachineExImpl,
|
|
20
|
+
UAShelvedStateMachineExImplBase
|
|
21
|
+
} from "../state_machine/ua_shelving_state_machine_ex";
|
|
18
22
|
import { _install_TwoStateVariable_machinery } from "../state_machine/ua_two_state_variable";
|
|
19
23
|
import { ConditionInfoImpl } from "./condition_info_impl";
|
|
20
24
|
import { UAAcknowledgeableConditionImpl, UAAcknowledgeableConditionImplBase } from "./ua_acknowledgeable_condition_impl";
|
|
21
25
|
|
|
22
26
|
const debugLog = make_debugLog(__filename);
|
|
27
|
+
const doDebug = checkDebugFlag(__filename);
|
|
23
28
|
|
|
24
29
|
function _update_suppressedOrShelved(alarmNode: UAAlarmConditionImpl) {
|
|
25
30
|
alarmNode.suppressedOrShelved.setValueFromSource({
|
|
@@ -28,7 +33,7 @@ function _update_suppressedOrShelved(alarmNode: UAAlarmConditionImpl) {
|
|
|
28
33
|
});
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
const
|
|
36
|
+
const $ = (a: UAAlarmConditionImplBase): UAAlarmConditionEx => a as unknown as UAAlarmConditionEx;
|
|
32
37
|
export class UAAlarmConditionImplBase extends UAAcknowledgeableConditionImplBase {
|
|
33
38
|
public static MaxDuration = 2 ** 31;
|
|
34
39
|
|
|
@@ -178,7 +183,6 @@ export class UAAlarmConditionImplBase extends UAAcknowledgeableConditionImplBase
|
|
|
178
183
|
return alarmNode;
|
|
179
184
|
}
|
|
180
185
|
|
|
181
|
-
|
|
182
186
|
public dispose(): void {
|
|
183
187
|
if ($(this).shelvingState) {
|
|
184
188
|
_clear_timer_if_any($(this).shelvingState as unknown as UAShelvedStateMachineExImpl);
|
|
@@ -240,7 +244,7 @@ export class UAAlarmConditionImplBase extends UAAcknowledgeableConditionImplBase
|
|
|
240
244
|
if (duration < 10 || duration >= 2 ** 31) {
|
|
241
245
|
throw new Error(` Invalid maxTimeShelved duration: ${duration} must be [10,2**31] `);
|
|
242
246
|
}
|
|
243
|
-
|
|
247
|
+
$(this).maxTimeShelved?.setValueFromSource({
|
|
244
248
|
dataType: "Duration", // <= Duration is basic Type Double! ( milliseconds)
|
|
245
249
|
value: duration
|
|
246
250
|
});
|
|
@@ -271,7 +275,7 @@ export class UAAlarmConditionImplBase extends UAAcknowledgeableConditionImplBase
|
|
|
271
275
|
* whose node id is stored in alarm.inputNode
|
|
272
276
|
*/
|
|
273
277
|
public getInputNodeNode(): UAVariable | null {
|
|
274
|
-
const nodeId
|
|
278
|
+
const nodeId = $(this).inputNode.readValue().value.value;
|
|
275
279
|
assert(nodeId instanceof NodeId || nodeId === null);
|
|
276
280
|
return this.addressSpace.findNode(nodeId) as UAVariable | null;
|
|
277
281
|
}
|
|
@@ -321,22 +325,23 @@ export class UAAlarmConditionImplBase extends UAAcknowledgeableConditionImplBase
|
|
|
321
325
|
assert(inputNode, " must provide options.inputNode (NodeId or BaseNode object)");
|
|
322
326
|
|
|
323
327
|
if (inputNode instanceof NodeId) {
|
|
324
|
-
|
|
328
|
+
$(this).inputNode.setValueFromSource({
|
|
325
329
|
dataType: DataType.NodeId,
|
|
326
330
|
value: inputNode as NodeId
|
|
327
331
|
});
|
|
328
332
|
} else {
|
|
329
|
-
|
|
333
|
+
$(this).inputNode.setValueFromSource({
|
|
330
334
|
dataType: "NodeId",
|
|
331
335
|
value: (inputNode as BaseNode).nodeId
|
|
332
336
|
});
|
|
333
337
|
|
|
334
338
|
const _node = addressSpace._coerceNode(inputNode);
|
|
335
339
|
if (_node === null) {
|
|
336
|
-
|
|
340
|
+
// c8 ignore next
|
|
341
|
+
doDebug && debugLog(" cannot find nodeId ", inputNode);
|
|
337
342
|
} else {
|
|
338
343
|
assert(_node, "Expecting a valid input node");
|
|
339
|
-
|
|
344
|
+
$(this).inputNode.setValueFromSource({
|
|
340
345
|
dataType: DataType.NodeId,
|
|
341
346
|
value: _node.nodeId
|
|
342
347
|
});
|
|
@@ -433,9 +438,11 @@ export class UAAlarmConditionImplBase extends UAAcknowledgeableConditionImplBase
|
|
|
433
438
|
|
|
434
439
|
// detect potential internal bugs due to misused of _signalNewCondition
|
|
435
440
|
if (isEqual(oldConditionInfo, newConditionInfo)) {
|
|
436
|
-
//
|
|
437
|
-
|
|
438
|
-
|
|
441
|
+
// c8 ignore next
|
|
442
|
+
if (doDebug) {
|
|
443
|
+
debugLog("oldConditionInfo", oldConditionInfo);
|
|
444
|
+
debugLog("oldConditionInfo", newConditionInfo);
|
|
445
|
+
}
|
|
439
446
|
throw new Error(
|
|
440
447
|
`condition values have not change, shall we really raise an event ? alarm ${this.browseName.toString()}`
|
|
441
448
|
);
|
|
@@ -39,4 +39,4 @@ export class UABaseEventImplBase<T extends UABaseEventEvents & ListenerSignature
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export type UABaseEventImpl = UABaseEventImplBase & UABaseEventEx;
|
|
42
|
-
export const UABaseEventImpl = UABaseEventImplBase as unknown as new () => UABaseEventImpl;
|
|
42
|
+
export const UABaseEventImpl = UABaseEventImplBase as unknown as new () => UABaseEventImpl;
|
|
@@ -241,4 +241,4 @@ registerNodePromoter(ObjectTypeIds.CertificateExpirationAlarmType, promoteToCert
|
|
|
241
241
|
|
|
242
242
|
export type UACertificateExpirationAlarmImpl = UACertificateExpirationAlarmImplBase & UACertificateExpirationAlarmEx;
|
|
243
243
|
export const UACertificateExpirationAlarmImpl: new () => UACertificateExpirationAlarmImpl =
|
|
244
|
-
UACertificateExpirationAlarmImplBase as
|
|
244
|
+
UACertificateExpirationAlarmImplBase as unknown as new () => UACertificateExpirationAlarmImpl;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable complexity */
|
|
2
1
|
/**
|
|
3
2
|
* @module node-opcua-address-space.AlarmsAndConditions
|
|
4
3
|
*/
|
|
@@ -44,7 +43,7 @@ import type { UAConditionType } from "../ua_condition_type";
|
|
|
44
43
|
import { UAObjectImpl } from "../ua_object_impl";
|
|
45
44
|
import type { UAVariableImpl } from "../ua_variable_impl";
|
|
46
45
|
import { ConditionSnapshotImpl } from "./condition_snapshot_impl";
|
|
47
|
-
import {
|
|
46
|
+
import { UABaseEventImplBase } from "./ua_base_event_impl";
|
|
48
47
|
|
|
49
48
|
const debugLog = make_debugLog(__filename);
|
|
50
49
|
const errorLog = make_errorLog(__filename);
|
|
@@ -76,7 +75,9 @@ const warningLog = make_warningLog(__filename);
|
|
|
76
75
|
|
|
77
76
|
const $ = (a: UAConditionImplBase): UAConditionEx => a as unknown as UAConditionEx;
|
|
78
77
|
|
|
79
|
-
export class UAConditionImplBase<
|
|
78
|
+
export class UAConditionImplBase<
|
|
79
|
+
T extends UAConditionEvents & ListenerSignature<T> = UAConditionEvents
|
|
80
|
+
> extends UABaseEventImplBase<T> {
|
|
80
81
|
public static defaultSeverity = 250;
|
|
81
82
|
public static typeDefinition = resolveNodeId("ConditionType");
|
|
82
83
|
|
|
@@ -239,10 +240,9 @@ export class UAConditionImplBase<T extends UAConditionEvents & ListenerSignature
|
|
|
239
240
|
assert(!sameNodeId(branch.getBranchId(), NodeId.nullNodeId), "cannot delete branch zero");
|
|
240
241
|
assert(this._branches.has(key));
|
|
241
242
|
this._branches.delete(key);
|
|
242
|
-
(this as UAConditionImplBase
|
|
243
|
+
(this as UAConditionImplBase).emit("branch_deleted", key);
|
|
243
244
|
}
|
|
244
245
|
|
|
245
|
-
|
|
246
246
|
private get $() {
|
|
247
247
|
return this as unknown as UAConditionEx;
|
|
248
248
|
}
|
|
@@ -547,7 +547,8 @@ export class UAConditionImplBase<T extends UAConditionEvents & ListenerSignature
|
|
|
547
547
|
// for the time being , only current branch
|
|
548
548
|
const currentBranch = this.currentBranch();
|
|
549
549
|
if (currentBranch.getRetain()) {
|
|
550
|
-
|
|
550
|
+
// c8 ignore next
|
|
551
|
+
doDebug && debugLog(` resending condition event for ${this.browseName.toString()}`);
|
|
551
552
|
this.raiseConditionEvent(currentBranch, false);
|
|
552
553
|
return 1;
|
|
553
554
|
}
|
|
@@ -643,7 +644,7 @@ export class UAConditionImplBase<T extends UAConditionEvents & ListenerSignature
|
|
|
643
644
|
throw new Error("Unimplemented , please override");
|
|
644
645
|
}
|
|
645
646
|
}
|
|
646
|
-
export type
|
|
647
|
+
export type UAConditionImpl = UAConditionImplBase & UAConditionEx;
|
|
647
648
|
export const UAConditionImpl = UAConditionImplBase as unknown as new () => UAConditionImpl;
|
|
648
649
|
|
|
649
650
|
/**²
|
|
@@ -848,7 +849,8 @@ function UACondition_instantiate(
|
|
|
848
849
|
!options.conditionSource ||
|
|
849
850
|
(options.conditionSource.nodeClass !== NodeClass.Object && options.conditionSource.nodeClass !== NodeClass.Variable)
|
|
850
851
|
) {
|
|
851
|
-
|
|
852
|
+
// c8 ignore next
|
|
853
|
+
doDebug && debugLog(options.conditionSource);
|
|
852
854
|
throw new Error("Expecting condition source to be NodeClass.Object or Variable");
|
|
853
855
|
}
|
|
854
856
|
|
|
@@ -1006,7 +1008,8 @@ function _disable_method(inputArguments: VariantLike[], context: ISessionContext
|
|
|
1006
1008
|
|
|
1007
1009
|
// c8 ignore next
|
|
1008
1010
|
if (!(conditionNode instanceof UAConditionImpl)) {
|
|
1009
|
-
|
|
1011
|
+
// c8 ignore next
|
|
1012
|
+
doDebug && debugLog("conditionNode is not a UACondition ", conditionNode?.toString());
|
|
1010
1013
|
return callback(null, {
|
|
1011
1014
|
statusCode: StatusCodes.BadNodeIdInvalid
|
|
1012
1015
|
});
|
|
@@ -1210,7 +1213,6 @@ function _create_new_branch_id() {
|
|
|
1210
1213
|
return makeNodeId(randomGuid(), 1);
|
|
1211
1214
|
}
|
|
1212
1215
|
|
|
1213
|
-
// tslint:disable:no-console
|
|
1214
1216
|
function _install_condition_variable_type<T, DT extends DataType>(node: UAConditionVariable<T, DT>) {
|
|
1215
1217
|
// from spec 1.03 : 5.3 condition variables
|
|
1216
1218
|
// However, a change in their value is considered important and supposed to trigger
|
|
@@ -15,7 +15,7 @@ import { UAAlarmConditionImplBase } from "./ua_alarm_condition_impl.js";
|
|
|
15
15
|
* Alarm may take on only a certain number of possible values (e.g. true/false,
|
|
16
16
|
* running/stopped/terminating).
|
|
17
17
|
*/
|
|
18
|
-
export class UADiscreteAlarmImplBase extends UAAlarmConditionImplBase
|
|
18
|
+
export class UADiscreteAlarmImplBase extends UAAlarmConditionImplBase {
|
|
19
19
|
public static instantiate(
|
|
20
20
|
namespace: INamespace,
|
|
21
21
|
discreteAlarmTypeId: UAEventType | NodeId | string,
|
|
@@ -32,10 +32,13 @@ export class UADiscreteAlarmImplBase extends UAAlarmConditionImplBase {
|
|
|
32
32
|
|
|
33
33
|
const discreteAlarmTypeBase = addressSpace.findObjectType("DiscreteAlarmType");
|
|
34
34
|
assert(discreteAlarmTypeBase, "expecting DiscreteAlarmType - please check you nodeset xml file!");
|
|
35
|
+
if (!discreteAlarmTypeBase) {
|
|
36
|
+
throw new Error("expecting DiscreteAlarmType - please check you nodeset xml file!");
|
|
37
|
+
}
|
|
35
38
|
|
|
36
39
|
/* eventTypeNode should be subtypeOf("DiscreteAlarmType"); */
|
|
37
40
|
/* c8 ignore next */
|
|
38
|
-
if (!discreteAlarmType.isSubtypeOf(discreteAlarmTypeBase
|
|
41
|
+
if (!discreteAlarmType.isSubtypeOf(discreteAlarmTypeBase)) {
|
|
39
42
|
throw new Error("UADiscreteAlarm.instantiate : event found is not subType of DiscreteAlarmType");
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -44,11 +47,11 @@ export class UADiscreteAlarmImplBase extends UAAlarmConditionImplBase {
|
|
|
44
47
|
discreteAlarmType.nodeId,
|
|
45
48
|
options,
|
|
46
49
|
data
|
|
47
|
-
) as
|
|
50
|
+
) as unknown as UADiscreteAlarm;
|
|
48
51
|
Object.setPrototypeOf(alarmNode, UADiscreteAlarmImplBase.prototype);
|
|
49
52
|
|
|
50
|
-
return alarmNode as unknown as
|
|
53
|
+
return alarmNode as unknown as UADiscreteAlarmImpl;
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
export type UADiscreteAlarmImpl = UADiscreteAlarmImplBase & UADiscreteAlarmEx;
|
|
54
|
-
export const UADiscreteAlarmImpl = UADiscreteAlarmImplBase as unknown as UADiscreteAlarmImpl;
|
|
57
|
+
export const UADiscreteAlarmImpl = UADiscreteAlarmImplBase as unknown as UADiscreteAlarmImpl;
|
|
@@ -39,7 +39,6 @@ export declare interface UAOffNormalAlarmEx
|
|
|
39
39
|
setNormalStateValue(value: NodeIdLike): void;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
const $ = (instance: UAOffNormalAlarmImplBase): UAOffNormalAlarmEx => instance as unknown as UAOffNormalAlarmEx;
|
|
44
43
|
/**
|
|
45
44
|
* The OffNormalAlarmType is a specialization of the DiscreteAlarmType intended to represent a
|
|
@@ -8,7 +8,7 @@ export function apply_condition_refresh(this: UAObject | UAVariable, cache?: Con
|
|
|
8
8
|
cache = cache || new Map();
|
|
9
9
|
const notifiers = this.getNotifiers();
|
|
10
10
|
const eventSources = this.getEventSources();
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
const conditions = this.findReferencesAsObject("HasCondition", true);
|
|
13
13
|
for (const condition of conditions) {
|
|
14
14
|
if (condition instanceof UAConditionImpl) {
|
package/src/base_node_impl.ts
CHANGED
|
@@ -7,7 +7,7 @@ import chalk from "chalk";
|
|
|
7
7
|
import {
|
|
8
8
|
type AddReferenceOpts,
|
|
9
9
|
type AttributeEventName,
|
|
10
|
-
type BaseNode,
|
|
10
|
+
type BaseNode,
|
|
11
11
|
type BaseNodeEvents,
|
|
12
12
|
type BrowseDescriptionOptions2,
|
|
13
13
|
type IAddressSpace,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type UAReference,
|
|
24
24
|
type UAReferenceType,
|
|
25
25
|
type UAVariable,
|
|
26
|
-
type UAVariableType
|
|
26
|
+
type UAVariableType
|
|
27
27
|
} from "node-opcua-address-space-base";
|
|
28
28
|
import { assert } from "node-opcua-assert";
|
|
29
29
|
import type { UAString } from "node-opcua-basic-types";
|
|
@@ -85,9 +85,6 @@ import { type MinimalistAddressSpace, ReferenceImpl } from "./reference_impl";
|
|
|
85
85
|
import { coerceRolePermissions } from "./role_permissions";
|
|
86
86
|
|
|
87
87
|
type ApplyFunc = { apply: (...args: unknown[]) => void };
|
|
88
|
-
// tslint:disable:no-var-requires
|
|
89
|
-
// tslint:disable:no-bitwise
|
|
90
|
-
// tslint:disable:no-console
|
|
91
88
|
|
|
92
89
|
const doDebug = false;
|
|
93
90
|
const warningLog = make_warningLog(__filename);
|
|
@@ -156,8 +153,10 @@ export function makeAttributeEventName(attributeId: AttributeIds): AttributeEven
|
|
|
156
153
|
*
|
|
157
154
|
*/
|
|
158
155
|
|
|
159
|
-
export abstract class BaseNodeImpl<T extends BaseNodeEvents & ListenerSignature<T> = BaseNodeEvents>
|
|
160
|
-
extends TypedEventEmitter<T>
|
|
156
|
+
export abstract class BaseNodeImpl<T extends BaseNodeEvents & ListenerSignature<T> = BaseNodeEvents>
|
|
157
|
+
extends TypedEventEmitter<T>
|
|
158
|
+
implements BaseNode<T>
|
|
159
|
+
{
|
|
161
160
|
public static makeAttributeEventName(attributeId: AttributeIds): AttributeEventName {
|
|
162
161
|
return makeAttributeEventName(attributeId);
|
|
163
162
|
}
|
|
@@ -614,7 +613,7 @@ extends TypedEventEmitter<T> implements BaseNode<T> {
|
|
|
614
613
|
const methods = this.getMethods();
|
|
615
614
|
const select = _filter_by_browse_name(methods, methodName, namespaceIndex);
|
|
616
615
|
assert(select.length <= 1, "BaseNode#getMethodByName found duplicated reference");
|
|
617
|
-
return select.length === 1 ? select[0]
|
|
616
|
+
return select.length === 1 ? (select[0] as UAMethod) : null;
|
|
618
617
|
}
|
|
619
618
|
|
|
620
619
|
public getWriteMask(): number {
|
|
@@ -857,7 +856,8 @@ extends TypedEventEmitter<T> implements BaseNode<T> {
|
|
|
857
856
|
|
|
858
857
|
/* c8 ignore next */
|
|
859
858
|
if (do_debug) {
|
|
860
|
-
|
|
859
|
+
// c8 ignore next
|
|
860
|
+
doDebug && debugLog("all references :", this.nodeId.toString(), this.browseName.toString());
|
|
861
861
|
dumpReferences(addressSpace, _private._referenceIdx.values());
|
|
862
862
|
}
|
|
863
863
|
|
|
@@ -949,6 +949,16 @@ extends TypedEventEmitter<T> implements BaseNode<T> {
|
|
|
949
949
|
} else if (_private._back_referenceIdx.has(h)) {
|
|
950
950
|
relatedNode.removeReference(backwardReference);
|
|
951
951
|
} else {
|
|
952
|
+
// A back reference of a massively used type was never installed: _propagate_ref
|
|
953
|
+
// skips HasTypeDefinition and HasModellingRule deliberately, "because there are
|
|
954
|
+
// too many". Removal has to mirror that, or detaching any node asks its type
|
|
955
|
+
// definition to drop a reference it never held - which is where the hundred-odd
|
|
956
|
+
// "Cannot find reference to remove: ns=0;i=40" lines per run came from. The
|
|
957
|
+
// absence is the designed state, not a fault worth reporting.
|
|
958
|
+
const referenceType = resolveReferenceType(addressSpace, reference);
|
|
959
|
+
if (!reference.isForward && referenceType && _is_massively_used_reference(referenceType)) {
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
952
962
|
warningLog(`Cannot find reference to remove: ${reference.toString()}`);
|
|
953
963
|
}
|
|
954
964
|
}
|
|
@@ -1018,7 +1028,6 @@ extends TypedEventEmitter<T> implements BaseNode<T> {
|
|
|
1018
1028
|
if (Object.hasOwn(reservedNames, name)) {
|
|
1019
1029
|
// c8 ignore next
|
|
1020
1030
|
if (doDebug) {
|
|
1021
|
-
// tslint:disable-next-line:no-console
|
|
1022
1031
|
debugLog(chalk.bgWhite.red(`Ignoring reserved keyword ${name}`));
|
|
1023
1032
|
}
|
|
1024
1033
|
return;
|
|
@@ -1542,11 +1551,13 @@ function toObject(addressSpace: IAddressSpace, reference: UAReference): BaseNode
|
|
|
1542
1551
|
const obj = resolveReferenceNode(addressSpace, reference);
|
|
1543
1552
|
// c8 ignore next
|
|
1544
1553
|
if (doDebug && !obj) {
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
chalk.red("
|
|
1549
|
-
|
|
1554
|
+
// c8 ignore next
|
|
1555
|
+
doDebug &&
|
|
1556
|
+
debugLog(
|
|
1557
|
+
chalk.red(" Warning : object with nodeId ") +
|
|
1558
|
+
chalk.cyan(reference.nodeId.toString()) +
|
|
1559
|
+
chalk.red(" cannot be found in the address space !")
|
|
1560
|
+
);
|
|
1550
1561
|
}
|
|
1551
1562
|
return obj;
|
|
1552
1563
|
}
|
|
@@ -1613,11 +1624,7 @@ function _is_massively_used_reference(referenceType: UAReferenceType): boolean {
|
|
|
1613
1624
|
return name === "HasTypeDefinition" || name === "HasModellingRule";
|
|
1614
1625
|
}
|
|
1615
1626
|
|
|
1616
|
-
function _propagate_ref(
|
|
1617
|
-
this: BaseNode,
|
|
1618
|
-
addressSpace: MinimalistAddressSpace,
|
|
1619
|
-
reference: UAReference
|
|
1620
|
-
): void {
|
|
1627
|
+
function _propagate_ref(this: BaseNode, addressSpace: MinimalistAddressSpace, reference: UAReference): void {
|
|
1621
1628
|
// filter out non Hierarchical References
|
|
1622
1629
|
const referenceType = ReferenceImpl.resolveReferenceType(addressSpace, reference);
|
|
1623
1630
|
|
|
@@ -1769,20 +1776,12 @@ function _filter_by_context(node: BaseNode, references: Reference[], context: Se
|
|
|
1769
1776
|
return [];
|
|
1770
1777
|
}
|
|
1771
1778
|
*/
|
|
1772
|
-
function _filter_by_context(
|
|
1773
|
-
node: BaseNode,
|
|
1774
|
-
references: UAReference[],
|
|
1775
|
-
context: ISessionContext
|
|
1776
|
-
): UAReference[] {
|
|
1779
|
+
function _filter_by_context(node: BaseNode, references: UAReference[], context: ISessionContext): UAReference[] {
|
|
1777
1780
|
const addressSpace = node.addressSpace;
|
|
1778
1781
|
return references.filter((reference) => !context.isBrowseAccessRestricted(resolveReferenceNode(addressSpace, reference)));
|
|
1779
1782
|
}
|
|
1780
1783
|
|
|
1781
|
-
function _filter_by_nodeClass(
|
|
1782
|
-
this: BaseNode,
|
|
1783
|
-
references: UAReference[],
|
|
1784
|
-
nodeClassMask: number
|
|
1785
|
-
): UAReference[] {
|
|
1784
|
+
function _filter_by_nodeClass(this: BaseNode, references: UAReference[], nodeClassMask: number): UAReference[] {
|
|
1786
1785
|
assert(Number.isFinite(nodeClassMask));
|
|
1787
1786
|
if (nodeClassMask === 0) {
|
|
1788
1787
|
return references;
|
|
@@ -1802,11 +1801,7 @@ function _filter_by_nodeClass(
|
|
|
1802
1801
|
});
|
|
1803
1802
|
}
|
|
1804
1803
|
|
|
1805
|
-
function _filter_by_userFilter(
|
|
1806
|
-
this: BaseNode,
|
|
1807
|
-
references: UAReference[],
|
|
1808
|
-
context?: ISessionContext
|
|
1809
|
-
): UAReference[] {
|
|
1804
|
+
function _filter_by_userFilter(this: BaseNode, references: UAReference[], context?: ISessionContext): UAReference[] {
|
|
1810
1805
|
const addressSpace = this.addressSpace;
|
|
1811
1806
|
return references.filter((reference: UAReference) => {
|
|
1812
1807
|
const obj = resolveReferenceNode(addressSpace, reference) as BaseNode;
|
package/src/base_node_private.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
/* eslint-disable complexity */
|
|
2
|
-
/* eslint-disable max-statements */
|
|
3
1
|
/**
|
|
4
2
|
* @module node-opcua-address-space.Private
|
|
5
3
|
*/
|
|
6
|
-
// tslint:disable:no-bitwise
|
|
7
4
|
import chalk from "chalk";
|
|
8
5
|
import type {
|
|
9
6
|
BaseNode,
|
|
@@ -44,7 +41,6 @@ import { UANamespace_process_modelling_rule } from "./namespace_private";
|
|
|
44
41
|
import { ReferenceImpl } from "./reference_impl";
|
|
45
42
|
import { wipeMemorizedStuff } from "./tool_isSubtypeOf";
|
|
46
43
|
|
|
47
|
-
// eslint-disable-next-line prefer-const
|
|
48
44
|
const errorLog = make_errorLog("address-space:BaseNode");
|
|
49
45
|
const doTrace = checkDebugFlag("INSTANTIATE");
|
|
50
46
|
const traceLog = errorLog;
|
|
@@ -618,7 +614,6 @@ function _clone_collection_new(
|
|
|
618
614
|
|
|
619
615
|
// c8 ignore next
|
|
620
616
|
if (typeof node.clone !== "function") {
|
|
621
|
-
// tslint:disable-next-line:no-console
|
|
622
617
|
warningLog(
|
|
623
618
|
chalk.red("Warning : cannot clone node ") +
|
|
624
619
|
fullPath2(node) +
|
|
@@ -1278,7 +1273,6 @@ export function BaseNode_add_backward_reference(this: BaseNodeImpl, reference: U
|
|
|
1278
1273
|
warningLog(" ", reference.toString(opts));
|
|
1279
1274
|
warningLog(" already found in ===>");
|
|
1280
1275
|
warningLog([..._private._back_referenceIdx.values()].map((c: UAReference) => c.toString(opts)).join("\n"));
|
|
1281
|
-
// tslint:disable-next-line:no-console
|
|
1282
1276
|
warningLog("===>");
|
|
1283
1277
|
throw new Error("reference exists already in _back_references");
|
|
1284
1278
|
}
|