node-opcua-client 2.166.0 → 2.167.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 (102) hide show
  1. package/dist/alarms_and_conditions/client_alarm_tools.d.ts +1 -1
  2. package/dist/alarms_and_conditions/client_alarm_tools.js +2 -2
  3. package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
  4. package/dist/alarms_and_conditions/client_tools.d.ts +3 -0
  5. package/dist/alarms_and_conditions/client_tools.js +2 -2
  6. package/dist/alarms_and_conditions/client_tools.js.map +1 -1
  7. package/dist/client_base.d.ts +47 -40
  8. package/dist/client_base.js +5 -6
  9. package/dist/client_base.js.map +1 -1
  10. package/dist/client_monitored_item.d.ts +7 -7
  11. package/dist/client_monitored_item.js.map +1 -1
  12. package/dist/client_monitored_item_base.d.ts +12 -13
  13. package/dist/client_monitored_item_group.d.ts +5 -5
  14. package/dist/client_monitored_item_toolbox.d.ts +6 -7
  15. package/dist/client_monitored_item_toolbox.js.map +1 -1
  16. package/dist/client_session.d.ts +19 -23
  17. package/dist/client_session.js.map +1 -1
  18. package/dist/client_session_keepalive_manager.d.ts +1 -1
  19. package/dist/client_session_keepalive_manager.js +6 -6
  20. package/dist/client_session_keepalive_manager.js.map +1 -1
  21. package/dist/client_subscription.d.ts +11 -12
  22. package/dist/client_subscription.js.map +1 -1
  23. package/dist/client_utils.d.ts +3 -3
  24. package/dist/client_utils.js.map +1 -1
  25. package/dist/common.d.ts +12 -12
  26. package/dist/index.d.ts +26 -27
  27. package/dist/index.js +65 -66
  28. package/dist/index.js.map +1 -1
  29. package/dist/opcua_client.d.ts +17 -19
  30. package/dist/opcua_client.js.map +1 -1
  31. package/dist/private/client_base_impl.d.ts +19 -18
  32. package/dist/private/client_base_impl.js +140 -119
  33. package/dist/private/client_base_impl.js.map +1 -1
  34. package/dist/private/client_monitored_item_group_impl.d.ts +4 -5
  35. package/dist/private/client_monitored_item_group_impl.js +1 -1
  36. package/dist/private/client_monitored_item_group_impl.js.map +1 -1
  37. package/dist/private/client_monitored_item_impl.d.ts +9 -10
  38. package/dist/private/client_monitored_item_impl.js.map +1 -1
  39. package/dist/private/client_publish_engine.d.ts +3 -3
  40. package/dist/private/client_publish_engine.js +6 -7
  41. package/dist/private/client_publish_engine.js.map +1 -1
  42. package/dist/private/client_session_impl.d.ts +24 -25
  43. package/dist/private/client_session_impl.js +14 -10
  44. package/dist/private/client_session_impl.js.map +1 -1
  45. package/dist/private/client_subscription_impl.d.ts +10 -11
  46. package/dist/private/client_subscription_impl.js +12 -11
  47. package/dist/private/client_subscription_impl.js.map +1 -1
  48. package/dist/private/i_private_client.d.ts +7 -7
  49. package/dist/private/opcua_client_impl.d.ts +12 -9
  50. package/dist/private/opcua_client_impl.js +58 -48
  51. package/dist/private/opcua_client_impl.js.map +1 -1
  52. package/dist/private/performance.js.map +1 -1
  53. package/dist/private/reconnection/client_publish_engine_reconnection.d.ts +1 -1
  54. package/dist/private/reconnection/client_publish_engine_reconnection.js +4 -2
  55. package/dist/private/reconnection/client_publish_engine_reconnection.js.map +1 -1
  56. package/dist/private/reconnection/client_reconnection.d.ts +1 -1
  57. package/dist/private/reconnection/client_subscription_reconnection.d.ts +1 -1
  58. package/dist/private/reconnection/client_subscription_reconnection.js +2 -2
  59. package/dist/private/reconnection/client_subscription_reconnection.js.map +1 -1
  60. package/dist/private/reconnection/reconnection.d.ts +3 -3
  61. package/dist/private/reconnection/reconnection.js +1 -1
  62. package/dist/private/reconnection/reconnection.js.map +1 -1
  63. package/dist/tools/findservers.d.ts +7 -2
  64. package/dist/tools/findservers.js +41 -53
  65. package/dist/tools/findservers.js.map +1 -1
  66. package/dist/tools/read_history_server_capabilities.d.ts +1 -1
  67. package/dist/tools/read_history_server_capabilities.js +9 -8
  68. package/dist/tools/read_history_server_capabilities.js.map +1 -1
  69. package/dist/user_identity_info.d.ts +1 -1
  70. package/dist/verify.js.map +1 -1
  71. package/package.json +41 -40
  72. package/source/alarms_and_conditions/client_alarm_tools.ts +14 -8
  73. package/source/alarms_and_conditions/client_tools.ts +7 -6
  74. package/source/client_base.ts +93 -79
  75. package/source/client_monitored_item.ts +7 -8
  76. package/source/client_monitored_item_base.ts +12 -14
  77. package/source/client_monitored_item_group.ts +5 -5
  78. package/source/client_monitored_item_toolbox.ts +13 -14
  79. package/source/client_session.ts +37 -40
  80. package/source/client_session_keepalive_manager.ts +7 -10
  81. package/source/client_subscription.ts +11 -12
  82. package/source/client_utils.ts +6 -6
  83. package/source/common.ts +12 -12
  84. package/source/index.ts +44 -40
  85. package/source/opcua_client.ts +24 -23
  86. package/source/private/client_base_impl.ts +276 -186
  87. package/source/private/client_monitored_item_group_impl.ts +10 -14
  88. package/source/private/client_monitored_item_impl.ts +17 -17
  89. package/source/private/client_publish_engine.ts +11 -12
  90. package/source/private/client_session_impl.ts +85 -82
  91. package/source/private/client_subscription_impl.ts +42 -41
  92. package/source/private/i_private_client.ts +8 -8
  93. package/source/private/opcua_client_impl.ts +118 -97
  94. package/source/private/performance.ts +2 -3
  95. package/source/private/reconnection/client_publish_engine_reconnection.ts +16 -15
  96. package/source/private/reconnection/client_reconnection.ts +1 -1
  97. package/source/private/reconnection/client_subscription_reconnection.ts +16 -13
  98. package/source/private/reconnection/reconnection.ts +130 -33
  99. package/source/tools/findservers.ts +43 -62
  100. package/source/tools/read_history_server_capabilities.ts +20 -22
  101. package/source/user_identity_info.ts +5 -5
  102. package/source/verify.ts +25 -25
@@ -2,20 +2,23 @@
2
2
  * @module node-opcua-client
3
3
  */
4
4
  // tslint:disable:no-unused-expression
5
- import { EventEmitter } from "events";
6
- import { LocaleId } from "node-opcua-basic-types";
7
- import { OPCUACertificateManager } from "node-opcua-certificate-manager";
8
- import { OPCUASecureObject } from "node-opcua-common";
9
- import { Certificate } from "node-opcua-crypto/web";
5
+ import type { LocaleId } from "node-opcua-basic-types";
6
+ import type { OPCUACertificateManager } from "node-opcua-certificate-manager";
7
+ import type { OPCUASecureObject } from "node-opcua-common";
8
+ import type { Certificate } from "node-opcua-crypto/web";
10
9
  import { ObjectRegistry } from "node-opcua-object-registry";
11
- import { ClientSecureChannelLayer, ConnectionStrategy, ConnectionStrategyOptions, SecurityPolicy } from "node-opcua-secure-channel";
12
- import { FindServersOnNetworkRequestOptions, FindServersRequestOptions, ServerOnNetwork } from "node-opcua-service-discovery";
13
- import { ApplicationDescription, EndpointDescription } from "node-opcua-service-endpoints";
14
- import { ChannelSecurityToken, MessageSecurityMode } from "node-opcua-service-secure-channel";
15
- import { ErrorCallback } from "node-opcua-status-code";
16
- import { ResponseCallback } from "node-opcua-pseudo-session";
17
-
18
- import { Request, Response } from "./common";
10
+ import type { ResponseCallback } from "node-opcua-pseudo-session";
11
+ import type {
12
+ ClientSecureChannelLayer,
13
+ ConnectionStrategy,
14
+ ConnectionStrategyOptions,
15
+ SecurityPolicy
16
+ } from "node-opcua-secure-channel";
17
+ import type { FindServersOnNetworkRequestOptions, FindServersRequestOptions, ServerOnNetwork } from "node-opcua-service-discovery";
18
+ import type { ApplicationDescription, EndpointDescription } from "node-opcua-service-endpoints";
19
+ import type { ChannelSecurityToken, MessageSecurityMode } from "node-opcua-service-secure-channel";
20
+ import type { ErrorCallback } from "node-opcua-status-code";
21
+ import type { Request, Response } from "./common";
19
22
 
20
23
  export type FindServersRequestLike = FindServersRequestOptions;
21
24
  export type FindServersOnNetworkRequestLike = FindServersOnNetworkRequestOptions;
@@ -73,9 +76,9 @@ export interface OPCUAClientBaseOptions {
73
76
  keepPendingSessionsOnDisconnect?: boolean;
74
77
 
75
78
  /**
76
- * the server certificate.
79
+ * the server certificate or certificate chain.
77
80
  */
78
- serverCertificate?: Certificate;
81
+ serverCertificate?: Certificate | Certificate[];
79
82
 
80
83
  /**
81
84
  * default secure token lifetime in ms
@@ -97,70 +100,70 @@ export interface OPCUAClientBaseOptions {
97
100
 
98
101
  /**
99
102
  * When set to true, the session will send a Read request on a regular interval specified by the `keepAliveInterval`.
100
- *
103
+ *
101
104
  * This ensure that the connection will remain active and that the socket will not timeout.
102
- *
103
- * When the keepAlive manager is not able to perform the Read operation, then it breaks the connection
104
- * and force the client to enter a reconnection phase.
105
- *
106
- * On some network settings and operating system, it might be quite tricky to detect when the communication
107
- * as the the
108
- *
109
- *
105
+ *
106
+ * When the keepAlive manager is not able to perform the Read operation, then it breaks the connection
107
+ * and force the client to enter a reconnection phase.
108
+ *
109
+ * On some network settings and operating system, it might be quite tricky to detect when the communication
110
+ * as the the
111
+ *
112
+ *
110
113
  * Tips:
111
- *
112
- * You don't ned to use `keepSessionAlive: true` when your session have a subscription active.
113
- * A OPCUA subscription has already a built-in keepAlive mechanism that can replace the regular Read pooling
114
- * offered by this flag.
115
- *
114
+ *
115
+ * You don't ned to use `keepSessionAlive: true` when your session have a subscription active.
116
+ * A OPCUA subscription has already a built-in keepAlive mechanism that can replace the regular Read pooling
117
+ * offered by this flag.
118
+ *
116
119
  * @default false
117
120
  */
118
121
  keepSessionAlive?: boolean;
119
122
  /**
120
123
  * The number of milliseconds that the client should wait until it sends a keep alive message to the server.
121
- *
124
+ *
122
125
  * If not specified, node-opcua will use a suitable default value.
123
- *
126
+ *
124
127
  * Tips:
125
- *
126
- * - make sure to tune the value appropriately to be lesser than the sessionTimeOut and the tcp.ip socket
127
- * timeout.
128
+ *
129
+ * - make sure to tune the value appropriately to be lesser than the sessionTimeOut and the tcp.ip socket
130
+ * timeout.
128
131
  */
129
132
  keepAliveInterval?: number;
130
133
 
131
134
  /**
132
135
  * The certificate Manager
133
- *
136
+ *
134
137
  * If not specified your Client will create and use a default Certificate manager.
135
- *
138
+ *
136
139
  * You will have pass your own OPCUACertificateManager if you are in one of the following situation:
137
- *
140
+ *
138
141
  * - you want to control the location of your PKI
139
142
  * - you want multiple instances of OPCUAClient to share the same OPCUACertificateManager
140
- *
143
+ *
141
144
  */
142
145
  clientCertificateManager?: OPCUACertificateManager;
143
146
 
144
147
  /**
145
148
  * The client certificate pem file.
146
- *
147
- * Note:
149
+ *
150
+ * Note:
148
151
  * - most of the time, you won't need to overload the certificate PEM fiel
149
152
  * - don't specify the certificateFile if you are using the PushCertificate built-in feature
150
- * provided by NodeOPCUA as it may interfere.
151
- *
153
+ * provided by NodeOPCUA as it may interfere.
154
+ *
152
155
  * @default `${clientCertificateManager/rootFolder}/own/certs/client_certificate.pem"
153
156
  */
154
157
  certificateFile?: string;
155
158
 
156
159
  /**
157
160
  * client private key pem file.
158
- * Note:
161
+ * Note:
159
162
  * - most of the time, you won't need to overload the private key file
160
163
  * - don't specify the privateKeyFile if you are using the PushCertificate built-in feature
161
- * provided by NodeOPCUA as it may interfere.
164
+ * provided by NodeOPCUA as it may interfere.
162
165
  * - ensure that the provided client certificate matches the private pey.
163
- *
166
+ *
164
167
  * @default `${clientCertificateManager/rootFolder}/own/private/private_key.pem"
165
168
  */
166
169
  privateKeyFile?: string;
@@ -174,18 +177,18 @@ export interface OPCUAClientBaseOptions {
174
177
  * discovery url:
175
178
  */
176
179
  discoveryUrl?: string;
177
-
180
+
178
181
  /**
179
- * specify some transport settings that will override
182
+ * specify some transport settings that will override
180
183
  * the default transport settings for the end point.
181
184
  */
182
185
  transportSettings?: TransportSettings;
183
-
186
+
184
187
  /**
185
188
  * transport timeout
186
- *
189
+ *
187
190
  * - the devffault
188
- * @default
191
+ * @default
189
192
  */
190
193
  transportTimeout?: number;
191
194
  /**
@@ -200,7 +203,7 @@ export interface GetEndpointsOptions {
200
203
  profileUris?: string[];
201
204
  }
202
205
 
203
- export interface OPCUAClientBase extends OPCUASecureObject {
206
+ export interface OPCUAClientBase<Events extends OPCUAClientBaseEvents = OPCUAClientBaseEvents> extends OPCUASecureObject<Events> {
204
207
  /**
205
208
  * certificate Manager
206
209
  */
@@ -246,23 +249,21 @@ export interface OPCUAClientBase extends OPCUASecureObject {
246
249
  }
247
250
 
248
251
  // Events -----------------------------------------------------------------------------
249
- export interface OPCUAClientBase extends EventEmitter {
250
- // tslint:disable:unified-signatures
251
-
252
+ export interface OPCUAClientBaseEvents {
252
253
  /**
253
254
  * this Event is raised when the initial connection has succeeded
254
255
  */
255
- on(eventName: "connected", eventHandler: () => void): this;
256
+ connected: [];
256
257
 
257
258
  /**
258
259
  * this Event is raised when the initial connection has failed
259
260
  */
260
- on(eventName: "connection_failed", eventHandler: (err: Error) => void): this;
261
+ connection_failed: [err: Error];
261
262
 
262
263
  /**
263
264
  * this Event is raised when a failing connection is about to be tried again
264
265
  */
265
- on(eventName: "backoff", eventHandler: (count: number, delay: number) => void): this;
266
+ backoff: [count: number, delay: number];
266
267
 
267
268
  /**
268
269
  * this event is raised when the client has encountered a connection failure and
@@ -274,14 +275,14 @@ export interface OPCUAClientBase extends EventEmitter {
274
275
  * You can intercept start_reconnection event to pause your interaction with the remote
275
276
  * OPCUA server.
276
277
  */
277
- on(eventName: "start_reconnection", eventHandler: () => void): this;
278
+ start_reconnection: [err?: Error];
278
279
 
279
280
  /**
280
281
  * this event is raised when the client has failed one attempt to reconnect to the server
281
282
  * This event will be raised if the socket has successfully being created to the server but
282
283
  * if something went wrong during the reconnection process.
283
284
  */
284
- on(eventName: "reconnection_attempt_has_failed", eventHandler: (err: Error, message: string) => void): this;
285
+ reconnection_attempt_has_failed: [err: Error, message: string];
285
286
 
286
287
  /**
287
288
  * this event is raised after the client has successfully managed to re-establish the connection with
@@ -289,63 +290,76 @@ export interface OPCUAClientBase extends EventEmitter {
289
290
  * You can intercept after_reconnection event to resume your interaction with the remote
290
291
  * OPCUA server.
291
292
  */
292
- on(eventName: "after_reconnection", eventHandler: (err?: Error) => void): this;
293
+ after_reconnection: [err?: Error | null];
293
294
 
294
295
  /**
295
296
  * the event is raised when the connection has been aborted by the remote OPCUA Server
296
297
  */
297
- on(eventName: "abort", eventHandler: () => void): this;
298
+ abort: [];
299
+
300
+ reconnection_canceled: [];
301
+
302
+ startingDelayBeforeReconnection: [duration: number];
303
+
304
+ reconnecting: [];
305
+
306
+ repairConnectionStarted: [];
307
+
308
+ keepalive: [];
298
309
 
299
310
  /**
300
311
  * this event is raised when the connection is closed
301
312
  */
302
- on(eventName: "close", eventHandler: () => void): this;
313
+ close: [err?: Error | null];
303
314
 
304
315
  /**
305
316
  * this event is raised when the client is sending a message chunk to the server
306
317
  * (advanced use only)
307
318
  */
308
- on(eventName: "send_chunk", eventHandler: (chunk: Buffer) => void): this;
319
+ send_chunk: [chunk: Buffer];
309
320
 
310
321
  /**
311
322
  * this event is raised when the client has received a new message chunk from the servers
312
323
  * (advanced use only)
313
324
  */
314
- on(eventName: "receive_chunk", eventHandler: (chunk: Buffer) => void): this;
325
+ receive_chunk: [chunk: Buffer];
315
326
 
316
- on(eventName: "send_request", eventHandler: (request: Request) => void): this;
327
+ send_request: [request: Request];
317
328
 
318
- on(eventName: "receive_response", eventHandler: (response: Response) => void): this;
329
+ receive_response: [response: Response];
319
330
 
320
331
  /**
321
332
  * this event is raised when the current security token has reached 75% of its lifetime and is therefore
322
333
  * about to expired.
323
334
  */
324
- on(eventName: "lifetime_75", eventHandler: (token: ChannelSecurityToken) => void): this;
335
+ lifetime_75: [token: ChannelSecurityToken];
325
336
 
326
337
  /**
327
338
  * this event is raised after the (about ) security token as been renewed
328
339
  * and renegotiated with the server.to expire
329
340
  */
330
- on(eventName: "security_token_renewed", eventHandler: (channel: ClientSecureChannelLayer, token: ChannelSecurityToken) => void): this;
341
+ security_token_renewed: [channel: ClientSecureChannelLayer, token: ChannelSecurityToken];
342
+
343
+ /**
344
+ * this event is raised when the secure channel has been created
345
+ */
346
+ secure_channel_created: [secureChannel: ClientSecureChannelLayer];
331
347
 
332
348
  /**
333
349
  * this event is raised when the connection has been broken
334
350
  */
335
- on(eventName: "connection_lost", eventHandler: () => void): this;
351
+ connection_lost: [];
336
352
 
337
353
  /**
338
354
  * this event is raised when a broken connection with the remote Server has been reestablished
339
355
  */
340
- on(eventName: "connection_reestablished", eventHandler: () => void): this;
356
+ connection_reestablished: [];
341
357
 
342
358
  /**
343
359
  * This event is raised when a request sent to the remote OPCUA server has reach it's timeout value without
344
360
  * a Response from the server.
345
361
  */
346
- on(eventName: "timed_out_request", eventHandler: (request: Request) => void): this;
347
-
348
- on(eventName: string | symbol, listener: (...args: any[]) => void): this;
362
+ timed_out_request: [request: Request];
349
363
  }
350
364
 
351
365
  export interface OPCUAClientBase {
@@ -359,7 +373,7 @@ export interface OPCUAClientBase {
359
373
 
360
374
  readonly securityMode: MessageSecurityMode;
361
375
  readonly securityPolicy: SecurityPolicy;
362
- readonly serverCertificate?: Certificate;
376
+ readonly serverCertificate?: Certificate | Certificate[];
363
377
  readonly clientName: string;
364
378
  readonly protocolVersion: 0;
365
379
  readonly defaultSecureTokenLifetime: number;
@@ -370,13 +384,13 @@ export interface OPCUAClientBase {
370
384
  readonly applicationName: string;
371
385
  }
372
386
 
373
- export class OPCUAClientBase {
374
- public static registry = new ObjectRegistry();
375
- public static retryDelay = 1000 * 5;
387
+ export const OPCUAClientBase = {
388
+ registry: new ObjectRegistry(),
389
+ retryDelay: 1000 * 5,
376
390
 
377
- public static create(options: OPCUAClientBaseOptions): OPCUAClientBase {
391
+ create(options: OPCUAClientBaseOptions): OPCUAClientBase {
378
392
  /* c8 ignore next*/
379
393
  options;
380
394
  throw new Error("Not Implemented");
381
395
  }
382
- }
396
+ };
@@ -1,15 +1,14 @@
1
1
  /**
2
2
  * @module node-opcua-client
3
3
  */
4
- import { EventEmitter } from "events";
4
+ import type { EventEmitter } from "events";
5
5
 
6
- import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
7
- import { ReadValueIdOptions } from "node-opcua-service-read";
8
- import { Variant } from "node-opcua-variant";
9
-
10
- import { MonitoringMode, MonitoringParametersOptions } from "node-opcua-types";
11
- import { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
12
- import { ClientSubscription } from "./client_subscription";
6
+ import { type DataValue, TimestampsToReturn } from "node-opcua-data-value";
7
+ import type { ReadValueIdOptions } from "node-opcua-service-read";
8
+ import { MonitoringMode, type MonitoringParametersOptions } from "node-opcua-types";
9
+ import type { Variant } from "node-opcua-variant";
10
+ import type { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
11
+ import type { ClientSubscription } from "./client_subscription";
13
12
 
14
13
  // tslint:disable:unified-signatures
15
14
  export interface ClientMonitoredItem extends ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction, EventEmitter {
@@ -1,26 +1,24 @@
1
1
  /**
2
2
  * @module node-opcua-client
3
3
  */
4
- import { EventEmitter } from "events";
5
-
6
- import { DataValue } from "node-opcua-data-value";
7
- import { ExtensionObject } from "node-opcua-extension-object";
8
- import { TimestampsToReturn } from "node-opcua-service-read";
9
- import {
4
+ import type { EventEmitter } from "events";
5
+ import { type AttributeIds, UInt32 } from "node-opcua-basic-types";
6
+ import type { QualifiedNameLike } from "node-opcua-data-model";
7
+ import type { DataValue } from "node-opcua-data-value";
8
+ import type { ExtensionObject } from "node-opcua-extension-object";
9
+ import type { NodeId } from "node-opcua-nodeid";
10
+ import type { NumericRange } from "node-opcua-numeric-range";
11
+ import type { TimestampsToReturn } from "node-opcua-service-read";
12
+ import type {
10
13
  MonitoredItemCreateResult,
11
14
  MonitoringMode,
12
15
  MonitoringParameters,
13
16
  MonitoringParametersOptions
14
17
  } from "node-opcua-service-subscription";
15
- import { StatusCode } from "node-opcua-status-code";
16
- import { Callback, ErrorCallback } from "node-opcua-status-code";
17
- import { Variant } from "node-opcua-variant";
18
- import { NumericRange } from "node-opcua-numeric-range";
19
- import { QualifiedNameLike } from "node-opcua-data-model";
20
- import { NodeId } from "node-opcua-nodeid";
21
- import { AttributeIds, UInt32 } from "node-opcua-basic-types";
18
+ import type { Callback, ErrorCallback, StatusCode } from "node-opcua-status-code";
19
+ import type { Variant } from "node-opcua-variant";
22
20
 
23
- import { ClientSubscription } from "./client_subscription";
21
+ import type { ClientSubscription } from "./client_subscription";
24
22
 
25
23
  // tslint:disable:unified-signatures
26
24
  export interface ClientMonitoredItemOrGroupAction {
@@ -2,12 +2,12 @@
2
2
  * @module node-opcua-client
3
3
  */
4
4
 
5
- import { EventEmitter } from "events";
6
- import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
7
- import { MonitoringParametersOptions } from "node-opcua-types";
5
+ import type { EventEmitter } from "events";
6
+ import type { DataValue, TimestampsToReturn } from "node-opcua-data-value";
7
+ import type { MonitoringParametersOptions } from "node-opcua-types";
8
8
 
9
- import { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
10
- import { ClientSubscription } from "./client_subscription";
9
+ import type { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
10
+ import type { ClientSubscription } from "./client_subscription";
11
11
 
12
12
  // tslint:disable:unified-signatures
13
13
  export interface ClientMonitoredItemGroup extends EventEmitter, ClientMonitoredItemOrGroupAction {
@@ -4,27 +4,26 @@
4
4
  import chalk from "chalk";
5
5
 
6
6
  import { assert } from "node-opcua-assert";
7
- import { TimestampsToReturn } from "node-opcua-data-value";
7
+ import type { TimestampsToReturn } from "node-opcua-data-value";
8
8
  import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
9
9
  import {
10
10
  CreateMonitoredItemsRequest,
11
- CreateMonitoredItemsResponse,
11
+ type CreateMonitoredItemsResponse,
12
12
  ModifyMonitoredItemsRequest,
13
13
  ModifyMonitoredItemsResponse,
14
14
  MonitoredItemModifyRequest,
15
- MonitoredItemModifyResult,
16
- MonitoringMode,
17
- SetMonitoringModeResponse
15
+ type MonitoredItemModifyResult,
16
+ type MonitoringMode,
17
+ type SetMonitoringModeResponse
18
18
  } from "node-opcua-service-subscription";
19
- import { StatusCode, StatusCodes } from "node-opcua-status-code";
20
- import { Callback, ErrorCallback } from "node-opcua-status-code";
21
-
22
- import { MonitoredItemCreateRequestOptions, MonitoringParametersOptions } from "node-opcua-types";
23
- import { ClientMonitoredItemBase } from "./client_monitored_item_base";
24
- import { SetMonitoringModeRequestLike } from "./client_session";
25
- import { ClientSubscription } from "./client_subscription";
26
- import { ClientMonitoredItemImpl } from "./private/client_monitored_item_impl";
27
- import { ClientSessionImpl } from "./private/client_session_impl";
19
+ import { type Callback, type ErrorCallback, type StatusCode, StatusCodes } from "node-opcua-status-code";
20
+
21
+ import type { MonitoredItemCreateRequestOptions, MonitoringParametersOptions } from "node-opcua-types";
22
+ import type { ClientMonitoredItemBase } from "./client_monitored_item_base";
23
+ import type { SetMonitoringModeRequestLike } from "./client_session";
24
+ import type { ClientSubscription } from "./client_subscription";
25
+ import type { ClientMonitoredItemImpl } from "./private/client_monitored_item_impl";
26
+ import type { ClientSessionImpl } from "./private/client_session_impl";
28
27
 
29
28
  const debugLog = make_debugLog(__filename);
30
29
  const doDebug = checkDebugFlag(__filename);
@@ -2,30 +2,35 @@
2
2
  * @module node-opcua-client
3
3
  */
4
4
 
5
- import { EventEmitter } from "events";
6
-
7
- import { DateTime, UInt8 } from "node-opcua-basic-types";
8
- import { ServerState } from "node-opcua-common";
9
- import { Certificate } from "node-opcua-crypto/web";
10
- import { LocalizedTextLike } from "node-opcua-data-model";
11
- import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
12
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
5
+ import type { EventEmitter } from "events";
6
+
7
+ import type { DateTime, UInt8 } from "node-opcua-basic-types";
8
+ import type { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
9
+ import type { ServerState } from "node-opcua-common";
10
+ import type { AggregateFunction } from "node-opcua-constants";
11
+ import type { Certificate } from "node-opcua-crypto/web";
12
+ import type { LocalizedTextLike } from "node-opcua-data-model";
13
+ import type { DataValue, TimestampsToReturn } from "node-opcua-data-value";
14
+ import type { ExtensionObject } from "node-opcua-extension-object";
15
+ import type { NodeId, NodeIdLike } from "node-opcua-nodeid";
13
16
  import {
17
+ type ArgumentDefinition,
14
18
  CallMethodRequestLike,
15
- IBasicSession,
16
- IBasicSessionBrowse,
17
- IBasicSessionBrowseNext,
18
- IBasicSessionCall,
19
- IBasicSessionRead,
20
- IBasicSessionTranslateBrowsePath,
21
- IBasicSessionWrite,
22
- ResponseCallback
19
+ type IBasicSession,
20
+ type IBasicSessionBrowse,
21
+ type IBasicSessionBrowseNext,
22
+ type IBasicSessionCall,
23
+ type IBasicSessionChangeUser,
24
+ type IBasicSessionRead,
25
+ type IBasicSessionTranslateBrowsePath,
26
+ type IBasicSessionWrite,
27
+ type MethodId,
28
+ type ResponseCallback
23
29
  } from "node-opcua-pseudo-session";
24
- import { ErrorCallback } from "node-opcua-status-code";
25
- import { EndpointDescription } from "node-opcua-service-endpoints";
26
- import { HistoryReadResult } from "node-opcua-service-history";
27
- import { QueryFirstRequestOptions, QueryFirstResponse } from "node-opcua-service-query";
28
- import {
30
+ import type { EndpointDescription } from "node-opcua-service-endpoints";
31
+ import type { HistoryReadResult } from "node-opcua-service-history";
32
+ import type { QueryFirstRequestOptions, QueryFirstResponse } from "node-opcua-service-query";
33
+ import type {
29
34
  CreateMonitoredItemsRequestOptions,
30
35
  CreateMonitoredItemsResponse,
31
36
  CreateSubscriptionRequestOptions,
@@ -44,35 +49,29 @@ import {
44
49
  RepublishResponse,
45
50
  SetMonitoringModeRequestOptions,
46
51
  SetMonitoringModeResponse,
47
- TransferSubscriptionsRequestOptions,
48
- TransferSubscriptionsResponse,
52
+ SetTriggeringRequestOptions,
49
53
  SetTriggeringResponse,
50
- SetTriggeringRequestOptions
54
+ TransferSubscriptionsRequestOptions,
55
+ TransferSubscriptionsResponse
51
56
  } from "node-opcua-service-subscription";
52
- import { StatusCode } from "node-opcua-status-code";
53
- import { DataType, Variant } from "node-opcua-variant";
54
- import { Callback } from "node-opcua-status-code";
55
- import { IBasicSessionChangeUser } from "node-opcua-pseudo-session";
56
- import { ExtensionObject } from "node-opcua-extension-object";
57
- import { ArgumentDefinition, MethodId } from "node-opcua-pseudo-session";
58
- import { AggregateFunction } from "node-opcua-constants";
57
+ import type { Callback, ErrorCallback, StatusCode } from "node-opcua-status-code";
59
58
  import {
60
- AggregateConfigurationOptions,
59
+ type AggregateConfigurationOptions,
61
60
  CallMethodResult,
62
- HistoryReadRequest,
63
- HistoryReadResponse,
64
- HistoryReadValueIdOptions,
61
+ type HistoryReadRequest,
62
+ type HistoryReadResponse,
63
+ type HistoryReadValueIdOptions,
65
64
  ReadValueId,
66
- ReadValueIdOptions
65
+ type ReadValueIdOptions
67
66
  } from "node-opcua-types";
67
+ import type { DataType, Variant } from "node-opcua-variant";
68
68
 
69
- import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
70
69
  export { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
71
70
 
72
71
  export { ExtensionObject } from "node-opcua-extension-object";
73
72
  export { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
74
73
 
75
- import { ClientSubscription } from "./client_subscription";
74
+ import type { ClientSubscription } from "./client_subscription";
76
75
 
77
76
  export interface MonitoredItemData {
78
77
  clientHandles: Uint32Array;
@@ -177,8 +176,6 @@ export interface ClientSessionQueryService {
177
176
 
178
177
  // call services
179
178
  export interface ClientSessionCallService extends IBasicSessionCall {
180
-
181
-
182
179
  getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>;
183
180
  getArgumentDefinition(methodId: MethodId, callback: (err: Error | null, args?: ArgumentDefinition) => void): void;
184
181
  }
@@ -1,18 +1,19 @@
1
1
  /**
2
2
  * @module node-opcua-client
3
3
  */
4
- import { EventEmitter } from "events";
4
+
5
5
  import chalk from "chalk";
6
+ import { EventEmitter } from "events";
6
7
  import { assert } from "node-opcua-assert";
8
+ import { AttributeIds } from "node-opcua-basic-types";
7
9
  import { ServerState } from "node-opcua-common";
8
10
  import { VariableIds } from "node-opcua-constants";
9
- import { DataValue } from "node-opcua-data-value";
10
- import { AttributeIds } from "node-opcua-basic-types";
11
+ import type { DataValue } from "node-opcua-data-value";
11
12
  import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
12
13
  import { coerceNodeId } from "node-opcua-nodeid";
13
14
  import { ClientSecureChannelLayer } from "node-opcua-secure-channel";
14
- import { ClientSessionImpl } from "./private/client_session_impl";
15
- import { IClientBase } from "./private/i_private_client";
15
+ import type { ClientSessionImpl } from "./private/client_session_impl";
16
+ import type { IClientBase } from "./private/i_private_client";
16
17
 
17
18
  const serverStatusStateNodeId = coerceNodeId(VariableIds.Server_ServerStatus_State);
18
19
 
@@ -166,13 +167,11 @@ export class ClientSessionKeepAliveManager extends EventEmitter implements Clien
166
167
  */
167
168
  this.emit("failure");
168
169
 
169
-
170
- // also simulate a connection by closing the channel abruptly from our end ...
170
+ // also simulate a connection by closing the channel abruptly from our end ...
171
171
  warningLog("Keep alive has failed, considering a network outage is in place, forcing a reconnection");
172
172
 
173
173
  terminateConnection(session._client);
174
174
 
175
-
176
175
  resolve(0);
177
176
  return;
178
177
  }
@@ -200,7 +199,6 @@ export class ClientSessionKeepAliveManager extends EventEmitter implements Clien
200
199
  }
201
200
  }
202
201
 
203
-
204
202
  function terminateConnection(client: IClientBase | null) {
205
203
  if (!client) return;
206
204
 
@@ -209,5 +207,4 @@ function terminateConnection(client: IClientBase | null) {
209
207
  return;
210
208
  }
211
209
  channel.forceConnectionBreak();
212
-
213
210
  }