opcua-webapi-ts 1.0.22 → 1.0.24
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/cjs/client/UaWebClient.d.ts +10 -11
- package/dist/cjs/client/UaWebClient.js +156 -174
- package/dist/cjs/client/utils/UaDataTypeDictionary.js +15 -27
- package/dist/cjs/client/utils/UaNodeReader.d.ts +1 -1
- package/dist/cjs/client/utils/UaNodeReader.js +95 -145
- package/dist/cjs/client/utils/UaObjectTypeDictionary.js +8 -15
- package/dist/cjs/client/utils/UaReferenceTypeDictionary.js +8 -15
- package/dist/cjs/common/index.d.ts +1 -1
- package/dist/cjs/common/index.js +1 -1
- package/dist/cjs/common/payload/UaBrowseDescription.d.ts +20 -0
- package/dist/cjs/common/payload/UaBrowseDescription.js +58 -0
- package/dist/cjs/common/payload/UaBrowseResult.d.ts +16 -0
- package/dist/cjs/common/payload/UaBrowseResult.js +52 -0
- package/dist/cjs/common/payload/UaCallMethodRequest.d.ts +14 -0
- package/dist/cjs/common/payload/UaCallMethodRequest.js +50 -0
- package/dist/cjs/common/payload/UaCallMethodResult.d.ts +14 -0
- package/dist/cjs/common/payload/UaCallMethodResult.js +61 -0
- package/dist/cjs/common/payload/UaHistoryReadResult.d.ts +14 -0
- package/dist/cjs/common/payload/UaHistoryReadResult.js +41 -0
- package/dist/cjs/common/payload/UaHistoryReadValueId.d.ts +14 -0
- package/dist/cjs/common/payload/UaHistoryReadValueId.js +39 -0
- package/dist/cjs/common/payload/UaPayloadMapper.d.ts +15 -0
- package/dist/cjs/common/payload/UaPayloadMapper.js +444 -0
- package/dist/cjs/common/payload/UaReadValueId.d.ts +14 -0
- package/dist/cjs/common/payload/UaReadValueId.js +39 -0
- package/dist/cjs/common/payload/UaReferenceDescription.d.ts +22 -0
- package/dist/cjs/common/payload/UaReferenceDescription.js +61 -0
- package/dist/cjs/common/payload/UaWriteValue.d.ts +16 -0
- package/dist/cjs/common/payload/UaWriteValue.js +49 -0
- package/dist/cjs/common/payload/index.d.ts +10 -0
- package/dist/cjs/common/payload/index.js +26 -0
- package/dist/cjs/common/structure/UaArgument.js +3 -3
- package/dist/cjs/common/structure/UaContentFilterElement.js +3 -3
- package/dist/cjs/common/structure/UaEUInformation.js +5 -5
- package/dist/cjs/common/structure/UaEnumValueType.js +5 -5
- package/dist/cjs/common/structure/UaHistoryData.js +3 -3
- package/dist/cjs/common/structure/UaHistoryEvent.js +3 -3
- package/dist/cjs/common/structure/UaLiteralOperand.js +3 -3
- package/dist/cjs/common/types/UaExpandedNodeId.d.ts +1 -0
- package/dist/cjs/common/types/UaExpandedNodeId.js +11 -0
- package/dist/cjs/common/types/index.d.ts +0 -1
- package/dist/cjs/common/types/index.js +0 -1
- package/dist/client/UaWebClient.d.ts +10 -11
- package/dist/client/UaWebClient.js +156 -174
- package/dist/client/utils/UaDataTypeDictionary.js +15 -27
- package/dist/client/utils/UaNodeReader.d.ts +1 -1
- package/dist/client/utils/UaNodeReader.js +95 -145
- package/dist/client/utils/UaObjectTypeDictionary.js +8 -15
- package/dist/client/utils/UaReferenceTypeDictionary.js +8 -15
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -1
- package/dist/common/payload/UaBrowseDescription.d.ts +20 -0
- package/dist/common/payload/UaBrowseDescription.js +58 -0
- package/dist/common/payload/UaBrowseResult.d.ts +16 -0
- package/dist/common/payload/UaBrowseResult.js +52 -0
- package/dist/common/payload/UaCallMethodRequest.d.ts +14 -0
- package/dist/common/payload/UaCallMethodRequest.js +50 -0
- package/dist/common/payload/UaCallMethodResult.d.ts +14 -0
- package/dist/common/payload/UaCallMethodResult.js +61 -0
- package/dist/common/payload/UaHistoryReadResult.d.ts +14 -0
- package/dist/common/payload/UaHistoryReadResult.js +41 -0
- package/dist/common/payload/UaHistoryReadValueId.d.ts +14 -0
- package/dist/common/payload/UaHistoryReadValueId.js +39 -0
- package/dist/common/payload/UaPayloadMapper.d.ts +15 -0
- package/dist/common/payload/UaPayloadMapper.js +444 -0
- package/dist/common/payload/UaReadValueId.d.ts +14 -0
- package/dist/common/payload/UaReadValueId.js +39 -0
- package/dist/common/payload/UaReferenceDescription.d.ts +22 -0
- package/dist/common/payload/UaReferenceDescription.js +61 -0
- package/dist/common/payload/UaWriteValue.d.ts +16 -0
- package/dist/common/payload/UaWriteValue.js +49 -0
- package/dist/common/payload/index.d.ts +10 -0
- package/dist/common/payload/index.js +26 -0
- package/dist/common/structure/UaArgument.js +3 -3
- package/dist/common/structure/UaContentFilterElement.js +3 -3
- package/dist/common/structure/UaEUInformation.js +5 -5
- package/dist/common/structure/UaEnumValueType.js +5 -5
- package/dist/common/structure/UaHistoryData.js +3 -3
- package/dist/common/structure/UaHistoryEvent.js +3 -3
- package/dist/common/structure/UaLiteralOperand.js +3 -3
- package/dist/common/types/UaExpandedNodeId.d.ts +1 -0
- package/dist/common/types/UaExpandedNodeId.js +11 -0
- package/dist/common/types/index.d.ts +0 -1
- package/dist/common/types/index.js +0 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DefaultApi, ViewDescription,
|
|
2
|
-
import { UaBrowseResult, UaNodeAttributes, UaVariableAttributes, UaNodeId, UaDataValue, UaVariant, UaStatusCode,
|
|
1
|
+
import { DefaultApi, ViewDescription, ApplicationDescription, BrowseDirection, EndpointDescription } from "opcua-webapi";
|
|
2
|
+
import { UaBrowseResult, UaNodeAttributes, UaVariableAttributes, UaNodeId, UaDataValue, UaVariant, UaStatusCode, UaExtensionObject, UaHistoryDataResult, UaQuery, UaObjectAttributes, UaMethodArguments, UaApplicationDescriptor, UaBrowseDescription, UaReadValueId, UaWriteValue, UaHistoryReadValueId, UaHistoryReadResult } from "../common";
|
|
3
3
|
import { UaClientConfiguration, UaClientParameters } from "..";
|
|
4
|
-
import { UaHistoryEventResult } from "../common";
|
|
4
|
+
import { UaHistoryEventResult, UaCallMethodRequest, UaCallMethodResult } from "../common";
|
|
5
5
|
export declare class UaWebClient {
|
|
6
6
|
private api;
|
|
7
7
|
private clientConfig;
|
|
@@ -15,7 +15,7 @@ export declare class UaWebClient {
|
|
|
15
15
|
browseReference(nodeId: UaNodeId, nodeClass?: number, direction?: BrowseDirection, referenceTypeId?: UaNodeId, maxReferences?: number): Promise<UaBrowseResult>;
|
|
16
16
|
browseNextByCP(continuationPoint: string): Promise<UaBrowseResult>;
|
|
17
17
|
readValues(nodeIds: Array<UaNodeId>, timestampsToReturn?: number): Promise<Array<UaDataValue>>;
|
|
18
|
-
|
|
18
|
+
writeValue(nodeId: UaNodeId, value: UaVariant): Promise<void>;
|
|
19
19
|
readNodeAttributes(nodeId: UaNodeId, returnDescription?: boolean): Promise<UaNodeAttributes>;
|
|
20
20
|
readVariableAttributes(nodeIds: Array<UaNodeId>): Promise<Array<UaVariableAttributes>>;
|
|
21
21
|
readMethodArguments(nodeId: UaNodeId): Promise<UaMethodArguments>;
|
|
@@ -25,13 +25,12 @@ export declare class UaWebClient {
|
|
|
25
25
|
historyReadRawData(nodeId: UaNodeId, startTime: Date, endTime: Date, numValuesPerNode?: number | null, continuationPoint?: string | null, returnBounds?: boolean | null, isReadModified?: boolean | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
26
26
|
historyReadAtTime(nodeId: UaNodeId, requiredTimes: Array<Date>, useSimpleBounds?: boolean | null, continuationPoint?: string | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
|
|
27
27
|
historyReadEvent(nodeId: UaNodeId, startTime: Date, endTime: Date, select: Array<string>, where?: UaQuery | null, numValuesPerNode?: number | null, continuationPoint?: string | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryEventResult>;
|
|
28
|
-
browse(nodesToBrowse: Array<
|
|
29
|
-
browseNext(continuationPoints: Array<string>, releaseContinuationPoints: boolean, additionalParameters?: UaClientParameters): Promise<Array<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
historyRead(nodesToRead: Array<HistoryReadValueId>, historyReadDetails: ExtensionObject, timestampsToReturn?: number, releaseContinuationPoints?: boolean, additionalParameters?: UaClientParameters): Promise<Array<HistoryReadResult>>;
|
|
28
|
+
browse(nodesToBrowse: Array<UaBrowseDescription>, maxReferencesPerNode?: number, view?: ViewDescription, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
|
|
29
|
+
browseNext(continuationPoints: Array<string>, releaseContinuationPoints: boolean, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
|
|
30
|
+
read(nodesToRead: Array<UaReadValueId>, timestampsToReturn?: number, maxAge?: number, additionalParameters?: UaClientParameters): Promise<Array<UaDataValue>>;
|
|
31
|
+
write(nodesToWrite: Array<UaWriteValue>, additionalParameters?: UaClientParameters): Promise<Array<UaStatusCode>>;
|
|
32
|
+
call(methodsToCall: Array<UaCallMethodRequest>, additionalParameters?: UaClientParameters): Promise<Array<UaCallMethodResult>>;
|
|
33
|
+
historyRead(nodesToRead: Array<UaHistoryReadValueId>, historyReadDetails: UaExtensionObject, timestampsToReturn?: number, releaseContinuationPoints?: boolean, additionalParameters?: UaClientParameters): Promise<Array<UaHistoryReadResult>>;
|
|
35
34
|
findServer(endpointUrl: string, serverUris: Array<string>, localeIds?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<ApplicationDescription>>;
|
|
36
35
|
getEndpoints(endpointUrl?: string, localeIds?: Array<string>, profileUris?: Array<string>, additionalParameters?: UaClientParameters): Promise<Array<EndpointDescription>>;
|
|
37
36
|
private requestHeader;
|
|
@@ -42,45 +42,31 @@ class UaWebClient {
|
|
|
42
42
|
}
|
|
43
43
|
browseChild(nodeId, nodeClass, maxReferences) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
let nodesToBrowse =
|
|
46
|
-
NodeId: nodeId.toString(),
|
|
47
|
-
BrowseDirection: opcua_webapi_1.BrowseDirection.Forward,
|
|
48
|
-
ReferenceTypeId: opcua_webapi_1.ReferenceTypeIds.HierarchicalReferences,
|
|
49
|
-
IncludeSubtypes: true,
|
|
50
|
-
NodeClassMask: (nodeClass) ? nodeClass : Number(opcua_webapi_1.NodeClass.Object | opcua_webapi_1.NodeClass.Variable | opcua_webapi_1.NodeClass.Method),
|
|
51
|
-
ResultMask: 63
|
|
52
|
-
};
|
|
45
|
+
let nodesToBrowse = new common_1.UaBrowseDescription(nodeId, opcua_webapi_1.BrowseDirection.Forward, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), true, (nodeClass) ? nodeClass : Number(opcua_webapi_1.NodeClass.Object | opcua_webapi_1.NodeClass.Variable | opcua_webapi_1.NodeClass.Method), 63);
|
|
53
46
|
let results = yield this.browse([nodesToBrowse], maxReferences);
|
|
54
|
-
let statusCode =
|
|
47
|
+
let statusCode = results[0].statusCode;
|
|
55
48
|
if (statusCode.isNotGood())
|
|
56
49
|
throw new common_1.UaError(statusCode);
|
|
57
|
-
return
|
|
50
|
+
return results[0];
|
|
58
51
|
});
|
|
59
52
|
}
|
|
60
53
|
browseReference(nodeId, nodeClass, direction, referenceTypeId, maxReferences) {
|
|
61
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
let nodesToBrowse =
|
|
63
|
-
NodeId: nodeId.toString(),
|
|
64
|
-
BrowseDirection: (direction) ? direction : opcua_webapi_1.BrowseDirection.Forward,
|
|
65
|
-
ReferenceTypeId: (referenceTypeId) ? referenceTypeId.toString() : opcua_webapi_1.ReferenceTypeIds.NonHierarchicalReferences,
|
|
66
|
-
IncludeSubtypes: true,
|
|
67
|
-
NodeClassMask: (nodeClass) ? nodeClass : Number(opcua_webapi_1.NodeClass.Object | opcua_webapi_1.NodeClass.Variable | opcua_webapi_1.NodeClass.Method),
|
|
68
|
-
ResultMask: 63
|
|
69
|
-
};
|
|
55
|
+
let nodesToBrowse = new common_1.UaBrowseDescription(nodeId, (direction) ? direction : opcua_webapi_1.BrowseDirection.Forward, (referenceTypeId) ? referenceTypeId : common_1.UaNodeId.from(common_1.ReferenceTypeIds.NonHierarchicalReferences), true, (nodeClass) ? nodeClass : Number(opcua_webapi_1.NodeClass.Object | opcua_webapi_1.NodeClass.Variable | opcua_webapi_1.NodeClass.Method), 63);
|
|
70
56
|
let results = yield this.browse([nodesToBrowse], maxReferences);
|
|
71
|
-
let statusCode =
|
|
57
|
+
let statusCode = results[0].statusCode;
|
|
72
58
|
if (statusCode.isNotGood())
|
|
73
59
|
throw new common_1.UaError(statusCode);
|
|
74
|
-
return
|
|
60
|
+
return results[0];
|
|
75
61
|
});
|
|
76
62
|
}
|
|
77
63
|
browseNextByCP(continuationPoint) {
|
|
78
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
65
|
let results = yield this.browseNext([continuationPoint], false);
|
|
80
|
-
let statusCode =
|
|
66
|
+
let statusCode = results[0].statusCode;
|
|
81
67
|
if (statusCode.isNotGood())
|
|
82
68
|
throw new common_1.UaError(statusCode);
|
|
83
|
-
return
|
|
69
|
+
return results[0];
|
|
84
70
|
});
|
|
85
71
|
}
|
|
86
72
|
readValues(nodeIds, timestampsToReturn) {
|
|
@@ -89,75 +75,51 @@ class UaWebClient {
|
|
|
89
75
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
90
76
|
let nodesToRead = [];
|
|
91
77
|
for (let item of nodeIds) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
let results = yield this.read(nodesToRead, timestampsToReturn);
|
|
95
|
-
let dataValues = [];
|
|
96
|
-
for (let item of results) {
|
|
97
|
-
dataValues.push(common_1.UaPayloadMapper.dataValueFromWebApi(item));
|
|
78
|
+
let nodeToRead = new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.Value);
|
|
79
|
+
nodesToRead.push(nodeToRead);
|
|
98
80
|
}
|
|
99
|
-
|
|
81
|
+
let results = yield this.read(nodesToRead, (timestampsToReturn) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Neither);
|
|
82
|
+
return results;
|
|
100
83
|
});
|
|
101
84
|
}
|
|
102
|
-
|
|
85
|
+
writeValue(nodeId, value) {
|
|
103
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
let variant = common_1.UaPayloadMapper.variantToWebApi(item.value);
|
|
109
|
-
writeValues.push({
|
|
110
|
-
NodeId: item.nodeId.toString(),
|
|
111
|
-
Value: {
|
|
112
|
-
UaType: variant.UaType,
|
|
113
|
-
Value: variant.Value
|
|
114
|
-
},
|
|
115
|
-
AttributeId: opcua_webapi_1.Attributes.Value
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
let results = yield this.write(writeValues);
|
|
119
|
-
let statusCodes = [];
|
|
120
|
-
for (let item of results) {
|
|
121
|
-
statusCodes.push(common_1.UaPayloadMapper.statusCodeFromWebApi(item));
|
|
122
|
-
}
|
|
123
|
-
return statusCodes;
|
|
87
|
+
let writeValue = new common_1.UaWriteValue(nodeId, value);
|
|
88
|
+
let results = yield this.write([writeValue]);
|
|
89
|
+
if (results[0].isNotGood())
|
|
90
|
+
throw new common_1.UaError(results[0]);
|
|
124
91
|
});
|
|
125
92
|
}
|
|
126
93
|
readNodeAttributes(nodeId, returnDescription) {
|
|
127
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
let nodeIdStr = nodeId.toString();
|
|
129
95
|
let nodesToRead = [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
96
|
+
new common_1.UaReadValueId(nodeId, opcua_webapi_1.Attributes.NodeClass),
|
|
97
|
+
new common_1.UaReadValueId(nodeId, opcua_webapi_1.Attributes.BrowseName),
|
|
98
|
+
new common_1.UaReadValueId(nodeId, opcua_webapi_1.Attributes.DisplayName),
|
|
99
|
+
new common_1.UaReadValueId(nodeId, opcua_webapi_1.Attributes.UserWriteMask)
|
|
134
100
|
];
|
|
135
101
|
if (returnDescription) {
|
|
136
|
-
nodesToRead.push(
|
|
102
|
+
nodesToRead.push(new common_1.UaReadValueId(nodeId, opcua_webapi_1.Attributes.Description));
|
|
137
103
|
}
|
|
138
104
|
let results = yield this.read(nodesToRead);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
throw new common_1.UaError(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
throw new common_1.UaError(dataValues[2].statusCode);
|
|
149
|
-
let nodeClassValue = dataValues[0].value;
|
|
150
|
-
let browseNameValue = dataValues[1].value;
|
|
151
|
-
let displayNameValue = dataValues[2].value;
|
|
105
|
+
if (results[0].statusCode.isNotGood())
|
|
106
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
107
|
+
if (results[1].statusCode.isNotGood())
|
|
108
|
+
throw new common_1.UaError(results[1].statusCode);
|
|
109
|
+
if (results[2].statusCode.isNotGood())
|
|
110
|
+
throw new common_1.UaError(results[2].statusCode);
|
|
111
|
+
let nodeClassValue = results[0].value;
|
|
112
|
+
let browseNameValue = results[1].value;
|
|
113
|
+
let displayNameValue = results[2].value;
|
|
152
114
|
if (common_1.UaVariantType.Int32 != nodeClassValue.type ||
|
|
153
115
|
common_1.UaVariantType.QualifiedName != browseNameValue.type ||
|
|
154
116
|
common_1.UaVariantType.LocalizedText != displayNameValue.type)
|
|
155
117
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeAttributesInvalid));
|
|
156
|
-
let writeMaskValue = (
|
|
157
|
-
|
|
118
|
+
let writeMaskValue = (results[3].statusCode.isGood() &&
|
|
119
|
+
results[3].value.type == common_1.UaVariantType.UInt32) ? results[3].value : undefined;
|
|
158
120
|
let descriptionValue = (returnDescription &&
|
|
159
|
-
|
|
160
|
-
|
|
121
|
+
results[4].statusCode.isGood() &&
|
|
122
|
+
results[4].value.type == common_1.UaVariantType.LocalizedText) ? results[4].value : undefined;
|
|
161
123
|
let ret = {
|
|
162
124
|
nodeClass: nodeClassValue.value,
|
|
163
125
|
browseName: browseNameValue.value,
|
|
@@ -174,19 +136,18 @@ class UaWebClient {
|
|
|
174
136
|
return [];
|
|
175
137
|
let nodesToRead = [];
|
|
176
138
|
for (let item of nodeIds) {
|
|
177
|
-
|
|
178
|
-
nodesToRead.push(
|
|
179
|
-
nodesToRead.push(
|
|
180
|
-
nodesToRead.push(
|
|
181
|
-
nodesToRead.push(
|
|
182
|
-
nodesToRead.push(
|
|
183
|
-
nodesToRead.push({ NodeId: nodeIdString, AttributeId: opcua_webapi_1.Attributes.Historizing });
|
|
139
|
+
nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.NodeClass));
|
|
140
|
+
nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.DataType));
|
|
141
|
+
nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.ValueRank));
|
|
142
|
+
nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.AccessLevel));
|
|
143
|
+
nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.UserAccessLevel));
|
|
144
|
+
nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.Historizing));
|
|
184
145
|
}
|
|
185
146
|
let results = yield this.read(nodesToRead);
|
|
186
147
|
let dataValues = [];
|
|
187
148
|
let ret = [];
|
|
188
149
|
for (let item of results) {
|
|
189
|
-
dataValues.push(
|
|
150
|
+
dataValues.push(item);
|
|
190
151
|
if (dataValues.length == 6) {
|
|
191
152
|
let dataType = common_1.UaNodeId.nullNodeId;
|
|
192
153
|
let valueRank = -1;
|
|
@@ -274,18 +235,13 @@ class UaWebClient {
|
|
|
274
235
|
}
|
|
275
236
|
readObjectAttributes(nodeId) {
|
|
276
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
277
|
-
let nodeIdStr = nodeId.toString();
|
|
278
238
|
let nodesToRead = [
|
|
279
|
-
|
|
239
|
+
new common_1.UaReadValueId(nodeId, opcua_webapi_1.Attributes.EventNotifier)
|
|
280
240
|
];
|
|
281
241
|
let results = yield this.read(nodesToRead);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
if (dataValues[0].statusCode.isNotGood())
|
|
287
|
-
throw new common_1.UaError(dataValues[0].statusCode);
|
|
288
|
-
let eventNotifierValue = dataValues[0].value;
|
|
242
|
+
if (results[0].statusCode.isNotGood())
|
|
243
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
244
|
+
let eventNotifierValue = results[0].value;
|
|
289
245
|
if (common_1.UaVariantType.Byte != eventNotifierValue.type)
|
|
290
246
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeAttributesInvalid));
|
|
291
247
|
let ret = {
|
|
@@ -301,36 +257,23 @@ class UaWebClient {
|
|
|
301
257
|
inputs.push(common_1.UaPayloadMapper.variantToWebApi(item));
|
|
302
258
|
}
|
|
303
259
|
let methodsToCall = [
|
|
304
|
-
|
|
260
|
+
new common_2.UaCallMethodRequest(objectId, methodId, inputArguments)
|
|
305
261
|
];
|
|
306
262
|
let results = yield this.call(methodsToCall);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
let outputs = [];
|
|
311
|
-
if (results[0].OutputArguments) {
|
|
312
|
-
for (let item of results[0].OutputArguments) {
|
|
313
|
-
outputs.push(common_1.UaPayloadMapper.variantFromWebApi(item));
|
|
314
|
-
}
|
|
315
|
-
}
|
|
263
|
+
if (results[0].statusCode.isNotGood())
|
|
264
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
265
|
+
let outputs = results[0].outputArguments;
|
|
316
266
|
return outputs;
|
|
317
267
|
});
|
|
318
268
|
}
|
|
319
269
|
getGeneratedEventType(typeId) {
|
|
320
270
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
-
let nodesToBrowse =
|
|
322
|
-
NodeId: typeId.toString(),
|
|
323
|
-
BrowseDirection: opcua_webapi_1.BrowseDirection.Forward,
|
|
324
|
-
ReferenceTypeId: opcua_webapi_1.ReferenceTypeIds.GeneratesEvent,
|
|
325
|
-
IncludeSubtypes: false,
|
|
326
|
-
NodeClassMask: opcua_webapi_1.NodeClass.ObjectType,
|
|
327
|
-
ResultMask: 0
|
|
328
|
-
};
|
|
271
|
+
let nodesToBrowse = new common_1.UaBrowseDescription(typeId, opcua_webapi_1.BrowseDirection.Forward, common_1.UaNodeId.from(common_1.ReferenceTypeIds.GeneratesEvent), false, opcua_webapi_1.NodeClass.ObjectType, 0);
|
|
329
272
|
let results = yield this.browse([nodesToBrowse]);
|
|
330
|
-
let statusCode =
|
|
273
|
+
let statusCode = results[0].statusCode;
|
|
331
274
|
if (statusCode.isNotGood())
|
|
332
275
|
throw new common_1.UaError(statusCode);
|
|
333
|
-
let browseResult =
|
|
276
|
+
let browseResult = results[0];
|
|
334
277
|
let ret = [];
|
|
335
278
|
for (let item of browseResult.results) {
|
|
336
279
|
ret.push(item.nodeId.getNodeId());
|
|
@@ -340,24 +283,18 @@ class UaWebClient {
|
|
|
340
283
|
}
|
|
341
284
|
historyReadRawData(nodeId, startTime, endTime, numValuesPerNode, continuationPoint, returnBounds, isReadModified, timestampsToReturn, releaseContinuationPoints) {
|
|
342
285
|
return __awaiter(this, void 0, void 0, function* () {
|
|
343
|
-
let nodeToRead =
|
|
344
|
-
NodeId: nodeId.toString(),
|
|
345
|
-
ContinuationPoint: (continuationPoint) ? continuationPoint : undefined
|
|
346
|
-
};
|
|
286
|
+
let nodeToRead = new common_1.UaHistoryReadValueId(nodeId, continuationPoint);
|
|
347
287
|
let details = new common_2.UaReadRawModifiedDetails(startTime, endTime, numValuesPerNode, returnBounds, isReadModified);
|
|
348
|
-
let historyReadDetails =
|
|
288
|
+
let historyReadDetails = details.toExtensionObject();
|
|
349
289
|
let nodesToRead = [nodeToRead];
|
|
350
290
|
let results = yield this.historyRead(nodesToRead, historyReadDetails, timestampsToReturn, releaseContinuationPoints);
|
|
351
|
-
if (results.
|
|
352
|
-
throw new common_1.UaError(
|
|
353
|
-
let
|
|
354
|
-
if (statusCode.isNotGood())
|
|
355
|
-
throw new common_1.UaError(statusCode);
|
|
356
|
-
let extensionObject = common_1.UaPayloadMapper.extensionObjectFromWebApi(results[0].HistoryData);
|
|
291
|
+
if (results[0].statusCode.isNotGood())
|
|
292
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
293
|
+
let extensionObject = results[0].historyData;
|
|
357
294
|
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
358
295
|
if (null == historyData)
|
|
359
296
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
360
|
-
let ret = new common_1.UaHistoryDataResult(historyData.dataValues, results[0].
|
|
297
|
+
let ret = new common_1.UaHistoryDataResult(historyData.dataValues, results[0].continuationPoint);
|
|
361
298
|
return ret;
|
|
362
299
|
});
|
|
363
300
|
}
|
|
@@ -365,24 +302,18 @@ class UaWebClient {
|
|
|
365
302
|
return __awaiter(this, void 0, void 0, function* () {
|
|
366
303
|
if (requiredTimes.length == 0)
|
|
367
304
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadInvalidArgument));
|
|
368
|
-
let nodeToRead =
|
|
369
|
-
NodeId: nodeId.toString(),
|
|
370
|
-
ContinuationPoint: (continuationPoint) ? continuationPoint : undefined
|
|
371
|
-
};
|
|
305
|
+
let nodeToRead = new common_1.UaHistoryReadValueId(nodeId, continuationPoint);
|
|
372
306
|
let details = new common_2.UaReadAtTimeDetails(requiredTimes, useSimpleBounds);
|
|
373
|
-
let historyReadDetails =
|
|
307
|
+
let historyReadDetails = details.toExtensionObject();
|
|
374
308
|
let nodesToRead = [nodeToRead];
|
|
375
309
|
let results = yield this.historyRead(nodesToRead, historyReadDetails, timestampsToReturn, releaseContinuationPoints);
|
|
376
|
-
if (results.
|
|
377
|
-
throw new common_1.UaError(
|
|
378
|
-
let
|
|
379
|
-
if (statusCode.isNotGood())
|
|
380
|
-
throw new common_1.UaError(statusCode);
|
|
381
|
-
let extensionObject = common_1.UaPayloadMapper.extensionObjectFromWebApi(results[0].HistoryData);
|
|
310
|
+
if (results[0].statusCode.isNotGood())
|
|
311
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
312
|
+
let extensionObject = results[0].historyData;
|
|
382
313
|
let historyData = common_1.UaHistoryData.fromExtensionObject(extensionObject);
|
|
383
314
|
if (null == historyData)
|
|
384
315
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
385
|
-
let ret = new common_1.UaHistoryDataResult(historyData.dataValues, results[0].
|
|
316
|
+
let ret = new common_1.UaHistoryDataResult(historyData.dataValues, results[0].continuationPoint);
|
|
386
317
|
return ret;
|
|
387
318
|
});
|
|
388
319
|
}
|
|
@@ -390,10 +321,7 @@ class UaWebClient {
|
|
|
390
321
|
return __awaiter(this, void 0, void 0, function* () {
|
|
391
322
|
if (select.length == 0)
|
|
392
323
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadInvalidArgument));
|
|
393
|
-
let nodeToRead =
|
|
394
|
-
NodeId: nodeId.toString(),
|
|
395
|
-
ContinuationPoint: (continuationPoint) ? continuationPoint : undefined
|
|
396
|
-
};
|
|
324
|
+
let nodeToRead = new common_1.UaHistoryReadValueId(nodeId, continuationPoint);
|
|
397
325
|
let selectClauses = [];
|
|
398
326
|
let whereClauses = (where) ? where.toContentFilter() : null;
|
|
399
327
|
for (let item of select) {
|
|
@@ -401,19 +329,16 @@ class UaWebClient {
|
|
|
401
329
|
selectClauses.push(selectedField);
|
|
402
330
|
}
|
|
403
331
|
let details = new common_1.UaReadEventDetails(startTime, endTime, new common_1.UaEventFilter(selectClauses, whereClauses), numValuesPerNode);
|
|
404
|
-
let historyReadDetails =
|
|
332
|
+
let historyReadDetails = details.toExtensionObject();
|
|
405
333
|
let nodesToRead = [nodeToRead];
|
|
406
334
|
let results = yield this.historyRead(nodesToRead, historyReadDetails, opcua_webapi_1.TimestampsToReturn.Both, releaseContinuationPoints);
|
|
407
|
-
if (results.
|
|
408
|
-
throw new common_1.UaError(
|
|
409
|
-
let
|
|
410
|
-
if (statusCode.isNotGood())
|
|
411
|
-
throw new common_1.UaError(statusCode);
|
|
412
|
-
let extensionObject = common_1.UaPayloadMapper.extensionObjectFromWebApi(results[0].HistoryData);
|
|
335
|
+
if (results[0].statusCode.isNotGood())
|
|
336
|
+
throw new common_1.UaError(results[0].statusCode);
|
|
337
|
+
let extensionObject = results[0].historyData;
|
|
413
338
|
let historyData = common_2.UaHistoryEvent.fromExtensionObject(extensionObject);
|
|
414
339
|
if (null == historyData)
|
|
415
340
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
416
|
-
let ret = new common_2.UaHistoryEventResult(historyData.events, results[0].
|
|
341
|
+
let ret = new common_2.UaHistoryEventResult(historyData.events, results[0].continuationPoint);
|
|
417
342
|
return ret;
|
|
418
343
|
});
|
|
419
344
|
}
|
|
@@ -421,9 +346,15 @@ class UaWebClient {
|
|
|
421
346
|
browse(nodesToBrowse, maxReferencesPerNode, view, additionalParameters) {
|
|
422
347
|
return __awaiter(this, void 0, void 0, function* () {
|
|
423
348
|
var _a, _b;
|
|
349
|
+
if (nodesToBrowse.length == 0)
|
|
350
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
351
|
+
let NodesToBrowse = [];
|
|
352
|
+
for (let item of nodesToBrowse) {
|
|
353
|
+
NodesToBrowse.push(item.toStruct());
|
|
354
|
+
}
|
|
424
355
|
let request = (0, opcua_webapi_1.BrowseRequestFromJSON)({
|
|
425
356
|
RequestHeader: this.requestHeader(this.clientConfig, additionalParameters),
|
|
426
|
-
NodesToBrowse:
|
|
357
|
+
NodesToBrowse: NodesToBrowse,
|
|
427
358
|
RequestedMaxReferencesPerNode: (maxReferencesPerNode && maxReferencesPerNode > 0) ? maxReferencesPerNode : undefined,
|
|
428
359
|
View: view
|
|
429
360
|
});
|
|
@@ -432,12 +363,23 @@ class UaWebClient {
|
|
|
432
363
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
433
364
|
if (!response.Results || nodesToBrowse.length != response.Results.length)
|
|
434
365
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
435
|
-
|
|
366
|
+
let results = [];
|
|
367
|
+
if (response.Results) {
|
|
368
|
+
for (let item of response.Results) {
|
|
369
|
+
let result = common_1.UaBrowseResult.fromStruct(item);
|
|
370
|
+
if (null == result)
|
|
371
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
372
|
+
results.push(result);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return results;
|
|
436
376
|
});
|
|
437
377
|
}
|
|
438
378
|
browseNext(continuationPoints, releaseContinuationPoints, additionalParameters) {
|
|
439
379
|
return __awaiter(this, void 0, void 0, function* () {
|
|
440
380
|
var _a, _b;
|
|
381
|
+
if (continuationPoints.length == 0)
|
|
382
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
441
383
|
let request = (0, opcua_webapi_1.BrowseNextRequestFromJSON)({
|
|
442
384
|
RequestHeader: this.requestHeader(this.clientConfig, additionalParameters),
|
|
443
385
|
ContinuationPoints: continuationPoints,
|
|
@@ -448,91 +390,131 @@ class UaWebClient {
|
|
|
448
390
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
449
391
|
if (!response.Results || continuationPoints.length != response.Results.length)
|
|
450
392
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
BrowsePaths: browsePaths
|
|
460
|
-
});
|
|
461
|
-
let response = yield this.api.translateBrowsePathsToNodeIds({ translateBrowsePathsToNodeIdsRequest: request });
|
|
462
|
-
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
463
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
464
|
-
if (!response.Results || browsePaths.length != response.Results.length)
|
|
465
|
-
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadUnknownResponse));
|
|
466
|
-
return response.Results;
|
|
393
|
+
let results = [];
|
|
394
|
+
for (let item of response.Results) {
|
|
395
|
+
let result = common_1.UaBrowseResult.fromStruct(item);
|
|
396
|
+
if (null == result)
|
|
397
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
398
|
+
results.push(result);
|
|
399
|
+
}
|
|
400
|
+
return results;
|
|
467
401
|
});
|
|
468
402
|
}
|
|
469
403
|
read(nodesToRead, timestampsToReturn, maxAge, additionalParameters) {
|
|
470
404
|
return __awaiter(this, void 0, void 0, function* () {
|
|
471
405
|
var _a, _b;
|
|
406
|
+
if (nodesToRead.length == 0)
|
|
407
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
408
|
+
let NodesToRead = [];
|
|
409
|
+
for (let item of nodesToRead) {
|
|
410
|
+
NodesToRead.push(item.toStruct());
|
|
411
|
+
}
|
|
472
412
|
let request = (0, opcua_webapi_1.ReadRequestFromJSON)({
|
|
473
413
|
RequestHeader: this.requestHeader(this.clientConfig, additionalParameters),
|
|
474
|
-
NodesToRead:
|
|
414
|
+
NodesToRead: NodesToRead,
|
|
475
415
|
MaxAge: (maxAge && maxAge > 0) ? maxAge : undefined,
|
|
476
416
|
TimestampsToReturn: (timestampsToReturn &&
|
|
477
417
|
timestampsToReturn >= opcua_webapi_1.TimestampsToReturn.Source &&
|
|
478
|
-
timestampsToReturn < opcua_webapi_1.TimestampsToReturn.Invalid) ? timestampsToReturn :
|
|
418
|
+
timestampsToReturn < opcua_webapi_1.TimestampsToReturn.Invalid) ? timestampsToReturn : opcua_webapi_1.TimestampsToReturn.Neither
|
|
479
419
|
});
|
|
480
420
|
let response = yield this.api.read({ readRequest: request });
|
|
481
421
|
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
482
422
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
483
423
|
if (!response.Results || nodesToRead.length != response.Results.length)
|
|
484
424
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
485
|
-
|
|
425
|
+
let results = [];
|
|
426
|
+
for (let item of response.Results) {
|
|
427
|
+
let result = common_1.UaPayloadMapper.dataValueFromWebApi(item);
|
|
428
|
+
results.push(result);
|
|
429
|
+
}
|
|
430
|
+
return results;
|
|
486
431
|
});
|
|
487
432
|
}
|
|
488
433
|
write(nodesToWrite, additionalParameters) {
|
|
489
434
|
return __awaiter(this, void 0, void 0, function* () {
|
|
490
435
|
var _a, _b;
|
|
436
|
+
if (nodesToWrite.length == 0)
|
|
437
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
438
|
+
let NodesToWrite = [];
|
|
439
|
+
for (let item of nodesToWrite) {
|
|
440
|
+
NodesToWrite.push(item.toStruct());
|
|
441
|
+
}
|
|
491
442
|
let request = (0, opcua_webapi_1.WriteRequestFromJSON)({
|
|
492
443
|
RequestHeader: this.requestHeader(this.clientConfig, additionalParameters),
|
|
493
|
-
NodesToWrite:
|
|
444
|
+
NodesToWrite: NodesToWrite
|
|
494
445
|
});
|
|
495
446
|
let response = yield this.api.write({ writeRequest: request });
|
|
496
447
|
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
497
448
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
498
449
|
if (!response.Results || nodesToWrite.length != response.Results.length)
|
|
499
450
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
500
|
-
|
|
451
|
+
let results = [];
|
|
452
|
+
for (let item of response.Results) {
|
|
453
|
+
let result = common_1.UaPayloadMapper.statusCodeFromWebApi(item);
|
|
454
|
+
results.push(result);
|
|
455
|
+
}
|
|
456
|
+
return results;
|
|
501
457
|
});
|
|
502
458
|
}
|
|
503
459
|
call(methodsToCall, additionalParameters) {
|
|
504
460
|
return __awaiter(this, void 0, void 0, function* () {
|
|
505
461
|
var _a, _b;
|
|
462
|
+
if (methodsToCall.length == 0)
|
|
463
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
464
|
+
let MethodsToCall = [];
|
|
465
|
+
for (let item of methodsToCall) {
|
|
466
|
+
MethodsToCall.push(item.toStruct());
|
|
467
|
+
}
|
|
506
468
|
let request = (0, opcua_webapi_1.CallRequestFromJSON)({
|
|
507
469
|
RequestHeader: this.requestHeader(this.clientConfig, additionalParameters),
|
|
508
|
-
MethodsToCall:
|
|
470
|
+
MethodsToCall: MethodsToCall
|
|
509
471
|
});
|
|
510
472
|
let response = yield this.api.call({ callRequest: request });
|
|
511
473
|
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
512
474
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
513
475
|
if (!response.Results || methodsToCall.length != response.Results.length)
|
|
514
476
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
515
|
-
|
|
477
|
+
let results = [];
|
|
478
|
+
for (let item of response.Results) {
|
|
479
|
+
let result = common_2.UaCallMethodResult.fromStruct(item);
|
|
480
|
+
if (null == result)
|
|
481
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
482
|
+
results.push(result);
|
|
483
|
+
}
|
|
484
|
+
return results;
|
|
516
485
|
});
|
|
517
486
|
}
|
|
518
487
|
historyRead(nodesToRead, historyReadDetails, timestampsToReturn, releaseContinuationPoints, additionalParameters) {
|
|
519
488
|
return __awaiter(this, void 0, void 0, function* () {
|
|
520
489
|
var _a, _b;
|
|
490
|
+
if (nodesToRead.length == 0)
|
|
491
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNothingToDo));
|
|
492
|
+
let NodesToRead = [];
|
|
493
|
+
for (let item of nodesToRead) {
|
|
494
|
+
NodesToRead.push(item.toStruct());
|
|
495
|
+
}
|
|
521
496
|
let request = (0, opcua_webapi_1.HistoryReadRequestFromJSON)({
|
|
522
497
|
RequestHeader: this.requestHeader(this.clientConfig, additionalParameters),
|
|
523
|
-
HistoryReadDetails: historyReadDetails,
|
|
498
|
+
HistoryReadDetails: common_1.UaPayloadMapper.extensionObjectToWebApi(historyReadDetails),
|
|
524
499
|
TimestampsToReturn: (timestampsToReturn &&
|
|
525
500
|
timestampsToReturn >= opcua_webapi_1.TimestampsToReturn.Source &&
|
|
526
501
|
timestampsToReturn < opcua_webapi_1.TimestampsToReturn.Invalid) ? timestampsToReturn : undefined,
|
|
527
502
|
ReleaseContinuationPoints: releaseContinuationPoints,
|
|
528
|
-
NodesToRead:
|
|
503
|
+
NodesToRead: NodesToRead
|
|
529
504
|
});
|
|
530
505
|
let response = yield this.api.historyRead({ historyReadRequest: request });
|
|
531
506
|
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.ResponseHeader) === null || _a === void 0 ? void 0 : _a.ServiceResult) === null || _b === void 0 ? void 0 : _b.Code)
|
|
532
507
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(response.ResponseHeader.ServiceResult.Code));
|
|
533
508
|
if (!response.Results || nodesToRead.length != response.Results.length)
|
|
534
509
|
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDataLost));
|
|
535
|
-
|
|
510
|
+
let results = [];
|
|
511
|
+
for (let item of response.Results) {
|
|
512
|
+
let result = common_1.UaHistoryReadResult.fromStruct(item);
|
|
513
|
+
if (null == result)
|
|
514
|
+
throw new common_1.UaError((0, common_1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadDecodingError));
|
|
515
|
+
results.push(result);
|
|
516
|
+
}
|
|
517
|
+
return results;
|
|
536
518
|
});
|
|
537
519
|
}
|
|
538
520
|
findServer(endpointUrl, serverUris, localeIds, additionalParameters) {
|