node-opcua-client 2.166.0 → 2.168.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 +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools.js +2 -2
- package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
- package/dist/alarms_and_conditions/client_tools.d.ts +3 -0
- package/dist/alarms_and_conditions/client_tools.js +2 -2
- package/dist/alarms_and_conditions/client_tools.js.map +1 -1
- package/dist/client_base.d.ts +47 -40
- package/dist/client_base.js +5 -6
- package/dist/client_base.js.map +1 -1
- package/dist/client_monitored_item.d.ts +7 -7
- package/dist/client_monitored_item.js.map +1 -1
- package/dist/client_monitored_item_base.d.ts +12 -13
- package/dist/client_monitored_item_group.d.ts +5 -5
- package/dist/client_monitored_item_toolbox.d.ts +6 -7
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session.d.ts +19 -23
- package/dist/client_session.js.map +1 -1
- package/dist/client_session_keepalive_manager.d.ts +1 -1
- package/dist/client_session_keepalive_manager.js +6 -6
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/client_subscription.d.ts +11 -12
- package/dist/client_subscription.js.map +1 -1
- package/dist/client_utils.d.ts +3 -3
- package/dist/client_utils.js.map +1 -1
- package/dist/common.d.ts +12 -12
- package/dist/index.d.ts +26 -27
- package/dist/index.js +65 -66
- package/dist/index.js.map +1 -1
- package/dist/opcua_client.d.ts +17 -19
- package/dist/opcua_client.js.map +1 -1
- package/dist/private/client_base_impl.d.ts +19 -18
- package/dist/private/client_base_impl.js +220 -192
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_group_impl.d.ts +4 -5
- package/dist/private/client_monitored_item_group_impl.js +1 -1
- package/dist/private/client_monitored_item_group_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.d.ts +9 -10
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_publish_engine.d.ts +3 -3
- package/dist/private/client_publish_engine.js +6 -7
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +24 -25
- package/dist/private/client_session_impl.js +14 -10
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.d.ts +10 -11
- package/dist/private/client_subscription_impl.js +12 -11
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/i_private_client.d.ts +7 -7
- package/dist/private/opcua_client_impl.d.ts +12 -9
- package/dist/private/opcua_client_impl.js +58 -48
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/performance.js.map +1 -1
- package/dist/private/reconnection/client_publish_engine_reconnection.d.ts +1 -1
- package/dist/private/reconnection/client_publish_engine_reconnection.js +54 -43
- package/dist/private/reconnection/client_publish_engine_reconnection.js.map +1 -1
- package/dist/private/reconnection/client_reconnection.d.ts +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.d.ts +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.js +2 -2
- package/dist/private/reconnection/client_subscription_reconnection.js.map +1 -1
- package/dist/private/reconnection/reconnection.d.ts +4 -4
- package/dist/private/reconnection/reconnection.js +200 -281
- package/dist/private/reconnection/reconnection.js.map +1 -1
- package/dist/tools/findservers.d.ts +7 -2
- package/dist/tools/findservers.js +41 -53
- package/dist/tools/findservers.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.d.ts +1 -1
- package/dist/tools/read_history_server_capabilities.js +9 -8
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/dist/user_identity_info.d.ts +1 -1
- package/dist/verify.js.map +1 -1
- package/package.json +45 -45
- package/source/alarms_and_conditions/client_alarm_tools.ts +14 -8
- package/source/alarms_and_conditions/client_tools.ts +7 -6
- package/source/client_base.ts +93 -79
- package/source/client_monitored_item.ts +7 -8
- package/source/client_monitored_item_base.ts +12 -14
- package/source/client_monitored_item_group.ts +5 -5
- package/source/client_monitored_item_toolbox.ts +13 -14
- package/source/client_session.ts +37 -40
- package/source/client_session_keepalive_manager.ts +7 -10
- package/source/client_subscription.ts +11 -12
- package/source/client_utils.ts +6 -6
- package/source/common.ts +12 -12
- package/source/index.ts +44 -40
- package/source/opcua_client.ts +24 -23
- package/source/private/client_base_impl.ts +329 -290
- package/source/private/client_monitored_item_group_impl.ts +10 -14
- package/source/private/client_monitored_item_impl.ts +17 -17
- package/source/private/client_publish_engine.ts +11 -12
- package/source/private/client_session_impl.ts +85 -82
- package/source/private/client_subscription_impl.ts +42 -41
- package/source/private/i_private_client.ts +8 -8
- package/source/private/opcua_client_impl.ts +118 -97
- package/source/private/performance.ts +2 -3
- package/source/private/reconnection/client_publish_engine_reconnection.ts +76 -68
- package/source/private/reconnection/client_reconnection.ts +1 -1
- package/source/private/reconnection/client_subscription_reconnection.ts +16 -13
- package/source/private/reconnection/reconnection.ts +307 -301
- package/source/tools/findservers.ts +43 -62
- package/source/tools/read_history_server_capabilities.ts +20 -22
- package/source/user_identity_info.ts +5 -5
- package/source/verify.ts +25 -25
|
@@ -4,21 +4,18 @@
|
|
|
4
4
|
// tslint:disable:no-empty
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
|
-
import { DataValue, TimestampsToReturn
|
|
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 { MonitoringMode, MonitoringParametersOptions } from "node-opcua-service-subscription";
|
|
10
|
-
import { StatusCode } from "node-opcua-status-code";
|
|
11
|
-
import { Callback, ErrorCallback } from "node-opcua-status-code";
|
|
12
|
-
|
|
13
9
|
import { resolveNodeId } from "node-opcua-nodeid";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
10
|
+
import { MonitoringMode, type MonitoringParametersOptions } from "node-opcua-service-subscription";
|
|
11
|
+
import type { Callback, ErrorCallback, StatusCode } from "node-opcua-status-code";
|
|
12
|
+
import type { ReadValueIdOptions } from "node-opcua-types";
|
|
13
|
+
import type { ClientMonitoredItemBase } from "../client_monitored_item_base";
|
|
16
14
|
import { ClientMonitoredItemGroup } from "../client_monitored_item_group";
|
|
17
|
-
import { ClientMonitoredItemToolbox } from "../client_monitored_item_toolbox";
|
|
18
|
-
import { ClientSubscription } from "../client_subscription";
|
|
15
|
+
import { type ClientMonitoredItemBaseEx, ClientMonitoredItemToolbox } from "../client_monitored_item_toolbox";
|
|
16
|
+
import type { ClientSubscription } from "../client_subscription";
|
|
19
17
|
import { ClientMonitoredItemImpl } from "./client_monitored_item_impl";
|
|
20
|
-
import { ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
21
|
-
import { ClientMonitoredItemBaseEx } from "../client_monitored_item_toolbox";
|
|
18
|
+
import type { ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
22
19
|
|
|
23
20
|
const debugLog = make_debugLog(__filename);
|
|
24
21
|
const doDebug = checkDebugFlag(__filename);
|
|
@@ -217,12 +214,11 @@ Please investigate the code of the event handler function to fix the error.`
|
|
|
217
214
|
// tslint:disable:no-var-requires
|
|
218
215
|
// tslint:disable:max-line-length
|
|
219
216
|
import { withCallback } from "thenify-ex";
|
|
217
|
+
|
|
220
218
|
const opts = { multiArgs: false };
|
|
221
219
|
|
|
222
220
|
ClientMonitoredItemGroupImpl.prototype.terminate = withCallback(ClientMonitoredItemGroupImpl.prototype.terminate);
|
|
223
|
-
ClientMonitoredItemGroupImpl.prototype.setMonitoringMode = withCallback(
|
|
224
|
-
ClientMonitoredItemGroupImpl.prototype.setMonitoringMode
|
|
225
|
-
);
|
|
221
|
+
ClientMonitoredItemGroupImpl.prototype.setMonitoringMode = withCallback(ClientMonitoredItemGroupImpl.prototype.setMonitoringMode);
|
|
226
222
|
ClientMonitoredItemGroupImpl.prototype.modify = withCallback(ClientMonitoredItemGroupImpl.prototype.modify);
|
|
227
223
|
|
|
228
224
|
ClientMonitoredItemGroup.create = (
|
|
@@ -7,26 +7,25 @@ import { EventEmitter } from "events";
|
|
|
7
7
|
import { assert } from "node-opcua-assert";
|
|
8
8
|
|
|
9
9
|
import { AttributeIds } from "node-opcua-data-model";
|
|
10
|
-
import {
|
|
10
|
+
import { coerceTimestampsToReturn, type DataValue } from "node-opcua-data-value";
|
|
11
11
|
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
12
|
-
import { ExtensionObject } from "node-opcua-extension-object";
|
|
12
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
13
13
|
import { EventFilter } from "node-opcua-service-filter";
|
|
14
|
-
import { ReadValueId, ReadValueIdOptions, TimestampsToReturn } from "node-opcua-service-read";
|
|
14
|
+
import { ReadValueId, type ReadValueIdOptions, type TimestampsToReturn } from "node-opcua-service-read";
|
|
15
15
|
import {
|
|
16
|
-
MonitoredItemCreateResult,
|
|
17
|
-
MonitoredItemModifyResult,
|
|
16
|
+
type MonitoredItemCreateResult,
|
|
17
|
+
type MonitoredItemModifyResult,
|
|
18
18
|
MonitoringMode,
|
|
19
19
|
MonitoringParameters,
|
|
20
|
-
MonitoringParametersOptions
|
|
20
|
+
type MonitoringParametersOptions
|
|
21
21
|
} from "node-opcua-service-subscription";
|
|
22
|
-
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
23
|
-
import { Variant } from "node-opcua-variant";
|
|
24
|
-
import { Callback, ErrorCallback } from "node-opcua-status-code";
|
|
22
|
+
import { type Callback, type ErrorCallback, type StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
23
|
+
import type { Variant } from "node-opcua-variant";
|
|
25
24
|
|
|
26
25
|
import { ClientMonitoredItem } from "../client_monitored_item";
|
|
27
|
-
import {
|
|
28
|
-
import { ClientSubscription } from "../client_subscription";
|
|
29
|
-
import { ClientMonitoredItem_create, ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
26
|
+
import { type ClientMonitoredItemBaseEx, ClientMonitoredItemToolbox } from "../client_monitored_item_toolbox";
|
|
27
|
+
import type { ClientSubscription } from "../client_subscription";
|
|
28
|
+
import { ClientMonitoredItem_create, type ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
30
29
|
|
|
31
30
|
const debugLog = make_debugLog(__filename);
|
|
32
31
|
const warningLog = make_warningLog(__filename);
|
|
@@ -35,11 +34,11 @@ const doDebug = checkDebugFlag(__filename);
|
|
|
35
34
|
export type PrepareForMonitoringResult =
|
|
36
35
|
| { error: string }
|
|
37
36
|
| {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
error?: null;
|
|
38
|
+
itemToMonitor: ReadValueIdOptions;
|
|
39
|
+
monitoringMode: MonitoringMode;
|
|
40
|
+
requestedParameters: MonitoringParameters;
|
|
41
|
+
};
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* ClientMonitoredItem
|
|
@@ -390,6 +389,7 @@ export class ClientMonitoredItemImpl extends EventEmitter implements ClientMonit
|
|
|
390
389
|
// tslint:disable:no-var-requires
|
|
391
390
|
// tslint:disable:max-line-length
|
|
392
391
|
import { withCallback } from "thenify-ex";
|
|
392
|
+
|
|
393
393
|
const opts = { multiArgs: false };
|
|
394
394
|
|
|
395
395
|
ClientMonitoredItemImpl.prototype.terminate = withCallback(ClientMonitoredItemImpl.prototype.terminate);
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* @module node-opcua-client-private
|
|
3
3
|
*/
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
-
import { getMinOPCUADate } from "node-opcua-date-time";
|
|
6
5
|
import { assert } from "node-opcua-assert";
|
|
6
|
+
import { getMinOPCUADate } from "node-opcua-date-time";
|
|
7
7
|
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
8
|
-
import { PublishRequest, PublishResponse } from "node-opcua-service-subscription";
|
|
8
|
+
import { PublishRequest, type PublishResponse } from "node-opcua-service-subscription";
|
|
9
9
|
|
|
10
|
-
import { ClientSession, SubscriptionId } from "../client_session";
|
|
11
|
-
import { ClientSubscription } from "../client_subscription";
|
|
12
|
-
import { ClientSessionImpl } from "../private/client_session_impl";
|
|
13
|
-
import { ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
10
|
+
import type { ClientSession, SubscriptionId } from "../client_session";
|
|
11
|
+
import type { ClientSubscription } from "../client_subscription";
|
|
12
|
+
import type { ClientSessionImpl } from "../private/client_session_impl";
|
|
13
|
+
import type { ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
14
14
|
|
|
15
15
|
const debugLog = make_debugLog(__filename);
|
|
16
16
|
const doDebug = checkDebugFlag(__filename);
|
|
@@ -141,7 +141,7 @@ export class ClientSidePublishEngine {
|
|
|
141
141
|
const _subscription = subscription as ClientSubscriptionImpl;
|
|
142
142
|
assert(arguments.length === 1);
|
|
143
143
|
assert(isFinite(subscription.subscriptionId));
|
|
144
|
-
assert(!Object.
|
|
144
|
+
assert(!Object.hasOwn(this.subscriptionMap, subscription.subscriptionId)); // already registered ?
|
|
145
145
|
assert(typeof _subscription.onNotificationMessage === "function");
|
|
146
146
|
assert(isFinite(subscription.timeoutHint));
|
|
147
147
|
|
|
@@ -186,7 +186,7 @@ export class ClientSidePublishEngine {
|
|
|
186
186
|
// note : it is possible that we get here while the server has already requested
|
|
187
187
|
// a session shutdown ... in this case it is possible that subscriptionId is already
|
|
188
188
|
// removed
|
|
189
|
-
if (Object.
|
|
189
|
+
if (Object.hasOwn(this.subscriptionMap, subscriptionId)) {
|
|
190
190
|
delete this.subscriptionMap[subscriptionId];
|
|
191
191
|
} else {
|
|
192
192
|
debugLog("ClientSidePublishEngine#unregisterSubscription cannot find subscription ", subscriptionId);
|
|
@@ -202,13 +202,13 @@ export class ClientSidePublishEngine {
|
|
|
202
202
|
*/
|
|
203
203
|
public getSubscription(subscriptionId: SubscriptionId): ClientSubscription {
|
|
204
204
|
assert(isFinite(subscriptionId) && subscriptionId > 0);
|
|
205
|
-
assert(Object.
|
|
205
|
+
assert(Object.hasOwn(this.subscriptionMap, subscriptionId));
|
|
206
206
|
return this.subscriptionMap[subscriptionId];
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
public hasSubscription(subscriptionId: SubscriptionId): boolean {
|
|
210
210
|
assert(isFinite(subscriptionId) && subscriptionId > 0);
|
|
211
|
-
return Object.
|
|
211
|
+
return Object.hasOwn(this.subscriptionMap, subscriptionId);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
public internalSendPublishRequest(): void {
|
|
@@ -334,8 +334,7 @@ export class ClientSidePublishEngine {
|
|
|
334
334
|
// transfer completes.
|
|
335
335
|
debugLog(
|
|
336
336
|
chalk.bgWhite.yellow(
|
|
337
|
-
" WARNING: BadSecureChannelIdInvalid on PublishRequest"
|
|
338
|
-
+ " - session transfer may be in progress"
|
|
337
|
+
" WARNING: BadSecureChannelIdInvalid on PublishRequest" + " - session transfer may be in progress"
|
|
339
338
|
)
|
|
340
339
|
);
|
|
341
340
|
active = false;
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-client-private
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
+
import { EventEmitter } from "events";
|
|
6
7
|
import { assert } from "node-opcua-assert";
|
|
7
|
-
import {
|
|
8
|
-
import { DateTime } from "node-opcua-basic-types";
|
|
8
|
+
import type { DateTime } from "node-opcua-basic-types";
|
|
9
9
|
import {
|
|
10
|
+
type ExtraDataTypeManager,
|
|
10
11
|
extractDataValueToPromote,
|
|
11
|
-
ExtraDataTypeManager,
|
|
12
12
|
getExtensionObjectConstructor,
|
|
13
13
|
getExtraDataTypeManager,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type PseudoDataValue,
|
|
15
|
+
promoteOpaqueStructure
|
|
16
16
|
} from "node-opcua-client-dynamic-extension-object";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import type { AggregateFunction } from "node-opcua-constants";
|
|
18
|
+
import type { Certificate, Nonce } from "node-opcua-crypto/web";
|
|
19
|
+
import { BrowseDirection, type LocalizedTextLike } from "node-opcua-data-model";
|
|
19
20
|
import { DataValue } from "node-opcua-data-value";
|
|
20
21
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
21
|
-
import { ExtensionObject } from "node-opcua-extension-object";
|
|
22
|
-
import { coerceNodeId, NodeId, NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
|
|
22
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
23
|
+
import { coerceNodeId, NodeId, type NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
|
|
23
24
|
import {
|
|
24
|
-
|
|
25
|
+
type BrowseDescriptionLike,
|
|
25
26
|
getArgumentDefinitionHelper,
|
|
26
|
-
|
|
27
|
+
getBuiltInDataType,
|
|
28
|
+
type IBasicSessionAsync2,
|
|
29
|
+
type IBasicTransportSettings,
|
|
30
|
+
type NodeAttributes,
|
|
31
|
+
type ResponseCallback,
|
|
27
32
|
readAllAttributes,
|
|
28
|
-
NodeAttributes,
|
|
29
|
-
ResponseCallback,
|
|
30
|
-
BrowseDescriptionLike,
|
|
31
|
-
IBasicSessionAsync2,
|
|
32
33
|
readNamespaceArray
|
|
33
34
|
} from "node-opcua-pseudo-session";
|
|
34
|
-
import { AnyConstructorFunc } from "node-opcua-schemas";
|
|
35
|
-
import { ClientSecureChannelLayer, requestHandleNotSetValue, SignatureData } from "node-opcua-secure-channel";
|
|
35
|
+
import type { AnyConstructorFunc } from "node-opcua-schemas";
|
|
36
|
+
import { ClientSecureChannelLayer, requestHandleNotSetValue, type SignatureData } from "node-opcua-secure-channel";
|
|
36
37
|
import { BrowseDescription, BrowseRequest, BrowseResponse, BrowseResult } from "node-opcua-service-browse";
|
|
37
|
-
import { CallMethodRequest, CallMethodResult, CallRequest, CallResponse } from "node-opcua-service-call";
|
|
38
|
-
import { EndpointDescription } from "node-opcua-service-endpoints";
|
|
38
|
+
import { CallMethodRequest, type CallMethodResult, CallRequest, CallResponse } from "node-opcua-service-call";
|
|
39
|
+
import type { EndpointDescription } from "node-opcua-service-endpoints";
|
|
39
40
|
import {
|
|
41
|
+
HistoryData,
|
|
40
42
|
HistoryReadRequest,
|
|
41
43
|
HistoryReadResponse,
|
|
42
|
-
HistoryReadResult,
|
|
43
|
-
|
|
44
|
-
ReadRawModifiedDetails
|
|
45
|
-
ReadProcessedDetails
|
|
44
|
+
type HistoryReadResult,
|
|
45
|
+
ReadProcessedDetails,
|
|
46
|
+
ReadRawModifiedDetails
|
|
46
47
|
} from "node-opcua-service-history";
|
|
47
48
|
import { QueryFirstRequest, QueryFirstResponse } from "node-opcua-service-query";
|
|
48
49
|
import {
|
|
@@ -50,7 +51,7 @@ import {
|
|
|
50
51
|
ReadRequest,
|
|
51
52
|
ReadResponse,
|
|
52
53
|
ReadValueId,
|
|
53
|
-
ReadValueIdOptions,
|
|
54
|
+
type ReadValueIdOptions,
|
|
54
55
|
TimestampsToReturn
|
|
55
56
|
} from "node-opcua-service-read";
|
|
56
57
|
import {
|
|
@@ -80,35 +81,34 @@ import {
|
|
|
80
81
|
SetMonitoringModeResponse,
|
|
81
82
|
SetPublishingModeRequest,
|
|
82
83
|
SetPublishingModeResponse,
|
|
83
|
-
SetTriggeringRequestOptions,
|
|
84
|
-
SetTriggeringResponse,
|
|
85
84
|
SetTriggeringRequest,
|
|
85
|
+
type SetTriggeringRequestOptions,
|
|
86
|
+
SetTriggeringResponse,
|
|
86
87
|
TransferSubscriptionsRequest,
|
|
87
88
|
TransferSubscriptionsResponse
|
|
88
89
|
} from "node-opcua-service-subscription";
|
|
89
90
|
import {
|
|
90
|
-
BrowsePath,
|
|
91
|
-
BrowsePathResult,
|
|
91
|
+
type BrowsePath,
|
|
92
|
+
type BrowsePathResult,
|
|
92
93
|
TranslateBrowsePathsToNodeIdsRequest,
|
|
93
94
|
TranslateBrowsePathsToNodeIdsResponse
|
|
94
95
|
} from "node-opcua-service-translate-browse-path";
|
|
95
96
|
import { WriteRequest, WriteResponse, WriteValue } from "node-opcua-service-write";
|
|
96
|
-
import {
|
|
97
|
-
import { ErrorCallback } from "node-opcua-status-code";
|
|
97
|
+
import { type Callback, type CallbackT, type ErrorCallback, type StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
98
98
|
import {
|
|
99
99
|
ActivateSessionRequest,
|
|
100
|
-
AggregateConfigurationOptions,
|
|
100
|
+
type AggregateConfigurationOptions,
|
|
101
101
|
BrowseNextRequest,
|
|
102
102
|
BrowseNextResponse,
|
|
103
103
|
CloseSessionRequest,
|
|
104
|
-
HistoryReadValueIdOptions,
|
|
104
|
+
type HistoryReadValueIdOptions,
|
|
105
105
|
UserTokenType,
|
|
106
|
-
WriteValueOptions
|
|
106
|
+
type WriteValueOptions
|
|
107
107
|
} from "node-opcua-types";
|
|
108
108
|
import { buffer_ellipsis, getFunctionParameterNames, isNullOrUndefined } from "node-opcua-utils";
|
|
109
|
-
import { DataType, Variant, VariantLike } from "node-opcua-variant";
|
|
109
|
+
import { DataType, type Variant, type VariantLike } from "node-opcua-variant";
|
|
110
110
|
|
|
111
|
-
import {
|
|
111
|
+
import type {
|
|
112
112
|
ArgumentDefinition,
|
|
113
113
|
CallMethodRequestLike,
|
|
114
114
|
ClientSession,
|
|
@@ -116,6 +116,8 @@ import {
|
|
|
116
116
|
CreateSubscriptionRequestLike,
|
|
117
117
|
DeleteMonitoredItemsRequestLike,
|
|
118
118
|
DeleteSubscriptionsRequestLike,
|
|
119
|
+
ExtraReadHistoryValueParameters,
|
|
120
|
+
HistoryReadValueIdOptions2,
|
|
119
121
|
MethodId,
|
|
120
122
|
ModifyMonitoredItemsRequestLike,
|
|
121
123
|
ModifySubscriptionRequestLike,
|
|
@@ -123,18 +125,16 @@ import {
|
|
|
123
125
|
QueryFirstRequestLike,
|
|
124
126
|
SetMonitoringModeRequestLike,
|
|
125
127
|
SubscriptionId,
|
|
126
|
-
TransferSubscriptionsRequestLike
|
|
127
|
-
HistoryReadValueIdOptions2,
|
|
128
|
-
ExtraReadHistoryValueParameters
|
|
128
|
+
TransferSubscriptionsRequestLike
|
|
129
129
|
} from "../client_session";
|
|
130
|
-
import { UserIdentityInfo } from "../user_identity_info";
|
|
131
130
|
import { ClientSessionKeepAliveManager } from "../client_session_keepalive_manager";
|
|
132
|
-
import { ClientSubscription } from "../client_subscription";
|
|
133
|
-
import { Request, Response } from "../common";
|
|
131
|
+
import type { ClientSubscription } from "../client_subscription";
|
|
132
|
+
import type { Request, Response } from "../common";
|
|
133
|
+
import type { UserIdentityInfo } from "../user_identity_info";
|
|
134
134
|
|
|
135
135
|
import { ClientSidePublishEngine } from "./client_publish_engine";
|
|
136
136
|
import { ClientSubscriptionImpl } from "./client_subscription_impl";
|
|
137
|
-
import { IClientBase } from "./i_private_client";
|
|
137
|
+
import type { IClientBase } from "./i_private_client";
|
|
138
138
|
import { repair_client_session } from "./reconnection/reconnection";
|
|
139
139
|
|
|
140
140
|
const helpAPIChange = process.env.DEBUG && process.env.DEBUG.match(/API/);
|
|
@@ -184,7 +184,7 @@ export interface Reconnectable {
|
|
|
184
184
|
_reconnecting: {
|
|
185
185
|
reconnecting: boolean;
|
|
186
186
|
pendingCallbacks: EmptyCallback[];
|
|
187
|
-
pendingTransactions: { request: Request
|
|
187
|
+
pendingTransactions: { request: Request; callback: (err: Error | null, response?: Response) => void }[];
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -405,8 +405,8 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
405
405
|
if (r.references && r.references.length > this.requestedMaxReferencesPerNode) {
|
|
406
406
|
warningLog(
|
|
407
407
|
chalk.yellow("warning") +
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
" BrowseResponse : the server didn't take into" +
|
|
409
|
+
" account our requestedMaxReferencesPerNode "
|
|
410
410
|
);
|
|
411
411
|
warningLog(" this.requestedMaxReferencesPerNode= " + this.requestedMaxReferencesPerNode);
|
|
412
412
|
warningLog(" got " + r.references.length + "for " + nodesToBrowse[i].nodeId.toString());
|
|
@@ -415,7 +415,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
for (const r of results) {
|
|
418
|
-
r.references = r.references || /* c8 ignore next */[];
|
|
418
|
+
r.references = r.references || /* c8 ignore next */ [];
|
|
419
419
|
}
|
|
420
420
|
assert(results[0] instanceof BrowseResult);
|
|
421
421
|
return callback(null, isArray ? results : results[0]);
|
|
@@ -710,7 +710,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
710
710
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
-
response.results = response.results || /* c8 ignore next */[];
|
|
713
|
+
response.results = response.results || /* c8 ignore next */ [];
|
|
714
714
|
|
|
715
715
|
// perform ExtensionObject resolution
|
|
716
716
|
const promises = response.results.map(async (result) => {
|
|
@@ -723,8 +723,8 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
723
723
|
Promise.all(promises)
|
|
724
724
|
.then(() => {
|
|
725
725
|
callback(null, response);
|
|
726
|
-
})
|
|
727
|
-
|
|
726
|
+
})
|
|
727
|
+
.catch((err) => callback(err));
|
|
728
728
|
});
|
|
729
729
|
}
|
|
730
730
|
|
|
@@ -855,7 +855,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
855
855
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
-
response.results = response.results || /* c8 ignore next */[];
|
|
858
|
+
response.results = response.results || /* c8 ignore next */ [];
|
|
859
859
|
|
|
860
860
|
assert(nodesToRead.length === response.results.length);
|
|
861
861
|
|
|
@@ -994,7 +994,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
994
994
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
995
995
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
996
996
|
}
|
|
997
|
-
response.results = response.results || /* c8 ignore next */[];
|
|
997
|
+
response.results = response.results || /* c8 ignore next */ [];
|
|
998
998
|
assert(nodesToWrite.length === response.results.length);
|
|
999
999
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1000
1000
|
});
|
|
@@ -1189,7 +1189,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1189
1189
|
warningLog(
|
|
1190
1190
|
chalk.yellow(
|
|
1191
1191
|
"please make sure to refactor your code and check that " +
|
|
1192
|
-
|
|
1192
|
+
"the second argument of your callback function is named"
|
|
1193
1193
|
),
|
|
1194
1194
|
chalk.cyan("dataValue" + (isArray ? "s" : ""))
|
|
1195
1195
|
);
|
|
@@ -1221,12 +1221,14 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1221
1221
|
}
|
|
1222
1222
|
|
|
1223
1223
|
// perform ExtensionObject resolution
|
|
1224
|
-
promoteOpaqueStructure(this, response.results!)
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1224
|
+
promoteOpaqueStructure(this, response.results!)
|
|
1225
|
+
.then(() => {
|
|
1226
|
+
response.results = response.results || /* c8 ignore next */ [];
|
|
1227
|
+
callback(null, isArray ? response.results : response.results[0]);
|
|
1228
|
+
})
|
|
1229
|
+
.catch((err) => {
|
|
1230
|
+
callback(err);
|
|
1231
|
+
});
|
|
1230
1232
|
});
|
|
1231
1233
|
}
|
|
1232
1234
|
|
|
@@ -1399,7 +1401,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1399
1401
|
if (!response) {
|
|
1400
1402
|
return callback(new Error("Internal Error"));
|
|
1401
1403
|
}
|
|
1402
|
-
response.results = response.results || /* c8 ignore next */[];
|
|
1404
|
+
response.results = response.results || /* c8 ignore next */ [];
|
|
1403
1405
|
callback(err, isArray ? response.results : response.results[0]);
|
|
1404
1406
|
}
|
|
1405
1407
|
);
|
|
@@ -1435,7 +1437,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1435
1437
|
if (!response || !(response instanceof TranslateBrowsePathsToNodeIdsResponse)) {
|
|
1436
1438
|
return callback(new Error("Internal Error"));
|
|
1437
1439
|
}
|
|
1438
|
-
response.results = response.results || /* c8 ignore next */[];
|
|
1440
|
+
response.results = response.results || /* c8 ignore next */ [];
|
|
1439
1441
|
|
|
1440
1442
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1441
1443
|
});
|
|
@@ -1501,11 +1503,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1501
1503
|
}
|
|
1502
1504
|
this.#reprocessRequest(0, request, callback);
|
|
1503
1505
|
}
|
|
1504
|
-
#reprocessRequest(
|
|
1505
|
-
attemptCount: number,
|
|
1506
|
-
request: Request,
|
|
1507
|
-
callback: (err: Error | null, response?: Response) => void
|
|
1508
|
-
): void {
|
|
1506
|
+
#reprocessRequest(attemptCount: number, request: Request, callback: (err: Error | null, response?: Response) => void): void {
|
|
1509
1507
|
attemptCount > 0 &&
|
|
1510
1508
|
warningLog("reprocessRequest => ", request.constructor.name, this._reconnecting.pendingTransactions.length);
|
|
1511
1509
|
this._performMessageTransaction(request, (err: null | Error, response?: Response) => {
|
|
@@ -1539,7 +1537,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1539
1537
|
this.#reprocessRequest(0, request, callback);
|
|
1540
1538
|
}
|
|
1541
1539
|
});
|
|
1542
|
-
}
|
|
1540
|
+
}
|
|
1543
1541
|
|
|
1544
1542
|
public _performMessageTransaction(request: Request, callback: (err: Error | null, response?: Response) => void): void {
|
|
1545
1543
|
assert(typeof callback === "function");
|
|
@@ -1588,9 +1586,9 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1588
1586
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
1589
1587
|
err = new Error(
|
|
1590
1588
|
" ServiceResult is " +
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1589
|
+
response.responseHeader.serviceResult.toString() +
|
|
1590
|
+
" request was " +
|
|
1591
|
+
request.constructor.name
|
|
1594
1592
|
);
|
|
1595
1593
|
|
|
1596
1594
|
if (response && response.responseHeader.serviceDiagnostics) {
|
|
@@ -1723,11 +1721,13 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1723
1721
|
}
|
|
1724
1722
|
response.results = response.results || [];
|
|
1725
1723
|
|
|
1726
|
-
promoteOpaqueStructureForCall(this, response.results)
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1724
|
+
promoteOpaqueStructureForCall(this, response.results)
|
|
1725
|
+
.then(() => {
|
|
1726
|
+
callback(null, isArray ? response.results : response.results![0]);
|
|
1727
|
+
})
|
|
1728
|
+
.catch((err) => {
|
|
1729
|
+
callback(err);
|
|
1730
|
+
});
|
|
1731
1731
|
});
|
|
1732
1732
|
}
|
|
1733
1733
|
|
|
@@ -1837,7 +1837,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1837
1837
|
return callback(new Error("Internal Error"));
|
|
1838
1838
|
}
|
|
1839
1839
|
|
|
1840
|
-
response.registeredNodeIds = response.registeredNodeIds || /* c8 ignore next */[];
|
|
1840
|
+
response.registeredNodeIds = response.registeredNodeIds || /* c8 ignore next */ [];
|
|
1841
1841
|
|
|
1842
1842
|
callback(null, response.registeredNodeIds);
|
|
1843
1843
|
});
|
|
@@ -2163,7 +2163,10 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
2163
2163
|
}
|
|
2164
2164
|
}
|
|
2165
2165
|
|
|
2166
|
-
async function promoteOpaqueStructureForCallMethodResult(
|
|
2166
|
+
async function promoteOpaqueStructureForCallMethodResult(
|
|
2167
|
+
session: IBasicSessionAsync2,
|
|
2168
|
+
callMethodResult: CallMethodResult
|
|
2169
|
+
): Promise<void> {
|
|
2167
2170
|
if (!callMethodResult || !callMethodResult.outputArguments || callMethodResult.outputArguments.length === 0) {
|
|
2168
2171
|
return;
|
|
2169
2172
|
}
|
|
@@ -2193,13 +2196,16 @@ async function promoteOpaqueStructureForCall(session: IBasicSessionAsync2, callM
|
|
|
2193
2196
|
// construct dataTypeManager if not already present
|
|
2194
2197
|
await getExtraDataTypeManager(session);
|
|
2195
2198
|
|
|
2196
|
-
const promises: Promise<void>[] = callMethodResults.map(async (x: CallMethodResult) =>
|
|
2199
|
+
const promises: Promise<void>[] = callMethodResults.map(async (x: CallMethodResult) =>
|
|
2200
|
+
promoteOpaqueStructureForCallMethodResult(session, x)
|
|
2201
|
+
);
|
|
2197
2202
|
await Promise.all(promises);
|
|
2198
2203
|
}
|
|
2199
2204
|
|
|
2200
2205
|
// tslint:disable:no-var-requires
|
|
2201
2206
|
// tslint:disable:max-line-length
|
|
2202
2207
|
import { withCallback } from "thenify-ex";
|
|
2208
|
+
|
|
2203
2209
|
const opts = { multiArgs: false };
|
|
2204
2210
|
|
|
2205
2211
|
ClientSessionImpl.prototype.browse = withCallback(ClientSessionImpl.prototype.browse, opts);
|
|
@@ -2226,10 +2232,7 @@ ClientSessionImpl.prototype.republish = withCallback(ClientSessionImpl.prototype
|
|
|
2226
2232
|
ClientSessionImpl.prototype.deleteMonitoredItems = withCallback(ClientSessionImpl.prototype.deleteMonitoredItems, opts);
|
|
2227
2233
|
ClientSessionImpl.prototype.setPublishingMode = withCallback(ClientSessionImpl.prototype.setPublishingMode, opts);
|
|
2228
2234
|
ClientSessionImpl.prototype.translateBrowsePath = withCallback(ClientSessionImpl.prototype.translateBrowsePath, opts);
|
|
2229
|
-
ClientSessionImpl.prototype.performMessageTransaction = withCallback(
|
|
2230
|
-
ClientSessionImpl.prototype.performMessageTransaction,
|
|
2231
|
-
opts
|
|
2232
|
-
);
|
|
2235
|
+
ClientSessionImpl.prototype.performMessageTransaction = withCallback(ClientSessionImpl.prototype.performMessageTransaction, opts);
|
|
2233
2236
|
ClientSessionImpl.prototype.close = withCallback(ClientSessionImpl.prototype.close, opts);
|
|
2234
2237
|
ClientSessionImpl.prototype.call = withCallback(ClientSessionImpl.prototype.call, opts);
|
|
2235
2238
|
ClientSessionImpl.prototype.getMonitoredItems = withCallback(ClientSessionImpl.prototype.getMonitoredItems, opts);
|