node-opcua-address-space 2.119.2 → 2.121.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/LICENSE +1 -1
- package/dist/source/continuation_points/continuation_point_manager.d.ts +9 -2
- package/dist/source/continuation_points/continuation_point_manager.js +42 -14
- package/dist/source/continuation_points/continuation_point_manager.js.map +1 -1
- package/dist/source/helpers/adjust_browse_direction.js.map +1 -1
- package/dist/source/helpers/argument_list.js +8 -3
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/call_helpers.js +2 -2
- package/dist/source/helpers/call_helpers.js.map +1 -1
- package/dist/source/helpers/coerce_enum_value.js.map +1 -1
- package/dist/source/helpers/dump_tools.js.map +1 -1
- package/dist/source/helpers/ensure_secure_access.js.map +1 -1
- package/dist/source/helpers/make_optionals_map.js.map +1 -1
- package/dist/source/helpers/multiform_func.js.map +1 -1
- package/dist/source/helpers/resolve_opaque_on_address_space.js.map +1 -1
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +2 -0
- 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.map +1 -1
- package/dist/source/loader/load_nodeset2.js +4 -3
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/loader/make_semver_compatible.js.map +1 -1
- 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/pseudo_session.js +1 -6
- package/dist/source/pseudo_session.js.map +1 -1
- package/dist/source/session_context.js.map +1 -1
- package/dist/source/set_namespace_meta_data.js.map +1 -1
- package/dist/src/_instantiate_helpers.js.map +1 -1
- package/dist/src/_mandatory_child_or_requested_optional_filter.js +2 -1
- package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
- package/dist/src/address_space.d.ts +3 -1
- package/dist/src/address_space.js +5 -2
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/address_space_change_event_tools.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_info_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +1 -1
- 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 +1 -1
- 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.d.ts +2 -0
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -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/apply_condition_refresh.js.map +1 -1
- package/dist/src/base_node_impl.d.ts +2 -0
- package/dist/src/base_node_impl.js +8 -4
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.js +4 -1
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/check_value_rank_compatibility.js.map +1 -1
- package/dist/src/data_access/add_dataItem_stuff.js.map +1 -1
- package/dist/src/data_access/adjust_datavalue_status_code.js.map +1 -1
- package/dist/src/data_access/ua_multistate_discrete_impl.js +2 -2
- package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -1
- package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
- package/dist/src/data_access/ua_two_state_discrete_impl.js.map +1 -1
- package/dist/src/event_data.js.map +1 -1
- package/dist/src/extension_object_array_node.js.map +1 -1
- package/dist/src/get_basic_datatype.js.map +1 -1
- package/dist/src/historical_access/address_space_historical_data_node.js +2 -2
- package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
- package/dist/src/idx_iterator.js.map +1 -1
- package/dist/src/namespace_impl.js +1 -1
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/namespace_private.js.map +1 -1
- package/dist/src/nodeid_manager.js.map +1 -1
- package/dist/src/nodeset_tools/adjust_namespace_array.js.map +1 -1
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/reference_impl.js.map +1 -1
- package/dist/src/state_machine/finite_state_machine.js +2 -2
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +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.map +1 -1
- package/dist/src/tool_isSubtypeOf.js.map +1 -1
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_method_impl.js +1 -1
- package/dist/src/ua_method_impl.js.map +1 -1
- package/dist/src/ua_object_impl.js +9 -0
- package/dist/src/ua_object_impl.js.map +1 -1
- package/dist/src/ua_object_type_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +1 -1
- package/dist/src/ua_reference_type_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.js +52 -27
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/src/ua_view_impl.js.map +1 -1
- package/dist/src/validate_data_type_correctness.js.map +1 -1
- package/dist/tsconfig_common.tsbuildinfo +1 -1
- package/distHelpers/alarms_and_conditions_demo.js +2 -2
- package/distHelpers/alarms_and_conditions_demo.js.map +1 -1
- package/distHelpers/assertHasMatchingReference.js.map +1 -1
- package/distHelpers/boiler_system.js +18 -8
- package/distHelpers/boiler_system.js.map +1 -1
- package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -1
- package/distHelpers/get_address_space_fixture.js.map +1 -1
- package/distHelpers/get_mini_address_space.js.map +1 -1
- package/distNodeJS/generate_address_space.js.map +1 -1
- package/package.json +41 -41
- package/source/continuation_points/continuation_point_manager.ts +49 -21
- package/source/helpers/argument_list.ts +26 -21
- package/source/helpers/call_helpers.ts +2 -2
- package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +4 -4
- package/source/loader/load_nodeset2.ts +5 -3
- package/source/pseudo_session.ts +2 -6
- package/src/_mandatory_child_or_requested_optional_filter.ts +2 -2
- package/src/address_space.ts +7 -4
- package/src/alarms_and_conditions/ua_condition_impl.ts +2 -3
- package/src/base_node_impl.ts +8 -5
- package/src/base_node_private.ts +5 -2
- package/src/historical_access/address_space_historical_data_node.ts +2 -2
- package/src/namespace_impl.ts +1 -1
- package/src/ua_method_impl.ts +1 -1
- package/src/ua_object_impl.ts +12 -0
- package/src/ua_variable_impl.ts +66 -31
|
@@ -91,7 +91,7 @@ function convertAccessLevel(accessLevel?: string | null): AccessLevelFlag {
|
|
|
91
91
|
|
|
92
92
|
type Task = (addressSpace: IAddressSpace) => Promise<void>;
|
|
93
93
|
|
|
94
|
-
function makeDefaultVariant(addressSpace: IAddressSpace, dataTypeNode: NodeId, valueRank: number): VariantOptions | undefined {
|
|
94
|
+
function makeDefaultVariant(addressSpace: IAddressSpace, dataTypeNode: NodeId, valueRank: number, arrayDimensions?: number[] |null): VariantOptions | undefined {
|
|
95
95
|
let variant: VariantOptions = { dataType: DataType.Null };
|
|
96
96
|
|
|
97
97
|
const nodeDataType = addressSpace.findNode(dataTypeNode) as UADataType;
|
|
@@ -136,7 +136,7 @@ function makeDefaultVariant(addressSpace: IAddressSpace, dataTypeNode: NodeId, v
|
|
|
136
136
|
break;
|
|
137
137
|
default:
|
|
138
138
|
arrayType = VariantArrayType.Matrix;
|
|
139
|
-
variant = { dataType: basicDataType, value: [], arrayType, dimensions:
|
|
139
|
+
variant = { dataType: basicDataType, value: [], arrayType, dimensions: arrayDimensions };
|
|
140
140
|
break;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -1408,7 +1408,9 @@ function makeNodeSetParserEngine(addressSpace: IAddressSpace, options: NodeSetLo
|
|
|
1408
1408
|
const task = async (addressSpace2: IAddressSpace) => {
|
|
1409
1409
|
const dataTypeNode = capturedVariable.dataType;
|
|
1410
1410
|
const valueRank = capturedVariable.valueRank;
|
|
1411
|
-
const
|
|
1411
|
+
const arrayDimensions = capturedVariable.arrayDimensions;
|
|
1412
|
+
|
|
1413
|
+
const value = makeDefaultVariant(addressSpace, dataTypeNode, valueRank, arrayDimensions);
|
|
1412
1414
|
if (value) {
|
|
1413
1415
|
if (false && doDebug) {
|
|
1414
1416
|
debugLog("2 setting value to ", capturedVariable.nodeId.toString(), value);
|
package/source/pseudo_session.ts
CHANGED
|
@@ -68,10 +68,7 @@ export function innerBrowse(
|
|
|
68
68
|
if (!engine.continuationPointManager) {
|
|
69
69
|
return new BrowseResult({ statusCode: StatusCodes.BadNoContinuationPoints });
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
// clear previous continuation points
|
|
73
|
-
engine.continuationPointManager.clearContinuationPoints();
|
|
74
|
-
}
|
|
71
|
+
|
|
75
72
|
if (engine.continuationPointManager.hasReachedMaximum(engine.maxBrowseContinuationPoints)) {
|
|
76
73
|
return new BrowseResult({ statusCode: StatusCodes.BadNoContinuationPoints });
|
|
77
74
|
}
|
|
@@ -79,7 +76,7 @@ export function innerBrowse(
|
|
|
79
76
|
const truncatedResult = engine.continuationPointManager.registerReferences(
|
|
80
77
|
engine.requestedMaxReferencesPerNode,
|
|
81
78
|
result.references || [],
|
|
82
|
-
{ continuationPoint: null
|
|
79
|
+
{ continuationPoint: null }
|
|
83
80
|
);
|
|
84
81
|
let { statusCode } = truncatedResult;
|
|
85
82
|
const { continuationPoint, values } = truncatedResult;
|
|
@@ -108,7 +105,6 @@ export function innerBrowseNext(
|
|
|
108
105
|
.map((continuationPoint: ContinuationPoint, index: number) => {
|
|
109
106
|
return engine.continuationPointManager.getNextReferences(0, {
|
|
110
107
|
continuationPoint,
|
|
111
|
-
index,
|
|
112
108
|
releaseContinuationPoints
|
|
113
109
|
});
|
|
114
110
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert } from "node-opcua-assert";
|
|
2
2
|
import { BaseNode, UAMethod, UAObject, UAReference, UAVariable, CloneFilter, fullPath2 } from "node-opcua-address-space-base";
|
|
3
|
-
|
|
4
3
|
import { checkDebugFlag, make_debugLog, make_warningLog, make_errorLog } from "node-opcua-debug";
|
|
4
|
+
import { BrowseDirection } from "node-opcua-data-model";
|
|
5
5
|
|
|
6
6
|
import { _clone_hierarchical_references } from "./base_node_private";
|
|
7
7
|
|
|
@@ -23,7 +23,7 @@ export class MandatoryChildOrRequestedOptionalFilter implements CloneFilter {
|
|
|
23
23
|
assert(null !== instance);
|
|
24
24
|
this.optionalsMap = optionalsMap;
|
|
25
25
|
this.instance = instance;
|
|
26
|
-
this.references = instance.
|
|
26
|
+
this.references = instance.findReferencesEx("Aggregates", BrowseDirection.Forward);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
public shouldKeep(node: BaseNode): boolean {
|
package/src/address_space.ts
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
ShutdownTask,
|
|
57
57
|
RaiseEventData
|
|
58
58
|
} from "node-opcua-address-space-base";
|
|
59
|
-
import { make_debugLog, make_errorLog } from "node-opcua-debug";
|
|
59
|
+
import { make_debugLog, make_warningLog, make_errorLog } from "node-opcua-debug";
|
|
60
60
|
|
|
61
61
|
import { adjustBrowseDirection } from "../source/helpers/adjust_browse_direction";
|
|
62
62
|
import { UARootFolder } from "../source/ua_root_folder";
|
|
@@ -80,6 +80,7 @@ import { BaseNodeImpl } from "./base_node_impl";
|
|
|
80
80
|
const doDebug = false;
|
|
81
81
|
const errorLog = make_errorLog(__filename);
|
|
82
82
|
const debugLog = make_debugLog(__filename);
|
|
83
|
+
const warningLog = make_warningLog(__filename);
|
|
83
84
|
|
|
84
85
|
// tslint:disable-next-line:no-var-requires
|
|
85
86
|
const Dequeue = require("dequeue");
|
|
@@ -253,7 +254,9 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
253
254
|
/**
|
|
254
255
|
* @method registerNamespace
|
|
255
256
|
*
|
|
256
|
-
* register a new namespace
|
|
257
|
+
* register a new namespace,
|
|
258
|
+
* it is OK to call registerNamespace even if namespace has already been registered;
|
|
259
|
+
* in this case the registerNamespace has no effect and returns the existing namespace.
|
|
257
260
|
*
|
|
258
261
|
* @param namespaceUri {string}
|
|
259
262
|
* @returns {Namespace}
|
|
@@ -806,8 +809,8 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
806
809
|
}
|
|
807
810
|
/* istanbul ignore next */
|
|
808
811
|
if (!alreadyVisited(k)) {
|
|
809
|
-
|
|
810
|
-
"
|
|
812
|
+
warningLog(
|
|
813
|
+
"constructEventData: cannot find property '" +
|
|
811
814
|
k +
|
|
812
815
|
"' in [ " +
|
|
813
816
|
Object.keys(visitedProperties).join(", ") +
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
NodeClass,
|
|
18
18
|
QualifiedName
|
|
19
19
|
} from "node-opcua-data-model";
|
|
20
|
-
import { DataValue } from "node-opcua-data-value";
|
|
21
20
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
22
21
|
import { minDate } from "node-opcua-basic-types";
|
|
23
22
|
import { coerceNodeId, makeNodeId, NodeId, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
@@ -60,6 +59,8 @@ export declare interface UAConditionImpl extends UAConditionEx, UABaseEventImpl
|
|
|
60
59
|
on(eventName: string, eventHandler: any): this;
|
|
61
60
|
conditionClassId: UAProperty<NodeId, /*c*/ DataType.NodeId>;
|
|
62
61
|
conditionClassName: UAProperty<LocalizedText, /*c*/ DataType.LocalizedText>;
|
|
62
|
+
conditionSubClassId: UAProperty<NodeId[], DataType.NodeId>;
|
|
63
|
+
conditionSubClassName: UAProperty<LocalizedText[], DataType.LocalizedText>;
|
|
63
64
|
}
|
|
64
65
|
/**
|
|
65
66
|
*
|
|
@@ -1208,7 +1209,6 @@ function _create_new_branch_id() {
|
|
|
1208
1209
|
return makeNodeId(randomGuid(), 1);
|
|
1209
1210
|
}
|
|
1210
1211
|
|
|
1211
|
-
|
|
1212
1212
|
// tslint:disable:no-console
|
|
1213
1213
|
function _install_condition_variable_type<T, DT extends DataType>(node: UAConditionVariable<T, DT>) {
|
|
1214
1214
|
// from spec 1.03 : 5.3 condition variables
|
|
@@ -1220,7 +1220,6 @@ function _install_condition_variable_type<T, DT extends DataType>(node: UACondit
|
|
|
1220
1220
|
console.warn("cannot find node.sourceTimestamp", node.browseName.toString());
|
|
1221
1221
|
}
|
|
1222
1222
|
node.accessLevel = makeAccessLevelFlag("CurrentRead");
|
|
1223
|
-
|
|
1224
1223
|
}
|
|
1225
1224
|
|
|
1226
1225
|
/**
|
package/src/base_node_impl.ts
CHANGED
|
@@ -87,6 +87,8 @@ const warningLog = make_warningLog(__filename);
|
|
|
87
87
|
const errorLog = make_errorLog(__filename);
|
|
88
88
|
const debugLog = make_debugLog(__filename);
|
|
89
89
|
|
|
90
|
+
const HasEventSourceReferenceType = resolveNodeId("HasEventSource");
|
|
91
|
+
const HasNotifierReferenceType = resolveNodeId("HasNotifier");
|
|
90
92
|
|
|
91
93
|
function defaultBrowseFilterFunc(context?: ISessionContext): boolean {
|
|
92
94
|
return true;
|
|
@@ -180,7 +182,6 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
180
182
|
return _private._displayName;
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
|
|
184
185
|
public setDisplayName(value: LocalizedTextLike[] | LocalizedTextLike): void {
|
|
185
186
|
if (!Array.isArray(value)) {
|
|
186
187
|
return this.setDisplayName([value]);
|
|
@@ -199,7 +200,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
199
200
|
return _private._description!;
|
|
200
201
|
}
|
|
201
202
|
|
|
202
|
-
public setDescription(value: LocalizedTextLike| null): void {
|
|
203
|
+
public setDescription(value: LocalizedTextLike | null): void {
|
|
203
204
|
this._setDescription(value);
|
|
204
205
|
/**
|
|
205
206
|
* fires when the description attribute is changed.
|
|
@@ -504,6 +505,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
504
505
|
|
|
505
506
|
/**
|
|
506
507
|
* return a array with the notifiers of this object.
|
|
508
|
+
* only reference of exact type HasNotifier are returned.
|
|
507
509
|
*/
|
|
508
510
|
public getNotifiers(): BaseNode[] {
|
|
509
511
|
// const _cache = BaseNode_getCache(this);
|
|
@@ -511,11 +513,12 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
511
513
|
// _cache._notifiers = this.findReferencesAsObject("HasNotifier", true);
|
|
512
514
|
// }
|
|
513
515
|
// return _cache._notifiers;
|
|
514
|
-
return this.findReferencesAsObject(
|
|
516
|
+
return this.findReferencesAsObject(HasNotifierReferenceType, true);
|
|
515
517
|
}
|
|
516
518
|
|
|
517
519
|
/**
|
|
518
520
|
* return a array with the event source of this object.
|
|
521
|
+
* only reference of exact type HasEventSource are returned.
|
|
519
522
|
*/
|
|
520
523
|
public getEventSources(): BaseNode[] {
|
|
521
524
|
// const _cache = BaseNode_getCache(this);
|
|
@@ -523,7 +526,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
523
526
|
// _cache._eventSources = this.findReferencesAsObject("HasEventSource", true);
|
|
524
527
|
// }
|
|
525
528
|
// return _cache._eventSources;
|
|
526
|
-
return this.findReferencesAsObject(
|
|
529
|
+
return this.findReferencesAsObject(HasEventSourceReferenceType, true);
|
|
527
530
|
}
|
|
528
531
|
|
|
529
532
|
/**
|
|
@@ -535,7 +538,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
535
538
|
// _cache._eventSources = this.findReferencesAsObject("HasEventSource", false);
|
|
536
539
|
// }
|
|
537
540
|
// return _cache._eventSources;
|
|
538
|
-
return this.findReferencesAsObject(
|
|
541
|
+
return this.findReferencesAsObject(HasEventSourceReferenceType, false);
|
|
539
542
|
}
|
|
540
543
|
|
|
541
544
|
/**
|
package/src/base_node_private.ts
CHANGED
|
@@ -542,7 +542,10 @@ function _clone_children_on_template(
|
|
|
542
542
|
)
|
|
543
543
|
);
|
|
544
544
|
|
|
545
|
-
|
|
545
|
+
// Find aggregates with same browseName as node. Do not search children as this includes nodes with HasSubType relation which we do
|
|
546
|
+
// not want. See issue #1326.
|
|
547
|
+
const aggregates = typeDefinitionNode.getAggregates().filter((n) => n.browseName.equals(node.browseName));
|
|
548
|
+
const typeDefinitionChild = aggregates.length > 0 ? aggregates[0] : null;
|
|
546
549
|
if (typeDefinitionChild) {
|
|
547
550
|
const references = typeDefinitionChild.findReferencesEx("Aggregates", BrowseDirection.Forward);
|
|
548
551
|
|
|
@@ -1053,7 +1056,7 @@ export function _clone<T extends UAObject | UAVariable | UAMethod>(
|
|
|
1053
1056
|
);
|
|
1054
1057
|
typeDefinitionNode = typeDefinitionNode.subtypeOfObj;
|
|
1055
1058
|
}
|
|
1056
|
-
|
|
1059
|
+
|
|
1057
1060
|
extraInfo.popContext();
|
|
1058
1061
|
|
|
1059
1062
|
}
|
|
@@ -445,9 +445,9 @@ function _historyReadRaw(
|
|
|
445
445
|
historyReadRawModifiedDetails.numValuesPerNode,
|
|
446
446
|
continuationData
|
|
447
447
|
);
|
|
448
|
-
const { statusCode, values } = cnt;
|
|
448
|
+
const { statusCode, values, continuationPoint } = cnt;
|
|
449
449
|
const result2 = new HistoryReadResult({
|
|
450
|
-
continuationPoint
|
|
450
|
+
continuationPoint,
|
|
451
451
|
historyData: new HistoryData({ dataValues: values }),
|
|
452
452
|
statusCode
|
|
453
453
|
});
|
package/src/namespace_impl.ts
CHANGED
|
@@ -2000,7 +2000,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
2000
2000
|
// a getter has been specified and no options.minimumSamplingInterval has been specified
|
|
2001
2001
|
warningLog(
|
|
2002
2002
|
"[NODE-OPCUA-W30",
|
|
2003
|
-
"namespace#addVariable a getter has been specified and minimumSamplingInterval is missing.\nMinimumSamplingInterval has been adjusted to 1000 ms"
|
|
2003
|
+
"namespace#addVariable a getter has been specified and minimumSamplingInterval is missing.\nMinimumSamplingInterval has been adjusted to 1000 ms\nvariable = "+ options?.browseName?.toString()
|
|
2004
2004
|
);
|
|
2005
2005
|
options.minimumSamplingInterval = 1000;
|
|
2006
2006
|
}
|
package/src/ua_method_impl.ts
CHANGED
|
@@ -135,7 +135,7 @@ export class UAMethodImpl extends BaseNodeImpl implements UAMethod {
|
|
|
135
135
|
if (async_func.length === 2) {
|
|
136
136
|
async_func = callbackify(async_func as MethodFunctorA) as MethodFunctorC;
|
|
137
137
|
}
|
|
138
|
-
assert(async_func.length === 3);
|
|
138
|
+
assert(async_func.length === 3, " a method with callback should have 3 arguments : got " + async_func.length);
|
|
139
139
|
this._asyncExecutionFunction = async_func;
|
|
140
140
|
}
|
|
141
141
|
public execute(
|
package/src/ua_object_impl.ts
CHANGED
|
@@ -42,6 +42,18 @@ export class UAObjectImpl extends BaseNodeImpl implements UAObject {
|
|
|
42
42
|
private _eventNotifier: EventNotifierFlags;
|
|
43
43
|
public readonly nodeClass = NodeClass.Object;
|
|
44
44
|
public get eventNotifier(): EventNotifierFlags {
|
|
45
|
+
|
|
46
|
+
// ensure eventNotifier is set if the node has some event
|
|
47
|
+
|
|
48
|
+
if (!this._eventNotifier) {
|
|
49
|
+
// const s = this.getEventSources();
|
|
50
|
+
const s = this.getEventSources();
|
|
51
|
+
const n = this.getNotifiers();
|
|
52
|
+
if (s.length > 0 || n.length > 0) {
|
|
53
|
+
this._eventNotifier = this._eventNotifier | EventNotifierFlags.SubscribeToEvents;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
return this._eventNotifier;
|
|
46
58
|
}
|
|
47
59
|
public readonly symbolicName: string | null;
|
package/src/ua_variable_impl.ts
CHANGED
|
@@ -1870,19 +1870,19 @@ function check_valid_array(dataType: DataType, array: any): boolean {
|
|
|
1870
1870
|
return false;
|
|
1871
1871
|
}
|
|
1872
1872
|
|
|
1873
|
-
function _apply_default_timestamps(dataValue: DataValue): void {
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
}
|
|
1873
|
+
// function _apply_default_timestamps(dataValue: DataValue): void {
|
|
1874
|
+
// const now = getCurrentClock();
|
|
1875
|
+
// assert(dataValue instanceof DataValue);
|
|
1876
|
+
|
|
1877
|
+
// if (!dataValue.sourceTimestamp) {
|
|
1878
|
+
// dataValue.sourceTimestamp = now.timestamp;
|
|
1879
|
+
// dataValue.sourcePicoseconds = now.picoseconds;
|
|
1880
|
+
// }
|
|
1881
|
+
// if (!dataValue.serverTimestamp) {
|
|
1882
|
+
// dataValue.serverTimestamp = now.timestamp;
|
|
1883
|
+
// dataValue.serverPicoseconds = now.picoseconds;
|
|
1884
|
+
// }
|
|
1885
|
+
// }
|
|
1886
1886
|
|
|
1887
1887
|
function unsetFlag(flags: number, mask: number): number {
|
|
1888
1888
|
return flags & ~mask;
|
|
@@ -1949,17 +1949,33 @@ function _default_writable_timestamped_set_func(
|
|
|
1949
1949
|
callback(null, StatusCodes.Good, dataValue);
|
|
1950
1950
|
}
|
|
1951
1951
|
|
|
1952
|
-
|
|
1952
|
+
type f1<T, D, R> = (this: T, data: D) => R;
|
|
1953
|
+
type f2<T, D, R> = (this: T, data: D) => Promise<R>;
|
|
1954
|
+
type f3<T, D, R> = (this: T, data: D, callback: (err: Error | null, r?: R) => void) => void;
|
|
1955
|
+
|
|
1956
|
+
function turn_sync_to_async<T, D, R>(f: f1<T, D, R> | f2<T, D, R> | f3<T, D, R>, numberOfArgs: number): f3<T, D, R> {
|
|
1953
1957
|
if (f.length <= numberOfArgs) {
|
|
1954
1958
|
return function (this: T, data: D, callback: (err: Error | null, r?: R) => void) {
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
+
new Promise<R>((resolve, reject) => {
|
|
1960
|
+
try {
|
|
1961
|
+
// const ff1 = f as f1<T, D, R>;
|
|
1962
|
+
const ff2 = f as f2<T, D, R>;
|
|
1963
|
+
const r: R | Promise<R> = ff2.call(this, data);
|
|
1964
|
+
if (r instanceof Promise) {
|
|
1965
|
+
r.then(resolve, reject);
|
|
1966
|
+
} else {
|
|
1967
|
+
resolve(r);
|
|
1968
|
+
}
|
|
1969
|
+
} catch (err) {
|
|
1970
|
+
reject(err);
|
|
1971
|
+
}
|
|
1972
|
+
})
|
|
1973
|
+
.then((r) => {
|
|
1974
|
+
callback(null, r);
|
|
1975
|
+
})
|
|
1976
|
+
.catch((err) => {
|
|
1977
|
+
callback(err as Error);
|
|
1959
1978
|
});
|
|
1960
|
-
} catch (err) {
|
|
1961
|
-
return callback(err as Error);
|
|
1962
|
-
}
|
|
1963
1979
|
};
|
|
1964
1980
|
} else {
|
|
1965
1981
|
assert(f.length === numberOfArgs + 1);
|
|
@@ -1977,8 +1993,10 @@ function coerceDataValue(dataValue: DataValue | DataValueLike): DataValue {
|
|
|
1977
1993
|
}
|
|
1978
1994
|
|
|
1979
1995
|
// variation #3 :
|
|
1980
|
-
function _Variable_bind_with_async_refresh(
|
|
1981
|
-
|
|
1996
|
+
function _Variable_bind_with_async_refresh(
|
|
1997
|
+
this: UAVariableImpl,
|
|
1998
|
+
options: { refreshFunc: RefreshFunc; get?: undefined; timestamped_get?: undefined }
|
|
1999
|
+
) {
|
|
1982
2000
|
assert(this instanceof UAVariableImpl);
|
|
1983
2001
|
|
|
1984
2002
|
assert(typeof options.refreshFunc === "function");
|
|
@@ -2050,7 +2068,6 @@ function _Variable_bind_with_timestamped_get(
|
|
|
2050
2068
|
|
|
2051
2069
|
// variation 1
|
|
2052
2070
|
function _Variable_bind_with_simple_get(this: UAVariableImpl, options: GetterOptions) {
|
|
2053
|
-
/* jshint validthis: true */
|
|
2054
2071
|
assert(this instanceof UAVariableImpl);
|
|
2055
2072
|
assert(typeof options.get === "function", "should specify get function");
|
|
2056
2073
|
assert(options.get!.length === 0, "get function should not have arguments");
|
|
@@ -2082,7 +2099,14 @@ function _Variable_bind_with_simple_get(this: UAVariableImpl, options: GetterOpt
|
|
|
2082
2099
|
!this.$dataValue.statusCode.isGoodish() ||
|
|
2083
2100
|
!sameVariant(this.$dataValue.value, value as Variant)
|
|
2084
2101
|
) {
|
|
2085
|
-
|
|
2102
|
+
// rebuilding artificially timestamps with current clock as they are not provided
|
|
2103
|
+
// by the underlying getter function
|
|
2104
|
+
const { timestamp: sourceTimestamp, picoseconds: sourcePicoseconds } = getCurrentClock();
|
|
2105
|
+
const serverTimestamp = sourceTimestamp;
|
|
2106
|
+
const serverPicoseconds = sourcePicoseconds;
|
|
2107
|
+
this._inner_replace_dataValue(
|
|
2108
|
+
new DataValue({ value, sourceTimestamp, sourcePicoseconds, serverTimestamp, serverPicoseconds })
|
|
2109
|
+
);
|
|
2086
2110
|
}
|
|
2087
2111
|
return this.$dataValue;
|
|
2088
2112
|
}
|
|
@@ -2094,7 +2118,8 @@ function _Variable_bind_with_simple_get(this: UAVariableImpl, options: GetterOpt
|
|
|
2094
2118
|
});
|
|
2095
2119
|
}
|
|
2096
2120
|
|
|
2097
|
-
|
|
2121
|
+
type SimpleSetOptions = { set?: SetFunc; timestamped_set: undefined };
|
|
2122
|
+
function _Variable_bind_with_simple_set(this: UAVariableImpl, options: SimpleSetOptions) {
|
|
2098
2123
|
assert(this instanceof UAVariableImpl);
|
|
2099
2124
|
assert(typeof options.set === "function", "should specify set function");
|
|
2100
2125
|
assert(!options.timestamped_set, "should not specify a timestamped_set function");
|
|
@@ -2102,7 +2127,9 @@ function _Variable_bind_with_simple_set(this: UAVariableImpl, options: any) {
|
|
|
2102
2127
|
assert(!this._timestamped_set_func);
|
|
2103
2128
|
assert(!this._set_func);
|
|
2104
2129
|
|
|
2105
|
-
|
|
2130
|
+
//
|
|
2131
|
+
this._set_func = turn_sync_to_async(options.set!, 1);
|
|
2132
|
+
|
|
2106
2133
|
assert(this._set_func.length === 2, " set function must have 2 arguments ( variant, callback)");
|
|
2107
2134
|
|
|
2108
2135
|
this._timestamped_set_func = (
|
|
@@ -2149,9 +2176,13 @@ interface SetterOptions {
|
|
|
2149
2176
|
timestamped_get?: TimestampGetFunc;
|
|
2150
2177
|
}
|
|
2151
2178
|
function bind_setter(this: UAVariableImpl, options: SetterOptions) {
|
|
2152
|
-
if (typeof options.set === "function") {
|
|
2179
|
+
if (options.set && typeof options.set === "function") {
|
|
2153
2180
|
// variation 1
|
|
2154
|
-
|
|
2181
|
+
if (options.timestamped_set === undefined) {
|
|
2182
|
+
_Variable_bind_with_simple_set.call(this, options as SimpleSetOptions);
|
|
2183
|
+
} else {
|
|
2184
|
+
throw new Error("bind_setter : options should not specify both set and timestamped_set ");
|
|
2185
|
+
}
|
|
2155
2186
|
} else if (typeof options.timestamped_set === "function") {
|
|
2156
2187
|
// variation 2
|
|
2157
2188
|
assert(typeof options.timestamped_get === "function", "timestamped_set must be used with timestamped_get ");
|
|
@@ -2174,10 +2205,11 @@ function bind_setter(this: UAVariableImpl, options: SetterOptions) {
|
|
|
2174
2205
|
}
|
|
2175
2206
|
}
|
|
2176
2207
|
|
|
2208
|
+
type RefreshFunc = (callback: CallbackT<DataValue>) => void;
|
|
2177
2209
|
interface GetterOptions {
|
|
2178
2210
|
get?: GetFunc;
|
|
2179
2211
|
timestamped_get?: TimestampGetFunc;
|
|
2180
|
-
refreshFunc?:
|
|
2212
|
+
refreshFunc?: RefreshFunc;
|
|
2181
2213
|
dataType?: DataType | string;
|
|
2182
2214
|
value?: any;
|
|
2183
2215
|
}
|
|
@@ -2193,7 +2225,10 @@ function bind_getter(this: UAVariableImpl, options: GetterOptions) {
|
|
|
2193
2225
|
});
|
|
2194
2226
|
} else if (typeof options.refreshFunc === "function") {
|
|
2195
2227
|
// variation 3
|
|
2196
|
-
|
|
2228
|
+
if (options.get !== undefined || options.timestamped_get !== undefined) {
|
|
2229
|
+
throw new Error("bind_getter : options should not specify both get and timestamped_get ");
|
|
2230
|
+
}
|
|
2231
|
+
_Variable_bind_with_async_refresh.call(this, { refreshFunc: options.refreshFunc! });
|
|
2197
2232
|
} else {
|
|
2198
2233
|
assert(
|
|
2199
2234
|
!Object.prototype.hasOwnProperty.call(options, "set"),
|