node-opcua-client 2.188.1 → 2.190.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alarms_and_conditions/client_alarm_tools.d.ts.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools.js +2 -1
- package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
- package/dist/client_monitored_item_toolbox.d.ts.map +1 -1
- package/dist/client_monitored_item_toolbox.js +8 -4
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session_keepalive_manager.d.ts.map +1 -1
- package/dist/client_session_keepalive_manager.js +18 -12
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/private/client_base_impl.d.ts +10 -1
- package/dist/private/client_base_impl.d.ts.map +1 -1
- package/dist/private/client_base_impl.js +188 -77
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.d.ts.map +1 -1
- package/dist/private/client_monitored_item_impl.js +2 -1
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_publish_engine.d.ts.map +1 -1
- package/dist/private/client_publish_engine.js +16 -8
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +21 -0
- package/dist/private/client_session_impl.d.ts.map +1 -1
- package/dist/private/client_session_impl.js +122 -57
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.d.ts.map +1 -1
- package/dist/private/client_subscription_impl.js +27 -17
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.d.ts.map +1 -1
- package/dist/private/opcua_client_impl.js +307 -29
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/reconnection/client_publish_engine_reconnection.d.ts.map +1 -1
- package/dist/private/reconnection/client_publish_engine_reconnection.js +6 -3
- package/dist/private/reconnection/client_publish_engine_reconnection.js.map +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.d.ts.map +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.js +6 -3
- package/dist/private/reconnection/client_subscription_reconnection.js.map +1 -1
- package/dist/private/reconnection/reconnection.d.ts.map +1 -1
- package/dist/private/reconnection/reconnection.js +6 -4
- package/dist/private/reconnection/reconnection.js.map +1 -1
- package/dist/private/verify_server_signature.d.ts +51 -0
- package/dist/private/verify_server_signature.d.ts.map +1 -0
- package/dist/private/verify_server_signature.js +76 -0
- package/dist/private/verify_server_signature.js.map +1 -0
- package/dist/reverse/client_reverse_connect.js +2 -2
- package/dist/reverse/client_reverse_connect.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.js +6 -3
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/dist/verify.d.ts +6 -0
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +32 -10
- package/dist/verify.js.map +1 -1
- package/package.json +47 -47
- package/source/alarms_and_conditions/client_alarm_tools.ts +2 -1
- package/source/client_monitored_item_toolbox.ts +8 -4
- package/source/client_session_keepalive_manager.ts +18 -12
- package/source/private/client_base_impl.ts +206 -78
- package/source/private/client_monitored_item_impl.ts +2 -1
- package/source/private/client_publish_engine.ts +16 -8
- package/source/private/client_session_impl.ts +122 -57
- package/source/private/client_subscription_impl.ts +27 -17
- package/source/private/opcua_client_impl.ts +383 -29
- package/source/private/reconnection/client_publish_engine_reconnection.ts +6 -3
- package/source/private/reconnection/client_subscription_reconnection.ts +6 -3
- package/source/private/reconnection/reconnection.ts +6 -4
- package/source/private/verify_server_signature.ts +109 -0
- package/source/reverse/client_reverse_connect.ts +2 -2
- package/source/tools/read_history_server_capabilities.ts +6 -3
- package/source/verify.ts +34 -12
|
@@ -66,7 +66,7 @@ const minimumMaxKeepAliveCount = 3;
|
|
|
66
66
|
function displayKeepAliveWarning(sessionTimeout: number, maxKeepAliveCount: number, publishingInterval: number): boolean {
|
|
67
67
|
const keepAliveInterval = maxKeepAliveCount * publishingInterval;
|
|
68
68
|
|
|
69
|
-
/* c8 ignore
|
|
69
|
+
/* c8 ignore start */
|
|
70
70
|
if (sessionTimeout < keepAliveInterval) {
|
|
71
71
|
warningLog(
|
|
72
72
|
chalk.yellowBright(
|
|
@@ -113,6 +113,7 @@ function displayKeepAliveWarning(sessionTimeout: number, maxKeepAliveCount: numb
|
|
|
113
113
|
}
|
|
114
114
|
return true;
|
|
115
115
|
}
|
|
116
|
+
/* c8 ignore stop */
|
|
116
117
|
return false;
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -183,7 +184,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
183
184
|
options.requestedMaxKeepAliveCount,
|
|
184
185
|
options.requestedPublishingInterval
|
|
185
186
|
);
|
|
186
|
-
|
|
187
|
+
/* c8 ignore start */
|
|
187
188
|
if (warningEmitted) {
|
|
188
189
|
warningLog(
|
|
189
190
|
JSON.stringify(
|
|
@@ -195,6 +196,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
195
196
|
)
|
|
196
197
|
);
|
|
197
198
|
}
|
|
199
|
+
/* c8 ignore stop */
|
|
198
200
|
|
|
199
201
|
options.maxNotificationsPerPublish = isNullOrUndefined(options.maxNotificationsPerPublish)
|
|
200
202
|
? 0
|
|
@@ -249,7 +251,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
249
251
|
public terminate(): Promise<void>;
|
|
250
252
|
public terminate(callback: ErrorCallback): void;
|
|
251
253
|
public terminate(callback?: ErrorCallback): Promise<void> | void {
|
|
252
|
-
|
|
254
|
+
/* c8 ignore next */
|
|
253
255
|
doDebug && debugLog("Terminating client subscription ", this.subscriptionId);
|
|
254
256
|
|
|
255
257
|
if (this.subscriptionId === TERMINATED_SUBSCRIPTION_ID || this.subscriptionId === TERMINATING_SUBSCRIPTION_ID) {
|
|
@@ -277,7 +279,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
277
279
|
},
|
|
278
280
|
(err: Error | null, response?: DeleteSubscriptionsResponse) => {
|
|
279
281
|
if (response && response?.results?.[0] !== StatusCodes.Good) {
|
|
280
|
-
|
|
282
|
+
/* c8 ignore next */
|
|
281
283
|
doDebug && debugLog("warning: deleteSubscription returned ", response.results);
|
|
282
284
|
}
|
|
283
285
|
if (err) {
|
|
@@ -292,7 +294,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
292
294
|
}
|
|
293
295
|
);
|
|
294
296
|
} else {
|
|
295
|
-
|
|
297
|
+
/* c8 ignore next */
|
|
296
298
|
doDebug && debugLog("subscriptionId is not value ", this.subscriptionId);
|
|
297
299
|
assert(this.subscriptionId === PENDING_SUBSCRIPTION_ID);
|
|
298
300
|
this._terminate_step2(callback as ErrorCallback);
|
|
@@ -430,11 +432,12 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
430
432
|
callback?.(err);
|
|
431
433
|
return;
|
|
432
434
|
}
|
|
433
|
-
/* c8 ignore
|
|
435
|
+
/* c8 ignore start */
|
|
434
436
|
if (!statusCode) {
|
|
435
437
|
callback?.(new Error("Internal Error"));
|
|
436
438
|
return;
|
|
437
439
|
}
|
|
440
|
+
/* c8 ignore stop */
|
|
438
441
|
if (statusCode.isNotGood()) {
|
|
439
442
|
callback?.(null, statusCode);
|
|
440
443
|
return;
|
|
@@ -494,11 +497,12 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
494
497
|
return;
|
|
495
498
|
}
|
|
496
499
|
}
|
|
497
|
-
|
|
500
|
+
/* c8 ignore start */
|
|
498
501
|
if (!response) {
|
|
499
502
|
callback?.(new Error("Internal Error"));
|
|
500
503
|
return;
|
|
501
504
|
}
|
|
505
|
+
/* c8 ignore stop */
|
|
502
506
|
callback?.(null, response);
|
|
503
507
|
});
|
|
504
508
|
return undefined;
|
|
@@ -686,16 +690,17 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
686
690
|
}
|
|
687
691
|
}
|
|
688
692
|
}
|
|
689
|
-
|
|
693
|
+
/* c8 ignore start */
|
|
690
694
|
if (repeated > 1) {
|
|
691
695
|
warningLog("previous message repeated", repeated, "times");
|
|
692
696
|
}
|
|
697
|
+
/* c8 ignore stop */
|
|
693
698
|
}
|
|
694
699
|
|
|
695
700
|
private __on_publish_response_StatusChangeNotification(notification: StatusChangeNotification) {
|
|
696
701
|
assert(notification.schema.name === "StatusChangeNotification");
|
|
697
702
|
|
|
698
|
-
|
|
703
|
+
/* c8 ignore next */
|
|
699
704
|
doDebug && debugLog("Client has received a Status Change Notification ", notification.status.toString());
|
|
700
705
|
|
|
701
706
|
if (notification.status === StatusCodes.GoodSubscriptionTransferred) {
|
|
@@ -703,7 +708,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
703
708
|
// If the Server transfers the Subscription to the new Session, the Server shall issue
|
|
704
709
|
// a StatusChangeNotification notificationMessage with the status code
|
|
705
710
|
// Good_SubscriptionTransferred to the old Session.
|
|
706
|
-
|
|
711
|
+
/* c8 ignore next */
|
|
707
712
|
doDebug && debugLog("ClientSubscription#__on_publish_response_StatusChangeNotification : GoodSubscriptionTransferred");
|
|
708
713
|
|
|
709
714
|
// may be it has been transferred after a reconnection.... in this case should do nothing about it
|
|
@@ -759,7 +764,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
759
764
|
|
|
760
765
|
if (notificationData.length === 0) {
|
|
761
766
|
// this is a keep alive message
|
|
762
|
-
|
|
767
|
+
/* c8 ignore next */
|
|
763
768
|
doDebug && debugLog(chalk.yellow("Client : received a keep alive notification from client"));
|
|
764
769
|
/**
|
|
765
770
|
* notify the observers that a keep alive Publish Response has been received from the server.
|
|
@@ -780,10 +785,11 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
780
785
|
() => {
|
|
781
786
|
// now process all notifications
|
|
782
787
|
for (const notification of notificationData) {
|
|
783
|
-
|
|
788
|
+
/* c8 ignore start */
|
|
784
789
|
if (!notification) {
|
|
785
790
|
continue;
|
|
786
791
|
}
|
|
792
|
+
/* c8 ignore stop */
|
|
787
793
|
|
|
788
794
|
// DataChangeNotification / StatusChangeNotification / EventNotification
|
|
789
795
|
switch (notification.schema.name) {
|
|
@@ -876,7 +882,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
876
882
|
timestampsToReturn: TimestampsToReturn,
|
|
877
883
|
monitoringMode: MonitoringMode = MonitoringMode.Reporting
|
|
878
884
|
): ClientMonitoredItem {
|
|
879
|
-
/* c8 ignore
|
|
885
|
+
/* c8 ignore start */
|
|
880
886
|
const monitoredItem = new ClientMonitoredItemImpl(
|
|
881
887
|
this,
|
|
882
888
|
itemToMonitor,
|
|
@@ -884,6 +890,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
884
890
|
timestampsToReturn,
|
|
885
891
|
monitoringMode
|
|
886
892
|
);
|
|
893
|
+
/* c8 ignore stop */
|
|
887
894
|
return monitoredItem;
|
|
888
895
|
}
|
|
889
896
|
}
|
|
@@ -948,13 +955,14 @@ ClientSubscription.create = (clientSession: ClientSession, options: ClientSubscr
|
|
|
948
955
|
};
|
|
949
956
|
|
|
950
957
|
export function __create_subscription(subscription: ClientSubscriptionImpl, callback: ErrorCallback) {
|
|
951
|
-
|
|
958
|
+
/* c8 ignore start */
|
|
952
959
|
if (!subscription.hasSession) {
|
|
953
960
|
return callback(new Error("__create_subscription: subscription has no Session"));
|
|
954
961
|
}
|
|
962
|
+
/* c8 ignore stop */
|
|
955
963
|
const session = subscription.session;
|
|
956
964
|
|
|
957
|
-
|
|
965
|
+
/* c8 ignore next */
|
|
958
966
|
doDebug && debugLog(chalk.yellow.bold("ClientSubscription created "));
|
|
959
967
|
|
|
960
968
|
const request = new CreateSubscriptionRequest({
|
|
@@ -976,10 +984,11 @@ export function __create_subscription(subscription: ClientSubscriptionImpl, call
|
|
|
976
984
|
return;
|
|
977
985
|
}
|
|
978
986
|
|
|
979
|
-
/* c8 ignore
|
|
987
|
+
/* c8 ignore start */
|
|
980
988
|
if (!response) {
|
|
981
989
|
return callback(new Error("internal error"));
|
|
982
990
|
}
|
|
991
|
+
/* c8 ignore stop */
|
|
983
992
|
|
|
984
993
|
if (!subscription.hasSession) {
|
|
985
994
|
return callback(new Error("createSubscription has failed = > no session"));
|
|
@@ -996,7 +1005,7 @@ export function __create_subscription(subscription: ClientSubscriptionImpl, call
|
|
|
996
1005
|
displayKeepAliveWarning(subscription.session.timeout, subscription.maxKeepAliveCount, subscription.publishingInterval);
|
|
997
1006
|
ClientSubscription.ignoreNextWarning = false;
|
|
998
1007
|
|
|
999
|
-
|
|
1008
|
+
/* c8 ignore start */
|
|
1000
1009
|
if (doDebug) {
|
|
1001
1010
|
debugLog(chalk.yellow.bold("registering callback"));
|
|
1002
1011
|
debugLog(chalk.yellow.bold("publishingInterval "), subscription.publishingInterval);
|
|
@@ -1006,6 +1015,7 @@ export function __create_subscription(subscription: ClientSubscriptionImpl, call
|
|
|
1006
1015
|
debugLog(chalk.yellow.bold("hasTimedOut "), subscription.hasTimedOut);
|
|
1007
1016
|
debugLog(chalk.yellow.bold("timeoutHint for publish request "), subscription.timeoutHint);
|
|
1008
1017
|
}
|
|
1018
|
+
/* c8 ignore stop */
|
|
1009
1019
|
|
|
1010
1020
|
subscription.publishEngine.registerSubscription(subscription);
|
|
1011
1021
|
|