node-opcua-client 2.177.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/alarms_and_conditions/client_alarm_tools.js +7 -5
- package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
- package/dist/alarms_and_conditions/client_tools.js +38 -28
- package/dist/alarms_and_conditions/client_tools.js.map +1 -1
- package/dist/client_base.d.ts +5 -0
- package/dist/client_base.js.map +1 -1
- package/dist/client_monitored_item.d.ts +1 -1
- package/dist/client_monitored_item.js +4 -2
- package/dist/client_monitored_item.js.map +1 -1
- package/dist/client_monitored_item_group.d.ts +4 -3
- package/dist/client_monitored_item_group.js +8 -5
- package/dist/client_monitored_item_group.js.map +1 -1
- package/dist/client_monitored_item_toolbox.js +4 -2
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session.d.ts +9 -2
- package/dist/client_session_keepalive_manager.d.ts +1 -1
- package/dist/client_session_keepalive_manager.js +50 -29
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/client_subscription.d.ts +2 -2
- package/dist/client_subscription.js +3 -1
- package/dist/client_subscription.js.map +1 -1
- package/dist/common.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/opcua_client.js +1 -0
- package/dist/opcua_client.js.map +1 -1
- package/dist/private/client_base_impl.js +178 -77
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_group_impl.d.ts +1 -0
- package/dist/private/client_monitored_item_group_impl.js +6 -8
- package/dist/private/client_monitored_item_group_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.js +0 -4
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_publish_engine.js +62 -28
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +49 -17
- package/dist/private/client_session_impl.js +240 -143
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.js +15 -12
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/i_private_client.d.ts +1 -1
- package/dist/private/opcua_client_impl.js +44 -9
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/reconnection/client_publish_engine_reconnection.js +17 -7
- package/dist/private/reconnection/client_publish_engine_reconnection.js.map +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.js +11 -7
- package/dist/private/reconnection/client_subscription_reconnection.js.map +1 -1
- package/dist/private/reconnection/reconnection.js +31 -14
- package/dist/private/reconnection/reconnection.js.map +1 -1
- package/dist/reverse/client_reverse_connect.js.map +1 -1
- package/dist/tools/findservers.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.d.ts +2 -1
- package/dist/tools/read_history_server_capabilities.js +6 -3
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/package.json +50 -50
- package/source/alarms_and_conditions/client_alarm_tools.ts +10 -8
- package/source/alarms_and_conditions/client_tools.ts +71 -30
- package/source/client_base.ts +5 -1
- package/source/client_monitored_item.ts +10 -9
- package/source/client_monitored_item_base.ts +2 -8
- package/source/client_monitored_item_group.ts +13 -10
- package/source/client_monitored_item_toolbox.ts +4 -2
- package/source/client_session.ts +10 -3
- package/source/client_session_keepalive_manager.ts +72 -55
- package/source/client_subscription.ts +6 -3
- package/source/common.ts +4 -0
- package/source/index.ts +1 -1
- package/source/opcua_client.ts +1 -0
- package/source/private/client_base_impl.ts +244 -113
- package/source/private/client_monitored_item_group_impl.ts +17 -18
- package/source/private/client_monitored_item_impl.ts +0 -4
- package/source/private/client_publish_engine.ts +78 -40
- package/source/private/client_session_impl.ts +393 -236
- package/source/private/client_subscription_impl.ts +20 -25
- package/source/private/i_private_client.ts +1 -1
- package/source/private/opcua_client_impl.ts +51 -9
- package/source/private/reconnection/client_publish_engine_reconnection.ts +22 -21
- package/source/private/reconnection/client_subscription_reconnection.ts +12 -8
- package/source/private/reconnection/reconnection.ts +35 -18
- package/source/reverse/client_reverse_connect.ts +11 -3
- package/source/tools/findservers.ts +0 -1
- package/source/tools/read_history_server_capabilities.ts +9 -7
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.179.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module client",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "npx rimraf -g node_modules dist *.tsbuildinfo certificates",
|
|
7
7
|
"test": "mocha",
|
|
8
8
|
"test:check": "tsc --noEmit -p test/tsconfig.json",
|
|
9
9
|
"build": "tsc -b",
|
|
10
|
-
"lint": "
|
|
11
|
-
"format": "
|
|
10
|
+
"lint": "biome check --no-errors-on-unmatched .",
|
|
11
|
+
"format": "biome check --write --no-errors-on-unmatched .",
|
|
12
12
|
"doc": "npx typedoc@0.21 --options typedoc.js"
|
|
13
13
|
},
|
|
14
14
|
"main": "./dist/index.js",
|
|
@@ -16,56 +16,56 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@ster5/global-mutex": "^3.3.0",
|
|
18
18
|
"chalk": "4.1.2",
|
|
19
|
-
"node-opcua-alarm-condition": "2.
|
|
20
|
-
"node-opcua-assert": "2.
|
|
21
|
-
"node-opcua-basic-types": "2.
|
|
22
|
-
"node-opcua-buffer-utils": "2.
|
|
23
|
-
"node-opcua-certificate-manager": "2.
|
|
24
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
25
|
-
"node-opcua-common": "2.
|
|
26
|
-
"node-opcua-constants": "2.
|
|
27
|
-
"node-opcua-crypto": "5.
|
|
28
|
-
"node-opcua-data-model": "2.
|
|
29
|
-
"node-opcua-data-value": "2.
|
|
30
|
-
"node-opcua-date-time": "2.
|
|
31
|
-
"node-opcua-debug": "2.
|
|
32
|
-
"node-opcua-extension-object": "2.
|
|
33
|
-
"node-opcua-hostname": "2.
|
|
34
|
-
"node-opcua-nodeid": "2.
|
|
35
|
-
"node-opcua-numeric-range": "2.
|
|
36
|
-
"node-opcua-object-registry": "2.
|
|
37
|
-
"node-opcua-pki": "6.
|
|
38
|
-
"node-opcua-pseudo-session": "2.
|
|
39
|
-
"node-opcua-schemas": "2.
|
|
40
|
-
"node-opcua-secure-channel": "2.
|
|
41
|
-
"node-opcua-service-browse": "2.
|
|
42
|
-
"node-opcua-service-call": "2.
|
|
43
|
-
"node-opcua-service-discovery": "2.
|
|
44
|
-
"node-opcua-service-endpoints": "2.
|
|
45
|
-
"node-opcua-service-filter": "2.
|
|
46
|
-
"node-opcua-service-history": "2.
|
|
47
|
-
"node-opcua-service-query": "2.
|
|
48
|
-
"node-opcua-service-read": "2.
|
|
49
|
-
"node-opcua-service-register-node": "2.
|
|
50
|
-
"node-opcua-service-secure-channel": "2.
|
|
51
|
-
"node-opcua-service-session": "2.
|
|
52
|
-
"node-opcua-service-subscription": "2.
|
|
53
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
54
|
-
"node-opcua-service-write": "2.
|
|
55
|
-
"node-opcua-status-code": "2.
|
|
56
|
-
"node-opcua-transport": "2.
|
|
57
|
-
"node-opcua-types": "2.
|
|
58
|
-
"node-opcua-utils": "2.
|
|
59
|
-
"node-opcua-variant": "2.
|
|
19
|
+
"node-opcua-alarm-condition": "2.179.0",
|
|
20
|
+
"node-opcua-assert": "2.179.0",
|
|
21
|
+
"node-opcua-basic-types": "2.179.0",
|
|
22
|
+
"node-opcua-buffer-utils": "2.179.0",
|
|
23
|
+
"node-opcua-certificate-manager": "2.179.0",
|
|
24
|
+
"node-opcua-client-dynamic-extension-object": "2.179.0",
|
|
25
|
+
"node-opcua-common": "2.179.0",
|
|
26
|
+
"node-opcua-constants": "2.179.0",
|
|
27
|
+
"node-opcua-crypto": "5.9.0",
|
|
28
|
+
"node-opcua-data-model": "2.179.0",
|
|
29
|
+
"node-opcua-data-value": "2.179.0",
|
|
30
|
+
"node-opcua-date-time": "2.179.0",
|
|
31
|
+
"node-opcua-debug": "2.179.0",
|
|
32
|
+
"node-opcua-extension-object": "2.179.0",
|
|
33
|
+
"node-opcua-hostname": "2.179.0",
|
|
34
|
+
"node-opcua-nodeid": "2.179.0",
|
|
35
|
+
"node-opcua-numeric-range": "2.179.0",
|
|
36
|
+
"node-opcua-object-registry": "2.179.0",
|
|
37
|
+
"node-opcua-pki": "6.21.0",
|
|
38
|
+
"node-opcua-pseudo-session": "2.179.0",
|
|
39
|
+
"node-opcua-schemas": "2.179.0",
|
|
40
|
+
"node-opcua-secure-channel": "2.179.0",
|
|
41
|
+
"node-opcua-service-browse": "2.179.0",
|
|
42
|
+
"node-opcua-service-call": "2.179.0",
|
|
43
|
+
"node-opcua-service-discovery": "2.179.0",
|
|
44
|
+
"node-opcua-service-endpoints": "2.179.0",
|
|
45
|
+
"node-opcua-service-filter": "2.179.0",
|
|
46
|
+
"node-opcua-service-history": "2.179.0",
|
|
47
|
+
"node-opcua-service-query": "2.179.0",
|
|
48
|
+
"node-opcua-service-read": "2.179.0",
|
|
49
|
+
"node-opcua-service-register-node": "2.179.0",
|
|
50
|
+
"node-opcua-service-secure-channel": "2.179.0",
|
|
51
|
+
"node-opcua-service-session": "2.179.0",
|
|
52
|
+
"node-opcua-service-subscription": "2.179.0",
|
|
53
|
+
"node-opcua-service-translate-browse-path": "2.179.0",
|
|
54
|
+
"node-opcua-service-write": "2.179.0",
|
|
55
|
+
"node-opcua-status-code": "2.179.0",
|
|
56
|
+
"node-opcua-transport": "2.179.0",
|
|
57
|
+
"node-opcua-types": "2.179.0",
|
|
58
|
+
"node-opcua-utils": "2.179.0",
|
|
59
|
+
"node-opcua-variant": "2.179.0",
|
|
60
60
|
"thenify-ex": "4.4.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"dequeue": "^1.0.5",
|
|
64
|
-
"node-opcua-address-space": "2.
|
|
65
|
-
"node-opcua-binary-stream": "2.
|
|
66
|
-
"node-opcua-factory": "2.
|
|
67
|
-
"node-opcua-leak-detector": "2.
|
|
68
|
-
"node-opcua-nodesets": "2.
|
|
64
|
+
"node-opcua-address-space": "2.179.0",
|
|
65
|
+
"node-opcua-binary-stream": "2.179.0",
|
|
66
|
+
"node-opcua-factory": "2.179.0",
|
|
67
|
+
"node-opcua-leak-detector": "2.179.0",
|
|
68
|
+
"node-opcua-nodesets": "2.179.0"
|
|
69
69
|
},
|
|
70
70
|
"eslintConfig": {
|
|
71
71
|
"env": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"internet of things"
|
|
88
88
|
],
|
|
89
89
|
"homepage": "http://node-opcua.github.io/",
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "c78c6ee424bae3c6e851fabd8e144390e2941f8a",
|
|
91
91
|
"files": [
|
|
92
92
|
"dist",
|
|
93
93
|
"source"
|
|
@@ -116,20 +116,22 @@ export async function installAlarmMonitoring(session: ClientSession): Promise<Cl
|
|
|
116
116
|
const pojo = fieldsToJson(fields, eventFields);
|
|
117
117
|
const { eventType, eventId, conditionId, conditionName } = pojo;
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
" " +
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
// c8 ignore next
|
|
120
|
+
doDebug &&
|
|
121
|
+
debugLog(
|
|
122
|
+
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---- ALARM RECEIVED " +
|
|
123
|
+
eventType.value.toString() +
|
|
124
|
+
" " +
|
|
125
|
+
eventId.value?.toString("hex")
|
|
126
|
+
);
|
|
125
127
|
try {
|
|
126
128
|
if (!conditionId?.value || conditionId.dataType === DataType.Null) {
|
|
127
129
|
// not a acknowledgeable condition
|
|
128
130
|
warningLog(
|
|
129
|
-
|
|
131
|
+
` not acknowledgeable condition ---- ${eventType.value.toString()} `,
|
|
130
132
|
conditionId,
|
|
131
133
|
conditionName?.value,
|
|
132
|
-
|
|
134
|
+
` ${eventId.value?.toString("hex")}`
|
|
133
135
|
);
|
|
134
136
|
return;
|
|
135
137
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { callbackify } from "node:util";
|
|
5
6
|
import { acknowledgeCondition, callMethodCondition, confirmCondition } from "node-opcua-alarm-condition";
|
|
6
7
|
import type { LocalizedTextLike } from "node-opcua-data-model";
|
|
7
8
|
import type { NodeId, NodeIdLike } from "node-opcua-nodeid";
|
|
8
9
|
import { findMethodId, type ResponseCallback } from "node-opcua-pseudo-session";
|
|
9
10
|
import type { Callback, StatusCode } from "node-opcua-status-code";
|
|
10
|
-
import { callbackify } from "util";
|
|
11
11
|
|
|
12
12
|
import { ClientSessionImpl } from "../private/client_session_impl";
|
|
13
13
|
|
|
@@ -19,57 +19,98 @@ ClientSessionImpl.prototype.enableCondition = () => {
|
|
|
19
19
|
/** */
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
function addCommentConditionImpl(
|
|
23
23
|
conditionId: NodeIdLike,
|
|
24
24
|
eventId: Buffer,
|
|
25
25
|
comment: LocalizedTextLike,
|
|
26
26
|
callback: Callback<StatusCode>
|
|
27
|
-
)
|
|
27
|
+
): void;
|
|
28
|
+
function addCommentConditionImpl(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
|
|
29
|
+
function addCommentConditionImpl(
|
|
30
|
+
this: ClientSessionImpl,
|
|
31
|
+
conditionId: NodeIdLike,
|
|
32
|
+
eventId: Buffer,
|
|
33
|
+
comment: LocalizedTextLike,
|
|
34
|
+
callback?: Callback<StatusCode>
|
|
35
|
+
): Promise<StatusCode> | undefined {
|
|
36
|
+
if (!callback) {
|
|
37
|
+
return callMethodCondition(this, "AddComment", conditionId, eventId, comment);
|
|
38
|
+
}
|
|
28
39
|
callbackify(callMethodCondition)(this, "AddComment", conditionId, eventId, comment, callback);
|
|
29
|
-
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
ClientSessionImpl.prototype.addCommentCondition = addCommentConditionImpl;
|
|
30
43
|
|
|
31
44
|
/** @deprecated */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
function findMethodIdImpl(nodeId: NodeIdLike, methodName: string, callback: ResponseCallback<NodeId>): void;
|
|
46
|
+
function findMethodIdImpl(nodeId: NodeIdLike, methodName: string): Promise<NodeId>;
|
|
47
|
+
function findMethodIdImpl(
|
|
48
|
+
this: ClientSessionImpl,
|
|
49
|
+
nodeId: NodeIdLike,
|
|
50
|
+
methodName: string,
|
|
51
|
+
callback?: ResponseCallback<NodeId>
|
|
52
|
+
): Promise<NodeId> | undefined {
|
|
53
|
+
const promise = findMethodId(this, nodeId, methodName).then((data) => {
|
|
54
|
+
if (data.methodId) {
|
|
55
|
+
return data.methodId;
|
|
56
|
+
}
|
|
57
|
+
throw data.err || new Error("findMethodId: method not found");
|
|
58
|
+
});
|
|
59
|
+
if (!callback) {
|
|
60
|
+
return promise;
|
|
61
|
+
}
|
|
62
|
+
promise
|
|
63
|
+
.then((methodId) => callback(null, methodId))
|
|
41
64
|
.catch((err) => {
|
|
42
65
|
callback(err);
|
|
43
66
|
});
|
|
44
|
-
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
ClientSessionImpl.prototype.findMethodId = findMethodIdImpl;
|
|
45
70
|
|
|
46
|
-
|
|
71
|
+
function confirmConditionImpl(
|
|
47
72
|
conditionId: NodeId,
|
|
48
73
|
eventId: Buffer,
|
|
49
74
|
comment: LocalizedTextLike,
|
|
50
75
|
callback: Callback<StatusCode>
|
|
51
|
-
)
|
|
76
|
+
): void;
|
|
77
|
+
function confirmConditionImpl(conditionId: NodeId, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
|
|
78
|
+
function confirmConditionImpl(
|
|
79
|
+
this: ClientSessionImpl,
|
|
80
|
+
conditionId: NodeId,
|
|
81
|
+
eventId: Buffer,
|
|
82
|
+
comment: LocalizedTextLike,
|
|
83
|
+
callback?: Callback<StatusCode>
|
|
84
|
+
): Promise<StatusCode> | undefined {
|
|
52
85
|
// ns=0;i=9113 AcknowledgeableConditionType#Confirm
|
|
53
86
|
// note that confirm method is Optionals on condition
|
|
87
|
+
if (!callback) {
|
|
88
|
+
return confirmCondition(this, conditionId, eventId, comment);
|
|
89
|
+
}
|
|
54
90
|
callbackify(confirmCondition)(this, conditionId, eventId, comment, callback);
|
|
55
|
-
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
ClientSessionImpl.prototype.confirmCondition = confirmConditionImpl;
|
|
56
94
|
|
|
57
|
-
|
|
95
|
+
function acknowledgeConditionImpl(
|
|
58
96
|
conditionId: NodeId,
|
|
59
97
|
eventId: Buffer,
|
|
60
98
|
comment: LocalizedTextLike,
|
|
61
99
|
callback: Callback<StatusCode>
|
|
62
|
-
)
|
|
100
|
+
): void;
|
|
101
|
+
function acknowledgeConditionImpl(conditionId: NodeId, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
|
|
102
|
+
function acknowledgeConditionImpl(
|
|
103
|
+
this: ClientSessionImpl,
|
|
104
|
+
conditionId: NodeId,
|
|
105
|
+
eventId: Buffer,
|
|
106
|
+
comment: LocalizedTextLike,
|
|
107
|
+
callback?: Callback<StatusCode>
|
|
108
|
+
): Promise<StatusCode> | undefined {
|
|
63
109
|
// ns=0;i=9111 AcknowledgeableConditionType#Acknowledge
|
|
110
|
+
if (!callback) {
|
|
111
|
+
return acknowledgeCondition(this, conditionId, eventId, comment);
|
|
112
|
+
}
|
|
64
113
|
callbackify(acknowledgeCondition)(this, conditionId, eventId, comment, callback);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// tslint:disable:max-line-length
|
|
69
|
-
import { withCallback } from "thenify-ex";
|
|
70
|
-
|
|
71
|
-
const opts = { multiArgs: false };
|
|
72
|
-
ClientSessionImpl.prototype.addCommentCondition = withCallback(ClientSessionImpl.prototype.addCommentCondition, opts);
|
|
73
|
-
ClientSessionImpl.prototype.findMethodId = withCallback(ClientSessionImpl.prototype.findMethodId, opts);
|
|
74
|
-
ClientSessionImpl.prototype.confirmCondition = withCallback(ClientSessionImpl.prototype.confirmCondition, opts);
|
|
75
|
-
ClientSessionImpl.prototype.acknowledgeCondition = withCallback(ClientSessionImpl.prototype.acknowledgeCondition, opts);
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
ClientSessionImpl.prototype.acknowledgeCondition = acknowledgeConditionImpl;
|
package/source/client_base.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
|
-
// tslint:disable:no-unused-expression
|
|
5
4
|
import type { LocaleId } from "node-opcua-basic-types";
|
|
6
5
|
import type { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
7
6
|
import type { ICertificateKeyPairProvider, ICertificateStore, OPCUASecureObject } from "node-opcua-common";
|
|
@@ -166,6 +165,11 @@ export interface OPCUAClientBaseOptions {
|
|
|
166
165
|
* provided by NodeOPCUA as it may interfere.
|
|
167
166
|
* - ensure that the provided client certificate matches the private pey.
|
|
168
167
|
*
|
|
168
|
+
* If the key is encrypted, `clientCertificateManager` must be an
|
|
169
|
+
* `OPCUACertificateManager` constructed with a matching
|
|
170
|
+
* `privateKeyPassphrase` (or `privateKeyProvider`) — otherwise
|
|
171
|
+
* `connect()` fails closed.
|
|
172
|
+
*
|
|
169
173
|
* @default `${clientCertificateManager/rootFolder}/own/private/private_key.pem"
|
|
170
174
|
*/
|
|
171
175
|
privateKeyFile?: string;
|
|
@@ -10,7 +10,6 @@ import type { Variant } from "node-opcua-variant";
|
|
|
10
10
|
import type { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
|
|
11
11
|
import type { ClientSubscription } from "./client_subscription";
|
|
12
12
|
|
|
13
|
-
// tslint:disable:unified-signatures
|
|
14
13
|
export interface ClientMonitoredItem extends ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction, EventEmitter {
|
|
15
14
|
on(event: "changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
16
15
|
on(event: "changed", eventHandler: (values: Variant[]) => void): this;
|
|
@@ -22,15 +21,17 @@ export interface ClientMonitoredItem extends ClientMonitoredItemBase, ClientMoni
|
|
|
22
21
|
on(event: "err", eventHandler: (message: string) => void): this;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
26
24
|
export namespace ClientMonitoredItem {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
// reassigned in private/client_monitored_item_impl.ts to install the real
|
|
26
|
+
// implementation; biome's useConst can't see that cross-module write.
|
|
27
|
+
// biome-ignore lint/style/useConst: intentionally mutable, see above
|
|
28
|
+
export let create = (
|
|
29
|
+
_subscription: ClientSubscription,
|
|
30
|
+
_itemToMonitor: ReadValueIdOptions,
|
|
31
|
+
_monitoringParameters: MonitoringParametersOptions,
|
|
32
|
+
_timestampsToReturn: TimestampsToReturn = TimestampsToReturn.Neither
|
|
33
|
+
): ClientMonitoredItem => {
|
|
33
34
|
/* c8 ignore next*/
|
|
34
35
|
throw new Error("unimplemented");
|
|
35
|
-
}
|
|
36
|
+
};
|
|
36
37
|
}
|
|
@@ -22,14 +22,8 @@ import type { Variant } from "node-opcua-variant";
|
|
|
22
22
|
import type { ClientSubscription } from "./client_subscription";
|
|
23
23
|
|
|
24
24
|
export interface ClientMonitoredItemOrGroupAction {
|
|
25
|
-
modify(
|
|
26
|
-
|
|
27
|
-
timestampsToReturn?: TimestampsToReturn
|
|
28
|
-
): Promise<MonitoredItemModifyResult>;
|
|
29
|
-
modify(
|
|
30
|
-
parameters: MonitoringParametersOptions,
|
|
31
|
-
callback: Callback<MonitoredItemModifyResult>
|
|
32
|
-
): void;
|
|
25
|
+
modify(parameters: MonitoringParametersOptions, timestampsToReturn?: TimestampsToReturn): Promise<MonitoredItemModifyResult>;
|
|
26
|
+
modify(parameters: MonitoringParametersOptions, callback: Callback<MonitoredItemModifyResult>): void;
|
|
33
27
|
modify(
|
|
34
28
|
parameters: MonitoringParametersOptions,
|
|
35
29
|
timestampsToReturn: TimestampsToReturn | null,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { EventEmitter } from "events";
|
|
5
|
+
import type { EventEmitter } from "node:events";
|
|
6
6
|
import type { DataValue, TimestampsToReturn } from "node-opcua-data-value";
|
|
7
|
+
import type { ReadValueIdOptions } from "node-opcua-service-read";
|
|
7
8
|
import type { MonitoringParametersOptions } from "node-opcua-types";
|
|
8
9
|
|
|
9
10
|
import type { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
|
|
10
11
|
import type { ClientSubscription } from "./client_subscription";
|
|
11
12
|
|
|
12
|
-
// tslint:disable:unified-signatures
|
|
13
13
|
export interface ClientMonitoredItemGroup extends EventEmitter, ClientMonitoredItemOrGroupAction {
|
|
14
14
|
on(event: "changed", eventHandler: (monitoredItem: ClientMonitoredItemBase, dataValue: DataValue, index: number) => void): this;
|
|
15
15
|
|
|
@@ -24,14 +24,17 @@ export interface ClientMonitoredItemGroup {
|
|
|
24
24
|
monitoredItems: ClientMonitoredItemBase[];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
export namespace ClientMonitoredItemGroup {
|
|
28
|
+
// reassigned in private/client_monitored_item_group_impl.ts to install the real
|
|
29
|
+
// implementation; biome's useConst can't see that cross-module write.
|
|
30
|
+
// biome-ignore lint/style/useConst: intentionally mutable, see above
|
|
31
|
+
export let create = (
|
|
32
|
+
_subscription: ClientSubscription,
|
|
33
|
+
_itemsToMonitor: ReadValueIdOptions[],
|
|
34
|
+
_monitoringParameters: MonitoringParametersOptions,
|
|
35
|
+
_timestampsToReturn: TimestampsToReturn
|
|
36
|
+
): ClientMonitoredItemGroup => {
|
|
34
37
|
/* c8 ignore next*/
|
|
35
38
|
throw new Error("Not implemented");
|
|
36
|
-
}
|
|
39
|
+
};
|
|
37
40
|
}
|
|
@@ -26,7 +26,7 @@ import type { ClientMonitoredItemImpl } from "./private/client_monitored_item_im
|
|
|
26
26
|
import type { ClientSessionImpl } from "./private/client_session_impl";
|
|
27
27
|
|
|
28
28
|
const debugLog = make_debugLog(__filename);
|
|
29
|
-
const
|
|
29
|
+
const doDebug = checkDebugFlag(__filename);
|
|
30
30
|
|
|
31
31
|
export interface ClientMonitoredItemBaseEx extends ClientMonitoredItemBase {
|
|
32
32
|
internalSetMonitoringMode(monitoringMode: MonitoringMode): void;
|
|
@@ -85,7 +85,9 @@ export namespace ClientMonitoredItemToolbox {
|
|
|
85
85
|
session.createMonitoredItems(createMonitorItemsRequest, (err?: Error | null, response?: CreateMonitoredItemsResponse) => {
|
|
86
86
|
/* c8 ignore next */
|
|
87
87
|
if (err) {
|
|
88
|
-
|
|
88
|
+
// c8 ignore next
|
|
89
|
+
doDebug &&
|
|
90
|
+
debugLog(chalk.red("ClientMonitoredItemBase#_toolbox_monitor: ERROR in createMonitoredItems ", err.message));
|
|
89
91
|
} else {
|
|
90
92
|
/* c8 ignore next */
|
|
91
93
|
if (!response) {
|
package/source/client_session.ts
CHANGED
|
@@ -110,7 +110,14 @@ export interface ClientSessionBase {
|
|
|
110
110
|
*/
|
|
111
111
|
lastRequestSentTime: Date;
|
|
112
112
|
/**
|
|
113
|
-
* the time of the latest response received by the client
|
|
113
|
+
* the time of the latest response received by the client from the server.
|
|
114
|
+
*
|
|
115
|
+
* this is only updated when the server has actually answered. A transaction that fails
|
|
116
|
+
* on a timeout or on a broken channel does not update this value, whereas a ServiceFault
|
|
117
|
+
* does: a fault means the server answered and rejected the request, so the session is
|
|
118
|
+
* still in contact with it.
|
|
119
|
+
*
|
|
120
|
+
* before the first answer, this holds the session creation sentinel rather than a real date.
|
|
114
121
|
*/
|
|
115
122
|
lastResponseReceivedTime: Date;
|
|
116
123
|
/**
|
|
@@ -183,10 +190,9 @@ export interface ClientSession extends ClientSessionBase {
|
|
|
183
190
|
}
|
|
184
191
|
// events
|
|
185
192
|
export interface ClientSession extends EventEmitter {
|
|
186
|
-
// tslint:disable:unified-signatures
|
|
187
193
|
on(event: "keepalive", eventHandler: (lastKnownServerState: ServerState) => void): this;
|
|
188
194
|
|
|
189
|
-
on(event: "keepalive_failure", eventHandler: (
|
|
195
|
+
on(event: "keepalive_failure", eventHandler: () => void): this;
|
|
190
196
|
|
|
191
197
|
on(event: "session_closed", eventHandler: (statusCode: StatusCode) => void): this;
|
|
192
198
|
|
|
@@ -196,6 +202,7 @@ export interface ClientSession extends EventEmitter {
|
|
|
196
202
|
*/
|
|
197
203
|
on(event: "session_restored", eventHandler: () => void): this;
|
|
198
204
|
|
|
205
|
+
// biome-ignore lint/suspicious/noExplicitAny: matches Node's EventEmitter.on catch-all signature; narrowing to unknown[] breaks assignability of specifically-typed listener handlers at call sites
|
|
199
206
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
200
207
|
}
|
|
201
208
|
|