node-opcua-client 2.168.0 → 2.169.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/client_monitored_item.d.ts +4 -4
- package/dist/client_monitored_item.js +6 -5
- package/dist/client_monitored_item.js.map +1 -1
- package/dist/client_monitored_item_base.d.ts +7 -7
- package/dist/client_monitored_item_toolbox.d.ts +5 -5
- package/dist/client_monitored_item_toolbox.js +26 -19
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/private/client_base_impl.js +28 -4
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_group_impl.d.ts +7 -6
- package/dist/private/client_monitored_item_group_impl.js +6 -8
- package/dist/private/client_monitored_item_group_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.d.ts +10 -9
- package/dist/private/client_monitored_item_impl.js +40 -26
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +1 -0
- package/dist/private/client_session_impl.js +12 -0
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.d.ts +7 -4
- package/dist/private/client_subscription_impl.js +101 -77
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.d.ts +1 -0
- package/dist/private/opcua_client_impl.js +11 -0
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/package.json +42 -42
- package/source/client_monitored_item.ts +5 -4
- package/source/client_monitored_item_base.ts +13 -8
- package/source/client_monitored_item_toolbox.ts +24 -20
- package/source/private/client_base_impl.ts +27 -6
- package/source/private/client_monitored_item_group_impl.ts +15 -16
- package/source/private/client_monitored_item_impl.ts +56 -38
- package/source/private/client_session_impl.ts +29 -14
- package/source/private/client_subscription_impl.ts +151 -91
- package/source/private/opcua_client_impl.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.169.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module client",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "npx rimraf -g node_modules dist *.tsbuildinfo certificates",
|
|
@@ -16,54 +16,54 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@ster5/global-mutex": "^3.3.0",
|
|
18
18
|
"chalk": "4.1.2",
|
|
19
|
-
"node-opcua-alarm-condition": "2.
|
|
19
|
+
"node-opcua-alarm-condition": "2.169.0",
|
|
20
20
|
"node-opcua-assert": "2.164.0",
|
|
21
|
-
"node-opcua-basic-types": "2.
|
|
22
|
-
"node-opcua-buffer-utils": "2.
|
|
23
|
-
"node-opcua-certificate-manager": "2.
|
|
24
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
25
|
-
"node-opcua-common": "2.
|
|
21
|
+
"node-opcua-basic-types": "2.169.0",
|
|
22
|
+
"node-opcua-buffer-utils": "2.169.0",
|
|
23
|
+
"node-opcua-certificate-manager": "2.169.0",
|
|
24
|
+
"node-opcua-client-dynamic-extension-object": "2.169.0",
|
|
25
|
+
"node-opcua-common": "2.169.0",
|
|
26
26
|
"node-opcua-constants": "2.157.0",
|
|
27
|
-
"node-opcua-crypto": "5.3.
|
|
28
|
-
"node-opcua-data-model": "2.
|
|
29
|
-
"node-opcua-data-value": "2.
|
|
30
|
-
"node-opcua-date-time": "2.
|
|
27
|
+
"node-opcua-crypto": "5.3.5",
|
|
28
|
+
"node-opcua-data-model": "2.169.0",
|
|
29
|
+
"node-opcua-data-value": "2.169.0",
|
|
30
|
+
"node-opcua-date-time": "2.169.0",
|
|
31
31
|
"node-opcua-debug": "2.168.0",
|
|
32
|
-
"node-opcua-extension-object": "2.
|
|
32
|
+
"node-opcua-extension-object": "2.169.0",
|
|
33
33
|
"node-opcua-hostname": "2.167.0",
|
|
34
|
-
"node-opcua-nodeid": "2.
|
|
35
|
-
"node-opcua-numeric-range": "2.
|
|
36
|
-
"node-opcua-object-registry": "2.
|
|
37
|
-
"node-opcua-pki": "6.
|
|
38
|
-
"node-opcua-pseudo-session": "2.
|
|
39
|
-
"node-opcua-schemas": "2.
|
|
40
|
-
"node-opcua-secure-channel": "2.
|
|
41
|
-
"node-opcua-service-browse": "2.
|
|
42
|
-
"node-opcua-service-call": "2.
|
|
43
|
-
"node-opcua-service-discovery": "2.
|
|
44
|
-
"node-opcua-service-endpoints": "2.
|
|
45
|
-
"node-opcua-service-filter": "2.
|
|
46
|
-
"node-opcua-service-history": "2.
|
|
47
|
-
"node-opcua-service-query": "2.
|
|
48
|
-
"node-opcua-service-read": "2.
|
|
49
|
-
"node-opcua-service-register-node": "2.
|
|
50
|
-
"node-opcua-service-secure-channel": "2.
|
|
51
|
-
"node-opcua-service-session": "2.
|
|
52
|
-
"node-opcua-service-subscription": "2.
|
|
53
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
54
|
-
"node-opcua-service-write": "2.
|
|
55
|
-
"node-opcua-status-code": "2.
|
|
56
|
-
"node-opcua-types": "2.
|
|
57
|
-
"node-opcua-utils": "2.
|
|
58
|
-
"node-opcua-variant": "2.
|
|
34
|
+
"node-opcua-nodeid": "2.169.0",
|
|
35
|
+
"node-opcua-numeric-range": "2.169.0",
|
|
36
|
+
"node-opcua-object-registry": "2.169.0",
|
|
37
|
+
"node-opcua-pki": "6.13.0",
|
|
38
|
+
"node-opcua-pseudo-session": "2.169.0",
|
|
39
|
+
"node-opcua-schemas": "2.169.0",
|
|
40
|
+
"node-opcua-secure-channel": "2.169.0",
|
|
41
|
+
"node-opcua-service-browse": "2.169.0",
|
|
42
|
+
"node-opcua-service-call": "2.169.0",
|
|
43
|
+
"node-opcua-service-discovery": "2.169.0",
|
|
44
|
+
"node-opcua-service-endpoints": "2.169.0",
|
|
45
|
+
"node-opcua-service-filter": "2.169.0",
|
|
46
|
+
"node-opcua-service-history": "2.169.0",
|
|
47
|
+
"node-opcua-service-query": "2.169.0",
|
|
48
|
+
"node-opcua-service-read": "2.169.0",
|
|
49
|
+
"node-opcua-service-register-node": "2.169.0",
|
|
50
|
+
"node-opcua-service-secure-channel": "2.169.0",
|
|
51
|
+
"node-opcua-service-session": "2.169.0",
|
|
52
|
+
"node-opcua-service-subscription": "2.169.0",
|
|
53
|
+
"node-opcua-service-translate-browse-path": "2.169.0",
|
|
54
|
+
"node-opcua-service-write": "2.169.0",
|
|
55
|
+
"node-opcua-status-code": "2.169.0",
|
|
56
|
+
"node-opcua-types": "2.169.0",
|
|
57
|
+
"node-opcua-utils": "2.169.0",
|
|
58
|
+
"node-opcua-variant": "2.169.0",
|
|
59
59
|
"thenify-ex": "4.4.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"dequeue": "^1.0.5",
|
|
63
|
-
"node-opcua-address-space": "2.
|
|
64
|
-
"node-opcua-binary-stream": "2.
|
|
65
|
-
"node-opcua-factory": "2.
|
|
66
|
-
"node-opcua-leak-detector": "2.
|
|
63
|
+
"node-opcua-address-space": "2.169.0",
|
|
64
|
+
"node-opcua-binary-stream": "2.169.0",
|
|
65
|
+
"node-opcua-factory": "2.169.0",
|
|
66
|
+
"node-opcua-leak-detector": "2.169.0",
|
|
67
67
|
"node-opcua-nodesets": "2.163.1"
|
|
68
68
|
},
|
|
69
69
|
"eslintConfig": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"internet of things"
|
|
87
87
|
],
|
|
88
88
|
"homepage": "http://node-opcua.github.io/",
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "82d570d3e95bea689cbbe30096279885c5282245",
|
|
90
90
|
"files": [
|
|
91
91
|
"dist",
|
|
92
92
|
"source"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
|
-
import type { EventEmitter } from "events";
|
|
4
|
+
import type { EventEmitter } from "node:events";
|
|
5
5
|
|
|
6
6
|
import { type DataValue, TimestampsToReturn } from "node-opcua-data-value";
|
|
7
7
|
import type { ReadValueIdOptions } from "node-opcua-service-read";
|
|
8
|
-
import {
|
|
8
|
+
import type { MonitoringParametersOptions } from "node-opcua-types";
|
|
9
9
|
import type { Variant } from "node-opcua-variant";
|
|
10
10
|
import type { ClientMonitoredItemBase, ClientMonitoredItemOrGroupAction } from "./client_monitored_item_base";
|
|
11
11
|
import type { ClientSubscription } from "./client_subscription";
|
|
@@ -22,8 +22,9 @@ export interface ClientMonitoredItem extends ClientMonitoredItemBase, ClientMoni
|
|
|
22
22
|
on(event: "err", eventHandler: (message: string) => void): this;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
26
|
+
export namespace ClientMonitoredItem {
|
|
27
|
+
export let create = function(
|
|
27
28
|
subscription: ClientSubscription,
|
|
28
29
|
itemToMonitor: ReadValueIdOptions,
|
|
29
30
|
monitoringParameters: MonitoringParametersOptions,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
|
-
import type { EventEmitter } from "events";
|
|
5
|
-
import {
|
|
4
|
+
import type { EventEmitter } from "node:events";
|
|
5
|
+
import type { AttributeIds } from "node-opcua-basic-types";
|
|
6
6
|
import type { QualifiedNameLike } from "node-opcua-data-model";
|
|
7
7
|
import type { DataValue } from "node-opcua-data-value";
|
|
8
8
|
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
@@ -11,6 +11,7 @@ import type { NumericRange } from "node-opcua-numeric-range";
|
|
|
11
11
|
import type { TimestampsToReturn } from "node-opcua-service-read";
|
|
12
12
|
import type {
|
|
13
13
|
MonitoredItemCreateResult,
|
|
14
|
+
MonitoredItemModifyResult,
|
|
14
15
|
MonitoringMode,
|
|
15
16
|
MonitoringParameters,
|
|
16
17
|
MonitoringParametersOptions
|
|
@@ -20,14 +21,19 @@ import type { Variant } from "node-opcua-variant";
|
|
|
20
21
|
|
|
21
22
|
import type { ClientSubscription } from "./client_subscription";
|
|
22
23
|
|
|
23
|
-
// tslint:disable:unified-signatures
|
|
24
24
|
export interface ClientMonitoredItemOrGroupAction {
|
|
25
|
-
modify(
|
|
26
|
-
|
|
25
|
+
modify(
|
|
26
|
+
parameters: MonitoringParametersOptions,
|
|
27
|
+
timestampsToReturn?: TimestampsToReturn
|
|
28
|
+
): Promise<MonitoredItemModifyResult>;
|
|
29
|
+
modify(
|
|
30
|
+
parameters: MonitoringParametersOptions,
|
|
31
|
+
callback: Callback<MonitoredItemModifyResult>
|
|
32
|
+
): void;
|
|
27
33
|
modify(
|
|
28
34
|
parameters: MonitoringParametersOptions,
|
|
29
35
|
timestampsToReturn: TimestampsToReturn | null,
|
|
30
|
-
callback: Callback<
|
|
36
|
+
callback: Callback<MonitoredItemModifyResult>
|
|
31
37
|
): void;
|
|
32
38
|
|
|
33
39
|
setMonitoringMode(monitoringMode: MonitoringMode): Promise<StatusCode>;
|
|
@@ -37,7 +43,6 @@ export interface ClientMonitoredItemOrGroupAction {
|
|
|
37
43
|
terminate(done: ErrorCallback): void;
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
// tslint:disable:unified-signatures
|
|
41
46
|
export interface ClientMonitoredItemBase extends EventEmitter, ClientMonitoredItemOrGroupAction {
|
|
42
47
|
on(event: "changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
43
48
|
on(event: "changed", eventHandler: (values: Variant[]) => void): this;
|
|
@@ -60,7 +65,7 @@ export interface ClientMonitoredItemBase {
|
|
|
60
65
|
readonly subscription: ClientSubscription;
|
|
61
66
|
readonly monitoringMode: MonitoringMode;
|
|
62
67
|
readonly statusCode: StatusCode;
|
|
63
|
-
readonly monitoredItemId?:
|
|
68
|
+
readonly monitoredItemId?: number;
|
|
64
69
|
readonly result?: MonitoredItemCreateResult;
|
|
65
70
|
readonly filterResult?: ExtensionObject;
|
|
66
71
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
|
+
import type { UInt32 } from "node-opcua-basic-types";
|
|
7
8
|
import type { TimestampsToReturn } from "node-opcua-data-value";
|
|
8
9
|
import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
|
|
9
10
|
import {
|
|
@@ -16,8 +17,7 @@ import {
|
|
|
16
17
|
type MonitoringMode,
|
|
17
18
|
type SetMonitoringModeResponse
|
|
18
19
|
} from "node-opcua-service-subscription";
|
|
19
|
-
import {
|
|
20
|
-
|
|
20
|
+
import type { Callback, ErrorCallback, StatusCode } from "node-opcua-status-code";
|
|
21
21
|
import type { MonitoredItemCreateRequestOptions, MonitoringParametersOptions } from "node-opcua-types";
|
|
22
22
|
import type { ClientMonitoredItemBase } from "./client_monitored_item_base";
|
|
23
23
|
import type { SetMonitoringModeRequestLike } from "./client_session";
|
|
@@ -26,7 +26,7 @@ import type { ClientMonitoredItemImpl } from "./private/client_monitored_item_im
|
|
|
26
26
|
import type { ClientSessionImpl } from "./private/client_session_impl";
|
|
27
27
|
|
|
28
28
|
const debugLog = make_debugLog(__filename);
|
|
29
|
-
const
|
|
29
|
+
const _doDebug = checkDebugFlag(__filename);
|
|
30
30
|
|
|
31
31
|
export interface ClientMonitoredItemBaseEx extends ClientMonitoredItemBase {
|
|
32
32
|
internalSetMonitoringMode(monitoringMode: MonitoringMode): void;
|
|
@@ -34,8 +34,8 @@ export interface ClientMonitoredItemBaseEx extends ClientMonitoredItemBase {
|
|
|
34
34
|
/**
|
|
35
35
|
* @internal
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
38
|
-
|
|
37
|
+
export namespace ClientMonitoredItemToolbox {
|
|
38
|
+
export function _toolbox_monitor(
|
|
39
39
|
subscription: ClientSubscription,
|
|
40
40
|
timestampsToReturn: TimestampsToReturn,
|
|
41
41
|
monitoredItems: ClientMonitoredItemBase[],
|
|
@@ -46,18 +46,14 @@ export class ClientMonitoredItemToolbox {
|
|
|
46
46
|
// we expect subscription to be valid and have a valid session
|
|
47
47
|
if (!subscription.hasSession) {
|
|
48
48
|
const err0 = new Error("Invalid subscription");
|
|
49
|
-
|
|
50
|
-
return done(err0);
|
|
51
|
-
}
|
|
49
|
+
done(err0);
|
|
52
50
|
return;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
// may be the subscription has been terminated or is not fully initialize, in the meantime
|
|
56
54
|
if (!subscription.isActive) {
|
|
57
55
|
const err1 = new Error("Subscription has been terminated or is not fully initialized");
|
|
58
|
-
|
|
59
|
-
return done(err1);
|
|
60
|
-
}
|
|
56
|
+
done(err1);
|
|
61
57
|
return;
|
|
62
58
|
}
|
|
63
59
|
|
|
@@ -66,7 +62,8 @@ export class ClientMonitoredItemToolbox {
|
|
|
66
62
|
const monitoredItemI = monitoredItem as ClientMonitoredItemImpl;
|
|
67
63
|
const itemToCreate = monitoredItemI._prepare_for_monitoring();
|
|
68
64
|
if (typeof itemToCreate.error === "string") {
|
|
69
|
-
|
|
65
|
+
done(new Error(itemToCreate.error));
|
|
66
|
+
return;
|
|
70
67
|
}
|
|
71
68
|
itemsToCreate.push(itemToCreate as MonitoredItemCreateRequestOptions);
|
|
72
69
|
}
|
|
@@ -107,7 +104,7 @@ export class ClientMonitoredItemToolbox {
|
|
|
107
104
|
});
|
|
108
105
|
}
|
|
109
106
|
|
|
110
|
-
|
|
107
|
+
export function _toolbox_modify(
|
|
111
108
|
subscription: ClientSubscription,
|
|
112
109
|
monitoredItems: ClientMonitoredItemBase[],
|
|
113
110
|
parameters: MonitoringParametersOptions,
|
|
@@ -139,10 +136,12 @@ export class ClientMonitoredItemToolbox {
|
|
|
139
136
|
session.modifyMonitoredItems(modifyMonitoredItemsRequest, (err: Error | null, response?: ModifyMonitoredItemsResponse) => {
|
|
140
137
|
/* c8 ignore next */
|
|
141
138
|
if (err) {
|
|
142
|
-
|
|
139
|
+
callback(err);
|
|
140
|
+
return;
|
|
143
141
|
}
|
|
144
142
|
if (!response || !(response instanceof ModifyMonitoredItemsResponse)) {
|
|
145
|
-
|
|
143
|
+
callback(new Error("internal error"));
|
|
144
|
+
return;
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
response.results = response.results || [];
|
|
@@ -153,19 +152,20 @@ export class ClientMonitoredItemToolbox {
|
|
|
153
152
|
|
|
154
153
|
/* c8 ignore next */
|
|
155
154
|
if (response.results.length === 1 && res.statusCode.isNotGood()) {
|
|
156
|
-
|
|
155
|
+
callback(new Error(`Error${res.statusCode.toString()}`));
|
|
156
|
+
return;
|
|
157
157
|
}
|
|
158
158
|
callback(null, response.results);
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
export function _toolbox_setMonitoringMode(
|
|
163
163
|
subscription: ClientSubscription,
|
|
164
164
|
monitoredItems: ClientMonitoredItemBaseEx[],
|
|
165
165
|
monitoringMode: MonitoringMode,
|
|
166
166
|
callback: Callback<StatusCode[]>
|
|
167
167
|
): void {
|
|
168
|
-
const monitoredItemIds = monitoredItems.map((monitoredItem) => monitoredItem.monitoredItemId);
|
|
168
|
+
const monitoredItemIds = monitoredItems.map((monitoredItem) => monitoredItem.monitoredItemId as UInt32);
|
|
169
169
|
|
|
170
170
|
const setMonitoringModeRequest: SetMonitoringModeRequestLike = {
|
|
171
171
|
monitoredItemIds,
|
|
@@ -178,12 +178,16 @@ export class ClientMonitoredItemToolbox {
|
|
|
178
178
|
|
|
179
179
|
session.setMonitoringMode(setMonitoringModeRequest, (err: Error | null, response?: SetMonitoringModeResponse) => {
|
|
180
180
|
if (err) {
|
|
181
|
-
|
|
181
|
+
callback(err);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (!response) {
|
|
185
|
+
callback(new Error("internal error"));
|
|
186
|
+
return;
|
|
182
187
|
}
|
|
183
188
|
monitoredItems.forEach((monitoredItem) => {
|
|
184
189
|
monitoredItem.internalSetMonitoringMode(monitoringMode);
|
|
185
190
|
});
|
|
186
|
-
response = response!;
|
|
187
191
|
response.results = response.results || [];
|
|
188
192
|
callback(null, response.results);
|
|
189
193
|
});
|
|
@@ -230,7 +230,7 @@ function __findEndpoint(this: ClientBaseImpl, endpointUrl: string, params: FindE
|
|
|
230
230
|
*/
|
|
231
231
|
async function _verify_serverCertificate(certificateManager: OPCUACertificateManager, serverCertificate: Certificate) {
|
|
232
232
|
const status = await certificateManager.checkCertificate(serverCertificate);
|
|
233
|
-
if (status
|
|
233
|
+
if (!status.isGood()) {
|
|
234
234
|
// c8 ignore next
|
|
235
235
|
if (doDebug) {
|
|
236
236
|
// do it again for debug purposes
|
|
@@ -1481,14 +1481,35 @@ export class ClientBaseImpl<Events extends OPCUAClientBaseEvents = OPCUAClientBa
|
|
|
1481
1481
|
warningLog("[NODE-OPCUA-W25] client's server certificate verification has failed ", err1.message);
|
|
1482
1482
|
warningLog(" clientCertificateManager.rootDir = ", this.clientCertificateManager.rootDir);
|
|
1483
1483
|
|
|
1484
|
-
const f = (b: Buffer) =>
|
|
1485
|
-
` ${b.toString("base64").replace(/(.{80})/g, "$1\n ")}`;
|
|
1486
|
-
|
|
1487
1484
|
const chain = split_der(endpoint.serverCertificate);
|
|
1488
|
-
warningLog(`
|
|
1485
|
+
warningLog(` server certificate chain contains ${chain.length} element(s)`);
|
|
1489
1486
|
for (let i = 0; i < chain.length; i++) {
|
|
1490
1487
|
const c = chain[i];
|
|
1491
|
-
|
|
1488
|
+
const thumbprint = makeSHA1Thumbprint(c).toString("hex");
|
|
1489
|
+
try {
|
|
1490
|
+
const { exploreCertificate } = require("node-opcua-crypto");
|
|
1491
|
+
const info = exploreCertificate(c);
|
|
1492
|
+
const tbs = info.tbsCertificate;
|
|
1493
|
+
const cn = tbs.subject?.commonName ?? "unknown";
|
|
1494
|
+
const issuerCN = tbs.issuer?.commonName ?? "unknown";
|
|
1495
|
+
const isCA = tbs.extensions?.basicConstraints?.cA === true;
|
|
1496
|
+
const isSelfSigned = JSON.stringify(tbs.subject) === JSON.stringify(tbs.issuer);
|
|
1497
|
+
const certType = isCA
|
|
1498
|
+
? (isSelfSigned ? "Root CA" : "Intermediate CA")
|
|
1499
|
+
: (isSelfSigned ? "Application (self-signed)" : "Application (CA-signed)");
|
|
1500
|
+
const ski = tbs.extensions?.subjectKeyIdentifier ?? "-";
|
|
1501
|
+
const aki = tbs.extensions?.authorityKeyIdentifier?.keyIdentifier ?? "-";
|
|
1502
|
+
const notBefore = tbs.validity.notBefore.toISOString();
|
|
1503
|
+
const notAfter = tbs.validity.notAfter.toISOString();
|
|
1504
|
+
warningLog(` [${i + 1}/${chain.length}] "${cn}" (${certType})`);
|
|
1505
|
+
warningLog(` thumbprint: ${thumbprint}`);
|
|
1506
|
+
warningLog(` issuer: "${issuerCN}"`);
|
|
1507
|
+
warningLog(` SKI: ${ski}`);
|
|
1508
|
+
warningLog(` AKI: ${aki}`);
|
|
1509
|
+
warningLog(` validity: ${notBefore} → ${notAfter}`);
|
|
1510
|
+
} catch {
|
|
1511
|
+
warningLog(` [${i + 1}/${chain.length}] thumbprint: ${thumbprint} (details unavailable)`);
|
|
1512
|
+
}
|
|
1492
1513
|
}
|
|
1493
1514
|
if (chain.length > 1) {
|
|
1494
1515
|
warningLog(
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* @module node-opcua-client-private
|
|
3
3
|
*/
|
|
4
4
|
// tslint:disable:no-empty
|
|
5
|
-
import { EventEmitter } from "events";
|
|
5
|
+
import { EventEmitter } from "node:events";
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
7
|
import { coerceTimestampsToReturn, type DataValue, TimestampsToReturn } from "node-opcua-data-value";
|
|
8
8
|
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
9
|
-
import { resolveNodeId } from "node-opcua-nodeid";
|
|
9
|
+
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
10
10
|
import { MonitoringMode, type MonitoringParametersOptions } from "node-opcua-service-subscription";
|
|
11
11
|
import type { Callback, ErrorCallback, StatusCode } from "node-opcua-status-code";
|
|
12
|
-
import type { ReadValueIdOptions } from "node-opcua-types";
|
|
12
|
+
import type { MonitoredItemModifyResult, ReadValueIdOptions } from "node-opcua-types";
|
|
13
13
|
import type { ClientMonitoredItemBase } from "../client_monitored_item_base";
|
|
14
14
|
import { ClientMonitoredItemGroup } from "../client_monitored_item_group";
|
|
15
15
|
import { type ClientMonitoredItemBaseEx, ClientMonitoredItemToolbox } from "../client_monitored_item_toolbox";
|
|
@@ -17,8 +17,7 @@ import type { ClientSubscription } from "../client_subscription";
|
|
|
17
17
|
import { ClientMonitoredItemImpl } from "./client_monitored_item_impl";
|
|
18
18
|
import type { ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const doDebug = checkDebugFlag(__filename);
|
|
20
|
+
|
|
22
21
|
const warningLog = make_warningLog(__filename);
|
|
23
22
|
|
|
24
23
|
/**
|
|
@@ -38,7 +37,7 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
38
37
|
|
|
39
38
|
constructor(
|
|
40
39
|
subscription: ClientSubscription,
|
|
41
|
-
itemsToMonitor:
|
|
40
|
+
itemsToMonitor: ReadValueIdOptions[],
|
|
42
41
|
monitoringParameters: MonitoringParametersOptions,
|
|
43
42
|
timestampsToReturn: TimestampsToReturn,
|
|
44
43
|
monitoringMode: MonitoringMode = MonitoringMode.Reporting
|
|
@@ -47,7 +46,7 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
47
46
|
assert(Array.isArray(itemsToMonitor));
|
|
48
47
|
// Try to resolve the nodeId and fail fast if we can't.
|
|
49
48
|
itemsToMonitor.forEach((itemToMonitor: ReadValueIdOptions) => {
|
|
50
|
-
itemToMonitor.nodeId = resolveNodeId(itemToMonitor.nodeId
|
|
49
|
+
itemToMonitor.nodeId = resolveNodeId(itemToMonitor.nodeId || NodeId.nullNodeId);
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
timestampsToReturn = coerceTimestampsToReturn(timestampsToReturn);
|
|
@@ -82,8 +81,8 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
82
81
|
)
|
|
83
82
|
.join("\n") +
|
|
84
83
|
"\n];\n";
|
|
85
|
-
ret +=
|
|
86
|
-
ret +=
|
|
84
|
+
ret += `timestampsToReturn: ${TimestampsToReturn[this.timestampsToReturn]}\n`;
|
|
85
|
+
ret += `monitoringMode ${MonitoringMode[this.monitoringMode]}`;
|
|
87
86
|
return ret;
|
|
88
87
|
}
|
|
89
88
|
|
|
@@ -109,13 +108,13 @@ export class ClientMonitoredItemGroupImpl extends EventEmitter implements Client
|
|
|
109
108
|
/**
|
|
110
109
|
|
|
111
110
|
*/
|
|
112
|
-
public async modify(parameters: MonitoringParametersOptions): Promise<
|
|
113
|
-
public async modify(parameters: MonitoringParametersOptions, timestampsToReturn: TimestampsToReturn): Promise<
|
|
114
|
-
public modify(parameters: MonitoringParametersOptions, callback:
|
|
111
|
+
public async modify(parameters: MonitoringParametersOptions): Promise<MonitoredItemModifyResult>;
|
|
112
|
+
public async modify(parameters: MonitoringParametersOptions, timestampsToReturn: TimestampsToReturn): Promise<MonitoredItemModifyResult>;
|
|
113
|
+
public modify(parameters: MonitoringParametersOptions, callback: Callback<MonitoredItemModifyResult>): void;
|
|
115
114
|
public modify(
|
|
116
115
|
parameters: MonitoringParametersOptions,
|
|
117
116
|
timestampsToReturn: TimestampsToReturn | null,
|
|
118
|
-
callback:
|
|
117
|
+
callback: Callback<MonitoredItemModifyResult>
|
|
119
118
|
): void;
|
|
120
119
|
public modify(...args: any[]): any {
|
|
121
120
|
if (args.length === 2) {
|
|
@@ -223,8 +222,8 @@ ClientMonitoredItemGroupImpl.prototype.modify = withCallback(ClientMonitoredItem
|
|
|
223
222
|
|
|
224
223
|
ClientMonitoredItemGroup.create = (
|
|
225
224
|
subscription: ClientSubscription,
|
|
226
|
-
itemsToMonitor:
|
|
227
|
-
monitoringParameters:
|
|
225
|
+
itemsToMonitor: ReadValueIdOptions[],
|
|
226
|
+
monitoringParameters: MonitoringParametersOptions,
|
|
228
227
|
timestampsToReturn: TimestampsToReturn
|
|
229
228
|
) => {
|
|
230
229
|
const monitoredItemGroup = new ClientMonitoredItemGroupImpl(
|
|
@@ -238,7 +237,7 @@ ClientMonitoredItemGroup.create = (
|
|
|
238
237
|
if (err) {
|
|
239
238
|
return;
|
|
240
239
|
}
|
|
241
|
-
monitoredItemGroup._monitor((
|
|
240
|
+
monitoredItemGroup._monitor((_err1?: Error) => {
|
|
242
241
|
/** */
|
|
243
242
|
});
|
|
244
243
|
});
|