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.
Files changed (83) hide show
  1. package/dist/alarms_and_conditions/client_alarm_tools.js +7 -5
  2. package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
  3. package/dist/alarms_and_conditions/client_tools.js +38 -28
  4. package/dist/alarms_and_conditions/client_tools.js.map +1 -1
  5. package/dist/client_base.d.ts +5 -0
  6. package/dist/client_base.js.map +1 -1
  7. package/dist/client_monitored_item.d.ts +1 -1
  8. package/dist/client_monitored_item.js +4 -2
  9. package/dist/client_monitored_item.js.map +1 -1
  10. package/dist/client_monitored_item_group.d.ts +4 -3
  11. package/dist/client_monitored_item_group.js +8 -5
  12. package/dist/client_monitored_item_group.js.map +1 -1
  13. package/dist/client_monitored_item_toolbox.js +4 -2
  14. package/dist/client_monitored_item_toolbox.js.map +1 -1
  15. package/dist/client_session.d.ts +9 -2
  16. package/dist/client_session_keepalive_manager.d.ts +1 -1
  17. package/dist/client_session_keepalive_manager.js +50 -29
  18. package/dist/client_session_keepalive_manager.js.map +1 -1
  19. package/dist/client_subscription.d.ts +2 -2
  20. package/dist/client_subscription.js +3 -1
  21. package/dist/client_subscription.js.map +1 -1
  22. package/dist/common.d.ts +3 -3
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/opcua_client.js +1 -0
  27. package/dist/opcua_client.js.map +1 -1
  28. package/dist/private/client_base_impl.js +178 -77
  29. package/dist/private/client_base_impl.js.map +1 -1
  30. package/dist/private/client_monitored_item_group_impl.d.ts +1 -0
  31. package/dist/private/client_monitored_item_group_impl.js +6 -8
  32. package/dist/private/client_monitored_item_group_impl.js.map +1 -1
  33. package/dist/private/client_monitored_item_impl.js +0 -4
  34. package/dist/private/client_monitored_item_impl.js.map +1 -1
  35. package/dist/private/client_publish_engine.js +62 -28
  36. package/dist/private/client_publish_engine.js.map +1 -1
  37. package/dist/private/client_session_impl.d.ts +49 -17
  38. package/dist/private/client_session_impl.js +240 -143
  39. package/dist/private/client_session_impl.js.map +1 -1
  40. package/dist/private/client_subscription_impl.js +15 -12
  41. package/dist/private/client_subscription_impl.js.map +1 -1
  42. package/dist/private/i_private_client.d.ts +1 -1
  43. package/dist/private/opcua_client_impl.js +44 -9
  44. package/dist/private/opcua_client_impl.js.map +1 -1
  45. package/dist/private/reconnection/client_publish_engine_reconnection.js +17 -7
  46. package/dist/private/reconnection/client_publish_engine_reconnection.js.map +1 -1
  47. package/dist/private/reconnection/client_subscription_reconnection.js +11 -7
  48. package/dist/private/reconnection/client_subscription_reconnection.js.map +1 -1
  49. package/dist/private/reconnection/reconnection.js +31 -14
  50. package/dist/private/reconnection/reconnection.js.map +1 -1
  51. package/dist/reverse/client_reverse_connect.js.map +1 -1
  52. package/dist/tools/findservers.js.map +1 -1
  53. package/dist/tools/read_history_server_capabilities.d.ts +2 -1
  54. package/dist/tools/read_history_server_capabilities.js +6 -3
  55. package/dist/tools/read_history_server_capabilities.js.map +1 -1
  56. package/package.json +50 -50
  57. package/source/alarms_and_conditions/client_alarm_tools.ts +10 -8
  58. package/source/alarms_and_conditions/client_tools.ts +71 -30
  59. package/source/client_base.ts +5 -1
  60. package/source/client_monitored_item.ts +10 -9
  61. package/source/client_monitored_item_base.ts +2 -8
  62. package/source/client_monitored_item_group.ts +13 -10
  63. package/source/client_monitored_item_toolbox.ts +4 -2
  64. package/source/client_session.ts +10 -3
  65. package/source/client_session_keepalive_manager.ts +72 -55
  66. package/source/client_subscription.ts +6 -3
  67. package/source/common.ts +4 -0
  68. package/source/index.ts +1 -1
  69. package/source/opcua_client.ts +1 -0
  70. package/source/private/client_base_impl.ts +244 -113
  71. package/source/private/client_monitored_item_group_impl.ts +17 -18
  72. package/source/private/client_monitored_item_impl.ts +0 -4
  73. package/source/private/client_publish_engine.ts +78 -40
  74. package/source/private/client_session_impl.ts +393 -236
  75. package/source/private/client_subscription_impl.ts +20 -25
  76. package/source/private/i_private_client.ts +1 -1
  77. package/source/private/opcua_client_impl.ts +51 -9
  78. package/source/private/reconnection/client_publish_engine_reconnection.ts +22 -21
  79. package/source/private/reconnection/client_subscription_reconnection.ts +12 -8
  80. package/source/private/reconnection/reconnection.ts +35 -18
  81. package/source/reverse/client_reverse_connect.ts +11 -3
  82. package/source/tools/findservers.ts +0 -1
  83. 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.177.0",
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": "eslint source test test_helpers",
11
- "format": "prettier --write source test test_helpers",
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.177.0",
20
- "node-opcua-assert": "2.175.6",
21
- "node-opcua-basic-types": "2.177.0",
22
- "node-opcua-buffer-utils": "2.176.0",
23
- "node-opcua-certificate-manager": "2.177.0",
24
- "node-opcua-client-dynamic-extension-object": "2.177.0",
25
- "node-opcua-common": "2.177.0",
26
- "node-opcua-constants": "2.176.0",
27
- "node-opcua-crypto": "5.5.0",
28
- "node-opcua-data-model": "2.177.0",
29
- "node-opcua-data-value": "2.177.0",
30
- "node-opcua-date-time": "2.176.0",
31
- "node-opcua-debug": "2.175.6",
32
- "node-opcua-extension-object": "2.177.0",
33
- "node-opcua-hostname": "2.175.1",
34
- "node-opcua-nodeid": "2.177.0",
35
- "node-opcua-numeric-range": "2.177.0",
36
- "node-opcua-object-registry": "2.175.6",
37
- "node-opcua-pki": "6.19.1",
38
- "node-opcua-pseudo-session": "2.177.0",
39
- "node-opcua-schemas": "2.177.0",
40
- "node-opcua-secure-channel": "2.177.0",
41
- "node-opcua-service-browse": "2.177.0",
42
- "node-opcua-service-call": "2.177.0",
43
- "node-opcua-service-discovery": "2.177.0",
44
- "node-opcua-service-endpoints": "2.177.0",
45
- "node-opcua-service-filter": "2.177.0",
46
- "node-opcua-service-history": "2.177.0",
47
- "node-opcua-service-query": "2.177.0",
48
- "node-opcua-service-read": "2.177.0",
49
- "node-opcua-service-register-node": "2.177.0",
50
- "node-opcua-service-secure-channel": "2.177.0",
51
- "node-opcua-service-session": "2.177.0",
52
- "node-opcua-service-subscription": "2.177.0",
53
- "node-opcua-service-translate-browse-path": "2.177.0",
54
- "node-opcua-service-write": "2.177.0",
55
- "node-opcua-status-code": "2.176.0",
56
- "node-opcua-transport": "2.177.0",
57
- "node-opcua-types": "2.177.0",
58
- "node-opcua-utils": "2.176.0",
59
- "node-opcua-variant": "2.177.0",
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.177.0",
65
- "node-opcua-binary-stream": "2.176.0",
66
- "node-opcua-factory": "2.177.0",
67
- "node-opcua-leak-detector": "2.175.6",
68
- "node-opcua-nodesets": "2.175.3"
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": "a00d1d3f4db4522ed6bb2c6104d86c57df79946a",
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
- debugLog(
120
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---- ALARM RECEIVED " +
121
- eventType.value.toString() +
122
- " " +
123
- eventId.value?.toString("hex")
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
- " not acknowledgeable condition ---- " + eventType.value.toString() + " ",
131
+ ` not acknowledgeable condition ---- ${eventType.value.toString()} `,
130
132
  conditionId,
131
133
  conditionName?.value,
132
- " " + eventId.value?.toString("hex")
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
- ClientSessionImpl.prototype.addCommentCondition = function (
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
- ClientSessionImpl.prototype.findMethodId = function (nodeId: NodeIdLike, methodName: string, callback: ResponseCallback<NodeId>) {
33
- findMethodId(this, nodeId, methodName)
34
- .then((data) => {
35
- if (data.methodId) {
36
- callback(null, data.methodId);
37
- } else {
38
- callback(data.err);
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
- ClientSessionImpl.prototype.confirmCondition = function (
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
- ClientSessionImpl.prototype.acknowledgeCondition = function (
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
- // tslint:disable:no-var-requires
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;
@@ -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
- export let create = function(
28
- subscription: ClientSubscription,
29
- itemToMonitor: ReadValueIdOptions,
30
- monitoringParameters: MonitoringParametersOptions,
31
- timestampsToReturn: TimestampsToReturn = TimestampsToReturn.Neither
32
- ): ClientMonitoredItem {
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
- parameters: MonitoringParametersOptions,
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 class ClientMonitoredItemGroup {
28
- public static create(
29
- subscription: ClientSubscription,
30
- itemsToMonitor: any[],
31
- monitoringParameters: MonitoringParametersOptions,
32
- timestampsToReturn: TimestampsToReturn
33
- ): ClientMonitoredItemGroup {
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 _doDebug = checkDebugFlag(__filename);
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
- debugLog(chalk.red("ClientMonitoredItemBase#_toolbox_monitor: ERROR in createMonitoredItems ", err.message));
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) {
@@ -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: (state: any) => void): this;
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