node-opcua-client 2.76.1 → 2.76.2

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 (68) hide show
  1. package/dist/alarms_and_conditions/client_alarm.d.ts +49 -49
  2. package/dist/alarms_and_conditions/client_alarm.js +109 -109
  3. package/dist/alarms_and_conditions/client_alarm_list.d.ts +25 -25
  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 +156 -156
  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 +192 -192
  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 +3 -3
  12. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +118 -118
  13. package/dist/alarms_and_conditions/client_tools.d.ts +7 -7
  14. package/dist/alarms_and_conditions/client_tools.js +180 -180
  15. package/dist/client_base.d.ts +277 -277
  16. package/dist/client_base.js +14 -14
  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 +485 -484
  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 +93 -93
  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 +157 -157
  40. package/dist/private/client_base_impl.js +1337 -1337
  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 +305 -305
  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 +621 -621
  50. package/dist/private/client_session_impl.js +1302 -1302
  51. package/dist/private/client_session_impl.js.map +1 -1
  52. package/dist/private/client_subscription_impl.d.ts +93 -93
  53. package/dist/private/client_subscription_impl.js +748 -748
  54. package/dist/private/i_private_client.d.ts +18 -18
  55. package/dist/private/i_private_client.js +2 -2
  56. package/dist/private/opcua_client_impl.d.ts +169 -169
  57. package/dist/private/opcua_client_impl.js +981 -981
  58. package/dist/reconnection.d.ts +9 -9
  59. package/dist/reconnection.js +408 -408
  60. package/dist/tools/findservers.d.ts +20 -20
  61. package/dist/tools/findservers.js +61 -61
  62. package/dist/tools/read_history_server_capabilities.d.ts +6 -6
  63. package/dist/tools/read_history_server_capabilities.js +99 -99
  64. package/dist/verify.d.ts +5 -5
  65. package/dist/verify.js +134 -134
  66. package/package.json +40 -40
  67. package/source/client_session.ts +1 -1
  68. package/source/private/client_session_impl.ts +1 -1
@@ -1,484 +1,485 @@
1
- /**
2
- * @module node-opcua-client
3
- */
4
- /// <reference types="node" />
5
- /// <reference types="node" />
6
- import { EventEmitter } from "events";
7
- import { DateTime, UInt8 } from "node-opcua-basic-types";
8
- import { ServerState } from "node-opcua-common";
9
- import { Certificate } from "node-opcua-crypto";
10
- import { LocalizedTextLike } from "node-opcua-data-model";
11
- import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
12
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
13
- import { IBasicSession } from "node-opcua-pseudo-session";
14
- import { ErrorCallback } from "node-opcua-status-code";
15
- import { BrowseDescriptionOptions, BrowseResult } from "node-opcua-service-browse";
16
- import { CallMethodResult } from "node-opcua-service-call";
17
- import { EndpointDescription } from "node-opcua-service-endpoints";
18
- import { HistoryReadResult } from "node-opcua-service-history";
19
- import { QueryFirstRequestOptions, QueryFirstResponse } from "node-opcua-service-query";
20
- import { ReadValueIdOptions } from "node-opcua-service-read";
21
- import { CreateMonitoredItemsRequestOptions, CreateMonitoredItemsResponse, CreateSubscriptionRequestOptions, CreateSubscriptionResponse, DeleteMonitoredItemsRequestOptions, DeleteMonitoredItemsResponse, DeleteSubscriptionsRequestOptions, DeleteSubscriptionsResponse, ModifyMonitoredItemsRequestOptions, ModifyMonitoredItemsResponse, ModifySubscriptionRequestOptions, ModifySubscriptionResponse, PublishRequest, PublishResponse, RepublishRequest, RepublishResponse, SetMonitoringModeRequestOptions, SetMonitoringModeResponse, TransferSubscriptionsRequestOptions, TransferSubscriptionsResponse, SetTriggeringResponse, SetTriggeringRequestOptions } from "node-opcua-service-subscription";
22
- import { BrowsePath, BrowsePathResult } from "node-opcua-service-translate-browse-path";
23
- import { WriteValueOptions } from "node-opcua-service-write";
24
- import { StatusCode } from "node-opcua-status-code";
25
- import { DataType, Variant } from "node-opcua-variant";
26
- import { Callback } from "node-opcua-status-code";
27
- import { ExtensionObject } from "node-opcua-extension-object";
28
- import { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
29
- import { AggregateFunction } from "node-opcua-constants";
30
- import { HistoryReadRequest, HistoryReadResponse, HistoryReadValueIdOptions } from "node-opcua-types";
31
- import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
32
- export { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
33
- export { ExtensionObject } from "node-opcua-extension-object";
34
- export { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
35
- import { ClientSubscription } from "./client_subscription";
36
- export declare type ResponseCallback<T> = (err: Error | null, response?: T) => void;
37
- export interface NodeAttributes {
38
- nodeId: NodeId;
39
- statusCode: StatusCode;
40
- [key: string]: Variant | NodeId | StatusCode;
41
- }
42
- export interface MonitoredItemData {
43
- clientHandles: Uint32Array;
44
- serverHandles: Uint32Array;
45
- }
46
- export interface CreateSubscriptionOptions {
47
- requestedPublishingInterval: number;
48
- requestedLifetimeCount: number;
49
- requestedMaxKeepAliveCount: number;
50
- maxNotificationsPerPublish?: number;
51
- publishingEnabled?: boolean;
52
- priority?: UInt8;
53
- }
54
- export declare type BrowseDescriptionLike = string | BrowseDescriptionOptions;
55
- export declare type DeleteMonitoredItemsRequestLike = DeleteMonitoredItemsRequestOptions;
56
- export declare type CreateSubscriptionRequestLike = CreateSubscriptionRequestOptions;
57
- export declare type DeleteSubscriptionsRequestLike = DeleteSubscriptionsRequestOptions;
58
- export declare type TransferSubscriptionsRequestLike = TransferSubscriptionsRequestOptions;
59
- export declare type CreateMonitoredItemsRequestLike = CreateMonitoredItemsRequestOptions;
60
- export declare type ModifyMonitoredItemsRequestLike = ModifyMonitoredItemsRequestOptions;
61
- export declare type ModifySubscriptionRequestLike = ModifySubscriptionRequestOptions;
62
- export declare type SetMonitoringModeRequestLike = SetMonitoringModeRequestOptions;
63
- export declare type QueryFirstRequestLike = QueryFirstRequestOptions;
64
- export declare type SubscriptionId = number;
65
- export interface ClientSessionBase {
66
- /** the session Id */
67
- timeout: number;
68
- authenticationToken?: NodeId;
69
- sessionId: NodeId;
70
- subscriptionCount: number;
71
- isReconnecting: boolean;
72
- endpoint: EndpointDescription;
73
- /**
74
- * the time of the latest request sent by the client to the server
75
- */
76
- lastRequestSentTime: Date;
77
- /**
78
- * the time of the latest response received by the client
79
- */
80
- lastResponseReceivedTime: Date;
81
- /**
82
- * the server certificate as provided by the server
83
- */
84
- serverCertificate: Certificate;
85
- /**
86
- * the session name
87
- */
88
- name: string;
89
- close(callback: ErrorCallback): void;
90
- close(deleteSubscription: boolean, callback: ErrorCallback): void;
91
- close(deleteSubscription?: boolean): Promise<void>;
92
- }
93
- export interface ClientSession extends ClientSessionBase {
94
- }
95
- export interface ClientSession extends EventEmitter {
96
- on(event: "keepalive", eventHandler: (lastKnownServerState: ServerState) => void): this;
97
- on(event: "keepalive_failure", eventHandler: (state: any) => void): this;
98
- on(event: "session_closed", eventHandler: (statusCode: StatusCode) => void): this;
99
- /**
100
- * session_restored is raised when the session and related subscription
101
- * have been fully repaired after a reconnection.
102
- */
103
- on(event: "session_restored", eventHandler: () => void): this;
104
- on(event: string | symbol, listener: (...args: any[]) => void): this;
105
- }
106
- export interface ClientSessionBrowseService {
107
- /**
108
- * the maximum number of reference that the server should return per browseResult
109
- * Continuous points will be return by server to allow retrieving remaining references
110
- * with browseNext
111
- */
112
- requestedMaxReferencesPerNode: number;
113
- browse(nodeToBrowse: BrowseDescriptionLike, callback: ResponseCallback<BrowseResult>): void;
114
- browse(nodesToBrowse: BrowseDescriptionLike[], callback: ResponseCallback<BrowseResult[]>): void;
115
- browse(nodeToBrowse: BrowseDescriptionLike): Promise<BrowseResult>;
116
- browse(nodesToBrowse: BrowseDescriptionLike[]): Promise<BrowseResult[]>;
117
- browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult>): void;
118
- browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult[]>): void;
119
- browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean): Promise<BrowseResult>;
120
- browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean): Promise<BrowseResult[]>;
121
- }
122
- export interface ClientSessionTranslateBrowsePathService {
123
- translateBrowsePath(browsesPath: BrowsePath[], callback: ResponseCallback<BrowsePathResult[]>): void;
124
- translateBrowsePath(browsePath: BrowsePath, callback: ResponseCallback<BrowsePathResult>): void;
125
- translateBrowsePath(browsePath: BrowsePath): Promise<BrowsePathResult>;
126
- translateBrowsePath(browsePaths: BrowsePath[]): Promise<BrowsePathResult[]>;
127
- }
128
- export interface ClientSessionQueryService {
129
- queryFirst(queryFirstRequest: QueryFirstRequestLike): Promise<QueryFirstResponse>;
130
- queryFirst(queryFirstRequest: QueryFirstRequestLike, callback: ResponseCallback<QueryFirstResponse>): void;
131
- }
132
- export interface ClientSessionCallService {
133
- /**
134
- *
135
- * @method call
136
- *
137
- * @param methodToCall {CallMethodRequest} the call method request
138
- * @param callback
139
- *
140
- * @example :
141
- *
142
- * ```javascript
143
- * const methodToCall = {
144
- * objectId: "ns=2;i=12",
145
- * methodId: "ns=2;i=13",
146
- * inputArguments: [
147
- * new Variant({...}),
148
- * new Variant({...}),
149
- * ]
150
- * }
151
- * session.call(methodToCall,function(err,callResult) {
152
- * if (!err) {
153
- * console.log(" statusCode = ",callResult.statusCode);
154
- * console.log(" inputArgumentResults[0] = ",callResult.inputArgumentResults[0].toString());
155
- * console.log(" inputArgumentResults[1] = ",callResult.inputArgumentResults[1].toString());
156
- * console.log(" outputArgument[0] = ",callResult.outputArgument[0].toString()); // array of variant
157
- * }
158
- * });
159
- * ```
160
- *
161
- * @method call
162
- *
163
- * @param methodsToCall {CallMethodRequest[]} the call method request array
164
- * @param callback
165
- *
166
- *
167
- * @example :
168
- *
169
- * ```javascript
170
- * const methodsToCall = [ {
171
- * objectId: "ns=2;i=12",
172
- * methodId: "ns=2;i=13",
173
- * inputArguments: [
174
- * new Variant({...}),
175
- * new Variant({...}),
176
- * ]
177
- * }];
178
- * session.call(methodsToCall,function(err,callResults) {
179
- * if (!err) {
180
- * const callResult = callResults[0];
181
- * console.log(" statusCode = ",rep.statusCode);
182
- * console.log(" inputArgumentResults[0] = ",callResult.inputArgumentResults[0].toString());
183
- * console.log(" inputArgumentResults[1] = ",callResult.inputArgumentResults[1].toString());
184
- * console.log(" outputArgument[0] = ",callResult.outputArgument[0].toString()); // array of variant
185
- * }
186
- * });
187
- * ```
188
- */
189
- call(methodToCall: CallMethodRequestLike, callback: (err: Error | null, result?: CallMethodResult) => void): void;
190
- call(methodsToCall: CallMethodRequestLike[], callback: (err: Error | null, results?: CallMethodResult[]) => void): void;
191
- call(methodToCall: CallMethodRequestLike): Promise<CallMethodResult>;
192
- call(methodsToCall: CallMethodRequestLike[]): Promise<CallMethodResult[]>;
193
- getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>;
194
- getArgumentDefinition(methodId: MethodId, callback: (err: Error | null, args?: ArgumentDefinition) => void): void;
195
- }
196
- export interface ClientSessionRegisterService {
197
- registerNodes(nodesToRegister: NodeIdLike[]): Promise<NodeId[]>;
198
- registerNodes(nodesToRegister: NodeIdLike[], callback: (err: Error | null, registeredNodeIds?: NodeId[]) => void): void;
199
- unregisterNodes(nodesToRegister: NodeIdLike[]): Promise<void>;
200
- unregisterNodes(nodesToRegister: NodeIdLike[], callback: (err?: Error) => void): void;
201
- }
202
- export interface ClientSessionReadService {
203
- read(nodeToRead: ReadValueIdOptions, maxAge: number, callback: ResponseCallback<DataValue>): void;
204
- read(nodesToRead: ReadValueIdOptions[], maxAge: number, callback: ResponseCallback<DataValue[]>): void;
205
- read(nodeToRead: ReadValueIdOptions, callback: ResponseCallback<DataValue>): void;
206
- read(nodesToRead: ReadValueIdOptions[], callback: ResponseCallback<DataValue[]>): void;
207
- read(nodeToRead: ReadValueIdOptions, maxAge?: number): Promise<DataValue>;
208
- read(nodesToRead: ReadValueIdOptions[], maxAge?: number): Promise<DataValue[]>;
209
- /**
210
- * @deprecated
211
- */
212
- readVariableValue(nodeId: NodeIdLike, callback: ResponseCallback<DataValue>): void;
213
- /**
214
- * @deprecated
215
- */
216
- readVariableValue(nodeId: NodeIdLike): Promise<DataValue>;
217
- /**
218
- * @deprecated
219
- */
220
- readVariableValue(nodeIds: NodeIdLike[], callback: ResponseCallback<DataValue[]>): void;
221
- /**
222
- * @deprecated
223
- */
224
- readVariableValue(nodeIds: NodeIdLike[]): Promise<DataValue[]>;
225
- }
226
- export interface ClientSessionWriteService {
227
- write(nodeToWrite: WriteValueOptions, callback: ResponseCallback<StatusCode>): void;
228
- write(nodesToWrite: WriteValueOptions[], callback: ResponseCallback<StatusCode[]>): void;
229
- write(nodesToWrite: WriteValueOptions[]): Promise<StatusCode[]>;
230
- write(nodeToWrite: WriteValueOptions): Promise<StatusCode>;
231
- /**
232
- * @deprecated
233
- */
234
- writeSingleNode(nodeToWrite: NodeIdLike, value: Variant): Promise<StatusCode>;
235
- /**
236
- * @deprecated
237
- */
238
- writeSingleNode(nodeToWrite: NodeIdLike, value: Variant, callback: ResponseCallback<StatusCode>): void;
239
- }
240
- export interface ClientSessionRawSubscriptionService {
241
- /**
242
- * @method createSubscription
243
- * @async
244
- *
245
- * @example
246
- *
247
- * ```ts
248
- * const options = {
249
- * requestedPublishingInterval: 1000,
250
- * requestedLifetimeCount: 2000,
251
- * requestedMaxKeepAliveCount: 10,
252
- * maxNotificationsPerPublish: 1000,
253
- * publishingEnabled: true,
254
- * priority: 128
255
- * };
256
- * const response = await session.createSubscription(options);
257
- * ```
258
- */
259
- createSubscription(options: CreateSubscriptionRequestLike, callback: ResponseCallback<CreateSubscriptionResponse>): void;
260
- createSubscription(options: CreateSubscriptionRequestLike): Promise<CreateSubscriptionResponse>;
261
- setMonitoringMode(options: SetMonitoringModeRequestLike, callback: ResponseCallback<SetMonitoringModeResponse>): void;
262
- setMonitoringMode(options: SetMonitoringModeRequestLike): Promise<SetMonitoringModeResponse>;
263
- createMonitoredItems(options: CreateMonitoredItemsRequestLike, callback: ResponseCallback<CreateMonitoredItemsResponse>): void;
264
- createMonitoredItems(options: CreateMonitoredItemsRequestLike): Promise<CreateMonitoredItemsResponse>;
265
- modifySubscription(options: ModifySubscriptionRequestLike, callback: ResponseCallback<ModifySubscriptionResponse>): void;
266
- modifySubscription(options: ModifySubscriptionRequestLike): Promise<ModifySubscriptionResponse>;
267
- transferSubscriptions(options: TransferSubscriptionsRequestLike, callback?: ResponseCallback<TransferSubscriptionsResponse>): void;
268
- transferSubscriptions(options: TransferSubscriptionsRequestLike): Promise<TransferSubscriptionsResponse>;
269
- deleteSubscriptions(options: DeleteSubscriptionsRequestLike, callback?: ResponseCallback<DeleteSubscriptionsResponse>): void;
270
- deleteSubscriptions(options: DeleteSubscriptionsRequestLike): Promise<DeleteSubscriptionsResponse>;
271
- /**
272
- *
273
- * @method modifyMonitoredItems
274
- * @async
275
- */
276
- modifyMonitoredItems(options: ModifyMonitoredItemsRequestLike, callback?: ResponseCallback<ModifyMonitoredItemsResponse>): void;
277
- modifyMonitoredItems(options: ModifyMonitoredItemsRequestLike): Promise<ModifyMonitoredItemsResponse>;
278
- getMonitoredItems(subscriptionId: SubscriptionId): Promise<MonitoredItemData>;
279
- getMonitoredItems(subscriptionId: SubscriptionId, callback: ResponseCallback<MonitoredItemData>): void;
280
- deleteMonitoredItems(request: DeleteMonitoredItemsRequestLike, callback: Callback<DeleteMonitoredItemsResponse>): void;
281
- deleteMonitoredItems(request: DeleteMonitoredItemsRequestLike): Promise<DeleteMonitoredItemsResponse>;
282
- setTriggering(request: SetTriggeringRequestOptions): Promise<SetTriggeringResponse>;
283
- setTriggering(request: SetTriggeringRequestOptions, callback: ResponseCallback<SetTriggeringResponse>): void;
284
- }
285
- export interface ClientSessionSubscriptionService {
286
- createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike): Promise<ClientSubscription>;
287
- createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike, callback: ResponseCallback<ClientSubscription>): void;
288
- }
289
- export interface HistoryReadValueIdOptions2 extends HistoryReadValueIdOptions {
290
- nodeId: NodeIdLike;
291
- }
292
- export interface ExtraReadHistoryValueParameters {
293
- numValuesPerNode?: number;
294
- returnBounds?: boolean;
295
- isReadModified?: boolean;
296
- timestampsToReturn?: TimestampsToReturn;
297
- }
298
- export interface ClientSessionReadHistoryService {
299
- readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
300
- readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
301
- readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options?: ExtraReadHistoryValueParameters): Promise<HistoryReadResult[]>;
302
- readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, callback: (err: Error | null, result?: HistoryReadResult) => void): void;
303
- readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, result?: HistoryReadResult) => void): void;
304
- readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, options?: ExtraReadHistoryValueParameters): Promise<HistoryReadResult>;
305
- /**
306
- * @method readAggregateValue
307
- * @async
308
- *
309
- * @example
310
- *
311
- * ```javascript
312
- * // es5
313
- * session.readAggregateValue(
314
- * {nodeId: "ns=5;s=Simulation Examples.Functions.Sine1" },
315
- * new Date("2015-06-10T09:00:00.000Z"),
316
- * new Date("2015-06-10T09:01:00.000Z"),
317
- * AggregateFunction.Average, 3600000, (err,dataValues) => {
318
- *
319
- * });
320
- * ```
321
- *
322
- * ```javascript
323
- * // es6
324
- * const dataValues = await session.readAggregateValue(
325
- * { nodeId: "ns=5;s=Simulation Examples.Functions.Sine1" },
326
- * new Date("2015-06-10T09:00:00.000Z"),
327
- * new Date("2015-06-10T09:01:00.000Z"),
328
- * AggregateFunction.Average, 3600000);
329
- * ```
330
- * @param nodes the read value id
331
- * @param startTime the start time in UTC format
332
- * @param endTime the end time in UTC format
333
- * @param aggregateFn
334
- * @param processingInterval in milliseconds
335
- * @param callback
336
- */
337
- readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number, callback: Callback<HistoryReadResult[]>): void;
338
- readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number): Promise<HistoryReadResult[]>;
339
- readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number, callback: Callback<HistoryReadResult>): void;
340
- readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number): Promise<HistoryReadResult>;
341
- historyRead(request: HistoryReadRequest, callback: Callback<HistoryReadResponse>): void;
342
- historyRead(request: HistoryReadRequest): Promise<HistoryReadResponse>;
343
- }
344
- export interface ClientSessionDataTypeService {
345
- /**
346
- * retrieve the built-in DataType of a Variable, from its DataType attribute.
347
- *
348
- *
349
- * this method is useful to determine which DataType to use when constructing a Variant
350
- * @param nodeId - the node id of the variable to query
351
- * @async
352
- *
353
- *
354
- * @example
355
- *
356
- * ```javascript
357
- * const session = ...; // ClientSession
358
- * const nodeId = opcua.VariableIds.Server_ServerStatus_CurrentTime;
359
- * session.getBuiltInDataType(nodeId,function(err,dataType) {
360
- * assert(dataType === opcua.DataType.DateTime);
361
- * });
362
- * // or
363
- * nodeId = opcua.coerceNodeId("ns=2;s=Static_Scalar_ImagePNG");
364
- * const dataType: await session.getBuiltInDataType(nodeId);
365
- * assert(dataType === opcua.DataType.ByteString);
366
- * ```
367
- */
368
- getBuiltInDataType(nodeId: NodeId): Promise<DataType>;
369
- getBuiltInDataType(nodeId: NodeId, callback: (err: Error | null, dataType?: DataType) => void): void;
370
- }
371
- export interface ClientSessionNamespaceService {
372
- getNamespaceIndex(namespaceUri: string): number;
373
- readNamespaceArray(): Promise<string[]>;
374
- readNamespaceArray(callback: (err: Error | null, namespaceArray?: string[]) => void): void;
375
- }
376
- export interface ClientSessionExtensionObjectService {
377
- constructExtensionObject(dataType: NodeId, pojo: Record<string, unknown>): Promise<ExtensionObject>;
378
- /**
379
- * @private
380
- */
381
- extractNamespaceDataType(): Promise<ExtraDataTypeManager>;
382
- }
383
- export interface ClientSessionConditionService {
384
- disableCondition(): void;
385
- enableCondition(): void;
386
- /**
387
- * helper to add a comment to a condition
388
- *
389
- * The AddComment Method is used to apply a comment to a specific state of a Condition instance.
390
- *
391
- * Normally, the NodeId of the object instance as the ObjectId is passed to the Call Service.
392
- *
393
- * However, some Servers do not expose Condition instances in the AddressSpace. Therefore all Servers
394
- * shall also allow Clients to call the AddComment Method by specifying ConditionId as the ObjectId.
395
- *
396
- * The Method cannot be called with an ObjectId of the ConditionType Node.
397
- *
398
- * ### Notes:
399
- * * Comments are added to Event occurrences identified via an EventId. EventIds where the related EventType
400
- * is not a ConditionType (or subtype of it) and thus does not support Comments are rejected.
401
- * * A ConditionEvent where the Comment Variable contains this text will be sent for the identified
402
- * state. If a comment is added to a previous state (i.e. a state for which the Server has created a
403
- * branch), the BranchId and all Condition values of this branch will be reported/.
404
- *
405
- */
406
- addCommentCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike, callback: Callback<StatusCode>): void;
407
- addCommentCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
408
- /**
409
- * helper to confirm a condition
410
- *
411
- * >> from Spec 1.03 Part 9 : page 27
412
- * The Confirm Method is used to confirm an Event Notifications for a Condition instance state
413
- * where ConfirmedState is FALSE.
414
- *
415
- * Normally, the NodeId of the object instance as the ObjectId is passed to the Call Service.
416
- *
417
- * However, some Servers do not expose Condition instances in the AddressSpace.
418
- *
419
- * Therefore all Servers shall also allow Clients to call the Confirm Method by specifying ConditionId
420
- * as the ObjectId.
421
- *
422
- * The Method cannot be called with an ObjectId of the AcknowledgeableConditionType Node.
423
- * @param conditionId
424
- * @param eventId
425
- * @param comment
426
- * @param callback
427
- */
428
- confirmCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike, callback: Callback<StatusCode>): void;
429
- confirmCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
430
- /**
431
- * helper to acknowledge a condition
432
- *
433
- * >>> from Spec 1.03 Part 9 : page 27
434
- *
435
- * The Acknowledge Method is used to acknowledge an Event Notification for a Condition
436
- * instance state where AckedState is false.
437
- *
438
- * Normally, the NodeId of the object instance as the ObjectId is passed to the Call Service.
439
- *
440
- * However, some Servers do not expose Condition instances in the AddressSpace.
441
- *
442
- * Therefore all Servers shall also allow Clients to call the Acknowledge Method by specifying ConditionId
443
- * as the ObjectId.
444
- *
445
- * The Method cannot be called with an ObjectId of the AcknowledgeableConditionType Node.
446
- *
447
- * A Condition instance may be an Object that appears in the Server Address Space. If this is
448
- * the case the ConditionId is the NodeId for the Object.
449
- *
450
- * The EventId identifies a specific Event Notification where a state to be acknowledged was
451
- * reported.
452
- *
453
- * Acknowledgement and the optional comment will be applied to the state identified
454
- * with the EventId. If the comment field is NULL (both locale and text are empty) it will be
455
- * ignored and any existing comments will remain unchanged. If the comment is to be reset, an
456
- * empty text with a locale shall be provided.
457
- *
458
- * A valid EventId will result in an Event Notification where AckedState/Id is set to TRUE and the
459
- * Comment Property contains the text of the optional comment argument. If a previous state is
460
- * acknowledged, the BranchId and all Condition values of this branch will be reported.
461
- *
462
- * @param conditionId
463
- * @param eventId
464
- * @param comment
465
- * @param callback
466
- */
467
- acknowledgeCondition(conditionId: NodeId, eventId: Buffer, comment: LocalizedTextLike, callback: Callback<StatusCode>): void;
468
- acknowledgeCondition(conditionId: NodeId, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
469
- /**
470
- * @method findMethodId
471
- *
472
- * @param nodeId the nodeId of the parent Object
473
- * @param methodName the method name
474
- * @param callback
475
- */
476
- findMethodId(nodeId: NodeIdLike, methodName: string, callback: ResponseCallback<NodeId>): void;
477
- findMethodId(nodeId: NodeIdLike, methodName: string): Promise<NodeId>;
478
- }
479
- export interface ClientSessionPublishService {
480
- publish(options: PublishRequest, callback: ResponseCallback<PublishResponse>): void;
481
- republish(options: RepublishRequest, callback: ResponseCallback<RepublishResponse>): void;
482
- }
483
- export interface ClientSession extends ClientSessionTranslateBrowsePathService, ClientSessionQueryService, ClientSessionBrowseService, ClientSessionSubscriptionService, ClientSessionCallService, ClientSessionRegisterService, ClientSessionReadService, ClientSessionReadHistoryService, ClientSessionConditionService, ClientSessionExtensionObjectService, ClientSessionNamespaceService, ClientSessionDataTypeService, IBasicSession {
484
- }
1
+ /**
2
+ * @module node-opcua-client
3
+ */
4
+ /// <reference types="node" />
5
+ /// <reference types="node" />
6
+ import { EventEmitter } from "events";
7
+ import { DateTime, UInt8 } from "node-opcua-basic-types";
8
+ import { ServerState } from "node-opcua-common";
9
+ import { Certificate } from "node-opcua-crypto";
10
+ import { LocalizedTextLike } from "node-opcua-data-model";
11
+ import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
12
+ import { NodeId, NodeIdLike } from "node-opcua-nodeid";
13
+ import { IBasicSession } from "node-opcua-pseudo-session";
14
+ import { ErrorCallback } from "node-opcua-status-code";
15
+ import { BrowseDescriptionOptions, BrowseResult } from "node-opcua-service-browse";
16
+ import { CallMethodResult } from "node-opcua-service-call";
17
+ import { EndpointDescription } from "node-opcua-service-endpoints";
18
+ import { HistoryReadResult } from "node-opcua-service-history";
19
+ import { QueryFirstRequestOptions, QueryFirstResponse } from "node-opcua-service-query";
20
+ import { ReadValueIdOptions } from "node-opcua-service-read";
21
+ import { CreateMonitoredItemsRequestOptions, CreateMonitoredItemsResponse, CreateSubscriptionRequestOptions, CreateSubscriptionResponse, DeleteMonitoredItemsRequestOptions, DeleteMonitoredItemsResponse, DeleteSubscriptionsRequestOptions, DeleteSubscriptionsResponse, ModifyMonitoredItemsRequestOptions, ModifyMonitoredItemsResponse, ModifySubscriptionRequestOptions, ModifySubscriptionResponse, PublishRequest, PublishResponse, RepublishRequest, RepublishResponse, SetMonitoringModeRequestOptions, SetMonitoringModeResponse, TransferSubscriptionsRequestOptions, TransferSubscriptionsResponse, SetTriggeringResponse, SetTriggeringRequestOptions } from "node-opcua-service-subscription";
22
+ import { BrowsePath, BrowsePathResult } from "node-opcua-service-translate-browse-path";
23
+ import { WriteValueOptions } from "node-opcua-service-write";
24
+ import { StatusCode } from "node-opcua-status-code";
25
+ import { DataType, Variant } from "node-opcua-variant";
26
+ import { Callback } from "node-opcua-status-code";
27
+ import { ExtensionObject } from "node-opcua-extension-object";
28
+ import { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
29
+ import { AggregateFunction } from "node-opcua-constants";
30
+ import { HistoryReadRequest, HistoryReadResponse, HistoryReadValueIdOptions } from "node-opcua-types";
31
+ import { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
32
+ export { ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
33
+ export { ExtensionObject } from "node-opcua-extension-object";
34
+ export { ArgumentDefinition, CallMethodRequestLike, MethodId } from "node-opcua-pseudo-session";
35
+ import { ClientSubscription } from "./client_subscription";
36
+ export declare type ResponseCallback<T> = (err: Error | null, response?: T) => void;
37
+ export interface NodeAttributes {
38
+ nodeId: NodeId;
39
+ statusCode: StatusCode;
40
+ [key: string]: Variant | NodeId | StatusCode;
41
+ }
42
+ export interface MonitoredItemData {
43
+ clientHandles: Uint32Array;
44
+ serverHandles: Uint32Array;
45
+ }
46
+ export interface CreateSubscriptionOptions {
47
+ requestedPublishingInterval: number;
48
+ requestedLifetimeCount: number;
49
+ requestedMaxKeepAliveCount: number;
50
+ maxNotificationsPerPublish?: number;
51
+ publishingEnabled?: boolean;
52
+ priority?: UInt8;
53
+ }
54
+ export declare type BrowseDescriptionLike = string | BrowseDescriptionOptions;
55
+ export declare type DeleteMonitoredItemsRequestLike = DeleteMonitoredItemsRequestOptions;
56
+ export declare type CreateSubscriptionRequestLike = CreateSubscriptionRequestOptions;
57
+ export declare type DeleteSubscriptionsRequestLike = DeleteSubscriptionsRequestOptions;
58
+ export declare type TransferSubscriptionsRequestLike = TransferSubscriptionsRequestOptions;
59
+ export declare type CreateMonitoredItemsRequestLike = CreateMonitoredItemsRequestOptions;
60
+ export declare type ModifyMonitoredItemsRequestLike = ModifyMonitoredItemsRequestOptions;
61
+ export declare type ModifySubscriptionRequestLike = ModifySubscriptionRequestOptions;
62
+ export declare type SetMonitoringModeRequestLike = SetMonitoringModeRequestOptions;
63
+ export declare type QueryFirstRequestLike = QueryFirstRequestOptions;
64
+ export declare type SubscriptionId = number;
65
+ export interface ClientSessionBase {
66
+ /** the session Id */
67
+ timeout: number;
68
+ authenticationToken?: NodeId;
69
+ sessionId: NodeId;
70
+ subscriptionCount: number;
71
+ isReconnecting: boolean;
72
+ endpoint: EndpointDescription;
73
+ /**
74
+ * the time of the latest request sent by the client to the server
75
+ */
76
+ lastRequestSentTime: Date;
77
+ /**
78
+ * the time of the latest response received by the client
79
+ */
80
+ lastResponseReceivedTime: Date;
81
+ /**
82
+ * the server certificate as provided by the server
83
+ */
84
+ serverCertificate: Certificate;
85
+ /**
86
+ * the session name
87
+ */
88
+ name: string;
89
+ close(callback: ErrorCallback): void;
90
+ close(deleteSubscription: boolean, callback: ErrorCallback): void;
91
+ close(deleteSubscription?: boolean): Promise<void>;
92
+ }
93
+ export interface ClientSession extends ClientSessionBase {
94
+ serverEndpoints: EndpointDescription[];
95
+ }
96
+ export interface ClientSession extends EventEmitter {
97
+ on(event: "keepalive", eventHandler: (lastKnownServerState: ServerState) => void): this;
98
+ on(event: "keepalive_failure", eventHandler: (state: any) => void): this;
99
+ on(event: "session_closed", eventHandler: (statusCode: StatusCode) => void): this;
100
+ /**
101
+ * session_restored is raised when the session and related subscription
102
+ * have been fully repaired after a reconnection.
103
+ */
104
+ on(event: "session_restored", eventHandler: () => void): this;
105
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
106
+ }
107
+ export interface ClientSessionBrowseService {
108
+ /**
109
+ * the maximum number of reference that the server should return per browseResult
110
+ * Continuous points will be return by server to allow retrieving remaining references
111
+ * with browseNext
112
+ */
113
+ requestedMaxReferencesPerNode: number;
114
+ browse(nodeToBrowse: BrowseDescriptionLike, callback: ResponseCallback<BrowseResult>): void;
115
+ browse(nodesToBrowse: BrowseDescriptionLike[], callback: ResponseCallback<BrowseResult[]>): void;
116
+ browse(nodeToBrowse: BrowseDescriptionLike): Promise<BrowseResult>;
117
+ browse(nodesToBrowse: BrowseDescriptionLike[]): Promise<BrowseResult[]>;
118
+ browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult>): void;
119
+ browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean, callback: ResponseCallback<BrowseResult[]>): void;
120
+ browseNext(continuationPoint: Buffer, releaseContinuationPoints: boolean): Promise<BrowseResult>;
121
+ browseNext(continuationPoints: Buffer[], releaseContinuationPoints: boolean): Promise<BrowseResult[]>;
122
+ }
123
+ export interface ClientSessionTranslateBrowsePathService {
124
+ translateBrowsePath(browsesPath: BrowsePath[], callback: ResponseCallback<BrowsePathResult[]>): void;
125
+ translateBrowsePath(browsePath: BrowsePath, callback: ResponseCallback<BrowsePathResult>): void;
126
+ translateBrowsePath(browsePath: BrowsePath): Promise<BrowsePathResult>;
127
+ translateBrowsePath(browsePaths: BrowsePath[]): Promise<BrowsePathResult[]>;
128
+ }
129
+ export interface ClientSessionQueryService {
130
+ queryFirst(queryFirstRequest: QueryFirstRequestLike): Promise<QueryFirstResponse>;
131
+ queryFirst(queryFirstRequest: QueryFirstRequestLike, callback: ResponseCallback<QueryFirstResponse>): void;
132
+ }
133
+ export interface ClientSessionCallService {
134
+ /**
135
+ *
136
+ * @method call
137
+ *
138
+ * @param methodToCall {CallMethodRequest} the call method request
139
+ * @param callback
140
+ *
141
+ * @example :
142
+ *
143
+ * ```javascript
144
+ * const methodToCall = {
145
+ * objectId: "ns=2;i=12",
146
+ * methodId: "ns=2;i=13",
147
+ * inputArguments: [
148
+ * new Variant({...}),
149
+ * new Variant({...}),
150
+ * ]
151
+ * }
152
+ * session.call(methodToCall,function(err,callResult) {
153
+ * if (!err) {
154
+ * console.log(" statusCode = ",callResult.statusCode);
155
+ * console.log(" inputArgumentResults[0] = ",callResult.inputArgumentResults[0].toString());
156
+ * console.log(" inputArgumentResults[1] = ",callResult.inputArgumentResults[1].toString());
157
+ * console.log(" outputArgument[0] = ",callResult.outputArgument[0].toString()); // array of variant
158
+ * }
159
+ * });
160
+ * ```
161
+ *
162
+ * @method call
163
+ *
164
+ * @param methodsToCall {CallMethodRequest[]} the call method request array
165
+ * @param callback
166
+ *
167
+ *
168
+ * @example :
169
+ *
170
+ * ```javascript
171
+ * const methodsToCall = [ {
172
+ * objectId: "ns=2;i=12",
173
+ * methodId: "ns=2;i=13",
174
+ * inputArguments: [
175
+ * new Variant({...}),
176
+ * new Variant({...}),
177
+ * ]
178
+ * }];
179
+ * session.call(methodsToCall,function(err,callResults) {
180
+ * if (!err) {
181
+ * const callResult = callResults[0];
182
+ * console.log(" statusCode = ",rep.statusCode);
183
+ * console.log(" inputArgumentResults[0] = ",callResult.inputArgumentResults[0].toString());
184
+ * console.log(" inputArgumentResults[1] = ",callResult.inputArgumentResults[1].toString());
185
+ * console.log(" outputArgument[0] = ",callResult.outputArgument[0].toString()); // array of variant
186
+ * }
187
+ * });
188
+ * ```
189
+ */
190
+ call(methodToCall: CallMethodRequestLike, callback: (err: Error | null, result?: CallMethodResult) => void): void;
191
+ call(methodsToCall: CallMethodRequestLike[], callback: (err: Error | null, results?: CallMethodResult[]) => void): void;
192
+ call(methodToCall: CallMethodRequestLike): Promise<CallMethodResult>;
193
+ call(methodsToCall: CallMethodRequestLike[]): Promise<CallMethodResult[]>;
194
+ getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>;
195
+ getArgumentDefinition(methodId: MethodId, callback: (err: Error | null, args?: ArgumentDefinition) => void): void;
196
+ }
197
+ export interface ClientSessionRegisterService {
198
+ registerNodes(nodesToRegister: NodeIdLike[]): Promise<NodeId[]>;
199
+ registerNodes(nodesToRegister: NodeIdLike[], callback: (err: Error | null, registeredNodeIds?: NodeId[]) => void): void;
200
+ unregisterNodes(nodesToRegister: NodeIdLike[]): Promise<void>;
201
+ unregisterNodes(nodesToRegister: NodeIdLike[], callback: (err?: Error) => void): void;
202
+ }
203
+ export interface ClientSessionReadService {
204
+ read(nodeToRead: ReadValueIdOptions, maxAge: number, callback: ResponseCallback<DataValue>): void;
205
+ read(nodesToRead: ReadValueIdOptions[], maxAge: number, callback: ResponseCallback<DataValue[]>): void;
206
+ read(nodeToRead: ReadValueIdOptions, callback: ResponseCallback<DataValue>): void;
207
+ read(nodesToRead: ReadValueIdOptions[], callback: ResponseCallback<DataValue[]>): void;
208
+ read(nodeToRead: ReadValueIdOptions, maxAge?: number): Promise<DataValue>;
209
+ read(nodesToRead: ReadValueIdOptions[], maxAge?: number): Promise<DataValue[]>;
210
+ /**
211
+ * @deprecated
212
+ */
213
+ readVariableValue(nodeId: NodeIdLike, callback: ResponseCallback<DataValue>): void;
214
+ /**
215
+ * @deprecated
216
+ */
217
+ readVariableValue(nodeId: NodeIdLike): Promise<DataValue>;
218
+ /**
219
+ * @deprecated
220
+ */
221
+ readVariableValue(nodeIds: NodeIdLike[], callback: ResponseCallback<DataValue[]>): void;
222
+ /**
223
+ * @deprecated
224
+ */
225
+ readVariableValue(nodeIds: NodeIdLike[]): Promise<DataValue[]>;
226
+ }
227
+ export interface ClientSessionWriteService {
228
+ write(nodeToWrite: WriteValueOptions, callback: ResponseCallback<StatusCode>): void;
229
+ write(nodesToWrite: WriteValueOptions[], callback: ResponseCallback<StatusCode[]>): void;
230
+ write(nodesToWrite: WriteValueOptions[]): Promise<StatusCode[]>;
231
+ write(nodeToWrite: WriteValueOptions): Promise<StatusCode>;
232
+ /**
233
+ * @deprecated
234
+ */
235
+ writeSingleNode(nodeToWrite: NodeIdLike, value: Variant): Promise<StatusCode>;
236
+ /**
237
+ * @deprecated
238
+ */
239
+ writeSingleNode(nodeToWrite: NodeIdLike, value: Variant, callback: ResponseCallback<StatusCode>): void;
240
+ }
241
+ export interface ClientSessionRawSubscriptionService {
242
+ /**
243
+ * @method createSubscription
244
+ * @async
245
+ *
246
+ * @example
247
+ *
248
+ * ```ts
249
+ * const options = {
250
+ * requestedPublishingInterval: 1000,
251
+ * requestedLifetimeCount: 2000,
252
+ * requestedMaxKeepAliveCount: 10,
253
+ * maxNotificationsPerPublish: 1000,
254
+ * publishingEnabled: true,
255
+ * priority: 128
256
+ * };
257
+ * const response = await session.createSubscription(options);
258
+ * ```
259
+ */
260
+ createSubscription(options: CreateSubscriptionRequestLike, callback: ResponseCallback<CreateSubscriptionResponse>): void;
261
+ createSubscription(options: CreateSubscriptionRequestLike): Promise<CreateSubscriptionResponse>;
262
+ setMonitoringMode(options: SetMonitoringModeRequestLike, callback: ResponseCallback<SetMonitoringModeResponse>): void;
263
+ setMonitoringMode(options: SetMonitoringModeRequestLike): Promise<SetMonitoringModeResponse>;
264
+ createMonitoredItems(options: CreateMonitoredItemsRequestLike, callback: ResponseCallback<CreateMonitoredItemsResponse>): void;
265
+ createMonitoredItems(options: CreateMonitoredItemsRequestLike): Promise<CreateMonitoredItemsResponse>;
266
+ modifySubscription(options: ModifySubscriptionRequestLike, callback: ResponseCallback<ModifySubscriptionResponse>): void;
267
+ modifySubscription(options: ModifySubscriptionRequestLike): Promise<ModifySubscriptionResponse>;
268
+ transferSubscriptions(options: TransferSubscriptionsRequestLike, callback?: ResponseCallback<TransferSubscriptionsResponse>): void;
269
+ transferSubscriptions(options: TransferSubscriptionsRequestLike): Promise<TransferSubscriptionsResponse>;
270
+ deleteSubscriptions(options: DeleteSubscriptionsRequestLike, callback?: ResponseCallback<DeleteSubscriptionsResponse>): void;
271
+ deleteSubscriptions(options: DeleteSubscriptionsRequestLike): Promise<DeleteSubscriptionsResponse>;
272
+ /**
273
+ *
274
+ * @method modifyMonitoredItems
275
+ * @async
276
+ */
277
+ modifyMonitoredItems(options: ModifyMonitoredItemsRequestLike, callback?: ResponseCallback<ModifyMonitoredItemsResponse>): void;
278
+ modifyMonitoredItems(options: ModifyMonitoredItemsRequestLike): Promise<ModifyMonitoredItemsResponse>;
279
+ getMonitoredItems(subscriptionId: SubscriptionId): Promise<MonitoredItemData>;
280
+ getMonitoredItems(subscriptionId: SubscriptionId, callback: ResponseCallback<MonitoredItemData>): void;
281
+ deleteMonitoredItems(request: DeleteMonitoredItemsRequestLike, callback: Callback<DeleteMonitoredItemsResponse>): void;
282
+ deleteMonitoredItems(request: DeleteMonitoredItemsRequestLike): Promise<DeleteMonitoredItemsResponse>;
283
+ setTriggering(request: SetTriggeringRequestOptions): Promise<SetTriggeringResponse>;
284
+ setTriggering(request: SetTriggeringRequestOptions, callback: ResponseCallback<SetTriggeringResponse>): void;
285
+ }
286
+ export interface ClientSessionSubscriptionService {
287
+ createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike): Promise<ClientSubscription>;
288
+ createSubscription2(createSubscriptionRequest: CreateSubscriptionRequestLike, callback: ResponseCallback<ClientSubscription>): void;
289
+ }
290
+ export interface HistoryReadValueIdOptions2 extends HistoryReadValueIdOptions {
291
+ nodeId: NodeIdLike;
292
+ }
293
+ export interface ExtraReadHistoryValueParameters {
294
+ numValuesPerNode?: number;
295
+ returnBounds?: boolean;
296
+ isReadModified?: boolean;
297
+ timestampsToReturn?: TimestampsToReturn;
298
+ }
299
+ export interface ClientSessionReadHistoryService {
300
+ readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
301
+ readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, results?: HistoryReadResult[]) => void): void;
302
+ readHistoryValue(nodesToRead: NodeIdLike[] | HistoryReadValueIdOptions2[], start: DateTime, end: DateTime, options?: ExtraReadHistoryValueParameters): Promise<HistoryReadResult[]>;
303
+ readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, callback: (err: Error | null, result?: HistoryReadResult) => void): void;
304
+ readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, options: ExtraReadHistoryValueParameters | undefined, callback: (err: Error | null, result?: HistoryReadResult) => void): void;
305
+ readHistoryValue(nodeToRead: NodeIdLike | HistoryReadValueIdOptions2, start: DateTime, end: DateTime, options?: ExtraReadHistoryValueParameters): Promise<HistoryReadResult>;
306
+ /**
307
+ * @method readAggregateValue
308
+ * @async
309
+ *
310
+ * @example
311
+ *
312
+ * ```javascript
313
+ * // es5
314
+ * session.readAggregateValue(
315
+ * {nodeId: "ns=5;s=Simulation Examples.Functions.Sine1" },
316
+ * new Date("2015-06-10T09:00:00.000Z"),
317
+ * new Date("2015-06-10T09:01:00.000Z"),
318
+ * AggregateFunction.Average, 3600000, (err,dataValues) => {
319
+ *
320
+ * });
321
+ * ```
322
+ *
323
+ * ```javascript
324
+ * // es6
325
+ * const dataValues = await session.readAggregateValue(
326
+ * { nodeId: "ns=5;s=Simulation Examples.Functions.Sine1" },
327
+ * new Date("2015-06-10T09:00:00.000Z"),
328
+ * new Date("2015-06-10T09:01:00.000Z"),
329
+ * AggregateFunction.Average, 3600000);
330
+ * ```
331
+ * @param nodes the read value id
332
+ * @param startTime the start time in UTC format
333
+ * @param endTime the end time in UTC format
334
+ * @param aggregateFn
335
+ * @param processingInterval in milliseconds
336
+ * @param callback
337
+ */
338
+ readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number, callback: Callback<HistoryReadResult[]>): void;
339
+ readAggregateValue(nodesToRead: HistoryReadValueIdOptions[], startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction[], processingInterval: number): Promise<HistoryReadResult[]>;
340
+ readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number, callback: Callback<HistoryReadResult>): void;
341
+ readAggregateValue(nodeToRead: HistoryReadValueIdOptions, startTime: DateTime, endTime: DateTime, aggregateFn: AggregateFunction, processingInterval: number): Promise<HistoryReadResult>;
342
+ historyRead(request: HistoryReadRequest, callback: Callback<HistoryReadResponse>): void;
343
+ historyRead(request: HistoryReadRequest): Promise<HistoryReadResponse>;
344
+ }
345
+ export interface ClientSessionDataTypeService {
346
+ /**
347
+ * retrieve the built-in DataType of a Variable, from its DataType attribute.
348
+ *
349
+ *
350
+ * this method is useful to determine which DataType to use when constructing a Variant
351
+ * @param nodeId - the node id of the variable to query
352
+ * @async
353
+ *
354
+ *
355
+ * @example
356
+ *
357
+ * ```javascript
358
+ * const session = ...; // ClientSession
359
+ * const nodeId = opcua.VariableIds.Server_ServerStatus_CurrentTime;
360
+ * session.getBuiltInDataType(nodeId,function(err,dataType) {
361
+ * assert(dataType === opcua.DataType.DateTime);
362
+ * });
363
+ * // or
364
+ * nodeId = opcua.coerceNodeId("ns=2;s=Static_Scalar_ImagePNG");
365
+ * const dataType: await session.getBuiltInDataType(nodeId);
366
+ * assert(dataType === opcua.DataType.ByteString);
367
+ * ```
368
+ */
369
+ getBuiltInDataType(nodeId: NodeId): Promise<DataType>;
370
+ getBuiltInDataType(nodeId: NodeId, callback: (err: Error | null, dataType?: DataType) => void): void;
371
+ }
372
+ export interface ClientSessionNamespaceService {
373
+ getNamespaceIndex(namespaceUri: string): number;
374
+ readNamespaceArray(): Promise<string[]>;
375
+ readNamespaceArray(callback: (err: Error | null, namespaceArray?: string[]) => void): void;
376
+ }
377
+ export interface ClientSessionExtensionObjectService {
378
+ constructExtensionObject(dataType: NodeId, pojo: Record<string, unknown>): Promise<ExtensionObject>;
379
+ /**
380
+ * @private
381
+ */
382
+ extractNamespaceDataType(): Promise<ExtraDataTypeManager>;
383
+ }
384
+ export interface ClientSessionConditionService {
385
+ disableCondition(): void;
386
+ enableCondition(): void;
387
+ /**
388
+ * helper to add a comment to a condition
389
+ *
390
+ * The AddComment Method is used to apply a comment to a specific state of a Condition instance.
391
+ *
392
+ * Normally, the NodeId of the object instance as the ObjectId is passed to the Call Service.
393
+ *
394
+ * However, some Servers do not expose Condition instances in the AddressSpace. Therefore all Servers
395
+ * shall also allow Clients to call the AddComment Method by specifying ConditionId as the ObjectId.
396
+ *
397
+ * The Method cannot be called with an ObjectId of the ConditionType Node.
398
+ *
399
+ * ### Notes:
400
+ * * Comments are added to Event occurrences identified via an EventId. EventIds where the related EventType
401
+ * is not a ConditionType (or subtype of it) and thus does not support Comments are rejected.
402
+ * * A ConditionEvent where the Comment Variable contains this text will be sent for the identified
403
+ * state. If a comment is added to a previous state (i.e. a state for which the Server has created a
404
+ * branch), the BranchId and all Condition values of this branch will be reported/.
405
+ *
406
+ */
407
+ addCommentCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike, callback: Callback<StatusCode>): void;
408
+ addCommentCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
409
+ /**
410
+ * helper to confirm a condition
411
+ *
412
+ * >> from Spec 1.03 Part 9 : page 27
413
+ * The Confirm Method is used to confirm an Event Notifications for a Condition instance state
414
+ * where ConfirmedState is FALSE.
415
+ *
416
+ * Normally, the NodeId of the object instance as the ObjectId is passed to the Call Service.
417
+ *
418
+ * However, some Servers do not expose Condition instances in the AddressSpace.
419
+ *
420
+ * Therefore all Servers shall also allow Clients to call the Confirm Method by specifying ConditionId
421
+ * as the ObjectId.
422
+ *
423
+ * The Method cannot be called with an ObjectId of the AcknowledgeableConditionType Node.
424
+ * @param conditionId
425
+ * @param eventId
426
+ * @param comment
427
+ * @param callback
428
+ */
429
+ confirmCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike, callback: Callback<StatusCode>): void;
430
+ confirmCondition(conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
431
+ /**
432
+ * helper to acknowledge a condition
433
+ *
434
+ * >>> from Spec 1.03 Part 9 : page 27
435
+ *
436
+ * The Acknowledge Method is used to acknowledge an Event Notification for a Condition
437
+ * instance state where AckedState is false.
438
+ *
439
+ * Normally, the NodeId of the object instance as the ObjectId is passed to the Call Service.
440
+ *
441
+ * However, some Servers do not expose Condition instances in the AddressSpace.
442
+ *
443
+ * Therefore all Servers shall also allow Clients to call the Acknowledge Method by specifying ConditionId
444
+ * as the ObjectId.
445
+ *
446
+ * The Method cannot be called with an ObjectId of the AcknowledgeableConditionType Node.
447
+ *
448
+ * A Condition instance may be an Object that appears in the Server Address Space. If this is
449
+ * the case the ConditionId is the NodeId for the Object.
450
+ *
451
+ * The EventId identifies a specific Event Notification where a state to be acknowledged was
452
+ * reported.
453
+ *
454
+ * Acknowledgement and the optional comment will be applied to the state identified
455
+ * with the EventId. If the comment field is NULL (both locale and text are empty) it will be
456
+ * ignored and any existing comments will remain unchanged. If the comment is to be reset, an
457
+ * empty text with a locale shall be provided.
458
+ *
459
+ * A valid EventId will result in an Event Notification where AckedState/Id is set to TRUE and the
460
+ * Comment Property contains the text of the optional comment argument. If a previous state is
461
+ * acknowledged, the BranchId and all Condition values of this branch will be reported.
462
+ *
463
+ * @param conditionId
464
+ * @param eventId
465
+ * @param comment
466
+ * @param callback
467
+ */
468
+ acknowledgeCondition(conditionId: NodeId, eventId: Buffer, comment: LocalizedTextLike, callback: Callback<StatusCode>): void;
469
+ acknowledgeCondition(conditionId: NodeId, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
470
+ /**
471
+ * @method findMethodId
472
+ *
473
+ * @param nodeId the nodeId of the parent Object
474
+ * @param methodName the method name
475
+ * @param callback
476
+ */
477
+ findMethodId(nodeId: NodeIdLike, methodName: string, callback: ResponseCallback<NodeId>): void;
478
+ findMethodId(nodeId: NodeIdLike, methodName: string): Promise<NodeId>;
479
+ }
480
+ export interface ClientSessionPublishService {
481
+ publish(options: PublishRequest, callback: ResponseCallback<PublishResponse>): void;
482
+ republish(options: RepublishRequest, callback: ResponseCallback<RepublishResponse>): void;
483
+ }
484
+ export interface ClientSession extends ClientSessionTranslateBrowsePathService, ClientSessionQueryService, ClientSessionBrowseService, ClientSessionSubscriptionService, ClientSessionCallService, ClientSessionRegisterService, ClientSessionReadService, ClientSessionReadHistoryService, ClientSessionConditionService, ClientSessionExtensionObjectService, ClientSessionNamespaceService, ClientSessionDataTypeService, IBasicSession {
485
+ }