node-opcua-client 2.98.0 → 2.98.2

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