node-opcua-server 2.71.0 → 2.72.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 (65) hide show
  1. package/dist/base_server.d.ts +110 -110
  2. package/dist/base_server.js +473 -473
  3. package/dist/factory.d.ts +12 -12
  4. package/dist/factory.js +23 -23
  5. package/dist/history_server_capabilities.d.ts +35 -35
  6. package/dist/history_server_capabilities.js +43 -43
  7. package/dist/i_channel_data.d.ts +13 -13
  8. package/dist/i_channel_data.js +2 -2
  9. package/dist/i_register_server_manager.d.ts +16 -16
  10. package/dist/i_register_server_manager.js +2 -2
  11. package/dist/i_server_side_publish_engine.d.ts +36 -36
  12. package/dist/i_server_side_publish_engine.js +49 -49
  13. package/dist/i_socket_data.d.ts +11 -11
  14. package/dist/i_socket_data.js +2 -2
  15. package/dist/index.d.ts +15 -15
  16. package/dist/index.js +31 -31
  17. package/dist/monitored_item.d.ts +177 -177
  18. package/dist/monitored_item.js +998 -998
  19. package/dist/node_sampler.d.ts +3 -3
  20. package/dist/node_sampler.js +75 -75
  21. package/dist/opcua_server.d.ts +650 -647
  22. package/dist/opcua_server.js +2392 -2385
  23. package/dist/opcua_server.js.map +1 -1
  24. package/dist/queue.d.ts +11 -11
  25. package/dist/queue.js +71 -71
  26. package/dist/register_server_manager.d.ts +96 -96
  27. package/dist/register_server_manager.js +584 -584
  28. package/dist/register_server_manager_hidden.d.ts +17 -17
  29. package/dist/register_server_manager_hidden.js +27 -27
  30. package/dist/register_server_manager_mdns_only.d.ts +22 -22
  31. package/dist/register_server_manager_mdns_only.js +55 -55
  32. package/dist/server_capabilities.d.ts +148 -61
  33. package/dist/server_capabilities.js +91 -108
  34. package/dist/server_capabilities.js.map +1 -1
  35. package/dist/server_end_point.d.ts +183 -183
  36. package/dist/server_end_point.js +817 -816
  37. package/dist/server_end_point.js.map +1 -1
  38. package/dist/server_engine.d.ts +317 -316
  39. package/dist/server_engine.js +1716 -1688
  40. package/dist/server_engine.js.map +1 -1
  41. package/dist/server_publish_engine.d.ts +112 -112
  42. package/dist/server_publish_engine.js +530 -530
  43. package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +16 -16
  44. package/dist/server_publish_engine_for_orphan_subscriptions.js +49 -49
  45. package/dist/server_session.d.ts +181 -181
  46. package/dist/server_session.js +738 -738
  47. package/dist/server_session.js.map +1 -1
  48. package/dist/server_subscription.d.ts +415 -395
  49. package/dist/server_subscription.js +1334 -1316
  50. package/dist/server_subscription.js.map +1 -1
  51. package/dist/sessions_compatible_for_transfer.d.ts +2 -2
  52. package/dist/sessions_compatible_for_transfer.js +36 -36
  53. package/dist/user_manager.d.ts +32 -32
  54. package/dist/user_manager.js +74 -74
  55. package/dist/user_manager_ua.d.ts +3 -3
  56. package/dist/user_manager_ua.js +39 -39
  57. package/dist/validate_filter.d.ts +5 -5
  58. package/dist/validate_filter.js +60 -60
  59. package/package.json +34 -34
  60. package/source/opcua_server.ts +27 -16
  61. package/source/server_capabilities.ts +178 -91
  62. package/source/server_end_point.ts +9 -8
  63. package/source/server_engine.ts +30 -1
  64. package/source/server_session.ts +1 -0
  65. package/source/server_subscription.ts +46 -5
@@ -1,395 +1,415 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- /// <reference types="node" />
5
- import { EventEmitter } from "events";
6
- import { AddressSpace, BaseNode, Duration } from "node-opcua-address-space";
7
- import { Byte } from "node-opcua-basic-types";
8
- import { SubscriptionDiagnosticsDataType } from "node-opcua-common";
9
- import { TimestampsToReturn } from "node-opcua-data-value";
10
- import { NodeId } from "node-opcua-nodeid";
11
- import { ObjectRegistry } from "node-opcua-object-registry";
12
- import { DataChangeNotification, EventNotificationList, MonitoredItemCreateResult, NotificationMessage, StatusChangeNotification, MonitoredItemCreateRequest } from "node-opcua-service-subscription";
13
- import { StatusCode } from "node-opcua-status-code";
14
- import { MonitoredItem, QueueItem } from "./monitored_item";
15
- import { ServerSession } from "./server_session";
16
- import { IServerSidePublishEngine } from "./i_server_side_publish_engine";
17
- export interface SubscriptionDiagnosticsDataTypePriv extends SubscriptionDiagnosticsDataType {
18
- $subscription: Subscription;
19
- }
20
- export declare enum SubscriptionState {
21
- CLOSED = 1,
22
- CREATING = 2,
23
- NORMAL = 3,
24
- LATE = 4,
25
- KEEPALIVE = 5,
26
- TERMINATED = 6
27
- }
28
- export interface SubscriptionOptions {
29
- sessionId?: NodeId;
30
- /**
31
- * (default:1000) the publishing interval.
32
- */
33
- publishingInterval?: number;
34
- /**
35
- * (default:10) the max Life Time Count
36
- */
37
- maxKeepAliveCount?: number;
38
- lifeTimeCount?: number;
39
- /**
40
- * (default:true)
41
- */
42
- publishingEnabled?: boolean;
43
- /**
44
- * (default:0)
45
- */
46
- maxNotificationsPerPublish?: number;
47
- /**
48
- * subscription priority Byte:(0-255)
49
- */
50
- priority?: number;
51
- publishEngine?: IServerSidePublishEngine;
52
- /**
53
- * a unique identifier
54
- */
55
- id?: number;
56
- }
57
- export declare type Notification = DataChangeNotification | EventNotificationList | StatusChangeNotification;
58
- export declare type Counter = number;
59
- export interface ModifySubscriptionParameters {
60
- /**
61
- * requestedPublishingInterval =0 means fastest possible
62
- */
63
- requestedPublishingInterval?: Duration;
64
- requestedLifetimeCount?: Counter;
65
- /**
66
- * requestedMaxKeepAliveCount ===0 means no change
67
- */
68
- requestedMaxKeepAliveCount?: Counter;
69
- maxNotificationsPerPublish?: Counter;
70
- priority?: Byte;
71
- }
72
- export interface GetMonitoredItemsResult {
73
- /**
74
- * array of serverHandles for all MonitoredItems of the subscription
75
- * identified by subscriptionId.
76
- */
77
- serverHandles: Uint32Array;
78
- /**
79
- * array of clientHandles for all MonitoredItems of the subscription
80
- * identified by subscriptionId.
81
- */
82
- clientHandles: Uint32Array;
83
- statusCode: StatusCode;
84
- }
85
- export interface InternalNotification {
86
- monitoredItemId?: number;
87
- notification: QueueItem | StatusChangeNotification;
88
- publishTime: Date;
89
- start_tick: number;
90
- }
91
- export interface InternalCreateMonitoredItemResult {
92
- monitoredItem?: MonitoredItem;
93
- monitoredItemCreateRequest: MonitoredItemCreateRequest;
94
- createResult: MonitoredItemCreateResult;
95
- }
96
- export interface MonitoredItemBase {
97
- node: any | null;
98
- }
99
- export declare type CreateMonitoredItemHook = (subscription: Subscription, monitoredItem: MonitoredItemBase) => Promise<StatusCode>;
100
- export declare type DeleteMonitoredItemHook = (subscription: Subscription, monitoredItem: MonitoredItemBase) => Promise<StatusCode>;
101
- /**
102
- * The Subscription class used in the OPCUA server side.
103
- */
104
- export declare class Subscription extends EventEmitter {
105
- static minimumPublishingInterval: number;
106
- static defaultPublishingInterval: number;
107
- static maximumPublishingInterval: number;
108
- static maxNotificationPerPublishHighLimit: number;
109
- static maxMonitoredItemCount: number;
110
- static registry: ObjectRegistry;
111
- sessionId: NodeId;
112
- publishEngine?: IServerSidePublishEngine;
113
- id: number;
114
- priority: number;
115
- /**
116
- * the Subscription publishing interval
117
- * @default 1000
118
- */
119
- publishingInterval: number;
120
- /**
121
- * The keep alive count defines how many times the publish interval need to
122
- * expires without having notifications available before the server send an
123
- * empty message.
124
- * OPCUA Spec says: a value of 0 is invalid.
125
- * @default 10
126
- *
127
- */
128
- maxKeepAliveCount: number;
129
- /**
130
- * The life time count defines how many times the publish interval expires without
131
- * having a connection to the client to deliver data.
132
- * If the life time count reaches maxKeepAliveCount, the subscription will
133
- * automatically terminate.
134
- * OPCUA Spec: The life-time count shall be a minimum of three times the keep keep-alive count.
135
- *
136
- * Note: this has to be interpreted as without having a PublishRequest available
137
- * @default 1
138
- */
139
- lifeTimeCount: number;
140
- /**
141
- * The maximum number of notifications that the Client wishes to receive in a
142
- * single Publish response. A value of zero indicates that there is no limit.
143
- * The number of notifications per Publish is the sum of monitoredItems in the
144
- * DataChangeNotification and events in the EventNotificationList.
145
- *
146
- * @property maxNotificationsPerPublish
147
- * @default 0
148
- */
149
- maxNotificationsPerPublish: number;
150
- publishingEnabled: boolean;
151
- subscriptionDiagnostics: SubscriptionDiagnosticsDataTypePriv;
152
- publishIntervalCount: number;
153
- /**
154
- * number of monitored Item
155
- */
156
- monitoredItemIdCounter: number;
157
- state: SubscriptionState;
158
- messageSent: boolean;
159
- $session?: ServerSession;
160
- private _life_time_counter;
161
- private _keep_alive_counter;
162
- private _pending_notifications;
163
- private _sent_notification_messages;
164
- private readonly _sequence_number_generator;
165
- private readonly monitoredItems;
166
- private timerId;
167
- private _hasUncollectedMonitoredItemNotifications;
168
- constructor(options: SubscriptionOptions);
169
- getSessionId(): NodeId;
170
- toString(): string;
171
- /**
172
- * modify subscription parameters
173
- * @param param
174
- */
175
- modify(param: ModifySubscriptionParameters): void;
176
- /**
177
- * set publishing mode
178
- * @param publishingEnabled
179
- */
180
- setPublishingMode(publishingEnabled: boolean): StatusCode;
181
- /**
182
- * @private
183
- */
184
- get keepAliveCounterHasExpired(): boolean;
185
- /**
186
- * Reset the Lifetime Counter Variable to the value specified for the lifetime of a Subscription in
187
- * the CreateSubscription Service( 5.13.2).
188
- * @private
189
- */
190
- resetLifeTimeCounter(): void;
191
- /**
192
- * @private
193
- */
194
- increaseLifeTimeCounter(): void;
195
- /**
196
- * True if the subscription life time has expired.
197
- *
198
- */
199
- get lifeTimeHasExpired(): boolean;
200
- /**
201
- * number of milliseconds before this subscription times out (lifeTimeHasExpired === true);
202
- */
203
- get timeToExpiration(): number;
204
- get timeToKeepAlive(): number;
205
- /**
206
- * Terminates the subscription.
207
- * Calling this method will also remove any monitored items.
208
- *
209
- */
210
- terminate(): void;
211
- setTriggering(triggeringItemId: number, linksToAdd: number[] | null, linksToRemove: number[] | null): {
212
- statusCode: StatusCode;
213
- addResults: StatusCode[];
214
- removeResults: StatusCode[];
215
- };
216
- dispose(): void;
217
- get aborted(): boolean;
218
- /**
219
- * number of pending notifications
220
- */
221
- get pendingNotificationsCount(): number;
222
- /**
223
- * is 'true' if there are pending notifications for this subscription. (i.e moreNotifications)
224
- */
225
- get hasPendingNotifications(): boolean;
226
- /**
227
- * number of sent notifications
228
- */
229
- get sentNotificationMessageCount(): number;
230
- /**
231
- * @internal
232
- */
233
- _flushSentNotifications(): NotificationMessage[];
234
- /**
235
- * number of monitored items handled by this subscription
236
- */
237
- get monitoredItemCount(): number;
238
- /**
239
- * number of disabled monitored items.
240
- */
241
- get disabledMonitoredItemCount(): number;
242
- /**
243
- * The number of unacknowledged messages saved in the republish queue.
244
- */
245
- get unacknowledgedMessageCount(): number;
246
- /**
247
- * adjust monitored item sampling interval
248
- * - an samplingInterval ===0 means that we use a event-base model ( no sampling)
249
- * - otherwise the sampling is adjusted
250
- * @private
251
- */
252
- adjustSamplingInterval(samplingInterval: number, node: BaseNode): number;
253
- /**
254
- * create a monitored item
255
- * @param addressSpace - address space
256
- * @param timestampsToReturn - the timestamp to return
257
- * @param monitoredItemCreateRequest - the parameters describing the monitored Item to create
258
- */
259
- preCreateMonitoredItem(addressSpace: AddressSpace, timestampsToReturn: TimestampsToReturn, monitoredItemCreateRequest: MonitoredItemCreateRequest): InternalCreateMonitoredItemResult;
260
- applyOnMonitoredItem(functor: (monitoredItem: MonitoredItem) => Promise<void>): Promise<void>;
261
- postCreateMonitoredItem(monitoredItem: MonitoredItem, monitoredItemCreateRequest: MonitoredItemCreateRequest, createResult: MonitoredItemCreateResult): void;
262
- createMonitoredItem(addressSpace: AddressSpace, timestampsToReturn: TimestampsToReturn, monitoredItemCreateRequest: MonitoredItemCreateRequest): MonitoredItemCreateResult;
263
- /**
264
- * get a monitoredItem by Id.
265
- * @param monitoredItemId : the id of the monitored item to get.
266
- * @return the monitored item matching monitoredItemId
267
- */
268
- getMonitoredItem(monitoredItemId: number): MonitoredItem | null;
269
- /**
270
- * remove a monitored Item from the subscription.
271
- * @param monitoredItemId : the id of the monitored item to get.
272
- */
273
- removeMonitoredItem(monitoredItemId: number): StatusCode;
274
- /**
275
- * rue if monitored Item have uncollected Notifications
276
- */
277
- get hasUncollectedMonitoredItemNotifications(): boolean;
278
- get subscriptionId(): number;
279
- getMessageForSequenceNumber(sequenceNumber: number): NotificationMessage | null;
280
- /**
281
- * returns true if the notification has expired
282
- * @param notification
283
- */
284
- notificationHasExpired(notification: {
285
- start_tick: number;
286
- }): boolean;
287
- /**
288
- * returns in an array the sequence numbers of the notifications that have been sent
289
- * and that haven't been acknowledged yet.
290
- */
291
- getAvailableSequenceNumbers(): number[];
292
- /**
293
- * acknowledges a notification identified by its sequence number
294
- */
295
- acknowledgeNotification(sequenceNumber: number): StatusCode;
296
- /**
297
- * getMonitoredItems is used to get information about monitored items of a subscription.Its intended
298
- * use is defined in Part 4. This method is the implementation of the Standard OPCUA GetMonitoredItems Method.
299
- * from spec:
300
- * This method can be used to get the list of monitored items in a subscription if CreateMonitoredItems
301
- * failed due to a network interruption and the client does not know if the creation succeeded in the server.
302
- *
303
- */
304
- getMonitoredItems(): GetMonitoredItemsResult;
305
- /**
306
- * @private
307
- */
308
- resendInitialValues(): Promise<void>;
309
- /**
310
- * @private
311
- */
312
- notifyTransfer(): void;
313
- /**
314
- *
315
- * the server invokes the resetLifeTimeAndKeepAliveCounters method of the subscription
316
- * when the server has send a Publish Response, so that the subscription
317
- * can reset its life time counter.
318
- *
319
- * @private
320
- */
321
- resetLifeTimeAndKeepAliveCounters(): void;
322
- private _updateCounters;
323
- /**
324
- * _publish_pending_notifications send a "notification" event:
325
- *
326
- * @private
327
- * @precondition
328
- * - pendingPublishRequestCount > 0
329
- */
330
- _publish_pending_notifications(): void;
331
- process_subscription(): void;
332
- _get_future_sequence_number(): number;
333
- private _process_keepAlive;
334
- private _stop_timer;
335
- private _start_timer;
336
- private _get_next_sequence_number;
337
- /**
338
- * @private
339
- */
340
- private _tick;
341
- /**
342
- * @private
343
- */
344
- private _sendKeepAliveResponse;
345
- /**
346
- * Reset the Lifetime Counter Variable to the value specified for the lifetime of a Subscription in
347
- * the CreateSubscription Service( 5.13.2).
348
- * @private
349
- */
350
- private resetKeepAliveCounter;
351
- /**
352
- * @private
353
- */
354
- private increaseKeepAliveCounter;
355
- /**
356
- * @private
357
- */
358
- private _addNotificationMessage;
359
- /**
360
- * @internal
361
- * @param monitoredItemId
362
- */
363
- private _removePendingNotificationsFor;
364
- /**
365
- * Extract the next Notification that is ready to be sent to the client.
366
- * @return the Notification to send._pending_notifications
367
- */
368
- private _popNotificationToSend;
369
- /**
370
- * discardOldSentNotification find all sent notification message that have expired keep-alive
371
- * and destroy them.
372
- * @private
373
- *
374
- * Subscriptions maintain a retransmission queue of sent NotificationMessages.
375
- * NotificationMessages are retained in this queue until they are acknowledged or until they have
376
- * been in the queue for a minimum of one keep-alive interval.
377
- *
378
- */
379
- private discardOldSentNotifications;
380
- /**
381
- * @param timestampsToReturn
382
- * @param monitoredItemCreateRequest
383
- * @param node
384
- * @private
385
- */
386
- private _createMonitoredItemStep2;
387
- /**
388
- *
389
- * @param monitoredItem
390
- * @param monitoredItemCreateRequest
391
- * @private
392
- */
393
- _createMonitoredItemStep3(monitoredItem: MonitoredItem | null, monitoredItemCreateRequest: MonitoredItemCreateRequest): void;
394
- private _harvestMonitoredItems;
395
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ /// <reference types="node" />
5
+ import { EventEmitter } from "events";
6
+ import { AddressSpace, BaseNode, Duration } from "node-opcua-address-space";
7
+ import { Byte, UInt32 } from "node-opcua-basic-types";
8
+ import { SubscriptionDiagnosticsDataType } from "node-opcua-common";
9
+ import { TimestampsToReturn } from "node-opcua-data-value";
10
+ import { NodeId } from "node-opcua-nodeid";
11
+ import { ObjectRegistry } from "node-opcua-object-registry";
12
+ import { DataChangeNotification, EventNotificationList, MonitoredItemCreateResult, NotificationMessage, StatusChangeNotification, MonitoredItemCreateRequest } from "node-opcua-service-subscription";
13
+ import { StatusCode } from "node-opcua-status-code";
14
+ import { MonitoredItem, QueueItem } from "./monitored_item";
15
+ import { ServerSession } from "./server_session";
16
+ import { IServerSidePublishEngine } from "./i_server_side_publish_engine";
17
+ export interface SubscriptionDiagnosticsDataTypePriv extends SubscriptionDiagnosticsDataType {
18
+ $subscription: Subscription;
19
+ }
20
+ export declare enum SubscriptionState {
21
+ CLOSED = 1,
22
+ CREATING = 2,
23
+ NORMAL = 3,
24
+ LATE = 4,
25
+ KEEPALIVE = 5,
26
+ TERMINATED = 6
27
+ }
28
+ interface IGlobalMonitoredItemCounter {
29
+ totalMonitoredItemCount: number;
30
+ }
31
+ export interface SubscriptionOptions {
32
+ sessionId?: NodeId;
33
+ /**
34
+ * (default:1000) the publishing interval.
35
+ */
36
+ publishingInterval?: number;
37
+ /**
38
+ * (default:10) the max Life Time Count
39
+ */
40
+ maxKeepAliveCount?: number;
41
+ lifeTimeCount?: number;
42
+ /**
43
+ * (default:true)
44
+ */
45
+ publishingEnabled?: boolean;
46
+ /**
47
+ * (default:0)
48
+ */
49
+ maxNotificationsPerPublish?: number;
50
+ /**
51
+ * subscription priority Byte:(0-255)
52
+ */
53
+ priority?: number;
54
+ publishEngine?: IServerSidePublishEngine;
55
+ /**
56
+ * a unique identifier
57
+ */
58
+ id?: number;
59
+ serverCapabilities: ServerCapabilitiesPartial;
60
+ globalCounter: IGlobalMonitoredItemCounter;
61
+ }
62
+ export declare type Notification = DataChangeNotification | EventNotificationList | StatusChangeNotification;
63
+ export declare type Counter = number;
64
+ export interface ModifySubscriptionParameters {
65
+ /**
66
+ * requestedPublishingInterval =0 means fastest possible
67
+ */
68
+ requestedPublishingInterval?: Duration;
69
+ requestedLifetimeCount?: Counter;
70
+ /**
71
+ * requestedMaxKeepAliveCount ===0 means no change
72
+ */
73
+ requestedMaxKeepAliveCount?: Counter;
74
+ maxNotificationsPerPublish?: Counter;
75
+ priority?: Byte;
76
+ }
77
+ export interface GetMonitoredItemsResult {
78
+ /**
79
+ * array of serverHandles for all MonitoredItems of the subscription
80
+ * identified by subscriptionId.
81
+ */
82
+ serverHandles: Uint32Array;
83
+ /**
84
+ * array of clientHandles for all MonitoredItems of the subscription
85
+ * identified by subscriptionId.
86
+ */
87
+ clientHandles: Uint32Array;
88
+ statusCode: StatusCode;
89
+ }
90
+ export interface InternalNotification {
91
+ monitoredItemId?: number;
92
+ notification: QueueItem | StatusChangeNotification;
93
+ publishTime: Date;
94
+ start_tick: number;
95
+ }
96
+ export interface InternalCreateMonitoredItemResult {
97
+ monitoredItem?: MonitoredItem;
98
+ monitoredItemCreateRequest: MonitoredItemCreateRequest;
99
+ createResult: MonitoredItemCreateResult;
100
+ }
101
+ export interface MonitoredItemBase {
102
+ node: any | null;
103
+ }
104
+ export declare type CreateMonitoredItemHook = (subscription: Subscription, monitoredItem: MonitoredItemBase) => Promise<StatusCode>;
105
+ export declare type DeleteMonitoredItemHook = (subscription: Subscription, monitoredItem: MonitoredItemBase) => Promise<StatusCode>;
106
+ export interface ServerCapabilitiesPartial {
107
+ maxMonitoredItems: UInt32;
108
+ maxMonitoredItemsPerSubscription: UInt32;
109
+ }
110
+ /**
111
+ * The Subscription class used in the OPCUA server side.
112
+ */
113
+ export declare class Subscription extends EventEmitter {
114
+ static minimumPublishingInterval: number;
115
+ static defaultPublishingInterval: number;
116
+ static maximumPublishingInterval: number;
117
+ static maxNotificationPerPublishHighLimit: number;
118
+ /**
119
+ * maximum number of monitored item in a subscription to be used
120
+ * when serverCapacity.maxMonitoredItems and serverCapacity.maxMonitoredItemsPerSubscription are not set.
121
+ */
122
+ static defaultMaxMonitoredItemCount: number;
123
+ /**
124
+ * @deprecated use serverCapacity.maxMonitoredItems and serverCapacity.maxMonitoredItemsPerSubscription instead
125
+ */
126
+ protected static get maxMonitoredItemCount(): number;
127
+ static registry: ObjectRegistry;
128
+ sessionId: NodeId;
129
+ publishEngine?: IServerSidePublishEngine;
130
+ id: number;
131
+ priority: number;
132
+ /**
133
+ * the Subscription publishing interval
134
+ * @default 1000
135
+ */
136
+ publishingInterval: number;
137
+ /**
138
+ * The keep alive count defines how many times the publish interval need to
139
+ * expires without having notifications available before the server send an
140
+ * empty message.
141
+ * OPCUA Spec says: a value of 0 is invalid.
142
+ * @default 10
143
+ *
144
+ */
145
+ maxKeepAliveCount: number;
146
+ /**
147
+ * The life time count defines how many times the publish interval expires without
148
+ * having a connection to the client to deliver data.
149
+ * If the life time count reaches maxKeepAliveCount, the subscription will
150
+ * automatically terminate.
151
+ * OPCUA Spec: The life-time count shall be a minimum of three times the keep keep-alive count.
152
+ *
153
+ * Note: this has to be interpreted as without having a PublishRequest available
154
+ * @default 1
155
+ */
156
+ lifeTimeCount: number;
157
+ /**
158
+ * The maximum number of notifications that the Client wishes to receive in a
159
+ * single Publish response. A value of zero indicates that there is no limit.
160
+ * The number of notifications per Publish is the sum of monitoredItems in the
161
+ * DataChangeNotification and events in the EventNotificationList.
162
+ *
163
+ * @property maxNotificationsPerPublish
164
+ * @default 0
165
+ */
166
+ maxNotificationsPerPublish: number;
167
+ publishingEnabled: boolean;
168
+ subscriptionDiagnostics: SubscriptionDiagnosticsDataTypePriv;
169
+ publishIntervalCount: number;
170
+ /**
171
+ * number of monitored Item
172
+ */
173
+ monitoredItemIdCounter: number;
174
+ state: SubscriptionState;
175
+ messageSent: boolean;
176
+ $session?: ServerSession;
177
+ private _life_time_counter;
178
+ private _keep_alive_counter;
179
+ private _pending_notifications;
180
+ private _sent_notification_messages;
181
+ private readonly _sequence_number_generator;
182
+ private readonly monitoredItems;
183
+ private timerId;
184
+ private _hasUncollectedMonitoredItemNotifications;
185
+ private globalCounter;
186
+ private serverCapabilities;
187
+ constructor(options: SubscriptionOptions);
188
+ getSessionId(): NodeId;
189
+ toString(): string;
190
+ /**
191
+ * modify subscription parameters
192
+ * @param param
193
+ */
194
+ modify(param: ModifySubscriptionParameters): void;
195
+ /**
196
+ * set publishing mode
197
+ * @param publishingEnabled
198
+ */
199
+ setPublishingMode(publishingEnabled: boolean): StatusCode;
200
+ /**
201
+ * @private
202
+ */
203
+ get keepAliveCounterHasExpired(): boolean;
204
+ /**
205
+ * Reset the Lifetime Counter Variable to the value specified for the lifetime of a Subscription in
206
+ * the CreateSubscription Service( 5.13.2).
207
+ * @private
208
+ */
209
+ resetLifeTimeCounter(): void;
210
+ /**
211
+ * @private
212
+ */
213
+ increaseLifeTimeCounter(): void;
214
+ /**
215
+ * True if the subscription life time has expired.
216
+ *
217
+ */
218
+ get lifeTimeHasExpired(): boolean;
219
+ /**
220
+ * number of milliseconds before this subscription times out (lifeTimeHasExpired === true);
221
+ */
222
+ get timeToExpiration(): number;
223
+ get timeToKeepAlive(): number;
224
+ /**
225
+ * Terminates the subscription.
226
+ * Calling this method will also remove any monitored items.
227
+ *
228
+ */
229
+ terminate(): void;
230
+ setTriggering(triggeringItemId: number, linksToAdd: number[] | null, linksToRemove: number[] | null): {
231
+ statusCode: StatusCode;
232
+ addResults: StatusCode[];
233
+ removeResults: StatusCode[];
234
+ };
235
+ dispose(): void;
236
+ get aborted(): boolean;
237
+ /**
238
+ * number of pending notifications
239
+ */
240
+ get pendingNotificationsCount(): number;
241
+ /**
242
+ * is 'true' if there are pending notifications for this subscription. (i.e moreNotifications)
243
+ */
244
+ get hasPendingNotifications(): boolean;
245
+ /**
246
+ * number of sent notifications
247
+ */
248
+ get sentNotificationMessageCount(): number;
249
+ /**
250
+ * @internal
251
+ */
252
+ _flushSentNotifications(): NotificationMessage[];
253
+ /**
254
+ * number of monitored items handled by this subscription
255
+ */
256
+ get monitoredItemCount(): number;
257
+ /**
258
+ * number of disabled monitored items.
259
+ */
260
+ get disabledMonitoredItemCount(): number;
261
+ /**
262
+ * The number of unacknowledged messages saved in the republish queue.
263
+ */
264
+ get unacknowledgedMessageCount(): number;
265
+ /**
266
+ * adjust monitored item sampling interval
267
+ * - an samplingInterval ===0 means that we use a event-base model ( no sampling)
268
+ * - otherwise the sampling is adjusted
269
+ * @private
270
+ */
271
+ adjustSamplingInterval(samplingInterval: number, node: BaseNode): number;
272
+ /**
273
+ * create a monitored item
274
+ * @param addressSpace - address space
275
+ * @param timestampsToReturn - the timestamp to return
276
+ * @param monitoredItemCreateRequest - the parameters describing the monitored Item to create
277
+ */
278
+ preCreateMonitoredItem(addressSpace: AddressSpace, timestampsToReturn: TimestampsToReturn, monitoredItemCreateRequest: MonitoredItemCreateRequest): InternalCreateMonitoredItemResult;
279
+ applyOnMonitoredItem(functor: (monitoredItem: MonitoredItem) => Promise<void>): Promise<void>;
280
+ postCreateMonitoredItem(monitoredItem: MonitoredItem, monitoredItemCreateRequest: MonitoredItemCreateRequest, createResult: MonitoredItemCreateResult): void;
281
+ createMonitoredItem(addressSpace: AddressSpace, timestampsToReturn: TimestampsToReturn, monitoredItemCreateRequest: MonitoredItemCreateRequest): MonitoredItemCreateResult;
282
+ /**
283
+ * get a monitoredItem by Id.
284
+ * @param monitoredItemId : the id of the monitored item to get.
285
+ * @return the monitored item matching monitoredItemId
286
+ */
287
+ getMonitoredItem(monitoredItemId: number): MonitoredItem | null;
288
+ /**
289
+ * remove a monitored Item from the subscription.
290
+ * @param monitoredItemId : the id of the monitored item to get.
291
+ */
292
+ removeMonitoredItem(monitoredItemId: number): StatusCode;
293
+ /**
294
+ * rue if monitored Item have uncollected Notifications
295
+ */
296
+ get hasUncollectedMonitoredItemNotifications(): boolean;
297
+ get subscriptionId(): number;
298
+ getMessageForSequenceNumber(sequenceNumber: number): NotificationMessage | null;
299
+ /**
300
+ * returns true if the notification has expired
301
+ * @param notification
302
+ */
303
+ notificationHasExpired(notification: {
304
+ start_tick: number;
305
+ }): boolean;
306
+ /**
307
+ * returns in an array the sequence numbers of the notifications that have been sent
308
+ * and that haven't been acknowledged yet.
309
+ */
310
+ getAvailableSequenceNumbers(): number[];
311
+ /**
312
+ * acknowledges a notification identified by its sequence number
313
+ */
314
+ acknowledgeNotification(sequenceNumber: number): StatusCode;
315
+ /**
316
+ * getMonitoredItems is used to get information about monitored items of a subscription.Its intended
317
+ * use is defined in Part 4. This method is the implementation of the Standard OPCUA GetMonitoredItems Method.
318
+ * from spec:
319
+ * This method can be used to get the list of monitored items in a subscription if CreateMonitoredItems
320
+ * failed due to a network interruption and the client does not know if the creation succeeded in the server.
321
+ *
322
+ */
323
+ getMonitoredItems(): GetMonitoredItemsResult;
324
+ /**
325
+ * @private
326
+ */
327
+ resendInitialValues(): Promise<void>;
328
+ /**
329
+ * @private
330
+ */
331
+ notifyTransfer(): void;
332
+ /**
333
+ *
334
+ * the server invokes the resetLifeTimeAndKeepAliveCounters method of the subscription
335
+ * when the server has send a Publish Response, so that the subscription
336
+ * can reset its life time counter.
337
+ *
338
+ * @private
339
+ */
340
+ resetLifeTimeAndKeepAliveCounters(): void;
341
+ private _updateCounters;
342
+ /**
343
+ * _publish_pending_notifications send a "notification" event:
344
+ *
345
+ * @private
346
+ * @precondition
347
+ * - pendingPublishRequestCount > 0
348
+ */
349
+ _publish_pending_notifications(): void;
350
+ process_subscription(): void;
351
+ _get_future_sequence_number(): number;
352
+ private _process_keepAlive;
353
+ private _stop_timer;
354
+ private _start_timer;
355
+ private _get_next_sequence_number;
356
+ /**
357
+ * @private
358
+ */
359
+ private _tick;
360
+ /**
361
+ * @private
362
+ */
363
+ private _sendKeepAliveResponse;
364
+ /**
365
+ * Reset the Lifetime Counter Variable to the value specified for the lifetime of a Subscription in
366
+ * the CreateSubscription Service( 5.13.2).
367
+ * @private
368
+ */
369
+ private resetKeepAliveCounter;
370
+ /**
371
+ * @private
372
+ */
373
+ private increaseKeepAliveCounter;
374
+ /**
375
+ * @private
376
+ */
377
+ private _addNotificationMessage;
378
+ /**
379
+ * @internal
380
+ * @param monitoredItemId
381
+ */
382
+ private _removePendingNotificationsFor;
383
+ /**
384
+ * Extract the next Notification that is ready to be sent to the client.
385
+ * @return the Notification to send._pending_notifications
386
+ */
387
+ private _popNotificationToSend;
388
+ /**
389
+ * discardOldSentNotification find all sent notification message that have expired keep-alive
390
+ * and destroy them.
391
+ * @private
392
+ *
393
+ * Subscriptions maintain a retransmission queue of sent NotificationMessages.
394
+ * NotificationMessages are retained in this queue until they are acknowledged or until they have
395
+ * been in the queue for a minimum of one keep-alive interval.
396
+ *
397
+ */
398
+ private discardOldSentNotifications;
399
+ /**
400
+ * @param timestampsToReturn
401
+ * @param monitoredItemCreateRequest
402
+ * @param node
403
+ * @private
404
+ */
405
+ private _createMonitoredItemStep2;
406
+ /**
407
+ *
408
+ * @param monitoredItem
409
+ * @param monitoredItemCreateRequest
410
+ * @private
411
+ */
412
+ _createMonitoredItemStep3(monitoredItem: MonitoredItem | null, monitoredItemCreateRequest: MonitoredItemCreateRequest): void;
413
+ private _harvestMonitoredItems;
414
+ }
415
+ export {};