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