node-opcua-address-space 2.178.0 → 2.179.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.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 +1 -0
- 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
|
@@ -15,6 +15,7 @@ import { VariableTypeIds } from "node-opcua-constants";
|
|
|
15
15
|
import {
|
|
16
16
|
BrowseDirection,
|
|
17
17
|
coerceLocalizedText,
|
|
18
|
+
coerceLocalizedTextStrict,
|
|
18
19
|
type LocalizedText,
|
|
19
20
|
type LocalizedTextLike,
|
|
20
21
|
type QualifiedNameLike
|
|
@@ -93,13 +94,13 @@ function _getEffectiveDisplayName<_T, _DT extends DataType>(
|
|
|
93
94
|
}
|
|
94
95
|
const boolValue = node.getValue();
|
|
95
96
|
|
|
96
|
-
let subStateNodes;
|
|
97
|
+
let subStateNodes: BaseNode[];
|
|
97
98
|
if (boolValue) {
|
|
98
99
|
subStateNodes = node.findReferencesExAsObject("HasTrueSubState", BrowseDirection.Forward);
|
|
99
100
|
} else {
|
|
100
101
|
subStateNodes = node.findReferencesExAsObject("HasFalseSubState", BrowseDirection.Forward);
|
|
101
102
|
}
|
|
102
|
-
const _states = subStateNodes.forEach((_n:
|
|
103
|
+
const _states = subStateNodes.forEach((_n: BaseNode) => {
|
|
103
104
|
// todo happen
|
|
104
105
|
});
|
|
105
106
|
|
|
@@ -113,7 +114,7 @@ function _getHumanReadableString(node: UATwoStateVariableImpl): DataValueT<Local
|
|
|
113
114
|
const _c = dataValue.clone() as DataValueT<LocalizedText, DataType.LocalizedText>;
|
|
114
115
|
_c.value = new Variant({
|
|
115
116
|
dataType: DataType.LocalizedText,
|
|
116
|
-
value:
|
|
117
|
+
value: coerceLocalizedTextStrict("")
|
|
117
118
|
}) as VariantT<LocalizedText, DataType.LocalizedText>;
|
|
118
119
|
|
|
119
120
|
return _c;
|
|
@@ -199,6 +200,7 @@ export declare interface UATwoStateVariableImpl extends UATwoStateVariableEx {
|
|
|
199
200
|
/***
|
|
200
201
|
* @class UATwoStateVariable
|
|
201
202
|
*/
|
|
203
|
+
// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: interface adds typed members/overloads for this class
|
|
202
204
|
export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataType.LocalizedText> implements UATwoStateVariableEx {
|
|
203
205
|
private _trueState?: string;
|
|
204
206
|
private _falseState?: string;
|
|
@@ -222,7 +224,7 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
|
|
|
222
224
|
value: coerceLocalizedText(options.trueState)
|
|
223
225
|
});
|
|
224
226
|
} else {
|
|
225
|
-
this._trueState =
|
|
227
|
+
this._trueState = coerceLocalizedTextStrict(options.trueState).text ?? undefined;
|
|
226
228
|
}
|
|
227
229
|
if (this.falseState) {
|
|
228
230
|
this.falseState.setValueFromSource({
|
|
@@ -230,7 +232,7 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
|
|
|
230
232
|
value: coerceLocalizedText(options.falseState)
|
|
231
233
|
});
|
|
232
234
|
} else {
|
|
233
|
-
this._falseState =
|
|
235
|
+
this._falseState = coerceLocalizedTextStrict(options.falseState).text ?? undefined;
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
238
|
|
|
@@ -305,10 +307,11 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
|
|
|
305
307
|
// EffectiveDisplayName will be constructed by adding the EnabledState
|
|
306
308
|
// and the State of the addTrue state
|
|
307
309
|
if (this.effectiveDisplayName) {
|
|
310
|
+
const effectiveDisplayName = this.effectiveDisplayName as UAVariableImpl;
|
|
308
311
|
this.id.on("value_changed", () => {
|
|
309
|
-
|
|
312
|
+
effectiveDisplayName._internal_set_dataValue(_getEffectiveDisplayName(this));
|
|
310
313
|
});
|
|
311
|
-
|
|
314
|
+
effectiveDisplayName._internal_set_dataValue(_getEffectiveDisplayName(this));
|
|
312
315
|
}
|
|
313
316
|
}
|
|
314
317
|
/**
|
|
@@ -344,10 +347,10 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
|
|
|
344
347
|
return dataValue.value.value.text?.toString() || "";
|
|
345
348
|
}
|
|
346
349
|
public getTrueState(): LocalizedText {
|
|
347
|
-
return this.trueState ? this.trueState.readValue().value.value :
|
|
350
|
+
return this.trueState ? this.trueState.readValue().value.value : coerceLocalizedTextStrict(this._trueState || "TRUE");
|
|
348
351
|
}
|
|
349
352
|
public getFalseState(): LocalizedText {
|
|
350
|
-
return this.falseState ? this.falseState.readValue().value.value :
|
|
353
|
+
return this.falseState ? this.falseState.readValue().value.value : coerceLocalizedTextStrict(this._falseState || "FALSE");
|
|
351
354
|
}
|
|
352
355
|
// TODO : shall we care about overloading the remove_backward_reference method ?
|
|
353
356
|
// some TrueSubState and FalseSubState relationship may be added later
|
package/src/tool_isSubtypeOf.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
BaseNode,
|
|
7
|
-
BaseNodeEvents,
|
|
8
7
|
UADataType,
|
|
9
8
|
UAObjectType,
|
|
10
9
|
UAReference,
|
|
@@ -26,11 +25,7 @@ function _filterSubType(reference: UAReference) {
|
|
|
26
25
|
|
|
27
26
|
export type BaseNodeConstructor<T extends BaseNode> = new () => T;
|
|
28
27
|
|
|
29
|
-
function _slow_isSubtypeOf<T extends UAType>(
|
|
30
|
-
this: T,
|
|
31
|
-
Class: typeof BaseNodeImpl,
|
|
32
|
-
baseType: T | NodeIdLike
|
|
33
|
-
): boolean {
|
|
28
|
+
function _slow_isSubtypeOf<T extends UAType>(this: T, Class: typeof BaseNodeImpl, baseType: T | NodeIdLike): boolean {
|
|
34
29
|
if (!(baseType instanceof Class)) {
|
|
35
30
|
const node = this.addressSpace.findNode(baseType as NodeIdLike);
|
|
36
31
|
if (!node || !(node instanceof Class)) {
|
|
@@ -117,9 +112,7 @@ export type IsSubtypeOfFunc<T extends UAType> = (this: T, baseType: T) => boolea
|
|
|
117
112
|
|
|
118
113
|
export type UAType = UAReferenceType | UADataType | UAObjectType | UAVariableType;
|
|
119
114
|
|
|
120
|
-
export function construct_isSubtypeOf<T extends UAType>(
|
|
121
|
-
Class: typeof BaseNodeImpl
|
|
122
|
-
): IsSubtypeOfFunc<T> {
|
|
115
|
+
export function construct_isSubtypeOf<T extends UAType>(Class: typeof BaseNodeImpl): IsSubtypeOfFunc<T> {
|
|
123
116
|
return wrap_memoize(function (this: T, baseType: T | NodeIdLike): boolean {
|
|
124
117
|
if (!(baseType instanceof Class)) {
|
|
125
118
|
throw new Error(
|
package/src/ua_data_type_impl.ts
CHANGED
|
@@ -272,7 +272,6 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
272
272
|
return definition as EnumDefinition;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
// eslint-disable-next-line complexity
|
|
276
275
|
public _getDefinition(): DataTypeDefinition | null {
|
|
277
276
|
if (this.$fullDefinition !== undefined) {
|
|
278
277
|
return this.$fullDefinition;
|
|
@@ -314,7 +313,6 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
314
313
|
this.$fullDefinition = makeStructureDefinition(basicDataType, defaultEncodingId, definitionFields, isUnion);
|
|
315
314
|
} else if (isEnumeration) {
|
|
316
315
|
const allPartialDefinitions: StructureFieldOptions[][] = [];
|
|
317
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
318
316
|
let dataTypeNode: UADataTypeImpl | null = this;
|
|
319
317
|
while (dataTypeNode && !isRootDataType(dataTypeNode)) {
|
|
320
318
|
if (dataTypeNode.$partialDefinition) {
|
|
@@ -420,10 +418,12 @@ function makeStructureDefinition(
|
|
|
420
418
|
const hasSubtypedFields = fields.filter((field) => field.allowSubTypes).length > 0;
|
|
421
419
|
|
|
422
420
|
if (hasSubtypedFields && doDebug) {
|
|
423
|
-
|
|
421
|
+
// c8 ignore next
|
|
422
|
+
doDebug && debugLog("Fields with subtypes:");
|
|
424
423
|
for (const field of fields) {
|
|
425
424
|
if (field.allowSubTypes) {
|
|
426
|
-
|
|
425
|
+
// c8 ignore next
|
|
426
|
+
doDebug && debugLog(" ", field.name, field.dataType?.toString());
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
}
|
package/src/ua_method_impl.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type MethodFunctorC,
|
|
16
16
|
makeDefaultCloneExtraInfo,
|
|
17
17
|
type UAMethod,
|
|
18
|
-
type UAMethodEvents,
|
|
18
|
+
type UAMethodEvents,
|
|
19
19
|
type UAObject,
|
|
20
20
|
type UAObjectType,
|
|
21
21
|
type UAVariable
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { assert } from "node-opcua-assert";
|
|
24
24
|
import { AttributeIds, type DiagnosticInfo, NodeClass, type QualifiedNameLike } from "node-opcua-data-model";
|
|
25
25
|
import { DataValue, type DataValueLike } from "node-opcua-data-value";
|
|
26
|
-
import { make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
26
|
+
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
27
27
|
import type { NodeId } from "node-opcua-nodeid";
|
|
28
28
|
import type { NumericRange } from "node-opcua-numeric-range";
|
|
29
29
|
import { Argument } from "node-opcua-service-call";
|
|
@@ -38,6 +38,7 @@ import { _handle_hierarchy_parent } from "./namespace_impl";
|
|
|
38
38
|
|
|
39
39
|
const warningLog = make_warningLog(__filename);
|
|
40
40
|
const debugLog = make_debugLog(__filename);
|
|
41
|
+
const doDebug = checkDebugFlag(__filename);
|
|
41
42
|
const errorLog = make_errorLog(__filename);
|
|
42
43
|
|
|
43
44
|
function default_check_valid_argument(arg: unknown): boolean {
|
|
@@ -157,7 +158,7 @@ export class UAMethodImpl extends BaseNodeImpl<UAMethodEvents> implements UAMeth
|
|
|
157
158
|
inputArguments: VariantLike[] | null,
|
|
158
159
|
context: ISessionContext,
|
|
159
160
|
callback?: CallbackT<CallMethodResultOptions>
|
|
160
|
-
):
|
|
161
|
+
): Promise<CallMethodResultOptions> | undefined {
|
|
161
162
|
// c8 ignore next
|
|
162
163
|
if (!callback) {
|
|
163
164
|
throw new Error("execute need to be promisified");
|
|
@@ -174,7 +175,8 @@ export class UAMethodImpl extends BaseNodeImpl<UAMethodEvents> implements UAMeth
|
|
|
174
175
|
// c8 ignore next
|
|
175
176
|
if (!object) {
|
|
176
177
|
errorLog("UAMethod#execute expects a valid object");
|
|
177
|
-
|
|
178
|
+
callback(null, { statusCode: StatusCodes.BadInternalError });
|
|
179
|
+
return;
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
if (object.nodeClass !== NodeClass.Object && object.nodeClass !== NodeClass.ObjectType) {
|
|
@@ -186,24 +188,29 @@ export class UAMethodImpl extends BaseNodeImpl<UAMethodEvents> implements UAMeth
|
|
|
186
188
|
" called for a node that is not a Object/ObjectType but " +
|
|
187
189
|
NodeClass[context.object?.nodeClass as number]
|
|
188
190
|
);
|
|
189
|
-
|
|
191
|
+
callback(null, { statusCode: StatusCodes.BadNodeIdInvalid });
|
|
192
|
+
return;
|
|
190
193
|
}
|
|
191
194
|
if (!this._asyncExecutionFunction) {
|
|
192
195
|
warningLog(`Method ${this.nodeId.toString()} ${this.browseName.toString()} has not been bound`);
|
|
193
|
-
|
|
196
|
+
callback(null, { statusCode: StatusCodes.BadInternalError });
|
|
197
|
+
return;
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
if (!this.getExecutableFlag(context)) {
|
|
197
201
|
warningLog(`Method ${this.nodeId.toString()} ${this.browseName.toString()} is not executable`);
|
|
198
|
-
|
|
202
|
+
callback(null, { statusCode: StatusCodes.BadNotExecutable });
|
|
203
|
+
return;
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
if (context.isAccessRestricted(this)) {
|
|
202
|
-
|
|
207
|
+
callback(null, { statusCode: StatusCodes.BadSecurityModeInsufficient });
|
|
208
|
+
return;
|
|
203
209
|
}
|
|
204
210
|
|
|
205
211
|
if (!context.checkPermission(this, PermissionType.Call)) {
|
|
206
|
-
|
|
212
|
+
callback(null, { statusCode: StatusCodes.BadUserAccessDenied });
|
|
213
|
+
return;
|
|
207
214
|
}
|
|
208
215
|
|
|
209
216
|
// verify that input arguments are correct
|
|
@@ -240,7 +247,8 @@ export class UAMethodImpl extends BaseNodeImpl<UAMethodEvents> implements UAMeth
|
|
|
240
247
|
inputArgumentResults: coercedInputArguments?.map(() => status) || [],
|
|
241
248
|
inputArgumentDiagnosticInfos
|
|
242
249
|
};
|
|
243
|
-
|
|
250
|
+
callback?.(null, callMethodResult);
|
|
251
|
+
return;
|
|
244
252
|
}
|
|
245
253
|
}
|
|
246
254
|
|
|
@@ -252,8 +260,11 @@ export class UAMethodImpl extends BaseNodeImpl<UAMethodEvents> implements UAMeth
|
|
|
252
260
|
context,
|
|
253
261
|
(err: Error | null, callMethodResult?: CallMethodResultOptions) => {
|
|
254
262
|
if (err) {
|
|
255
|
-
|
|
256
|
-
|
|
263
|
+
// c8 ignore next
|
|
264
|
+
if (doDebug) {
|
|
265
|
+
debugLog(err.message);
|
|
266
|
+
debugLog(err);
|
|
267
|
+
}
|
|
257
268
|
}
|
|
258
269
|
callMethodResult = callMethodResult || {};
|
|
259
270
|
|
|
@@ -296,6 +307,7 @@ export class UAMethodImpl extends BaseNodeImpl<UAMethodEvents> implements UAMeth
|
|
|
296
307
|
const callMethodResponse = { statusCode: StatusCodes.BadInternalError };
|
|
297
308
|
callback?.(err as Error, callMethodResponse);
|
|
298
309
|
});
|
|
310
|
+
return undefined;
|
|
299
311
|
}
|
|
300
312
|
|
|
301
313
|
public clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAMethod {
|
|
@@ -345,8 +357,6 @@ export class UAMethodImpl extends BaseNodeImpl<UAMethodEvents> implements UAMeth
|
|
|
345
357
|
}
|
|
346
358
|
}
|
|
347
359
|
|
|
348
|
-
// tslint:disable:no-var-requires
|
|
349
|
-
// tslint:disable:max-line-length
|
|
350
360
|
import { withCallback } from "thenify-ex";
|
|
351
361
|
|
|
352
362
|
UAMethodImpl.prototype.execute = withCallback(UAMethodImpl.prototype.execute);
|
|
@@ -12,21 +12,24 @@ import type {
|
|
|
12
12
|
UAReference
|
|
13
13
|
} from "node-opcua-address-space-base";
|
|
14
14
|
import { assert } from "node-opcua-assert";
|
|
15
|
-
import { AttributeIds, NodeClass } from "node-opcua-data-model";
|
|
15
|
+
import { AttributeIds, type LocalizedTextLike, NodeClass } from "node-opcua-data-model";
|
|
16
16
|
import { DataValue, type DataValueLike } from "node-opcua-data-value";
|
|
17
17
|
import type { NodeId } from "node-opcua-nodeid";
|
|
18
18
|
import { StatusCodes } from "node-opcua-status-code";
|
|
19
|
-
import { isNullOrUndefined } from "node-opcua-utils";
|
|
20
19
|
import { DataType } from "node-opcua-variant";
|
|
21
20
|
|
|
22
21
|
import { SessionContext } from "../source/session_context";
|
|
23
22
|
import { initialize_properties_and_components } from "./_instantiate_helpers";
|
|
24
23
|
import type { AddressSpacePrivate } from "./address_space_private";
|
|
25
|
-
import { BaseNodeImpl } from "./base_node_impl";
|
|
24
|
+
import { BaseNodeImpl, type InternalBaseNodeOptions } from "./base_node_impl";
|
|
26
25
|
import { ToStringBuilder, UAObjectType_toString } from "./base_node_private";
|
|
27
26
|
import { construct_isSubtypeOf, get_subtypeOf, get_subtypeOfObj } from "./tool_isSubtypeOf";
|
|
28
27
|
import { assertUnusedChildBrowseName, topMostParentIsObjectTypeOrVariableType } from "./ua_variable_type_impl";
|
|
29
28
|
|
|
29
|
+
export interface UAObjectTypeOptions extends InternalBaseNodeOptions {
|
|
30
|
+
isAbstract?: boolean | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
30
33
|
export class UAObjectTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements UAObjectType {
|
|
31
34
|
public readonly nodeClass = NodeClass.ObjectType;
|
|
32
35
|
public readonly isAbstract: boolean;
|
|
@@ -48,9 +51,9 @@ export class UAObjectTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements UA
|
|
|
48
51
|
/** @deprecated - use isSubtypeOf instead */
|
|
49
52
|
public isSupertypeOf = construct_isSubtypeOf<UAObjectType>(UAObjectTypeImpl);
|
|
50
53
|
|
|
51
|
-
constructor(options:
|
|
54
|
+
constructor(options: UAObjectTypeOptions) {
|
|
52
55
|
super(options);
|
|
53
|
-
this.isAbstract =
|
|
56
|
+
this.isAbstract = options.isAbstract ?? false;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
public readAttribute(context: ISessionContext, attributeId: AttributeIds): DataValue {
|
|
@@ -123,7 +126,10 @@ export class UAObjectTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements UA
|
|
|
123
126
|
browseName: options.browseName,
|
|
124
127
|
componentOf: options.componentOf,
|
|
125
128
|
displayName: options.displayName || "",
|
|
126
|
-
description:
|
|
129
|
+
description:
|
|
130
|
+
options.description === undefined
|
|
131
|
+
? (this.description?.clone() as LocalizedTextLike | undefined)
|
|
132
|
+
: options.description,
|
|
127
133
|
encodingOf: options.encodingOf,
|
|
128
134
|
eventSourceOf: options.eventSourceOf,
|
|
129
135
|
notifierOf: options.notifierOf,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type { BaseNodeEvents, UAReference, UAReferenceType } from "node-opcua-address-space-base";
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
|
-
import { AttributeIds,
|
|
7
|
+
import { AttributeIds, LocalizedText, type LocalizedTextOptions, NodeClass } from "node-opcua-data-model";
|
|
8
8
|
import { DataValue, type DataValueLike } from "node-opcua-data-value";
|
|
9
9
|
import type { NodeId } from "node-opcua-nodeid";
|
|
10
10
|
import { StatusCodes } from "node-opcua-status-code";
|
|
@@ -112,8 +112,7 @@ export class UAReferenceTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements
|
|
|
112
112
|
this.isAbstract = options.isAbstract === undefined ? false : !!options.isAbstract;
|
|
113
113
|
this.symmetric = options.symmetric === undefined ? false : !!options.symmetric;
|
|
114
114
|
// Note: Inverse name is not required anymore in 1.0.4
|
|
115
|
-
this.inverseName =
|
|
116
|
-
new LocalizedText(options.inverseName || this.browseName.name);
|
|
115
|
+
this.inverseName = new LocalizedText(options.inverseName || this.browseName.name);
|
|
117
116
|
|
|
118
117
|
ReferenceTypeCounter.count += 1;
|
|
119
118
|
}
|