node-opcua-client 2.72.2 → 2.74.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 CHANGED
@@ -1,6 +1,8 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2021 Etienne Rossignon
3
+ Copyright (c) 2022 Sterfive SAS - 833264583 RCS ORLEANS - France (https://www.sterfive.com)
4
+
5
+ Copyright (c) 2014-2022 Etienne Rossignon
4
6
 
5
7
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
8
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -6,3 +6,57 @@ an implementation of a OPC UA stack fully written in javascript and nodejs
6
6
 
7
7
  see http://node-opcua.github.io/
8
8
 
9
+
10
+ # Documentation
11
+
12
+ "NodeOPCUA by Example" (https://leanpub.com/node-opcuabyexample) provides a good starting point to understand and start using node-opcua.
13
+
14
+ More advanced interactive material & documentation is made available online for Registered members of the NodeOPCUA Subscription. Please visit https://support.sterfive.com to apply or contact Sterfive.
15
+
16
+
17
+ ## Sponsors & Backers
18
+
19
+ We appreciate that, once you have evaluated the software you consider supporting our effort by applying to our sponsor program:
20
+
21
+ - https://github.com/sponsors/node-opcua
22
+ - https://opencollective.com/node-opcua
23
+
24
+ Grants ensure the following:
25
+
26
+ - 🔨 Long term maintenance of the project
27
+ - ⚙️ maintain the website and continuous integration platform
28
+ - 🛣 Progress on the road-map
29
+ - 🐛 Quick responses to bug reports
30
+ - 🚀 New features & enhancements
31
+ - ⚖️ representing the node-opcua user community at the OPC Foundation
32
+
33
+ # Support
34
+
35
+ Technical Support is exclusively provided to registered members of the NodeOPCUA Subscription (https://support.sterfive.com) or through dedicated Professional Services.
36
+
37
+ # License
38
+
39
+ Node-OPCUA is made available to you under the MIT open source license.
40
+
41
+ See [LICENSE](./LICENSE) for details.
42
+
43
+
44
+ # value-added extensions
45
+
46
+ Contact Sterfive SAS (mailto:contact@sterfive.com) for additional companion modules that are available to registered members:
47
+
48
+ - node-opcua-pub-sub : Part 14 implementation to develop OPC UA PubSub over MQTT applications
49
+ - node-opcua-webproxy: to operate node-opcua from within a web browser
50
+ - node-opcua-optimized-client: super-charge OPC UA Client
51
+ - react-components: a collection of React UI components
52
+ - aggregator: a powerful OPC UA aggregator that can combine and monitored hundred of servers and millions of variables.
53
+ - node-opcua-gds: a Global Discovery Server (Part 12)
54
+ - node-opcua-modeler-ex: a powerful NO-GUI OPC UA modeler
55
+
56
+
57
+ # Copyright
58
+
59
+ Copyright (c) 2022 Sterfive SAS
60
+
61
+ Copyright (c) 2014-2022 Etienne Rossignon
62
+
@@ -36,17 +36,8 @@ export interface FindEndpointResult {
36
36
  export declare type FindEndpointCallback = (err: Error | null, result?: FindEndpointResult) => void;
37
37
  export interface TransportSettings {
38
38
  maxChunkCount?: number;
39
- /**
40
- * @advanced
41
- */
42
39
  maxMessageSize?: number;
43
- /**
44
- * @advanced
45
- */
46
40
  sendBufferSize?: number;
47
- /**
48
- * @advanced
49
- */
50
41
  receiveBufferSize?: number;
51
42
  }
52
43
  export interface OPCUAClientBaseOptions {
@@ -161,111 +152,102 @@ export interface OPCUAClientBase extends OPCUASecureObject {
161
152
  export interface OPCUAClientBase extends EventEmitter {
162
153
  /**
163
154
  * this Event is raised when the initial connection has succeeded
164
- * @param event
165
- * @param eventHandler
166
155
  */
167
- on(event: "connected", eventHandler: () => void): this;
156
+ on(eventName: "connected", eventHandler: () => void): this;
168
157
  /**
169
158
  * this Event is raised when the initial connection has failed
170
- * @param event
171
- * @param eventHandler
172
159
  */
173
- on(event: "connection_failed", eventHandler: (err: Error) => void): this;
160
+ on(eventName: "connection_failed", eventHandler: (err: Error) => void): this;
174
161
  /**
175
162
  * this Event is raised when a failing connection is about to be tried again
176
- * @param event
177
- * @param eventHandler
178
163
  */
179
- on(event: "backoff", eventHandler: (count: number, delay: number) => void): this;
164
+ on(eventName: "backoff", eventHandler: (count: number, delay: number) => void): this;
180
165
  /**
181
166
  * this event is raised when the client has encountered a connection failure and
182
167
  * and is going to reconnection mode.
168
+ *
169
+ * It notifies the observer that the OPCUA is now trying to reestablish the connection
170
+ * after having received a connection break...
171
+ *
183
172
  * You can intercept start_reconnection event to pause your interaction with the remote
184
173
  * OPCUA server.
185
- * @param event
186
- * @param eventHandler
187
174
  */
188
- on(event: "start_reconnection", eventHandler: () => void): this;
175
+ on(eventName: "start_reconnection", eventHandler: () => void): this;
189
176
  /**
190
177
  * this event is raised when the client has failed one attempt to reconnect to the server
191
178
  * This event will be raised if the socket has successfully being created to the server but
192
179
  * if something went wrong during the reconnection process.
193
- * @param event
194
- * @param eventHandler
195
180
  */
196
- on(event: "reconnection_attempt_has_failed", eventHandler: (err: Error, message: string) => void): this;
181
+ on(eventName: "reconnection_attempt_has_failed", eventHandler: (err: Error, message: string) => void): this;
197
182
  /**
198
183
  * this event is raised after the client has successfully managed to re-establish the connection with
199
184
  * the remote OPCUA Server.
200
185
  * You can intercept after_reconnection event to resume your interaction with the remote
201
186
  * OPCUA server.
202
- *
203
- * @param event
204
- * @param eventHandler
205
187
  */
206
- on(event: "after_reconnection", eventHandler: (err?: Error) => void): this;
188
+ on(eventName: "after_reconnection", eventHandler: (err?: Error) => void): this;
207
189
  /**
208
190
  * the event is raised when the connection has been aborted by the remote OPCUA Server
209
191
  * @param event
210
192
  * @param eventHandler
211
193
  */
212
- on(event: "abort", eventHandler: () => void): this;
194
+ on(eventName: "abort", eventHandler: () => void): this;
213
195
  /**
214
196
  * this event is raised when the connection is closed
215
197
  * @param event
216
198
  * @param eventHandler
217
199
  */
218
- on(event: "close", eventHandler: () => void): this;
200
+ on(eventName: "close", eventHandler: () => void): this;
219
201
  /**
220
202
  * this event is raised when the client is sending a message chunk to the server
221
203
  * (advanced use only)
222
204
  * @param event
223
205
  * @param eventHandler
224
206
  */
225
- on(event: "send_chunk", eventHandler: (chunk: Buffer) => void): this;
207
+ on(eventName: "send_chunk", eventHandler: (chunk: Buffer) => void): this;
226
208
  /**
227
209
  * this event is raised when the client has received a new message chunk from the servers
228
210
  * (advanced use only)
229
211
  * @param event
230
212
  * @param eventHandler
231
213
  */
232
- on(event: "receive_chunk", eventHandler: (chunk: Buffer) => void): this;
233
- on(event: "send_request", eventHandler: (request: Request) => void): this;
234
- on(event: "receive_response", eventHandler: (response: Response) => void): this;
214
+ on(eventName: "receive_chunk", eventHandler: (chunk: Buffer) => void): this;
215
+ on(eventName: "send_request", eventHandler: (request: Request) => void): this;
216
+ on(eventName: "receive_response", eventHandler: (response: Response) => void): this;
235
217
  /**
236
218
  * this event is raised when the current security token has reached 75% of its lifetime and is therefore
237
219
  * about to expired.
238
220
  * @param event
239
221
  * @param eventHandler
240
222
  */
241
- on(event: "lifetime_75", eventHandler: (token: ChannelSecurityToken) => void): this;
223
+ on(eventName: "lifetime_75", eventHandler: (token: ChannelSecurityToken) => void): this;
242
224
  /**
243
225
  * this event is raised after the (about ) security token as been renewed
244
226
  * and renegotiated with the server.to expire
245
227
  * @param event
246
228
  * @param eventHandler
247
229
  */
248
- on(event: "security_token_renewed", eventHandler: () => void): this;
230
+ on(eventName: "security_token_renewed", eventHandler: () => void): this;
249
231
  /**
250
232
  * this event is raised when the connection has been broken
251
233
  * @param event
252
234
  * @param eventHandler
253
235
  */
254
- on(event: "connection_lost", eventHandler: () => void): this;
236
+ on(eventName: "connection_lost", eventHandler: () => void): this;
255
237
  /**
256
238
  * this event is raised when a broken connection with the remote Server has been reestablished
257
239
  * @param event
258
240
  * @param eventHandler
259
241
  */
260
- on(event: "connection_reestablished", eventHandler: () => void): this;
242
+ on(eventName: "connection_reestablished", eventHandler: () => void): this;
261
243
  /**
262
244
  * This event is raised when a request sent to the remote OPCUA server has reach it's timeout value without
263
245
  * a Response from the server.
264
246
  * @param event
265
247
  * @param eventHandler
266
248
  */
267
- on(event: "timed_out_request", eventHandler: (request: Request) => void): this;
268
- on(event: string | symbol, listener: (...args: any[]) => void): this;
249
+ on(eventName: "timed_out_request", eventHandler: (request: Request) => void): this;
250
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
269
251
  }
270
252
  export interface OPCUAClientBase {
271
253
  readonly endpoint?: EndpointDescription;
@@ -290,5 +272,6 @@ export interface OPCUAClientBase {
290
272
  }
291
273
  export declare class OPCUAClientBase {
292
274
  static registry: ObjectRegistry;
275
+ static retryDelay: number;
293
276
  static create(options: OPCUAClientBaseOptions): OPCUAClientBase;
294
277
  }
@@ -11,4 +11,5 @@ class OPCUAClientBase {
11
11
  }
12
12
  exports.OPCUAClientBase = OPCUAClientBase;
13
13
  OPCUAClientBase.registry = new node_opcua_object_registry_1.ObjectRegistry();
14
+ OPCUAClientBase.retryDelay = 1000 * 5;
14
15
  //# sourceMappingURL=client_base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client_base.js","sourceRoot":"","sources":["../source/client_base.ts"],"names":[],"mappings":";;;AASA,2EAA4D;AAoV5D,MAAa,eAAe;IAGjB,MAAM,CAAC,MAAM,CAAC,OAA+B;QAChD,yBAAyB;QACzB,OAAO,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;;AAPL,0CAQC;AAPiB,wBAAQ,GAAG,IAAI,2CAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"client_base.js","sourceRoot":"","sources":["../source/client_base.ts"],"names":[],"mappings":";;;AASA,2EAA4D;AAkU5D,MAAa,eAAe;IAIjB,MAAM,CAAC,MAAM,CAAC,OAA+B;QAChD,yBAAyB;QACzB,OAAO,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;;AARL,0CASC;AARiB,wBAAQ,GAAG,IAAI,2CAAc,EAAE,CAAC;AAChC,0BAAU,GAAG,IAAI,GAAG,CAAC,CAAC"}
@@ -24,11 +24,11 @@ import { WriteValueOptions } from "node-opcua-service-write";
24
24
  import { StatusCode } from "node-opcua-status-code";
25
25
  import { DataType, Variant } from "node-opcua-variant";
26
26
  import { Callback } from "node-opcua-status-code";
27
- import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
28
27
  import { ExtensionObject } from "node-opcua-extension-object";
29
28
  import { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
30
29
  import { AggregateFunction } from "node-opcua-constants";
31
30
  import { HistoryReadRequest, HistoryReadResponse, HistoryReadValueIdOptions } from "node-opcua-types";
31
+ import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
32
32
  export { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
33
33
  export { ExtensionObject } from "node-opcua-extension-object";
34
34
  export { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
@@ -374,7 +374,7 @@ export interface ClientSessionNamespaceService {
374
374
  readNamespaceArray(callback: (err: Error | null, namespaceArray?: string[]) => void): void;
375
375
  }
376
376
  export interface ClientSessionExtensionObjectService {
377
- constructExtensionObject(dataType: NodeId, pojo: any): Promise<ExtensionObject>;
377
+ constructExtensionObject(dataType: NodeId, pojo: Record<string, unknown>): Promise<ExtensionObject>;
378
378
  /**
379
379
  * @private
380
380
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client_session.js","sourceRoot":"","sources":["../source/client_session.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA6DH,yGAAkF;AAAzE,kJAAA,oBAAoB,OAAA;AAC7B,2EAA8D;AAArD,8HAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"client_session.js","sourceRoot":"","sources":["../source/client_session.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA8DH,yGAAkF;AAAzE,kJAAA,oBAAoB,OAAA;AAE7B,2EAA8D;AAArD,8HAAA,eAAe,OAAA"}
@@ -11,51 +11,37 @@ import { Request, Response } from "../common";
11
11
  import { CreateSecureChannelCallbackFunc, FindServersOnNetworkRequestLike, FindServersRequestLike, GetEndpointsOptions, OPCUAClientBase, OPCUAClientBaseOptions } from "../client_base";
12
12
  import { ClientSessionImpl } from "./client_session_impl";
13
13
  import { IClientBase } from "./i_private_client";
14
- declare type InternalClientState = "uninitialized" | "disconnected" | "connecting" | "connected" | "reconnecting" | "disconnecting";
14
+ declare type InternalClientState = "uninitialized" | "disconnected" | "connecting" | "connected" | "reconnecting" | "reconnecting_newchannel_connected" | "disconnecting";
15
15
  /**
16
16
  * @internal
17
17
  */
18
18
  export declare class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase, IClientBase {
19
19
  /**
20
20
  * total number of requests that been canceled due to timeout
21
- * @property timedOutRequestCount
22
- * @type {Number}
23
21
  */
24
22
  get timedOutRequestCount(): number;
25
23
  /**
26
24
  * total number of transactions performed by the client
27
- * @property transactionsPerformed
28
- * @type {Number}
29
- */
25
+ x */
30
26
  get transactionsPerformed(): number;
31
27
  /**
32
28
  * is true when the client has already requested the server end points.
33
- * @property knowsServerEndpoint
34
- * @type boolean
35
29
  */
36
30
  get knowsServerEndpoint(): boolean;
37
31
  /**
38
32
  * true if the client is trying to reconnect to the server after a connection break.
39
- * @property isReconnecting
40
- * @type {Boolean}
41
33
  */
42
34
  get isReconnecting(): boolean;
43
35
  /**
44
36
  * true if the connection strategy is set to automatically try to reconnect in case of failure
45
- * @property reconnectOnFailure
46
- * @type {Boolean}
47
37
  */
48
38
  get reconnectOnFailure(): boolean;
49
39
  /**
50
40
  * total number of bytes read by the client
51
- * @property bytesRead
52
- * @type {Number}
53
41
  */
54
42
  get bytesRead(): number;
55
43
  /**
56
44
  * total number of bytes written by the client
57
- * @property bytesWritten
58
- * @type {Number}
59
45
  */
60
46
  get bytesWritten(): number;
61
47
  securityMode: MessageSecurityMode;
@@ -83,10 +69,11 @@ export declare class ClientBaseImpl extends OPCUASecureObject implements OPCUACl
83
69
  private _byteWritten;
84
70
  private _timedOutRequestCount;
85
71
  private _transactionsPerformed;
86
- private reconnectionIsCanceled;
72
+ private _reconnectionIsCanceled;
87
73
  private _clockAdjuster?;
88
74
  private _tmpClient?;
89
75
  private _instanceNumber;
76
+ private _transportSettings;
90
77
  clientCertificateManager: OPCUACertificateManager;
91
78
  protected _setInternalState(internalState: InternalClientState): void;
92
79
  emit(eventName: string | symbol, ...others: any[]): boolean;
@@ -156,6 +143,7 @@ export declare class ClientBaseImpl extends OPCUASecureObject implements OPCUACl
156
143
  private _destroy_secure_channel;
157
144
  private _close_pending_sessions;
158
145
  private _install_secure_channel_event_handlers;
146
+ _inside_repairConnection: boolean;
159
147
  private _repairConnection;
160
148
  private _finalReconnectionStep;
161
149
  /**