node-opcua-client 2.64.0 → 2.64.1

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