node-opcua-client 2.64.1 → 2.65.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 (65) hide show
  1. package/dist/alarms_and_conditions/client_alarm.d.ts +42 -42
  2. package/dist/alarms_and_conditions/client_alarm.js +84 -84
  3. package/dist/alarms_and_conditions/client_alarm_list.d.ts +21 -21
  4. package/dist/alarms_and_conditions/client_alarm_list.js +97 -97
  5. package/dist/alarms_and_conditions/client_alarm_tools.d.ts +4 -4
  6. package/dist/alarms_and_conditions/client_alarm_tools.js +139 -139
  7. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.d.ts +18 -18
  8. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +190 -190
  9. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.d.ts +9 -9
  10. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +73 -73
  11. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.d.ts +8 -8
  12. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +120 -120
  13. package/dist/alarms_and_conditions/client_tools.d.ts +7 -7
  14. package/dist/alarms_and_conditions/client_tools.js +179 -179
  15. package/dist/client_base.d.ts +270 -270
  16. package/dist/client_base.js +13 -13
  17. package/dist/client_monitored_item.d.ts +21 -21
  18. package/dist/client_monitored_item.js +11 -11
  19. package/dist/client_monitored_item_base.d.ts +39 -39
  20. package/dist/client_monitored_item_base.js +2 -2
  21. package/dist/client_monitored_item_group.d.ts +18 -18
  22. package/dist/client_monitored_item_group.js +13 -13
  23. package/dist/client_monitored_item_toolbox.d.ts +15 -15
  24. package/dist/client_monitored_item_toolbox.js +117 -117
  25. package/dist/client_session.d.ts +483 -483
  26. package/dist/client_session.js +10 -10
  27. package/dist/client_session_keepalive_manager.d.ts +34 -34
  28. package/dist/client_session_keepalive_manager.js +150 -150
  29. package/dist/client_subscription.d.ts +241 -241
  30. package/dist/client_subscription.js +14 -14
  31. package/dist/client_utils.d.ts +22 -22
  32. package/dist/client_utils.js +88 -88
  33. package/dist/common.d.ts +17 -17
  34. package/dist/common.js +5 -5
  35. package/dist/index.d.ts +55 -55
  36. package/dist/index.js +89 -89
  37. package/dist/opcua_client.d.ts +132 -132
  38. package/dist/opcua_client.js +33 -33
  39. package/dist/private/client_base_impl.d.ts +169 -169
  40. package/dist/private/client_base_impl.js +1315 -1315
  41. package/dist/private/client_monitored_item_base_impl.d.ts +3 -3
  42. package/dist/private/client_monitored_item_base_impl.js +4 -4
  43. package/dist/private/client_monitored_item_group_impl.d.ts +53 -53
  44. package/dist/private/client_monitored_item_group_impl.js +159 -159
  45. package/dist/private/client_monitored_item_impl.d.ts +93 -93
  46. package/dist/private/client_monitored_item_impl.js +304 -304
  47. package/dist/private/client_publish_engine.d.ts +62 -62
  48. package/dist/private/client_publish_engine.js +408 -408
  49. package/dist/private/client_session_impl.d.ts +620 -620
  50. package/dist/private/client_session_impl.js +1298 -1298
  51. package/dist/private/client_subscription_impl.d.ts +93 -93
  52. package/dist/private/client_subscription_impl.js +779 -779
  53. package/dist/private/i_private_client.d.ts +18 -18
  54. package/dist/private/i_private_client.js +2 -2
  55. package/dist/private/opcua_client_impl.d.ts +169 -169
  56. package/dist/private/opcua_client_impl.js +978 -978
  57. package/dist/reconnection.d.ts +9 -9
  58. package/dist/reconnection.js +362 -362
  59. package/dist/tools/findservers.d.ts +20 -20
  60. package/dist/tools/findservers.js +61 -61
  61. package/dist/tools/read_history_server_capabilities.d.ts +6 -6
  62. package/dist/tools/read_history_server_capabilities.js +99 -99
  63. package/dist/verify.d.ts +5 -5
  64. package/dist/verify.js +134 -134
  65. package/package.json +24 -24
@@ -1,620 +1,620 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-client-private
4
- */
5
- import { EventEmitter } from "events";
6
- import { AggregateFunction } from "node-opcua-constants";
7
- import { DateTime } from "node-opcua-basic-types";
8
- import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
9
- import { Certificate, Nonce } from "node-opcua-crypto";
10
- import { LocalizedTextLike } from "node-opcua-data-model";
11
- import { DataValue } from "node-opcua-data-value";
12
- import { ExtensionObject } from "node-opcua-extension-object";
13
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
14
- import { AnyConstructorFunc } from "node-opcua-schemas";
15
- import { SignatureData } from "node-opcua-secure-channel";
16
- import { BrowseResult } from "node-opcua-service-browse";
17
- import { CallMethodResult } from "node-opcua-service-call";
18
- import { EndpointDescription } from "node-opcua-service-endpoints";
19
- import { HistoryReadRequest, HistoryReadResponse, HistoryReadResult } from "node-opcua-service-history";
20
- import { QueryFirstResponse } from "node-opcua-service-query";
21
- import { ReadValueIdOptions } from "node-opcua-service-read";
22
- import { CreateMonitoredItemsResponse, CreateSubscriptionResponse, DeleteMonitoredItemsResponse, DeleteSubscriptionsResponse, ModifyMonitoredItemsResponse, ModifySubscriptionResponse, PublishRequest, PublishResponse, RepublishRequest, RepublishResponse, SetMonitoringModeResponse, SetTriggeringRequestOptions, SetTriggeringResponse, TransferSubscriptionsResponse } from "node-opcua-service-subscription";
23
- import { BrowsePath, BrowsePathResult } from "node-opcua-service-translate-browse-path";
24
- import { StatusCode, Callback } from "node-opcua-status-code";
25
- import { ErrorCallback } from "node-opcua-status-code";
26
- import { HistoryReadValueIdOptions, WriteValueOptions } from "node-opcua-types";
27
- import { VariantLike } from "node-opcua-variant";
28
- import { ArgumentDefinition, BrowseDescriptionLike, CallMethodRequestLike, ClientSession, CreateMonitoredItemsRequestLike, CreateSubscriptionRequestLike, DeleteMonitoredItemsRequestLike, DeleteSubscriptionsRequestLike, MethodId, ModifyMonitoredItemsRequestLike, ModifySubscriptionRequestLike, MonitoredItemData, NodeAttributes, QueryFirstRequestLike, SetMonitoringModeRequestLike, SubscriptionId, TransferSubscriptionsRequestLike, HistoryReadValueIdOptions2, ExtraReadHistoryValueParameters } from "../client_session";
29
- import { ClientSubscription } from "../client_subscription";
30
- import { Request, Response } from "../common";
31
- import { ClientSidePublishEngine } from "./client_publish_engine";
32
- import { IClientBase } from "./i_private_client";
33
- export declare type ResponseCallback<T> = (err: Error | null, response?: T) => void;
34
- declare type EmptyCallback = (err?: Error) => void;
35
- export interface Reconnectable {
36
- _reconnecting: {
37
- reconnecting: boolean;
38
- pendingCallbacks: EmptyCallback[];
39
- };
40
- pendingTransactions: any[];
41
- pendingTransactionsCount: number;
42
- }
43
- /**
44
- * @class ClientSession
45
- * @param client {OPCUAClientImpl}
46
- * @constructor
47
- * @private
48
- */
49
- export declare class ClientSessionImpl extends EventEmitter implements ClientSession {
50
- timeout: number;
51
- authenticationToken?: NodeId;
52
- requestedMaxReferencesPerNode: number;
53
- sessionId: NodeId;
54
- lastRequestSentTime: Date;
55
- lastResponseReceivedTime: Date;
56
- serverCertificate: Certificate;
57
- name: string;
58
- serverNonce?: Nonce;
59
- serverSignature?: SignatureData;
60
- serverEndpoints: any[];
61
- _client: IClientBase | null;
62
- _closed: boolean;
63
- private _reconnecting;
64
- /**
65
- * @internal
66
- */
67
- _closeEventHasBeenEmitted: boolean;
68
- private _publishEngine;
69
- private _keepAliveManager?;
70
- private _namespaceArray?;
71
- private recursive_repair_detector;
72
- constructor(client: IClientBase);
73
- /**
74
- * the endpoint on which this session is operating
75
- * @property endpoint
76
- * @type {EndpointDescription}
77
- */
78
- get endpoint(): EndpointDescription;
79
- get subscriptionCount(): number;
80
- get isReconnecting(): boolean;
81
- getPublishEngine(): ClientSidePublishEngine;
82
- /**
83
- * @method browse
84
- * @async
85
- *
86
- * @example
87
- *
88
- * ```javascript
89
- * session.browse("RootFolder",function(err,browseResult) {
90
- * if(err) return callback(err);
91
- * console.log(browseResult.toString());
92
- * callback();
93
- * } );
94
- * ```
95
- *
96
- *
97
- * @example
98
- *
99
- * ``` javascript
100
- * const browseDescription = {
101
- * nodeId: "ObjectsFolder",
102
- * referenceTypeId: "Organizes",
103
- * browseDirection: BrowseDirection.Inverse,
104
- * includeSubtypes: true,
105
- * nodeClassMask: 0,
106
- * resultMask: 63
107
- * }
108
- * session.browse(browseDescription,function(err, browseResult) {
109
- * if(err) return callback(err);
110
- * console.log(browseResult.toString());
111
- * callback();
112
- * });
113
- * ```
114
- * @example
115
- *
116
- * ``` javascript
117
- * session.browse([ "RootFolder", "ObjectsFolder"],function(err, browseResults) {
118
- * assert(browseResults.length === 2);
119
- * });
120
- * ```
121
- *
122
- * @example
123
- * ``` javascript
124
- * const browseDescriptions = [
125
- * {
126
- * nodeId: "ObjectsFolder",
127
- * referenceTypeId: "Organizes",
128
- * browseDirection: BrowseDirection.Inverse,
129
- * includeSubtypes: true,
130
- * nodeClassMask: 0,
131
- * resultMask: 63
132
- * },
133
- * // {...}
134
- * ]
135
- * session.browse(browseDescriptions,function(err, browseResults) {
136
- *
137
- * });
138
- * ```
139
- *
140
- *
141
- */
142
- browse(nodeToBrowse: BrowseDescriptionLike, callback: ResponseCallback<BrowseResult>): void;
143
- browse(nodesToBrowse: BrowseDescriptionLike[], callback: ResponseCallback<BrowseResult[]>): void;
144
- browse(nodeToBrowse: BrowseDescriptionLike): Promise<BrowseResult>;
145
- browse(nodesToBrowse: BrowseDescriptionLike[]): Promise<BrowseResult[]>;
146
- browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult>): void;
147
- browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult[]>): void;
148
- browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean): Promise<BrowseResult>;
149
- browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean): Promise<BrowseResult[]>;
150
- /**
151
- * @method readVariableValue
152
- * @async
153
- *
154
- * @example
155
- *
156
- * ```javascript
157
- * session.readVariableValue("ns=2;s=Furnace_1.Temperature",function(err,dataValue) {
158
- * if(err) { return callback(err); }
159
- * if (dataValue.statusCode === opcua.StatusCodes.Good) {
160
- * }
161
- * console.log(dataValue.toString());
162
- * callback();
163
- * });
164
- * ```
165
- *
166
- * @example
167
- *
168
- * ```javascript
169
- * session.readVariableValue(["ns=0;i=2257","ns=0;i=2258"],function(err,dataValues) {
170
- * if (!err) {
171
- * console.log(dataValues[0].toString());
172
- * console.log(dataValues[1].toString());
173
- * }
174
- * });
175
- * ```
176
- *
177
- * @example
178
- * ```javascript
179
- * const dataValues = await session.readVariableValue(["ns=1;s=Temperature","ns=1;s=Pressure"]);
180
- * ```
181
- */
182
- readVariableValue(nodeId: NodeIdLike, callback: ResponseCallback<DataValue>): void;
183
- readVariableValue(nodeIds: NodeIdLike[], callback: ResponseCallback<DataValue[]>): void;
184
- readVariableValue(nodeId: NodeIdLike): Promise<DataValue>;
185
- readVariableValue(nodeIds: NodeIdLike[]): Promise<DataValue[]>;
186
- /**
187
- * @method readHistoryValue
188
- * @async
189
- *
190
- * @example
191
- *
192
- * ```javascript
193
- * // es5
194
- * session.readHistoryValue(
195
- * "ns=5;s=Simulation Examples.Functions.Sine1",
196
- * "2015-06-10T09:00:00.000Z",
197
- * "2015-06-10T09:01:00.000Z", function(err,dataValues) {
198
- *
199
- * });
200
- * ```
201
- *
202
- * ```javascript
203
- * // es6
204
- * const dataValues = await session.readHistoryValue(
205
- * "ns=5;s=Simulation Examples.Functions.Sine1",
206
- * "2015-06-10T09:00:00.000Z",
207
- * "2015-06-10T09:01:00.000Z");
208
- * ```
209
- * @param nodeToRead the read value id
210
- * @param start the start time in UTC format
211
- * @param end the end time in UTC format
212
- * @param callback
213
- */
214
- readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
215
- readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
216
- readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options?: ExtraReadHistoryValueParameters): Promise<HistoryReadResult[]>;
217
- readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, callback: (err: Error | null, results?: HistoryReadResult) => void): void;
218
- readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, results?: HistoryReadResult) => void): void;
219
- readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, parameters: ExtraReadHistoryValueParameters): Promise<HistoryReadResult>;
220
- historyRead(request: HistoryReadRequest, callback: Callback<HistoryReadResponse>): void;
221
- historyRead(request: HistoryReadRequest): Promise<HistoryReadResponse>;
222
- readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number, callback: Callback<HistoryReadResult[]>): void;
223
- readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number): Promise<HistoryReadResult[]>;
224
- readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number, callback: Callback<HistoryReadResult>): void;
225
- readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number): Promise<HistoryReadResult>;
226
- /**
227
- *
228
- * @method write
229
- * @param nodesToWrite {WriteValue[]} - the array of value to write. One or more elements.
230
- * @param {Function} callback - the callback function
231
- * @param callback.err {object|null} the error if write has failed or null if OK
232
- * @param callback.statusCodes {StatusCode[]} - an array of status code of each write
233
- * @async
234
- *
235
- * @example
236
- *
237
- * const nodesToWrite = [
238
- * {
239
- * nodeId: "ns=1;s=SetPoint1",
240
- * attributeId: opcua.AttributeIds.Value,
241
- * value: {
242
- * statusCode: Good,
243
- * value: {
244
- * dataType: opcua.DataType.Double,
245
- * value: 100.0
246
- * }
247
- * }
248
- * },
249
- * {
250
- * nodeId: "ns=1;s=SetPoint2",
251
- * attributeIds opcua.AttributeIds.Value,
252
- * value: {
253
- * statusCode: Good,
254
- * value: {
255
- * dataType: opcua.DataType.Double,
256
- * value: 45.0
257
- * }
258
- * }
259
- * }
260
- * ];
261
- * session.write(nodesToWrite,function (err,statusCodes) {
262
- * if(err) { return callback(err);}
263
- * //
264
- * });
265
- *
266
- * @method write
267
- * @param nodeToWrite {WriteValue} - the value to write
268
- * @param callback - the callback function
269
- * @param callback.err {object|null} the error if write has failed or null if OK
270
- * @param callback.statusCode {StatusCodes} - the status code of the write
271
- * @async
272
- *
273
- * @example
274
- *
275
- * const nodeToWrite = {
276
- * nodeId: "ns=1;s=SetPoint",
277
- * attributeId: opcua.AttributeIds.Value,
278
- * value: {
279
- * statusCode: Good,
280
- * value: {
281
- * dataType: opcua.DataType.Double,
282
- * value: 100.0
283
- * }
284
- * }
285
- * };
286
- * session.write(nodeToWrite,function (err,statusCode) {
287
- * if(err) { return callback(err);}
288
- * //
289
- * });
290
- *
291
- *
292
- * @method write
293
- * @param nodeToWrite {WriteValue} - the value to write
294
- * @return {Promise<StatusCode>}
295
- * @async
296
- *
297
- * @example
298
- *
299
- * ```javascript
300
- * session.write(nodeToWrite).then(function(statusCode) { });
301
- * ```
302
- *
303
- * @example
304
- *
305
- * ```javascript
306
- * const statusCode = await session.write(nodeToWrite);
307
- * ```
308
- *
309
- * @method write
310
- * @param nodesToWrite {Array<WriteValue>} - the value to write
311
- * @return {Promise<Array<StatusCode>>}
312
- * @async
313
- *
314
- * @example
315
- * ```javascript
316
- * session.write(nodesToWrite).then(function(statusCodes) { });
317
- * ```
318
- *
319
- * @example
320
- * ```javascript
321
- * const statusCodes = await session.write(nodesToWrite);
322
- * ```
323
- */
324
- write(nodeToWrite: WriteValueOptions, callback: ResponseCallback<StatusCode>): void;
325
- write(nodesToWrite: WriteValueOptions[], callback: ResponseCallback<StatusCode[]>): void;
326
- write(nodesToWrite: WriteValueOptions[]): Promise<StatusCode[]>;
327
- write(nodeToWrite: WriteValueOptions): Promise<StatusCode>;
328
- /**
329
- *
330
- * @method writeSingleNode
331
- * @async
332
- * @param nodeId {NodeId} - the node id of the node to write
333
- * @param value {Variant} - the value to write
334
- * @param callback {Function}
335
- * @param callback.err {object|null} the error if write has failed or null if OK
336
- * @param callback.statusCode {StatusCode} - the status code of the write
337
- *
338
- * @method writeSingleNode
339
- * @async
340
- * @param nodeId {NodeId} - the node id of the node to write
341
- * @param value {Variant} - the value to write
342
- * @return {Promise<StatusCode>} - the status code of the write
343
- *
344
- * @deprecated
345
- */
346
- writeSingleNode(nodeId: NodeIdLike, value: VariantLike, callback: ResponseCallback<StatusCode>): void;
347
- writeSingleNode(nodeId: NodeIdLike, value: VariantLike): Promise<StatusCode>;
348
- /**
349
- * @method readAllAttributes
350
- *
351
- * @example
352
- *
353
- *
354
- * ``` javascript
355
- * session.readAllAttributes("ns=2;s=Furnace_1.Temperature",function(err,data) {
356
- * if(data.statusCode === StatusCodes.Good) {
357
- * console.log(" nodeId = ",data.nodeId.toString());
358
- * console.log(" browseName = ",data.browseName.toString());
359
- * console.log(" description = ",data.description.toString());
360
- * console.log(" value = ",data.value.toString()));
361
- * }
362
- * });
363
- * ```
364
- *
365
- * @async
366
- * @param nodes array of nodeId to read
367
- * @param node nodeId to read
368
- * @param callback
369
- */
370
- readAllAttributes(node: NodeIdLike, callback: (err: Error | null, data?: NodeAttributes) => void): void;
371
- readAllAttributes(nodes: NodeIdLike[], callback: (err: Error | null, data?: NodeAttributes[]) => void): void;
372
- /**
373
- * @method read (form1)
374
- *
375
- * @async
376
- *
377
- * @example
378
- *
379
- * ```javascript
380
- * ```
381
- *
382
- * form1: reading a single node
383
- *
384
- * ``` javascript
385
- * const nodeToRead = {
386
- * nodeId: "ns=2;s=Furnace_1.Temperature",
387
- * attributeId: AttributeIds.BrowseName
388
- * };
389
- *
390
- * session.read(nodeToRead,function(err,dataValue) {
391
- * if (!err) {
392
- * console.log(dataValue.toString());
393
- * }
394
- * });
395
- * ```
396
- *
397
- *
398
- * @method read (form2)
399
- * @param nodesToRead {Array<ReadValueId>} - an array of nodeId to read or a ReadValueId
400
- * @param [maxAge] {Number}
401
- * @param callback {Function} - the callback function
402
- * @param callback.err {Error|null} - the error or null if the transaction was OK}
403
- * @param callback.dataValues {Array<DataValue>}
404
- * @async
405
- *
406
- * @example
407
- *
408
- * ``` javascript
409
- * const nodesToRead = [
410
- * {
411
- * nodeId: "ns=2;s=Furnace_1.Temperature",
412
- * attributeId: AttributeIds.BrowseName
413
- * }
414
- * ];
415
- * session.read(nodesToRead,function(err,dataValues) {
416
- * if (!err) {
417
- * dataValues.forEach(dataValue=>console.log(dataValue.toString()));
418
- * }
419
- * });
420
- * ```
421
- *
422
- */
423
- read(nodeToRead: ReadValueIdOptions, maxAge: number, callback: ResponseCallback<DataValue>): void;
424
- read(nodesToRead: ReadValueIdOptions[], maxAge: number, callback: ResponseCallback<DataValue[]>): void;
425
- read(nodeToRead: ReadValueIdOptions, callback: ResponseCallback<DataValue>): void;
426
- read(nodesToRead: ReadValueIdOptions[], callback: ResponseCallback<DataValue[]>): void;
427
- read(nodeToRead: ReadValueIdOptions, maxAge?: number): Promise<DataValue>;
428
- read(nodeToRead: ReadValueIdOptions[], maxAge?: number): Promise<DataValue[]>;
429
- emitCloseEvent(statusCode: StatusCode): void;
430
- createSubscription(options: CreateSubscriptionRequestLike, callback?: ResponseCallback<CreateSubscriptionResponse>): any;
431
- /**
432
- * @method createSubscription2
433
- * @param createSubscriptionRequest
434
- * @param callback
435
- *
436
- *
437
- * subscription.on("error', function(err){ ... });
438
- * subscription.on("terminate',function(err){ ... });
439
- * const monitoredItem = await subscription.monitor(itemToMonitor,monitoringParameters,requestedParameters);
440
- * monitoredItem.on("changed",function( dataValue) {...});
441
- *
442
- */
443
- createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike): Promise<ClientSubscription>;
444
- createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike, callback: (err: Error | null, subscription?: ClientSubscription) => void): void;
445
- deleteSubscriptions(options: DeleteSubscriptionsRequestLike, callback?: ResponseCallback<DeleteSubscriptionsResponse>): any;
446
- setTriggering(request: SetTriggeringRequestOptions, callback?: ResponseCallback<SetTriggeringResponse>): any;
447
- /**
448
- * @method transferSubscriptions
449
- * @async
450
- */
451
- transferSubscriptions(options: TransferSubscriptionsRequestLike, callback?: ResponseCallback<TransferSubscriptionsResponse>): any;
452
- createMonitoredItems(options: CreateMonitoredItemsRequestLike, callback?: ResponseCallback<CreateMonitoredItemsResponse>): any;
453
- modifyMonitoredItems(options: ModifyMonitoredItemsRequestLike, callback?: ResponseCallback<ModifyMonitoredItemsResponse>): any;
454
- /**
455
- *
456
- * @method modifySubscription
457
- * @async
458
- * @param options {ModifySubscriptionRequest}
459
- * @param callback {Function}
460
- * @param callback.err {Error|null} - the Error if the async method has failed
461
- * @param callback.response {ModifySubscriptionResponse} - the response
462
- */
463
- modifySubscription(options: ModifySubscriptionRequestLike, callback?: ResponseCallback<ModifySubscriptionResponse>): any;
464
- setMonitoringMode(options: SetMonitoringModeRequestLike, callback?: ResponseCallback<SetMonitoringModeResponse>): any;
465
- /**
466
- *
467
- * @method publish
468
- * @async
469
- * @param options {PublishRequest}
470
- * @param callback {Function}
471
- * @param callback.err {Error|null} - the Error if the async method has failed
472
- * @param callback.response {PublishResponse} - the response
473
- */
474
- publish(options: PublishRequest, callback: (err: Error | null, response?: PublishResponse) => void): void;
475
- /**
476
- *
477
- * @method republish
478
- * @async
479
- * @param options {RepublishRequest}
480
- * @param callback the callback
481
- */
482
- republish(options: RepublishRequest, callback: (err: Error | null, response?: RepublishResponse) => void): void;
483
- /**
484
- *
485
- * @method deleteMonitoredItems
486
- * @async
487
- * @param options {DeleteMonitoredItemsRequest}
488
- * @param callback {Function}
489
- * @param callback.err {Error|null} - the Error if the async method has failed
490
- */
491
- deleteMonitoredItems(options: DeleteMonitoredItemsRequestLike, callback: (err: Error | null, response?: DeleteMonitoredItemsResponse) => void): void;
492
- /**
493
- *
494
- * @method setPublishingMode
495
- * @async
496
- */
497
- setPublishingMode(publishingEnabled: boolean, subscriptionId: SubscriptionId): Promise<StatusCode>;
498
- setPublishingMode(publishingEnabled: boolean, subscriptionIds: SubscriptionId[]): Promise<StatusCode[]>;
499
- setPublishingMode(publishingEnabled: boolean, subscriptionId: SubscriptionId, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
500
- setPublishingMode(publishingEnabled: boolean, subscriptionIds: SubscriptionId[], callback: (err: Error | null, statusCodes?: StatusCode[]) => void): void;
501
- /**
502
- *
503
- * @method translateBrowsePath
504
- * @async
505
- * @param browsePath {BrowsePath|Array<BrowsePath>}
506
- * @param callback {Function}
507
- * @param callback.err {Error|null}
508
- * @param callback.response {BrowsePathResult|Array<BrowsePathResult>}
509
- *
510
- *
511
- *
512
- */
513
- translateBrowsePath(browsePath: BrowsePath, callback: ResponseCallback<BrowsePathResult>): void;
514
- translateBrowsePath(browsesPath: BrowsePath[], callback: ResponseCallback<BrowsePathResult[]>): void;
515
- translateBrowsePath(browsePath: BrowsePath): Promise<BrowsePathResult>;
516
- translateBrowsePath(browsePaths: BrowsePath[]): Promise<BrowsePathResult[]>;
517
- channelId(): number;
518
- isChannelValid(): boolean;
519
- performMessageTransaction(request: Request, callback: (err: Error | null, response?: Response) => void): void;
520
- processTransactionQueue: (request: Request, callback: (err: Error | null, response?: Response | undefined) => void) => void;
521
- _performMessageTransaction(request: Request, callback: (err: Error | null, response?: Response) => void): void;
522
- /**
523
- * evaluate the remaining time for the session
524
- *
525
- *
526
- * evaluate the time in milliseconds that the session will live
527
- * on the server end from now.
528
- * The remaining live time is calculated based on when the last message was sent to the server
529
- * and the session timeout.
530
- *
531
- * * In normal operation , when server and client communicates on a regular
532
- * basis, evaluateRemainingLifetime will return a number slightly below
533
- * session.timeout
534
- *
535
- * * when the client and server cannot communicate due to a network issue
536
- * (or a server crash), evaluateRemainingLifetime returns the estimated number
537
- * of milliseconds before the server (if not crash) will keep the session alive
538
- * on its end to allow a automatic reconnection with session.
539
- *
540
- * * When evaluateRemainingLifetime returns zero , this mean that
541
- * the session has probably ended on the server side and will have to be recreated
542
- * from scratch in case of a reconnection.
543
- *
544
- * @return the number of milliseconds before session expires
545
- */
546
- evaluateRemainingLifetime(): number;
547
- _terminatePublishEngine(): void;
548
- /**
549
- *
550
- * @method close
551
- * @async
552
- * @param [deleteSubscription=true] {Boolean}
553
- * @param callback {Function}
554
- */
555
- close(callback: ErrorCallback): void;
556
- close(deleteSubscription: boolean, callback: ErrorCallback): void;
557
- close(deleteSubscription?: boolean): Promise<void>;
558
- /**
559
- * @method hasBeenClosed
560
- * @return {Boolean}
561
- */
562
- hasBeenClosed(): boolean;
563
- call(methodToCall: CallMethodRequestLike): Promise<CallMethodResult>;
564
- call(methodToCall: CallMethodRequestLike[]): Promise<CallMethodResult[]>;
565
- call(methodToCall: CallMethodRequestLike, callback: ResponseCallback<CallMethodResult>): void;
566
- call(methodsToCall: CallMethodRequestLike[], callback: ResponseCallback<CallMethodResult[]>): void;
567
- /**
568
- * @method getMonitoredItems
569
- * @param subscriptionId {UInt32} the subscription Id to return
570
- * @param callback {Function}
571
- * @param callback.err {Error}
572
- * @param callback.monitoredItems the monitored Items
573
- * @param callback.monitoredItems the monitored Items
574
- */
575
- getMonitoredItems(subscriptionId: SubscriptionId): Promise<MonitoredItemData>;
576
- getMonitoredItems(subscriptionId: SubscriptionId, callback: ResponseCallback<MonitoredItemData>): void;
577
- /**
578
- * @method getArgumentDefinition
579
- * extract the argument definition of a method
580
- * @param methodId the method nodeId to get argument definition from
581
- * @async
582
- *
583
- */
584
- getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>;
585
- getArgumentDefinition(methodId: MethodId, callback: ResponseCallback<ArgumentDefinition>): void;
586
- registerNodes(nodesToRegister: NodeIdLike[]): Promise<NodeId[]>;
587
- registerNodes(nodesToRegister: NodeIdLike[], callback: (err: Error | null, registeredNodeIds?: NodeId[]) => void): void;
588
- unregisterNodes(nodesToUnregister: NodeIdLike[]): Promise<void>;
589
- unregisterNodes(nodesToUnregister: NodeIdLike[], callback: (err?: Error) => void): void;
590
- queryFirst(queryFirstRequest: QueryFirstRequestLike): Promise<QueryFirstResponse>;
591
- queryFirst(queryFirstRequest: QueryFirstRequestLike, callback: ResponseCallback<QueryFirstResponse>): void;
592
- startKeepAliveManager(): void;
593
- stopKeepAliveManager(): void;
594
- dispose(): void;
595
- toString(): string;
596
- getBuiltInDataType(...args: any[]): any;
597
- resumePublishEngine(): void;
598
- readNamespaceArray(): Promise<string[]>;
599
- readNamespaceArray(callback: (err: Error | null, namespaceArray?: string[]) => void): void;
600
- getNamespaceIndex(namespaceUri: string): number;
601
- disableCondition(): void;
602
- enableCondition(): void;
603
- addCommentCondition(_conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
604
- confirmCondition(_conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
605
- acknowledgeCondition(_conditionId: NodeId, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
606
- findMethodId(_nodeId: NodeIdLike, _methodName: string, _callback?: ResponseCallback<NodeId>): any;
607
- _callMethodCondition(_methodName: string, _conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback: Callback<StatusCode>): void;
608
- extractNamespaceDataType(): Promise<ExtraDataTypeManager>;
609
- getExtensionObjectConstructor(dataTypeNodeId: NodeId): Promise<AnyConstructorFunc>;
610
- /**
611
- *
612
- * @param dataType
613
- * @param pojo
614
- * @async
615
- */
616
- constructExtensionObject(dataType: NodeId, pojo: Record<string, any>): Promise<ExtensionObject>;
617
- private _defaultRequest;
618
- private recreate_session_and_reperform_transaction;
619
- }
620
- export {};
1
+ /// <reference types="node" />
2
+ /**
3
+ * @module node-opcua-client-private
4
+ */
5
+ import { EventEmitter } from "events";
6
+ import { AggregateFunction } from "node-opcua-constants";
7
+ import { DateTime } from "node-opcua-basic-types";
8
+ import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
9
+ import { Certificate, Nonce } from "node-opcua-crypto";
10
+ import { LocalizedTextLike } from "node-opcua-data-model";
11
+ import { DataValue } from "node-opcua-data-value";
12
+ import { ExtensionObject } from "node-opcua-extension-object";
13
+ import { NodeId, NodeIdLike } from "node-opcua-nodeid";
14
+ import { AnyConstructorFunc } from "node-opcua-schemas";
15
+ import { SignatureData } from "node-opcua-secure-channel";
16
+ import { BrowseResult } from "node-opcua-service-browse";
17
+ import { CallMethodResult } from "node-opcua-service-call";
18
+ import { EndpointDescription } from "node-opcua-service-endpoints";
19
+ import { HistoryReadRequest, HistoryReadResponse, HistoryReadResult } from "node-opcua-service-history";
20
+ import { QueryFirstResponse } from "node-opcua-service-query";
21
+ import { ReadValueIdOptions } from "node-opcua-service-read";
22
+ import { CreateMonitoredItemsResponse, CreateSubscriptionResponse, DeleteMonitoredItemsResponse, DeleteSubscriptionsResponse, ModifyMonitoredItemsResponse, ModifySubscriptionResponse, PublishRequest, PublishResponse, RepublishRequest, RepublishResponse, SetMonitoringModeResponse, SetTriggeringRequestOptions, SetTriggeringResponse, TransferSubscriptionsResponse } from "node-opcua-service-subscription";
23
+ import { BrowsePath, BrowsePathResult } from "node-opcua-service-translate-browse-path";
24
+ import { StatusCode, Callback } from "node-opcua-status-code";
25
+ import { ErrorCallback } from "node-opcua-status-code";
26
+ import { HistoryReadValueIdOptions, WriteValueOptions } from "node-opcua-types";
27
+ import { VariantLike } from "node-opcua-variant";
28
+ import { ArgumentDefinition, BrowseDescriptionLike, CallMethodRequestLike, ClientSession, CreateMonitoredItemsRequestLike, CreateSubscriptionRequestLike, DeleteMonitoredItemsRequestLike, DeleteSubscriptionsRequestLike, MethodId, ModifyMonitoredItemsRequestLike, ModifySubscriptionRequestLike, MonitoredItemData, NodeAttributes, QueryFirstRequestLike, SetMonitoringModeRequestLike, SubscriptionId, TransferSubscriptionsRequestLike, HistoryReadValueIdOptions2, ExtraReadHistoryValueParameters } from "../client_session";
29
+ import { ClientSubscription } from "../client_subscription";
30
+ import { Request, Response } from "../common";
31
+ import { ClientSidePublishEngine } from "./client_publish_engine";
32
+ import { IClientBase } from "./i_private_client";
33
+ export declare type ResponseCallback<T> = (err: Error | null, response?: T) => void;
34
+ declare type EmptyCallback = (err?: Error) => void;
35
+ export interface Reconnectable {
36
+ _reconnecting: {
37
+ reconnecting: boolean;
38
+ pendingCallbacks: EmptyCallback[];
39
+ };
40
+ pendingTransactions: any[];
41
+ pendingTransactionsCount: number;
42
+ }
43
+ /**
44
+ * @class ClientSession
45
+ * @param client {OPCUAClientImpl}
46
+ * @constructor
47
+ * @private
48
+ */
49
+ export declare class ClientSessionImpl extends EventEmitter implements ClientSession {
50
+ timeout: number;
51
+ authenticationToken?: NodeId;
52
+ requestedMaxReferencesPerNode: number;
53
+ sessionId: NodeId;
54
+ lastRequestSentTime: Date;
55
+ lastResponseReceivedTime: Date;
56
+ serverCertificate: Certificate;
57
+ name: string;
58
+ serverNonce?: Nonce;
59
+ serverSignature?: SignatureData;
60
+ serverEndpoints: any[];
61
+ _client: IClientBase | null;
62
+ _closed: boolean;
63
+ private _reconnecting;
64
+ /**
65
+ * @internal
66
+ */
67
+ _closeEventHasBeenEmitted: boolean;
68
+ private _publishEngine;
69
+ private _keepAliveManager?;
70
+ private _namespaceArray?;
71
+ private recursive_repair_detector;
72
+ constructor(client: IClientBase);
73
+ /**
74
+ * the endpoint on which this session is operating
75
+ * @property endpoint
76
+ * @type {EndpointDescription}
77
+ */
78
+ get endpoint(): EndpointDescription;
79
+ get subscriptionCount(): number;
80
+ get isReconnecting(): boolean;
81
+ getPublishEngine(): ClientSidePublishEngine;
82
+ /**
83
+ * @method browse
84
+ * @async
85
+ *
86
+ * @example
87
+ *
88
+ * ```javascript
89
+ * session.browse("RootFolder",function(err,browseResult) {
90
+ * if(err) return callback(err);
91
+ * console.log(browseResult.toString());
92
+ * callback();
93
+ * } );
94
+ * ```
95
+ *
96
+ *
97
+ * @example
98
+ *
99
+ * ``` javascript
100
+ * const browseDescription = {
101
+ * nodeId: "ObjectsFolder",
102
+ * referenceTypeId: "Organizes",
103
+ * browseDirection: BrowseDirection.Inverse,
104
+ * includeSubtypes: true,
105
+ * nodeClassMask: 0,
106
+ * resultMask: 63
107
+ * }
108
+ * session.browse(browseDescription,function(err, browseResult) {
109
+ * if(err) return callback(err);
110
+ * console.log(browseResult.toString());
111
+ * callback();
112
+ * });
113
+ * ```
114
+ * @example
115
+ *
116
+ * ``` javascript
117
+ * session.browse([ "RootFolder", "ObjectsFolder"],function(err, browseResults) {
118
+ * assert(browseResults.length === 2);
119
+ * });
120
+ * ```
121
+ *
122
+ * @example
123
+ * ``` javascript
124
+ * const browseDescriptions = [
125
+ * {
126
+ * nodeId: "ObjectsFolder",
127
+ * referenceTypeId: "Organizes",
128
+ * browseDirection: BrowseDirection.Inverse,
129
+ * includeSubtypes: true,
130
+ * nodeClassMask: 0,
131
+ * resultMask: 63
132
+ * },
133
+ * // {...}
134
+ * ]
135
+ * session.browse(browseDescriptions,function(err, browseResults) {
136
+ *
137
+ * });
138
+ * ```
139
+ *
140
+ *
141
+ */
142
+ browse(nodeToBrowse: BrowseDescriptionLike, callback: ResponseCallback<BrowseResult>): void;
143
+ browse(nodesToBrowse: BrowseDescriptionLike[], callback: ResponseCallback<BrowseResult[]>): void;
144
+ browse(nodeToBrowse: BrowseDescriptionLike): Promise<BrowseResult>;
145
+ browse(nodesToBrowse: BrowseDescriptionLike[]): Promise<BrowseResult[]>;
146
+ browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult>): void;
147
+ browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult[]>): void;
148
+ browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean): Promise<BrowseResult>;
149
+ browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean): Promise<BrowseResult[]>;
150
+ /**
151
+ * @method readVariableValue
152
+ * @async
153
+ *
154
+ * @example
155
+ *
156
+ * ```javascript
157
+ * session.readVariableValue("ns=2;s=Furnace_1.Temperature",function(err,dataValue) {
158
+ * if(err) { return callback(err); }
159
+ * if (dataValue.statusCode === opcua.StatusCodes.Good) {
160
+ * }
161
+ * console.log(dataValue.toString());
162
+ * callback();
163
+ * });
164
+ * ```
165
+ *
166
+ * @example
167
+ *
168
+ * ```javascript
169
+ * session.readVariableValue(["ns=0;i=2257","ns=0;i=2258"],function(err,dataValues) {
170
+ * if (!err) {
171
+ * console.log(dataValues[0].toString());
172
+ * console.log(dataValues[1].toString());
173
+ * }
174
+ * });
175
+ * ```
176
+ *
177
+ * @example
178
+ * ```javascript
179
+ * const dataValues = await session.readVariableValue(["ns=1;s=Temperature","ns=1;s=Pressure"]);
180
+ * ```
181
+ */
182
+ readVariableValue(nodeId: NodeIdLike, callback: ResponseCallback<DataValue>): void;
183
+ readVariableValue(nodeIds: NodeIdLike[], callback: ResponseCallback<DataValue[]>): void;
184
+ readVariableValue(nodeId: NodeIdLike): Promise<DataValue>;
185
+ readVariableValue(nodeIds: NodeIdLike[]): Promise<DataValue[]>;
186
+ /**
187
+ * @method readHistoryValue
188
+ * @async
189
+ *
190
+ * @example
191
+ *
192
+ * ```javascript
193
+ * // es5
194
+ * session.readHistoryValue(
195
+ * "ns=5;s=Simulation Examples.Functions.Sine1",
196
+ * "2015-06-10T09:00:00.000Z",
197
+ * "2015-06-10T09:01:00.000Z", function(err,dataValues) {
198
+ *
199
+ * });
200
+ * ```
201
+ *
202
+ * ```javascript
203
+ * // es6
204
+ * const dataValues = await session.readHistoryValue(
205
+ * "ns=5;s=Simulation Examples.Functions.Sine1",
206
+ * "2015-06-10T09:00:00.000Z",
207
+ * "2015-06-10T09:01:00.000Z");
208
+ * ```
209
+ * @param nodeToRead the read value id
210
+ * @param start the start time in UTC format
211
+ * @param end the end time in UTC format
212
+ * @param callback
213
+ */
214
+ readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
215
+ readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
216
+ readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options?: ExtraReadHistoryValueParameters): Promise<HistoryReadResult[]>;
217
+ readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, callback: (err: Error | null, results?: HistoryReadResult) => void): void;
218
+ readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, results?: HistoryReadResult) => void): void;
219
+ readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, parameters: ExtraReadHistoryValueParameters): Promise<HistoryReadResult>;
220
+ historyRead(request: HistoryReadRequest, callback: Callback<HistoryReadResponse>): void;
221
+ historyRead(request: HistoryReadRequest): Promise<HistoryReadResponse>;
222
+ readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number, callback: Callback<HistoryReadResult[]>): void;
223
+ readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number): Promise<HistoryReadResult[]>;
224
+ readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number, callback: Callback<HistoryReadResult>): void;
225
+ readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number): Promise<HistoryReadResult>;
226
+ /**
227
+ *
228
+ * @method write
229
+ * @param nodesToWrite {WriteValue[]} - the array of value to write. One or more elements.
230
+ * @param {Function} callback - the callback function
231
+ * @param callback.err {object|null} the error if write has failed or null if OK
232
+ * @param callback.statusCodes {StatusCode[]} - an array of status code of each write
233
+ * @async
234
+ *
235
+ * @example
236
+ *
237
+ * const nodesToWrite = [
238
+ * {
239
+ * nodeId: "ns=1;s=SetPoint1",
240
+ * attributeId: opcua.AttributeIds.Value,
241
+ * value: {
242
+ * statusCode: Good,
243
+ * value: {
244
+ * dataType: opcua.DataType.Double,
245
+ * value: 100.0
246
+ * }
247
+ * }
248
+ * },
249
+ * {
250
+ * nodeId: "ns=1;s=SetPoint2",
251
+ * attributeIds opcua.AttributeIds.Value,
252
+ * value: {
253
+ * statusCode: Good,
254
+ * value: {
255
+ * dataType: opcua.DataType.Double,
256
+ * value: 45.0
257
+ * }
258
+ * }
259
+ * }
260
+ * ];
261
+ * session.write(nodesToWrite,function (err,statusCodes) {
262
+ * if(err) { return callback(err);}
263
+ * //
264
+ * });
265
+ *
266
+ * @method write
267
+ * @param nodeToWrite {WriteValue} - the value to write
268
+ * @param callback - the callback function
269
+ * @param callback.err {object|null} the error if write has failed or null if OK
270
+ * @param callback.statusCode {StatusCodes} - the status code of the write
271
+ * @async
272
+ *
273
+ * @example
274
+ *
275
+ * const nodeToWrite = {
276
+ * nodeId: "ns=1;s=SetPoint",
277
+ * attributeId: opcua.AttributeIds.Value,
278
+ * value: {
279
+ * statusCode: Good,
280
+ * value: {
281
+ * dataType: opcua.DataType.Double,
282
+ * value: 100.0
283
+ * }
284
+ * }
285
+ * };
286
+ * session.write(nodeToWrite,function (err,statusCode) {
287
+ * if(err) { return callback(err);}
288
+ * //
289
+ * });
290
+ *
291
+ *
292
+ * @method write
293
+ * @param nodeToWrite {WriteValue} - the value to write
294
+ * @return {Promise<StatusCode>}
295
+ * @async
296
+ *
297
+ * @example
298
+ *
299
+ * ```javascript
300
+ * session.write(nodeToWrite).then(function(statusCode) { });
301
+ * ```
302
+ *
303
+ * @example
304
+ *
305
+ * ```javascript
306
+ * const statusCode = await session.write(nodeToWrite);
307
+ * ```
308
+ *
309
+ * @method write
310
+ * @param nodesToWrite {Array<WriteValue>} - the value to write
311
+ * @return {Promise<Array<StatusCode>>}
312
+ * @async
313
+ *
314
+ * @example
315
+ * ```javascript
316
+ * session.write(nodesToWrite).then(function(statusCodes) { });
317
+ * ```
318
+ *
319
+ * @example
320
+ * ```javascript
321
+ * const statusCodes = await session.write(nodesToWrite);
322
+ * ```
323
+ */
324
+ write(nodeToWrite: WriteValueOptions, callback: ResponseCallback<StatusCode>): void;
325
+ write(nodesToWrite: WriteValueOptions[], callback: ResponseCallback<StatusCode[]>): void;
326
+ write(nodesToWrite: WriteValueOptions[]): Promise<StatusCode[]>;
327
+ write(nodeToWrite: WriteValueOptions): Promise<StatusCode>;
328
+ /**
329
+ *
330
+ * @method writeSingleNode
331
+ * @async
332
+ * @param nodeId {NodeId} - the node id of the node to write
333
+ * @param value {Variant} - the value to write
334
+ * @param callback {Function}
335
+ * @param callback.err {object|null} the error if write has failed or null if OK
336
+ * @param callback.statusCode {StatusCode} - the status code of the write
337
+ *
338
+ * @method writeSingleNode
339
+ * @async
340
+ * @param nodeId {NodeId} - the node id of the node to write
341
+ * @param value {Variant} - the value to write
342
+ * @return {Promise<StatusCode>} - the status code of the write
343
+ *
344
+ * @deprecated
345
+ */
346
+ writeSingleNode(nodeId: NodeIdLike, value: VariantLike, callback: ResponseCallback<StatusCode>): void;
347
+ writeSingleNode(nodeId: NodeIdLike, value: VariantLike): Promise<StatusCode>;
348
+ /**
349
+ * @method readAllAttributes
350
+ *
351
+ * @example
352
+ *
353
+ *
354
+ * ``` javascript
355
+ * session.readAllAttributes("ns=2;s=Furnace_1.Temperature",function(err,data) {
356
+ * if(data.statusCode === StatusCodes.Good) {
357
+ * console.log(" nodeId = ",data.nodeId.toString());
358
+ * console.log(" browseName = ",data.browseName.toString());
359
+ * console.log(" description = ",data.description.toString());
360
+ * console.log(" value = ",data.value.toString()));
361
+ * }
362
+ * });
363
+ * ```
364
+ *
365
+ * @async
366
+ * @param nodes array of nodeId to read
367
+ * @param node nodeId to read
368
+ * @param callback
369
+ */
370
+ readAllAttributes(node: NodeIdLike, callback: (err: Error | null, data?: NodeAttributes) => void): void;
371
+ readAllAttributes(nodes: NodeIdLike[], callback: (err: Error | null, data?: NodeAttributes[]) => void): void;
372
+ /**
373
+ * @method read (form1)
374
+ *
375
+ * @async
376
+ *
377
+ * @example
378
+ *
379
+ * ```javascript
380
+ * ```
381
+ *
382
+ * form1: reading a single node
383
+ *
384
+ * ``` javascript
385
+ * const nodeToRead = {
386
+ * nodeId: "ns=2;s=Furnace_1.Temperature",
387
+ * attributeId: AttributeIds.BrowseName
388
+ * };
389
+ *
390
+ * session.read(nodeToRead,function(err,dataValue) {
391
+ * if (!err) {
392
+ * console.log(dataValue.toString());
393
+ * }
394
+ * });
395
+ * ```
396
+ *
397
+ *
398
+ * @method read (form2)
399
+ * @param nodesToRead {Array<ReadValueId>} - an array of nodeId to read or a ReadValueId
400
+ * @param [maxAge] {Number}
401
+ * @param callback {Function} - the callback function
402
+ * @param callback.err {Error|null} - the error or null if the transaction was OK}
403
+ * @param callback.dataValues {Array<DataValue>}
404
+ * @async
405
+ *
406
+ * @example
407
+ *
408
+ * ``` javascript
409
+ * const nodesToRead = [
410
+ * {
411
+ * nodeId: "ns=2;s=Furnace_1.Temperature",
412
+ * attributeId: AttributeIds.BrowseName
413
+ * }
414
+ * ];
415
+ * session.read(nodesToRead,function(err,dataValues) {
416
+ * if (!err) {
417
+ * dataValues.forEach(dataValue=>console.log(dataValue.toString()));
418
+ * }
419
+ * });
420
+ * ```
421
+ *
422
+ */
423
+ read(nodeToRead: ReadValueIdOptions, maxAge: number, callback: ResponseCallback<DataValue>): void;
424
+ read(nodesToRead: ReadValueIdOptions[], maxAge: number, callback: ResponseCallback<DataValue[]>): void;
425
+ read(nodeToRead: ReadValueIdOptions, callback: ResponseCallback<DataValue>): void;
426
+ read(nodesToRead: ReadValueIdOptions[], callback: ResponseCallback<DataValue[]>): void;
427
+ read(nodeToRead: ReadValueIdOptions, maxAge?: number): Promise<DataValue>;
428
+ read(nodeToRead: ReadValueIdOptions[], maxAge?: number): Promise<DataValue[]>;
429
+ emitCloseEvent(statusCode: StatusCode): void;
430
+ createSubscription(options: CreateSubscriptionRequestLike, callback?: ResponseCallback<CreateSubscriptionResponse>): any;
431
+ /**
432
+ * @method createSubscription2
433
+ * @param createSubscriptionRequest
434
+ * @param callback
435
+ *
436
+ *
437
+ * subscription.on("error', function(err){ ... });
438
+ * subscription.on("terminate',function(err){ ... });
439
+ * const monitoredItem = await subscription.monitor(itemToMonitor,monitoringParameters,requestedParameters);
440
+ * monitoredItem.on("changed",function( dataValue) {...});
441
+ *
442
+ */
443
+ createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike): Promise<ClientSubscription>;
444
+ createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike, callback: (err: Error | null, subscription?: ClientSubscription) => void): void;
445
+ deleteSubscriptions(options: DeleteSubscriptionsRequestLike, callback?: ResponseCallback<DeleteSubscriptionsResponse>): any;
446
+ setTriggering(request: SetTriggeringRequestOptions, callback?: ResponseCallback<SetTriggeringResponse>): any;
447
+ /**
448
+ * @method transferSubscriptions
449
+ * @async
450
+ */
451
+ transferSubscriptions(options: TransferSubscriptionsRequestLike, callback?: ResponseCallback<TransferSubscriptionsResponse>): any;
452
+ createMonitoredItems(options: CreateMonitoredItemsRequestLike, callback?: ResponseCallback<CreateMonitoredItemsResponse>): any;
453
+ modifyMonitoredItems(options: ModifyMonitoredItemsRequestLike, callback?: ResponseCallback<ModifyMonitoredItemsResponse>): any;
454
+ /**
455
+ *
456
+ * @method modifySubscription
457
+ * @async
458
+ * @param options {ModifySubscriptionRequest}
459
+ * @param callback {Function}
460
+ * @param callback.err {Error|null} - the Error if the async method has failed
461
+ * @param callback.response {ModifySubscriptionResponse} - the response
462
+ */
463
+ modifySubscription(options: ModifySubscriptionRequestLike, callback?: ResponseCallback<ModifySubscriptionResponse>): any;
464
+ setMonitoringMode(options: SetMonitoringModeRequestLike, callback?: ResponseCallback<SetMonitoringModeResponse>): any;
465
+ /**
466
+ *
467
+ * @method publish
468
+ * @async
469
+ * @param options {PublishRequest}
470
+ * @param callback {Function}
471
+ * @param callback.err {Error|null} - the Error if the async method has failed
472
+ * @param callback.response {PublishResponse} - the response
473
+ */
474
+ publish(options: PublishRequest, callback: (err: Error | null, response?: PublishResponse) => void): void;
475
+ /**
476
+ *
477
+ * @method republish
478
+ * @async
479
+ * @param options {RepublishRequest}
480
+ * @param callback the callback
481
+ */
482
+ republish(options: RepublishRequest, callback: (err: Error | null, response?: RepublishResponse) => void): void;
483
+ /**
484
+ *
485
+ * @method deleteMonitoredItems
486
+ * @async
487
+ * @param options {DeleteMonitoredItemsRequest}
488
+ * @param callback {Function}
489
+ * @param callback.err {Error|null} - the Error if the async method has failed
490
+ */
491
+ deleteMonitoredItems(options: DeleteMonitoredItemsRequestLike, callback: (err: Error | null, response?: DeleteMonitoredItemsResponse) => void): void;
492
+ /**
493
+ *
494
+ * @method setPublishingMode
495
+ * @async
496
+ */
497
+ setPublishingMode(publishingEnabled: boolean, subscriptionId: SubscriptionId): Promise<StatusCode>;
498
+ setPublishingMode(publishingEnabled: boolean, subscriptionIds: SubscriptionId[]): Promise<StatusCode[]>;
499
+ setPublishingMode(publishingEnabled: boolean, subscriptionId: SubscriptionId, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
500
+ setPublishingMode(publishingEnabled: boolean, subscriptionIds: SubscriptionId[], callback: (err: Error | null, statusCodes?: StatusCode[]) => void): void;
501
+ /**
502
+ *
503
+ * @method translateBrowsePath
504
+ * @async
505
+ * @param browsePath {BrowsePath|Array<BrowsePath>}
506
+ * @param callback {Function}
507
+ * @param callback.err {Error|null}
508
+ * @param callback.response {BrowsePathResult|Array<BrowsePathResult>}
509
+ *
510
+ *
511
+ *
512
+ */
513
+ translateBrowsePath(browsePath: BrowsePath, callback: ResponseCallback<BrowsePathResult>): void;
514
+ translateBrowsePath(browsesPath: BrowsePath[], callback: ResponseCallback<BrowsePathResult[]>): void;
515
+ translateBrowsePath(browsePath: BrowsePath): Promise<BrowsePathResult>;
516
+ translateBrowsePath(browsePaths: BrowsePath[]): Promise<BrowsePathResult[]>;
517
+ channelId(): number;
518
+ isChannelValid(): boolean;
519
+ performMessageTransaction(request: Request, callback: (err: Error | null, response?: Response) => void): void;
520
+ processTransactionQueue: (request: Request, callback: (err: Error | null, response?: Response | undefined) => void) => void;
521
+ _performMessageTransaction(request: Request, callback: (err: Error | null, response?: Response) => void): void;
522
+ /**
523
+ * evaluate the remaining time for the session
524
+ *
525
+ *
526
+ * evaluate the time in milliseconds that the session will live
527
+ * on the server end from now.
528
+ * The remaining live time is calculated based on when the last message was sent to the server
529
+ * and the session timeout.
530
+ *
531
+ * * In normal operation , when server and client communicates on a regular
532
+ * basis, evaluateRemainingLifetime will return a number slightly below
533
+ * session.timeout
534
+ *
535
+ * * when the client and server cannot communicate due to a network issue
536
+ * (or a server crash), evaluateRemainingLifetime returns the estimated number
537
+ * of milliseconds before the server (if not crash) will keep the session alive
538
+ * on its end to allow a automatic reconnection with session.
539
+ *
540
+ * * When evaluateRemainingLifetime returns zero , this mean that
541
+ * the session has probably ended on the server side and will have to be recreated
542
+ * from scratch in case of a reconnection.
543
+ *
544
+ * @return the number of milliseconds before session expires
545
+ */
546
+ evaluateRemainingLifetime(): number;
547
+ _terminatePublishEngine(): void;
548
+ /**
549
+ *
550
+ * @method close
551
+ * @async
552
+ * @param [deleteSubscription=true] {Boolean}
553
+ * @param callback {Function}
554
+ */
555
+ close(callback: ErrorCallback): void;
556
+ close(deleteSubscription: boolean, callback: ErrorCallback): void;
557
+ close(deleteSubscription?: boolean): Promise<void>;
558
+ /**
559
+ * @method hasBeenClosed
560
+ * @return {Boolean}
561
+ */
562
+ hasBeenClosed(): boolean;
563
+ call(methodToCall: CallMethodRequestLike): Promise<CallMethodResult>;
564
+ call(methodToCall: CallMethodRequestLike[]): Promise<CallMethodResult[]>;
565
+ call(methodToCall: CallMethodRequestLike, callback: ResponseCallback<CallMethodResult>): void;
566
+ call(methodsToCall: CallMethodRequestLike[], callback: ResponseCallback<CallMethodResult[]>): void;
567
+ /**
568
+ * @method getMonitoredItems
569
+ * @param subscriptionId {UInt32} the subscription Id to return
570
+ * @param callback {Function}
571
+ * @param callback.err {Error}
572
+ * @param callback.monitoredItems the monitored Items
573
+ * @param callback.monitoredItems the monitored Items
574
+ */
575
+ getMonitoredItems(subscriptionId: SubscriptionId): Promise<MonitoredItemData>;
576
+ getMonitoredItems(subscriptionId: SubscriptionId, callback: ResponseCallback<MonitoredItemData>): void;
577
+ /**
578
+ * @method getArgumentDefinition
579
+ * extract the argument definition of a method
580
+ * @param methodId the method nodeId to get argument definition from
581
+ * @async
582
+ *
583
+ */
584
+ getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>;
585
+ getArgumentDefinition(methodId: MethodId, callback: ResponseCallback<ArgumentDefinition>): void;
586
+ registerNodes(nodesToRegister: NodeIdLike[]): Promise<NodeId[]>;
587
+ registerNodes(nodesToRegister: NodeIdLike[], callback: (err: Error | null, registeredNodeIds?: NodeId[]) => void): void;
588
+ unregisterNodes(nodesToUnregister: NodeIdLike[]): Promise<void>;
589
+ unregisterNodes(nodesToUnregister: NodeIdLike[], callback: (err?: Error) => void): void;
590
+ queryFirst(queryFirstRequest: QueryFirstRequestLike): Promise<QueryFirstResponse>;
591
+ queryFirst(queryFirstRequest: QueryFirstRequestLike, callback: ResponseCallback<QueryFirstResponse>): void;
592
+ startKeepAliveManager(): void;
593
+ stopKeepAliveManager(): void;
594
+ dispose(): void;
595
+ toString(): string;
596
+ getBuiltInDataType(...args: any[]): any;
597
+ resumePublishEngine(): void;
598
+ readNamespaceArray(): Promise<string[]>;
599
+ readNamespaceArray(callback: (err: Error | null, namespaceArray?: string[]) => void): void;
600
+ getNamespaceIndex(namespaceUri: string): number;
601
+ disableCondition(): void;
602
+ enableCondition(): void;
603
+ addCommentCondition(_conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
604
+ confirmCondition(_conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
605
+ acknowledgeCondition(_conditionId: NodeId, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
606
+ findMethodId(_nodeId: NodeIdLike, _methodName: string, _callback?: ResponseCallback<NodeId>): any;
607
+ _callMethodCondition(_methodName: string, _conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback: Callback<StatusCode>): void;
608
+ extractNamespaceDataType(): Promise<ExtraDataTypeManager>;
609
+ getExtensionObjectConstructor(dataTypeNodeId: NodeId): Promise<AnyConstructorFunc>;
610
+ /**
611
+ *
612
+ * @param dataType
613
+ * @param pojo
614
+ * @async
615
+ */
616
+ constructExtensionObject(dataType: NodeId, pojo: Record<string, any>): Promise<ExtensionObject>;
617
+ private _defaultRequest;
618
+ private recreate_session_and_reperform_transaction;
619
+ }
620
+ export {};