node-opcua-client 2.73.1 → 2.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/LICENSE +3 -1
  2. package/README.md +54 -0
  3. package/dist/alarms_and_conditions/client_alarm.d.ts +49 -45
  4. package/dist/alarms_and_conditions/client_alarm.js +109 -101
  5. package/dist/alarms_and_conditions/client_alarm.js.map +1 -1
  6. package/dist/alarms_and_conditions/client_alarm_list.d.ts +25 -25
  7. package/dist/alarms_and_conditions/client_alarm_list.js +97 -97
  8. package/dist/alarms_and_conditions/client_alarm_list.js.map +1 -1
  9. package/dist/alarms_and_conditions/client_alarm_tools.d.ts +4 -4
  10. package/dist/alarms_and_conditions/client_alarm_tools.js +156 -152
  11. package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
  12. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.d.ts +18 -18
  13. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +192 -190
  14. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js.map +1 -1
  15. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.d.ts +9 -9
  16. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +73 -73
  17. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.d.ts +3 -8
  18. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +118 -120
  19. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js.map +1 -1
  20. package/dist/alarms_and_conditions/client_tools.d.ts +7 -7
  21. package/dist/alarms_and_conditions/client_tools.js +180 -180
  22. package/dist/client_base.d.ts +277 -277
  23. package/dist/client_base.js +14 -14
  24. package/dist/client_monitored_item.d.ts +21 -21
  25. package/dist/client_monitored_item.js +11 -11
  26. package/dist/client_monitored_item_base.d.ts +39 -39
  27. package/dist/client_monitored_item_base.js +2 -2
  28. package/dist/client_monitored_item_group.d.ts +18 -18
  29. package/dist/client_monitored_item_group.js +13 -13
  30. package/dist/client_monitored_item_toolbox.d.ts +15 -15
  31. package/dist/client_monitored_item_toolbox.js +117 -117
  32. package/dist/client_session.d.ts +484 -484
  33. package/dist/client_session.js +10 -10
  34. package/dist/client_session_keepalive_manager.d.ts +34 -34
  35. package/dist/client_session_keepalive_manager.js +150 -150
  36. package/dist/client_subscription.d.ts +241 -241
  37. package/dist/client_subscription.js +14 -14
  38. package/dist/client_utils.d.ts +22 -22
  39. package/dist/client_utils.js +88 -88
  40. package/dist/common.d.ts +17 -17
  41. package/dist/common.js +5 -5
  42. package/dist/index.d.ts +55 -55
  43. package/dist/index.js +93 -93
  44. package/dist/opcua_client.d.ts +132 -132
  45. package/dist/opcua_client.js +33 -33
  46. package/dist/private/client_base_impl.d.ts +157 -157
  47. package/dist/private/client_base_impl.js +1337 -1337
  48. package/dist/private/client_monitored_item_base_impl.d.ts +3 -3
  49. package/dist/private/client_monitored_item_base_impl.js +4 -4
  50. package/dist/private/client_monitored_item_group_impl.d.ts +53 -53
  51. package/dist/private/client_monitored_item_group_impl.js +159 -159
  52. package/dist/private/client_monitored_item_impl.d.ts +93 -93
  53. package/dist/private/client_monitored_item_impl.js +305 -304
  54. package/dist/private/client_monitored_item_impl.js.map +1 -1
  55. package/dist/private/client_publish_engine.d.ts +62 -62
  56. package/dist/private/client_publish_engine.js +408 -408
  57. package/dist/private/client_session_impl.d.ts +621 -621
  58. package/dist/private/client_session_impl.js +1302 -1301
  59. package/dist/private/client_session_impl.js.map +1 -1
  60. package/dist/private/client_subscription_impl.d.ts +93 -93
  61. package/dist/private/client_subscription_impl.js +748 -743
  62. package/dist/private/client_subscription_impl.js.map +1 -1
  63. package/dist/private/i_private_client.d.ts +18 -18
  64. package/dist/private/i_private_client.js +2 -2
  65. package/dist/private/opcua_client_impl.d.ts +169 -169
  66. package/dist/private/opcua_client_impl.js +981 -981
  67. package/dist/reconnection.d.ts +9 -9
  68. package/dist/reconnection.js +408 -408
  69. package/dist/tools/findservers.d.ts +20 -20
  70. package/dist/tools/findservers.js +61 -61
  71. package/dist/tools/read_history_server_capabilities.d.ts +6 -6
  72. package/dist/tools/read_history_server_capabilities.js +99 -99
  73. package/dist/verify.d.ts +5 -5
  74. package/dist/verify.js +134 -134
  75. package/package.json +48 -48
  76. package/source/alarms_and_conditions/client_alarm.ts +28 -17
  77. package/source/alarms_and_conditions/client_alarm_list.ts +1 -0
  78. package/source/alarms_and_conditions/client_alarm_tools.ts +33 -23
  79. package/source/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.ts +10 -4
  80. package/source/alarms_and_conditions/client_alarm_tools_extractConditionFields.ts +11 -11
  81. package/source/private/client_monitored_item_impl.ts +4 -3
  82. package/source/private/client_session_impl.ts +10 -2
  83. package/source/private/client_subscription_impl.ts +6 -2
@@ -1,484 +1,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
- }
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
+ }
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
+ }