node-opcua-client 2.97.0 → 2.98.1
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.d.ts +49 -49
- package/dist/alarms_and_conditions/client_alarm.js +109 -109
- package/dist/alarms_and_conditions/client_alarm_list.d.ts +25 -25
- package/dist/alarms_and_conditions/client_alarm_list.js +97 -97
- package/dist/alarms_and_conditions/client_alarm_tools.d.ts +4 -4
- package/dist/alarms_and_conditions/client_alarm_tools.js +156 -156
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.d.ts +18 -18
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +192 -192
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.d.ts +9 -9
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +72 -72
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.d.ts +3 -3
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +118 -118
- package/dist/alarms_and_conditions/client_tools.d.ts +7 -7
- package/dist/alarms_and_conditions/client_tools.js +179 -179
- package/dist/client_base.d.ts +277 -277
- package/dist/client_base.js +14 -14
- package/dist/client_base.js.map +1 -1
- package/dist/client_monitored_item.d.ts +21 -21
- package/dist/client_monitored_item.js +11 -11
- package/dist/client_monitored_item_base.d.ts +39 -39
- package/dist/client_monitored_item_base.js +2 -2
- package/dist/client_monitored_item_group.d.ts +21 -21
- package/dist/client_monitored_item_group.js +13 -13
- package/dist/client_monitored_item_toolbox.d.ts +15 -15
- package/dist/client_monitored_item_toolbox.js +116 -116
- package/dist/client_session.d.ts +529 -529
- package/dist/client_session.js +10 -10
- package/dist/client_session_keepalive_manager.d.ts +34 -34
- package/dist/client_session_keepalive_manager.js +149 -149
- package/dist/client_subscription.d.ts +241 -241
- package/dist/client_subscription.js +14 -14
- package/dist/client_subscription.js.map +1 -1
- package/dist/client_utils.d.ts +22 -22
- package/dist/client_utils.js +87 -87
- package/dist/common.d.ts +17 -17
- package/dist/common.js +5 -5
- package/dist/index.d.ts +56 -56
- package/dist/index.js +94 -94
- package/dist/opcua_client.d.ts +118 -118
- package/dist/opcua_client.js +33 -33
- package/dist/private/client_base_impl.d.ts +160 -160
- package/dist/private/client_base_impl.js +1348 -1348
- package/dist/private/client_monitored_item_base_impl.d.ts +3 -3
- package/dist/private/client_monitored_item_base_impl.js +4 -4
- package/dist/private/client_monitored_item_group_impl.d.ts +53 -53
- package/dist/private/client_monitored_item_group_impl.js +159 -159
- package/dist/private/client_monitored_item_impl.d.ts +93 -93
- package/dist/private/client_monitored_item_impl.js +304 -304
- package/dist/private/client_publish_engine.d.ts +62 -62
- package/dist/private/client_publish_engine.js +408 -408
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +631 -631
- package/dist/private/client_session_impl.js +1348 -1348
- package/dist/private/client_subscription_impl.d.ts +93 -93
- package/dist/private/client_subscription_impl.js +763 -763
- package/dist/private/i_private_client.d.ts +21 -21
- package/dist/private/i_private_client.js +2 -2
- package/dist/private/opcua_client_impl.d.ts +166 -166
- package/dist/private/opcua_client_impl.js +1000 -1000
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/performance.d.ts +1 -1
- package/dist/private/performance.js +18 -18
- package/dist/reconnection.d.ts +9 -9
- package/dist/reconnection.js +381 -381
- package/dist/tools/findservers.d.ts +20 -20
- package/dist/tools/findservers.js +61 -61
- package/dist/tools/read_history_server_capabilities.d.ts +6 -6
- package/dist/tools/read_history_server_capabilities.js +98 -98
- package/dist/user_identity_info.d.ts +1 -1
- package/dist/user_identity_info.js +2 -2
- package/dist/verify.d.ts +5 -5
- package/dist/verify.js +134 -134
- package/package.json +49 -45
- package/source/alarms_and_conditions/client_alarm_tools_dump_event.ts +1 -1
- package/.nycrc.json +0 -14
- package/test_helpers/create_certificates.js +0 -1
- package/typedoc.js +0 -20
package/dist/client_base.d.ts
CHANGED
|
@@ -1,277 +1,277 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/**
|
|
4
|
-
* @module node-opcua-client
|
|
5
|
-
*/
|
|
6
|
-
import { EventEmitter } from "events";
|
|
7
|
-
import { LocaleId } from "node-opcua-basic-types";
|
|
8
|
-
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
9
|
-
import { OPCUASecureObject } from "node-opcua-common";
|
|
10
|
-
import { Certificate } from "node-opcua-crypto";
|
|
11
|
-
import { ObjectRegistry } from "node-opcua-object-registry";
|
|
12
|
-
import { ClientSecureChannelLayer, ConnectionStrategy, ConnectionStrategyOptions, SecurityPolicy } from "node-opcua-secure-channel";
|
|
13
|
-
import { FindServersOnNetworkRequestOptions, FindServersRequestOptions, ServerOnNetwork } from "node-opcua-service-discovery";
|
|
14
|
-
import { ApplicationDescription, EndpointDescription } from "node-opcua-service-endpoints";
|
|
15
|
-
import { ChannelSecurityToken, MessageSecurityMode } from "node-opcua-service-secure-channel";
|
|
16
|
-
import { ErrorCallback } from "node-opcua-status-code";
|
|
17
|
-
import { ResponseCallback } from "./client_session";
|
|
18
|
-
import { Request, Response } from "./common";
|
|
19
|
-
export type FindServersRequestLike = FindServersRequestOptions;
|
|
20
|
-
export type FindServersOnNetworkRequestLike = FindServersOnNetworkRequestOptions;
|
|
21
|
-
export type CreateSecureChannelCallbackFunc = (err: Error | null, secureChannel?: ClientSecureChannelLayer) => void;
|
|
22
|
-
export interface FindEndpointOptions {
|
|
23
|
-
securityMode: MessageSecurityMode;
|
|
24
|
-
securityPolicy: SecurityPolicy;
|
|
25
|
-
connectionStrategy: ConnectionStrategyOptions;
|
|
26
|
-
certificateFile: string;
|
|
27
|
-
privateKeyFile: string;
|
|
28
|
-
applicationName: string;
|
|
29
|
-
applicationUri: string;
|
|
30
|
-
clientCertificateManager: OPCUACertificateManager;
|
|
31
|
-
}
|
|
32
|
-
export interface FindEndpointResult {
|
|
33
|
-
selectedEndpoint: EndpointDescription;
|
|
34
|
-
endpoints: EndpointDescription[];
|
|
35
|
-
}
|
|
36
|
-
export type FindEndpointCallback = (err: Error | null, result?: FindEndpointResult) => void;
|
|
37
|
-
export interface TransportSettings {
|
|
38
|
-
maxChunkCount?: number;
|
|
39
|
-
maxMessageSize?: number;
|
|
40
|
-
sendBufferSize?: number;
|
|
41
|
-
receiveBufferSize?: number;
|
|
42
|
-
}
|
|
43
|
-
export interface OPCUAClientBaseOptions {
|
|
44
|
-
/**
|
|
45
|
-
* the client application name
|
|
46
|
-
* @default "NodeOPCUA-Client"
|
|
47
|
-
*/
|
|
48
|
-
applicationName?: string;
|
|
49
|
-
/**
|
|
50
|
-
* the application Uri
|
|
51
|
-
* @default: `urn:${hostname}:${applicationName}`
|
|
52
|
-
*/
|
|
53
|
-
applicationUri?: string;
|
|
54
|
-
connectionStrategy?: ConnectionStrategyOptions;
|
|
55
|
-
/**
|
|
56
|
-
* if not specify or set to 0 , token renewal will happen
|
|
57
|
-
* around 75% of the defaultSecureTokenLifetime
|
|
58
|
-
*/
|
|
59
|
-
tokenRenewalInterval?: number;
|
|
60
|
-
/**
|
|
61
|
-
* if set to true, pending session will not be automatically closed when disconnect is called
|
|
62
|
-
*/
|
|
63
|
-
keepPendingSessionsOnDisconnect?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* the server certificate.
|
|
66
|
-
*/
|
|
67
|
-
serverCertificate?: Certificate;
|
|
68
|
-
/**
|
|
69
|
-
* default secure token lifetime in ms
|
|
70
|
-
*/
|
|
71
|
-
defaultSecureTokenLifetime?: number;
|
|
72
|
-
/**
|
|
73
|
-
* the security mode
|
|
74
|
-
* @default MessageSecurityMode.None
|
|
75
|
-
*/
|
|
76
|
-
securityMode?: MessageSecurityMode | string;
|
|
77
|
-
/**
|
|
78
|
-
* the security policy
|
|
79
|
-
* @default SecurityPolicy.None
|
|
80
|
-
*/
|
|
81
|
-
securityPolicy?: SecurityPolicy | string;
|
|
82
|
-
/**
|
|
83
|
-
* can be set when the client doesn't create subscription. In this case,
|
|
84
|
-
* the client will send a dummy request on a regular basis to keep the
|
|
85
|
-
* connection active.
|
|
86
|
-
* @default false
|
|
87
|
-
*/
|
|
88
|
-
keepSessionAlive?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* certificate Manager
|
|
91
|
-
*/
|
|
92
|
-
clientCertificateManager?: OPCUACertificateManager;
|
|
93
|
-
/**
|
|
94
|
-
* client certificate pem file.
|
|
95
|
-
* @default `${clientCertificateManager/rootFolder}/own/certs/client_certificate.pem"
|
|
96
|
-
*/
|
|
97
|
-
certificateFile?: string;
|
|
98
|
-
/**
|
|
99
|
-
* client private key pem file.
|
|
100
|
-
* @default `${clientCertificateManager/rootFolder}/own/private/private_key.pem"
|
|
101
|
-
*/
|
|
102
|
-
privateKeyFile?: string;
|
|
103
|
-
/**
|
|
104
|
-
* a client name string that will be used to generate session names.
|
|
105
|
-
*/
|
|
106
|
-
clientName?: string;
|
|
107
|
-
/**
|
|
108
|
-
* discovery url:
|
|
109
|
-
*/
|
|
110
|
-
discoveryUrl?: string;
|
|
111
|
-
/**
|
|
112
|
-
* @advanced
|
|
113
|
-
*/
|
|
114
|
-
transportSettings?: TransportSettings;
|
|
115
|
-
}
|
|
116
|
-
export interface GetEndpointsOptions {
|
|
117
|
-
endpointUrl?: string;
|
|
118
|
-
localeIds?: LocaleId[];
|
|
119
|
-
profileUris?: string[];
|
|
120
|
-
}
|
|
121
|
-
export interface OPCUAClientBase extends OPCUASecureObject {
|
|
122
|
-
/**
|
|
123
|
-
* certificate Manager
|
|
124
|
-
*/
|
|
125
|
-
readonly clientCertificateManager: OPCUACertificateManager;
|
|
126
|
-
/***
|
|
127
|
-
*
|
|
128
|
-
* @param endpointUrl the endpoint of the server to connect to ( i.e "opc.tcp://machine.name:3434/name" )
|
|
129
|
-
*/
|
|
130
|
-
connect(endpointUrl: string): Promise<void>;
|
|
131
|
-
connect(endpointUrl: string, callback: ErrorCallback): void;
|
|
132
|
-
/***
|
|
133
|
-
* causes the client to close and disconnect the communication with server
|
|
134
|
-
*
|
|
135
|
-
* ### note
|
|
136
|
-
* > once the client has disconnected, it cannot reconnect to the server
|
|
137
|
-
* you'll need to recreate a new Client object to reconnect to the server.
|
|
138
|
-
*/
|
|
139
|
-
disconnect(): Promise<void>;
|
|
140
|
-
disconnect(callback: ErrorCallback): void;
|
|
141
|
-
findEndpointForSecurity(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy): EndpointDescription | undefined;
|
|
142
|
-
getEndpoints(options?: GetEndpointsOptions): Promise<EndpointDescription[]>;
|
|
143
|
-
getEndpoints(options: GetEndpointsOptions, callback: ResponseCallback<EndpointDescription[]>): void;
|
|
144
|
-
getEndpoints(callback: ResponseCallback<EndpointDescription[]>): void;
|
|
145
|
-
findServers(options?: FindServersRequestLike): Promise<ApplicationDescription[]>;
|
|
146
|
-
findServers(options: FindServersRequestLike, callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
147
|
-
findServers(callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
148
|
-
findServersOnNetwork(options?: FindServersOnNetworkRequestLike): Promise<ServerOnNetwork[]>;
|
|
149
|
-
findServersOnNetwork(callback: ResponseCallback<ServerOnNetwork[]>): void;
|
|
150
|
-
findServersOnNetwork(options: FindServersOnNetworkRequestLike, callback: ResponseCallback<ServerOnNetwork[]>): void;
|
|
151
|
-
}
|
|
152
|
-
export interface OPCUAClientBase extends EventEmitter {
|
|
153
|
-
/**
|
|
154
|
-
* this Event is raised when the initial connection has succeeded
|
|
155
|
-
*/
|
|
156
|
-
on(eventName: "connected", eventHandler: () => void): this;
|
|
157
|
-
/**
|
|
158
|
-
* this Event is raised when the initial connection has failed
|
|
159
|
-
*/
|
|
160
|
-
on(eventName: "connection_failed", eventHandler: (err: Error) => void): this;
|
|
161
|
-
/**
|
|
162
|
-
* this Event is raised when a failing connection is about to be tried again
|
|
163
|
-
*/
|
|
164
|
-
on(eventName: "backoff", eventHandler: (count: number, delay: number) => void): this;
|
|
165
|
-
/**
|
|
166
|
-
* this event is raised when the client has encountered a connection failure and
|
|
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
|
-
*
|
|
172
|
-
* You can intercept start_reconnection event to pause your interaction with the remote
|
|
173
|
-
* OPCUA server.
|
|
174
|
-
*/
|
|
175
|
-
on(eventName: "start_reconnection", eventHandler: () => void): this;
|
|
176
|
-
/**
|
|
177
|
-
* this event is raised when the client has failed one attempt to reconnect to the server
|
|
178
|
-
* This event will be raised if the socket has successfully being created to the server but
|
|
179
|
-
* if something went wrong during the reconnection process.
|
|
180
|
-
*/
|
|
181
|
-
on(eventName: "reconnection_attempt_has_failed", eventHandler: (err: Error, message: string) => void): this;
|
|
182
|
-
/**
|
|
183
|
-
* this event is raised after the client has successfully managed to re-establish the connection with
|
|
184
|
-
* the remote OPCUA Server.
|
|
185
|
-
* You can intercept after_reconnection event to resume your interaction with the remote
|
|
186
|
-
* OPCUA server.
|
|
187
|
-
*/
|
|
188
|
-
on(eventName: "after_reconnection", eventHandler: (err?: Error) => void): this;
|
|
189
|
-
/**
|
|
190
|
-
* the event is raised when the connection has been aborted by the remote OPCUA Server
|
|
191
|
-
* @param event
|
|
192
|
-
* @param eventHandler
|
|
193
|
-
*/
|
|
194
|
-
on(eventName: "abort", eventHandler: () => void): this;
|
|
195
|
-
/**
|
|
196
|
-
* this event is raised when the connection is closed
|
|
197
|
-
* @param event
|
|
198
|
-
* @param eventHandler
|
|
199
|
-
*/
|
|
200
|
-
on(eventName: "close", eventHandler: () => void): this;
|
|
201
|
-
/**
|
|
202
|
-
* this event is raised when the client is sending a message chunk to the server
|
|
203
|
-
* (advanced use only)
|
|
204
|
-
* @param event
|
|
205
|
-
* @param eventHandler
|
|
206
|
-
*/
|
|
207
|
-
on(eventName: "send_chunk", eventHandler: (chunk: Buffer) => void): this;
|
|
208
|
-
/**
|
|
209
|
-
* this event is raised when the client has received a new message chunk from the servers
|
|
210
|
-
* (advanced use only)
|
|
211
|
-
* @param event
|
|
212
|
-
* @param eventHandler
|
|
213
|
-
*/
|
|
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;
|
|
217
|
-
/**
|
|
218
|
-
* this event is raised when the current security token has reached 75% of its lifetime and is therefore
|
|
219
|
-
* about to expired.
|
|
220
|
-
* @param event
|
|
221
|
-
* @param eventHandler
|
|
222
|
-
*/
|
|
223
|
-
on(eventName: "lifetime_75", eventHandler: (token: ChannelSecurityToken) => void): this;
|
|
224
|
-
/**
|
|
225
|
-
* this event is raised after the (about ) security token as been renewed
|
|
226
|
-
* and renegotiated with the server.to expire
|
|
227
|
-
* @param event
|
|
228
|
-
* @param eventHandler
|
|
229
|
-
*/
|
|
230
|
-
on(eventName: "security_token_renewed", eventHandler: () => void): this;
|
|
231
|
-
/**
|
|
232
|
-
* this event is raised when the connection has been broken
|
|
233
|
-
* @param event
|
|
234
|
-
* @param eventHandler
|
|
235
|
-
*/
|
|
236
|
-
on(eventName: "connection_lost", eventHandler: () => void): this;
|
|
237
|
-
/**
|
|
238
|
-
* this event is raised when a broken connection with the remote Server has been reestablished
|
|
239
|
-
* @param event
|
|
240
|
-
* @param eventHandler
|
|
241
|
-
*/
|
|
242
|
-
on(eventName: "connection_reestablished", eventHandler: () => void): this;
|
|
243
|
-
/**
|
|
244
|
-
* This event is raised when a request sent to the remote OPCUA server has reach it's timeout value without
|
|
245
|
-
* a Response from the server.
|
|
246
|
-
* @param event
|
|
247
|
-
* @param eventHandler
|
|
248
|
-
*/
|
|
249
|
-
on(eventName: "timed_out_request", eventHandler: (request: Request) => void): this;
|
|
250
|
-
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
251
|
-
}
|
|
252
|
-
export interface OPCUAClientBase {
|
|
253
|
-
readonly endpoint?: EndpointDescription;
|
|
254
|
-
readonly isReconnecting: boolean;
|
|
255
|
-
readonly transactionsPerformed: number;
|
|
256
|
-
readonly knowsServerEndpoint: boolean;
|
|
257
|
-
readonly reconnectOnFailure: boolean;
|
|
258
|
-
readonly bytesRead: number;
|
|
259
|
-
readonly bytesWritten: number;
|
|
260
|
-
readonly securityMode: MessageSecurityMode;
|
|
261
|
-
readonly securityPolicy: SecurityPolicy;
|
|
262
|
-
readonly serverCertificate?: Certificate;
|
|
263
|
-
readonly clientName: string;
|
|
264
|
-
readonly protocolVersion: 0;
|
|
265
|
-
readonly defaultSecureTokenLifetime: number;
|
|
266
|
-
readonly tokenRenewalInterval: number;
|
|
267
|
-
readonly connectionStrategy: ConnectionStrategy;
|
|
268
|
-
readonly keepPendingSessionsOnDisconnect: boolean;
|
|
269
|
-
readonly endpointUrl: string;
|
|
270
|
-
readonly keepSessionAlive: boolean;
|
|
271
|
-
readonly applicationName: string;
|
|
272
|
-
}
|
|
273
|
-
export declare class OPCUAClientBase {
|
|
274
|
-
static registry: ObjectRegistry;
|
|
275
|
-
static retryDelay: number;
|
|
276
|
-
static create(options: OPCUAClientBaseOptions): OPCUAClientBase;
|
|
277
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/**
|
|
4
|
+
* @module node-opcua-client
|
|
5
|
+
*/
|
|
6
|
+
import { EventEmitter } from "events";
|
|
7
|
+
import { LocaleId } from "node-opcua-basic-types";
|
|
8
|
+
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
9
|
+
import { OPCUASecureObject } from "node-opcua-common";
|
|
10
|
+
import { Certificate } from "node-opcua-crypto";
|
|
11
|
+
import { ObjectRegistry } from "node-opcua-object-registry";
|
|
12
|
+
import { ClientSecureChannelLayer, ConnectionStrategy, ConnectionStrategyOptions, SecurityPolicy } from "node-opcua-secure-channel";
|
|
13
|
+
import { FindServersOnNetworkRequestOptions, FindServersRequestOptions, ServerOnNetwork } from "node-opcua-service-discovery";
|
|
14
|
+
import { ApplicationDescription, EndpointDescription } from "node-opcua-service-endpoints";
|
|
15
|
+
import { ChannelSecurityToken, MessageSecurityMode } from "node-opcua-service-secure-channel";
|
|
16
|
+
import { ErrorCallback } from "node-opcua-status-code";
|
|
17
|
+
import { ResponseCallback } from "./client_session";
|
|
18
|
+
import { Request, Response } from "./common";
|
|
19
|
+
export type FindServersRequestLike = FindServersRequestOptions;
|
|
20
|
+
export type FindServersOnNetworkRequestLike = FindServersOnNetworkRequestOptions;
|
|
21
|
+
export type CreateSecureChannelCallbackFunc = (err: Error | null, secureChannel?: ClientSecureChannelLayer) => void;
|
|
22
|
+
export interface FindEndpointOptions {
|
|
23
|
+
securityMode: MessageSecurityMode;
|
|
24
|
+
securityPolicy: SecurityPolicy;
|
|
25
|
+
connectionStrategy: ConnectionStrategyOptions;
|
|
26
|
+
certificateFile: string;
|
|
27
|
+
privateKeyFile: string;
|
|
28
|
+
applicationName: string;
|
|
29
|
+
applicationUri: string;
|
|
30
|
+
clientCertificateManager: OPCUACertificateManager;
|
|
31
|
+
}
|
|
32
|
+
export interface FindEndpointResult {
|
|
33
|
+
selectedEndpoint: EndpointDescription;
|
|
34
|
+
endpoints: EndpointDescription[];
|
|
35
|
+
}
|
|
36
|
+
export type FindEndpointCallback = (err: Error | null, result?: FindEndpointResult) => void;
|
|
37
|
+
export interface TransportSettings {
|
|
38
|
+
maxChunkCount?: number;
|
|
39
|
+
maxMessageSize?: number;
|
|
40
|
+
sendBufferSize?: number;
|
|
41
|
+
receiveBufferSize?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface OPCUAClientBaseOptions {
|
|
44
|
+
/**
|
|
45
|
+
* the client application name
|
|
46
|
+
* @default "NodeOPCUA-Client"
|
|
47
|
+
*/
|
|
48
|
+
applicationName?: string;
|
|
49
|
+
/**
|
|
50
|
+
* the application Uri
|
|
51
|
+
* @default: `urn:${hostname}:${applicationName}`
|
|
52
|
+
*/
|
|
53
|
+
applicationUri?: string;
|
|
54
|
+
connectionStrategy?: ConnectionStrategyOptions;
|
|
55
|
+
/**
|
|
56
|
+
* if not specify or set to 0 , token renewal will happen
|
|
57
|
+
* around 75% of the defaultSecureTokenLifetime
|
|
58
|
+
*/
|
|
59
|
+
tokenRenewalInterval?: number;
|
|
60
|
+
/**
|
|
61
|
+
* if set to true, pending session will not be automatically closed when disconnect is called
|
|
62
|
+
*/
|
|
63
|
+
keepPendingSessionsOnDisconnect?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* the server certificate.
|
|
66
|
+
*/
|
|
67
|
+
serverCertificate?: Certificate;
|
|
68
|
+
/**
|
|
69
|
+
* default secure token lifetime in ms
|
|
70
|
+
*/
|
|
71
|
+
defaultSecureTokenLifetime?: number;
|
|
72
|
+
/**
|
|
73
|
+
* the security mode
|
|
74
|
+
* @default MessageSecurityMode.None
|
|
75
|
+
*/
|
|
76
|
+
securityMode?: MessageSecurityMode | string;
|
|
77
|
+
/**
|
|
78
|
+
* the security policy
|
|
79
|
+
* @default SecurityPolicy.None
|
|
80
|
+
*/
|
|
81
|
+
securityPolicy?: SecurityPolicy | string;
|
|
82
|
+
/**
|
|
83
|
+
* can be set when the client doesn't create subscription. In this case,
|
|
84
|
+
* the client will send a dummy request on a regular basis to keep the
|
|
85
|
+
* connection active.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
keepSessionAlive?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* certificate Manager
|
|
91
|
+
*/
|
|
92
|
+
clientCertificateManager?: OPCUACertificateManager;
|
|
93
|
+
/**
|
|
94
|
+
* client certificate pem file.
|
|
95
|
+
* @default `${clientCertificateManager/rootFolder}/own/certs/client_certificate.pem"
|
|
96
|
+
*/
|
|
97
|
+
certificateFile?: string;
|
|
98
|
+
/**
|
|
99
|
+
* client private key pem file.
|
|
100
|
+
* @default `${clientCertificateManager/rootFolder}/own/private/private_key.pem"
|
|
101
|
+
*/
|
|
102
|
+
privateKeyFile?: string;
|
|
103
|
+
/**
|
|
104
|
+
* a client name string that will be used to generate session names.
|
|
105
|
+
*/
|
|
106
|
+
clientName?: string;
|
|
107
|
+
/**
|
|
108
|
+
* discovery url:
|
|
109
|
+
*/
|
|
110
|
+
discoveryUrl?: string;
|
|
111
|
+
/**
|
|
112
|
+
* @advanced
|
|
113
|
+
*/
|
|
114
|
+
transportSettings?: TransportSettings;
|
|
115
|
+
}
|
|
116
|
+
export interface GetEndpointsOptions {
|
|
117
|
+
endpointUrl?: string;
|
|
118
|
+
localeIds?: LocaleId[];
|
|
119
|
+
profileUris?: string[];
|
|
120
|
+
}
|
|
121
|
+
export interface OPCUAClientBase extends OPCUASecureObject {
|
|
122
|
+
/**
|
|
123
|
+
* certificate Manager
|
|
124
|
+
*/
|
|
125
|
+
readonly clientCertificateManager: OPCUACertificateManager;
|
|
126
|
+
/***
|
|
127
|
+
*
|
|
128
|
+
* @param endpointUrl the endpoint of the server to connect to ( i.e "opc.tcp://machine.name:3434/name" )
|
|
129
|
+
*/
|
|
130
|
+
connect(endpointUrl: string): Promise<void>;
|
|
131
|
+
connect(endpointUrl: string, callback: ErrorCallback): void;
|
|
132
|
+
/***
|
|
133
|
+
* causes the client to close and disconnect the communication with server
|
|
134
|
+
*
|
|
135
|
+
* ### note
|
|
136
|
+
* > once the client has disconnected, it cannot reconnect to the server
|
|
137
|
+
* you'll need to recreate a new Client object to reconnect to the server.
|
|
138
|
+
*/
|
|
139
|
+
disconnect(): Promise<void>;
|
|
140
|
+
disconnect(callback: ErrorCallback): void;
|
|
141
|
+
findEndpointForSecurity(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy): EndpointDescription | undefined;
|
|
142
|
+
getEndpoints(options?: GetEndpointsOptions): Promise<EndpointDescription[]>;
|
|
143
|
+
getEndpoints(options: GetEndpointsOptions, callback: ResponseCallback<EndpointDescription[]>): void;
|
|
144
|
+
getEndpoints(callback: ResponseCallback<EndpointDescription[]>): void;
|
|
145
|
+
findServers(options?: FindServersRequestLike): Promise<ApplicationDescription[]>;
|
|
146
|
+
findServers(options: FindServersRequestLike, callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
147
|
+
findServers(callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
148
|
+
findServersOnNetwork(options?: FindServersOnNetworkRequestLike): Promise<ServerOnNetwork[]>;
|
|
149
|
+
findServersOnNetwork(callback: ResponseCallback<ServerOnNetwork[]>): void;
|
|
150
|
+
findServersOnNetwork(options: FindServersOnNetworkRequestLike, callback: ResponseCallback<ServerOnNetwork[]>): void;
|
|
151
|
+
}
|
|
152
|
+
export interface OPCUAClientBase extends EventEmitter {
|
|
153
|
+
/**
|
|
154
|
+
* this Event is raised when the initial connection has succeeded
|
|
155
|
+
*/
|
|
156
|
+
on(eventName: "connected", eventHandler: () => void): this;
|
|
157
|
+
/**
|
|
158
|
+
* this Event is raised when the initial connection has failed
|
|
159
|
+
*/
|
|
160
|
+
on(eventName: "connection_failed", eventHandler: (err: Error) => void): this;
|
|
161
|
+
/**
|
|
162
|
+
* this Event is raised when a failing connection is about to be tried again
|
|
163
|
+
*/
|
|
164
|
+
on(eventName: "backoff", eventHandler: (count: number, delay: number) => void): this;
|
|
165
|
+
/**
|
|
166
|
+
* this event is raised when the client has encountered a connection failure and
|
|
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
|
+
*
|
|
172
|
+
* You can intercept start_reconnection event to pause your interaction with the remote
|
|
173
|
+
* OPCUA server.
|
|
174
|
+
*/
|
|
175
|
+
on(eventName: "start_reconnection", eventHandler: () => void): this;
|
|
176
|
+
/**
|
|
177
|
+
* this event is raised when the client has failed one attempt to reconnect to the server
|
|
178
|
+
* This event will be raised if the socket has successfully being created to the server but
|
|
179
|
+
* if something went wrong during the reconnection process.
|
|
180
|
+
*/
|
|
181
|
+
on(eventName: "reconnection_attempt_has_failed", eventHandler: (err: Error, message: string) => void): this;
|
|
182
|
+
/**
|
|
183
|
+
* this event is raised after the client has successfully managed to re-establish the connection with
|
|
184
|
+
* the remote OPCUA Server.
|
|
185
|
+
* You can intercept after_reconnection event to resume your interaction with the remote
|
|
186
|
+
* OPCUA server.
|
|
187
|
+
*/
|
|
188
|
+
on(eventName: "after_reconnection", eventHandler: (err?: Error) => void): this;
|
|
189
|
+
/**
|
|
190
|
+
* the event is raised when the connection has been aborted by the remote OPCUA Server
|
|
191
|
+
* @param event
|
|
192
|
+
* @param eventHandler
|
|
193
|
+
*/
|
|
194
|
+
on(eventName: "abort", eventHandler: () => void): this;
|
|
195
|
+
/**
|
|
196
|
+
* this event is raised when the connection is closed
|
|
197
|
+
* @param event
|
|
198
|
+
* @param eventHandler
|
|
199
|
+
*/
|
|
200
|
+
on(eventName: "close", eventHandler: () => void): this;
|
|
201
|
+
/**
|
|
202
|
+
* this event is raised when the client is sending a message chunk to the server
|
|
203
|
+
* (advanced use only)
|
|
204
|
+
* @param event
|
|
205
|
+
* @param eventHandler
|
|
206
|
+
*/
|
|
207
|
+
on(eventName: "send_chunk", eventHandler: (chunk: Buffer) => void): this;
|
|
208
|
+
/**
|
|
209
|
+
* this event is raised when the client has received a new message chunk from the servers
|
|
210
|
+
* (advanced use only)
|
|
211
|
+
* @param event
|
|
212
|
+
* @param eventHandler
|
|
213
|
+
*/
|
|
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;
|
|
217
|
+
/**
|
|
218
|
+
* this event is raised when the current security token has reached 75% of its lifetime and is therefore
|
|
219
|
+
* about to expired.
|
|
220
|
+
* @param event
|
|
221
|
+
* @param eventHandler
|
|
222
|
+
*/
|
|
223
|
+
on(eventName: "lifetime_75", eventHandler: (token: ChannelSecurityToken) => void): this;
|
|
224
|
+
/**
|
|
225
|
+
* this event is raised after the (about ) security token as been renewed
|
|
226
|
+
* and renegotiated with the server.to expire
|
|
227
|
+
* @param event
|
|
228
|
+
* @param eventHandler
|
|
229
|
+
*/
|
|
230
|
+
on(eventName: "security_token_renewed", eventHandler: () => void): this;
|
|
231
|
+
/**
|
|
232
|
+
* this event is raised when the connection has been broken
|
|
233
|
+
* @param event
|
|
234
|
+
* @param eventHandler
|
|
235
|
+
*/
|
|
236
|
+
on(eventName: "connection_lost", eventHandler: () => void): this;
|
|
237
|
+
/**
|
|
238
|
+
* this event is raised when a broken connection with the remote Server has been reestablished
|
|
239
|
+
* @param event
|
|
240
|
+
* @param eventHandler
|
|
241
|
+
*/
|
|
242
|
+
on(eventName: "connection_reestablished", eventHandler: () => void): this;
|
|
243
|
+
/**
|
|
244
|
+
* This event is raised when a request sent to the remote OPCUA server has reach it's timeout value without
|
|
245
|
+
* a Response from the server.
|
|
246
|
+
* @param event
|
|
247
|
+
* @param eventHandler
|
|
248
|
+
*/
|
|
249
|
+
on(eventName: "timed_out_request", eventHandler: (request: Request) => void): this;
|
|
250
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
251
|
+
}
|
|
252
|
+
export interface OPCUAClientBase {
|
|
253
|
+
readonly endpoint?: EndpointDescription;
|
|
254
|
+
readonly isReconnecting: boolean;
|
|
255
|
+
readonly transactionsPerformed: number;
|
|
256
|
+
readonly knowsServerEndpoint: boolean;
|
|
257
|
+
readonly reconnectOnFailure: boolean;
|
|
258
|
+
readonly bytesRead: number;
|
|
259
|
+
readonly bytesWritten: number;
|
|
260
|
+
readonly securityMode: MessageSecurityMode;
|
|
261
|
+
readonly securityPolicy: SecurityPolicy;
|
|
262
|
+
readonly serverCertificate?: Certificate;
|
|
263
|
+
readonly clientName: string;
|
|
264
|
+
readonly protocolVersion: 0;
|
|
265
|
+
readonly defaultSecureTokenLifetime: number;
|
|
266
|
+
readonly tokenRenewalInterval: number;
|
|
267
|
+
readonly connectionStrategy: ConnectionStrategy;
|
|
268
|
+
readonly keepPendingSessionsOnDisconnect: boolean;
|
|
269
|
+
readonly endpointUrl: string;
|
|
270
|
+
readonly keepSessionAlive: boolean;
|
|
271
|
+
readonly applicationName: string;
|
|
272
|
+
}
|
|
273
|
+
export declare class OPCUAClientBase {
|
|
274
|
+
static registry: ObjectRegistry;
|
|
275
|
+
static retryDelay: number;
|
|
276
|
+
static create(options: OPCUAClientBaseOptions): OPCUAClientBase;
|
|
277
|
+
}
|
package/dist/client_base.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OPCUAClientBase = void 0;
|
|
4
|
-
const node_opcua_object_registry_1 = require("node-opcua-object-registry");
|
|
5
|
-
class OPCUAClientBase {
|
|
6
|
-
static create(options) {
|
|
7
|
-
/* istanbul ignore next*/
|
|
8
|
-
options;
|
|
9
|
-
throw new Error("Not Implemented");
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
OPCUAClientBase.
|
|
14
|
-
OPCUAClientBase
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OPCUAClientBase = void 0;
|
|
4
|
+
const node_opcua_object_registry_1 = require("node-opcua-object-registry");
|
|
5
|
+
class OPCUAClientBase {
|
|
6
|
+
static create(options) {
|
|
7
|
+
/* istanbul ignore next*/
|
|
8
|
+
options;
|
|
9
|
+
throw new Error("Not Implemented");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
OPCUAClientBase.registry = new node_opcua_object_registry_1.ObjectRegistry();
|
|
13
|
+
OPCUAClientBase.retryDelay = 1000 * 5;
|
|
14
|
+
exports.OPCUAClientBase = OPCUAClientBase;
|
|
15
15
|
//# sourceMappingURL=client_base.js.map
|
package/dist/client_base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;;
|
|
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;;AAPa,wBAAQ,GAAG,IAAI,2CAAc,EAAE,CAAC;AAChC,0BAAU,GAAG,IAAI,GAAG,CAAC,CAAC;AAF3B,0CAAe"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* @module node-opcua-client
|
|
4
|
-
*/
|
|
5
|
-
import { EventEmitter } from "events";
|
|
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
|
-
import { MonitoringParametersOptions } from "node-opcua-types";
|
|
10
|
-
import { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
|
|
11
|
-
import { ClientSubscription } from "./client_subscription";
|
|
12
|
-
export interface ClientMonitoredItem extends ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction, EventEmitter {
|
|
13
|
-
on(event: "changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
14
|
-
on(event: "changed", eventHandler: (values: Variant[]) => void): this;
|
|
15
|
-
on(event: "terminated", eventHandler: () => void): this;
|
|
16
|
-
on(event: "initialized", eventHandler: () => void): this;
|
|
17
|
-
on(event: "err", eventHandler: (message: string) => void): this;
|
|
18
|
-
}
|
|
19
|
-
export declare class ClientMonitoredItem {
|
|
20
|
-
static create(subscription: ClientSubscription, itemToMonitor: ReadValueIdOptions, monitoringParameters: MonitoringParametersOptions, timestampsToReturn?: TimestampsToReturn): ClientMonitoredItem;
|
|
21
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* @module node-opcua-client
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from "events";
|
|
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
|
+
import { MonitoringParametersOptions } from "node-opcua-types";
|
|
10
|
+
import { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
|
|
11
|
+
import { ClientSubscription } from "./client_subscription";
|
|
12
|
+
export interface ClientMonitoredItem extends ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction, EventEmitter {
|
|
13
|
+
on(event: "changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
14
|
+
on(event: "changed", eventHandler: (values: Variant[]) => void): this;
|
|
15
|
+
on(event: "terminated", eventHandler: () => void): this;
|
|
16
|
+
on(event: "initialized", eventHandler: () => void): this;
|
|
17
|
+
on(event: "err", eventHandler: (message: string) => void): this;
|
|
18
|
+
}
|
|
19
|
+
export declare class ClientMonitoredItem {
|
|
20
|
+
static create(subscription: ClientSubscription, itemToMonitor: ReadValueIdOptions, monitoringParameters: MonitoringParametersOptions, timestampsToReturn?: TimestampsToReturn): ClientMonitoredItem;
|
|
21
|
+
}
|